//Validates Email	
function validEmail(item)
{  	
   	invalidChars = " /:,;";
	var invalid = ""
   	email = item.value;      

   	if (email)
   	{                          
      
   	for (i=0; i<invalidChars.length; i++)
   	{  
      	badChar = invalidChars.charAt(i)
      	if (email.indexOf(badChar,0) > -1)
      	{
         		invalid = "Yes"
      	}
   	}
 
   	atPos = email.indexOf("@",1)   
   	if (atPos == -1) 
   	{
      	invalid = "Yes"
   	}
 
   	if (email.indexOf("@",atPos+1) != -1) 
   	{    
      	invalid = "Yes"
   	}
  
   	periodPos = email.indexOf(".", atPos)
   	if (periodPos == -1) 
   	{                      
        invalid = "Yes"
   	}

   	if (periodPos+3 > email.length) 
   	{
        invalid = "Yes" 
   	}   
   		
   	if (invalid=="Yes") 
	{		
		alert ("Sorry, your email address is not valid");
		item.focus();	
		item.select();			 		 	
	}	
	}	
} 
//validate form
function valForm(errors,form)
{
	if (errors == "")
	{
		
		form.submit();
	}
	else
	{
		alert('Please fill in the following field(s) \n' + errors);
	}
}
//Check Field for Blanks
function blankField(form,msg)
{
	var field = eval(form);
	if(!field.value)
	{
		return('*'+msg+'\n');
	}
	else
	{
		return("");
	}
}
function ShowHide(item,div)
{
	
	form=document.forms[0];
	if(item == "show")
	{
		document.getElementById(div).style.display = 'block';
	}
	if(item == "hide")
	{
		document.getElementById(div).style.display = 'none';
	}
}