var DA_Window=null;

function openWindow(imageName, galTitle) {
	// Initialize variables
	leftPos = 0;
	topPos = 0;
	imgNum = 0;
	sbars = 0;
	
	// Get desired resolution from form item
	switch(resolution_form.resolution.value){
		case "high" :
			height = 900;
			imageName = '../images/h_' + imageName;
			break;
		case "medium" :
			width = 310;
			height = 450;
			imageName = '../images/m_' + imageName;
			break;
		case "low" :
			width = 220;
			height = 320;
			imageName = '../images/l_' + imageName;
			break;
		default : 
			alert("Please choose a desired size for the image")
	}

	winWidth = width + 22;
	winHeight = height +26 +100;
		
	myMessage = "award info popup";

	// center the window in the screen
	leftPos = ((screen.width/2)-(winWidth/2));
	topPos = ((screen.height/2)-(winHeight/2));
	//	alert("width: " + width + " * height: " + height + "\ntop: " + topPos + " left: " + leftPos )
	if (topPos < 0){topPos = 0;}
	if (leftPos < 0){leftPos = 0;}

	// Create the window
	if (DA_Window && (!DA_Window.closed)){
	   DA_Window.close();
	}
	if (winHeight> screen.height){sbars=1; winHeight=(screen.height-60); }
		
	winParams = "resizable=1,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=" + sbars + ",width=" + winWidth + ",height=" + winHeight + ",left=" + leftPos + ",top=" + topPos;
	DA_Window = window.open('', 'DA_Window', winParams )
	DA_Window.document.open();
	DA_Window.document.write("<HTML><HEAD>");
	DA_Window.document.write("<link rel='STYLESHEET' href='../css/content.css' type='text/css'>");
	DA_Window.document.write("<TITLE>Dreyer Fine Art Bronze Studio - Gallery: " + galTitle + "</TITLE>");
	DA_Window.document.write("</HEAD><basefont face='futura, arial, helvetica, sans-serif' size='3'>");
	DA_Window.document.write("<body bgcolor='#B1A185' text='#663333' link='#990000' vlink='#0099CC' onBlur='this.close' class='nav'>");
	DA_Window.document.write("<center><h2 class='title'>" + galTitle + "</h2><hr>");
	/* USE THE FOLOWING LINE TO MANUALY SIZE THE IMAGE */
//		DA_Window.document.write("<IMG HSPACE=0 VSPACE=0 HEIGHT=" + imgname.high + " WIDTH=" + imgname.wide +" SRC='" + contentArg + "'>");
	DA_Window.document.write("<IMG HSPACE=0 VSPACE=0 HEIGHT=" + (height-26) + /*" WIDTH=" + (width-22) +*/ " SRC='" + imageName + "'>");
	/* USE THE FOLOWING LINE TO AUTOMATICALLY USE THE IMAGE AT 100 PERCENT OF ITS SIZE */
	// DA_Window.document.write("<IMG HSPACE=0 VSPACE=0 SRC='" + imgname.name + "'>");
	DA_Window.document.write("<hr>");
	DA_Window.document.write("<FORM><INPUT TYPE='button' VALUE='Close' onClick='window.close()'></FORM>");
	DA_Window.document.write("</center>");
	DA_Window.document.write("</BODY></HTML>");
	DA_Window.document.close();
	DA_Window.focus();
}
	
function highlightImage(curImage, size){
	curImage.border=size;
}