/****** GLOBAL VARIABLES ******/

var rPath= "images/";


/****** BUTTON FUNCTIONS ******/

function toggleImg(id,source1,source2){
	if(document.images[id].src.indexOf(source2)==-1){
		document.images[id].src=source1;			
	}
	else {
		document.images.src=source1;				
	}
}

function buttonClick(id){	
	toggleImg(id, rPath + [id] + "_down.jpg", rPath + [id] + "_over.jpg");	
}

function buttonOver(id){
	if(document.images[id].getAttribute("src").indexOf("_down")==-1){		
		document.images[id].src=rPath + [id] +"_over.jpg";
	}
}

function buttonUp(id){
		
	if(document.images[id].src.indexOf("_down")>0){
	
		return;
	}
	else {
		document.images[id].src=rPath + [id] +"_up.jpg";
	}
}


function resetButtons(){
document.images['home'].src=rPath + ['home'] +"_up.jpg";
document.images['profile'].src=rPath + ['profile'] +"_up.jpg";
document.images['portfolio'].src=rPath + ['portfolio'] +"_up.jpg";
document.images['contact'].src=rPath + ['contact'] +"_up.jpg";
}

/****** MENU FUNCTIONS ******/

function show(element){
		document.getElementById(element).style.visibility = 'visible';
}
	
function hide(element){
		document.getElementById(element).style.visibility = 'hidden';
}
	
function changeClass(element, newClass){
	document.getElementById(element).className= newClass;
}



/****** IMAGE PRELOADERS ******/

function preLoader(){

for (x=0; x<=7; x++) {
	imagevar="newimage" + x +" = new Image();"	
	eval(imagevar);
	
}

	newimage0.src = rPath + "home_over.jpg";
	newimage1.src = rPath + "home_down.jpg";
	newimage2.src = rPath + "profile_over.jpg";
	newimage3.src = rPath + "profile_down.jpg";
	newimage5.src = rPath + "portfolio_over.jpg";
	newimage4.src = rPath + "portfolio_down.jpg";	
	newimage6.src = rPath + "contact_over.jpg";
	newimage7.src = rPath + "contact_down.jpg";
}
