function cacheImgs(){
	if(!document.getElementsByTagName) return false;
	cached = new Array();

	var loc_elements = new Array();
	loc_elements[0] = 'images/nav1_on.gif';
	loc_elements[1] = 'images/nav2_on.gif';
	loc_elements[2] = 'images/nav3_on.gif';
	loc_elements[3] = 'images/nav4_on.gif';
	loc_elements[4] = 'images/nav5_on.gif';
	loc_elements[5] = 'images/nav6_on.gif';
	loc_elements[6] = 'images/nav7_on.gif';
	
	loc_elements[7] = 'images/h1_0_on.gif';
	loc_elements[8] = 'images/h1_1_on.gif';
	loc_elements[9] = 'images/h1_2_on.gif';
	loc_elements[10] = 'images/h1_3_on.gif';
	loc_elements[11] = 'images/h1_4_on.gif';
	loc_elements[12] = 'images/h1_5_on.gif';
	loc_elements[13] = 'images/h1_6_on.gif';
	loc_elements[14] = 'images/h1_7_on.gif';
	
	loc_elements[15] = 'images/hl_prev_on.gif';
	loc_elements[16] = 'images/hl_next_on.gif';
	
	loc_elements[17] = 'images/article_nav1_on.gif';
	loc_elements[18] = 'images/article_nav2_on.gif';
	loc_elements[19] = 'images/article_nav3_on.gif';
	loc_elements[20] = 'images/article_nav4_on.gif';
	

	for(var i=0; i<loc_elements.length; i++){
		cached[i] = new Image();
		cached[i].src = loc_elements[i];
	}
}

function setRollovers(){
		if(!document.getElementsByTagName) return false;
		var nav_elements = document.getElementsByTagName("a");
		for(var i=0; i<nav_elements.length; i++){
			
			if(nav_elements[i].parentNode.getAttribute('id') == 'navigation' || nav_elements[i].parentNode.getAttribute('id') == 'highlights_nav' || nav_elements[i].parentNode.getAttribute('id') == 'highlights_img' || nav_elements[i].getAttribute('rel') == 'roll'){
				nav_elements[i].onmouseover = switchOn;
				nav_elements[i].onmouseout = switchOff;
			}
		}
}

function switchOn(){
	var imgToSwap = this.childNodes;
	for(var i=0; i<imgToSwap.length; i++){
		if(imgToSwap[i].nodeType == 1){
			var source 		= imgToSwap[i].src.lastIndexOf('/') + 1;
			var image_path 	= imgToSwap[i].src.substring(0,source);
			var fileSrc 	= imgToSwap[i].src.substring(source);
			var spot 		= (fileSrc.length - 6);
			
			var newSrc  	= fileSrc.substring(0,spot);
			if(fileSrc.substr(fileSrc.lastIndexOf('_')+1,3) == 'off'){
					imgToSwap[i].src = (image_path+newSrc + 'n.gif');
			}
			//imgToSwap[i].src = (image_path+newSrc + 'n.jpg');
		}
	}
}

function switchOff(){
	var imgToSwap = this.childNodes;
	for(var i=0; i<imgToSwap.length; i++){
		if(imgToSwap[i].nodeType == 1){
			var source 		= imgToSwap[i].src.lastIndexOf('/') + 1;
			var image_path 	= imgToSwap[i].src.substring(0,source);
			var fileSrc 	= imgToSwap[i].src.substring(source);
			var spot 		= (fileSrc.length - 5);
			
			var newSrc  	= fileSrc.substring(0,spot);
			if(fileSrc.substr(fileSrc.lastIndexOf('_')+1,2) == 'on'){
					imgToSwap[i].src = (image_path+newSrc + 'ff.gif');
			}
			//imgToSwap[i].src = (image_path+newSrc + 'ff.jpg');
			
		}
	}
}

addOnLoadEvent(setRollovers);
addOnLoadEvent(cacheImgs);
