// Routine for popup windows with title, size and background colour parameter (5 parameters)

browser = navigator.appName;
version = navigator.appVersion;

function browser_caution() {

if (version.substring(0,1)<4) {
document.write('<font size="+1" color="#FF0000"><b>Caution:<\/b> You are running ' + browser + ' version ' + version.substring(0,3) +
' and many browsers lower than Version 4 do not support the JavaScript which provides the Popup images when you click on the thumbnails on this page.</font><p>') 
}
if ( (navigator.userAgent.indexOf("MSIE") != -1) && (navigator.userAgent.indexOf("Mac") != -1) ) {document.write('<font size="+1" color="#FF0000"><b>Caution: Apple Users<\/b> - Please do no close Popup Windows containing the larger images you get by clicking on icons, they will be closed automatically when you leave this page. If you close them you may need to refresh the page.<\/font><p>')
}
}

var newwindow;
var wheight = 0, wwidth = 0;

function popitup5(url, title, iwidth, iheight, imwidth, imheight, colour) {
var pwidth, pheight;

if ( !newwindow || newwindow.closed ) {
	pwidth=iwidth+30;
	pheight=iheight+70;
	newwindow=window.open('','htmlname','width=' + pwidth +',height=' +pheight + ',resizable=1,top=50,left=10');
	wheight=iheight;
	wwidth=iwidth;
}
 
if (wheight!=iheight || wwidth!=iwidth ) {
	pwidth=iwidth+30;
	pheight=iheight+100;
	if (version.substring(0,1)>3) { 	// check browser v4+ supporting JavaScript 1.2	
		newwindow.resizeTo(pwidth, pheight);
	}
	wheight=iheight;
	wwidth=iwidth;
}

newwindow.document.clear();
newwindow.document.writeln('<html> <head> <title>' + title + '<\/title> <\/head> <body bgcolor= \"' + colour + '\"> <center>');
newwindow.document.writeln('<img src=' + url + ' width=' + imwidth + ' height=' + imheight + '>');
newwindow.document.writeln('<p><a href="javascript:window.close()" onmouseout="status=\'\'; return true;" onmouseover="status=\'Close window\'; return true;" onclick="status=\'Close window\'; return true;">Close window<\/a><\/p>');
newwindow.document.writeln('<\/center> <\/body> <\/html>');
newwindow.document.close();
newwindow.focus();
}

function beforeafter(url1, url2, title, iwidth, iheight, imwidth, imheight, colour) {
var pwidth, pheight;

if ( !newwindow || newwindow.closed ) {
	pwidth=iwidth*2+50;
	pheight=iheight+100;
	newwindow=window.open('','htmlname','width=' + pwidth +',height=' +pheight + ',resizable=1,top=50,left=10');
	wheight=iheight;
	wwidth=iwidth;
}
 
if (wheight!=iheight || wwidth!=iwidth ) {
	pwidth=iwidth*2+50;
	pheight=iheight+130;
	if (version.substring(0,1)>3) { 	// check browser v4+ supporting JavaScript 1.2	
		newwindow.resizeTo(pwidth, pheight);
	}
	wheight=iheight;
	wwidth=iwidth;
}

newwindow.document.clear();
newwindow.document.writeln('<html> <head> <title>' + title + '<\/title> <\/head> <body bgcolor= \"' + colour + '\"> <center>');
newwindow.document.writeln('<table cellpadding=0 cellspacing=5 border=0><tr><td align=center>');
newwindow.document.writeln('<img src=' + url1 + ' width=' + imwidth + ' height=' + imheight + '>');
newwindow.document.writeln('<p>before<\/p>');
newwindow.document.writeln('<\/td><td align=center>');
newwindow.document.writeln('<img src=' + url2 + ' width=' + imwidth + ' height=' + imheight + '>');
newwindow.document.writeln('<p>after<\/p>');
newwindow.document.writeln('<\/td><\/tr><\/table>');
newwindow.document.writeln('<p><a href="javascript:window.close()" onmouseout="status=\'\'; return true;" onmouseover="status=\'Close window\'; return true;" onclick="status=\'Close window\'; return true;">Close window<\/a><\/p>');
newwindow.document.writeln('<\/center> <\/body> <\/html>');
newwindow.document.close();
newwindow.focus();
}


//Routines to tidy up popup windows when page is left

function tidyh() {
if (newwindow && !newwindow.closed) { newwindow.close(); }
}

function tidy5() {
tidyh();
fbtidy();
}

//Routines specifically for popup feedback windows

var fbwindow
function fbpopitup(url) {
if (fbwindow && !fbwindow.closed) 
	{ fbwindow.location.href = url; fbwindow.focus(); } 
else 
	{ fbwindow=window.open(url,'fhtmlname','width=520,height=420,resizable=1,scrollbars=1,top=50,left=10'); }
}
function fbtidy(){
if (fbwindow && !fbwindow.closed) {fbwindow.close(); } }

// Based on JavaScript provided by Peter Curtis at www.pcurtis.com
