var i=0;
var imgarray=new Array();

function rollimage_on(whichimg){
	document.images[whichimg].src = document.images[whichimg].src.replace(/_out/,"_ovr");	
}

function rollimage_off(whichimg){
	document.images[whichimg].src = document.images[whichimg].src.replace(/_ovr/,"_out");
}

function swapimage(whichimg){
	i = document.images[whichimg].name.replace(/thumb0/,"")-1;
	document.images["main"].src = document.images[whichimg].src.replace(/-thmb_ovr/,"");
}

function previmage(){
	i--;
	if (i < 0) i=imgarray.length-1;
	document.images["main"].src = imgarray[i];
}

function nextimage(){
	i++;
	if (i > imgarray.length-1) i=0;
	document.images["main"].src = imgarray[i];
}

function setimgarray(){
	var x=1;
	while (document.images["thumb0" + x]!=undefined){
		imgarray[x-1]=document.images["thumb0" + x].src.replace(/-thmb_out/,"");
		x++;
	}
}
function proj_rollimage_on(whichimg,message){
   if (document.getElementById || document.all) {
      var el = document.getElementById? document.getElementById("header-middle-project"): document.all["header-middle-project"];
      if (el && typeof el.innerHTML != "undefined") el.innerHTML = "<p>" + message + "</p>";
   }
	document.images[whichimg].src = document.images[whichimg].src.replace(/_out/,"_ovr");	
}

function proj_rollimage_off(whichimg){
   if (document.getElementById || document.all) {
      var el = document.getElementById? document.getElementById("header-middle-project"): document.all["header-middle-project"];
      if (el && typeof el.innerHTML != "undefined") el.innerHTML = "";
   }
	document.images[whichimg].src = document.images[whichimg].src.replace(/_ovr/,"_out");
}