function check_login(xbut){
var login_user_id = document.getElementById('login_user_id');
var login_password = document.getElementById('login_password');

	if(login_user_id.value == ''){
	login_user_id.focus();
	login_user_id.style.backgroundColor = "#ff8080";
	alert("Please enter a user ID!");
	}else{
		if(login_password.value == ''){
		login_password.focus();
		login_password.style.backgroundColor = "#ff8080";
		alert("Please enter a password!");
		}else{
		verify_login(xbut);
		}
	}
}

function verify_login(xbut){
var login_user_id = document.getElementById('login_user_id');
var login_password = document.getElementById('login_password');

	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		//alert(ajaxRequest.responseText);
		if(ajaxRequest.readyState == 4){
			if(ajaxRequest.responseText == 'VALID_ADMIN'){
			xbut.value = "Logging in...";
			window.location = "admin_home.php";
			}
				if(ajaxRequest.responseText == 'FAIL'){
				xbut.disabled = false;
				alert("Invalid User ID and/or Password!");
					}
		}else{
		xbut.disabled = true;
		}
	}
	var queryString = "?user_id="+login_user_id.value+"&password="+login_password.value;
	ajaxRequest.open("GET", "../ajax/verify_login.php" + queryString, true);
	ajaxRequest.send(null); 
}