// 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, colour) {
var pwidth, pheight;

// Routine to redirect popups from gallery folder to UNZ web site - a fudge due to shortage of storage on pcurtis.com

//if (url.indexOf('gallery') == 0) { url = 'http:\/\/www.uniquelynz.com\/' + url } ;

if ( !newwindow || newwindow.closed ) {
	pwidth=iwidth+30;
	pheight=iheight+30;
	newwindow=window.open('','htmlname','width=' + pwidth +',height=' +pheight + ',resizable=1,top=50,left=10,status=1 ');
	wheight=iheight;
	wwidth=iwidth;
}
 
if (wheight!=iheight || wwidth!=iwidth ) {
	pwidth=iwidth+30;
	pheight=iheight+90;
	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.focus();
newwindow.document.writeln('<html> <head> <title>' + title + ' <\/title> <\/head> <body bgcolor= \"' + colour + '\"> <center>');
newwindow.document.writeln('<img src=' + url + '  title=\"' + title + '\"   alt=\"' + title + '\" >');
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(); } }
function popitup(url) { popitup5(url , 'Digital Image 384x288', 384, 288, 'white') }
	function ppopitup(url) { popitup5(url , 'Photographic Image 400x267',400, 267, 'white') }
	function vpopitup(url) { popitup5(url , 'Digital Image 288x384', 288,384, 'white') }
	function pvpopitup(url) { popitup5(url , 'Photographic Image 267x400', 267, 400, 'white') }
	function tidy() {tidy5() }
	function popitup2v(url,title) { popitup5(url , title, 300, 400, 'white') }
	function popitup2bv(url,title) { popitup5(url , title, 450, 600, 'white') }
	function popitup2h(url,title) { popitup5(url , title, 400, 300, 'white') }
	function popitup2bh(url,title) { popitup5(url , title, 600, 450, 'white') }
	function hpop(image, title, alignment) {
		document.write('<IMG src= \"auimages04/' +image + 'i.jpg\" alt=\"' + title + '\"  title=\"' + title + '\"     width = 160 height = 120 border = 0 align=\"' + alignment + '\" hspace = 10 vspace = 10 onDblClick=\"popitup2bh(\'auimages04/'+ image+ 'b.jpg\' ,\' ' + title+ '  \' )\"  onClick=\"popitup2h(\'auimages04/'+ image+ 'w.jpg\' ,\' ' + title+ '  \' )\" <\/IMG>') }
	function vpop(image, title, alignment) {
		document.write('<IMG src= \"auimages04/' +image + 'i.jpg\" alt=\"' + title + '\"  title=\"' + title + '\"  width = 120 height = 160 border = 0 align=\"' + alignment + '\" hspace = 10 vspace = 10 onDblClick=\"popitup2bv(\'auimages04/'+ image+ 'b.jpg\' ,\' ' + title+ '  \' )\"  onClick=\"popitup2v(\'auimages04/'+ image+ 'w.jpg\' ,\' ' + title+ '  \' )\" <\/IMG>') }
/*
Sample routines for basic popup windows calling new routine in popup.js which can be copied into pages
	function popitup(url) { popitup5(url , 'Digital Image 384x288', 384, 288, 'white') }
	function ppopitup(url) { popitup5(url , 'Photographic Image 400x267', 400, 267, 'white') }
	function vpopitup(url) { popitup5(url , 'Digital Image 288x384', 288, 384, 'white') }
	function pvpopitup(url) { popitup5(url , 'Photographic Image 267x400', 267, 400, 'white') }
	function tidy() {tidy5() }
*/
// Based on JavaScript provided by Peter Curtis at www.pcurtis.com
