		function ajaxLogin()
        {	
			var username = document.getElementById('username').value;
			var password = document.getElementById('password').value;
			
			var postdata = 'username='+username+'&password='+password;
			
			var dataRequest = initXMLHttpClient();
			dataRequest.open("POST","http://skyteach.wku.edu/PHPUtilities/login.php",true);
			dataRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			dataRequest.setRequestHeader("Content-length", postdata.length);
			dataRequest.setRequestHeader("Connection", "close");
			dataRequest.onreadystatechange = function()
			{
				if(dataRequest.readyState == 4)
				{
					if(dataRequest.status == 200)
					{
						//Response has returned, so this will hide the waiting bar if it has popped up.
						//hideWaitIndicator();
						
						//This is the fail condition.
						if(dataRequest.responseText != '')
						{	
							alert(dataRequest.responseText);
						}
						else //Success
						{	
							//replace reloads by page code lookup.
							//remake login button
							//hideBox('loginbox');
							//document.getElementById('logintoggle').onclick = ajaxLogout;
							//document.getElementById('logintoggle').innerHTML = 'LOGOUT';

							document.location.reload();
						}
					}
				}
			}
			//Function will display a waiting bar over the page if a specified amount of time has passed.
			//showWaitIndicator(dataRequest.readyState);
			dataRequest.send(postdata);
		}
		
		function ajaxLogout()
        {	
			var dataRequest = initXMLHttpClient();
			var postdata = '';
			dataRequest.open("POST","http://skyteach.wku.edu/PHPUtilities/logout.php",true);
			dataRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			dataRequest.setRequestHeader("Content-length", postdata.length);
			dataRequest.setRequestHeader("Connection", "close");
			dataRequest.onreadystatechange = function()
			{
				if(dataRequest.readyState == 4)
				{
					if(dataRequest.status == 200)
					{
						//Response has returned, so this will hide the waiting bar if it has popped up.
						//hideWaitIndicator();
						if(dataRequest.responseText != '')
						{	
							alert(dataRequest.responseText);
						}
						else  //success
						{
							//replace reloads by page code lookup.
							//alert('Logout success!');
							//document.getElementById('logintoggle').onclick = shoxBoxAgain;
							//document.getElementById('logintoggle').innerHTML = '&lang;&lang;&nbsp;LOGIN';

							document.location.reload();
						}
					}
				}
			}
			//Function will display a waiting bar over the page if a specified amount of time has passed.
			//showWaitIndicator(dataRequest.readyState);
			dataRequest.send(postdata);
		}
		
		function shoxBoxAgain()
		{
			showBox('loginbox');
		}
		


