// JavaScript Document
function imageList(sectionid,section,cityid,stateid,countryid,page,photoStr){
	var ajaxReq;  // The variable that makes Ajax possible!
//	document.getElementById('imgholder'+imageid).innerHTML="imgholder";
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxReq = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxReq = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxReq = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	ajaxReq.onreadystatechange = function(){
		if(ajaxReq.readyState == 1 || ajaxReq.readyState == 2 || ajaxReq.readyState == 3){
			document.getElementById('imageThumbsHolder').innerHTML="<p class=\"verd11\"><img src=\"../images/ajax-loader.gif\" /></p>";
		}
		if(ajaxReq.readyState == 4){
			var ajaxDisplay = document.getElementById('imageThumbsHolder');
			ajaxDisplay.innerHTML = ajaxReq.responseText;
		}		
	}
	sid=Math.random();
	//var str="?countryid="+countryid+"&stateid="+stateid+"&cityid="+cityid+"&page="+page+"&section="+section+"&sectionid="+sectionid+"&photoStr="+photoStr
    var str="?country="+countryid+"&state="+stateid+"&city="+cityid+"&page="+page+"&section="+section+"&sectionid="+sectionid+"&photoStr="+photoStr
	ajaxReq.open("GET","imageList.php"+str, true)
	ajaxReq.send(null)
	
}
//PLACE LIST
function placeList(section,cityid,stateid,countryid){
	var ajaxReq;  // The variable that makes Ajax possible!
//	document.getElementById('imgholder'+imageid).innerHTML="imgholder";
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxReq = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxReq = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxReq = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	ajaxReq.onreadystatechange = function(){
		if(ajaxReq.readyState == 1 || ajaxReq.readyState == 2 || ajaxReq.readyState == 3){
			document.getElementById('pl').innerHTML="<p class=\"verd11\">Populating with places</p>";
		}
		if(ajaxReq.readyState == 4){
			var ajaxDisplay = document.getElementById('pl');
			ajaxDisplay.innerHTML = ajaxReq.responseText;
		}		
	}
	sid=Math.random();
	var str="?country="+countryid+"&state="+stateid+"&city="+cityid+"&section="+section
	ajaxReq.open("GET","placeList.php"+str, true)
	ajaxReq.send(null)
	
}
//STATE LIST
function stateList(countryid){
	var ajaxReq;  // The variable that makes Ajax possible!
//	document.getElementById('imgholder'+imageid).innerHTML="imgholder";
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxReq = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxReq = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxReq = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	ajaxReq.onreadystatechange = function(){
		if(ajaxReq.readyState == 1 || ajaxReq.readyState == 2 || ajaxReq.readyState == 3){
			document.getElementById('st').innerHTML="<p class=\"verd11\">Loading state list</p>";
		}
		if(ajaxReq.readyState == 4){
			var ajaxDisplay = document.getElementById('st');
			ajaxDisplay.innerHTML = ajaxReq.responseText;
		}		
	}
	sid=Math.random();
	var str="?countryid="+countryid
	ajaxReq.open("GET","process/statecitylist.php"+str, true)
	ajaxReq.send(null)
	
}
function cityList(countryid, stateid){
	var ajaxReq;  // The variable that makes Ajax possible!
//	document.getElementById('imgholder'+imageid).innerHTML="imgholder";
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxReq = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxReq = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxReq = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	ajaxReq.onreadystatechange = function(){
		if(ajaxReq.readyState == 1 || ajaxReq.readyState == 2 || ajaxReq.readyState == 3){
			document.getElementById('ci').innerHTML="<p class=\"verd11\">Loading city list</p>";
		}
		if(ajaxReq.readyState == 4){
			var ajaxDisplay = document.getElementById('ci');
			ajaxDisplay.innerHTML = ajaxReq.responseText;
		}		
	}
	sid=Math.random();
	var str="?countryid="+countryid+"&stateid="+stateid+"&sid="+sid
	ajaxReq.open("GET","process/statecitylist.php"+str, true)
	ajaxReq.send(null)
	
}
function loadImage(imageid,section){
	var ajaxReq;  // The variable that makes Ajax possible!
//	document.getElementById('imgholder'+imageid).innerHTML="imgholder";
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxReq = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxReq = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxReq = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	ajaxReq.onreadystatechange = function(){
		if(ajaxReq.readyState == 1 || ajaxReq.readyState == 2 || ajaxReq.readyState == 3){
			document.getElementById('imageHolder').innerHTML="<img src=\"../images/ajax-loader.gif\" />";
		}
		if(ajaxReq.readyState == 4){
			var ajaxDisplay = document.getElementById('imageHolder');
			ajaxDisplay.innerHTML = ajaxReq.responseText;
		}		
	}
	sid=Math.random();
	var str="?imageid="+imageid+"&section="+section
	ajaxReq.open("GET","loadImage.php"+str, true)
	ajaxReq.send(null)
	
}
//SEARCH RESULT
function searchPhoto(photoStr){
	var ajaxReq;  // The variable that makes Ajax possible!
//	document.getElementById('imgholder'+imageid).innerHTML="imgholder";
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxReq = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxReq = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxReq = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	ajaxReq.onreadystatechange = function(){
		if(ajaxReq.readyState == 1 || ajaxReq.readyState == 2 || ajaxReq.readyState == 3){
			document.getElementById('searchResult').innerHTML="<p class=\"verd11\"><img src=\"../images/ajax-loader.gif\" />Search in progress</p>";
		}
		if(ajaxReq.readyState == 4){
			var ajaxDisplay = document.getElementById('searchResult');
			ajaxDisplay.innerHTML = ajaxReq.responseText;
		}		
	}
	sid=Math.random();
	var str="?photoStr="+photoStr
	ajaxReq.open("GET","searchHandler.php"+str, true)
	ajaxReq.send(null)
	
}