var xmlHttp;
var divId;

function serverCall(URL, id) {
	 
	xmlHttp=GetXmlHttpObject();
	divId = id;
	if (xmlHttp==null) {
		alert ("Your browser does not support AJAX!");
	  	return;
	} 
	
	try {
		xmlHttp.onreadystatechange=getPost;
		xmlHttp.open("GET",URL,true);
		xmlHttp.send(null);
	} catch (e) {
		//document.getElementById("blogSpot").innerHTML=xmlHttp.responseText;
		alert(e);
	}
}


function getPost() { 
	/* 
	*	State 	Description 
	*	0 		The request is not initialized 
	*	1 		The request has been set up 
	*	2 		The request has been sent 
	*	3 		The request is in process 
	*	4 		The request is complete
	*
	*	200		HTTP Status Code, is OK 
	*	4xx/5xx	Error Codes
	*/
	if (xmlHttp.readyState==4 && xmlHttp.status==200) { 
		document.getElementById(divId).innerHTML=xmlHttp.responseText;
		
	} else if (xmlHttp.readyState==4 && xmlHttp.status >= 400) {
		document.getElementById(divId).innerHTML="ERROR - "+xmlHttp.status+" "+xmlHttp.statusText;	
		
	} else {
		document.getElementById(divId).innerHTML="LOADING DATA";		
	}
}

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