function getHTTPObject() {
  var xmlhttp;
 
  if(window.XMLHttpRequest){
    xmlhttp = new XMLHttpRequest();
  }
  else if (window.ActiveXObject){
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    if (!xmlhttp){
        xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
    
}
  return xmlhttp;

  
}
var http = getHTTPObject(); // We create the HTTP Object


    function requestInfo(url,id,redirectPage) {      
		var temp=new Array();
		var date = new Date();
var timestamp = date.getTime();
		document.getElementById('show').style.visibility="hidden";
			http.open("GET", url+"?&time="+timestamp, true);
			if (http.readyState == 0) {
			http.open("GET", url+"?&time="+timestamp, true);
			}
			http.onreadystatechange = function() {
				if ((http.readyState == 1)||(http.readyState == 2)||(http.readyState == 3)) {
document.getElementById('loader').style.visibility="visible";
		document.getElementById('loader').style.display="block";
		document.getElementById('loader').src="images/loader2.gif";
		}
				if (http.readyState == 4) {
				  if(http.status==200) {
		document.getElementById('loader').style.visibility="hidden";
			  		var results=http.responseText;
					if(redirectPage=="" || results!="1") {
						var temp=id.split("~"); // To display on multiple div 
						var r=results.split("~"); // To display multiple data into the div 
						if(temp.length>1) {
							for(i=0;i<temp.length;i++) {	
								document.getElementById(temp[i]).innerHTML=r[i];
							}
						} else {
		document.getElementById(id).innerHTML = results;
		document.getElementById('show').style.visibility="visible";
						}	
					} else {
						window.location.href=redirectPage;			
					}
				  	
				  } 
  				}
			};
			http.send(null);
		
       }
	   
	   
function check_user(uname) {
myRand=parseInt(Math.random()*99999999);  
url='check_user.php?uname='+uname+'&random='+myRand;
requestInfo(url,'show','check_user.php');
}
	
// JavaScript Document