﻿Type.registerNamespace("PhotoSite.Framework");PhotoSite.Framework.RegionManager=function(A){PhotoSite.Framework.RegionManager.initializeBase(this,[A]);this._regions=new Object();};PhotoSite.Framework.RegionManager.prototype={hideAll:function(){for(var A in this._regions){this._regions[A].hide();}},showAll:function(){for(var A in this._regions){this._regions[A].show();}},registerRegion:function(A){this._regions[A.get_regionId()]=A;},unregisterRegion:function(A){this._regions[A.get_regionId()]=null;},getRegion:function(A){return this._regions[A];},initialize:function(){PhotoSite.Framework.RegionManager.callBaseMethod(this,"initialize");this.get_element().RegionManager=this;},dispose:function(){PhotoSite.Framework.RegionManager.callBaseMethod(this,"dispose");}};PhotoSite.Framework.RegionManager.descriptor={properties:[{name:"registeredControls"}]};PhotoSite.Framework.RegionManager.registerClass("PhotoSite.Framework.RegionManager",PhotoSite.Framework.ControlBase);PhotoSite.Framework.Region=function(A){PhotoSite.Framework.Region.initializeBase(this,[A]);this._isVisible=false;};PhotoSite.Framework.Region.prototype={hide:function(){this._isVisible=false;this._setVisibility();this.raiseEvent("hide");},show:function(){this._isVisible=true;this._setVisibility();this.raiseEvent("show");},_setVisibility:function(){if(this._useVisibilityMode==true&&(Sys.Browser.agent!=Sys.Browser.InternetExplorer)){this.get_element().style.height=(this._isVisible==true)?"":"0";}else{this.get_element().style.display=(this._isVisible==true)?"":"none";}},initialize:function(){PhotoSite.Framework.Region.callBaseMethod(this,"initialize");this.get_element().Region=this;this._registerRegion();this.hide();},_registerRegion:function(){$get(this._regionManagerId).RegionManager.registerRegion(this);},_unregisterRegion:function(){$get(this._regionManagerId).RegionManager.unregisterRegion(this);},dispose:function(){this._unregisterRegion();this.get_element().Region=null;PhotoSite.Framework.Region.callBaseMethod(this,"dispose");},get_visibility:function(){return this._isVisible;}};PhotoSite.Framework.Region.descriptor={properties:[{name:"regionId"},{name:"regionManagerId"},{name:"useVisibilityMode"}],events:[{name:"hide"},{name:"show"}]};PhotoSite.Framework.Region.registerClass("PhotoSite.Framework.Region",PhotoSite.Framework.ControlBase);PhotoSite.Framework.Template=function(A,B,C){PhotoSite.Framework.Template.initializeBase(this);this._template=A;this._scriptInitializers=B;this._scriptResources=C;this._element=null;this._span=null;if(this._scriptResources){$scriptManager.load(C,Function.createDelegate(this,function(){this._scriptsLoaded=true;}));}else{this._scriptsLoaded=true;}};PhotoSite.Framework.Template.prototype={_scriptsLoaded:false,instantiateIn:function(D,C,E){if(!this._scriptsLoaded){setTimeout(Function.createDelegate(this,function(){this.instantiateIn(D,C,E);}),10);return;}this._element=D;this._span=document.createElement("span");var B=this._template.replace(/PNI_VM/g,D.id);D.appendChild(this._span);var A=((this._element.Region)&&(this._element.Region.get_visibility()==false));if(this._element.Region){this._element.Region.show();}this._span.innerHTML=unescape(B);this._executeScriptInitializers(D.id,C,E);if(A==true){this._element.Region.hide();}},_tearDownChildren:function(E){if(!E||!E.hasChildNodes()){return;}var A=E.childNodes;for(var B=0;B<A.length;B++){var C=A[B];if(C.control&&C.control.dispose){var D=C.control;D.dispose();}while(C._behaviors&&C._behaviors.length>0){var F=C._behaviors[0];F.dispose();}this._tearDownChildren(C);}},_disposeChildren:function(D){if(!D.hasChildNodes()){return;}var A=D.childNodes;for(var B=0;B<A.length;B++){var C=A[B];if(C.control){$log(this).debug("<!> warning: "+C.id+" control not disposed!");C.control=null;}if(C._behaviors){$log(this).debug("<!> warning: "+C.id+" behaviors not disposed!");for(var B=0;B<C._behaviors.length;B++){$log(this).debug("    "+C._behaviors[B].constructor.__typeName);}C._behaviors=null;}if(C._events){$log(this).debug("<!> warning: "+C.id+" events not disposed!");for(var E in C._events){$log(this).debug("    "+E+" event: "+C._events[E]);}C._events=null;}this._disposeChildren(C);}},tearDown:function(){this._tearDownChildren(this._element);this._element.removeChild(this._span);if(this._element.Region){this._element.Region.hide();}},_updateScriptInitializerDataItem:function(C,G){var B=C.split(':"PNI_DI');var A=B[0];for(var D=1;D<B.length;D++){var E=B[D];A+=":dataItem";if(E.charAt(0)==='"'){A+=E.substring(1);}else{var F=E.indexOf('"');A+=E.substring(0,F);A+=E.substring(F+1);}}return A;},_executeScriptInitializers:function(id,registeredControls,dataItem){if(this._scriptInitializers==null){return;}for(var sii=0;sii<this._scriptInitializers.length;sii++){var js=this._scriptInitializers[sii].replace(/PNI_VM/g,id);try{js=this._updateScriptInitializerDataItem(js,dataItem);js=this._replaceRegisteredControlIds(js,registeredControls);eval(js);}catch(ex){$log(this).debug("script initializer: "+js+" error: "+ex);}}},_replaceRegisteredControlIds:function(E,A){if(!A){return E;}var D=E;for(var B=0;B<A.length;B++){var C=new RegExp(A[B].RegisterId,"g");D=D.replace(C,A[B].ControlId);}return D;},initialize:function(){PhotoSite.Framework.Template.callBaseMethod(this,"initialize");},dispose:function(){PhotoSite.Framework.Template.callBaseMethod(this,"dispose");}};PhotoSite.Framework.Template.registerClass("PhotoSite.Framework.Template",Sys.Component);if(typeof(Sys)!=="undefined"){Sys.Application.notifyScriptLoaded();}
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();