<!-- Begin 

var submitHasFocus = false

function submitFocusHandler()
{
	submitHasFocus = true
}

function submitBlurHandler()
{
	submitHasFocus = false
}


function checkOrderForm(which) { 
  var success=true; 
  var msg;
  var errorMessage = "";

  if (!submitHasFocus) 
    return false;

  if (document.images) 
  { 
    if (which.txtName == null || which.txtName.value == '')
    	errorMessage += "A Name must be entered\n";
    	    
    if (which.txtPhone == null || which.txtPhone.value == '')
    	errorMessage += "No phone number provided\n";
    else if (checkInternationalPhone(which.txtPhone.value)==false)
    	errorMessage += "A valid phone number must be entered\n";
    
    if (which.txtEmail.value == '')
    	errorMessage += "No Email Address has been provided.\n";
    else if (checkEmail(which.txtEmail.value)==false)
    	errorMessage += "A valid Email Address must be entered.\n";
    	
    if (errorMessage != "")
    {
    	msg = "_____________________________________________________\n\n";    
		msg += "Your Quote Request cannot yet be submitted because:\n\n";     
		msg += errorMessage; 
		msg += "\n";     
		msg += "Please complete all required entries in this Form.\n";    
  		msg += "_____________________________________________________\n";  
		alert(msg); 
   	 return false; 
   }
  } 
  else 
    return true; 
} 

function checkNewsletterForm(which) { 
  var success=true; 
  var msg;
  var errorMessage = "";

  if (!submitHasFocus) 
    return false;

  if (document.images) 
  { 
    if (which.txtName == null || which.txtName.value == '')
    	errorMessage += "A Name must be entered\n";
    	    
    if (which.txtAddress == null || which.txtAddress.value == '')
    	errorMessage += "An Address must be provided\n";
    	
    if (which.txtCity == null || which.txtCity.value == '')
    	errorMessage += "A City must be entered\n";
    
    if (which.txtState == null || which.txtState.value == '')
    	errorMessage += "A State must be entered\n";


     if (which.txtZip == null || which.txtZip.value == '')
    	errorMessage += "A Zip code must be entered\n";

    if (which.txtName2 != null && which.txtName2.value != '')
    {
    	    
      if (which.txtAddress3 == null || which.txtAddress3.value == '')
    	  errorMessage += "Friend's Address must be provided\n";
    	
      if (which.txtCity2 == null || which.txtCity2.value == '')
      	errorMessage += "Friend's City must be entered\n";
    
      if (which.txtState2 == null || which.txtState2.value == '')
      	errorMessage += "Friend's State must be entered\n";

       if (which.txtZip2 == null || which.txtZip2.value == '')
      	errorMessage += "Friend's Zip code must be entered\n";
    }	
    if (errorMessage != "")
    {
    	msg = "_____________________________________________________\n\n";    
		msg += "Your Newsletter Request cannot yet be submitted because:\n\n";     
		msg += errorMessage; 
		msg += "\n";     
		msg += "Please complete all required entries in this Form.\n";    
  		msg += "_____________________________________________________\n";  
		alert(msg); 
   	 return false; 
   }
  } 
  else 
    return true; 
} 


var digits = "0123456789";
var phoneNumberDelimiters = "()- ";
var validWorldPhoneChars = phoneNumberDelimiters + "+";
var minDigitsInIPhoneNumber = 10;
function isInteger(s)
{   var i;
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
  
    return true;
}

function stripChars(s, bag)
{   var i;
    var returnString = "";

    for (i = 0; i < s.length; i++)
    {   

        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function checkInternationalPhone(strPhone){
s=stripChars(strPhone,validWorldPhoneChars);
return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
}

 function checkEmail(str) {
 
 		var at="@"
 		var dot="."
 		var lat=str.indexOf(at)
 		var lstr=str.length
 		var ldot=str.indexOf(dot)
 		if (str.indexOf(at)==-1){
 		   	   return false
 		}
 
 		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
 		   
 		   return false
 		}
 
 		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
 		    
 		    return false
 		}
 
 		 if (str.indexOf(at,(lat+1))!=-1){
 		    
 		    return false
 		 }
 
 		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
 		    
 		    return false
 		 }
 
 		 if (str.indexOf(dot,(lat+2))==-1){
 		    
 		    return false
 		 }
 		
 		 if (str.indexOf(" ")!=-1){
 		    
 		    return false
 		 }
 
  		 return true					
 	}
 
 
 
//  End -->