// JavaScript Document


function noRightClick() {
if (event.button==2) {
alert('Sorry! The \'Right Click\' option has been disabled!')
}
}
document.onmousedown=noRightClick


function checkcontact ( contact )
{
    // ** START **
	
//Validates fname Textbox for an entry
if (contact.fname.value == "") {
        alert( "Please enter your First Name" );
        contact.fname.focus();
        return false ;
    }

//Validates lname Textbox for an entry
if (contact.lname.value == "") {
        alert( "Please enter your Last Name" );
        contact.lname.focus();
        return false ;
    }
	
//Validates address Textbox for an entry
if (contact.address.value == "") {
        alert( "Please enter your Street Address" );
        contact.address.focus();
        return false ;
    }
	
//Validates city Textbox for an entry
if (contact.city.value == "") {
        alert( "Please enter your City" );
        contact.city.focus();
        return false ;
    }
	
//Validates state Textbox for an entry
//if (contact.state.value == "") {
//        alert( "Please enter your State" );
//        contact.state.focus();
//        return false ;
//    }
	
//Validates zip Textbox for an entry
if (contact.zip.value == "") {
        alert( "Please enter your Zip Code\nAnd don\'t forget to enter your State" );
        contact.zip.focus();
        return false ;
    }
	
//Validates an Email Address Textbox
	if (contact.email.value == "")
	{
	    alert("Please enter your email address.");
		contact.email.focus();
		return (false);
	}			
 			
	var teststr = (contact.email.value);
  	var iserr=false;
	if (!teststr=='')
	{ 
	  // there must be >= 1 character before @, so we
	  // start looking at character position 1 
	  // (i.e. second character)
	var i = 1;
	var sLength = teststr.length;
	  // look for @
	while ((i < sLength) && (teststr.charAt(i) != "@"))
	{ 
	i++;
	}
	if ((i >= sLength) || (teststr.charAt(i) != "@")) 
	{
	iserr=true;
	}
		else 
		{
		 i += 2;
		 // look for "."
		 while ((i < sLength) && (teststr.charAt(i) != "."))
			 { 
				i++;
			 }
		 // there must be at least one character after the "."
		 if ((i >= sLength - 1) || (teststr.charAt(i) != ".")) 
		 	{
			iserr = true;
			}
		}
   }
	   if (iserr)
		 {
		  alert('Please enter a valid email address.');
		  contact.email.focus();
   	      return (false);				  
	     }

    // ** END **
	return true ;
}


// this function calls a popupWindow where
// win is the page address i.e. '../page.htm'
// and must be specified when the function is called

function popupWindow(win){
	
	newWindow = window.open(win,'newWin','toolbar=no,left=200,top=200,scrollbars=no,resizable=no,width=400,height=400');
	newWindow.focus();
}

