
   <!-- Hide this script from non JavaScript enabled browsers
		   
   //This function returns true if string contains only whitespaces
    function whiteSpace(Stringy){
     for(var i=0; i<Stringy.length; i++){
        var Character = Stringy.charAt(i);
        if((Character !=' ') && (Character !='\n') && (Character !='\t')) return false;
     }
     return true;
    }//end of function whiteSpace

  
    function verifyFormData(theForm){
    /* This function loops through all the elements on the form and checks
       to see which ones are required values. If the user has omitted
       required data, the corresponding element is added to a message list.
       The code next checks for invalid data. An error message will be sent out at end. */

       //initialize variables
       var fields = ""
	var fieldsvalue = ""
       var msg = ""
       var empty_fields = ""    
       var result = "" 
	var oneischecked=false     
        var count_empty=0;
       //check for empty fields
       for(var i=0; i<theForm.length; i++){
	    //grab the first element in the form 
         var formElement = theForm.elements[i];
		
		
		 if (formElement.type == "checkbox" || formElement.type == "hidden" || formElement.type == "text" || formElement.type == "textarea"){
		if (formElement.type == "checkbox" && formElement.checked){
		oneischecked=true;
 		fields = fields + "--" + formElement.name + "~" +formElement.checked+"~1";
		}else{
		fields = fields + "--" + formElement.name + "~" + escape(formElement.value);
		}
			if ((!formElement.optional)) {
			//check to see if field contains anything 

				if((formElement.value == null) || (formElement.value == '') || whiteSpace(formElement.value)){
                                var field_name=formElement.name.split("_");
                                var s_field_name=field_name.join(" ");
				empty_fields = empty_fields + "\n  " + s_field_name;
                                count_empty++;

                                //fields = fields + "~" + "0";
				//continue;
            		}else{
				fields = fields + "~" + "1";
				}

           		}else{
			fields = fields + "~" + "1";

			}
		}
	    }
	   if (empty_fields){
             if (count_empty>1) alert(empty_fields+' are required fields');
             if (count_empty==1) alert(empty_fields+' is a required field');
             return false;

	     //document.location=document.location+"?fields="+fields;
			
	     //return false;
	  }
		   
		  //Begin checks on invalid Data
             
           result = checkEmail(theForm)
           if (result == false){
            //msg = escape("There is something wrong with your email. Please re-enter");
            msg = "There is something wrong with your email. Please re-enter";
	    alert(msg);
           //var win=window.open('includes/error.php?msg='+msg+'&sizepopup=small', 'barney','width=400,height=100,scrollbars=no,status=no,menubar=no,resizable=no,toolbar=no,location=no,screenX=50,ScreenY=50,left=50,top=50');
			
           return false;
           } 
       
           result = goPostal(theForm);
		   if (result == false){
		    msg = escape("There is something wrong with your postal/zip code entry. Please retry!");
           
		tofocus=result;
 		
		var win=window.open('includes/error.php?msg='+msg+'&tofocus='+tofocus, 'barney','width=400,height=100,scrollbars=no,status=no,menubar=no,resizable=no,toolbar=no,location=no,screenX=50,ScreenY=50,left=50,top=50');
			
		return false;
           }
	// disable if there are no required checkboxes...
 	//if(!oneischecked){ return false;}
     
       }//end of verifyFormData
	   
	   function checkEmail(theForm) {
       //this function checks to make sure that the user has entered the email address correctly
      
       invalidChars = ", \" \\ # $ % ^ & * ( ) = + | [ ] { } ; : ' < > / ?"
	 for(var i=0; i<theForm.length; i++){
	 var formElement = theForm.elements[i];
	var formElementLen=formElement.name.length;
		if (formElement.type == "text"){
		partname=formElement.name.substring(0,5);
		
			if (partname.toLowerCase() == "email"){
			
		       var email = formElement.value;
			 var badChar = ""
		       //if user has entered something as an email address
		       if (email != "" ) {
		       //make sure that all entered characters are valid
		         for (var i=0; i<invalidChars.length; i++){            
		           badChar = invalidChars.charAt(i);
		           if (email.indexOf(badChar,0) != -1){
		             return false;
		           }
		         }
		          
		         atPos = email.indexOf("@",1);

		         if (atPos == -1) return false;
		          
		         if (email.indexOf("@",atPos+1) != -1) return false;
		         
			   periodPos = email.indexOf(".",atPos);
		                 
		         if (periodPos == -1) return false;
		                               
		        }else{
				
				return true;}
			
			}
		}
	}

     return true;
       }//end of function checkEmail
	   
function goPostal(theForm){
var newtype="postal_or_zip";
var lenny="global";
var result=true;
lenny=theForm.length;
	for(var i=0; i<theForm.length; i++){
	var formElement = theForm.elements[i];
	var formElementLen=formElement.name.length;
		if (formElement.type == "text"){
		partname=formElement.name.substring(formElementLen-newtype.length,formElementLen);
			if (partname.toLowerCase() == newtype){
			
			var postalzip_optional = formElement.optional
			var postalzip = formElement.value
			var postalzip_empty
			
			postalzip_empty=((postalzip == null) || (postalzip == '') || whiteSpace(postalzip))
				if(postalzip_optional && postalzip_empty){
				
				}else{
					/* disabling validation
					if (postalzip.length > 5){
					result= goPostCode(postalzip,formElement)
					if(result==false){break;}
					}
					else if(postalzip.length == 5){
					result= goZippy(postalzip,formElement)
					if(result==false){break;}
					}
					else {
					result=false;
					}
					*/
				}
			}
			  
			
			
		}
	}
	return result;
}

function goZippy(postalzip,formElement){
var result=true;

	for (j = 0; j<postalzip.length; j++){
	Character = postalzip.charAt(j);
		if(isNaN(Character)){
		result=false;
		return false;
		break;
		}
	}
return result;


}// end goZippy function

	   
function goPostCode(postalzip,formElement){
//this code checks to make sure that a valid Postal Code has been entered
var blurt
var result = true;
var PCode = postalzip
var Character = ""
var postalcode = ""
	for (j = 0; j<PCode.length; j++){
	Character = PCode.charAt(j);
		if (Character != " "){
		postalcode=postalcode+Character;
		}
	}
	
	PCode=postalcode;
	if (PCode.length != 6){
	result=false;
	return result;
	}
	
      for (j = 0; j<PCode.length; j++){
      Character = PCode.charAt(j);
	
		if ((j)%2 == 0){ 
			
			if ((!isNaN(Character)) || (Character =="#") || (Character=="@") || (Character=="!") || (Character=="$") || (Character =="%") || (Character =="^") || (Character =="&") || (Character =="*") || (Character ==")") || (Character =="+") || (Character == "=") || (Character =="|") || (Character ==">") || (Character =="<") || (Character =="?") || (Character =="/") || (Character =="{") || (Character =="}") || (Character =="[") || (Character ==";") || (Character ==":") || (Character=="]") ) { 
			  result=false;
			
			return result;
			break;
			} 
		} 
		else if(isNaN(Character)){
		result=false;
		return result;
		break;
		}
	}// end for

return result;
}//end of goPostCode

function setoptional(theForm){
//this code initially sets input values to optional
	for(var i=0; i<theForm.length; i++){
	//grab the first element in the form
	var formElement = theForm.elements[i];
	formElement.optional = true;
	}
      return true;
}//end of setoptional

function setoptional_multi(theForm,list,counter){ //set optional fields except for those specified in exclude list
// for multible numbered fields such as name1, name2
//this code initially sets input values to optional
       name_list=list.split(",");
	for(var i=0; i<theForm.length; i++){
	//grab the first element in the form
	var formElement = theForm.elements[i];
        formElement.optional = true;
         for(var k=counter; k>1; k--) for(var j=0; j<name_list.length; j++) if (formElement.name==name_list[j]+k) formElement.optional = false;

        }
      return true;
}//end of setoptional


function setoptional_single(theForm,flag){ // set all optional fields with flag in case set_optional_multi has already been called
//this code initially sets input values to optional
	if(flag){
        for(var i=0; i<theForm.length; i++){
	//grab the first element in the form
	var formElement = theForm.elements[i];
	formElement.optional = true;
	}
}
      return true;
}//end of setoptional

function setoptional2(theForm){
var setemail="";
var setfax="";
var setaddress="";
//this code initially sets input values to optional
	for(var i=0; i<theForm.length; i++){
	//grab the first element in the form 
	var formElement = theForm.elements[i];
   		if (formElement.name == "checkedemail" && formElement.checked){
		theForm.email.optional = false; 
		} 
		if (formElement.name == "checkedfax" && formElement.checked){
		theForm.fax.optional = false;
		} 
		if (formElement.name == "checkedmail" && formElement.checked){
		theForm.postal_or_zip.optional = false;
		theForm.address.optional = false;
		theForm.city.optional = false;
		theForm.country.optional = false;
		theForm.phone.optional = false;
		
		} 		
	}

      return true;
}//end of setoptional2



function setrequired(theForm){
//this code initially sets input values to optional
	for(var i=0; i<theForm.length; i++){
	//grab the first element in the form 
	var formElement = theForm.elements[i];
	formElement.optional = false;
	}
      return true;
}//end of setrequired



  
  //stop hiding -->