var pmenu = "off";
var l, t, w, h, lt, lw;
lw = 0; w = 0;
var cur_td = 0;

function init() {
	if (window.innerHeight) {
		document.getElementById("txtWidth").value = .96 * window.innerWidth;
		document.getElementById("txtSize").value = .94 * window.innerHeight - findPosY(document.getElementById("divMain"));
	}
	else {
		document.getElementById("divMain").height = .80 * screen.availHeight - findPosY(document.getElementById("divMain"));
		document.getElementById("frmMain").height = .80 * screen.availHeight - findPosY(document.getElementById("frmMain"));
		document.getElementById("txtSize").value = document.getElementById("divMain").height;
		document.getElementById("txtWidth").value = .96 * screen.availWidth;
	}
	
	if (isSafari) {
		document.getElementById("divMain").style.top = '160px';
		document.getElementById("frmMain").style.top = '160px';
		document.getElementById("divMain").height = .94 * window.innerHeight - findPosY(document.getElementById("divMain"));
		document.getElementById("frmMain").height = .94 * window.innerHeight - findPosY(document.getElementById("frmMain"));
		document.getElementById("txtSize").value = document.getElementById("divMain").height;
		document.getElementById("txtWidth").value = .96 * window.innerWidth;
	}

	if (document.getElementById("txtInvalid").value == 1) {
		alert("Invalid login details.  Please try again.");
	}
	
	if (document.getElementById("txtInvalid").value == 2) {
		alert("You have been blacklisted. You may not log in!");
	}

	if (document.addEventListener) {
//alert('addevent');
		//document.addEventListener("scroll", setScroll, true);
		document.addEventListener("keypress", setScroll, false);
		document.addEventListener("click", setScroll, false);
	} else if (document.attachEvent) {
		document.attachEvent("onscroll", setScroll);
		document.attachEvent("onkeypress", setScroll);
		document.attachEvent("onclick", setScroll);
	}

	

	setMainDiv();
}

function forgotPassword() {
	var obj = document.getElementById("txtLogin_");
	var url_nm = "../cgi-bin/forgot_login.cgi?txtLogin=" + obj.value;	
	if (obj.value == "")
		alert("Please enter your user name.\nYour password will then be emailed to the email account associated with this user name...");
	else {
		var str = getLoginPword("_");	// Return login and password
		conn.setRespHandler('root', handlePword, 0);
		conn.request("../cgi-bin/forgot_login_aj.cgi", "POST", str, true, 0);
	}
}


// AJAX handlers!!!!

function handlePword(element) {
	try {
		alert(element.getElementsByTagName("err")[0].firstChild.nodeValue);
	} catch (e) {}
}

