/*---------- Copyright 2011 Neotek Limited (http://www.neotek.co.nz). All rights reserved. -----------*/
var iCurMenuItemType=0;var iLinkType=0;var aMenuItemType=new Array();var aLinkType=new Array();var curCatMenu='';var curCatMenuId=0;var goCategoryBottom=0;var goCategoryTop=0;var goBasketBottom=0;var goBasketTop=0;var HideLeftPanel=0;var mainmenuVer=0;var CatTypeAccordion=false;function menuitemType(Id,Text){this.Id=Id;this.Text=Text;}function menulinkType(Ref,Target){this.Ref=Ref;this.Target=Target;}function addMenuItemType(coid,id,text){aMenuItemType[coid]=new menuitemType(id,text);}function setTextType(obj,text){if(obj.innerHTML!=null){obj.innerHTML=text;}}function addLinkType(id,Ref,Target){aLinkType[id]=new menulinkType(Ref,Target);}function MenuType(iItem,container){ShowMenuItemNo=iItem;curMenuItemIndex=0;var strt='';var ilength=aMenuItemType.length;for(var ii=1;ii<ilength;ii++){if(CatTypeAccordion){var title=aMenuItemType[iItem].Text;var categoryTypeId=aMenuItemType[iItem].Id;strt=strt+'<h1 id="categoryType'+categoryTypeId+'" title="'+title+'" onclick="TypeClick('+iItem+','+categoryTypeId+')"><span class="categorytypetitle">'+title+'</span></h1><div><ul class="categorycontent" id="categorycontent'+categoryTypeId+'"></ul></div>';}else{strt=strt+'<ul width="100%" id="catdiv'+ii+'">'+MenuHTMLType(iItem,null)+'</ul>';}iItem=iItem+1;}container.innerHTML=strt;if(CatTypeAccordion){jQuery('#accordion').accordion({collapsible:false,fillSpace:true,animated:'easeOutBounce'});}}function MenuTypeNew(iItem,container){ShowMenuItemNo=iItem;curMenuItemIndex=0;var strt='';var ilength=aMenuItemType.length;for(var ii=1;ii<ilength;ii++){strt=strt+'<ul width="100%" id="catdiv'+ii+'">'+MenuHTMLTypeNew(iItem,null)+'</ul>';iItem=iItem+1;}container.innerHTML=strt;}function MenuHTMLType(iItem,container){var str='';idx=iItem;str+=MenuItemHTMLType(iItem)+'<div width="100%" ID="cdiv'+iItem+'" STYLE="display:none">';str+='</div>';return str;}function MenuHTMLTypeNew(iItem,container){var str='';idx=iItem;str+=MenuItemHTMLTypeNew(iItem)+'<div width="100%" id="catHolder'+iItem+'" ';str+=' class="CatMenuHide" ';str+='loading="0" >';str+='<div id="processing'+iItem+'cat" style ="position:absolute; top:20%;">';str+='</div>';str+='<div id="categoryMain'+iItem+'wrap" style ="position:relative;">';str+='<div id="category'+iItem+'scrlayer" onmousewheel="return scrollerget(\'category'+iItem+'\').scroll(event.wheelDelta/2)">';str+='<div  id="category'+iItem+'up"   style="display:none;" onmousedown="return scrollerget(\'category'+iItem+'\').scrollup();"'+' onmouseout="return scrollerget(\'category'+iItem+'\').stopscroll();" '+' onmouseup="return scrollerget(\'category'+iItem+'\').stopscroll();">';str+='</div>';str+='<div width="100%" id="category'+iItem+'content"  onresize="checkcatcontentsize('+iItem+');" style ="z-index:500;">';str+='</div>';str+='<div  id="category'+iItem+'down"   style="display:none;" onmousedown="return scrollerget(\'category'+iItem+'\')'+'.scrolldown();" onmouseout="return scrollerget(\'category'+iItem+'\').stopscroll();" '+' onmouseup="return scrollerget(\'category'+iItem+'\').stopscroll();">';str+='</div>';str+='</div>';str+='</div>';str+='</div>';str+='<div width="100%" ID="cdiv'+iItem+'" STYLE="display:none">';str+='</div>';str+='</li>';return str;}function MenuItemHTMLType(iItem){idx=iItem;var title=aMenuItemType[idx].Text;var menuitemid=aMenuItemType[idx].Id;text=aMenuItemType[idx].Text;iLevel=1;iLinkId=aMenuItemType[idx].LinkId;iLinkIndex=iLinkId;sCSSClass='menuLevel'+0;sHRef='<A id="cn'+iItem+'" name="cn'+iItem+'" class="CategoryTop" href="javascript: TypeClick('+iItem+')" ';sHRef+=' onMouseOver="return sSts(this);"';sHRef+=' onMouseDown="return sSts(this);"';sHRef+=' onMouseUp="return cSts();"';sHRef+=' onMouseOut="return cSts();"';sHRef+=' title="Click to view '+title+'">';sHRef+=text;sHRef+='</a>';sMenu='<li ';sMenu+=' STYLE="display:block"'
sMenu+=' class="'+sCSSClass+'" >';sMenu+='<span>'+sHRef;if(aMenuItemType[iItem].IsNode==1){sMenu+='<ul id="cndiv'+iItem+'" style="display:none;"></ul>';}sMenu+='</span></li>';return sMenu;}function MenuItemHTMLTypeNew(iItem){idx=iItem;var title=aMenuItemType[idx].Text;var length=aMenuItemType.length-1;var menuitemid=aMenuItemType[idx].Id;var catType=aMenuItemType[idx].Id;text=aMenuItemType[idx].Text;iLevel=1;iLinkId=aMenuItemType[idx].LinkId;iLinkIndex=iLinkId;sCSSClass='menuLevel'+0;sHRef='<A id="cn'+iItem+'" name="cn'+iItem+'" class="CategoryTop" href="javascript: top.CatMenuClick('+iItem+', '+length+', '+catType+');" ';sHRef+=' onMouseOver="return sSts(this);"';sHRef+=' onMouseDown="return sSts(this);"';sHRef+=' onMouseUp="return cSts();"';sHRef+=' onMouseOut="return cSts();"';sHRef+=' title="Click to view '+title+'">';sHRef+='<div id="divb'+iItem+'" class="CategoryButtonTop">';sHRef+=text;sHRef+='</div>';sHRef+='</a>';sMenu='<li ';sMenu+=' STYLE="display:block"'
sMenu+=' class="'+sCSSClass+'" >';sMenu+='<span>'+sHRef;if(aMenuItemType[iItem].IsNode==1){sMenu+='<ul id="cndiv'+iItem+'" style="display:none;"></ul>';}sMenu+='</span>';return sMenu;}function TypeClick(Type){Type=aMenuItemType[Type].Id;neotekscript('/catalog/menu/menuajax.aspx?Type='+Type);}function TypeClickNew(ItemCat,CatType){var elem='catHolder'+ItemCat;if(document.getElementById(elem).getAttribute('loading')<1){showcatprocessing(ItemCat);if(document.getElementById('concertina')!=null||CatTypeAccordion){if(typeof(top.menuArray[ItemCat])=='undefined'){showcatprocessing(ItemCat);neotekscript('/catalog/menu/menuajax.aspx?Type='+CatType+'&containerId='+ItemCat);document.getElementById(elem).loading=1;uploadNewCat=1;}}else{neotekscript('/catalog/menu/menuajax.aspx?Type='+CatType+'&containerId='+ItemCat);document.getElementById(elem).loading=1;uploadNewCat=1;}}}function showcatprocessing(Type){if(ProcessingTimeout!=null)window.clearTimeout(ProcessingTimeout);try{document.getElementById('processing'+Type+'cat').style['display']="block";}catch(e){}ProcessingTimeout=setTimeout(hidecatprocessing,5000)}function hidecatprocessing(Type){window.clearTimeout(ProcessingTimeout);ProcessingTimeout=null;try{if(document.getElementById('concertina')!=null){var o=document.getElementById('processing'+Type+'cat');if(o){o.style.display="none";}var elem2='category1scrlayer';var allHeights=pixel(225+(19*scrollerArray.length));resizeElement('category');var hh=scrollerHeight(elem2,allHeights);}else{document.getElementById('processing'+Type+'cat').style['display']="none";}}catch(e){}}function CatMenuClick(ItemCat,nn,CatType){var elem='';goCategoryBottom=0;goCategoryTop=0;for(var ix=1;ix<nn+1;ix++){elem='catHolder'+ix;document.getElementById(elem).className='CatMenuHide';}elem='catHolder'+ItemCat;document.getElementById(elem).className='CatMenuShow';TypeClickNew(ItemCat,CatType);var elem2='category'+ItemCat+'scrlayer';curCatMenu='category'+ItemCat;curCatMenuId=ItemCat;var allHeights=pixel(document.getElementById('cn1').offsetHeight)*scrollerArray.length;resizeElement('category');var hh=scrollerHeight(elem2,allHeights);}function scrollerHeight(name,offsetHeight){var vheight=500;if(document.documentElement!=null){vheight=pixel(document.documentElement.clientHeight);}else{vheight=pixel(window.innerHeight);}vheight=vheight-pixel(document.getElementById('toolbar').offsetHeight);vheight=vheight-pixel(document.getElementById('categorytop').offsetHeight);vheight=vheight-pixel(document.getElementById('categorybottom').offsetHeight);vheight=vheight-offsetHeight+'px';document.getElementById(name).style['height']=vheight;return vheight;}function checkcatcontentsize(numcat){var divcon=document.getElementById('category'+numcat+'content');var contentHeight=pixel(divcon.offsetHeight);var divscr=document.getElementById('category'+numcat+'scrlayer');var scrlayerHeight=pixel(divscr.offsetHeight);if(contentHeight>scrlayerHeight){document.getElementById(top.curCatMenu+'down').style['display']='block';goCategoryBottom+=1;}else{document.getElementById(top.curCatMenu+'down').style['display']='none';goCategoryBottom=0;}return null;}function ShowHideLeftPanel(wcat,wInfo,catHide){var w2=pixel(document.getElementById('category').style['width']);var x=top.InfoFrame.location.href;var len=x.length-24;var y=x.substring(0,len);var ylen=y.length;var z=x.substring(ylen);if((z=='EditContent.aspx?Id=2010')||(z=='EditContent.aspx?Id=2020')||(z=='EditContent.aspx?Id=2030')||(z=='EditContent.aspx?Id=2040')||(z=='EditContent.aspx?Id=2050')||(z=='EditContent.aspx?Id=2060')||(z=='EditContent.aspx?Id=1010')||(z=='EditContent.aspx?Id=1020')||(z=='EditContent.aspx?Id=1030')||(z=='EditContent.aspx?Id=1035')||(z=='EditContent.aspx?Id=1040')||(z=='EditContent.aspx?Id=1050')||(z=='EditContent.aspx?Id=1060')||(z=='EditContent.aspx?Id=1070')||(z=='EditContent.aspx?Id=3010')||(z=='EditContent.aspx?Id=2020')||(z=='EditContent.aspx?Id=3030')||(z=='EditContent.aspx?Id=3040')||(z=='EditContent.aspx?Id=4010')||(z=='EditContent.aspx?Id=4020')||(z=='EditContent.aspx?Id=4030')||(z=='/EditContent.aspx?Id=171'))catHide=1;if((z=='ContentPage.aspx?Id=2010')||(z=='ContentPage.aspx?Id=2020')||(z=='ContentPage.aspx?Id=2030')||(z=='ContentPage.aspx?Id=2040')||(z=='ContentPage.aspx?Id=2050')||(z=='ContentPage.aspx?Id=2060')||(z=='ContentPage.aspx?Id=1010')||(z=='ContentPage.aspx?Id=1020')||(z=='ContentPage.aspx?Id=1030')||(z=='ContentPage.aspx?Id=1035')||(z=='ContentPage.aspx?Id=1040')||(z=='ContentPage.aspx?Id=1050')||(z=='ContentPage.aspx?Id=1060')||(z=='ContentPage.aspx?Id=1070')||(z=='ContentPage.aspx?Id=3010')||(z=='ContentPage.aspx?Id=2020')||(z=='ContentPage.aspx?Id=3030')||(z=='ContentPage.aspx?Id=3040')||(z=='ContentPage.aspx?Id=4010')||(z=='ContentPage.aspx?Id=4020')||(z=='ContentPage.aspx?Id=4030'))catHide=1;if(catHide==1){wInfo=wInfo+(wcat);document.getElementById('category').style['width']='0px';}else{document.getElementById('category').style['width']=wcat+'px';}document.getElementById('InfoFrame').style['width']=wInfo+'px';}
