window.onload=handle_onload;
function createxmlhttp() {
	if (window.XMLHttpRequest) {
		return new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		var o=new ActiveXObject('Microsoft.XMLHTTP');
		return o;
	} else {
		alert("Could not create XMLHttpRequest on this browser");
		return null;
	}
}
function doSearch() {
	//' use XMLHTTP to get foto search results
	var xmlhttp = createxmlhttp();
	if (!xmlhttp) return;
   	var strUrl="searchFotos.asp?q=" + escape(document.getElementById("srch").value);
	xmlhttp.open("GET", strUrl, false);
	xmlhttp.send(null);
	//window.open ("searchFotos.asp?q=" + escape(document.getElementById("srch").value));
	document.getElementById("divResults").innerHTML=xmlhttp.responseText;
}
function checkEnter() {
	try {
		if (event.keyCode==13) doSearch()
	} catch(e){}
}
function doOpen(intId) {
	
	var a=window.open("", "", "width=450px,scrollbars=yes, resizable=yes");
	a.document.write("<html><head><title>Foto " + intId + "</title>");
	a.document.write ('	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>');
	a.document.write('<link rel="STYLESHEET" type="text/css" href="style.css"></head><body>');
	a.document.write("<center><img src='fotopub/" + intId + ".jpg'></center>");
	//' get the foto details
	var xmlhttp = createxmlhttp();
	if (!xmlhttp) return;
	
   	var strUrl="getFotoDetails.asp?q=" + intId;
	xmlhttp.open("GET", strUrl, false);
	xmlhttp.send(null);
	a.document.write(xmlhttp.responseText);
	a.document.write("</body></html>");
	a.document.close();
	
}
function handle_onload() {	
	doFocus();
}
function doFocus() {
	if (document.getElementById("srch")) document.getElementById("srch").focus();
}

