  // VERSION 1.031113      /*        developed by Arthur Naylor, CodneNet, 2003       */   // basic methods and objects ...   function menusClass() {         this.dom=document.getElementById;     this.ie=document.all;     this.ns=document.layers;     this.mac=navigator.userAgent.toLowerCase().indexOf('mac')!=-1;         this.names=null; // image names     this.uppers=null;     this.lowers=null;     this.signals=null;     this.dimmers=null;     this.category=null;     this.images=new Object();     this.imagesPath="/images/menus/";         this.identifiers=null; // layer identifiers (need to be different from image 'names')     this.assignMenus=true;     this.assignSubMenus=false;     this.subMenuHideDelay=2000;     this.delayedHide=false; 	this.keyTop=0; 	this.keyLeft=0;     this.key=new Array();     this.positions=new Array();       } // end   var menus=new menusClass();   var submenus=new menusClass();             // swaps in single or multiple lower images ..   function lowerMenus() {     for(i=0; i<arguments.length; i++) {       if(document.images[arguments[i]] && this.images[arguments[i]+"lower"]) { 	    document.images[arguments[i]].src=this.images[arguments[i]+"lower"].src; 	  } 	  else if(this.ns) { 	    for(j=0; j<document.layers.length; j++) { 	      if(document.layers[j].document.images[arguments[i]] && this.images[arguments[i]+"lower"]) { 	        document.layers[j].document.images[arguments[i]].src=this.images[arguments[i]+"lower"].src; 	      } 	    } 	  }     }   } // end   menusClass.prototype.lower=lowerMenus;           // swaps in single or multiple upper images ...   function upperMenus() {     for(i=0; i<arguments.length; i++) {       if(document.images[arguments[i]] && this.images[arguments[i]+"upper"]) { 	    document.images[arguments[i]].src=this.images[arguments[i]+"upper"].src; 	  } 	  else if(this.ns) {   	    for(j=0; j<document.layers.length; j++) { 	      if(document.layers[j].document.images[arguments[i]] && this.images[arguments[i]+"upper"]) { 	        document.layers[j].document.images[arguments[i]].src=this.images[arguments[i]+"upper"].src; 	      } 	    } 	  } 	}   } // end     menusClass.prototype.upper=upperMenus;           // preload all upper and lower images ...   function preloadMenus() {     if(this.names==null) { return null; }     for(i=0; i<this.names.length; i++) { 	  if(this.lowers!=null && this.lowers[i]) { 	    this.images[this.names[i]+"lower"]=new Image(); 	    this.images[this.names[i]+"lower"].src=this.imagesPath+this.lowers[i]; 	  } 	  if(this.uppers!=null && this.uppers[i]) { 	    this.images[this.names[i]+"upper"]=new Image(); 	    this.images[this.names[i]+"upper"].src=this.imagesPath+this.uppers[i]; 	  } 	  if(this.signals!=null && this.signals[i]) { 	    this.images[this.names[i]+"signal"]=new Image(); 	    this.images[this.names[i]+"signal"].src=this.imagesPath+this.signals[i]; 	  } 	  if(this.dimmers!=null && this.dimmers[i]) { 	    this.images[this.names[i]+"dimmer"]=new Image(); 	    this.images[this.names[i]+"dimmer"].src=this.imagesPath+this.dimmers[i]; 	  } 	}   } // end     menusClass.prototype.preload=preloadMenus;           // assigns all upper images ...   function setupMenus() {     if(this.names==null) { return null; } 		// assign current signal image based on category 	if(this.category!=null && this.signals!=null) { 	  if(document.images[this.category]) { 	    this.images[this.category+"lower"].src=this.images[this.category+"signal"].src; 	    this.images[this.category+"upper"].src=this.images[this.category+"signal"].src; 	  } 	} 		// assign current dimmer images based on category 	if(this.category!=null && this.dimmers!=null) { 	  var marker=this.names.length;       for(i=0; i<this.names.length; i++) { 	    if(this.category===this.names[i]) { 		  marker=i; 		  break; 		} 	  }       for(i=0; i<this.names.length; i++) { 	    if(i>marker) { 	      if(document.images[this.names[i]]) { 	        this.images[this.names[i]+"lower"].src=this.images[this.names[i]+"dimmer"].src; 	        this.images[this.names[i]+"upper"].src=this.images[this.names[i]+"dimmer"].src; 	      } 	    } 	  } 	}         // assign images     for(i=0; i<this.names.length; i++) { 	  if(document.images[this.names[i]]) { 	    document.images[this.names[i]].src=this.images[this.names[i]+"upper"].src; 	  } 	  else if(this.ns) { 	    for(j=0; j<document.layers.length; j++) { 		  if(document.layers[j].document.images[this.names[i]]) { 	        document.layers[j].document.images[this.names[i]].src=this.images[this.names[i]+"upper"].src; 		  } 		} 	  } 	}   } // end     menusClass.prototype.assign=setupMenus;                       // DYNAMIC SUBMENUS ...           // set visibility ..   function setVisibility(submenu,option) {     if(this.dom && document.getElementById(submenu)) { document.getElementById(submenu).style.visibility=option; }     else if(this.ie && document.all[submenu]) { document.all[submenu].style.visibility=option; }     else if(this.ns && document[submenu]) { document[submenu].visibility=option; }   } // end   menusClass.prototype.setVisibility=setVisibility;         // show dynamic sub menus ...   function showDynamicSubMenu(submenu) {     this.hideAllDynamicSubMenus(submenu); 	if(submenu) { this.setVisibility(submenu,"visible"); }   } // end   menusClass.prototype.showDynamicSubMenu=showDynamicSubMenu;         // hide dynamic sub menus ...   function hideDynamicSubMenu(submenu) {     if(this.delayedHide!=false) { this.cancelHideDelay(); } 	if(submenu) { this.setVisibility(submenu,"hidden"); }   } // end   menusClass.prototype.hideDynamicSubMenu=hideDynamicSubMenu;         // hide all dynamic sub menus ...   function hideAllDynamicSubMenus(submenu) {     for(i=0; i<this.identifiers.length; i++) {       if(submenu && this.identifiers==submenu) { continue; }       this.hideDynamicSubMenu(this.identifiers[i]);     }   } // end   menusClass.prototype.hideAllDynamicSubMenus=hideAllDynamicSubMenus;         // delayed hiding of all dynamic sub menus ...   function hidingAllDynamicSubMenus() {     this.delayedHide=setTimeout('menus.hideAllDynamicSubMenus()',this.subMenuHideDelay);   } // end   menusClass.prototype.hidingAllDynamicSubMenus=hidingAllDynamicSubMenus;         // cancel the delayed hiding of all dynamic sub menus ...   function cancelHideDelay() {     clearTimeout(this.delayedHide);    this.delayedHide=false;   } // end   menusClass.prototype.cancelHideDelay=cancelHideDelay;           // get position of key image ...   function getKeyPosition(image) { image="goingson"; 	var element=null,top=0,left=0; 	if (this.dom){ element=document.getElementById(image); } 	else if (this.ie) { element=document.all.image; } 	else if (this.ns) { element=document.images[image]; } 	if (this.ns) { 	  this.keyTop=element.y; 	  this.keyLeft=element.x; 	} 	else { 	  if(element.y) { this.keyTop=element.y } 	  else { this.keyTop=this.getOffset(element,"Top"); } 	  if(element.x) { this.keyLeft=element.x } 	  else { this.keyLeft=this.getOffset(element,"Left"); } 	} alert('top '+this.keyTop+' left '+this.keyLeft );   } // end   menusClass.prototype.getKeyPosition=getKeyPosition;         function getOffset(image,offset) { 	var position=0;     while (image!=null) {       position+=image["offset"+offset];       image=image.offsetParent;     }  	return position;   } // end   menusClass.prototype.getOffset=getOffset;           // set dynamic sub menus positions ...   function adjustDynamicSubMenus(image) {      this.getKeyPosition(image); 	var tops=new Array(); 	var lefts=new Array(); 	var i=0, j=0, topmargin=0, leftmargin=0; 	while(i<this.positions.length) { 	  tops[j]=this.positions[i]; 	  lefts[j]=this.positions[i+1]; 	  i+=2; 	  j++; 	}     for(i=0; i<this.identifiers.length; i++) { 	  var top=0, left=0; 	  var object=null; 	  if(this.ie && this.mac) {         topmargin=parseInt(document.body.topMargin); 	    leftmargin=parseInt(document.body.leftMargin); 	  }       if(this.dom) { object=document.getElementById(this.identifiers[i]).style; }       else if(this.ie) { object=document.all[this.identifiers[i]].style; }       else if(this.ns) { object=document[this.identifiers[i]]; } 	  object.top=this.keyTop+tops[i]+topmargin-this.key[0]; 	  object.left=this.keyLeft+lefts[i]+leftmargin-this.key[1]; 	}   } // end   menusClass.prototype.adjustDynamicSubMenus=adjustDynamicSubMenus;         // public methods ...   menusClass.prototype.show=showDynamicSubMenu;   menusClass.prototype.hide=hidingAllDynamicSubMenus;   menusClass.prototype.positioning=adjustDynamicSubMenus;   menusClass.prototype.position=adjustDynamicSubMenus;                 