function checkRegFields(form){
	//check captcha
	var captcha = form['captcha'].value;
	if(captcha != 'bd_signup'){
		alert('Invalid text entered in captcha');
		return false;
	}

	var email = form['email'].value;
	if(email == null || email.length == 0 || email.indexOf(".") == -1 || email.indexOf("@") == -1 || email.indexOf(" ") != -1){
		alert("Invalid email address."); 
		return false;
	}

	/* The local part cannot begin or end with a "."
	   Regular expression specifies: the group of characters before the @    
	   symbol must be made up of at least two word characters, followed by zero   
	   or one period char, followed by at least 2 word characters. */

	regex = /(^\w{2,}\.?\w{2,})@/;
	_match = regex.exec(email);
	if(_match){
	}
	else{
            var message="Make sure the email address is more than two characters, "+
	                 "does not begin or end with a period (.), or is not otherwise "+
	                 "invalid!";
	    alert(message);
	    return false;
        } 
	//get the domain after the @ char
	//first take care of domain literals like @[19.25.0.1], however rare
	regex = /@(\[\d{1,3}\.\d{1,3}\.\d{1,3}.\d{1,3}\])$/;
	_match = regex.exec(email);
        if(_match){
	        domain = RegExp.$1;
	        this.valid=true;
        }
	else{
		/* The @ character followed by at least two chars that are not a period (.),
		followed by a period, followed by zero or one instances of two or more
		characters ending with a period, followed by two-three chars that are 
		not periods */
		regex = /@((\w|-){2,}\.(\w{2,}\.)?[a-zA-Z]{2,3})$/;
		_match = regex.exec(email);
		if(_match){
		         domain=RegExp.$1;
		         //alert("domain: "+domain);
		}
		else{
		   var message="The domain portion of the email had less than 2 chars "+
	                     "or was otherwise invalid!";
		   alert(message);
	           return false;
		}
        }
	//done w email


	var pw = form['pw'].value;
	var pw2 = form['pw2'].value;
	if(pw != pw2){
	        alert("Your password entries did not match.");
	        return false;
	}
  	if(pw.length < 5){
		alert("Password must be longer than 5 characters");
		return false;
	}

	var screen_name = form['screen_name'].value;
	if(screen_name.length < 2){
		alert("Screen name must be at least 2 characters");
		return false;
	}
	return true;
}

function isValidZip(zip){
   var re = /^\d{5}$/;
   if(!re.test(zip)){
   	alert("The zip code you entered: \'" + zip + "\' was invalid.");
	return false;
   }
   return true;
}
