var IE = document.all;
var SF = navigator.vendor;

function sizeTable(reduceHeight, isHome)
{
	var extraHeight = 0;
	if (IE)
		extraHeight = 10;
	else if (SF)
		extraHeight = 20;

	var dim = getScreenDimensions(window);
	var x = document.getElementById("contentCell");
	var newHeight = (dim.availHeight - reduceHeight - extraHeight);
	
	if (newHeight >= 0)
	{
		x.style.height = newHeight + "px";
	
		if (!isHome)
			document.getElementById("contentDiv").style.height = newHeight + "px";
	}
}

function onLoadForm(widget)
{
	widget.addEventListener("submitted", function()
	{
		widget.showStatistics();
	});
}

function checkLogin()
{
	var userField = document.getElementById("username");
	var pwField = document.getElementById("password");
	var regX = new RegExp(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*\.(\w{2}|(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum))$/);
	var msg = "";
	if (!regX.test(userField.value))
	{
		msg += "Vul a.u.b. een geldig e-mailadres in.\n\r";
	}
	if (pwField.value == "")
	{
		msg += "Vul a.u.b. uw wachtwoord in.";
	}
	
	if (msg != "")
	{
		window.alert(msg);
		return false;
	}
	
	return true;
}