function getHTTPObject()
{
	var xmlHttp;
	try
  	{  // Firefox, Opera 8.0+, Safari  
		xmlHttp=new XMLHttpRequest();  
	}
	catch (e)
  	{  // Internet Explorer  
  		try
    	{    
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");    
		}
  		catch (e)
    	{    
			try
      		{      
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");      
			}
    		catch (e)
      		{      
				alert("Your browser does not support AJAX!");      
	  			return false;      
			}
		}  		
	}  
	return xmlHttp;
}
	  
/*function listApplicants(url)
{
	document.getElementById( 'central_body' ).innerHTML = 'loading...'
	url = url + "&sid=" + Math.random()
	
	var http = getHTTPObject()
	http.open( "GET", url, true ) 
	http.onreadystatechange = function()
	{
		if( http.readyState == 4  )
			document.getElementById( 'central_body' ).innerHTML = http.responseText
	}
	http.send( null )
}

/*function detailJobs(url)
{
	document.getElementById( 'central_body' ).innerHTML = 'loading...'
	url = url + "&sid=" + Math.random()
	
	var http = getHTTPObject()
	http.open( "GET", url, true ) 
	http.onreadystatechange = function()
	{
		if( http.readyState == 4  )
			document.getElementById( 'central_body' ).innerHTML = http.responseText
	}
	http.send( null )
}

/*function jobs(url)
{
	document.getElementById( 'central_body' ).innerHTML = 'loading...'
	url = url + "&sid=" + Math.random()
	
	var http = getHTTPObject()
	http.open( "GET", url, true ) 
	http.onreadystatechange = function()
	{
		if( http.readyState == 4  )
			document.getElementById( 'central_body' ).innerHTML = http.responseText
	}
	http.send( null )
}
*/

function login()
{
	var username = document.getElementById( 'username' ).value
	var password = document.getElementById( 'l_password' ).value
	if(username.value=='')
	{
		alert("Please Input User Name");
		return false
	}
	if(password.value=='')
	{
	alert("Please Input Correct Password");
	return false
		}
document.getElementById( 'login' ).innerHTML = '<i>connecting...</i>'

	
	var url = "login.php?username=" + username + "&password=" + password + "&login_mode=login" + "&sid=" + Math.random()
	
	var http = getHTTPObject()
	http.open( "GET", url, true ) 
	http.onreadystatechange = function()
	{
		if( http.readyState == 4 && http.status == 200 )
		{
						
			if( http.responseText == "1" )
			{
				//alert( 'its ok' )
				window.location = "login.php?login_mode=select"
			}
			else
			{
				document.getElementById( 'login_error' ).innerHTML = '<font color="red">username or password <i>error</i></font>'
				document.getElementById( 'login' ).innerHTML = "<b>Sign In</b><img src='images/bullet2.gif' onclick='login()' value='Login' />"
			}
		}
	}
	http.send( null )
}
