
///////////////////////////////////////////////////////////////////////////

var url;
var xmlHttp = createXmlHttpRequestObject();
//global declarations

function getScribd_doc(_params,_child_id)
{
  // alert("ok");
  // $("scribd_content").innerHTML = '<div align="center"><img src="../images/loading.gif" border="0"> </div>';
  document.getElementById("scribd_content").innerHTML = '<div align="center"><img src="http://www.astrovisiononline.com/image/loading.gif" border="0"> </div>';
   url ="indian-astrology/indianastrologyreports/scribdviewer_ajx.php?"+_params+'&sp='+Math.random();
   //alert(url);
   process(); 
}

///////////////////////////////////////////////////////////////////////////
// retrieves the XMLHttpRequest object

function createXmlHttpRequestObject()
{
var reqHttp;
if(window.ActiveXObject)
{
	try
	{
		reqHttp = new ActiveXObject("Microsoft.XMLHTTP");
		
	}
	catch (e)
	{
		reqHttp = false;
	}
}
// if running Mozilla or other browsers
else
{
	try
	{
		reqHttp = new XMLHttpRequest();
		
	}
	catch (e)
	{
		reqHttp = false;
	}
}
if (!reqHttp)
	alert("Error creating the XMLHttpRequest object.");
else
	return reqHttp;
}
//////////////////////////////////////////////////////////////////////

function process()
{
// proceed only if the xmlHttp object isn't busy

	if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0)
	{
		xmlHttp.open("GET",url,true);
		xmlHttp.onreadystatechange = handleServerResponse;
		xmlHttp.send(null);
	
	}
	else
	{
// if the connection is busy, try again after one second
 		t = setTimeout('process()', 1000);
	}
}
// executed automatically when a message is received from the server
function handleServerResponse()
{
	if (xmlHttp.readyState == 4)
	{
// status of 200 indicates the transaction completed successfully
		if (xmlHttp.status == 200)
		{
		
			//xmlResponse = xmlHttp.responseText;
			//xmlDocumentElement = xmlResponse.documentElement;
			_data =  xmlHttp.responseText;
		 
		   
		  //$("scribd_content").innerHTML = _data ;
		  document.getElementById("scribd_content").innerHTML =_data ;
		}
// a HTTP status different than 200 signals an error
	}
	else
	{
		//t = setTimeout('handleServerResponse()', 1000);
		// alert("There was a problem accessing the server: " + xmlHttp.statusText);
	}
}

////////////////////////////////////////////////////

/*
var XMLHttpFactories = [
	function () {return new XMLHttpRequest()},
	function () {return new ActiveXObject("Msxml2.XMLHTTP")},
	function () {return new ActiveXObject("Msxml3.XMLHTTP")},
	function () {return new ActiveXObject("Microsoft.XMLHTTP")}
];

function createXMLHTTPObject()
{
	var xmlhttp = false;
	for (var i=0;i<XMLHttpFactories.length;i++)
	{
		try {
			xmlhttp = XMLHttpFactories[i]();
		}
		catch (e) {
			continue;
		}
		break;
	}
	return xmlhttp;
}
*/

 