//function for making rollovers in per_nav
function nav_overs(elem)
{
	var pnav = document.getElementById(elem);
	
	var nav_items = pnav.getElementsByTagName('li');
	for(i=0;i<nav_items.length;i++){
		//dont try to make rollovers for images with no_rollover class
		if(nav_items[i].className != 'act'){
			nav_items[i].onmouseover=function(){this.className = 'act';}
			nav_items[i].onmouseout=function(){this.className = '';}
		}				
		
	}
	
	
	
}

function swapimg(elem){
		var itemimg = elem.getElementsByTagName('img');
		for(i=0;i<itemimg.length;i++){
			itemimg[i].src = splitSrc(itemimg[i].src);
		}
}

//helper function for rollovers
function splitSrc(imgsrc){			
	//now break it into parts so that we can change it to the over state
	var this_ext = imgsrc.substring(imgsrc.length-4,imgsrc.length);
	//flag the current state (on/off)
	var state = imgsrc.substring(imgsrc.length-7,imgsrc.length-4) == '_on' ? true : false;
		
		if(state){
			var this_src_split = imgsrc.split('_on');
			var newsrc = this_src_split[0]+''+this_ext;
		}else{
			var this_src_split = imgsrc.split(this_ext);
			var newsrc = this_src_split[0]+'_on'+this_ext;
		} 
	return newsrc;
}
window.onload=function(){
			nav_overs('nav');
		}
