var SITE_BRANCH_CLASS="SiteBranch";function SiteBranchManager(){this.componentClass=SITE_BRANCH_CLASS;}
SiteBranchManager.prototype=new AbstractComponentManager();SiteBranchManager.prototype.constructor=AbstractComponentManager;SiteBranchManager.prototype.toString=function(){return"SiteBranchManager"};SiteBranchManager.prototype.registerComponent=function registerComponent(id,props){this._nComponents.push(new SiteBranch(id,props));};function SiteBranch(id,props){AbstractComponent.apply(this,[id,props]);if(props){var pathProcessStrategyArg=props["pathProcessStrategy"],strategy;if(pathProcessStrategyArg){if(Function==pathProcessStrategyArg.constructor){strategy=pathProcessStrategyArg;}else if(String==pathProcessStrategyArg.constructor){strategy=SiteBranch[pathProcessStrategyArg];}}
this.processPath=strategy||null;}}
SiteBranch.SWITCHED_ON="switched-on";SiteBranch.SWITCHED_OFF="switched-off";SiteBranch._messages={"switchOn":"Expand","switchOff":"Collapse"};SiteBranch.addMessage=function addMessage(key,msg){SiteBranch._messages[key]=msg;};SiteBranch.udm4PathProcessStrategy=function(){var currentPageNode=$jq("#"+this._id+" .currentPage").get(0);$jq("a",currentPageNode).filter(":first").each(function(){var parent=this.parentNode,wrapper=document.createElement("span");wrapper.className="currentPageLinkWrapper";parent.replaceChild(wrapper,this);wrapper.appendChild(this);});$jq(currentPageNode).parents("li").each(function(){$jq("a",this).filter(":first").each(function(){var parent=this.parentNode,wrapper=document.createElement("span");wrapper.className="currentPageAncestorLinkWrapper";parent.replaceChild(wrapper,this);wrapper.appendChild(this);});});};SiteBranch.defaultPathProcessStrategy=function(){var currentPageNodes=$jq("#"+this._id+" .currentPage");currentPageNodes.each(function(i){var node=this.parentNode;while(node&&/(UL)|(LI)/.test(node.tagName.toUpperCase())){if("UL"==node.tagName.toUpperCase()&&"LI"==node.parentNode.tagName.toUpperCase()){node.className=SiteBranch.SWITCHED_ON;}
node=node.parentNode;}});$jq("#"+this._id+" .currentPage > ul").each(function(i){this.className=SiteBranch.SWITCHED_ON;});$jq("#"+this._id+" ul ul").each(function(i){if(SiteBranch.SWITCHED_ON!=this.className){this.className=SiteBranch.SWITCHED_OFF;}});};SiteBranch.prototype=new AbstractComponent();SiteBranch.prototype.constructor=SiteBranch;SiteBranch.prototype.toString=function(){return"SiteBranch, id: "+this._id;};SiteBranch.prototype.init=function init(){this.setDomElementById(this._id);if(!this.requireInit()){return;}
if(this.processPath&&0==$jq("#"+this._id+" .currentPage").size()){var resourceName=window.location.pathname;if(0<=resourceName.lastIndexOf("/")){var stringIndex=resourceName.lastIndexOf("/");resourceName=resourceName.substring(stringIndex+1,resourceName.length);}
var currentPagelinkNodes=$jq("#"+this._id+" a[@href="+resourceName+"]");currentPagelinkNodes.each(function(i){if("LI"!=this.parentNode.tagName.toUpperCase()){var msg="Assertion error, "+this._id+", currentPagelink.parentNode.tagName should be 'LI'";alert(msg);throw new Error(msg);}
this.parentNode.className+=" currentPage";});this.processPath();}
this.setInitialized(true);};application.addComponentManager(new SiteBranchManager(application));

