
///////////////////////////////////////////////////////////////////////////

var url,zsign;
var xmlHttpSunSignDaily,xmlHttpSunSignWeekly;
var xmlHttpMoonSignDaily,xmlHttpMoonSignWeekly;
//global declarations


function getsunsignprediction(Zsign,_params,fscope)
{
  
   //zsign=Zsign;
   pagename=zsign.toLowerCase()+"-sign.php"
   url=pagename+'?RequestType=Short&'+_params;
   
  if (fscope=='Daily')
    process('sunsign-daily');
  
  else if (fscope=='Weekly')
  	process('sunsign-weekly');
    
}


function getmoonsignprediction(Zsign,_params,fscope)
{
  
  //zsign=Zsign;
  pagename="rashi-prediction.php"
  url=pagename+'?RequestType=Short&'+_params;
  //alert(fscope+url);
  if (fscope=="Daily")
  	process('moonsign-daily'); 
  else if (fscope=="Weekly") 
    process('moonsign-weekly'); 
}



///////////////////////////////////////////////////////////////////////////
// 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(sType)
{
    //alert('inside process'+sType);
	
	if ( sType=='sunsign-daily')
	{
		xmlHttpSunSignDaily = createXmlHttpRequestObject();
		// proceed only if the xmlHttp object isn't busy

		if (xmlHttpSunSignDaily.readyState == 4 || xmlHttpSunSignDaily.readyState == 0)
		{
			xmlHttpSunSignDaily.open("GET",url,true);
			
			xmlHttpSunSignDaily.onreadystatechange = handleServerResponseForSunSignDaily;
			xmlHttpSunSignDaily.send(null);
	
		}
		else
		{
		// if the connection is busy, try again after one second
 		t = setTimeout('process()', 1000);
		}
	}


		if ( sType=='sunsign-weekly')
	    {
			xmlHttpSunSignWeekly = createXmlHttpRequestObject();
			// proceed only if the xmlHttp object isn't busy
			//alert('inside process');
			if (xmlHttpSunSignWeekly.readyState == 4 || xmlHttpSunSignWeekly.readyState == 0)
			{
			xmlHttpSunSignWeekly.open("GET",url,true);
			
			xmlHttpSunSignWeekly.onreadystatechange = handleServerResponseForSunSignWeekly;
			xmlHttpSunSignWeekly.send(null);
	
			}
			else
			{
			// if the connection is busy, try again after one second
 			t = setTimeout('process()', 1000);
			}
		}


	
	
	
	
	
	else if ( sType=='moonsign-daily')
	{
		xmlHttpMoonSignDaily = createXmlHttpRequestObject();
		// proceed only if the xmlHttp object isn't busy

		if (xmlHttpMoonSignDaily.readyState == 4 || xmlHttpMoonSignDaily.readyState == 0)
		{
		xmlHttpMoonSignDaily.open("GET",url,true);
		
		xmlHttpMoonSignDaily.onreadystatechange = handleServerResponseForMoonSignDaily;
		xmlHttpMoonSignDaily.send(null);
	
		}
		else
		{
		// if the connection is busy, try again after one second
 		t = setTimeout('process()', 1000);
		}
	}


	else if ( sType=='moonsign-weekly')
	    {
			xmlHttpMoonSignWeekly = createXmlHttpRequestObject();
			// proceed only if the xmlHttp object isn't busy
			//alert('inside process');
			if (xmlHttpMoonSignWeekly.readyState == 4 || xmlHttpMoonSignWeekly.readyState == 0)
			{
			xmlHttpMoonSignWeekly.open("GET",url,true);
			
			xmlHttpMoonSignWeekly.onreadystatechange = handleServerResponseForMoonSignWeekly;
			xmlHttpMoonSignWeekly.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 handleServerResponseForMoonSignDaily()
{
	//alert('handle');
	
				if (xmlHttpMoonSignDaily.readyState == 4)
	            {
                  // status of 200 indicates the transaction completed successfully
		                 if (xmlHttpMoonSignDaily.status == 200)
		                   {
		
			                       _dataMoonSignDaily='<b class="fnt14">'+GetStarName(document.getElementById("dRasi").value,'Indian')+' :</b>' ;
			                       _dataMoonSignDaily =  _dataMoonSignDaily + xmlHttpMoonSignDaily.responseText;
	    	                        document.getElementById("moonsigndaily").innerHTML  = _dataMoonSignDaily;
									
		                    }
                            // a HTTP status different than 200 signals an error
	             }
	             else
	           {
		                     document.getElementById("moonsigndaily").innerHTML  = '' ;
	           }
	
 }
 
 function handleServerResponseForMoonSignWeekly()
{
	//alert('handle');
	
				if (xmlHttpMoonSignWeekly.readyState == 4)
	            {
                  // status of 200 indicates the transaction completed successfully
		                 if (xmlHttpMoonSignWeekly.status == 200)
		                   {
									//alert('inside handle');
			                       _dataMoonSignWeekly='<b class="fnt14">'+GetStarName(document.getElementById("wRasi").value,'Indian')+' :</b>' ;
			                       _dataMoonSignWeekly =  _dataMoonSignWeekly + xmlHttpMoonSignWeekly.responseText;
	    	                        document.getElementById("moonsignweekly").innerHTML  = _dataMoonSignWeekly;
									//alert(_dataMoonSignWeekly);
		                    }
                            // a HTTP status different than 200 signals an error
	             }
	             else
	           {
		                     document.getElementById("moonsignweekly").innerHTML  = '' ;
	           }
	
 }


function handleServerResponseForSunSignDaily()
{
	//alert('handle');
	
				if (xmlHttpSunSignDaily.readyState == 4)
	            {
                  // status of 200 indicates the transaction completed successfully
		                 if (xmlHttpSunSignDaily.status == 200)
		                   {
		
			                       _dataSunSignDaily='<b class="fnt14">'+GetStarName(document.getElementById("dZodiac").value,'Western')+' :</b>' ;
			                       _dataSunSignDaily =  _dataSunSignDaily + xmlHttpSunSignDaily.responseText;
	    	                        document.getElementById("sunsigndaily").innerHTML  = _dataSunSignDaily;
									
		                    }
                            // a HTTP status different than 200 signals an error
	             }
	             else
	           {
		                     document.getElementById("sunsigndaily").innerHTML  = '' ;
	           }
	
 }
 
 function handleServerResponseForSunSignWeekly()
{
	//alert('handle');
	
				if (xmlHttpSunSignWeekly.readyState == 4)
	            {
                  // status of 200 indicates the transaction completed successfully
		                 if (xmlHttpSunSignWeekly.status == 200)
		                   {
									//alert('inside handle');
			                       _dataSunSignWeekly='<b class="fnt14">'+GetStarName(document.getElementById("wZodiac").value,'Western')+' :</b>' ;
			                       _dataSunSignWeekly =  _dataSunSignWeekly + xmlHttpSunSignWeekly.responseText;
	    	                        document.getElementById("sunsignweekly").innerHTML  = _dataSunSignWeekly;
									//alert(_dataSunSignWeekly);
		                    }
                            // a HTTP status different than 200 signals an error
	             }
	             else
	           {
		                     document.getElementById("sunsignweekly").innerHTML  = '' ;
	           }
	
 }


