﻿
 function openFlagBox(flag, page)
{
    box = document.getElementById(flag);
	if (box.className == "translate_box")
		box.className = "translate_box_open_" + page;
}

function closeFlagBox(flag, page) 
{
    box = document.getElementById(flag);
	if (box.className == "translate_box_open_" + page)
		box.className = "translate_box";
}

function myRoanoke(email)
{

address = document.getElementById(email);
if (validateEmail(address)) {
	window.location='./WebConfirmEntry?OpenAgent&N=Y&E=' + address;
}

} 

function validateEmail(f)
{
	eMailError = "";
	if (f.value == "")	{
		eMailError = "Please enter your e-mail address."; }
	invalidChars = " /:,;&+$#%^*!";
	for (i = 0; i < invalidChars.length; i++) {
		badChar = invalidChars.charAt(i);
		if (f.value.indexOf(badChar,0) > -1) {
			eMailError ="Please enter a valid e-mail address.";
			 }  }
	atPos = f.value.indexOf("@",1);
	if (atPos == -1) 	{
		eMailError ="Please enter a valid e-mail address."; }
	if (f.value.indexOf("@", atPos+1) > -1) {
		eMailError ="Please enter a valid e-mail address."; }
	periodPos = f.value.indexOf(".", atPos)
	if (periodPos+3 > f.value.length) 
	{
		eMailError ="Please enter a valid e-mail address."; 
	}
	if (periodPos == -1) 
	{ 			
		eMailError ="Please enter a valid e-mail address."; 
	}
	if (!eMailError == "") 
	{
		alert (eMailError);
		f.focus();
		f.select();
		return false; 
	}  
		
		return true;
		
}

function disableEnterKey(e)
{
     var key;      
     if(window.event)
          key = window.event.keyCode; 
     else
          key = e.which;     

     if (key == 13)
     {
        event.returnValue=false;
        event.cancel = true;
     }
     return true;
        
}
