function companyLogin()
{
	
	var username=document.getElementById('username').value;
	var password=document.getElementById('password').value;	
		
	login_xmlHttp=LoginGetXmlHttpObject()
	if (login_xmlHttp==null)
  	{
  		alert ("Your browser does not support AJAX!");
  		return;
  	} 
  
  		var url="../includes/ajax/company_login.php";
		url=url+"?username="+username;
		url=url+"&password="+password;
		url=url+"&sid="+Math.random();
		login_xmlHttp.onreadystatechange=LoginStateChanged;
		login_xmlHttp.open("GET",url,true);
		login_xmlHttp.send(null);
 }
 
function LoginStateChanged() 
{ 
	if (login_xmlHttp.readyState==4)
	{ 
		var login_response=login_xmlHttp.responseText;
		if(login_response!=0)
		{
			document.getElementById('cid').value=login_response;
			showRegistration(login_response);		
		}
		else
		{
		document.getElementById('login_message').innerHTML="<font color='red'>Invalid Username OR Password!</font>";
		}
		
	}
}
 

function LoginGetXmlHttpObject()
{
	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;
}
