﻿function validateForm(){
        var errors = "";
        
        var filter = /^[\w|\W]+@+[\w|\W]+\.+\w+$/;
        var strEmail = document.form1.email.value;
        while (strEmail.charAt(strEmail.length - 1) == " ") strEmail = strEmail.substring(0, strEmail.length - 1);

        if (strEmail.length == 0) {
            //if the user has left their email address out
            errors += 'Please enter a valid email address.  ';
            //document.form1.email.focus();
        } else if (!filter.test(strEmail)) {
            errors += 'Please enter a valid email address.  ';
            //document.form1.email.focus();
        } 
        
        if($('first_name').value.length == 0){
            errors += 'Please enter your first name.  '
        }
        
        if($('last_name').value.length == 0){
            errors += 'Please enter your last name.  '
        }
        
        if($('address').value.length == 0){
            errors += 'Please enter street address.  '
        }
        
        if($('postcode').value.length == 0){
            errors += 'Please enter your postcode.  '
        }
        
        if($('city').value.length == 0){
            errors += 'Please enter your city.  '
        }
        
        if($('select_country').value == "0"){
            errors += 'Please select a country.  '
        }
             	     	    
        if(errors.length > 0){
            alert(errors);
            return false;
        }
        else{
            return true;
        }
     }

