function MM_reloadPage(init)
{
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

if (NS4) parent.onload = startIt;
   if (IE4) parent.document.body.onload = startIt;

   if (perCentOver != null) {
       childOverlap = (perCentOver/100) * menuWidth
   }
   mSecsVis = secondsVisible*1000;

   imgStr = "<IMG SRC=" + imgSrc + " WIDTH=" + imgSiz + " HEIGHT=" + imgSiz +" BORDER=0 VSPACE=2 ALIGN=RIGHT>"

   function initVars() {
       topCount = 2;
       areCreated = false;
       isOverMenu = false;
       currentMenu = null;
       allTimer = null;
   }

   initVars();

   function startIt() {
       main = parent.frames.main;

       if (NS4) main.onunload = initVars;
       if (IE4) main.document.body.onunload = initVars;

       if (NS4) makeClass();
       makeTop();
   }

   function makeClass() {
       styLayer = new Layer(100);
       styleStr = "<STYLE TYPE='text/javascript'>"
       + "with (parent.frames.main.document.classes.items.SPAN) {"
       + "width=\"" + menuWidth + "\";"
       + "color=\""+ fntCol + "\";"
       + "fontSize=\""+ fntSiz + "\";"
       + "fontWeight=\""+ fntWgh + "\";"
       + "fontStyle=\""+ fntSty + "\";"
       + "fontFamily=\""+ fntFam + "\";"
       + "borderWidth=\"" + borWid + "\";"
       + "borderColor=\"" + borCol + "\";"
       + "borderStyle=\"" + borSty + "\";"
       + "lineHeight=\"" + linHgt + "\";"
       + "}"
       + "</STYLE>";

       styLayer.document.write(styleStr);
       styLayer.document.close();
   }

   function menuSetup(hasParent,lastItem,openCont,openItem) {

       this.menuOver = menuOver;
       this.menuOut = menuOut;

       this.onmouseover = this.menuOver;
       this.onmouseout = this.menuOut;

       this.showIt = showIt;
       this.keepInWindow = keepInWindow;

       this.hideTree = hideTree
       this.hideParents = hideParents;
       this.hideChildren = hideChildren;
       this.hideTop = hideTop;

       this.hasChildVisible = false;
       this.isOn = false;

       this.hideTimer = null;

		 switch(topCount)
		 {
		 	case 1:{this.menuref='YrAc';this.imgname='a-youraccount.gif';this.img2name='b-youraccount.gif';break;}
			case 2:{this.menuref='SA';this.imgname='ar_Samba_Alerts.gif';this.img2name='ar_Samba_Alerts_f2.gif';break;}
			//case 3:{this.menuref='PlTo';this.imgname='ar_planning_n_tools.gif';this.img2name='ar_planning_n_tools_f2.gif';break;}
		 	case 4:{this.menuref='QuRe';this.imgname='ar_qoutes_n_research.gif';this.img2name='ar_qoutes_n_research_f2.gif';break;}
		 	case 5:{this.menuref='PrSe';this.imgname='ar_products_n_services.gif';this.img2name='ar_products_n_services_f2.gif';break;}
		 	case 6:{this.menuref='AbSa';this.imgname='ar_aboutsamba.gif';this.img2name='ar_aboutsamba_f2.gif';break;}
		 	case 7:{this.menuref='HoSa';this.imgname='ar_howcansambahelp.gif';this.img2name='ar_howcansambahelp_f2.gif';break;}
		 	case 3:{this.menuref='HoSa';this.imgname='ar_howcansambahelp.gif';this.img2name='ar_howcansambahelp_f2.gif';break;}
		 }

       if (hasParent) {
           this.hasParent = true;
           this.parentMenu = openCont;
           this.parentItem = openItem;
           this.parentItem.child = this;
       }
       else {
           this.hasParent = false;
           this.hideSelf = hideSelf;
       }

       if (NS4) {
           this.fullHeight = lastItem.top + lastItem.document.height;
           this.clip.bottom = this.fullHeight;
       }
       else {
           this.fullHeight = lastItem.style.pixelTop + lastItem.offsetHeight;
           this.showIt(false);
           this.onselectstart = cancelSelect;
           this.moveTo = moveTo;
           this.moveTo(0,0);
       }
   }

   function itemSetup(arrayPointer,whichArray) {
       this.itemOver = itemOver;
       this.itemOut = itemOut;
       this.onmouseover = this.itemOver;
       this.onmouseout = this.itemOut;

       this.dispText = whichArray[arrayPointer];
       this.linkText = whichArray[arrayPointer + 1];
       this.hasMore = whichArray[arrayPointer + 2];

       if (this.linkText.length > 0) {
           this.linkIt = linkIt;
           if (NS4) {
               this.onfocus = this.linkIt;
           }
           else {
               this.onclick = this.linkIt;
               this.style.cursor = "hand";
           }
       }

       if (this.hasMore) {
           htmStr = imgStr + this.dispText;
       }
       else {
           htmStr = this.dispText;
       }

       if (NS4) {
           layStr = "<SPAN CLASS=items>" + htmStr+ "</SPAN>";

           this.document.write(layStr);
           this.document.close();

           this.bgColor = backCol;
           this.clip.right = menuWidth;
           this.visibility = "inherit";
           this.container = this.parentLayer;

           if (arrayPointer == 0) {
               this.top = 0;
           }
           else {
               this.top = this.prevItem.top + this.prevItem.document.height - borWid;
           }
           this.left = 0;
       }
       else {
           with (this.style) {
               padding = 3;
               width = menuWidth;
               color = fntCol;
               fontSize = fntSiz
               fontWeight = fntWgh;
               fontStyle = fntSty;
               fontFamily = fntFam;
               borderWidth = borWid;
               borderColor = borCol;
               borderStyle = borSty;
               backgroundColor = backCol;
               lineHeight = linHgt;
           }

           this.innerHTML = htmStr;
           this.container = this.offsetParent;

           if (arrayPointer == 0) {
               this.style.pixelTop = 0;
           }
           else {
               this.style.pixelTop = this.prevItem.style.pixelTop + this.prevItem.offsetHeight - borWid;
           }
           this.style.pixelLeft = 0;
       }
   }

   function makeElement(whichEl,whichContainer) {

       if (arguments.length==1)
           whichContainer = (NS4) ? main : main.document.body;

       if (NS4) {
           eval(whichEl + "= new Layer(menuWidth,whichContainer)");
       }
       else {
           elStr = "<DIV ID=" + whichEl + " STYLE='position:absolute'></DIV>";
           whichContainer.insertAdjacentHTML("BeforeEnd",elStr);
           eval(whichEl + "= main." + whichEl);
       }
       return eval(whichEl);
   }

   function makeTop() {
       while(eval("window.arMenu" + topCount)) {
           topArray = eval("arMenu" + topCount);

           topName = "elMenu" + topCount;

           //topMenu = makeElement(topName);

           whichContainer = (NS4) ? main : main.document.body;
       if (NS4) {
           eval(topName + "= new Layer(menuWidth,whichContainer)");
       }
       else {
           elStr = "<DIV ID=" + topName + " STYLE='position:absolute'></DIV>";
           main.document.body.insertAdjacentHTML("BeforeEnd",elStr);
           eval(topName + "= main." + topName);
       }

	     topMenu = eval(topName);

           topMenu.setup = menuSetup;

           topItemCount = 0;
           for (i=0; i<topArray.length; i+=3) {
               topItemCount++;
               //status = "Creating Hierarchical Menus: " + topCount + " / " + topItemCount;
               topItemName = "item" + topCount + "_" + topItemCount;
               topItem = makeElement(topItemName,topMenu);

               if (topItemCount >1)
                   topItem.prevItem = eval("item" + topCount + "_" + (topItemCount-1));

               topItem.setup = itemSetup;
               topItem.setup(i,topArray);

      //         if (topItem.hasMore) makeSecond();
           }

           topMenu.setup(false,topItem);
           topCount++
       }

       //status = (topCount-1) + " Heirarchical Menu Trees Created"
       areCreated = true;
   }

   function keepInWindow() {
       scrBars = 20;

       if (NS4) {
           winRight = (main.pageXOffset + main.innerWidth) - scrBars;
           rightPos = this.left + menuWidth;

           if (rightPos > winRight) {
               if (this.hasParent) {
                   parentLeft = this.parentMenu.left;
                   newLeft = ((parentLeft-menuWidth) + childOverlap);
                   this.left = newLeft;
               }
               else {
                   dif = rightPos - winRight;
                   this.left -= dif;
               }
           }

           winBot = (main.pageYOffset + main.innerHeight) - scrBars;
           botPos = this.top + this.fullHeight;

           if (botPos > winBot) {
               dif = botPos - winBot;
               this.top -= dif;
           }
       }
       else {
              winRight = (main.document.body.scrollLeft + main.document.body.clientWidth) - scrBars;

           rightPos = this.style.pixelLeft + menuWidth;

           if (rightPos > winRight) {

             if (this.hasParent) {
                   parentLeft = this.parentMenu.style.pixelLeft;
                   newLeft = ((parentLeft - menuWidth) + childOverlap);
                   this.style.pixelLeft = newLeft;
               }
               else {
                   dif = rightPos - winRight;
                   this.style.pixelLeft -= dif;
               }
           }

           winBot = (main.document.body.scrollTop + main.document.body.clientHeight) - scrBars;
           botPos = this.style.pixelTop + this.fullHeight;

           if (botPos > winBot) {
               dif = botPos - winBot;
               this.style.pixelTop -= dif;
           }
       }
   }

   function popUp(menuName,e, x){
	if (!areCreated) return;
       hideAll();
		currentMenu = eval(menuName);

       if (isLeftNav) {
//           xPos = (NS4) ? main.pageXOffset : main.document.body.scrollLeft;
           yPos = (NS4) ? (e.pageY-pageYOffset)+main.pageYOffset : event.clientY + main.document.body.scrollTop;
       }
       else {
//           xPos = (NS4) ? (e.pageX-pageXOffset)+main.pageXOffset : event.clientX + main.document.body.scrollLeft;
           yPos = (NS4) ? main.pageYOffset : main.document.body.scrollTop;
       }
		 xPos = x;
//		 yPos = y;
       currentMenu.moveTo(xPos,yPos);


       currentMenu.keepInWindow()
       currentMenu.isOn = true;
       currentMenu.showIt(true);
   }

   function popDown(menuName){
       if (!areCreated) return;
       whichEl = eval(menuName);
       whichEl.isOn = false;
		 whichEl.hideTop();
   }

   function menuOver() {
       this.isOn = true;
       isOverMenu = true;
       currentMenu = this;
       if (this.hideTimer) clearTimeout(this.hideTimer);
		 //setTimeout(parent.nav.doimagereplace(this.menuref, this.img2name), 500);
   }

   function menuOut() {
       if (IE4) theEvent = main.event;
       if (IE4 && theEvent.srcElement.contains(theEvent.toElement)) return;
       this.isOn = false;
       isOverMenu = false;
       if (IE4) allTimer = setTimeout("currentMenu.hideTree()",0);
   }

   function itemOver(){
       if (IE4) theEvent = main.event;
       if (IE4 && theEvent.srcElement.tagName == "IMG") return;

       if (NS4) {
           this.bgColor = overCol;
       }
       else {
           this.style.backgroundColor = overCol;
           this.style.color = overFnt;
       }

       if (this.container.hasChildVisible) {
           this.container.hideChildren(this);
       }

       if(this.hasMore) {
           if (NS4) {
               this.childX = this.container.left + (menuWidth - childOverlap);
               this.childY = this.pageY + childOffset;
           }
           else {
               this.childX = this.container.style.pixelLeft + (menuWidth - childOverlap);
               this.childY = this.style.pixelTop + this.container.style.pixelTop + childOffset;
           }

           this.child.moveTo(this.childX,this.childY);
           this.child.keepInWindow();
           this.container.hasChildVisible = true;
           this.container.visibleChild = this.child;
           this.child.showIt(true);
       }
   }


   function itemOut() {
       if (IE4) theEvent = main.event;
       if (IE4 && (theEvent.srcElement.contains(theEvent.toElement)
        || (theEvent.fromElement.tagName=="IMG" && theEvent.toElement.contains(theEvent.fromElement))))
           return;

       if (NS4) {
           this.bgColor = backCol;
           if (!isOverMenu) {
               allTimer = setTimeout("currentMenu.hideTree()",0);
           }
       }
       else {
           this.style.backgroundColor = backCol;
           this.style.color = fntCol;
       }
   }

   function hideAll() {
       for(i=2; i<topCount; i++) {
           temp = eval("elMenu" + i);
	   temp.isOn = false;
           if (temp.hasChildVisible)
				  	temp.hideChildren();
				else
					parent.nav.doimagereplace(temp.menuref, temp.imgname);
           temp.showIt(false);
			  //parent.nav.doimagereplace(temp.menuref, temp.imgname);
       }
   }

   function hideTree() {
       allTimer = null;
       if (isOverMenu) return;
       if (this.hasChildVisible) {
           this.hideChildren();
       }
       this.hideParents();
		 if(!this.hasparent) parent.nav.doimagereplace(this.menuref, this.imgname);
   }

   function hideChildren(item) {
       if (this.visibleChild.hasChildVisible) {
           this.visibleChild.visibleChild.showIt(false);
           this.visibleChild.hasChildVisible = false;
       }

       if (!this.isOn || !item.hasMore || this.visibleChild != this.child) {
           this.visibleChild.showIt(false);
           this.hasChildVisible = false;
       }
   }

   function hideParents() {

       if (this.hasParent) {
           this.showIt(false);
           if (this.parentMenu.hasParent) {
               this.parentMenu.isOn = false;
               this.parentMenu.showIt(false);
               this.parentMenu.parentMenu.isOn = false;
               whichEl = this.parentMenu.parentMenu
           }
           else {
               this.parentMenu.isOn = false;
               whichEl = this.parentMenu;
           }
       }
       else {
           whichEl = this;
       }

       whichEl.hideTop();
   }

   function hideTop() {
       whichEl = this;
       this.hideTimer = setTimeout("whichEl.hideSelf()",0); //mSecsVis);
		 //if(!this.hasparent) parent.nav.doimagereplace(this.menuref, this.imgname);
   }

   function hideSelf() {
       this.hideTimer = null;
       if (!this.isOn && !isOverMenu) {
           this.showIt(false);
 	  		 parent.nav.doimagereplace(this.menuref, this.imgname);

       }
   }

   function linkIt() {
       main.location.href = this.linkText;
	//window.open(this.linkText);
   }

   function showIt(on) {
		 if(!this.hasparent&&on)parent.nav.doimagereplace(this.menuref, this.img2name);
       if (NS4) {this.visibility = (on) ? "show" : "hide"}
           else {this.style.visibility = (on) ? "visible" : "hidden"}
   }

   function moveTo(xPos,yPos) {
       this.style.pixelLeft = xPos;
       this.style.pixelTop = yPos;
   }

   function cancelSelect(){return false}
