function echeck(str)
{
var at="@"
var dot="."
var lat=str.indexOf(at)
var lstr=str.length
var ldot=str.indexOf(dot)
if (str.indexOf(at)==-1){
alert("Invalid Email Address.")
return false
}

if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
alert("Invalid Email Address.")
return false
}

if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
alert("Invalid Email Address.")
return false
}

if (str.indexOf(at,(lat+1))!=-1){
alert("Invalid Email Address.")
return false
}

if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
alert("Invalid Email Address.")
return false
}

if (str.indexOf(dot,(lat+2))==-1){
alert("Invalid Email Address.")
return false
}

if (str.indexOf(" ")!=-1){
alert("Invalid E-mail Address.")
return false
}

return true
}

function checkform ( form )
{

// ** START **
if(form.customfield_insurance_company.value == "" && form.customfield_insurance_company_other.value == "") {
alert("Please enter the name of the insurance company or specify something for the insurance other field.");
return false ;
}
if(form.customfield_payment_amount.value == "") {
alert("Please enter the payment amount.");
return false ;
}
if(form.customfield_next_due_date.value == "") {
alert("Please enter the next payment due date.");
return false ;
}
if(form.customfield_number_payments_remaining.value == "") {
alert("Please enter how many payments are remaining.");
return false ;
}
if(form.customfield_payments_made.selectedIndex == 0) {
alert("Please select a value for the payments made.");
return false ;
}
if((form.customfield_payments_made.selectedIndex == 5) && form.customfield_payments_made_other.value == "") {
alert("You have selected 'Other' for payments made, please tell us what the other type is.");
return false ;
}
if(form.customfield_recipient_age.value == "") {
alert("Please tell us the recipients age.");
return false ;
}
if(form.customfield_settlement_type.selectedIndex == 0) {
alert("Please select a value for the settlement type.");
return false ;
}
if((form.customfield_settlement_type.selectedIndex == 4) && form.customfield_settlement_type_other.value == "") {
alert("You have selected 'Other' for settlement type, please tell us what the other type is.");
return false ;
}
if(form.customfield_first_name.value == "") {
alert("Please enter your first name.");
return false ;
}
if(form.customfield_last_name.value == "") {
alert("Please enter your last name.");
return false ;
}
if(form.customfield_day_phone.value == "") {
alert("Please enter your day phone number.");
return false ;
}
if(form.customfield_evening_phone.value == "") {
alert("Please enter your evening phone number.");
return false ;
}
var emailID=form.customfield_email;

if ((emailID.value==null)||(emailID.value=="")){
alert("Please enter your email address");
emailID.focus();
return false;
}
if (echeck(emailID.value)==false){
emailID.value="";
emailID.focus();
return false;
}
if(form.customfield_city.value == "") {
alert("Please enter your city.");
return false ;
}
if(form.customfield_state.selectedIndex == 0) {
alert("Please select the state you are from.");
return false ;
}
if(form.customfield_how_much_needed.value == "") {
alert("Please tell us how much you need.");
return false ;
}
if(form.customfield_how_fast.value == "") {
alert("Please tell us how fast you need the money.");
return false ;
}
if(form.customfield_more_info.value == "") {
alert("Please tell us why you are selling this note (in the comments box).");
return false ;
}
// ** END **
return true;
}
