// ------------------------------------------------------------------------------
// Copyright 2007 (c) BIZAMAJIG
// Version: 2.3.1.0
// ------------------------------------------------------------------------------

// javascript Document
<!--
var http_request__login_form = false;
var Get_http_response;
function bzmjg__authenticate_user(url) {
	
//
//	RAS
//	Unable to read document.LoginForm from Sliding Login Panel, so using forms[0] below.
//
//	var params = "?username="+document.LoginForm.username.value +"&password_text="+document.LoginForm.password_text.value;
//	url = url + "?username="+document.LoginForm.username.value +"&password_text="+document.LoginForm.password_text.value;

//	var params = "?username="+document.forms[0].username.value +"&password_text="+document.forms[0].password_text.value;
	url = url + "?username="+document.forms[0].username.value +"&password_text="+document.forms[0].password_text.value;

	http_request__login_form = false;

	if (window.XMLHttpRequest) { // Mozilla, Safari,...
		http_request__login_form = new XMLHttpRequest();
		if (http_request__login_form.overrideMimeType) {
			http_request__login_form.overrideMimeType('text/xml');
			}
		} else if (window.ActiveXObject) { // IE
			try {
				http_request__login_form = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
			try {
				http_request__login_form = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}

	if (!http_request__login_form) {
		alert("Cannot create an XMLHTTP instance");
		return false;
	}

	http_request__login_form.onreadystatechange = alertContents;
	http_request__login_form.open('POST', url, true);
//
//	RAS
//	HTTP 411 ERROR:
//	We first thought we would send the proper header information along with the request
//	to avoid the 411 error.  Using code that is commented out below, remains for reference.
//
//	http_request__login_form.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
//	http.setRequestHeader("Content-length", params.length);
//	http.setRequestHeader("Connection", "close");
//	http_request__login_form.send(url);
//
//	The solution to the 411 error is simply to send('');
//
	http_request__login_form.send(''); 

}

function alertContents() {

	if (http_request__login_form.readyState == 4) {
		if (http_request__login_form.status == 200) {
			Get_http_response=http_request__login_form.responseText;
			if (Get_http_response=="0"){
//				document.write(http_request__login_form.responseText);
				document.all.myerror.style.display="inline";
				document.all.signinsuccessful.style.display="none";
			} else if (Get_http_response!="0"){
				document.all.myerror.style.display="none";
				document.all.signinsuccessful.style.display="inline";
				document.location.href=Get_http_response;
			}
		} else {
			alert("Loading page.  Please wait... \n" + http_request__login_form.statusText);
		}
	}
}
//-->

