// JavaScript Document
<!-- 
//Browser Support Code
function ajaxFunction()
{
	//add something to varify input
	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;
			}
		}
	}
	var url = "http://www.crossfitwestpalmbeach.com/scripts/checklogin.php";
	var params = "myusername=";
	var pWord = document.getElementById('mypassword');
	params += document.getElementById('myusername').value;
	params += "&mypassword=";
	params += document.getElementById('mypassword').value;
	ajaxRequest.open("POST", url, true);

	//Send the proper header information along with the request
	ajaxRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	ajaxRequest.setRequestHeader("Content-length", params.length);
	ajaxRequest.setRequestHeader("Connection", "close");

	ajaxRequest.onreadystatechange = function() //Call a function when the state changes.
	{
		if(ajaxRequest.readyState == 4 && ajaxRequest.status == 200) 
		{
			if (ajaxRequest.responseText.length == 2)
			{
				window.location = "admin/admin.php";
			}
			else 
			{
				pWord.value = '';
				alert(ajaxRequest.responseText);
				pWord.focus();
			}
		}
	}
	ajaxRequest.send(params);
}