﻿Type.registerNamespace("PhotoSite.Framework");PhotoSite.Framework.ConsistentSizeOrientation=function(){};PhotoSite.Framework.ConsistentSizeOrientation.prototype={Height:1,Width:2};PhotoSite.Framework.ConsistentSizeOrientation.registerEnum("PhotoSite.Framework.ConsistentSizeOrientation",false);PhotoSite.Framework.ConsistentSize=function(A){PhotoSite.Framework.ConsistentSize.initializeBase(this,[A]);this._targetControls=[];this._orientation=null;this._maxBounds=null;this._initialLagClickHandler=Function.createDelegate(this,this._onInitialLagClick);this._initialLagTimer=null;this._initializationDelay=100;};PhotoSite.Framework.ConsistentSize.prototype={get_targetControls:function(){return this._targetControls;},set_targetControls:function(A){if(this._targetControls!=A){this._targetControls=A;this.raisePropertyChanged("controlIds");}},get_orientation:function(){return this._orientation;},set_orientation:function(A){if(this._orientation!=A){this._orientation=A;this.raisePropertyChanged("orientation");}},get_initializationDelay:function(){return this._initializationDelay;},set_initializationDelay:function(A){if(this._initializationDelay!=A){this._initializationDelay=A;this.raisePropertyChanged("initializationDelay");}},initialize:function(){PhotoSite.Framework.ConsistentSize.callBaseMethod(this,"initialize");this._initializeTimer();},dispose:function(){this._initialLagTimer.dispose();PhotoSite.Framework.ConsistentSize.callBaseMethod(this,"dispose");},_determineMaxBounds:function(){var C=0;var A=0;for(var B=0;B<this._targetControls.length;B++){var E=Sys.UI.DomElement.getBounds($get(this._targetControls[B].TargetControlId));var D=this._targetControls[B].TargetOffset;if(C<(E.width+D)){C=E.width+D;}if(A<(E.height+D)){A=E.height+D;}}this._maxBounds=new Sys.UI.Bounds(0,0,C,A);},_setAllControlBounds:function(){for(var B=0;B<this._targetControls.length;B++){var A=$get(this._targetControls[B].TargetControlId);var C=this._targetControls[B].TargetOffset;if((this._orientation&PhotoSite.Framework.ConsistentSizeOrientation.Width)>0){A.style.width=(this._maxBounds.width+C)+"px";}if((this._orientation&PhotoSite.Framework.ConsistentSizeOrientation.Height)>0){A.style.height=(this._maxBounds.height+C)+"px";}}},_onInitialLagClick:function(){this._initialLagTimer.set_enabled(false);this._determineMaxBounds();this._setAllControlBounds();},_initializeTimer:function(){this._initialLagTimer=new Sys.Timer();this._initialLagTimer.set_interval(this._initializationDelay);this._initialLagTimer.add_tick(this._initialLagClickHandler);this._initialLagTimer.set_enabled(true);}};PhotoSite.Framework.ConsistentSize.registerClass("PhotoSite.Framework.ConsistentSize",Sys.UI.Control);PhotoSite.Framework.ElementSize=function(A){PhotoSite.Framework.ElementSize.initializeBase(this,[A]);this._invokeClickHandler=Function.createDelegate(this,this._onInvokeClick);};PhotoSite.Framework.ElementSize.prototype={_onInvokeClick:function(){this._resize();},_resize:function(){if(this.get_relativeHeight()){var B=PhotoSite.Framework.UI.getWindowDimensions().height;var A=B*(this.get_relativeHeight()/100);if(this._maxHeight&&this._maxHeight<A){A=maxHeight;}$get(this.get_targetElementId()).style.height=A+"px";}this._execCompletionDelegate();},_execCompletionDelegate:function(){if(this.get_onCompletionDelegate()){eval(this.get_onCompletionDelegate());}},initialize:function(){PhotoSite.Framework.ElementSize.callBaseMethod(this,"initialize");this._initInvokeListener();},_initInvokeListener:function(){if(this.get_invokeElementId()){$addHandler($get(this.get_invokeElementId()),"click",this._invokeClickHandler);}},dispose:function(){PhotoSite.Framework.ElementSize.callBaseMethod(this,"dispose");}};PhotoSite.Framework.ElementSize.descriptor={properties:[{name:"invokeElementId"},{name:"targetElementId"},{name:"relativeHeight"},{name:"maxHeight"},{name:"onCompletionDelegate"}]};PhotoSite.Framework.ElementSize.registerClass("PhotoSite.Framework.ElementSize",PhotoSite.Framework.ControlBase);if(typeof(Sys)!=="undefined"){Sys.Application.notifyScriptLoaded();}
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();