/*
function PopUp(sDocument, width, height)
{
	var x, y, win;

	x = (screen.width - width - 22)/2 - 100;
	y = (screen.height - height)/2 - 100;
	
	win = window.open(sDocument, "PopUp", "width=" + width + ",height=" + height + ",toolbar=0,menubar=0,scrollbars=0,resizable=0,location=0,directories=0,status=0,left=" + x + ",top=" + y);
}
*/


function OpenNewWindow(sDocument, width, height)
{
	var x, y, win;

	x = (screen.width - width - 22)/2 - 100;
	y = (screen.height - height)/2 - 100;
	
	win = window.open(sDocument, "PopUp", "width=" + width + ",height=" + height + ",toolbar=0,menubar=0,scrollbars=1,resizable=1,location=0,directories=0,status=0,left=" + x + ",top=" + y);
}

function bValidLoginForm(frm)
{
	if(!bValidEmailAddress(frm.username.value))
	{
		alert("Please enter a valid username.");
		return false;
	}


	if(frm.password.value == "")
	{
		alert("Please enter your password.");
		return false;
	}
	return true;
}

function bValidEmail(frm)
{

	if(!bValidEmailAddress(frm.email.value))
	{
		alert("Please enter a valid e-mail address.");
		return false;
	}
	else
	{
		alert("Please wait a few momemts while your password is being sent to you.");
		return true;
	}
}

function bValidEmailAddress(sEmail)
{
	return sEmail.search(/\S+@\S+\.\S+/) != -1;
}

function goPortal(oList)
{
	OpenNewWindow('portal.asp?url=' + oList.options[oList.selectedIndex].value, 800, 600);

	return;
}

function PortalScript(sParams)
{
	OpenNewWindow('http://www.unitynetwork.com:9005/scripts/api.pl?' + sParams, 400, 400);
	return;
}