var oldSrc;

function preloadimages() {
	/*
	pre-load a highlighted version 
	of each "nav_" image
	*/
	var num = document.images.length;
	var img,posn,temp,orig,newsrc;
	var preload = new Array();
	for(var i = 0; i<num; i++) {
		img = document.images[i].src;
		posn = img.indexOf("nav_");
		if(posn > -1 && img.indexOf("_over")< 0){
			dot = img.lastIndexOf(".");
			temp = img.substr(dot,img.length);
			orig = img.substr(0,dot);
			newsrc = orig + "_over" + temp;
			preload[i] = new Image();
			preload[i].src = newsrc;
		}//if
	}//for
 }

function getSrc(n){
    img = n.toString();
         eval("n = document." + img + ".src");
         if(n.indexOf("_over")< 0){
                 dot = n.lastIndexOf(".");
                 temp = n.substr(dot,n.length).toString();
                 orig = n.substr(0,dot).toString();
                 newsrc = orig + "_over" + temp;
                 newsrc = newsrc.toString();
         return newsrc;
         }
        else{return n;}
 }

function swap(imgname) {
       n = arguments[0].toString();
                  eval("oldSrc = document." + n + ".src");
                  old = n;
                  eval("document." + n + ".src=getSrc('" + imgname + "')");
 }

function restore(){
      eval("document." + img + ".src=oldSrc");

 }
 
 function open_photo_h(url){
	window.open(url,"MISERY",'toolbar=no,location=0,directories=0,status=0,menubar=no,scrollbars=0,resizable=0,width=800,height=600,top=1,left=1')
}

 function open_photo_v(url){
	window.open(url,"MISERY",'toolbar=no,location=0,directories=0,status=0,menubar=no,scrollbars=0,resizable=0,width=600,height=800,top=1,left=1')
}

 function open_photo_h_big(url){
	window.open(url,"MISERY",'toolbar=no,location=0,directories=0,status=0,menubar=no,scrollbars=0,resizable=0,width=1024,height=768,top=1,left=1')
}

 function open_photo_v_big(url){
	window.open(url,"MISERY",'toolbar=no,location=0,directories=0,status=0,menubar=no,scrollbars=0,resizable=0,width=768,height=1024,top=1,left=1')
}
