/*function openPictureWindow(imageType,imageName,name,imageWidth,imageHeight,alt) {
	newWindow = window.open("",name,"width="+imageWidth+",height="+imageHeight+",scrollbars=no");
	newWindow.document.open();
	newWindow.document.write('<html><title>'+alt+'</title><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" >'); 
	if (imageType == "swf"){
	newWindow.document.write('<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0\" width=\"'+imageWidth+'\" height=\"'+imageHeight+'\">');
	newWindow.document.write('<param name=movie value=\"'+imageName+'\"><param name=quality value=high>');
	newWindow.document.write('<embed src=\"'+imageName+'\" quality=high pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width=\"'+imageWidth+'\" height=\"'+imageHeight+'\">');
	newWindow.document.write('</embed></object>');	}else{
	newWindow.document.write('<img src=\"'+imageName+'\" width='+imageWidth+' height='+imageHeight+' alt=\"'+alt+'\">'); 	}
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
}*/

function openIngeniousWindow(url, name) {
	var width = 800;
	var height = 585;
	newWindow = window.open(url, name, "width="+width+",height="+height+",scrollbars=yes,resizable=yes");
}

function openPictureWindow(imageType,imageName,name,imageWidth,imageHeight,alt,credit,title,ingenious, searchString, barcode) {
	if (imageType == "swf") {
		width = imageWidth;
		height = imageHeight;
	} else {
		// [be] added specific width
		pageWidth = 550;
		width = (+pageWidth) + 26; // add on width for table borders etc
		height = (+imageHeight) + 125; // add on height for table borders etc
	}
	newWindow = window.open("",name,"width="+width+",height="+height+",scrollbars=no,resizable=yes");
	newWindow.document.open();

	// write the HTML for the window
	newWindow.document.writeln('<html>');
	newWindow.document.writeln('<head><title>Making the Modern World</title><link rel="StyleSheet" href="/css/dom.css" type="text/css"/>');
	newWindow.document.writeln('</head>');
	newWindow.document.writeln('<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0">');
	
	// RICH MEDIA
	if (imageType == "swf") {
		newWindow.document.writeln('<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0\" width=\"'+imageWidth+'\" height=\"'+imageHeight+'\">');
		newWindow.document.writeln('<param name=movie value=\"'+imageName+'\"><param name=\"quality\" value=\"high\">');
		newWindow.document.writeln('<embed src=\"'+imageName+'\" quality=\"high\" pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width=\"'+imageWidth+'\" height=\"'+imageHeight+'\">');
		newWindow.document.writeln('</embed></object>');
	} else {

		// [be] newWindow.document.write('<table  border="0" cellspacing="0" cellpadding="0" width="' + width + '" height="' + height + '" class="popuptable">');
		
		newWindow.document.writeln('<table id="popUpTable" border="0" cellspacing="0" cellpadding="5" width="100%" height="100%" class="popuptable">');
		
		newWindow.document.writeln('<tr>');
	
	// POPUP WITH INGENIOUS LINK
		if (ingenious) {
		
			newWindow.document.writeln('<td colspan="3" align="center" valign="top" height="'+imageHeight+'"><img src=\"'+imageName+'\" width='+imageWidth+' height='+imageHeight+' alt=\"'+alt+'\" /></td>');
			newWindow.document.writeln('</tr>');	
			newWindow.document.writeln('<tr>');
			newWindow.document.writeln('<td valign="top" class="popupbottomcorner"><a href="http://www.sciencemuseum.org.uk/makingthemodernworld/redirector.asp?SearchString=' + searchString + '&amp;barcode=' + barcode + '" target="_blank" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'Image2\',\'\',\'/furniture/ingenious_f2.gif\',1)"><img src="/furniture/ingenious.gif" alt="Ingenious" name="Image2" width="95" height="22" border="0"></a></td>');
			newWindow.document.writeln('<td valign="top" class="popupbottom"><p>' + title + '</p></td>');
			newWindow.document.writeln('<td class="popupbottom" valign="top"><p>');			
			if (credit != '')
			{
				newWindow.document.writeln('&copy; ' + credit);
			}
			else
			{
				newWindow.document.writeln('&nbsp;');
			}			
			newWindow.document.writeln('</p></td>');
			newWindow.document.writeln('</tr>');

	// POPUP WITHOUT INGENIOUS LINK
		} else {
			
			newWindow.document.writeln('<td colspan="2" align="center" valign="top" height="'+imageHeight+'"><img src=\"'+imageName+'\" width='+imageWidth+' height='+imageHeight+' alt=\"'+alt+'\" /></td>');
			newWindow.document.writeln('</tr>');
			newWindow.document.writeln('<tr>');
			newWindow.document.writeln('<td valign="top" class="popupbottomcorner"><p>' + title + '</p></td>');
			newWindow.document.writeln('<td class="popupbottom" valign="top"><p>');			
			if (credit != '')
			{
				newWindow.document.writeln('&copy; ' + credit);
			}
			else
			{
				newWindow.document.writeln('&nbsp;');
			}	
			newWindow.document.writeln('</p></td>');
			newWindow.document.writeln('</tr>');
		}
	
		newWindow.document.writeln('</table>');
	}
	
	newWindow.document.writeln('</body></html>');

	newWindow.document.close();
	newWindow.focus();
}

