function checkLoginForm(objForm) {
	var i;
	var fOK=true;
	var fPasswordIsDate = false;
	
	if (objForm.my_x.value != "") {
		var arrDate = objForm.my_x.value.split("/");
		if (arrDate.length == 3) {
			if (objForm.my_x.value.length != 10) {
				fOK = false;
			} else if (arrDate[0].length != 2 || isNaN(parseInt(arrDate[0],10)) || parseInt(arrDate[0],10) < 1 || parseInt(arrDate[0],10) > 31) {
				fOK = false;
			} else if (arrDate[1].length != 2 || isNaN(parseInt(arrDate[1],10)) || parseInt(arrDate[1],10) < 1 || parseInt(arrDate[1],10) > 12) {
				fOK = false;
			} else if (arrDate[2].length != 4 || isNaN(parseInt(arrDate[2],10)) || parseInt(arrDate[2],10) < 1900 || parseInt(arrDate[2],10) > 2100) {
				fOK = false;
			}
			if (fOK == false) {
				alert("Please enter a date in the format dd/mm/yyyy");
				objForm.my_x.focus();
			} else {
				fPasswordIsDate = true;
			}
		}
	}
	if (!fOK) {
		return false;
	}
	if (objForm.my_y.value == "") {
		fOK=false;
		alert("Please enter a user name");
		objForm.my_y.focus();
	} else if (objForm.my_y.value != "" && String(parseInt(objForm.my_y.value)) == String(objForm.my_y.value) && fPasswordIsDate) {
		if (objForm.my_y.value.length > 9) {
			fOK=false;
			alert("A membership number is only ever 9 digits long");
			objForm.my_y.focus();
		} else {
			for (i = (9 - objForm.my_y.value.length); i > 0; i--) {
				objForm.my_y.value = "0" + objForm.my_y.value;
			}
		}
	} else if (objForm.my_x.value=="") {
		fOK=false;
		alert("Please enter your password");
		objForm.my_x.focus();
	} 
	
	return fOK;
}

/*** keep alive ***/
document.write("<script type=\"text/javascript\" src=\"assets/scripts/EdeptiveAjax.js\"></script>");
var goAjax = null;
function keepAlive() {
	var strUrl = "";
	var sTiming = document.documentElement.lastChild.lastChild.innerHTML;
	var sParams = "";

	sTiming = sTiming.substring(5, sTiming.length - 4);
	strUrl = window.location.protocol + "//" + window.location.host + "/webservices/keep_alive.asmx/Ping";
	sParams = "Timing=" + sTiming;
	try {
		goAjax = new EdeptiveAjax();
		goAjax.postRequest(strUrl, sParams, onKeepAliveResponse);
	} catch(e) {
		setTimeout("keepAlive()", 1000*1);
	}
}
function onKeepAliveResponse() {
	if(goAjax.checkReadyState("keepAlive", "ping.", "ping..", "ping...") == "OK") {
		if(document.getElementById("keepAlive")) {
			var response = goAjax.request.responseXML.documentElement;
			document.getElementById("keepAlive").innerText = "sid=" + getText(response.firstChild);
		}
		setTimeout("keepAlive()", 1000*60);
	}
}
setTimeout("keepAlive()", 1000*2);
