
var contentManager=null;function ContentManager()
{this.contentProviders=[];this.userParams=[];}
ContentManager.getInstance=function()
{if(!contentManager)
{contentManager=new ContentManager();}
return contentManager;};ContentManager.register=function(name,contentProvider)
{if(contentProvider.update)
{var contentMgr=ContentManager.getInstance();var providerInfo={};providerInfo[name]=contentProvider;contentMgr.contentProviders.push(providerInfo);if(contentProvider.updateOnLoad)
{$addHandler(window,"load",function()
{ContentManager.updateContent(name)});}}};ContentManager.setUserParams=function(userParams)
{var contentMgr=ContentManager.getInstance();contentMgr.userParams=userParams;};ContentManager.getParam=function(name)
{var contentMgr=ContentManager.getInstance();for(var i=0;i<contentMgr.userParams.length;i++)
{for(var userParamName in contentMgr.userParams[i])
{if(userParamName==name)
{return contentMgr.userParams[i][userParamName];}}}};ContentManager.setSingleUserParam=function(name,value)
{var contentMgr=ContentManager.getInstance();var found=false;for(var i=0;i<contentMgr.userParams.length;i++)
{for(var userParamName in contentMgr.userParams[i])
{if(userParamName==name)
{contentMgr.userParams[i][userParamName]=value;found=true;}
if(found)
{break;}}
if(found)
{break;}}
if(!found)
{var param={};param[name]=value;contentMgr.userParams.push(param);}};ContentManager.updateContent=function(name)
{var contentMgr=ContentManager.getInstance();var found=false;for(var i=0;i<contentMgr.contentProviders.length;i++)
{for(var providerName in contentMgr.contentProviders[i])
{if(found)
{break;}
if(providerName==name)
{contentMgr.contentProviders[i][name].update(contentMgr.userParams);found=true;}}
if(found)
{break;}}};ContentManager.updateAllContent=function()
{var contentMgr=ContentManager.getInstance();for(var i=0;i<contentMgr.contentProviders.length;i++)
{for(var providerName in contentMgr.contentProviders[i])
{contentMgr.contentProviders[i][providerName].update(contentMgr.userParams);}}};

function CustomizationPersistanceFactory()
{}
CustomizationPersistanceFactory.create=function(useDatabase)
{if(useDatabase)
{return new CustomizationDatabasePersister();}
return new CustomizationCookiePersister();};function CustomizationCookiePersister()
{this._persistComplete;}
CustomizationCookiePersister.prototype.setPersistComplete=function(persistComplete)
{this._persistComplete=persistComplete;};CustomizationCookiePersister.prototype.persist=function(values)
{var customCookie=CookieManager.getCookie("gisi");for(var name in values)
{customCookie.setValue(name,values[name]);}
customCookie.save(true);if(this._persistComplete)
{this._persistComplete(true,"");}};function CustomizationDatabasePersister()
{this._persistComplete;}
CustomizationDatabasePersister.prototype.setPersistComplete=function(value)
{this._persistComplete=value;};CustomizationDatabasePersister.prototype.persist=function(values)
{var command=CustomizationService.createCommand("Persist");for(var name in values)
{command.parameters[name]=values[name];}
var self=this;command.execute(function(response)
{if(self._persistComplete)
{self._persistComplete(response.success,response.value);}});};

function CustomizationChooser()
{this._chooserHeader=$get("chooserHeader");this._chooserBody=$get("chooserBody");this._persister;this._persistUserSelectionHandler=Function.createDelegate(this,this.persistUserSelection);this._persistCompleteHandler=Function.createDelegate(this,this.persistComplete);this._toggleHandler=Function.createDelegate(this,this.toggle);this._persistAndToggleHandler=Function.createDelegate(this,this.persistAndToggle);this._savedSelection;}
CustomizationChooser.getInstance=function()
{return new CustomizationChooser();};CustomizationChooser.init=function(isRemembered,savedSelection)
{var chooser=CustomizationChooser.getInstance();chooser._persister=CustomizationPersistanceFactory.create(isRemembered);chooser._persister.setPersistComplete(chooser._persistCompleteHandler);var showChooser=$get("showChooser");if(showChooser)
{$addHandler(showChooser,"click",chooser._toggleHandler);}
var showChooserHeader=$get("showChooserHeader");if(showChooserHeader)
{$addHandler(showChooserHeader,"click",chooser._persistAndToggleHandler);}
var hideChooser=$get("hideChooser");if(hideChooser)
{$addHandler(hideChooser,"click",chooser._persistAndToggleHandler);}
var choices=document.getElementsByName("choices");for(var i=0;i<choices.length;i++)
{$addHandler(choices[i],"click",chooser._persistUserSelectionHandler);}
chooser._savedSelection=savedSelection;var siteInfoCookie=CookieManager.getCookie("gisi");var interacted=siteInfoCookie.getValue("CCI");if(interacted!=1)
{chooser._toggleHandler();}};CustomizationChooser.prototype.toggle=function(e)
{e=e||window.event;if(this._chooserHeader&&this._chooserBody)
{Sys.UI.DomElement.toggleCssClass(this._chooserHeader,"hidden");Sys.UI.DomElement.toggleCssClass(this._chooserBody,"hidden");if(e)
{e.preventDefault();}}};CustomizationChooser.prototype.persistAndToggle=function(e)
{var choices=document.getElementsByName("choices");var checkedChoice;var generalChoice;for(var i=0;i<choices.length;i++)
{if(choices[i].checked)
{checkedChoice=choices[i];}
if(choices[i].value==0)
{generalChoice=choices[i];}}
var interacted=this.saveUserInteraction();if(!checkedChoice)
{checkedChoice=generalChoice;generalChoice.checked=true;}
if(checkedChoice.value!=this._savedSelection||!interacted)
{this.persist(checkedChoice.value,checkedChoice.trackingId);this._savedSelection=checkedChoice.value;}
this.toggle(e);};CustomizationChooser.prototype.persistUserSelection=function(e)
{e=e||window.event;var target=e.target||e.srcElement;if(target.checked)
{this.saveUserInteraction();this.persist(target.value,target.trackingId);this._savedSelection=target.value;}};CustomizationChooser.prototype.saveUserInteraction=function()
{var siteInfoCookie=CookieManager.getCookie("gisi");var interacted=siteInfoCookie.getValue("CCI");if(!interacted)
{siteInfoCookie.setValue("CCI",1);siteInfoCookie.save(true);return false;}
return true;};CustomizationChooser.prototype.persist=function(categoryId,trackingId)
{this._persister.persist({"IMP":categoryId});TrackingManager.reportZone(trackingId);};CustomizationChooser.prototype.persistComplete=function(success,value)
{if(success&&value=="")
{ContentManager.updateAllContent();}};

function CmsContainerView(id,updateMethod,updateOnLoad)
{this.id=id;this.updateMethod=updateMethod;this.updateOnLoad=updateOnLoad;}
CmsContainerView.getInstance=function(id,updateMethod,updateOnLoad)
{return new CmsContainerView(id,updateMethod,updateOnLoad);};CmsContainerView.prototype.update=function()
{var updatePanel=LiteViewUpdatePanel.getInstance(this.id);updatePanel.update(this.updateMethod);};