// JavaScript Document

function popWin (location,title,ih,iw) 
{
  var h = ih + 230;
  var w = iw + 100;
  
  if(h<350)
    h = 350;
  if(w<350)
    w = 350;
  
  window.open(location,'TMH','left=20,top=20,width='+w+',height='+h+',toolbar=0,resizable=0');
  return true;
}



function emailChecker(from)
{
  var blank_name = '';
  var blank_msg = '';
  var error = '';
  var flag=0;
  addy = document[from].visitormail.value;
  AtPos = addy.indexOf("@");
  StopPos = addy.lastIndexOf(".");

  name=document[from].visitor.value;
  if(name=="")
    blank_name="Please include your name." + "\n";
	
  message=document[from].notes.value;
  if(message=="")
    blank_msg="Please include a message to send." + "\n";

  if (addy=="")  flag=1;
  if (AtPos == -1 || StopPos == -1)  flag=1;
  if (StopPos < AtPos)   flag=1; 
  if (StopPos - AtPos == 1)  flag=1;
  
  if(flag==1)
    error =  "Please include a valid email address." + "\n" ;
    
  
  if(blank_name!="" || blank_msg!="" || error!="")
    alert(blank_name + error + blank_msg);
  else
    {
		document[from].submit();
	}
} 
 
