﻿Type.registerNamespace('Inductronic');Inductronic.PictureGalleryEventArgs = function(context,key) {
Inductronic.PictureGalleryEventArgs.initializeBase(this);this._context = context;this._key = key;}
Inductronic.PictureGalleryEventArgs.prototype = {
get_context : function() {
return this._context;}, 
get_key : function() {
return this._key;}
}
Inductronic.PictureGalleryEventArgs.registerClass('Inductronic.PictureGalleryEventArgs', Sys.CancelEventArgs);Inductronic.PictureGalleryStyle = function() {
}
Inductronic.PictureGalleryStyle.prototype = {
Grid : 0,
Carousel : 1,
Mosaic : 2
}
Inductronic.PictureGalleryStyle.registerEnum('Inductronic.PictureGalleryStyle', false);Inductronic.IPictureGalleryView = function() {
}
Inductronic.IPictureGalleryView.prototype = {
get_currentBehavior : function() { throw Error.notImplemented();},
get_gallery : function() { throw Error.notImplemented();},
set_gallery : function(value) { throw Error.notImplemented();},
get_displayPerPage : function() { throw Error.notImplemented();},
set_displayPerPage : function(value) { throw Error.notImplemented();},
get_imageRecipe : function() { throw Error.notImplemented();},
set_imageRecipe : function(value) { throw Error.notImplemented();}, 
activateView : function(selectedKey,refresh) { throw Error.notImplemented();},
deactivateView : function(refresh) { throw Error.notImplemented();},
showNext : function() { throw Error.notImplemented();},
showPrevious : function() { throw Error.notImplemented();},
rotateImage : function(key) { throw Error.notImplemented();},
deleteImage : function(key) { throw Error.notImplemented();},
sortView : function(selectedKey) { throw Error.notImplemented();}
}
Inductronic.IPictureGalleryView.registerInterface('Inductronic.IPictureGalleryView');////////////////////////////////////////////////////////////////////////
Inductronic.CarouselViewBehavior = function(element) {
Inductronic.CarouselViewBehavior.initializeBase(this, [element]);this._refresh = false;this._gallery = null;this._eventsAttached = false;this._scrollbarBehavior = null;this._onNextClickDelegate = null;this._onPreviousClickDelegate = null;this._onImageClickExternalDelegate = null;this._onSliderStartDelegate = null;this._onSliderSlideDelegate = null;this._onSliderEndDelegate = null;this._currentBehaviour = null;this._preloadImageUrl = '';this._list = null;this._imageBehaviours = null;this._imageWidth = 233;this._imageHeight = 175;this._isDragging = false;this._currentPosition = 0;this._targetPosition = 0;this._timer = false;this._imageRecipe = '';this._handleImageUrl = '';this._previousLink = null;this._nextLink = null;this._nextImageUrl = '';this._previousImageUrl = '';this._selectedKey = null;}
Inductronic.CarouselViewBehavior.prototype = {
initialize : function() {
Inductronic.CarouselViewBehavior.callBaseMethod(this, 'initialize');var el = this.get_element();this._list = document.createElement('div');el.appendChild(this._list);Sys.UI.DomElement.addCssClass(this._list, 'images');var scrollbarElement = document.createElement('div');scrollbarElement.id = this._generateId('scrollbar');el.appendChild(scrollbarElement);Sys.UI.DomElement.addCssClass(scrollbarElement, 'scrollbar');var previousDiv = document.createElement('div');scrollbarElement.appendChild(previousDiv);Sys.UI.DomElement.addCssClass(previousDiv, 'arrow first');this._previousLink = document.createElement('a');previousDiv.appendChild(this._previousLink);var previousImage = document.createElement('img');this._previousLink.appendChild(previousImage);previousImage.src = this._previousImageUrl;previousImage.alt = '';this._handleDelegates(true);this._scrollbarBehavior = $create(Inductronic.SliderBehavior, { id: scrollbarElement.id, tooltipText: this._gallery.get_sliderTooltip(), enableHandleAnimation : true, railCssClass: 'rail' , handleCssClass: 'handle', handleImageUrl : this._handleImageUrl }, { valueChanged: this._onSliderSlideDelegate, slideStart: this._onSliderStartDelegate, slideEnd: this._onSliderEndDelegate}, null, scrollbarElement);var nextDiv = document.createElement('div');scrollbarElement.appendChild(nextDiv);Sys.UI.DomElement.addCssClass(nextDiv, 'arrow last');this._nextLink = document.createElement('a');nextDiv.appendChild(this._nextLink);var nextImage = document.createElement('img');this._nextLink.appendChild(nextImage);nextImage.src = this._nextImageUrl;nextImage.alt = '';var clearDiv = document.createElement('div');scrollbarElement.appendChild(clearDiv);Sys.UI.DomElement.addCssClass(clearDiv, 'clear');this._handleEvents(true);}, 
dispose : function() {
$clearHandlers(this.get_element());if(this._scrollbarBehavior)
{
this._scrollbarBehavior.remove_valueChanged( this._onSliderSlideDelegate );this._scrollbarBehavior.remove_slideStart( this._onSliderStartDelegate );this._scrollbarBehavior.remove_slideEnd( this._onSliderEndDelegate );this._scrollbarBehavior = null;}
this._handleEvents(false);this._handleDelegates(false);Inductronic.CarouselViewBehavior.callBaseMethod(this, 'dispose');},
get_applicationManager: function()
{
return Inductronic.ApplicationManagerBehavior.getInstance();},
_handleDelegates : function(attach)
{
if(attach == true)
{ 
if( this._onImageClickExternalDelegate === null)
{
this._onImageClickExternalDelegate = Function.createDelegate(this, this._onImageClickExternalEvent );} 
if( this._onSliderStartDelegate === null )
{
this._onSliderStartDelegate = Function.createDelegate(this, this._onSliderStartEvent);} 
if( this._onSliderEndDelegate === null )
{
this._onSliderEndDelegate = Function.createDelegate(this, this._onSliderEndEvent);} 
if( this._onSliderSlideDelegate === null )
{
this._onSliderSlideDelegate = Function.createDelegate(this, this._onSliderSlideEvent );}
if( this._onNextClickDelegate === null )
{
this._onNextClickDelegate = Function.createDelegate(this, this._onNextClickEvent );}
if( this._onPreviousClickDelegate === null )
{
this._onPreviousClickDelegate = Function.createDelegate(this, this._onPreviousClickEvent );}
}
else
{ 
if( this._onImageClickExternalDelegate )
{
delete this._onImageClickExternalDelegate;this._onImageClickExternalDelegate = null;} 
if (this._onSliderSlideDelegate) {
delete this._onSliderSlideDelegate;this._onSliderSlideDelegate = null;} 
if (this._onSliderStartDelegate) {
delete this._onSliderStartDelegate;this._onSliderStartDelegate = null;} 
if (this._onSliderEndDelegate) {
delete this._onSliderEndDelegate;this._onSliderEndDelegate = null;} 
if (this._onNextClickDelegate) {
delete this._onNextClickDelegate;this._onNextClickDelegate = null;} 
if (this._onPreviousClickDelegate) {
delete this._onPreviousClickDelegate;this._onPreviousClickDelegate = null;} 
} 
},
_handleEvents : function(attach)
{ 
if(attach === true && this._eventsAttached === false)
{ 
this._eventsAttached = true;$addHandler(this._nextLink, 'click',this._onNextClickDelegate);$addHandler(this._previousLink, 'click',this._onPreviousClickDelegate);}
else if( this._eventsAttached === true )
{ 
$removeHandler(this._nextLink, 'click',this._onNextClickDelegate);$removeHandler(this._previousLink, 'click',this._onPreviousClickDelegate);this._eventsAttached = false;} 
},
_generateId : function(id)
{
return this.get_id() + '_' + id;}, 
_hide : function(element)
{
$common.setVisible(element, false);}, 
_show : function(element)
{
$common.setVisible(element, true);},
_animate : function ()
{
var self = this;if( this._targetPosition < this._currentPosition - 1 || this._targetPosition > this._currentPosition + 1 ) 
{
this._moveImages(this._currentPosition + (this._targetPosition - this._currentPosition)/3);window.setTimeout( function() { self._animate();}, 50);this._timer = true;}
else
{
this._isDragging = false;this._timer = false;}
},
_startAnimation : function(x)
{
this._targetPosition = x;if (this._timer === false)
{
var self = this;window.setTimeout( function() { self._animate();}, 50);this._timer = true;}
if (this._isDragging == false)
{
var newValue = x != 0 ? parseInt(x / -150) + 1 : 1;this._scrollbarBehavior.set_value(newValue);} 
}, 
_isCurrent : function(x)
{
if( this._targetPosition < x - 1 || this._targetPosition > x + 1 ) 
return false;else
return true;},
_moveImages : function(x)
{
this._currentPosition = x;var index = 0;var count = this._imageBehaviours.length;var zIndex = count;var galleryHalfWidth = this._list.offsetWidth * 0.5;var visibleImagesLeftAndRight = 600;var reflectionHeightPercent = 0.2;var behaviour = null;var behaviourElement = null;var currentId = 0;var imageSizePercent = 0;var z = 0;var xs = 0;var finalImageHeight = 0;var finalImageTop = 0;var aspect = this._imageHeight / this._imageWidth;for(var i = 0;i < count;i++ )
{
behaviour = this._imageBehaviours[i];behaviourElement = behaviour.get_element();currentId = behaviour.get_animationId();if ( ( currentId + visibleImagesLeftAndRight ) < this._targetPosition || ( currentId - visibleImagesLeftAndRight ) > this._targetPosition )
{ 
behaviour.hideImage();}
else 
{
if(this._isCurrent(currentId))
{
this._currentBehaviour = behaviour;behaviour.select();imageSizePercent = 118;}
else
{
behaviour.deselect();imageSizePercent = 100;}
z = Math.sqrt(10000 + x * x) + 100;xs = x / z * galleryHalfWidth + galleryHalfWidth;finalImageHeight = (aspect * imageSizePercent) / z * galleryHalfWidth;finalImageTop = (((this._list.offsetHeight+this._list.offsetTop) / 2) - finalImageHeight) + this._list.offsetTop + ((finalImageHeight / (reflectionHeightPercent + 1)) * reflectionHeightPercent);behaviourElement.style.left = xs - (imageSizePercent / 2) / z * galleryHalfWidth + this._list.offsetLeft + 'px';behaviourElement.style.height = finalImageHeight + 'px';behaviourElement.style.width = '';behaviourElement.style.top = finalImageTop + 'px';if( x < 0) 
{
zIndex++;}
else
{ 
zIndex--;}
behaviourElement.style.zIndex = zIndex;behaviour.update(true);}
x += 150;index++;}
}, 
_initializeSlider : function()
{
var count = this._imageBehaviours.length;this._scrollbarBehavior.set_minimum(1);this._scrollbarBehavior.set_maximum(count);this._scrollbarBehavior.set_steps(count);}, 
_isInitialized : function() {
return (this._imageBehaviours != null);},
_findByKey : function(key)
{
var count = this._imageBehaviours.length;var behaviour = null;for(var i = 0;i < count;i++ )
{
behaviour = this._imageBehaviours[i];if(behaviour.get_key() == key)
{
break;}
} 
return behaviour;},
_findIndexByKey : function(key)
{
var i = -1;var count = this._imageBehaviours.length;var behaviour = null;for(i = 0;i < count;i++ )
{
behaviour = this._imageBehaviours[i];if(behaviour.get_key() == key)
{
break;}
} 
return i;},
_create: function(refresh) {
var applicationManager = this.get_applicationManager();if(this._imageBehaviours == null)
{
this._imageBehaviours = new Array();var images = applicationManager.get_imageArray();var length = images.length;var count = 0;for(var i = 0;i < length;i++ )
{ 
var imageInformation = images[i];var behaviourElement = document.createElement('img');behaviourElement.id = this._generateId('im_' + i.toString());this._list.appendChild(behaviourElement);var dragBehavior = $create(Inductronic.PictureGalleryDragSourceBehavior, { id: behaviourElement.id, key: imageInformation.Key, imageUrl: applicationManager.createImageUrl(imageInformation.Key, this._imageRecipe), animationId: count, preloadImageUrl: this._gallery.get_preloadImageUrl() }, { imageClick: this._onImageClickExternalDelegate }, null, behaviourElement);this._imageBehaviours.push(dragBehavior);dragBehavior.hideImage();count = count - 150;}
this._initializeSlider();} else {
var images = applicationManager.get_imageArray();var length = images.length;var count = this._imageBehaviours.length;var newLength = this._imageBehaviours.length + ( images.length - this._imageBehaviours.length);for(var i = this._imageBehaviours.length;i < newLength;i++ )
{ 
var imageInformation = images[i];var behaviourElement = document.createElement('img');behaviourElement.id = this._generateId('im_' + i.toString());this._list.appendChild(behaviourElement);var dragBehavior = $create(Inductronic.PictureGalleryDragSourceBehavior, { id: behaviourElement.id, key: imageInformation.Key, imageUrl: applicationManager.createImageUrl(imageInformation.Key, this._imageRecipe), animationId: count, preloadImageUrl: this._gallery.get_preloadImageUrl() }, { imageClick: this._onImageClickExternalDelegate }, null, behaviourElement);this._imageBehaviours.push(dragBehavior);dragBehavior.hideImage();count = count - 150;}
this._initializeSlider();}
},
_onRefresh : function(animate,selectedKey,refresh)
{ 
if(selectedKey != null && selectedKey.length > 0)
{
var behaviour = this._findByKey(selectedKey);this._targetPosition = behaviour.get_animationId();this._currentPosition += 2;} else {
this._currentPosition += 2;}
this._selectedKey = selectedKey;if(refresh == true) {
this.sortView(this._selectedKey);} else if(animate === true) { 
this._startAnimation(this._targetPosition);}
else
{
this._moveImages(this._targetPosition);}
}, 
_onImageClickExternalEvent : function(sender,args)
{
var behaviour = null;behaviour = this._findByKey(args.get_key());var isCurrent = this._isCurrent(behaviour.get_animationId());if(behaviour != null && isCurrent === false )
{
this._startAnimation(behaviour.get_animationId());}
else if(behaviour != null && isCurrent === true )
{
this._raiseEvent('imageClick', args);}
}, 
_onSliderStartEvent : function(evt) 
{
this._isDragging = true;}, 
_onSliderEndEvent : function(evt) 
{
}, 
_onSliderSlideEvent : function(evt) 
{ 
if(this._isDragging)
{
this._startAnimation((this._scrollbarBehavior.get_value()-1)*-150);}
}, 
_onPreviousClickEvent : function(evt) 
{ 
evt.preventDefault();this.showPrevious();},
_onNextClickEvent : function(evt) 
{ 
evt.preventDefault();this.showNext();},
add_imageClick : function(handler) {
this.get_events().addHandler('imageClick', handler);}, 
remove_imageClick : function(handler) {
this.get_events().removeHandler('imageClick', handler);}, 
_raiseEvent : function(eventName, eventArgs) { 
var handler = this.get_events().getHandler(eventName);if (handler) { 
if (!eventArgs) { 
eventArgs = Sys.EventArgs.Empty;} 
handler(this, eventArgs);} 
}, 
get_handleImageUrl : function() {
return this._handleImageUrl ;}, 
set_handleImageUrl : function(value) { 
var e = Function._validateParams(arguments, [{name: 'value', type: String }]);if (e) throw e;if (this._handleImageUrl != value) {
this._handleImageUrl = value;this.raisePropertyChanged('handleImageUrl');}
},
get_nextImageUrl : function() {
return this._nextImageUrl;}, 
set_nextImageUrl : function(value) {
var e = Function._validateParams(arguments, [{name: 'value', type: String}]);if (e) throw e;if (this._nextImageUrl != value) {
this._nextImageUrl = value;this.raisePropertyChanged('nextImageUrl');}
},
get_previousImageUrl : function() {
return this._previousImageUrl;}, 
set_previousImageUrl : function(value) {
var e = Function._validateParams(arguments, [{name: 'value', type: String}]);if (e) throw e;if (this._previousImageUrl != value) {
this._previousImageUrl = value;this.raisePropertyChanged('previousImageUrl');}
}, 
get_currentBehavior : function() { 
return this._currentBehaviour;},
get_gallery : function() {
return this._gallery;}, 
set_gallery : function(value) { 
var e = Function._validateParams(arguments, [{name: 'value', type: Object }]);if (e) throw e;if (this._gallery != value) {
this._gallery = value;this.raisePropertyChanged('gallery');}
},
get_displayPerPage : function() { },
set_displayPerPage : function(value) { }, 
get_imageRecipe : function() {
return this._imageRecipe;}, 
set_imageRecipe : function(value) { 
var e = Function._validateParams(arguments, [{name: 'value', type: String }]);if (e) throw e;if (this._imageRecipe != value) {
this._imageRecipe = value;this.raisePropertyChanged('imageRecipe');}
},
activateView : function(selectedKey,refresh) { 
if(this._refresh == true && refresh == false) {
refresh = this._refresh;this._refresh = false;}
this._create(refresh);var el = this.get_element();if(!$common.getVisible(el))
{
$common.setVisible(el,true);}
this._onRefresh(this._selectedKey != selectedKey && selectedKey != null,selectedKey,refresh);}, 
deactivateView : function(refresh) { 
var el = this.get_element();this._refresh = refresh;if($common.getVisible(el))
{
$common.setVisible(el,false);}
},
showNext : function() {
if(this._isInitialized())
{
this._isDragging = true;this._scrollbarBehavior.set_value(this._scrollbarBehavior.get_value()+1);}
},
showPrevious : function() { 
if(this._isInitialized())
{
this._isDragging = true;this._scrollbarBehavior.set_value(this._scrollbarBehavior.get_value()-1);}
},
rotateImage : function(key) { 
if(this._isInitialized())
{ 
var behaviour = this._findByKey(key);if(behaviour != null)
{
behaviour.set_imageUrl(this.get_applicationManager().createImageUrl(behaviour.get_key(), this._gallery.get_carouselImageRecipe()));behaviour.update();}
}
},
deleteImage : function(key) {
if(this._isInitialized())
{
var i = 0;var count = 0;var behaviour = this._findByKey(key);this._currentBehaviour = null;if(behaviour)
{ 
var index = this._findIndexByKey(behaviour.get_key());this._imageBehaviours.splice(index,1);this._list.removeChild(behaviour.get_element());delete behaviour;}
var size = this._imageBehaviours.length;for(i = 0;i < size;i++ )
{
behaviour = this._imageBehaviours[i];behaviour.set_animationId(count);count = count - 150;} 
this._targetPosition += 150;if(this._targetPosition > 0)
{
this._currentPosition += 2;this._targetPosition = 0;}
this._initializeSlider();this._onRefresh(true,null,false);} 
},
_sortComparerAnimationId : function(x,y) {
if (x == null)
{
if (y == null)
{
return 0;}
else
{
return -1;}
}
else
{
if (y == null)
{
return 1;}
else
{
if(y.get_animationId() < x.get_animationId())
{
return -1;}
else if(y.get_animationId() > x.get_animationId())
{
return 1;} 
return 0;}
}
},
sortView : function(selectedKey) { 
if(this._isInitialized())
{
var count = 0;var applicationManager = this.get_applicationManager();var images = applicationManager.get_imageArray();var length = images.length;var imageInformation = null;var behaviour = null;for(var i = 0;i < length;i++ )
{ 
var imageInformation = images[i];behaviour = this._findByKey(imageInformation.Key);behaviour.set_animationId(count);count = count - 150;}
this._imageBehaviours = this._imageBehaviours.sort(this._sortComparerAnimationId);this._onRefresh(true,selectedKey,false);}
}
}
Inductronic.CarouselViewBehavior.registerClass('Inductronic.CarouselViewBehavior', AjaxControlToolkit.BehaviorBase, Inductronic.IPictureGalleryView );Inductronic.MosaicViewBehavior = function(element) {
Inductronic.MosaicViewBehavior.initializeBase(this, [element]);this._refresh = false;this._loaded = false;this._gallery = null;this._displayPerPage = -1;this._dragBehaviours = null;this._list = null;this._onImageClickExternalDelegate = null;this._currentBehavior = null;this._imageRecipe = '';this._currentPage = -1;this._pageInfoMessage = '';this._pageInfo = null;}
Inductronic.MosaicViewBehavior.prototype = {
initialize : function() { 
Inductronic.MosaicViewBehavior.callBaseMethod(this, 'initialize');this._handleDelegates(true);}, 
dispose : function() {
$clearHandlers(this.get_element());this._handleDelegates(false);Inductronic.MosaicViewBehavior.callBaseMethod(this, 'dispose');}, 
_handleDelegates : function(attach)
{
if(attach == true)
{ 
if( this._onImageClickExternalDelegate === null)
{
this._onImageClickExternalDelegate = Function.createDelegate(this, this._onImageClickExternalEvent );} 
}
else
{ 
if( this._onImageClickExternalDelegate )
{
delete this._onImageClickExternalDelegate;this._onImageClickExternalDelegate = null;} 
} 
},
_create : function(refresh) { 
if(this._list == null)
{
var li = null;var div = null;var dragBehavior = null;var behaviourElement = null;var el = this.get_element();div = document.createElement('div');el.appendChild(div);Sys.UI.DomElement.addCssClass(div, 'images');this._list = document.createElement('ul');div.appendChild(this._list);this._dragBehaviours = new Array();for(var i = 0;i < this._displayPerPage;i++ )
{
li = document.createElement('li');this._list.appendChild(li);behaviourElement = document.createElement('img');behaviourElement.id = this._generateId('im_' + i.toString());li.appendChild(behaviourElement);div = document.createElement('div');li.appendChild(div);dragBehavior = $create(Inductronic.PictureGalleryDragSourceBehavior, {id: behaviourElement.id, animationId: i, preloadImageUrl: this._gallery.get_preloadImageUrl() }, { imageClick: this._onImageClickExternalDelegate }, null, behaviourElement );this._dragBehaviours.push(dragBehavior);dragBehavior.hideImage();}
div = document.createElement('div');el.appendChild(div);Sys.UI.DomElement.addCssClass(div, 'pageinfo');this._pageInfo = document.createElement('span');div.appendChild(this._pageInfo);}
},
_createPageBySelectedIndex : function(selectedIndex,key,resort) { 
if(selectedIndex <= 0)
{
selectedIndex = 1;} 
else
{
selectedIndex++;} 
var selectedPage = Math.ceil(selectedIndex/this._displayPerPage);this._createPageByPageIndex(selectedPage,key,resort);},
_createPageByPageIndex : function(selectedPage,key,resort) {
var applicationManager = this.get_applicationManager();var images = applicationManager.get_imageArray();var count = images.length;var pages = Math.floor(count/this._displayPerPage);var leftOver = count % this._displayPerPage;if( leftOver > 0 )
{
pages += 1;}
if(selectedPage < 1 )
{
selectedPage = 1;}
else if(selectedPage > pages)
{
selectedPage = pages;}
this._pageInfo.innerHTML = String.format(this._pageInfoMessage,selectedPage,pages);if(resort || (this._currentPage != selectedPage))
{
this._currentPage = selectedPage;var pageData = this._paging(selectedPage,count,this._displayPerPage);var imageRange = applicationManager.subset(pageData.startOfPage, pageData.endOfPage);var i = 0;var behaviour = null;var imageInformation = null;var index = 0;for (i = pageData.startOfPage;i < (pageData.startOfPage + imageRange.length);i++)
{
index = i - pageData.startOfPage;imageInformation = imageRange[index];behaviour = this._dragBehaviours[index];behaviour.set_key(imageInformation.Key);behaviour.set_imageUrl(applicationManager.createImageUrl(imageInformation.Key, this._imageRecipe));if(key != null && behaviour.get_key() == key)
{
this._currentBehaviour = behaviour;behaviour.select();}
else
{
behaviour.deselect();} 
behaviour.update(true);}
index++;for (var j = index;j < this._displayPerPage;j++)
{
behaviour = this._dragBehaviours[j];behaviour.reset();behaviour.hideImage();}
}
else 
{
var behaviour = null;for (var j = 0;j < this._displayPerPage;j++)
{
behaviour = this._dragBehaviours[j];if(key != null && behaviour.get_key() == key)
{
this._currentBehaviour = behaviour;behaviour.select();}
else
{
behaviour.deselect();}
} 
}
},
_paging : function(whichPage,numItems,pageSize) { 
var pages = Math.floor(numItems / pageSize);var wholePages = pages;var leftOver = numItems % pageSize;if( leftOver > 0 )
{
pages += 1;}
var currentPage = whichPage;if( currentPage > pages || currentPage < 0)
{
return this._paging(1,numItems,pageSize);}
else
{
return { startOfPage : pageSize * (currentPage - 1), endOfPage : Math.min( (pageSize * (currentPage - 1)) + (pageSize - 1) , ((wholePages * pageSize) + leftOver - 1) )};} 
},
get_applicationManager: function()
{
return Inductronic.ApplicationManagerBehavior.getInstance();},
_generateId : function(id)
{
return this.get_id() + '_' + id;}, 
_hide : function(element)
{
$common.setVisible(element, false);}, 
_show : function(element)
{
$common.setVisible(element, true);},
_findByKey : function(key)
{
var result = null;if(this._dragBehaviours == null)
return result;var behaviour = null;for (var i = 0;i < this._dragBehaviours.length;i++)
{
behaviour = this._dragBehaviours[i];if(behaviour.get_key() == key)
{
result = behaviour;break;}
}
return result;},
_isInitialized : function() {
return (this._dragBehaviours != null);},
_onImageClickExternalEvent : function(sender,args)
{
var behaviour = null;behaviour = this._findByKey(args.get_key());if(behaviour != null)
{
if(this._currentBehavior != null && this._currentBehavior != behaviour)
{
this._currentBehavior.deselect();}
this._currentBehavior = behaviour;behaviour.select();this._raiseEvent('imageClick', args);}
},
add_imageClick : function(handler) {
this.get_events().addHandler('imageClick', handler);}, 
remove_imageClick : function(handler) {
this.get_events().removeHandler('imageClick', handler);}, 
_raiseEvent : function(eventName, eventArgs) { 
var handler = this.get_events().getHandler(eventName);if (handler) { 
if (!eventArgs) { 
eventArgs = Sys.EventArgs.Empty;} 
handler(this, eventArgs);} 
},
get_currentBehavior : function() { 
return this._currentBehavior;}, 
get_gallery : function() {
return this._gallery;}, 
set_gallery : function(value) { 
var e = Function._validateParams(arguments, [{name: 'value', type: Object }]);if (e) throw e;if (this._gallery != value) {
this._gallery = value;this.raisePropertyChanged('gallery');}
}, 
get_displayPerPage : function()
{
return this._displayPerPage;},
set_displayPerPage : function(value) 
{
var e = Function._validateParams(arguments, [{name: 'value', type: Number }]);if (e) throw e;if (this._displayPerPage != value) {
this._displayPerPage = value;this.raisePropertyChanged('displayPerPage');}
},
get_imageRecipe : function() {
return this._imageRecipe;}, 
set_imageRecipe : function(value) { 
var e = Function._validateParams(arguments, [{name: 'value', type: String }]);if (e) throw e;if (this._imageRecipe != value) {
this._imageRecipe = value;this.raisePropertyChanged('imageRecipe');}
},
get_pageInfoMessage : function() {
return this._pageInfoMessage;},
set_pageInfoMessage : function(value) { 
var e = Function._validateParams(arguments, [{name: 'value', type: String }]);if (e) throw e;if (this._pageInfoMessage != value) {
this._pageInfoMessage = value;this.raisePropertyChanged('pageInfoMessage');}
},
activateView : function(selectedKey,refresh) { 
if(this._loaded === false)
{
this._loaded = true;this._create(refresh);} 
if(this._refresh == true && refresh == false) {
refresh = this._refresh;this._refresh = false;}
var applicationManager = this.get_applicationManager();var selectedIndex = applicationManager.lookupIndexByKey(selectedKey);this._createPageBySelectedIndex(selectedIndex,selectedKey,refresh);var el = this.get_element();$common.setVisible(el,true);}, 
deactivateView : function(refresh) { 
var el = this.get_element();this._refresh = refresh;if($common.getVisible(el))
{
$common.setVisible(el,false);}
},
showNext : function() { 
this._createPageByPageIndex(this._currentPage+1,null,false);},
showPrevious : function() { 
this._createPageByPageIndex(this._currentPage-1,null,false);},
rotateImage : function(key) { 
if(this._isInitialized())
{
var behaviour = this._findByKey(key);if(behaviour != null)
{
behaviour.set_imageUrl(this.get_applicationManager().createImageUrl(behaviour.get_key(), this._imageRecipe));behaviour.update();}
}
},
deleteImage : function(key) {
if(this._isInitialized())
{
var behaviour = this._findByKey(key);this._currentBehaviour = null;if(behaviour)
{
behaviour.reset();}
}
},
sortView : function(selectedKey) { 
if(this._isInitialized())
{
this._createPageBySelectedIndex(this.get_applicationManager().lookupIndexByKey(selectedKey), selectedKey, true);}
}
}
Inductronic.MosaicViewBehavior.registerClass('Inductronic.MosaicViewBehavior', AjaxControlToolkit.BehaviorBase, Inductronic.IPictureGalleryView );Inductronic.PictureGalleryBehavior = function(element) {
Inductronic.PictureGalleryBehavior.initializeBase(this, [element]);this._eventsAttached = false;this._loaded = false;this._commandsEnabled = false;this._views = null;this._enabled = false;this._galleryStyle = Inductronic.PictureGalleryStyle.Grid;this._galleryTitle = '';this._editTitle = '';this._sortTitle = '';this._viewTitle = '';this._imageUploadTitle = '';this._imageUploadUrl = '';this._imageUploadPageUrl = '';this._gridImageRecipe = '';this._gridImageUrl = '';this._carouselImageRecipe = '';this._carouselImageUrl = '';this._mosaicImageRecipe = '';this._mosaicImageUrl = '';this._zoomImageRecipe = ''
this._zoomImageUrl = '';this._deleteConfirmMessage = '';this._deleteImageUrl = '';this._rotateConfirmMessage = '';this._rotateLeftImageUrl = '';this._rotateRightImageUrl = '';this._infoImageUrl = '';this._loadingMessage = '';this._loadingImageUrl = '';this._invalidAspectMessage = '';this._sliderTooltip = '{0}';this._nextImageUrl = '';this._previousImageUrl = '';this._nextSmallImageUrl = '';this._previousSmallImageUrl = '';this._preloadImageUrl = '';this._selectedKey = null;this._handleImageUrl = '';this._pageInfoMessage = '';this._dateModifiedTitle = '';this._dateCreateTitle = '';this._gridLink = null;this._carouselLink = null;this._mosaicLink = null;this._zoomLink = null;this._rotateLeftLink = null;this._rotateRightLink = null;this._infoLink = null;this._deleteLink = null;this._sortSelect = null;this._uploadLink = null;this._previousLink = null;this._nextLink = null;this._gridViewElement = null;this._carouselViewElement = null;this._mosaicViewElement = null;this._onImageManagerLoadedDelegate = null;this._onImageManagerRotateDelegate = null;this._onImageManagerDeleteDelegate = null;this._onImageManagerSelectDelegate = null;this._onImageClickDelegate = null;this._onGridClickDelegate = null;this._onCarouselClickDelegate = null;this._onMosaicClickDelegate = null;this._onZoomClickDelegate = null;this._onRotateLeftClickDelegate = null;this._onRotateRightClickDelegate = null;this._onInfoClickDelegate = null;this._onDeleteClickDelegate = null;this._onSortChangeDelegate = null;this._onPreviousClickDelegate = null;this._onNextClickDelegate = null;this._onUploadClickDelegate = null;}
Inductronic.PictureGalleryBehavior.prototype = {
initialize: function() {
Inductronic.PictureGalleryBehavior.callBaseMethod(this, 'initialize');var el = this.get_element();var pictures = document.createElement('div');el.appendChild(pictures);Sys.UI.DomElement.addCssClass(pictures, 'pictures');var options = document.createElement('div');pictures.appendChild(options);Sys.UI.DomElement.addCssClass(options, 'options');var header3 = document.createElement('h3');options.appendChild(header3);header3.innerHTML = this.get_galleryTitle();var view = document.createElement('div');options.appendChild(view);Sys.UI.DomElement.addCssClass(view, 'view');var viewSpan = document.createElement('span');view.appendChild(viewSpan);viewSpan.innerHTML = this.get_viewTitle();this._gridLink = document.createElement('a');view.appendChild(this._gridLink);this._gridLink.href = '';var gridImage = document.createElement('img');this._gridLink.appendChild(gridImage);gridImage.src = this.get_gridImageUrl();gridImage.alt = '';this._carouselLink = document.createElement('a');view.appendChild(this._carouselLink);this._carouselLink.href = '';var carouselImage = document.createElement('img');this._carouselLink.appendChild(carouselImage);carouselImage.src = this.get_carouselImageUrl();carouselImage.alt = '';this._mosaicLink = document.createElement('a');view.appendChild(this._mosaicLink);this._mosaicLink.href = '';var mosaicImage = document.createElement('img');this._mosaicLink.appendChild(mosaicImage);mosaicImage.src = this.get_mosaicImageUrl();mosaicImage.alt = '';var edit = document.createElement('div');options.appendChild(edit);Sys.UI.DomElement.addCssClass(edit, 'edit');var editSpan = document.createElement('span');edit.appendChild(editSpan);editSpan.innerHTML = this.get_editTitle();this._zoomLink = document.createElement('a');edit.appendChild(this._zoomLink);this._zoomLink.href = '';this._zoomLink.style.visibility = 'hidden';var zoomImage = document.createElement('img');this._zoomLink.appendChild(zoomImage);zoomImage.src = this.get_zoomImageUrl();zoomImage.alt = '';this._rotateLeftLink = document.createElement('a');edit.appendChild(this._rotateLeftLink);this._rotateLeftLink.href = '';var rotateLeftImage = document.createElement('img');this._rotateLeftLink.appendChild(rotateLeftImage);rotateLeftImage.src = this.get_rotateLeftImageUrl();rotateLeftImage.alt = '';this._rotateRightLink = document.createElement('a');edit.appendChild(this._rotateRightLink);this._rotateRightLink.href = '';var rotateRightImage = document.createElement('img');this._rotateRightLink.appendChild(rotateRightImage);rotateRightImage.src = this.get_rotateRightImageUrl();rotateRightImage.alt = '';this._infoLink = document.createElement('a');edit.appendChild(this._infoLink);this._infoLink.href = '';var infoImage = document.createElement('img');this._infoLink.appendChild(infoImage);infoImage.src = this.get_infoImageUrl();infoImage.alt = '';this._deleteLink = document.createElement('a');edit.appendChild(this._deleteLink);this._deleteLink.href = '';var deleteImage = document.createElement('img');this._deleteLink.appendChild(deleteImage);deleteImage.src = this.get_deleteImageUrl();deleteImage.alt = '';var sort = document.createElement('div');options.appendChild(sort);Sys.UI.DomElement.addCssClass(sort, 'sort');var sortSpan = document.createElement('span');sort.appendChild(sortSpan);sortSpan.innerHTML = this.get_sortTitle();this._sortSelect = document.createElement('select');sort.appendChild(this._sortSelect);current = document.createElement('option');this._sortSelect.appendChild(current);current.value = Inductronic.ApplicationManagerSortOrder.Created;current.innerHTML = this._dateCreateTitle;current = document.createElement('option');this._sortSelect.appendChild(current);current.value = Inductronic.ApplicationManagerSortOrder.Modified;current.innerHTML = this._dateModifiedTitle;var upload = document.createElement('div');options.appendChild(upload);Sys.UI.DomElement.addCssClass(upload, 'upload');var uploadSpan = document.createElement('span');upload.appendChild(uploadSpan);uploadSpan.innerHTML = this.get_imageUploadTitle();this._uploadLink = document.createElement('a');upload.appendChild(this._uploadLink);this._uploadLink.href = '';var uploadImage = document.createElement('img');this._uploadLink.appendChild(uploadImage);uploadImage.src = this.get_imageUploadUrl();uploadImage.alt = '';var clear = document.createElement('div');pictures.appendChild(clear);Sys.UI.DomElement.addCssClass(clear, 'clear');var previousArrow = document.createElement('div');pictures.appendChild(previousArrow);Sys.UI.DomElement.addCssClass(previousArrow, 'arrow first');this._previousLink = document.createElement('a');previousArrow.appendChild(this._previousLink);this._previousLink.href = '';this._hide(this._previousLink);var previousImage = document.createElement('img');this._previousLink.appendChild(previousImage);previousImage.src = this.get_previousImageUrl();previousImage.alt = '';this._gridViewElement = document.createElement('div');this._gridViewElement.id = this._generateId('grid');Sys.UI.DomElement.addCssClass(this._gridViewElement, 'grid');pictures.appendChild(this._gridViewElement);$common.setVisible(this._gridViewElement, false);this._carouselViewElement = document.createElement('div');this._carouselViewElement.id = this._generateId('carousel');Sys.UI.DomElement.addCssClass(this._carouselViewElement, 'carousel');pictures.appendChild(this._carouselViewElement);$common.setVisible(this._carouselViewElement, false);this._mosaicViewElement = document.createElement('div');this._mosaicViewElement.id = this._generateId('mosaic');Sys.UI.DomElement.addCssClass(this._mosaicViewElement, 'mosaic');pictures.appendChild(this._mosaicViewElement);$common.setVisible(this._mosaicViewElement, false);this._handleDelegates(true);var self = this;var gridViewBehavior = $create(Inductronic.MosaicViewBehavior, { id: this._gridViewElement.id, gallery: self, displayPerPage: 12, imageRecipe: self.get_gridImageRecipe(), pageInfoMessage: this._pageInfoMessage }, { imageClick: this._onImageClickDelegate }, null, this._gridViewElement);var carouselViewBehavior = $create(Inductronic.CarouselViewBehavior, { id: this._carouselViewElement.id, gallery: self, displayPerPage: -1, imageRecipe: self.get_carouselImageRecipe(), handleImageUrl: self.get_handleImageUrl(), nextImageUrl: self._nextSmallImageUrl, previousImageUrl: self._previousSmallImageUrl }, { imageClick: this._onImageClickDelegate }, null, this._carouselViewElement);var mosaicViewBehavior = $create(Inductronic.MosaicViewBehavior, { id: this._mosaicViewElement.id, gallery: self, displayPerPage: 36, imageRecipe: self.get_mosaicImageRecipe() }, { imageClick: this._onImageClickDelegate }, null, this._mosaicViewElement);this._views = [gridViewBehavior, carouselViewBehavior, mosaicViewBehavior];var nextArrow = document.createElement('div');pictures.appendChild(nextArrow);Sys.UI.DomElement.addCssClass(nextArrow, 'arrow last');this._nextLink = document.createElement('a');nextArrow.appendChild(this._nextLink);this._nextLink.href = '';this._hide(this._nextLink);var nextImage = document.createElement('img');this._nextLink.appendChild(nextImage);nextImage.src = this.get_nextImageUrl();nextImage.alt = '';clear = document.createElement('div');pictures.appendChild(clear);Sys.UI.DomElement.addCssClass(clear, 'clear');this._handleEvents(true);this._enableDisableCommands(false);var applicationManager = this.get_applicationManager();applicationManager.add_loaded(this._onImageManagerLoadedDelegate);applicationManager.add_rotate(this._onImageManagerRotateDelegate);applicationManager.add_delete(this._onImageManagerDeleteDelegate);applicationManager.add_select(this._onImageManagerSelectDelegate);var self = this;window.setTimeout(function() { self.get_applicationManager().load(false);}, 50);},
dispose: function() {
$clearHandlers(this.get_element());var applicationManager = this.get_applicationManager();if (applicationManager) {
applicationManager.remove_loaded(this._onImageManagerLoadedDelegate);applicationManager.remove_rotate(this._onImageManagerRotateDelegate);applicationManager.remove_delete(this._onImageManagerDeleteDelegate);applicationManager.remove_select(this._onImageManagerSelectDelegate);}
this._handleEvents(false);this._handleDelegates(false);Inductronic.PictureGalleryBehavior.callBaseMethod(this, 'dispose');},
_handleEvents: function(attach) {
if (attach === true && this._eventsAttached === false) {
this._eventsAttached = true;$addHandler(this._gridLink, 'click', this._onGridClickDelegate);$addHandler(this._carouselLink, 'click', this._onCarouselClickDelegate);$addHandler(this._mosaicLink, 'click', this._onMosaicClickDelegate);$addHandler(this._zoomLink, 'click', this._onZoomClickDelegate);$addHandler(this._rotateLeftLink, 'click', this._onRotateLeftClickDelegate);$addHandler(this._rotateRightLink, 'click', this._onRotateRightClickDelegate);$addHandler(this._infoLink, 'click', this._onInfoClickDelegate);$addHandler(this._deleteLink, 'click', this._onDeleteClickDelegate);$addHandler(this._sortSelect, 'change', this._onSortChangeDelegate);$addHandler(this._previousLink, 'click', this._onPreviousClickDelegate);$addHandler(this._nextLink, 'click', this._onNextClickDelegate);$addHandler(this._uploadLink, 'click', this._onUploadClickDelegate);}
else if (this._eventsAttached === true) {
$removeHandler(this._gridLink, 'click', this._onGridClickDelegate);$removeHandler(this._carouselLink, 'click', this._onCarouselClickDelegate);$removeHandler(this._mosaicLink, 'click', this._onMosaicClickDelegate);$removeHandler(this._zoomLink, 'click', this._onZoomClickDelegate);$removeHandler(this._rotateLeftLink, 'click', this._onRotateLeftClickDelegate);$removeHandler(this._rotateRightLink, 'click', this._onRotateRightClickDelegate);$removeHandler(this._infoLink, 'click', this._onInfoClickDelegate);$removeHandler(this._deleteLink, 'click', this._onDeleteClickDelegate);$removeHandler(this._sortSelect, 'change', this._onSortChangeDelegate);$removeHandler(this._previousLink, 'click', this._onPreviousClickDelegate);$removeHandler(this._nextLink, 'click', this._onNextClickDelegate);$removeHandler(this._uploadLink, 'click', this._onUploadClickDelegate);this._eventsAttached = false;}
},
_handleDelegates: function(attach) {
if (attach === true) {
if (this._onImageManagerLoadedDelegate === null) {
this._onImageManagerLoadedDelegate = Function.createDelegate(this, this._onImageManagerLoadedEvent);}
if (this._onImageManagerRotateDelegate === null) {
this._onImageManagerRotateDelegate = Function.createDelegate(this, this._onImageManagerRotateEvent);}
if (this._onImageManagerDeleteDelegate === null) {
this._onImageManagerDeleteDelegate = Function.createDelegate(this, this._onImageManagerDeleteEvent);}
if (this._onImageManagerSelectDelegate === null) {
this._onImageManagerSelectDelegate = Function.createDelegate(this, this._onImageManagerSelectEvent);}
if (this._onImageClickDelegate === null) {
this._onImageClickDelegate = Function.createDelegate(this, this._onImageClickEvent);}
if (this._onGridClickDelegate === null) {
this._onGridClickDelegate = Function.createDelegate(this, this._onGridClickEvent);}
if (this._onCarouselClickDelegate === null) {
this._onCarouselClickDelegate = Function.createDelegate(this, this._onCarouselClickEvent);}
if (this._onMosaicClickDelegate === null) {
this._onMosaicClickDelegate = Function.createDelegate(this, this._onMosaicClickEvent);}
if (this._onZoomClickDelegate === null) {
this._onZoomClickDelegate = Function.createDelegate(this, this._onZoomClickEvent);}
if (this._onRotateLeftClickDelegate === null) {
this._onRotateLeftClickDelegate = Function.createDelegate(this, this._onRotateLeftClickEvent);}
if (this._onRotateRightClickDelegate === null) {
this._onRotateRightClickDelegate = Function.createDelegate(this, this._onRotateRightClickEvent);}
if (this._onInfoClickDelegate === null) {
this._onInfoClickDelegate = Function.createDelegate(this, this._onInfoClickEvent);}
if (this._onDeleteClickDelegate === null) {
this._onDeleteClickDelegate = Function.createDelegate(this, this._onDeleteClickEvent);}
if (this._onSortChangeDelegate === null) {
this._onSortChangeDelegate = Function.createDelegate(this, this._onSortChangeEvent);}
if (this._onPreviousClickDelegate === null) {
this._onPreviousClickDelegate = Function.createDelegate(this, this._onPreviousClickEvent);}
if (this._onNextClickDelegate === null) {
this._onNextClickDelegate = Function.createDelegate(this, this._onNextClickEvent);}
if (this._onUploadClickDelegate === null) {
this._onUploadClickDelegate = Function.createDelegate(this, this._onUploadClickEvent);}
}
else {
if (this._onImageManagerLoadedDelegate) {
delete this._onImageManagerLoadedDelegate;this._onImageManagerLoadedDelegate = null;}
if (this._onImageManagerRotateDelegate) {
delete this._onImageManagerRotateDelegate;this._onImageManagerRotateDelegate = null;}
if (this._onImageManagerDeleteDelegate) {
delete this._onImageManagerDeleteDelegate;this._onImageManagerDeleteDelegate = null;}
if (this._onImageManagerSelectDelegate) {
delete this._onImageManagerSelectDelegate;this._onImageManagerSelectDelegate = null;}
if (this._onImageClickDelegate) {
delete this._onImageClickDelegate;this._onImageClickDelegate = null;}
if (this._onGridClickDelegate) {
delete this._onGridClickDelegate;this._onGridClickDelegate = null;}
if (this._onCarouselClickDelegate) {
delete this._onCarouselClickDelegate;this._onCarouselClickDelegate = null;}
if (this._onMosaicClickDelegate) {
delete this._onMosaicClickDelegate;this._onMosaicClickDelegate = null;}
if (this._onZoomClickDelegate) {
delete this._onZoomClickDelegate;this._onZoomClickDelegate = null;}
if (this._onRotateLeftClickDelegate) {
delete this._onRotateLeftClickDelegate;this._onRotateLeftClickDelegate = null;}
if (this._onRotateRightClickDelegate) {
delete this._onRotateRightClickDelegate;this._onRotateRightClickDelegate = null;}
if (this._onInfoClickDelegate) {
delete this._onInfoClickDelegate;this._onInfoClickDelegate = null;}
if (this._onDeleteClickDelegate) {
delete this._onDeleteClickDelegate;this._onDeleteClickDelegate = null;}
if (this._onSortChangeDelegate) {
delete this._onSortChangeDelegate;this._onSortChangeDelegate = null;}
if (this._onPreviousClickDelegate) {
delete this._onPreviousClickDelegate;this._onPreviousClickDelegate = null;}
if (this._onNextClickDelegate) {
delete this._onNextClickDelegate;this._onNextClickDelegate = null;}
if (this._onUploadClickDelegate) {
delete this._onUploadClickDelegate;this._onUploadClickDelegate = null;}
}
},
get_applicationManager: function() {
return Inductronic.ApplicationManagerBehavior.getInstance();},
_generateId: function(id) {
return this.get_id() + '_' + id;},
_hide: function(element) {
$common.setVisible(element, false);},
_show: function(element) {
$common.setVisible(element, true);},
_checkIfLossless: function(key) {
var result = true;var imageInformation = this.get_applicationManager().lookupImageInformationByKey(key);if (imageInformation != null && imageInformation.Width > 0 && imageInformation.Height > 0) {
var valid = false;if (imageInformation.Width / 16.0 - imageInformation.Width / 16.0 == 0.0)
valid = true;if (valid == true && (imageInformation.Height / 16.0 - imageInformation.Height / 16.0 == 0.0))
valid = true;if (valid == false && this._invalidAspectMessage != null && this._invalidAspectMessage.length > 0) {
result = confirm(this._invalidAspectMessage);}
}
return result;},
_enableDisableCommands: function(enable) {
this._commandsEnabled = enable;},
_isCommandsEnabled: function(enable) {
return (this._commandsEnabled == true);},
_changeView: function(newGalleryStyle, refresh) {
var raiseChanged = (this._galleryStyle != newGalleryStyle);this._galleryStyle = newGalleryStyle;if (this._galleryStyle == Inductronic.PictureGalleryStyle.Grid) {
this._views[Inductronic.PictureGalleryStyle.Carousel].deactivateView(refresh);this._views[Inductronic.PictureGalleryStyle.Mosaic].deactivateView(refresh);this._views[Inductronic.PictureGalleryStyle.Grid].activateView(this._selectedKey, refresh);}
else if (this._galleryStyle == Inductronic.PictureGalleryStyle.Carousel) {
this._views[Inductronic.PictureGalleryStyle.Grid].deactivateView(refresh);this._views[Inductronic.PictureGalleryStyle.Mosaic].deactivateView(refresh);this._views[Inductronic.PictureGalleryStyle.Carousel].activateView(this._selectedKey, refresh);}
else if (this._galleryStyle == Inductronic.PictureGalleryStyle.Mosaic) {
this._views[Inductronic.PictureGalleryStyle.Grid].deactivateView(refresh);this._views[Inductronic.PictureGalleryStyle.Carousel].deactivateView(refresh);this._views[Inductronic.PictureGalleryStyle.Mosaic].activateView(this._selectedKey, refresh);}
this._handleNextPreviousLinks();if (raiseChanged) {
this._raiseEvent('viewChanged', null);}
},
_handleNextPreviousLinks: function() {
var applicationManager = this.get_applicationManager();var images = applicationManager.get_imageArray();var count = images.length;if (count <= 0) {
this._hide(this._previousLink);this._hide(this._nextLink);}
else if (count <= 12 && this._galleryStyle == Inductronic.PictureGalleryStyle.Grid) {
this._hide(this._previousLink);this._hide(this._nextLink);}
else if (count <= 36 && this._galleryStyle == Inductronic.PictureGalleryStyle.Mosaic) {
this._hide(this._previousLink);this._hide(this._nextLink);}
else {
this._show(this._previousLink);this._show(this._nextLink);}
},
_onImageManagerLoadedEvent: function(sender, args) {
var self = this;window.setTimeout(function() { self._createGallery();}, 50);},
_createGallery: function() {
var applicationManager = this.get_applicationManager();var images = applicationManager.get_imageArray();var count = images.length;if (count > 0) {
this._changeView(this._galleryStyle, true);this._enableDisableCommands(true);}
else {
this._enableDisableCommands(false);}
this._loaded = true;},
_onImageManagerRotateEvent: function(sender, args) {
this._views[Inductronic.PictureGalleryStyle.Carousel].rotateImage(args.key);this._views[Inductronic.PictureGalleryStyle.Mosaic].rotateImage(args.key);this._views[Inductronic.PictureGalleryStyle.Grid].rotateImage(args.key);this._enableDisableCommands(true);},
_onImageManagerDeleteEvent: function(sender, args) {
this._selectedKey = null;this._views[Inductronic.PictureGalleryStyle.Carousel].deleteImage(args.key);this._views[Inductronic.PictureGalleryStyle.Mosaic].deleteImage(args.key);this._views[Inductronic.PictureGalleryStyle.Grid].deleteImage(args.key);this._handleNextPreviousLinks();this._enableDisableCommands(true);},
_onImageManagerSelectEvent: function(sender, args) {
var key = sender.get_selectedBehavior().get_key();if (key != null && key.length > 0 && this._selectedKey != key) {
this._selectedKey = key;this._views[this._galleryStyle].sortView(this._selectedKey);}
},
_onImageClickEvent: function(sender, args) {
if (this._isCommandsEnabled()) {
this._selectedKey = args.get_key();this._raiseEvent('imageClick', args);}
},
_onGridClickEvent: function(evt) {
evt.preventDefault();if (this._isCommandsEnabled()) {
this._changeView(Inductronic.PictureGalleryStyle.Grid, false);}
},
_onCarouselClickEvent: function(evt) {
evt.preventDefault();if (this._isCommandsEnabled()) {
this._changeView(Inductronic.PictureGalleryStyle.Carousel, false);}
},
_onMosaicClickEvent: function(evt) {
evt.preventDefault();if (this._isCommandsEnabled()) {
this._changeView(Inductronic.PictureGalleryStyle.Mosaic, false);}
},
_onZoomClickEvent: function(evt) {
evt.preventDefault();if (this._isCommandsEnabled()) {
var behavior = this._views[this._galleryStyle].get_currentBehavior();if (behavior != null) {
var args = new Inductronic.PictureGalleryEventArgs(this.get_applicationManager.get_contextKey(), behavior.get_key());this._raiseEvent('zoomClick', args);}
}
},
_onRotateLeftClickEvent: function(evt) {
evt.preventDefault();if (this._isCommandsEnabled()) {
var behavior = this._views[this._galleryStyle].get_currentBehavior();if (behavior != null && this._checkIfLossless(behavior.get_key()) && confirm(this._rotateConfirmMessage)) {
this._enableDisableCommands(false);this.get_applicationManager().rotateImage(behavior.get_key(), false);}
}
},
_onRotateRightClickEvent: function(evt) {
evt.preventDefault();if (this._isCommandsEnabled()) {
var behavior = this._views[this._galleryStyle].get_currentBehavior();if (behavior != null && this._checkIfLossless(behavior.get_key()) && confirm(this._rotateConfirmMessage)) {
this._enableDisableCommands(false);this.get_applicationManager().rotateImage(behavior.get_key(), true);}
}
},
_onInfoClickEvent: function(evt) {
evt.preventDefault();if (this._isCommandsEnabled()) {
var behavior = this._views[this._galleryStyle].get_currentBehavior();if (behavior != null) {
var args = new Inductronic.PictureGalleryEventArgs(this.get_applicationManager().get_contextKey(), behavior.get_key());this._raiseEvent('infoClick', args);}
}
},
_onDeleteClickEvent: function(evt) {
evt.preventDefault();if (this._isCommandsEnabled()) {
var behavior = this._views[this._galleryStyle].get_currentBehavior();if (behavior != null && confirm(this._deleteConfirmMessage)) {
this._enableDisableCommands(false);this.get_applicationManager().deleteImage(behavior.get_key());}
}
},
_onSortChangeEvent: function(evt) {
evt.preventDefault();if (this._isCommandsEnabled()) {
var sortOrder = this._sortSelect.value;this.get_applicationManager().sortImages(sortOrder);this._views[Inductronic.PictureGalleryStyle.Carousel].sortView(this._selectedKey);this._views[Inductronic.PictureGalleryStyle.Mosaic].sortView(this._selectedKey);this._views[Inductronic.PictureGalleryStyle.Grid].sortView(this._selectedKey);}
},
_onPreviousClickEvent: function(evt) {
evt.preventDefault();if (this._isCommandsEnabled()) {
this._views[this._galleryStyle].showPrevious();}
},
_onNextClickEvent: function(evt) {
evt.preventDefault();if (this._isCommandsEnabled()) {
this._views[this._galleryStyle].showNext();}
},
_onUploadClickEvent: function(evt) {
evt.preventDefault();this._raiseEvent('uploadClick', Sys.EventArgs.Empty);},
add_imageClick: function(handler) {
this.get_events().addHandler('imageClick', handler);},
remove_imageClick: function(handler) {
this.get_events().removeHandler('imageClick', handler);},
add_viewChanged: function(handler) {
this.get_events().addHandler('viewChanged', handler);},
remove_viewChanged: function(handler) {
this.get_events().removeHandler('viewChanged', handler);},
add_zoomClick: function(handler) {
this.get_events().addHandler('zoomClick', handler);},
remove_zoomClick: function(handler) {
this.get_events().removeHandler('zoomClick', handler);},
add_infoClick: function(handler) {
this.get_events().addHandler('infoClick', handler);},
remove_infoClick: function(handler) {
this.get_events().removeHandler('infoClick', handler);},
add_uploadClick: function(handler) {
this.get_events().addHandler('uploadClick', handler);},
remove_uploadClick: function(handler) {
this.get_events().removeHandler('uploadClick', handler);},
_raiseEvent: function(eventName, eventArgs) {
var handler = this.get_events().getHandler(eventName);if (handler) {
if (!eventArgs) {
eventArgs = Sys.EventArgs.Empty;}
handler(this, eventArgs);}
},
get_galleryTitle: function() {
return this._galleryTitle;},
set_galleryTitle: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._galleryTitle != value) {
this._galleryTitle = value;this.raisePropertyChanged('galleryTitle');}
},
get_viewTitle: function() {
return this._viewTitle;},
set_viewTitle: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._viewTitle != value) {
this._viewTitle = value;this.raisePropertyChanged('viewTitle');}
},
get_editTitle: function() {
return this._editTitle;},
set_editTitle: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._editTitle != value) {
this._editTitle = value;this.raisePropertyChanged('editTitle');}
},
get_sortTitle: function() {
return this._sortTitle;},
set_sortTitle: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._sortTitle != value) {
this._sortTitle = value;this.raisePropertyChanged('sortTitle');}
},
get_imageUploadTitle: function() {
return this._imageUploadTitle;},
set_imageUploadTitle: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._imageUploadTitle != value) {
this._imageUploadTitle = value;this.raisePropertyChanged('imageUploadTitle');}
},
get_imageUploadUrl: function() {
return this._imageUploadUrl;},
set_imageUploadUrl: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._imageUploadUrl != value) {
this._imageUploadUrl = value;this.raisePropertyChanged('imageUploadUrl');}
},
get_imageUploadPageUrl: function() {
return this._imageUploadPageUrl;},
set_imageUploadPageUrl: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._imageUploadPageUrl != value) {
this._imageUploadPageUrl = value;this.raisePropertyChanged('imageUploadPageUrl');}
},
get_gridImageRecipe: function() {
return this._gridImageRecipe;},
set_gridImageRecipe: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._gridImageRecipe != value) {
this._gridImageRecipe = value;this.raisePropertyChanged('gridImageRecipe');}
},
get_gridImageUrl: function() {
return this._gridImageUrl;},
set_gridImageUrl: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._gridImageUrl != value) {
this._gridImageUrl = value;this.raisePropertyChanged('gridImageUrl');}
},
get_carouselImageRecipe: function() {
return this._carouselImageRecipe;},
set_carouselImageRecipe: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._carouselImageRecipe != value) {
this._carouselImageRecipe = value;this.raisePropertyChanged('carouselImageRecipe');}
},
get_carouselImageUrl: function() {
return this._carouselImageUrl;},
set_carouselImageUrl: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._carouselImageUrl != value) {
this._carouselImageUrl = value;this.raisePropertyChanged('carouselImageUrl');}
},
get_mosaicImageRecipe: function() {
return this._mosaicImageRecipe;},
set_mosaicImageRecipe: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._mosaicImageRecipe != value) {
this._mosaicImageRecipe = value;this.raisePropertyChanged('mosaicImageRecipe');}
},
get_mosaicImageUrl: function() {
return this._mosaicImageUrl;},
set_mosaicImageUrl: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._mosaicImageUrl != value) {
this._mosaicImageUrl = value;this.raisePropertyChanged('mosaicImageUrl');}
},
get_selectedKey: function() {
return this._selectedKey;},
set_selectedKey: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._selectedKey != value) {
this._selectedKey = value;this.raisePropertyChanged('selectedKey');}
},
get_zoomImageRecipe: function() {
return this._zoomImageRecipe;},
set_zoomImageRecipe: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._zoomImageRecipe != value) {
this._zoomImageRecipe = value;this.raisePropertyChanged('zoomImageRecipe');}
},
get_zoomImageUrl: function() {
return this._zoomImageUrl;},
set_zoomImageUrl: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._zoomImageUrl != value) {
this._zoomImageUrl = value;this.raisePropertyChanged('zoomImageUrl');}
},
get_loadingImageUrl: function() {
return this._loadingImageUrl;},
set_loadingImageUrl: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._loadingImageUrl != value) {
this._loadingImageUrl = value;this.raisePropertyChanged('loadingImageUrl');}
},
get_nextImageUrl: function() {
return this._nextImageUrl;},
set_nextImageUrl: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._nextImageUrl != value) {
this._nextImageUrl = value;this.raisePropertyChanged('nextImageUrl');}
},
get_previousImageUrl: function() {
return this._previousImageUrl;},
set_previousImageUrl: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._previousImageUrl != value) {
this._previousImageUrl = value;this.raisePropertyChanged('previousImageUrl');}
},
get_nextSmallImageUrl: function() {
return this._nextSmallImageUrl;},
set_nextSmallImageUrl: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._nextSmallImageUrl != value) {
this._nextSmallImageUrl = value;this.raisePropertyChanged('nextSmallImageUrl');}
},
get_previousSmallImageUrl: function() {
return this._previousSmallImageUrl;},
set_previousSmallImageUrl: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._previousSmallImageUrl != value) {
this._previousSmallImageUrl = value;this.raisePropertyChanged('previousSmallImageUrl');}
},
get_preloadImageUrl: function() {
return this._preloadImageUrl;},
set_preloadImageUrl: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._preloadImageUrl != value) {
this._preloadImageUrl = value;this.raisePropertyChanged('preloadImageUrl');}
},
get_loadingMessage: function() {
return this._loadingMessage;},
set_loadingMessage: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._loadingMessage != value) {
this._loadingMessage = value;this.raisePropertyChanged('loadingMessage');}
},
get_rotateConfirmMessage: function() {
return this._rotateConfirmMessage;},
set_rotateConfirmMessage: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._rotateConfirmMessage != value) {
this._rotateConfirmMessage = value;this.raisePropertyChanged('rotateConfirmMessage');}
},
get_rotateLeftImageUrl: function() {
return this._rotateLeftImageUrl;},
set_rotateLeftImageUrl: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._rotateLeftImageUrl != value) {
this._rotateLeftImageUrl = value;this.raisePropertyChanged('rotateLeftImageUrl');}
},
get_rotateRightImageUrl: function() {
return this._rotateRightImageUrl;},
set_rotateRightImageUrl: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._rotateRightImageUrl != value) {
this._rotateRightImageUrl = value;this.raisePropertyChanged('rotateRightImageUrl');}
},
get_deleteConfirmMessage: function() {
return this._deleteConfirmMessage;},
set_deleteConfirmMessage: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._deleteConfirmMessage != value) {
this._deleteConfirmMessage = value;this.raisePropertyChanged('deleteConfirmMessage');}
},
get_deleteImageUrl: function() {
return this._deleteImageUrl;},
set_deleteImageUrl: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._deleteImageUrl != value) {
this._deleteImageUrl = value;this.raisePropertyChanged('deleteImageUrl');}
},
get_infoImageUrl: function() {
return this._infoImageUrl;},
set_infoImageUrl: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._infoImageUrl != value) {
this._infoImageUrl = value;this.raisePropertyChanged('infoImageUrl');}
},
get_invalidAspectMessage: function() {
return this._invalidAspectMessage;},
set_invalidAspectMessage: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._invalidAspectMessage != value) {
this._invalidAspectMessage = value;this.raisePropertyChanged('invalidAspectMessage');}
},
get_sliderTooltip: function() {
return this._sliderTooltip;},
set_sliderTooltip: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._sliderTooltip != value) {
this._sliderTooltip = value;this.raisePropertyChanged('sliderTooltip');}
},
get_handleImageUrl: function() {
return this._handleImageUrl;},
set_handleImageUrl: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._handleImageUrl != value) {
this._handleImageUrl = value;this.raisePropertyChanged('handleImageUrl');}
},
get_pageInfoMessage: function() {
return this._pageInfoMessage;},
set_pageInfoMessage: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._pageInfoMessage != value) {
this._pageInfoMessage = value;this.raisePropertyChanged('pageInfoMessage');}
},
get_dateModifiedTitle: function() {
return this._dateModifiedTitle;},
set_dateModifiedTitle: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._dateModifiedTitle != value) {
this._dateModifiedTitle = value;this.raisePropertyChanged('dateModifiedTitle');}
},
get_dateCreateTitle: function() {
return this._dateCreateTitle;},
set_dateCreateTitle: function(value) {
var e = Function._validateParams(arguments, [{ name: 'value', type: String}]);if (e) throw e;if (this._dateCreateTitle != value) {
this._dateCreateTitle = value;this.raisePropertyChanged('dateCreateTitle');}
}
}
Inductronic.PictureGalleryBehavior.registerClass('Inductronic.PictureGalleryBehavior', Sys.UI.Control, Sys.IDisposable );Inductronic.PictureGalleryDragSourceBehavior = function(element)
{
Inductronic.PictureGalleryDragSourceBehavior.initializeBase(this, [element]);this._onLoadDelegate = null;this._onMouseDownDelegate = null;this._onMouseMoveDelegate = null;this._onMouseUpDelegate = null;this._onSelectStartDelegate = null;this._selectStartPending = false;this._contextKey = null;this._visual = null;this._key = null;this._imageUrl = '';this._refresh = false;this._offset = null;this._fireClick = false;this._preloadImageUrl = '';}
Inductronic.PictureGalleryDragSourceBehavior.prototype =
{
initialize: function()
{
Inductronic.PictureGalleryDragSourceBehavior.callBaseMethod(this,'initialize');this._contextKey = Inductronic.ApplicationManagerBehavior.getInstance().get_contextKey();var el = this.get_element();if(this._onLoadDelegate == null)
{
this._onLoadDelegate = Function.createDelegate(this, this._onLoadEvent);$addHandler( el, 'load', this._onLoadDelegate );}
if(this._onMouseDownDelegate == null)
{
this._onMouseDownDelegate = Function.createDelegate(this,this._onMouseDownEvent);$addHandler( el, 'mousedown', this._onMouseDownDelegate);}
if(this._onMouseMoveDelegate == null)
{
this._onMouseMoveDelegate = Function.createDelegate(this,this._onMouseMoveEvent);$addHandler( el, 'mousemove', this._onMouseMoveDelegate);}
if(this._onMouseUpDelegate == null)
{
this._onMouseUpDelegate = Function.createDelegate(this,this._onMouseUpEvent);$addHandler( el, 'mouseup', this._onMouseUpDelegate);}
if(this._onSelectStartDelegate == null)
{
this._onSelectStartDelegate = Function.createDelegate(this, this._onSelectStartEvent);}
}, 
dispose: function()
{
var el = this.get_element();if(this._onLoadDelegate)
{
$removeHandler(el, 'load',this._onLoadDelegate);delete this._onLoadDelegate;this._onLoadDelegate = null;}
if (this._onMouseDownDelegate)
{
$removeHandler(el, 'mousedown',this._onMouseDownDelegate);delete this._onMouseDownDelegate;this._onMouseDownDelegate = null;}
if (this._onMouseMoveDelegate)
{
$removeHandler(el, 'mousemove',this._onMouseMoveDelegate);delete this._onMouseMoveDelegate;this._onMouseMoveDelegate = null;}
if (this._onMouseUpDelegate)
{
$removeHandler(el, 'mouseup',this._onMouseUpDelegate);delete this._onMouseUpDelegate;this._onMouseUpDelegate = null;}
if(this._onSelectStartDelegate)
{
delete this._onSelectStartDelegate;this._onSelectStartDelegate = null;}
Inductronic.PictureGalleryDragSourceBehavior.callBaseMethod(this,'dispose');}, 
update : function(show)
{
if(this._refresh)
{
this._refresh = false;var hideMe = false;var el = this.get_element();if(this._preloadImageUrl != null && this._preloadImageUrl.length > 0)
{
if(!Sys.UI.DomElement.containsCssClass(el, 'loading'))
{
Sys.UI.DomElement.addCssClass(el, 'loading');}
el.src = this._preloadImageUrl;} 
if(this._imageUrl != null && this._imageUrl.length > 0)
{
if(!Sys.UI.DomElement.containsCssClass(el, 'loading'))
{
Sys.UI.DomElement.addCssClass(el, 'loading');}
if( el.complete && Sys.Browser.agent == Sys.Browser.Opera )
{
el.src = this._imageUrl;this._onLoadEvent(null);}
else 
{ 
el.src = this._imageUrl;}
}
else
{
hideMe = true;this.hideImage();}
if((hideMe == false && this._loading == true) || show == true)
{
this.showImage();}
}
else if(show == true)
{
this.showImage();}
},
reset : function()
{
this.set_key('');this.set_imageUrl('');this.update(false);},
showImage : function()
{
var el = this.get_element();if(!$common.getVisible(el)) 
{
$common.setVisible(el,true);}
},
hideImage : function()
{
var el = this.get_element();if($common.getVisible(el)) 
{
$common.setVisible(el,false);}
this.deselect();},
select : function()
{
var el = this.get_element();if(!Sys.UI.DomElement.containsCssClass(el,'current'))
{
Sys.UI.DomElement.addCssClass(el,'current');}
},
deselect : function()
{
var el = this.get_element();if(Sys.UI.DomElement.containsCssClass(el,'current'))
{
Sys.UI.DomElement.removeCssClass(el,'current');}
},
_onLoadEvent : function(e)
{
var el = this.get_element();if(Sys.UI.DomElement.containsCssClass(el, 'loading'))
{
Sys.UI.DomElement.removeCssClass(el, 'loading');}
},
_onMouseDownEvent : function(ev)
{
window._event = ev;ev.preventDefault();this._fireClick = true;this._offset = { x: window._event.clientX, y: window._event.clientY };},
_onMouseMoveEvent : function(ev)
{
window._event = ev;ev.preventDefault();if(this._offset != null && Inductronic.DragDropManagerInternal.DropPending == null) { 
var offset = { x: window._event.clientX, y: window._event.clientY };if(Math.abs(offset.x - this._offset.x ) > 20 || Math.abs(offset.y - this._offset.y ) > 20 )
{ 
this._fireClick = false;Inductronic.DragDropManagerInternal.DropPending = this;this._selectStartPending = true;$addHandler(document, 'selectstart', this._onSelectStartDelegate);this._visual = this.get_element().cloneNode(true);document.body.appendChild(this._visual);this._visual.className = '';this._visual.style.opacity = '0.4';this._visual.style.filter = 'progid:DXImageTransform.Microsoft.BasicImage(opacity=0.4)';this._visual.style.zIndex = 99999;var location = Sys.UI.DomElement.getLocation(this.get_element());Sys.UI.DomElement.setLocation( this._visual, location.x, location.y);this._startDragDrop(this._visual);}
}
},
_onMouseUpEvent : function(ev)
{
if(Inductronic.DragDropManagerInternal.DropPending == this) {
Inductronic.DragDropManagerInternal.DropPending = null;if(this._selectStartPending) {
this._selectStartPending = false;$removeHandler(document, 'selectstart', this._onSelectStartDelegate);}
}
else if(this._offset != null && this._fireClick == true)
{
this._fireClick = false;var args = new Inductronic.PictureGalleryEventArgs(this._contextKey,this.get_key());this._raiseEvent('imageClick', args);}
this._offset = null;},
_onSelectStartEvent : function(ev) {
ev.preventDefault();}, 
_startDragDrop : function(dragVisual) {
Inductronic.DragDropManagerInternal.startDragDrop(this, dragVisual, null);}, 
get_dragDataType: function()
{
return 'DragDropImage';},
getDragData: function(context)
{
return { contextKey: this._contextKey, key: this._key};},
get_dragMode: function()
{
return AjaxControlToolkit.DragMode.Copy;},
onDragStart: function()
{
},
onDrag: function() 
{
},
onDragEnd: function(canceled)
{ 
this._fireClick = false;this._offset = null;Inductronic.DragDropManagerInternal.DropPending = null;if (this._visual)
{
document.body.removeChild(this._visual);this._visual = null;}
if(canceled == false)
{
var args = new Inductronic.PictureGalleryEventArgs(this._contextKey,this.get_key());this._raiseEvent('imageClick', args);}
}, 
add_imageClick : function(handler) {
this.get_events().addHandler('imageClick', handler);}, 
remove_imageClick : function(handler) {
this.get_events().removeHandler('imageClick', handler);}, 
_raiseEvent : function(eventName, eventArgs) { 
var handler = this.get_events().getHandler(eventName);if (handler) { 
if (!eventArgs) { 
eventArgs = Sys.EventArgs.Empty;} 
handler(this, eventArgs);} 
},
get_key : function()
{
return this._key;}, 
set_key : function(value)
{
var e = Function._validateParams(arguments, [{name: 'value', type: String}]);if (e) throw e;if (this._key != value) {
this._key = value;this._refresh = true;this.raisePropertyChanged('key');}
},
get_imageUrl : function()
{
return this._imageUrl;}, 
set_imageUrl : function(value)
{
var e = Function._validateParams(arguments, [{name: 'value', type: String}]);if (e) throw e;if (this._imageUrl != value) {
this._imageUrl = value;this._refresh = true;this.raisePropertyChanged('imageUrl');}
},
get_preloadImageUrl : function() {
return this._preloadImageUrl;}, 
set_preloadImageUrl : function(value) {
var e = Function._validateParams(arguments, [{name: 'value', type: String}]);if (e) throw e;if (this._preloadImageUrl != value) {
this._preloadImageUrl = value;this.raisePropertyChanged('preloadImageUrl');}
},
get_animationId : function()
{
return this._animationId;}, 
set_animationId : function(value)
{
var e = Function._validateParams(arguments, [{name: 'value', type: Number}]);if (e) throw e;if (this._animationId != value) {
this._animationId = value;this.raisePropertyChanged('animationId');}
}
}
Inductronic.PictureGalleryDragSourceBehavior.registerClass('Inductronic.PictureGalleryDragSourceBehavior', AjaxControlToolkit.BehaviorBase, AjaxControlToolkit.IDragSource, Sys.IDisposable );
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();