var o_jsp=null,o_sfnc,o_rfnc,o_cfnc,o_param,i_pw,i_ph,i_int,i_a,s_html,b_scrl;function PanelWrapper(sPnl,dPnl){this.sPnl=sPnl;this.dPnl=dPnl;} function showJSPanels(intWidth,intHeight,strHtml,bolScroll,intZIndex,objCallback,objParams){if(o_jsp==null){var objBody;if(window.onscroll!=null&&window.onscroll!=scrollJSPanels)o_sfnc=window.onscroll;if(window.onscroll!=scrollJSPanels)window.onscroll=scrollJSPanels;if(window.onresize!=null&&window.onresize!=resizeJSPanels)o_rfnc=window.onresize;if(window.onresize!=resizeJSPanels)window.onresize=resizeJSPanels;i_pw=intWidth;i_ph=intHeight;s_html=strHtml;i_a=0;if(bolScroll==null)b_scrl=false;else b_scrl=bolScroll;o_cfnc=objCallback;o_param=objParams;objBody=document.getElementsByTagName("body")[0];o_jsp=new PanelWrapper(document.createElement("div"),document.createElement("div"));with(o_jsp){sPnl.style.position="absolute";sPnl.style.backgroundColor="black";sPnl.style.opacity=0.0;sPnl.style.filter="alpha(opacity=0)";if(intZIndex!=null)sPnl.style.zIndex=intZIndex;dPnl.style.position="absolute";dPnl.style.overflow="hidden";dPnl.style.height=50;dPnl.style.width=50;dPnl.style.backgroundColor="white";dPnl.style.textAlign="left";if(intZIndex!=null)dPnl.style.zIndex=(intZIndex+1);i_int=0;resizeJSPanels();objBody.appendChild(sPnl);objBody.appendChild(dPnl);i_int=window.setInterval("incPanelSize()",10);}}} function closeJSPanels(){if(o_jsp!=null){var objBody=document.getElementsByTagName("body")[0];try{window.clearInterval(i_int);}catch(ex){}objBody.removeChild(o_jsp.sPnl);objBody.removeChild(o_jsp.dPnl);o_jsp=null;}} function scrollJSPanels(){if(o_jsp!=null)priv_resizeJSPanels();if(o_sfnc!=null)o_sfnc();} function resizeJSPanels(){if(o_jsp!=null)priv_resizeJSPanels();if(o_rfnc!=null)o_rfnc();} function getCssLength(strLength){var strEnd="";if(strLength.length>=3)strEnd=strLength.substr(strLength.length-2,2);if(strEnd=="px")return new Number(strLength.substr(0,strLength.length-2));else return new Number(strLength);} function priv_resizeJSPanels(){var objBody=document.getElementsByTagName("body")[0];with(o_jsp){sPnl.style.top=objBody.scrollTop;sPnl.style.left=objBody.scrollLeft;sPnl.style.width=objBody.clientWidth;sPnl.style.height = document.body.clientHeight;if(i_int==-1){intSize=i_pw;if(i_pw>document.body.clientWidth) intSize = document.body.clientWidth;dPnl.style.width=intSize;intSize=i_ph;if(i_ph>document.body.clientHeight) intSize=document.body.clientHeight;dPnl.style.height=intSize;}dPnl.style.top=((document.body.clientHeight-getCssLength(dPnl.style.height))/2)+objBody.scrollTop;dPnl.style.left=((document.body.clientWidth-getCssLength(dPnl.style.width))/2)+objBody.scrollLeft;}} function incPanelSize(){with(o_jsp){if(i_a<70){i_a+=5;sPnl.style.opacity=(i_a/100);sPnl.style.filter="alpha(opacity="+new String(i_a)+");";}var objBody=document.getElementsByTagName("body")[0],intW=getCssLength(dPnl.style.width),intH=getCssLength(dPnl.style.height);if(intW!=i_pw){intW=incSizeVar(intW,i_pw);dPnl.style.width=intW;dPnl.style.left=((document.body.clientWidth-intW)/2)+objBody.scrollLeft;}else if(intH!=i_ph){intH=incSizeVar(intH,i_ph);dPnl.style.height=intH;dPnl.style.top=((document.body.clientHeight-intH)/2)+objBody.scrollTop;}else{window.clearInterval(i_int);i_int=-1;if(b_scrl) dPnl.style.overflow="scroll";dPnl.innerHTML=s_html;resizeJSPanels();if(o_cfnc!=null) o_cfnc(o_param);}}} function incSizeVar(intSize,intFinal){if(intSize<intFinal&&intSize+10<=intFinal)intSize+=10;else if(intSize>intFinal&&intSize-10>=intFinal)intSize-=10;else intSize=intFinal;return intSize;} function changePanel(intWidth,intHeight,strHtml,bolScroll,intZIndex,objCallback,objParams){if(intWidth!=null)i_pw=intWidth;if(intHeight!=null)i_ph=intHeight;if(strHtml==null)s_html="";else s_html=strHtml;if(bolScroll==null)b_scrl=false;else b_scrl=bolScroll;o_cfnc=objCallback;o_param=objParams;o_jsp.dPnl.innerHTML="";o_jsp.dPnl.style.overflow="hidden";i_int=window.setInterval("incPanelSize()",10);}
var ROUNDED_MENU_EXPAND=75,ROUNDED_MENU_DELTA=12;function RoundedMenuDropDown(strPanelName){this.IntervalID=null;this.PanelName=strPanelName;this.Height=1;} var objRoundedMenus=new Array();function animateRoundedMenu(strPanelName,intDirection,intEndHeight){var objDropDown=getRoundedMenu(strPanelName);var objPanel;if(objDropDown!=null){objPanel=document.getElementById(strPanelName);if(intDirection==1){objDropDown.Height+=ROUNDED_MENU_DELTA;if(objDropDown.Height>intEndHeight)objDropDown.Height=intEndHeight;}else{objDropDown.Height-=ROUNDED_MENU_DELTA;if(objDropDown.Height<intEndHeight)objDropDown.Height=intEndHeight;}objPanel.style.height=objDropDown.Height;if(objDropDown.Height==intEndHeight){window.clearInterval(objDropDown.IntervalID);objDropDown.IntervalID=null;if(intDirection==-1){setMenuPanelVisibility(objPanel,false);objDropDown.Height=1;}}}} function startAnimateRoundedMenu(strPanelName,intDirection,intEndHeight){var objDropDown=getRoundedMenu(strPanelName);var objPanel=document.getElementById(strPanelName);if(objPanel!=null){if(objDropDown==null){objDropDown=new RoundedMenuDropDown(strPanelName);objRoundedMenus.push(objDropDown);}if(objDropDown.IntervalID!=null)window.clearInterval(objDropDown.IntervalID);setMenuPanelVisibility(objPanel,true);objPanel.style.height=objDropDown.Height;objDropDown.IntervalID=window.setInterval("animateRoundedMenu(\""+strPanelName+"\","+new String(intDirection)+","+new String(intEndHeight)+");",ROUNDED_MENU_EXPAND);}} function getRoundedMenu(strPanelName){var intIndex,objDropDown=null;for(intIndex=0;intIndex<objRoundedMenus.length;intIndex++)if(objRoundedMenus[intIndex].PanelName==strPanelName)objDropDown=objRoundedMenus[intIndex];return objDropDown;} function setMenuPanelVisibility(objPanel,bolVisible){if(bolVisible){objPanel.style.visibility="visible";objPanel.style.display="inline";}else{objPanel.style.visibiltiy="hidden";objPanel.style.display="none";}}
var ENTER_KEY=13,ESC_KEY=27;String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"");};Array.prototype.indexOf=function(objFind){var intIndex;for(intIndex=0;intIndex<this.length;intIndex++){if(this[intIndex]==objFind)return intIndex;}return -1;};function ArrayList(){this.Count=0;this.Arr=new Array(10);this.ArrIndex=-1;}ArrayList.prototype.Add=function(objAdd){this.ArrIndex++;this.Count++;if(this.ArrIndex>=this.Arr.length)this.Arr=Array.concat(this.Arr,new Array(10));this.Arr[this.ArrIndex]=objAdd;return this.ArrIndex;};ArrayList.prototype.RemoveAt=function(intIndex){if(intIndex<0||intIndex>this.ArrIndex)throw "Index out of bounds.";else{for(var intInd=intIndex;intInd<this.ArrIndex;intInd++)this.Arr[intInd]=this.Arr[intInd+1];this.ArrIndex--;this.Count--;}};ArrayList.prototype.ToArray=function(){this.Arr.length=this.Count;return this.Arr;};ArrayList.prototype.Item=function(intIndex){if(intIndex<0||intIndex>this.ArrIndex)throw "Index out of bounds.";else return this.Arr[intIndex];};var sta=new __sta();function __sta(){this.namespace="sta";} __sta.prototype.createHttpObject=function(){var objRequest=false;try{objRequest=new ActiveXObject("Msxml2.XMLHTTP");}catch(objErr1){try{objRequest=new ActiveXObject("Microsoft.XMLHTTP");}catch(objErr2){try{objRequest=new XMLHttpRequest();}catch(objErr3){objRequest = false;}}}return objRequest;};__sta.prototype.createObject=function(objXmlNode){var objRetVal=new Object(),objQuoteRegEx=new RegExp("\"","g"),objLineBreakRegEx=new RegExp("(\\r|\\n|\\r\\n)","g");for(var intIndex=0;intIndex<objXmlNode.childNodes.length;intIndex++){if(objXmlNode.childNodes[intIndex].nodeName!="#text"){if(objXmlNode.childNodes[intIndex].childNodes.length>0){if(objXmlNode.childNodes[intIndex].childNodes[0].nodeValue==null){eval("objRetVal."+objXmlNode.childNodes[intIndex].nodeName+"=\"\"");}else {eval("objRetVal." +  objXmlNode.childNodes[intIndex].nodeName + " = \"" + objXmlNode.childNodes[intIndex].childNodes[0].nodeValue.replace(objQuoteRegEx, "\\\"").replace(objLineBreakRegEx, "") + "\"");}}else{eval("objRetVal."+objXmlNode.childNodes[intIndex].nodeName+"=null");}}}return objRetVal;};__sta.prototype.fillCollection=function(objXmlNode){var objRetVal,intIndex,intArrayIndex,intLength;intLength=0;for(intIndex=0;intIndex<objXmlNode.childNodes.length;intIndex++)if(objXmlNode.childNodes[intIndex].nodeName!="#text")intLength++;objRetVal=new Array(intLength);intArrayIndex=0;for(intIndex=0;intIndex<objXmlNode.childNodes.length;intIndex++)if(objXmlNode.childNodes[intIndex].nodeName!="#text")objRetVal[intArrayIndex++]=sta.createObject(objXmlNode.childNodes[intIndex]);return objRetVal;};__sta.prototype.loadXML=function(strMethod,strUrl,strVars,objFunction,objParams){var objHttpRequest=sta.createHttpObject(),strQueryString,strForm;objHttpRequest.onreadystatechange=function(){if(objHttpRequest.readyState==4){if(objHttpRequest.status==200)objFunction(objHttpRequest.responseXML,objParams);else objFunction(null,objParams);}};if(strMethod!="GET"&&strMethod!="POST")strMethod="GET";if(strMethod=="GET"){strForm=null;if(strVars==null||strVars=="")strQueryString="";else strQueryString="?"+strVars;}else{strQueryString="";if(strVars==null||strVars=="")strForm=null;else strForm=strVars;}objHttpRequest.open(strMethod,strUrl+strQueryString,true);if(strMethod=="POST")objHttpRequest.setRequestHeader("Content-type","application/x-www-form-urlencoded");objHttpRequest.send(strForm);};__sta.prototype.setVisibility=function(objControl,bolVisible){if(bolVisible)objControl.style.visibility="visible";else objControl.style.visibility="hidden";};__sta.prototype.setPanelVisibility=function(objPanel,bolVisible){if(bolVisible){objPanel.style.visibility="visible";objPanel.style.display="inline";}else{objPanel.style.visibiltiy="hidden";objPanel.style.display="none";}};__sta.prototype.setElementVisibility=function(objElement,bolVisible){if(bolVisible){objElement.style.visibility="";objElement.style.display="";}else{objElement.style.visibiltiy="hidden";objElement.style.display="none";}};__sta.prototype.formatCurrency=function(dblValue){var strBefore,strAfter,strSplit,strValue,intIndex,intCount;strValue=new String(new Number(dblValue));if(strValue.indexOf(".")==-1){strAfter="00";strBefore=strValue;}else{strSplit=strValue.split(".");strBefore=strSplit[0];strAfter=strSplit[1];}if(strAfter.length==1)strAfter+="0";else if(strAfter.length>2)while(strAfter.length>2)strAfter=strAfter.substr(0,strAfter.length-2)+new String(new Number(strAfter.substr(strAfter.length-1,1))>=5&&new Number(strAfter.substr(strAfter.length-2,1))!=9?(new Number(strAfter.substr(strAfter.length-2,1))+1):new Number(strAfter.substr(strAfter.length-2,1)));if(strBefore.length>3){strValue="";intCount=-1;for(intIndex=strBefore.length-1;intIndex>=0;intIndex--){if(intCount+1>=3)strValue=","+strValue;strValue=strBefore.substr(intIndex,1)+strValue;if(++intCount>=3)intCount=0;}strBefore=strValue;}return "$"+strBefore+"."+strAfter;};__sta.prototype.controlKeyDown=function(objEventArgs){if(objEventArgs==null)objEventArgs=window.event;objEventArgs.cancelBubble=true;objEventArgs.cancel=true;return objEventArgs.keyCode;};function getProductName(objProduct){var strRetVal="";if(objProduct.BrandName!=null&&objProduct.BrandName!="")strRetVal+=objProduct.BrandName+" ";if(objProduct.WebName!=null&&objProduct.WebName!="")strRetVal+=objProduct.WebName;else if(objProduct.StyleName!=null&&objProduct.StyleName!="")strRetVal+=objProduct.StyleName;else strRetVal+=objProduct.ItemName;return strRetVal;};function getCartProductTotal(objCart){var dblTotal=0.0;for(var intIndex=0;intIndex<objCart.length;intIndex++){dblTotal+=getProductUserPrice(objCart[intIndex])*objCart[intIndex].Quantity;}return dblTotal;};function getProductUserPrice(objProduct){if(new Number(objProduct.BogoPrice)>0)return new Number(objProduct.BogoPrice);else if(new Number(objProduct.MultipricingPrice)>0)return new Number(objProduct.MultipricingPrice);else if(new Number(objProduct.OfferPrice)>0)return new Number(objProduct.OfferPrice);else return new Number(objProduct.Price);}
var MINICART_MOVEMENT_TIMEOUT=40,MINICART_MOVEMENT_LENGTH=7,MINICART_NOTIFY_HEIGHT=125,MINICART_NOTIFY_TIMEOUT=8000,MINICART_TABLE_HEIGHT=50;function changeMiniCartDropDownPanel(intDirection){var objPanel=document.getElementById("MiniCartDropDownPanel");if(intDirection>0){if(intMiniCartCurHeight==0){sta.setPanelVisibility(objPanel,true);objPanel.style.top=MINICART_TABLE_HEIGHT;}else if(intMiniCartCurHeight>=MINICART_NOTIFY_HEIGHT){window.clearInterval(intMiniCartInterval);intMiniCartInterval=null;}}intMiniCartCurHeight=intMiniCartCurHeight+intDirection;if(intMiniCartCurHeight<0)intMiniCartCurHeight=0;objPanel.style.height=intMiniCartCurHeight;if(intDirection<0&&intMiniCartCurHeight==0){sta.setPanelVisibility(objPanel,false);window.clearInterval(intMiniCartInterval);intMiniCartInterval=null;}} function switchMiniCartDropDownPanel(){if(intMiniCartInterval==null)if(intMiniCartCurHeight>=MINICART_NOTIFY_HEIGHT)intMiniCartInterval=window.setInterval("changeMiniCartDropDownPanel(-MINICART_MOVEMENT_LENGTH);",MINICART_MOVEMENT_TIMEOUT);else intMiniCartInterval=window.setInterval("changeMiniCartDropDownPanel(MINICART_MOVEMENT_LENGTH);",MINICART_MOVEMENT_TIMEOUT);} function updateMiniCart(objCart,strLastProductID,strItemsInCartID,strProductTotalID){var strTotal=new String(getCartProductTotal(objCart)),strText,objProduct,intIndex=objCart.length-1,objCell=document.getElementById(strLastProductID),objRow=document.getElementById("MiniCart_TopRow");if(objCart.length==1)strText="1 item";else strText=objCart.length+" items";strText+=" in Your Cart";if(objCart.length>0)strText+=" (<a class=\"MiniCartLink\" href=\""+strFullCartUrl+"\">View Cart</a>)";document.getElementById(strItemsInCartID).innerHTML=strText;document.getElementById(strProductTotalID).innerHTML="Product Total: "+sta.formatCurrency(strTotal);while(intIndex>=0&&objProduct==null){if(objCart[intIndex].AutoInsertProduct=="false")objProduct=objCart[intIndex];intIndex-=1;}if(objCell!=null)objRow.removeChild(objCell);objCell=document.createElement("td");objCell.id=strLastProductID;objCell.rowSpan=3;objCell.className="MiniCart_LastItemCell";objRow.appendChild(objCell);if(objProduct!=null)objCell.innerHTML="Last Item<br /><a href=\""+objProduct.AjaxProductUrl+"\"><img src=\"/Sta.DnnWebService/GetProductImage.ashx?ImageOverride="+getProductImageOverride(objProduct.WarehouseLocs4)+"&amp;ImageTypeID=0&amp;ProductID="+(objProduct.StyleNumber==""||objProduct.StyleNumber==null?objProduct.ItemNumber:objProduct.StyleNumber)+"\" alt=\""+getProductName(objProduct)+"\" class=\"MiniCart_ProductImage\" /></a>";} function showAddedMiniCartProduct(objProduct,strCheckout,strImageUrl){var objPanel=document.getElementById("MiniCartDropDownPanel"),strValue="<table border=\"0\">"+"<tr><td colspan=\"2\"><p><i>You've just added to your cart:</i><br /><b>"+getProductName(objProduct)+"</b></p></td></tr><tr><td><a href=\""+objProduct.AjaxProductUrl+"\"><img src=\"/Sta.DnnWebService/GetProductImage.ashx?ImageOverride="+getProductImageOverride(objProduct.WarehouseLocs4)+"&amp;ImageTypeID=0&amp;ProductID="+(objProduct.StyleNumber==""||objProduct.StyleNumber==null?objProduct.ItemNumber:objProduct.StyleNumber)+"\" style=\"width:60px;height:60px;border:0px\" /></a></td><td><p><b>Brand</b>: "+objProduct.BrandName+"<br /><b>Quantity</b>: "+objProduct.Quantity+"<br /><b>Price</b>: "+objProduct.AjaxUserPrice;if(new Number(objProduct.InStock)>0)strValue+="<br /><b>In Stock Now</b>";strValue+="</p></td></tr><tr><td colspan=\"2\"><p><a href=\"javascript:window.clearTimeout(intMiniCartTimeout);void(switchMiniCartDropDownPanel());\">Close Drop-Down Window</a></p></table>";objPanel.innerHTML=strValue;document.getElementById(strCheckout).src=strImageUrl;switchMiniCartDropDownPanel();intMiniCartTimeout=window.setTimeout("switchMiniCartDropDownPanel();",MINICART_NOTIFY_TIMEOUT);} function getProductImageOverride(strWarehouseLocs){return strWarehouseLocs.substr(0,8).trim();}
var AJX_ERROR_MSG="<p style=\"font-weight:bold;color:red\">An error occurred while loading the menu.</p>",AJX_WEB_SRV="www.wwsport.com/DesktopModules/Sta.AjaxMenu/AjaxMenu.ashx",objAjxTabs,bolAjxLoading=true,intAjxInterval,intAjxOpacity=100;function startAddTabsToTree(intTabID){try{var strUrl=AJX_WEB_SRV;if(strUrl.substr(0,1)!="/")strUrl=document.location.protocol+"//"+strUrl;sta.loadXML("GET",strUrl,"DnnTabID="+new String(intTabID),addTabsToTree,[intTabID]);}catch(ex){document.getElementById(strAjxPnlName).innerHTML=AJX_ERROR_MSG;}} function addTabsToTree(objXmlDoc,objParams){var objResponseNode,objResponse,objTabs,objNodes,objOpcPanel,objMainPanel,objTables,intIndex,intNodeIndex,intTabID,intTabIndex,strValue;try{if(objXmlDoc.childNodes[0].nodeName=="xml"){objResponseNode=objXmlDoc.childNodes[1];objResponse=sta.createObject(objXmlDoc.childNodes[1]);}else{objResponseNode=objXmlDoc.childNodes[0];objResponse=sta.createObject(objXmlDoc.childNodes[0]);}objNodes=objResponseNode.getElementsByTagName("Tabs");objTabs=sta.fillCollection(objNodes[0]);if(bolAjxLoading)objAjxTabs=objTabs;objNodes=objNodes[0].childNodes;intNodeIndex=intIndex=-1;while(++intIndex<objNodes.length&&intNodeIndex==-1){if(objNodes[intIndex].nodeName!="#text"){if(new Number(objNodes[intIndex].getElementsByTagName("TabID")[0].innerText)==intAjxTabID||objNodes[intIndex].getElementsByTagName("ChildTabs").length>0){intNodeIndex=intIndex;strValue=objNodes[intIndex].getElementsByTagName("TabID")[0].text;if(strValue==null)strValue=objNodes[intIndex].getElementsByTagName("TabID")[0].textContent;intTabID=new Number(strValue);}}}intTabIndex=intIndex=-1;while(++intIndex<objAjxTabs.length&&intTabIndex==-1)if(objAjxTabs[intIndex].TabID==intTabID)intTabIndex=intIndex;if(intNodeIndex!=-1&&intTabIndex!=-1)objAjxTabs[intTabIndex]=getTabTree(objNodes[intNodeIndex]);if(bolAjxLoading){bolAjxLoading=false;objMainPanel=document.getElementById(strAjxPnlName);objMainPanel.removeChild(document.getElementById("AjxLoadPnl"));intTabPathIDs=getTabPathIDs(intAjxTabID);objOpcPanel=document.createElement("div");objOpcPanel.id="AjxOpcPnl";objMainPanel.appendChild(objOpcPanel);objTables=buildTabTree(objAjxTabs,1,intTabPathIDs,true);for(intIndex=0;intIndex<objTables.length;intIndex++)objMainPanel.appendChild(objTables[intIndex]);objOpcPanel.style.height=objMainPanel.clientHeight;intAjxInterval=window.setInterval("setAjaxOpacity()",25);}else expandAjaxMenu(objParams[0]);}catch(ex){document.getElementById(strAjxPnlName).innerHTML=AJX_ERROR_MSG;}} function getTabTree(objNode){var objRetVal=sta.createObject(objNode),objNodes=objNode.getElementsByTagName("ChildTabs"),objTabs,objNode,intIndex,intLength;if(objNodes.length>0){objNode=objNodes[0];objTabs=new Array();intLength=-1;for(intIndex=0;intIndex<objNode.childNodes.length;intIndex++){if(objNode.childNodes[intIndex].nodeName!="#text"){intLength+=1;objTabs.lenth=intLength;objTabs[intLength]=getTabTree(objNode.childNodes[intIndex]);}}objRetVal.ChildTabs=objTabs;}else objRetVal.ChildTabs=new Array();return objRetVal;} function findAjaxTab(intTabID,objTabs){var objRetVal=null,intIndex=-1;if(objTabs==null)objTabs=objAjxTabs;while(++intIndex<objTabs.length&&objRetVal==null){if(objTabs[intIndex].TabID==intTabID)objRetVal=objTabs[intIndex];else if(objTabs[intIndex].ChildTabs!=null&&objTabs[intIndex].ChildTabs.length>0)objRetVal=findAjaxTab(intTabID,objTabs[intIndex].ChildTabs);}return objRetVal;} function getTabPathIDs(intTabID,objTabs){var intRetVal=new Array(),intIndex=-1;intRetVal.length=0;if(objTabs==null)objTabs=objAjxTabs;while(++intIndex<objTabs.length&&intRetVal.length==0){if(objTabs[intIndex].TabID==intTabID){intRetVal.length=1;intRetVal[0]=intTabID;}else if(objTabs[intIndex].ChildTabs!=null&&objTabs[intIndex].ChildTabs.length>0){intRetVal=getTabPathIDs(intTabID,objTabs[intIndex].ChildTabs);if(intRetVal.length>0){intRetVal.length++;intRetVal[intRetVal.length-1]=objTabs[intIndex].TabID;}}}return intRetVal;} function buildTabTree(objTabs,intLevel,intTabPathIDs,bolRecursive){var objRetVal=new Array(),objTemp,objTab,bolInTabPath,bolExpanded,intIndex,intTemp,intStartIndex;objRetVal.length=0;for(intIndex=0;intIndex<objTabs.length;intIndex++){objTab=objTabs[intIndex];bolInTabPath=isTabInTabPath(objTab.TabID,intTabPathIDs);if((objTab.ChildTabs!=null&&objTab.ChildTabs.length>0)||objTab.ChildTabCount>0){bolExpanded=bolInTabPath;}else bolExpanded=null;objRetVal.length++;objRetVal[objRetVal.length-1]=createTabTable(objTab.TabID,intLevel,objTab.TabName,objTab.Url,bolExpanded);if(bolInTabPath&&bolRecursive&&objTab.ChildTabs!=null&&objTab.ChildTabs.length>0){objTemp=buildTabTree(objTab.ChildTabs,intLevel+1,intTabPathIDs,bolRecursive);intStartIndex=objRetVal.length;objRetVal.length+=objTemp.length;for(intTemp=0;intTemp<objTemp.length;intTemp++)objRetVal[intStartIndex+intTemp]=objTemp[intTemp];}}return objRetVal;} function createTabTable(intTabID,intLevel,strTabName,strUrl,bolExpanded){var objRetVal=document.createElement("table");with(objRetVal){id="Ajx"+new String(intTabID);className="AjxMTab Ajx"+new String(intLevel)+" CollapsedTable";onmouseover=function(){objRetVal.className="AjxMTab Ajx"+new String(intLevel)+" AjxHoverTab CollapsedTable";};onmouseout=function(){objRetVal.className="AjxMTab Ajx"+new String(intLevel)+" CollapsedTable";};insertRow(0);with(rows[0]){createBorderCell(objRetVal.rows[0]);insertCell(cells.length);cells[1].className="AjxHLCel";createBorderDiv(cells[1]);createBorderCell(objRetVal.rows[0]);insertCell(cells.length);cells[3].className="AjxHRCel";cells[3].colSpan=2;createBorderDiv(cells[3]);}insertRow(1);with(rows[1]){createBorderCell(objRetVal.rows[1]);insertCell(cells.length);cells[1].className="AjxICel";if(bolExpanded!=null){if(bolExpanded)cells[1].className+=" AjxDArw";else if(!bolExpanded)cells[1].className+=" AjxRArw";}cells[1].appendChild(document.createTextNode(" "));createBorderCell(objRetVal.rows[1]);insertCell(cells.length);cells[3].className="AjxSCel"+(intTabID==intAjxTabID?" AjxSelCel":"");cells[3].appendChild(document.createTextNode(" "));insertCell(cells.length);cells[4].className="AjxTCel"+(intTabID==intAjxTabID?" AjxSelCel":"");cells[4].appendChild(document.createElement("a"));with(cells[4].childNodes[0]){href=strUrl;if(bolExpanded!=null){if(bolExpanded){onclick=function(){return false;};objRetVal.onclick=function(){contractAjaxMenu(intTabID);return false;};}else{onclick=function(){return false;};objRetVal.onclick=function(){expandAjaxMenu(intTabID);return false;};}}else objRetVal.onclick=function(){window.location=strUrl;return false;};appendChild(document.createTextNode(strTabName));}}}return objRetVal;} function createBorderCell(objRow){var objCell=objRow.insertCell(objRow.cells.length);objCell.className="AjxBCel";createBorderDiv(objCell);} function createBorderDiv(objParent){objParent.appendChild(document.createElement("div"));with(objParent.childNodes[0]){className="AjxBPnl";appendChild(document.createTextNode(" "));}} function setAjaxOpacity(){var objPanel=document.getElementById("AjxOpcPnl");intAjxOpacity-=10;objPanel.style.filter="alpha(opacity="+new String(intAjxOpacity)+")";objPanel.style.opacity=intAjxOpacity/100;if(intAjxOpacity==0){objPanel.style.display="none";objPanel.style.visibility="hidden";window.clearInterval(intAjxInterval);}} function isTabInTabPath(intTabID,intTabPathIDs){var bolRetVal=false,intIndex=-1;while(++intIndex<intTabPathIDs.length&&!bolRetVal)bolRetVal=(intTabID==intTabPathIDs[intIndex]);return bolRetVal;} function contractAjaxMenu(intTabID){var objCtrl,objTable,objNode,objTab=findAjaxTab(intTabID),objPanel=document.getElementById(strAjxPnlName),intTabPathIDs=getTabPathIDs(intTabID);recursiveRemoveTables(objTab.ChildTabs);objTable=document.getElementById("Ajx"+new String(intTabID));objNode=objTable.nextSibling;objPanel.removeChild(objTable);objTable=createTabTable(intTabID,intTabPathIDs.length,objTab.TabName,objTab.Url,false);if(objNode==null)objPanel.appendChild(objTable);else objPanel.insertBefore(objTable,objNode);} function recursiveRemoveTables(objTabs){for(var intIndex=0;intIndex<objTabs.length;intIndex++){if(objTabs[intIndex].ChildTabs!=null)recursiveRemoveTables(objTabs[intIndex].ChildTabs);var objTable=document.getElementById("Ajx"+new String(objTabs[intIndex].TabID));if(objTable!=null)document.getElementById(strAjxPnlName).removeChild(objTable);}} function expandAjaxMenu(intTabID) {var objNode,objTables,objTable,objTab,objTabs,intIndex,intTabIndex,intTabPathIDs=getTabPathIDs(intTabID),objPanel=document.getElementById(strAjxPnlName),objNode=document.getElementById("Ajx"+new String(intTabID)).nextSibling;objTab=findAjaxTab(intTabID);objPanel.removeChild(document.getElementById("Ajx"+new String(objTab.TabID)));if(objTab.ChildTabs!=null){for(intIndex=0;intIndex<objTab.ChildTabs.length;intIndex++){objTable=document.getElementById("Ajx"+new String(objTab.ChildTabs[intIndex].TabID));if(objTable!=null)objPanel.removeChild(objTable);}objTable=createTabTable(intTabID,intTabPathIDs.length,objTab.TabName,objTab.Url,true);objTables=buildTabTree(objTab.ChildTabs,intTabPathIDs.length+1,intTabPathIDs,false);ajaxInsertElement(objPanel,objTable,objNode);for(intIndex=0;intIndex<objTables.length;intIndex++)ajaxInsertElement(objPanel,objTables[intIndex],objNode);}else {startAddTabsToTree(intTabID);objPanel=document.createElement("div");objPanel.id="Ajx"+new String(intTabID);objPanel.className="AjxLoadPnl";objPanel.appendChild(document.createTextNode("Loading..."));ajaxInsertElement(document.getElementById(strAjxPnlName),objPanel,objNode);}} function ajaxInsertElement(objParent,objNew,objNext){if(objNext==null)objParent.appendChild(objNew);else objParent.insertBefore(objNew,objNext);}
