function ValidateForm(form)
{
	
	var fields = new Array("FirstName", "LastName", "EmailAddress", "StreetNumber", "Address", "City", "State", "ZipCode", "Phone", "Phone2");
	var prompts = new Array("First Name", "Last Name", "Email address", "Address", "Address", "City", "State", "ZipCode", "Phone (day)", "Phone (evening)");

	var i, fld;
	for( i in fields ) {
		fld = fields[i];
        	if (form[fld].value == 0){
      			alert(prompts[i] + " is Required");
          		form[fld].focus();
          		return false;
		}//if
	}//for

	//Special email address check
	if(!check_email(form.EmailAddress.value))
	{
		alert("Please make sure your Email Address is Correct");
        form.EmailAddress.focus();
		return false;
    } 
		//Special Investment Check
	if (form.CapitalID.selectedIndex == 0)
	{
		alert("Please let us know how much cash you have available to invest");
		form.CapitalID.focus();
		return false;
	}
		//Special found us Check
	if (form.HowFound.selectedIndex == 0)
	{
		alert("Please let us know how you found out about us");
		form.HowFound.focus();
		return false;
	}
	
	
//IF ALL IS GOOD
        return true;
}

//CHECK IF EMAIL IS VALID
function check_email(e) {
        ok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM";
        for(i=0; i < e.length ;i++){
               if(ok.indexOf(e.charAt(i))<0) return (false); 
        }
        if (document.images) {
               re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
               re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
               if (!e.match(re) && e.match(re_two)) return (-1);
        }
}//end check email


// This is the master POST TEST of the form (encapsulates ValidateForm above)
function PostTest(form)	{
	if (jcap())	{
		return ValidateForm(form);
	} else {
		return false;
	}
}
