
///////////////////////////////////////////////////////////////////////////

var url;
var xmlHttpreg = createXmlHttpRequestObject();
//global declarations

function checkRegistration(_params)
{
   url = 'http://www.clickastro.com/common/avregcheck4article.php?'+_params;
  //url = 'avregistercheck.php?'+_params;
   processreg(); 
}

///////////////////////////////////////////////////////////////////////////
// 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 processreg()
{
// proceed only if the xmlHttp object isn't busy

	if (xmlHttpreg.readyState == 4 || xmlHttpreg.readyState == 0)
	{
		xmlHttpreg.open("GET",url,true);
		xmlHttpreg.onreadystatechange = handleServerResponsereg;
		xmlHttpreg.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 handleServerResponsereg()
{
	if (xmlHttpreg.readyState == 4)
	{
// status of 200 indicates the transaction completed successfully
		if (xmlHttpreg.status == 200)
		{		
			_data=xmlHttpreg.responseText;
		  if ( xmlHttpreg.responseText =='REGISTRATIONOK')
			{
		    showhide('d1');
			showhide('uiTabsParent');
			 document.getElementById('regloginout').innerHTML = "<a href=\"#\"><img src=\"http://www.clickastro.com/image/btn-logout.gif\" width=\"138\" height=\"29\" border=\"0\" alt=\"Logout\" onclick=\"logout('http://www.clickastro.com/');\"></a>";
			}
		 else
			{
		   document.getElementById('regerrmsg').innerHTML=_data;
		  // alert(document.getElementById('regloginout').innerHTML);
		  
			}		   
		   
		   
		 
		}
// a HTTP status different than 200 signals an error
	}
	else
	{
		//t = setTimeout('handleServerResponse()', 1000);
		// alert("There was a problem accessing the server: " + xmlHttp.statusText);
	}
}

////////////////////////////////////////////////////


