var iDOM=(document.getElementById?1:0);var iIE4=((document.all && !iDOM)?1:0);var iNS4=(document.layers?1:0);function getRef(id) {if (iDOM) return document.getElementById(id);if (iIE4) return document.all[id];if (iNS4) return document.layers[id];}
function getSty(id) {return (iNS4?getRef(id):getRef(id).style);}
var popT=0;var litNow=new Array();function popOver(mNum,iNum) {clearTimeout(popT);hideAllBut(mNum);litNow=getTree(mNum,iNum);changeCol(litNow,1);tNum=menu[mNum][iNum].target;if (tNum>0) {thisX=parseInt(menu[mNum][0].ref.left)+parseInt(menu[mNum][iNum].ref.left);thisY=parseInt(menu[mNum][0].ref.top)+parseInt(menu[mNum][iNum].ref.top);with (menu[tNum][0].ref) {left=parseInt(thisX+menu[tNum][0].x);top=parseInt(thisY+menu[tNum][0].y);visibility='visible';}}}
function popOut(mNum,iNum) {if ((mNum==0) && !menu[mNum][iNum].target)hideAllBut(0);else popT=setTimeout('hideAllBut(0)',500);}
function getTree(mNum,iNum) {itemArray=new Array(menu.length);while(1) {itemArray[mNum]=iNum;if (mNum==0) return itemArray;iNum=menu[mNum][0].parentItem;mNum=menu[mNum][0].parentMenu;}}
function changeCol(changeArray,isOver) {for (mCnt=0;mCnt<changeArray.length;mCnt++) {if (changeArray[mCnt]) {newCol=isOver?menu[mCnt][0].overCol:menu[mCnt][0].backCol;with (menu[mCnt][changeArray[mCnt]].ref) {if (iNS4) bgColor=newCol;else backgroundColor=newCol;}}}}
function hideAllBut(mNum) {var keepMenus=getTree(mNum,1);for (count=0;count<menu.length;count++)
if (!keepMenus[count])menu[count][0].ref.visibility='hidden';changeCol(litNow,0);}
function Menu(isVert,popInd,x,y,width,overCol,backCol,borderClass,textClass) {this.isVert=isVert;this.popInd=popInd;this.x=x;this.y=y;this.width=width;this.overCol=overCol;this.backCol=backCol;this.borderClass=borderClass;this.textClass=textClass;this.parentMenu=null;this.parentItem=null;this.ref=null;}
function Item(text,href,frame,length,spacing,target) {this.text=text;this.href=href;this.frame=frame;this.length=length;this.spacing=spacing;this.target=target;this.ref=null;}
function writeMenus() {if (!iDOM && !iIE4 && !iNS4) return;for (cMn=0;cMn<menu.length;cMn++) with (menu[cMn][0]) {var str='',itmX=0,itmY=0;for (cIt=1;cIt<menu[cMn].length;cIt++) with (menu[cMn][cIt]) {var itmID='menu'+cMn+'item'+cIt;var w=(isVert?width:length);var h=(isVert?length:width);if (iDOM || iIE4) {str+='<div id="'+itmID+'" style="position: absolute;z-index:99;left:'+itmX+';top:'+itmY+';width:'+w+';height:'+h+';visibility:inherit;';if (backCol) str+='background:'+backCol+';';str+='" ';}
if (iNS4) {str+='<layer id="'+itmID+'" left="'+itmX+'" top="'+itmY+'" width="'+w+'" height="'+h+'" visibility="inherit" ';if (backCol) str+='bgcolor="'+backCol+'" ';}
if (borderClass) str+='class="'+borderClass+'" ';str+='onMouseOver="popOver('+cMn+','+cIt+')" onMouseOut="popOut('+cMn+','+cIt+')">';str+='<table width="'+(w - 8)+'" border="0" cellspacing="0" cellpadding="'+(!iNS4 && borderClass?3:0)+'"><tr onclick=a'+itmID+'.click()><td align="left" height="'+(h - 7)+'">'+'<a ID=a'+itmID+' class="'+textClass+'" href="'+href+'"'+(frame?' target="'+frame+'">':'>')+text+'</a></td>';if (target>0) {menu[target][0].parentMenu=cMn;menu[target][0].parentItem=cIt;if (popInd) str+='<td class="'+textClass+'" align="right">'+popInd+'</td>';}str+='</tr></table>'+(iNS4?'</layer>':'</div>');if (isVert) itmY+=length+spacing;else itmX+=length+spacing;}
if (iDOM) {var newDiv=document.createElement('div');document.getElementsByTagName('body').item(0).appendChild(newDiv);newDiv.innerHTML=str;ref=newDiv.style;ref.position='absolute';ref.visibility='hidden';}
if (iIE4) {document.body.insertAdjacentHTML('beforeEnd','<div id="menu'+cMn+'div" '+'style="position: absolute;z-index:99;visibility:hidden">'+str+'</div>');ref=getSty('menu'+cMn+'div');}
if (iNS4) {ref=new Layer(0);ref.document.write(str);ref.document.close();}
for (cIt=1;cIt<menu[cMn].length;cIt++) {iName='menu'+cMn+'item'+cIt;if (iDOM || iIE4) menu[cMn][cIt].ref=getSty(iName);if (iNS4) menu[cMn][cIt].ref=ref.document[iName];}}
with(menu[0][0]) {if (x<0) {if( typeof( window.innerWidth )=='number' ) {ref.left=(window.innerWidth / 2)+x;} else {ref.left=(document.body.clientWidth / 2)+x;}} else {ref.left=x;}ref.top=y;ref.visibility='visible';}}
var menu=new Array();var popOldWidth=window.innerWidth;nsResizeHandler=new Function('if (popOldWidth !=window.innerWidth) location.reload()');if (iNS4) document.captureEvents(Event.CLICK);document.onclick=clickHandle;function clickHandle(evt) {if (iNS4) document.routeEvent(evt);hideAllBut(0);}
function moveRoot() {with(menu[0][0].ref) left=((parseInt(left)<100)?100:5);}
function empty() {return;}
function resizeMenu() {with (menu[0][0]) {ref.visibility='hidden';}writeMenus();return;}
