function StringBuffer(){this.buffer=[]}StringBuffer.prototype.append=function(a){this.buffer.push(a);return this};StringBuffer.prototype.toString=function(){return this.buffer.join("")};function ctTreeInfo(a,b,c,e){this.nodeProperties=a;this.currentItem=null;this.prefix=b;this.hideType=c;this.expandLevel=e;this.endIndex=this.beginIndex=0}function ctMenuInfo(a,b){this.id=a;this.idSub=b}
var _ctIDSubMenuCount=0,_ctIDSubMenu="ctSubTreeID",_ctCurrentItem=null,_ctNoAction={},_ctItemList=[],_ctTreeList=[],_ctMenuList=[],_ctMenuInitStr="",_ctNodeProperties={folderLeft:[["",""]],folderRight:[["",""]],itemLeft:[""],itemRight:[""],folderConnect:[[["",""],["",""]]],itemConnect:[["",""],["",""]],spacer:[["&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;","&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"]],themeLevel:1};function ctNewSubMenuID(){return _ctIDSubMenu+ ++_ctIDSubMenuCount}
function ctActionItem(){return' onmouseover="ctItemMouseOver (this.parentNode)" onmouseout="ctItemMouseOut (this.parentNode)" onmousedown="ctItemMouseDown (this.parentNode)" onmouseup="ctItemMouseUp (this.parentNode)"'}function ctNoActionItem(a){return a[1]}function ctGetPropertyLevel(a,b){return a>=b.length?b.length-1:a}function ctCollapseTree(a){a=ctGetObject(a).firstChild;var b;for(b=0;b<a.ctItems.length;++b)ctCloseFolder(a.ctItems[b])}
function ctExpandTree(a,b){if(!(b<=0)){var c=ctGetObject(a);if(c)(c=c.firstChild)&&ctExpandTreeSub(c,b)}}function ctExpandTreeSub(a,b){if(!(a.ctLevel>=b)){var c,e;for(c=0;c<a.ctItems.length;++c){e=a.ctItems[c];if(e.ctIdSub){ctOpenFolder(e);ctExpandTreeSub(ctGetObject(e.ctIdSub),b)}}}}function ctExposeItem(a,b){if(!(a<0||a>=_ctTreeList.length)){var c=_ctTreeList[a],e=c.endIndex;for(c=c.beginIndex;c<e;++c)if(_ctItemList[c].length>2&&_ctItemList[c][2]==b)return ctExposeTreeIndex(a,c)}}
function ctExposeTreeIndex(a,b){var c=ctGetObject("ctItemID"+(_ctTreeList[a].beginIndex+b)).parentNode;if(!c)return null;var e=ctGetThisMenu(c).ctParent;e&&ctExposeTreeIndexSub(e);ctSetSelectedItem(c);return c}function ctExposeTreeIndexSub(a){var b=ctGetThisMenu(a).ctParent;b&&ctExposeTreeIndexSub(b);ctOpenFolder(a)}
function ctMarkItem(a,b){if(!(a<0||a>=_ctTreeList.length)){var c=_ctTreeList[a],e=c.endIndex;for(c=c.beginIndex;c<e;++c)if(_ctItemList[c].length>2&&_ctItemList[c][2]==b){e=ctGetObject("ctItemID"+(_ctTreeList[a].beginIndex+c)).parentNode;if(!e)return null;if(e.id=="JSCookTreeItem")e.id="JSCookTreeMarked";return e}}}function ctMarkTreeIndex(a,b){var c=ctGetObject("ctItemID"+(_ctTreeList[a].beginIndex+b)).parentNode;if(!c)return null;if(c.id=="JSCookTreeItem")c.id="JSCookTreeMarked";return c}
function ctGetSelectedItem(a){return _ctTreeList[a].hideType<=1?_ctTreeList[a].currentItem:_ctCurrentItem}
function ctDraw(a,b,c,e,f,g){var j=ctGetObject(a);c||(c=_ctNodeProperties);e||(e="");f||(f=0);g||(g=0);_ctTreeList[_ctTreeList.length]=new ctTreeInfo(c,e,f,g);f=_ctTreeList.length-1;var o=_ctItemList.length;_ctMenuInitStr="";b=ctDrawSub(b,true,null,f,0,c,e,"");j.innerHTML=b;eval(_ctMenuInitStr);_ctMenuInitStr="";j=_ctItemList.length;_ctTreeList[f].beginIndex=o;_ctTreeList[f].endIndex=j;g&&ctExpandTree(a,g);return f}
function ctDrawSub(a,b,c,e,f,g,j,o){var h=f;if(h>g.themeLevel)h=g.themeLevel;var i='<div class="'+j+"TreeLevel"+h+'"';b||(i+=' id="'+c+'"');i+=">";var p,k,n,l,m;b=b?0:5;c=' class="'+j+'Row"';var d=new StringBuffer;for(d.append(i);b<a.length;++b)if(i=a[b]){_ctItemList[_ctItemList.length]=i;h=_ctItemList.length-1;p=(k=i.length>5)?ctNewSubMenuID():null;d.append('<table cellspacing="0" class="');d.append(j);d.append('Table">');d.append("<tr");d.append(c);k?d.append(' id="JSCookTreeFolderClosed">'):d.append(' id="JSCookTreeItem">');
n=j+(k?"Folder":"Item");l="ctItemID"+h;m=' id="'+l+'"';_ctMenuInitStr+='ctSetupItem (ctGetObject ("'+l+'").parentNode,'+h+","+e+","+f+","+(p?'"'+p+'"':"null")+");";d.append('<td class="');d.append(n);d.append('Spacer"');d.append(m);d.append(">");d.append(o);d.append("</td>");if(i[0]==_ctNoAction){d.append(ctNoActionItem(i,j));d.append("</tr></table>")}else{m=ctActionItem();d.append('<td class="');d.append(n);d.append('Left"');d.append(m);d.append(">");if(k){l=ctHasNextItem(b,a)?0:1;h=ctGetPropertyLevel(f,
g.folderConnect);d.append('<span class="JSCookTreeFolderClosed">');d.append(g.folderConnect[h][l][0]);d.append("</span>");d.append('<span class="JSCookTreeFolderOpen">');d.append(g.folderConnect[h][l][1]);d.append("</span>")}else{l=ctHasNextItem(b,a)?0:1;h=ctGetPropertyLevel(f,g.itemConnect);d.append(g.itemConnect[h][l])}if(i[0]!=null&&i[0]!=_ctNoAction)d.append(i[0]);else if(k){h=ctGetPropertyLevel(f,g.folderLeft);d.append('<span class="JSCookTreeFolderClosed">');d.append(g.folderLeft[h][0]);d.append("</span>");
d.append('<span class="JSCookTreeFolderOpen">');d.append(g.folderLeft[h][1]);d.append("</span>")}else{h=ctGetPropertyLevel(f,g.itemLeft);d.append(g.itemLeft[h])}d.append("</td>");d.append('<td class="');d.append(n);d.append('Text"');d.append(m);d.append(">");d.append("<a");if(i[2]!=null){d.append(' href="');d.append(i[2]);d.append('"');if(i[3]){d.append(' target="');d.append(i[3]);d.append('"')}}if(i[4]!=null){d.append(' title="');d.append(i[4])}else{d.append(' title="');d.append(i[1])}d.append('"');
d.append(">");d.append(i[1]);d.append("</a></td>");d.append('<td class="');d.append(n);d.append('Right"');d.append(m);d.append(">");if(k){h=ctGetPropertyLevel(f,g.folderRight);d.append('<span class="JSCookTreeFolderClosed">');d.append(g.folderRight[h][0]);d.append("</span>");d.append('<span class="JSCookTreeFolderOpen">');d.append(g.folderRight[h][1]);d.append("</span>")}else{h=ctGetPropertyLevel(f,g.itemRight);d.append(g.itemRight[h])}d.append("</td>");d.append("</tr></table>");if(k){k=o;h=ctGetPropertyLevel(f,
g.spacer);k+=g.spacer[h][l];i=ctDrawSub(i,false,p,e,f+1,g,j,k);d.append(i)}}}d.append("</div>");return d}function ctItemMouseOver(a){if(ctIsDefaultItem(_ctItemList[a.ctIndex])){var b=ctGetDefaultClassName(a);if(a.className==b)a.className=b+"Hover"}}
function ctItemMouseOut(a){if(ctIsDefaultItem(_ctItemList[a.ctIndex])){var b=ctGetDefaultClassName(a);if(a.className==b+"Hover"||a.className==b+"Active"){var c=_ctTreeList[a.ctTreeIndex];a.className=a==(c.hideType<=1?c.currentItem:_ctCurrentItem)?b+"Selected":b}}}function ctItemMouseDown(a){if(ctIsDefaultItem(_ctItemList[a.ctIndex])){var b=ctGetDefaultClassName(a);if(a.className==b+"Hover")a.className=b+"Active"}}
function ctItemMouseUp(a){if(a.ctIdSub)ctGetObject(a.ctIdSub).style.display=="block"?ctCloseFolder(a):ctOpenFolder(a);ctSetSelectedItem(a)}
function ctSetSelectedItem(a){var b=_ctTreeList[a.ctTreeIndex],c=b.hideType,e;e=c<=1?b.currentItem:_ctCurrentItem;if(e!=a){ctLabelMenu(a);if(e){if(ctIsDefaultItem(_ctItemList[e.ctIndex])){var f=ctGetDefaultClassName(e);if(e.className==f+"Selected")e.className=f}c>0&&e&&ctHideMenu(e,a)}if(c<=1)b.currentItem=a;else _ctCurrentItem=a;if(ctIsDefaultItem(_ctItemList[a.ctIndex])){f=ctGetDefaultClassName(a);a.className=f+"Selected"}}}
function ctIsFolderOpen(a){if(a.id=="JSCookTreeFolderOpen")return true;return false}function ctOpenFolder(a){if(!ctIsFolderOpen(a))if(a.ctIdSub){ctGetObject(a.ctIdSub).style.display="block";a.id="JSCookTreeFolderOpen"}}function ctCloseFolder(a){if(ctIsFolderOpen(a))if(a.ctIdSub){var b=ctGetObject(a.ctIdSub),c;for(c=0;c<b.ctSubMenu.length;++c)ctCloseFolder(b.ctSubMenu[c].ctParent);if(!(a.ctLevel<_ctTreeList[a.ctTreeIndex].expandLevel)){b.style.display="none";a.id="JSCookTreeFolderClosed"}}}
function ctSetupItem(a,b,c,e,f){if(!a.ctIndex){a.ctIndex=b;a.ctTreeIndex=c;a.ctLevel=e;a.ctIdSub=f}b=ctGetThisMenu(a);ctSetupMenu(b,a,null,null);if(f){f=ctGetObject(f);ctSetupMenu(f,null,b,a)}}function ctSetupMenu(a,b,c,e){if(!a.ctSubMenu)a.ctSubMenu=[];if(e)if(!a.ctParent){a.ctParent=e;a.ctLevel=e.ctLevel+1;c.ctSubMenu[c.ctSubMenu.length]=a}if(b)if(!b.ctMenu){b.ctMenu=a;a.ctLevel=b.ctLevel;if(!a.ctItems)a.ctItems=[];a.ctItems[a.ctItems.length]=b}}
function ctLabelMenu(a){for(var b=ctGetThisMenu(a);b&&b.ctLevel!=0;){b.ctCurrentItem=a;b=ctGetThisMenu(b.ctParent)}}function ctHideMenu(a,b){for(var c;a;){if(a.ctIdSub&&(c=ctGetObject(a.ctIdSub)).ctLevel&&c.ctCurrentItem!=b)ctCloseFolder(a);a=ctGetThisMenu(a).ctParent}}
function ctGetThisMenu(a){var b=_ctTreeList[a.ctTreeIndex].prefix;if(a.ctLevel==0)b+="TreeLevel0";else{var c=_ctTreeList[a.ctTreeIndex].nodeProperties.themeLevel;b+="TreeLevel"+(a.ctLevel<c?a.ctLevel:c)}for(;a;){if(a.className==b)return a;a=a.parentNode}return null}function ctHasNextItem(a,b){return a<b.length-2||a==b.length-2&&b[a+1]?true:false}function ctGetDefaultClassName(a){return _ctTreeList[a.ctTreeIndex].prefix+"Row"}
function ctIsDefaultItem(a){if(a[0]==_ctNoAction)return false;return true}function ctGetObject(a){if(document.all)return document.all[a];return document.getElementById(a)}function ctGetProperties(a){var b=a+":\n",c;for(c in a)b+=c+" = "+a[c]+"; ";return b};
