		//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;
		}



//function for swapping thumbnail images
function changeThumb(thumbsrc){
	$("#largeThumb").attr("src",thumbsrc);
	//need to update the links on the arrows
	updateArrows();
}


//function for updating the arrow navigation
function updateArrows(){
	//step 1. get the current source for the large image
	var largeThumb = $("#largeThumb").attr("src");
	
	//step 2. traverse the array to find which node this is
	for(i=0;i<thumbnails.length;i++){
		if(thumbnails[i] == largeThumb){ var currentNode = i;}
	}
	
	//step 3. determine the previous and next nodes
	if(currentNode == 0){
		var prevNode = thumbnails.length -1;
		if(thumbnails.length > 1){
			var nextNode = 1;
		}else{
			var nextNode = 0;
		}
	}else if(currentNode == thumbnails.length -1){
		var nextNode = 0;
		var prevNode = currentNode -1;
	}else{
		var nextNode = currentNode +1;
		var prevNode = currentNode -1;
	}
	
	//step 4. update the arrow links
	$("#prevWork").attr("href",'javascript:changeThumb("'+thumbnails[prevNode]+'");');
	$("#nextWork").attr("href",'javascript:changeThumb("'+thumbnails[nextNode]+'");');
}


function moveThumb(dir,limit){
	
	if(dir == 'prev'){
		if(sansPX($('#largeThumbInner').css('left')) < 0){
			$('#largeThumbInner').animate({left: '+=600px'},800);
		}else{
			$('#largeThumbInner').animate({left: ((limit -1) * -600)+'px'},800);
		}
	}else{
		if(sansPX($('#largeThumbInner').css('left')) > ((limit -1) * -600)){
			$('#largeThumbInner').animate({left: '-=600px'},800);
		}else{
			$('#largeThumbInner').animate({left: '0'},800);
		}
	}
}

/****GET THE MEASURE SANS PX*******************************************/
		
		function sansPX(str){
			var tempMeasure = str;
			if(tempMeasure == ''){return 0;}
			else {
				if(tempMeasure.substring(tempMeasure.length-2, tempMeasure.length) == 'px'){
					var asInt = tempMeasure.substring(0, tempMeasure.length-2);
					return asInt;
				}else{
					return tempMeasure;
				}
			}
			
		}

//function for jump menus
function jumpMenu(url){
	if(url != ''){window.location = url;}
}



		
		
		window.onload=function(){
			nav_overs('nav');
		}