var xmlHttp, xmlHttp2;
//function showPage(str) {  showStates(str); }

function showStates(pg,kw,srch) 
	{ 
	xmlHttp=GetXmlHttpObject()
	xmlHttp2=GetXmlHttpObject()
	
	//If we cant do the request error out
	if (xmlHttp==null || xmlHttp2==null ) {	alert ("Browser does not support HTTP Request"); return false; }
		
	//First build the navigation panel
	var url="drm_ajax/pagination-photos.php?p="+pg+"&t=nav&sid="+Math.random()+"&kw="+kw+"&srch="+srch;
	xmlHttp2.onreadystatechange=navDone 
	xmlHttp2.open("GET",url,true);
	xmlHttp2.send(null);
	
	//Build the url to call Pass variables through the url
	var url="drm_ajax/pagination-photos.php?p="+pg+"&t=con&sid="+Math.random()+"&kw="+kw+"&srch="+srch;
	xmlHttp.onreadystatechange=stateChanged 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	}

function navDone() { 
	//IF this is getting called when the page is done loading then fill the pagination div
	if (xmlHttp2.readyState==4 || xmlHttp2.readyState=="complete") { 
	 	//Update the Div tag with the outputted text
	 	document.getElementById("pgNavigation1").innerHTML=xmlHttp2.responseText 
	 	document.getElementById("pgNavigation2").innerHTML=xmlHttp2.responseText 
	} 
}

function stateChanged() { 
	//IF this is getting called when the page is done loading the states then output the div
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 
	 	//Update the Div tag with the outputted text
	 	document.getElementById("pgContent").innerHTML=xmlHttp.responseText 
	} 
}

function GetXmlHttpObject() {
	//Determine what browser we are on and make a httprequest connection for ajax
	var xmlHttp=null;

	try { xmlHttp=new XMLHttpRequest(); } // Firefox, Opera 8.0+, Safari
	 	
	catch (e) {
	 	try {
	  		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	  	}
	 	catch (e) {
	  		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	  	}
	}
	return xmlHttp;
}