function getXMLHTTP() { //fuction to return the xml http object
		var xmlhttp=false;	
		try{
			xmlhttp=new XMLHttpRequest();
		}
		catch(e)	{		
			try{			
				xmlhttp= new ActiveXObject('Microsoft.XMLHTTP');
			}
			catch(e){
				try{
				xmlhttp = new ActiveXObject('Msxml2.XMLHTTP');
				}
				catch(e1){
					xmlhttp=false;
				}
			}
		}
		 	
		return xmlhttp;
    }

function sortPage(city, category) {		
		
		var age = document.getElementById('tcr_age').value;
		var gender = document.getElementById('tcr_gender').value;
		var japanese = document.getElementById('tcr_japanese').value;
		
		var strURL="http://hanasoo.com/private_call.php?cit="+encodeURI(city)+"&lct="+category+"&ag="+age+"&gd="+gender+"&jp="+japanese;
		var req = getXMLHTTP();
		
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {						
						document.getElementById('private_ajax').innerHTML=req.responseText;
						
					} else {
						alert("There was a problem while using XMLHTTP:" + req.statusText);
					}
				}else{
				document.getElementById('private_ajax').innerHTML = "<img src='http://hanasoo.com/img/img_loading.gif' width='16' height='16' style='margin-left:422px;margin-top:100px;margin-bottom:100px;' />";
				}			
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}		

}

function getPage(nowpage,tcnt,city,category,age,gender,japanese) {

		var strURL="http://hanasoo.com/private_call.php?np="+nowpage+"&tc="+tcnt+"&cit="+encodeURI(city)+"&lct="+category+"&ag="+age+"&gd="+gender+"&jp="+japanese;
		var req = getXMLHTTP();
		
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {						
						document.getElementById('private_ajax').innerHTML=req.responseText;
						
					} else {
						alert("There was a problem while using XMLHTTP:" + req.statusText);
					}
				}else{
				document.getElementById('private_ajax').innerHTML = "<img src='http://hanasoo.com/img/img_loading.gif' width='16' height='16' style='margin-left:422px;margin-top:100px;margin-bottom:100px;' />";
				}			
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}		
}