
// holds an instance of XMLHttpRequest
var xmlHttp_level = createXmlHttpRequestObject();
// creates an XMLHttpRequest instance
function createXmlHttpRequestObject()
{
// will store the reference to the XMLHttpRequest object
var xmlHttp_level;
// this should work for all browsers except IE6 and older
try
{
// try to create xmlHttp_levelRequest object
xmlHttp_level = new XMLHttpRequest();
}
catch(e)
{
// assume IE6 or older
try
{
xmlHttp_level = new ActiveXObject("Microsoft.XMLHttp");
}
catch(e) { }
}
// return the created object or display an error message
if (!xmlHttp_level)
alert("Error creating the XMLHttpRequest object.");
else
return xmlHttp_level;
}
	// called to read a file from the server
	
	function load_level(UserName,Password,WPPath)
	{
			
		
		var url = WPPath+"/login.php?UserName="+UserName+"&Password="+Password;
			
		
		if (xmlHttp_level)
		{
		// try to connect to the server
			try
			{
			
			xmlHttp_level.open("POST", url, true);
			xmlHttp_level.onreadystatechange = handleRequestStateChange_level;
			xmlHttp_level.send(null);
			}
			// display the error in case of failure
			catch (e)
			{
			alert("Can't connect to server:\n" + e.toString());
			}
		}

	
	}
	
	
	// function that handles the HTTP response
	function handleRequestStateChange_level()
	{
		  
		  //alert(MainLuId.innerHTML);
		
	if (xmlHttp_level.readyState == 1)
	{
		//loader.style.display = "block";
		//sport.innerHTML ="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src ='images/ajax-loader(2).gif' />";
		//document.getElementById("default_tab").style.display="block";

	}/*
	else if (xmlHttp_level.readyState == 2)
	{
	myDiv.innerHTML += "Request status: 2 (loaded) <br/>";
	}
	else if (xmlHttp_level.readyState == 3)
	{
	myDiv.innerHTML += "Request status: 3 (interactive) <br/>";
	}
	// when readyState is 4, we also read the server response
	*/
	else if (xmlHttp_level.readyState == 4)
	{
		// continue only if HTTP status is "OK"
	
		if (xmlHttp_level.status == 200)
		{
				
			try
			{
			//	loader.style.display = "none";
				response_level = xmlHttp_level.responseText;
				//response_level= "ø";
				response_level=response_level.replace(/^\s+|\s+$/g,"");
				if (response_level=="Yes")
					{
					  window.location ='http://seaboardconst.com/?page_id=1453';
					}
					else
					{
						alert('Please enter a valid user name and password');
						
						}

				
			}
			catch(e)
			{
			// display error message
				alert("Error reading the response: " + e.toString());
			}
		}
		else
		{
			// display status message
		alert("There was a problem retrieving the data:\n" +
		xmlHttp_level.statusText);
		}
		
	}
}


