
///////////////////////////////////////////////////////////////////////////
var _scribdsrc='http://www.indianastrologysoftware.com/scribd/scribd_doc_ajax.php?';
var _dataSrc  ='http://www.indianastrologysoftware.com/payment/iasDbExtractPage.php';
var _dataSrc1  ='http://www.indianastrologysoftware.com/payment/iasDbExtractPageForSales.php'; //anitha

var url;
var xmlHttp = createXmlHttpRequestObject();
//global declarations

function getScribd_doc(_params,_child_id)
{
	
	url = _scribdsrc+_params;
	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; 
		  document.getElementById("scribd_content").innerHTML = _data ;
  		  return;
		  //document.getElementById("scribd_content").focus();
		}
// a HTTP status different than 200 signals an error
	}
	else
	{
		t = setTimeout('handleServerResponse()', 1000);
		// alert("There was a problem accessing the server: " + xmlHttp.statusText);
	}
}

/*- ---------------------------------------------------------------------------------
					SERVER DATA RETRIEVAL AJAX
- ----------------------------------------------------------------------------------*/

function recieveServerData(_params)
{
	url = _dataSrc+_params;
	document.getElementById("loading").style.display = "block";
	getClientDataSet(); 
}
function recieveServerDataSales(_params) //anitha
{
	url = _dataSrc1+_params;
	document.getElementById("loading").style.display = "block";
	getClientDataSet(); 
}
function getClientDataSet()
{
// proceed only if the xmlHttp object isn't busy
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0)
	{
		
		xmlHttp.open("GET",url,true);
		xmlHttp.onreadystatechange = setDataSet;
		xmlHttp.send(null);
		return;
	}
	else
	{
// if the connection is busy, try again after one second
 		//t = setTimeout('getClientDataSet()', 1000);
	}
}

function setDataSet()
{
	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;
		  // alert(_data);
	 document.getElementById("data_grid").innerHTML = _data;
		 document.getElementById("loading").style.display = "none";
		 return;
		}
// a HTTP status different than 200 signals an error
	}
	else
	{
		//t = setTimeout('setDataSet()', 1000);
		// alert("There was a problem accessing the server: " + xmlHttp.statusText);
	}
}
function showeditform(orderid,name,amount,closedate,status,remarks)//orderid,name,amount,closeddate,status)
{
window.open("editdetails.php?id="+orderid+"&name="+name+"&amt="+amount+"&date="+closedate+"&status="+status+"&remark="+remarks,
  "QuotationDetails",'resizable=yes,width=350,height=500');
}
function showSalesTransHistory(oid)
{
 _url = "http://www.indianastrologysoftware.com/payment/salesHistoryPopup.php?id="+oid;
 window.open(_url,"SalesHistory","location=0,resizable=0,width=615,height=400");
}
function showDuplicateEmail(eid)	//will display the list of same emails 
{
 _url = "http://www.indianastrologysoftware.com/payment/salesDuplicatePopup.php?eid="+eid;
 window.open(_url,"DuplicateList","location=0,resizable=yes,scrollbars=1,width=1000,height=500");
}

