//PRECACHE IMAGES HERE
function LoadImgs(){
	if (document.images) {
		btn_intro0 = new Image(); btn_intro0.src="media/11a.gif"; btn_intro1 = new Image(); btn_intro1.src="media/11.gif"; 
		btn_fund0 = new Image(); btn_fund0.src="media/12a.gif"; btn_fund1 = new Image(); btn_fund1.src="media/12.gif";
		btn_anat0 = new Image(); btn_anat0.src="media/13a.gif"; btn_anat1 = new Image(); btn_anat1.src="media/13.gif";
		btn_proc0 = new Image(); btn_proc0.src="media/14a.gif"; btn_proc1 = new Image(); btn_proc1.src="media/14.gif";
		btn_lab0 = new Image(); btn_lab0.src="media/15a.gif"; btn_lab1 = new Image(); btn_lab1.src="media/15.gif";
		btn_info0 = new Image(); btn_info0.src="media/16a.gif"; btn_info1 = new Image(); btn_info1.src="media/16.gif";
		loaded = 1
	} 
}

// SHOW MENU
function showLayer(layerName){
	if (NS4 || IE4) {
		if (mLoaded == 1) {
			if (timeOn != null) {
				clearTimeout(timeOn)
				hideLayer(onLayer)
			}
			if (NS4 || IE4) {
				eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"');
			}   
			onLayer = layerName
		}
	}
}

//BUTTON ROLLOVER
function change(Name, No) {
	if (No >= 0) {
	 	if (document.images && (loaded == 1)) {
			document [Name].src = eval(Name + No + ".src");
		}
	}
}

// HIDE MENU
function hideLayer(layerName){
 if (mLoaded == 1) {
 	if (menuActive == 0) {
  		if (NS4 || IE4) {
   			eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"');
  		}
 	}
 }
}

// TIMER FOR BUTTON MOUSE OUT
function btnTimer() {
 timeOn = setTimeout("btnOut()",2500)
}

// TIMER FOR BUTTON MOUSE OUT
function btnTimergone() {
 timeOn = setTimeout("btnOut()",2500)
}

// BUTTON MOUSE OUT
function btnOut(layerName) {
 if (menuActive == 0) {
  	hideLayer(onLayer)
 }
}

// MENU MOUSE OUT 
function menuOut(itemName) {
 menuActive = 0 
  if (NS4 || IE4) {
  if (NS4) {
    document[onLayer].document.images[itemName].src = menu1.src
  } else {
     document.all[itemName].src = menu1.src
  }
  }
  timeOn = setTimeout("hideLayer(onLayer)", 4500)
 }

// Clear last Menu
function clearMenu() {
 if(onLayer != null){
  hideLayer(onLayer)
 }
}

// Creates menu object
function menuLink(title, url) {
 this.title = title
 this.url = url
}

// Builds menu table
function menuMaker(menuArray) {
 n = ""
 j = eval(menuArray + ".length") - 1;

 if(eval(menuArray) == introMenu){
 	menuColor = "#99D0BF"
 } else if (eval(menuArray) == fundMenu){
 	menuColor = "#729FF2"
 } else if (eval(menuArray) == anatMenu){
 	menuColor = "#F18090"
 } else if (eval(menuArray) == procMenu){
 	menuColor = "#F9F87F"
 } else if (eval(menuArray) == labMenu){
   menuColor = "#B799CF"
 } else if (eval(menuArray) == infoMenu){
   menuColor = "#E28D68"
 }
 	
 	
 topTable = "<div ID='" + eval(menuArray + ".id") + "'><table  border='0' cellspacing='0' cellpadding='2' bgcolor='" + menuColor +"' bordercolor='#808080' bordercolorlight='#C0C0C0' bordercolordark='#000000'><tr><td><table border='0' cellspacing='0' cellpadding='0' bgcolor='" + menuColor + "'>"
 endrow = "</td></tr>"
 btmTable = "</td></tr></table></td></tr></table></div>"
 
 n += topTable

 for( var i = 0; i <=j; i++) {
 	bgnrow = "<tr><td>";
 	n += "<a href='" + eval(menuArray + "[" + i + "].url") + "' class='menus' target='_top'>" + eval(menuArray + "[" + i + "].title") + "</a>"
 }
 
 n += btmTable
 return n
}

function OpenTimeline(url) {
	OpenWin = this.open(url, "timeWindow", 
		"toolbar=no,menubar=no,location=no,scrollbars=no,resize=yes,height=350,width=600");
	OpenWin.opener = self;
}

function Openme(newin) {
   flyout=window.open(newin,"flyout","resizable=no,scrollbars=yes,width=455,height=455,top=50,left=50")
}

function rollover(imagename,reg_img_src,hl_img_src,width,height) {
   this.imagename=imagename;
   this.reg_img = new Image(width,height);
   this.reg_img.src = reg_img_src;
   this.hl_img = new Image(width,height);
   this.hl_img.src = hl_img_src;
}

function set_reg(imagename) {
   if(rollOverOK) {
      document.images[rollovers[imagename].imagename].src = rollovers[imagename].reg_img.src;
   }
}

function set_hl(imagename) {
   if(rollOverOK) {
      document.images[rollovers[imagename].imagename].src = rollovers[imagename].hl_img.src;
      
   }
   if(onLayer != null){
  hideLayer(onLayer)
 } 
}

function reDo() {
	if (innerWidth != origWidth || innerHeight != origHeight) 
	location.reload();
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function start() {
	if (document.searchForm.context[0].checked == true) {
		OpenWin = this.open("", "myWindow", 
			"toolbar=no,menubar=no,location=no,scrollbars=yes,resize=yes,height=450,width=250");
		OpenWin.opener = self;
    	document.searchForm.action = "/C004535/GlossarySearch.php3";
    }
	if (document.searchForm.context[1].checked == true) {
		OpenWin = this.open("", "myWindow", 
			"toolbar=no,menubar=no,location=no,scrollbars=yes,resize=yes,height=450,width=250");
		OpenWin.opener = self;
    	document.searchForm.action = "http://search.atomz.com/search/";
    	document.searchForm.elements[1].value = document.searchForm.searchstr.value;
	}
	if (document.searchForm.context[2].checked == true) {
    	document.searchForm.action = "http://www.google.com/search";
    	document.searchForm.elements[2].value = document.searchForm.searchstr.value;
    	document.searchForm.target = "_top";
    }
}

function openTour() {
	OpenWin = this.open("TR_site_navigation.html", "tourWindow", 
		"toolbar=no,menubar=no,location=no,scrollbars=no,resize=yes,height=220,width=150");
	OpenWin.opener = self;
}

<!--
window.onerror = null;
var bName = navigator.appName;
var bVer = parseInt(navigator.appVersion);
var NS4 = (bName == "Netscape" && bVer >= 4);
var IE4 = (bName == "Microsoft Internet Explorer" && bVer >= 4);
var NS3 = (bName == "Netscape" && bVer < 4);
var IE3 = (bName == "Microsoft Internet Explorer" && bVer < 4);
var menuActive = 0
var menuOn = 0
var onLayer = null
var timeOn = null
var loaded = 0
var mLoaded = 0
 
// MENU COLOR VARIABLE
var menuColor

// LAYER SWITCHING CODE
if (NS4 || IE4) {
	if (navigator.appName == "Netscape") {
		layerStyleRef="layer.";
		layerRef="document.layers";
		styleSwitch="";
	} else{
		layerStyleRef="layer.style.";
		layerRef="document.all";
		styleSwitch=".style";
	}
}
  

//Menu Arrays
Array.prototype.id = "introMenu"
Array.prototype.imgname = "intro"
introMenu = new Array(2)
introMenu.id = "introMenu"
introMenu.imgname = "intro"
introMenu[0] = new menuLink("Site Navigation | ", "site_navigation.html")
introMenu[1] = new menuLink("Tour vs Browsing", "tour_vs_browsing.html")

fundMenu = new Array(4)
fundMenu.id = "fundMenu"
fundMenu.imgname = "fund"
fundMenu[0] = new menuLink("Before Cells | ", "before_cells.html")
fundMenu[1] = new menuLink("On the Origin of Cells | ", "on_the_origin_of_cells.html")
fundMenu[2] = new menuLink("Basics of Cells | ", "basics_of_cells.html")
fundMenu[3] = new menuLink("Basic Cell Functions", "basic_cell_functions.html")

anatMenu = new Array(4)
anatMenu.id = "anatMenu"
anatMenu.imgname = "anat"
anatMenu[0] = new menuLink("Cell Membranes | ", "cell_membranes.html")
anatMenu[1] = new menuLink("Cell Wall | ", "cell_wall.html")
anatMenu[2] = new menuLink("Cytoplasm | ", "cytoplasm.html")
anatMenu[3] = new menuLink("Nucleus", "nucleus.html")

procMenu = new Array(5)
procMenu.id = "procMenu"
procMenu.imgname = "proc"
procMenu[0] = new menuLink("Molecule Transport | ", "molecule_transport.html")
procMenu[1] = new menuLink("DNA Replication | ", "dna_replication.html")
procMenu[2] = new menuLink("Reproduction | ", "reproduction.html")
procMenu[3] = new menuLink("Protein Synthesis | ", "protein_synthesis.html")
procMenu[4] = new menuLink("Cellular Metabolism | ", "cellular_metabolism.html")
procMenu[5] = new menuLink("Cellular Signaling", "cellular_signaling.html")

labMenu = new Array(5)
labMenu.id = "labMenu"
labMenu.imgname = "lab"
labMenu[0] = new menuLink("Cell Simulation | ", "cell_simulation.html")
labMenu[1] = new menuLink("Discussion Boards | ", "discussion_boards.html")
labMenu[2] = new menuLink("News | ", "news.html")
labMenu[3] = new menuLink("Timeline | ", "timeline.html")
labMenu[4] = new menuLink("Advanced Search", "advanced_search.html")

infoMenu = new Array(6)
infoMenu.id = "infoMenu"
infoMenu.imgname = "info"
infoMenu[0] = new menuLink("About the Authors | ", "about_the_authors.html")
infoMenu[1] = new menuLink("Planning this Site | ", "planning_this_site.html")
infoMenu[2] = new menuLink("Sitemap | ", "sitemap.html")
infoMenu[3] = new menuLink("Glossary Index | ", "glossary_index.html")
infoMenu[4] = new menuLink("References and Links | ", "references__links.html")
infoMenu[5] = new menuLink("Feedback", "feedback.html")

var rollOverOK = ((navigator.appName == "Microsoft Internet Explorer") || (navigator.appName == "Netscape")) && parseInt(navigator.appVersion) >= 3;

if(rollOverOK) {
   num_rollovers = 6;

   rollovers = new Array(num_rollovers);
   rollovers["intro"] = new rollover("intro","media/11a.gif","media/11.gif",26,74);  
   rollovers["fund"] = new rollover("fund","media/12a.gif","media/12.gif",26,74);  
   rollovers["anat"] = new rollover("anat","media/13a.gif","media/13.gif",26,74);  
   rollovers["proc"] = new rollover("proc","media/14a.gif","media/14.gif",26,74);  
   rollovers["lab"] = new rollover("lab","media/15a.gif","media/15.gif",26,74);  
   rollovers["info"] = new rollover("info","media/16a.gif","media/16.gif",26,74);  
}

NS4 = document.layers;
	if (NS4) {
	origWidth = innerWidth;
	origHeight = innerHeight;
		}

if (NS4) onresize = reDo;
if (NS4) {
	document.write(menuMaker("introMenu"))
	document.write(menuMaker("fundMenu"))
	document.write(menuMaker("anatMenu"))
	document.write(menuMaker("procMenu"))
	document.write(menuMaker("labMenu"))
	document.write(menuMaker("infoMenu"))
	mLoaded = 1
}

//-->
