// JavaScript Document
// Checks to see if form element is empty
function isEmpty( str){
    strRE = new RegExp( );
    strRE.compile( '^[s ]*$', 'gi' );
    return strRE.test( str.value );
}

// Checks to see if email address is 'valid'
function notValidEmail( str ){
    mailRE = new RegExp( );
    mailRE.compile( '^[._a-z0-9-]+@[.a-z0-9-]+[.]{1}[a-z]{2,4}$', 'gi' );
    return !(mailRE.test( str.value ));
}

// Main validation area that holds the 'alerts' and if/else statements to loop until all info is correctly entered by the user
function checkForm( form ){
 //If the name area is empty, display message
    if( isEmpty( form.name ) ){
        alert( 'Please specify your name.' );
        return false;
    }

// If the company area is empty, display a message
    if( isEmpty( form.company ) ){
        alert( 'Please enter your company' );
        return false;
    }  
	
// If the occupation area is empty, display a message
    if( isEmpty( form.occupation ) ){
        alert( 'Please enter your occupation' );
        return false;
    } 
	
// If the email address is not 'valid' display a message
    if( notValidEmail( form.email ) ){
        alert( 'You must enter a valid e-mail address!' );
        return false;
    }
	
// If tel area is empty, display a message
    if( isEmpty( form.tel ) ){
        alert( 'Please enter your telephone number' );
        return false;
    } 
	
	
 //If postcode area is empty, display a message
    if( isEmpty( form.address ) ){
        alert( 'Please enter your address' );
        return false;
    } 	
	
 //If postcode area is empty, display a message
    if( isEmpty( form.postcode ) ){
        alert( 'Please enter your postcode' );
        return false;
    } 
	
	if(!(form.interior.checked) && !(form.exterior.checked)) {
		alert( 'Please select a publication to recieve' );
		return false;
	}
	


// Otherwise, if everything is ok...return true and let the email send.
else{
    return true;
}
}