// Launch info is a function used to create a new window
// and display information about a chosen subject.
// a: mike holloway, webxpress.

var infoWindow;
function launchInfo(subject){

	// Check if window is already open, close.
	if(infoWindow){
		infoWindow.close();
	}

	// Browser detection
	var dom = document.getElementById ? true:false;
	var nn4 = document.layers ? true:false;
	var ie4 = document.all ? true:false;

	// Declare and initialise.
	var artwork = new Image();
	artwork.src = subject;

	var imgTop;
	var imgLeft;
	var imgWidth = 600;
	var imgHeight = 600;
	
	imgTop = ((window.screen.availHeight / 2) - (imgHeight /2));
	imgLeft = ((window.screen.availWidth / 2) - (imgWidth /2));

	// Attach new window to variable.
	infoWindow = window.open("","information","top="+imgTop+",left="+imgLeft+",width="+imgWidth+",height="+imgHeight+",!resizable,status,!scrollbars,!menubar");

	// Begin building html for new window.
	infoWindow.document.write("<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd' />\r");
	infoWindow.document.write("<html xmlns='http://www.w3.org/1999/xhtml' lang='en' xml:lang='en'>\r");
	infoWindow.document.write("<html>\r");
	infoWindow.document.write("<head>\r");
	infoWindow.document.write("<title>Temper BMC</title>\r");
	infoWindow.document.write("<link rel='stylesheet' type='text/css' href='/common_files/stylesheet.css' />\r");
	infoWindow.document.write("</head>\r");
	infoWindow.document.write("<body>\r");	

	// Begin displaying page content
	if(subject){
		infoWindow.document.write("<img src='"+subject+"' alt='' border='0' />\r");
	}
	else infoWindow.document.write("<p>No information has been added for this artwork yet.</p>");

	// End html in new window.
	infoWindow.document.write("</body>\r");
	infoWindow.document.write("</html>");
	
	// Status bar message.
	infoWindow.status = "Close this window to return.";

	// Clear variables.
	artwork = false;
}