// com.nivaria.ncm.component.contentset.js, nivaria.com, 2007-05-01 cGuyomard

CONTENT_SET_CLASS="ContentSet";function ContentSetManager(){this.componentClass=CONTENT_SET_CLASS;}
ContentSetManager.prototype=new AbstractComponentManager();ContentSetManager.prototype.constructor=AbstractComponentManager;ContentSetManager.prototype.toString=function(){return"ContentSetManager";};ContentSetManager.prototype.registerComponent=function registerComponent(id,props){this._nComponents.push(new ContentSet(id,props));};function ContentSet(id,props){AbstractComponent.apply(this,[id,props]);}
ContentSet.getUnitStateNode=function getUnitStateNode(child){var o=child;while(o){if(o.tagName&&"LI"==o.tagName.toUpperCase()){break;}
o=o.parentNode;}
return o;}
ContentSet.prototype=new AbstractComponent();ContentSet.prototype.constructor=ContentSet;ContentSet.prototype.toString=function(){return"ContentSet, id: "+this._id};ContentSet.prototype.init=function init(){this.setDomElementById(this._id);$jq("#"+this._id+" ul.toc > li").each(function(i){this.className="unselected";});$jq("#"+this._id+" ul.units > li").each(function(i){this.className="unselected";});$jq("#"+this._id+" ul.toc > li:first-child").each(function(i){this.className="selected";});$jq("#"+this._id+" ul.units > li:first-child").each(function(i){this.className="selected";});$jq("#"+this._id+" ul.toc > li a.title").each(function(i){this.onclick=function(){return false;}});var componentNode=this._domElement;var unitStateNode=$jq("")[0];$jq("#"+this._id+" ul.toc > li").each(function(i){this.onclick=function(){var linkToAnchor=$jq(this).find("a.title")[0];var contentSet=self;var anchor=document.getElementById(linkToAnchor.hash.replace(/#/,""));var selectedTocNode=this;var selectedUnitStateNode=ContentSet.getUnitStateNode(anchor);var stateNode=null;stateNode=selectedTocNode.parentNode.firstChild;while(stateNode){if(stateNode.tagName&&selectedTocNode.tagName==stateNode.tagName){if(stateNode==selectedTocNode){stateNode.className="selected";}else{stateNode.className="unselected";}}
stateNode=stateNode.nextSibling;}
var stateNode=null;var i=0;stateNode=selectedUnitStateNode.parentNode.firstChild;while(stateNode){if(stateNode.tagName&&selectedUnitStateNode.tagName==stateNode.tagName){if(stateNode==selectedUnitStateNode){stateNode.className="selected";}else{stateNode.className="unselected";}}
stateNode=stateNode.nextSibling;}
var stateNode=null;};});this.setInitialized(true);};application.addComponentManager(new ContentSetManager(application));

