/**
 * DHTML email validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 */

function email_check(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;					
	}

function validateSignup() {
	
	var first_name = document.pds_request.first_name.value;
	var last_name = document.pds_request.last_name.value;
	var address_line1 = document.pds_request.address_line1.value;
	var city_suburb = document.pds_request.city_suburb.value;
	var state = document.pds_request.state.value;	
	var postal_code = document.pds_request.postal_code.value;	
	var email = document.pds_request.email.value;
	
	
	if ((first_name==null)||(first_name=="")){
		alert("Please enter your first name.");
		return false;
	}	
	
	if ((last_name==null)||(last_name=="")){
		alert("Please enter your last name.");
		return false;
	}		
	
	if ((address_line1==null)||(address_line1=="")){
		alert("Please enter the first line of your address.");
		return false;
	}
	
	if ((city_suburb==null)||(city_suburb=="")){
		alert("Please enter your City or Suburb.");
		return false;
	}			
	
	if ((state==null)||(state=="")){
		alert("Please enter your State.");
		return false;
	}		
	
	if ((postal_code==null)||(postal_code=="")){
		alert("Please enter your Postal Code.");
		return false;
	}		
	
	if (email_check(email)==false){
		alert("Email address is invalid.");
		return false;
	}	

	
	return true;
 }