//Lung Main Rollover.js file
var oldSrc;

function startList() {
	if (document.all&&document.getElementById) {
		navRoot = document.getElementById("nav");

		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];

			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
				}

				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}
			}
		}
	}
}

function preloadimages() {
	/*
	pre-load a highlighted version 
	of each "nav_" image
	*/
	var num = document.images.length;
	var img,posn,temp,orig,newsrc;
	var preload = new Array();
	for(var i = 0; i<num; i++) {
		img = document.images[i].src;
		posn = img.indexOf("nav_");
		if(posn > -1 && img.indexOf("_lit")< 0){
			dot = img.lastIndexOf(".");
			temp = img.substr(dot,img.length);
			orig = img.substr(0,dot);
			newsrc = orig + "_lit" + temp;
			preload[i] = new Image();
			preload[i].src = newsrc;
		}//if
	}//for
	
	startList();	
 }

function breakFrames() {
	var hyperlinks = document.getElementsByTagName("A");
	var num_hyperlinks = hyperlinks.length;
	
	for(var x = 0; x < num_hyperlinks; x++) {
		hyperlinks[x].target = "_parent";
	}
}

function getSrc(n){
    img = n.toString();
         eval("n = document." + img + ".src");
         if(n.indexOf("_lit")< 0){
                 dot = n.lastIndexOf(".");
                 temp = n.substr(dot,n.length).toString();
                 orig = n.substr(0,dot).toString();
                 newsrc = orig + "_lit" + temp;
                 newsrc = newsrc.toString();
         return newsrc;
         }
        else{return n;}
 }

function swap(imgname) {
       	n = arguments[0].toString();
	eval("oldSrc = document." + n + ".src");
	old = n;
	eval("document." + n + ".src=getSrc('" + imgname + "')");
 }

function restore(){
	eval("document." + img + ".src=oldSrc");
 }
