function win(url, title, w, h) {
	var parameters; // passed to photo.html
	var x;
	var y;
	var windowWidth = screen.width - 12;
	var windowHeight = screen.height - 64;
	var imageWidth = w;
	var imageHeight = h;
	
	if (windowWidth > 1268) windowWidth = 1268;
	if (windowHeight > 960) windowHeight = 960;
	if (windowWidth < (w+80)) { windowWidth = w; windowHeight = h;}
	if (windowHeight < (h+80)) { windowWidth = w; windowHeight = h;}
	if (windowWidth > screen.width) windowWidth = screen.width - 12;
	if (windowHeight > screen.height) windowHeight = screen.height - 64;


	x = (screen.width/2) - (windowWidth/2) - 6;
	if ( (x < 0) || (x > 500) ) x = 0;
	
	y = (screen.height/2) - (windowHeight/2) - 34;
	if (y < 0) y = 0;
	properties = "left=" + x + ",top=" + y + ",resizable=yes";
	needscroll = 0;
	if ( w > windowWidth ) {
		needscroll = 1;
	}
	if ( h > windowHeight ) {
		needscroll = 1;
	}
	if (1 == needscroll) {
		properties += ",scrollbars=yes";
	}
	properties += ",height="+windowHeight+",width="+windowWidth;
	parameters = "?url=" + url;
	parameters += "&title=" + title + " &#169; David Schwaegler";
	parameters += "&w=" + w;
	parameters += "&h=" + h;
	parameters += "&ww=" + windowWidth;
	parameters += "&wh=" + windowHeight;
	
	window.open("/photo.html" + parameters,"",properties);
}

function img(url, w, h) {
	var x;
	var y;
	var windowWidth = screen.width - 12;
	var windowHeight = screen.height - 64;
	
	if (windowWidth > 1268) windowWidth = 1268;
	if (windowHeight > 960) windowHeight = 960;
	if (windowWidth < (w+80)) { windowWidth = w; windowHeight = h;}
	if (windowHeight < (h+80)) { windowWidth = w; windowHeight = h;}
	if (windowWidth > screen.width) windowWidth = screen.width - 12;
	if (windowHeight > screen.height) windowHeight = screen.height - 64;


	x = (screen.width/2) - (windowWidth/2) - 6;
	if ( (x < 0) || (x > 500) ) x = 0;
	
	y = (screen.height/2) - (windowHeight/2) - 34;
	if (y < 0) y = 0;
	properties = "left=" + x + ",top=" + y + ",resizable=yes";
	needscroll = 0;
	if ( w > windowWidth ) {
		needscroll = 1;
	}
	if ( h > windowHeight ) {
		needscroll = 1;
	}
	if (1 == needscroll) {
		properties += ",scrollbars=yes";
	}
	properties += ",height="+windowHeight+",width="+windowWidth;
	window.open("/image.asp?url=" + url + "&w=" + w + "&windowWidth=" + windowWidth + "&windowHeight=" + windowHeight,"",properties);
}

function zoom(url, title) {
	var x;
	var y;
	w = 750;
	h = 450;
	var windowWidth = screen.width - 12;
	var windowHeight = screen.height - 64;
	var imageWidth = w;
	var imageHeight = h;

	if (windowWidth > 1268) windowWidth = 1268;
	if (windowHeight > 960) windowHeight = 960;
	if (windowWidth < (imageWidth+80)) { windowWidth = imageWidth; windowHeight = imageHeight;}
	if (windowHeight < (imageHeight+80)) { windowWidth = imageWidth; windowHeight = imageHeight;}
	if (windowWidth > screen.width) windowWidth = screen.width - 12;
	if (windowHeight > screen.height) windowHeight = screen.height - 64;
	x = (screen.width/2) - (windowWidth/2) - 6;
	if ( (x < 0) || (x > 500) ) x = 0;
	
	y = (screen.height/2) - (windowHeight/2) - 34;
	if (y < 0) y = 0;
	properties = "left=" + x + ",top=" + y + ",resizable=yes";
	needscroll = 0;
	if ( w > windowWidth ) {
		needscroll = 1;
	}
	if ( h > windowHeight ) {
		needscroll = 1;
	}
	if (1 == needscroll) {
		properties += ",scrollbars=yes";
	}
	properties += ",height="+windowHeight+",width="+windowWidth;
	parameters = "?url=" + url;
	parameters += "&title=" + title + " &#169; David Schwaegler";
	parameters += "&w=" + w;
	parameters += "&h=" + h;
	parameters += "&ww=" + windowWidth;
	parameters += "&wh=" + windowHeight;
	
	window.open("/zoom.html" + parameters,"",properties);
	
	
}

function gup( name ) {
	name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
	var regexS = "[\\?&]"+name+"=([^&#]*)";
	var regex = new RegExp( regexS );
	var results = regex.exec( window.location.href );
	if( results == null )
		return "";
	else {
		return( results[1].replace(/%20/g, " "));
	}
}
