function addPartnerAd(language,trackUrl,logo,linktext,webPage,position){var nbPartnerAds;nbPartnerAds=this.partnerAds.length;this.partnerAds[nbPartnerAds]=new PartnerAd(language,trackUrl,logo,linktext,webPage,position);}function addPartnerAdLeft(language,trackUrl,logo,linktext,webPage){this.addPartnerAd(language,trackUrl,logo,linktext,webPage,"left");}function addPartnerAdRight(language,trackUrl,logo,linktext,webPage){this.addPartnerAd(language,trackUrl,logo,linktext,webPage,"right");}function getPartnerAdsAt(position){var partnerAdsFound=new Array();var rank=0;for(adRank=0;adRank<this.partnerAds.length;adRank++){if(this.partnerAds[adRank].position==position&&this.partnerAds[adRank].language==Lang){partnerAdsFound[rank]=this.partnerAds[adRank];rank++;}}return partnerAdsFound;}function Tree(name,rootName,defaultNodeName,nodeStyle,leafStyle,currentLeafStyle){var rootNode;if(AllTrees[name]!=null){alert("Cannot create tree: name "+name+" already exists");return-1;}this.name=name;rootNode=AllNodes[rootName];if(rootNode!=null)this.root=rootNode;else{alert("Cannot create tree: "+name+" because root node: "+rootName+" does not exist");return-1;}this.currentNode=null;this.defaultNodeName=defaultNodeName;this.expanded=true;this.nodeStyle=nodeStyle;this.leafStyle=leafStyle;this.currentLeafStyle=currentLeafStyle;this.container=null;this.storeExpandedState=true;this.partnerAds=new Array();this.randomAdOrder=true;this.addPartnerAd=addPartnerAd;this.addPartnerAdLeft=addPartnerAdLeft;this.addPartnerAdRight=addPartnerAdRight;this.getPartnerAdsAt=getPartnerAdsAt;rootNode.tree=this;AllTrees[name]=this;}function Toc(name,tree){this.name=name;this.tree=tree;this.section=null;tree.container=this;}function PartnerAd(language,trackUrl,logo,linktext,webPage,position){this.language=language;this.trackUrl=trackUrl;this.logo=logo;this.linktext=linktext;this.headertext=LocStr[Lang]["_partnerHeaderText"];this.webPage=webPage;if(position!="left"&&position!="right"){alert("Incorrect position for partner ad: "+position+". Assuming 'left'");this.position="left";}else this.position=position;this.getPartnerAdCode=getPartnerAdCode;}function getPartnerAdCode(homePath,imagesPath,fext){var code="";if(this.language==Lang||this.language==null){if(this.headertext!=""||this.logo!=""||this.linktext!=""){if(this.webPage)linkCode="<a href=\""+this.webPage+"\" onclick=\"javascript:window.open('"+homePath+this.trackUrl+"'); return false;\">";else linkCode="<a rel=\"nofollow\" target=\"_blank\" href=\""+homePath+this.trackUrl+"\">";code+=getCodeLine("<div class=\"partnerAdBlock_"+this.position+"\">",fext);if(this.headertext)code+=getCodeLine("<span class=\"partnerAdTextTop\">"+this.headertext+"</span><br/>",fext);if(this.logo)code+=getCodeLine(linkCode+"<img alt=\"\" class=\"partnerAdLogo\" src=\""+imagesPath+this.logo+"\"/></a>",fext);if(this.linktext)code+=getCodeLine("<br /><div class=\"partnerAdLink\">"+linkCode+this.linktext+"</a></div>",fext);code+=getCodeLine("</div>",fext);}}return code;}function getTreeButtonsCode(node,homePath,imagesPath,fext){var code="";var expandLink;var collapseLink;var rootName=node.tree.root.name;var expandAllText=LocStr[Lang]["_expandAll"];var collapseAllText=LocStr[Lang]["_collapseAll"];expandLink="  <a onfocus=\"this.blur()\" onmouseover='status=\"\";return true;' href='javascript:AllNodes[\""+rootName+"\"].expandDescendentsAndRefresh(\""+homePath+"\")'>";collapseLink="  <a onfocus=\"this.blur()\" onmouseover='status=\"\";return true;' href='javascript:AllNodes[\""+rootName+"\"].collapseDescendentsAndRefresh()\'>";code+=getCodeLine("<table border=\"0\" class=\"treeButtonBarTable\" cellpadding=\"0\" cellspacing=\"0\" width=\""+MenuWidth+"\"><tr>",fext);code+=getCodeLine("<td class=\"treeButtonBarCell\">",fext);code+=getCodeLine(" <span class=\"treeButtonBarIcon\">",fext);code+=getCodeLine(expandLink+"<img alt=\""+expandAllText+"\" src=\""+imagesPath+"expand_all.gif\" border=\"0\"/></a>",fext);code+=getCodeLine(" </span>",fext);code+=getCodeLine(" <span class=\"treeButtonBarLink\">",fext);code+=getCodeLine(expandLink+expandAllText+"</a>",fext);code+=getCodeLine(" </span>",fext);code+=getCodeLine("</td><td class=\"treeButtonBarCell\">",fext);code+=getCodeLine(" <span class=\"treeButtonBarIcon\">",fext);code+=getCodeLine(collapseLink+"<img alt=\""+collapseAllText+"\" src=\""+imagesPath+"collapse_all.gif\" border=\"0\"/></a>",fext);code+=getCodeLine(" </span>",fext);code+=getCodeLine(" <span class=\"treeButtonBarLink\">",fext);code+=getCodeLine(collapseLink+collapseAllText+"</a>",fext);code+=getCodeLine(" </span>",fext);code+=getCodeLine("</td></tr></table>",fext);return code;}function getAllPartnerAdsAtCode(node,homePath,imagesPath,position,fext){var code="";var orderedPartnerAds;var nbPartnerAds;var adRank;if(node.tree.randomAdOrder)orderedPartnerAds=randomizeTable(node.tree.getPartnerAdsAt(position));else orderedPartnerAds=node.tree.getPartnerAdsAt(position);nbPartnerAds=orderedPartnerAds.length;for(adRank=0;adRank<nbPartnerAds;adRank++)code+=orderedPartnerAds[adRank].getPartnerAdCode(homePath,imagesPath,fext);return code;}function getRandomizedParnerAdCodeAt(node,homePath,imagesPath,position,fext){var code="";if(node.tree.randomAdOrder&&node.tree.getPartnerAdsAt(position).length>1){code+=getCodeLine("<script type=\"text/javascript\">",fext);code+=getCodeLine("  document.write(getAllPartnerAdsAtCode(AllNodes[\""+node.name+"\"], \""+homePath+"\", \""+imagesPath+"\", \""+position+"\", \".htm\"));",fext);code+=getCodeLine("</script>",fext);code+=getCodeLine("<noscript>",fext);code+=getAllPartnerAdsAtCode(node,homePath,imagesPath,position,fext);code+=getCodeLine("</noscript>",fext);}else{code+=getAllPartnerAdsAtCode(node,homePath,imagesPath,position,fext);}return code;}function getTocCode(rootNode,homePath,imagesPath,fext){var code="";var sectionName;var topValue;var widthValue;sectionName=rootNode.tree.container.section.name;code+=getCodeLine("<!-- Corner image(s) -->",fext);code+=getCodeLine(getZoneStartLeft(0,56),fext);code+=getCodeLine("<img alt=\"\" src=\""+imagesPath+"nav_bar_corner_left"+sectionName+".png\" />",fext);code+=getCodeLine(getZoneEnd(),fext);code+=getCodeLine("<!-- Background image of menu - not used for the time being -->",fext);code+=getCodeLine("<!--",fext);code+=getCodeLine(getZoneStartLeft(0,57),fext);code+=getCodeLine("<img alt=\"\" src=\""+imagesPath+"nav_bar_h_image"+sectionName+".png\" />",fext);code+=getCodeLine(getZoneEnd(),fext);code+=getCodeLine("-->",fext);code+=getCodeLine("<a href=\""+homePath+LocStr[Lang][HomeNodeName+"_url"]+"\">",fext);code+=getCodeLine("<img src=\""+imagesPath+"logo_top.jpg\" class=\"logoTop\" alt=\""+LocStr[Lang]["_homeImageTooltip"]+"\" />",fext);code+=getCodeLine("</a>",fext);topValue=60;if(!rootNode.hasOnlyLeaves(true)){code+=getCodeLine("<div style=\"position: absolute; left: 0px; top: "+topValue+"px; width: "+MenuWidth+"px\">",fext);code+=getTreeButtonsCode(rootNode,homePath,imagesPath,fext);code+=getCodeLine("</div>",fext);topValue+=35;}widthValue=MenuWidth-19;code+=getCodeLine("<div style=\"position: absolute; left: 0px; top: "+topValue+"px; width: "+widthValue+"px\">",fext);code+=getNodeCode(rootNode,homePath,imagesPath,fext);code+=getRandomizedParnerAdCodeAt(rootNode,homePath,imagesPath,"left",fext);code+=getCodeLine("</div>",fext);return code;}
