// Set global vars
var ok = (document.images ? true : false);
if(ok) {
   var corkin = new Image; corkin.src = "imgs/cork_in.gif";
   var corkout = new Image; corkout.src = "imgs/cork_out.gif";
}
var scrnwidth = screen.width;
var scrnheight = screen.height;
var thumbWin;

// Rollover functions 
function turnOn(whichone) {
   if(ok && whichone!="error" && whichone!="home") {
      eval('document.images["'+whichone+'_cork"].src=corkout.src');
   }
}
function turnOff(whichone) {
   if(ok && whichone!=current) {
      eval('document.images["'+whichone+'_cork"].src=corkin.src');
   }
}

// Opens larger image from thumbnail. Centered, one-at-a-time, naked, with alt.
function openThumb(filename,width,height,alttext) {
	xspot = Math.round((scrnwidth/2)-(width/2));
	yspot = Math.round((scrnheight/2)-(height/2));
	features = "width="+width+",height="+height+",top="+yspot+",screenY="+yspot+",left="+xspot+",screenX="+xspot;
	closeThumb();
	thumbWin = window.open("","",features);
	drawstr =  "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">";
	drawstr += "<html><head><title>"+alttext+"</title></head>";
	drawstr += "<body bgcolor=\"white\" marginheight=\"0\" marginwidth=\"0\" topmargin=\"0\" leftmargin=\"0\">";
	drawstr += "<img src=\"/photos/larger/";
	drawstr += filename;
	drawstr += "\" width=\""+width+"\" height=\""+height+"\" border=\"0\" alt=\"";
	drawstr += alttext;
	drawstr += "\">";
	drawstr += "</body></html>";
	thumbWin.document.open();
	thumbWin.document.write(drawstr);
	thumbWin.document.close();
}

// Closes thumbWin if open.
function closeThumb() {
	if (thumbWin && thumbWin.open){
		thumbWin.close();
	}
}
