
function testInput(formName)
{
	var oEmail = eval("document." + formName + ".Email")
	var NoBlanks = true
	if (oEmail.value>"" && NoBlanks)
	{
		if(!checkEmail(oEmail.value))
		{
			oEmail.focus();
			NoBlanks = false;
		}
	}else{
		NoBlanks = false;
		alert("Please enter a valid Email address.")
		oEmail.focus();
	}
	return NoBlanks
}

function checkEmail(vInput)
{
	var Correct = true;
	CharCount=1;
	strLength=vInput.length;
	// look for @
	while ((CharCount < strLength) && (vInput.charAt(CharCount) != "@"))
	{
		CharCount++
	}

	if ((CharCount>= strLength) || (vInput.charAt(CharCount) != "@")) 
	{ 
		alert ("Not a valid email address - must contain '@' with characters on either side")
		Correct = false;
	}   
	else
	{
		CharCount += 2;
	}

	// look for .
	while ((CharCount < strLength) && (vInput.charAt(CharCount) != "."))
	{
		CharCount++
	}

	// there must be at least one character after the .
	if ((CharCount>= strLength - 1) || (vInput.charAt(CharCount) != ".")) 
	{ 
		alert ("Not a valid email address: must have a '.' with at least 1 character after it")
		Correct = false;
	}
	return Correct
}
	
	
function toggleSubmenu(submenuName) {

	var submenu;
	
	if(document.all)
		submenu = eval('document.all.' + submenuName)
    else if(document.getElementById)
		submenu = eval('document.getElementById(submenuName)')	

    if ( submenu.style.visibility == 'visible' ) {
        submenu.style.visibility = 'hidden';
        submenu.style.display = 'none';       
    }
    else {
        submenu.style.visibility = 'visible';
        submenu.style.display = 'block';           
    }
}	

function hideSubmenu(submenuName) {

	var submenu;
	
	if(document.all)
		submenu = eval('document.all.' + submenuName)
    else if(document.getElementById)
		submenu = eval('document.getElementById(submenuName)')	

	submenu.style.visibility = 'hidden';
	submenu.style.display = 'none';       
}	