var sw = 0

function chkContact(ContactForm) {
		// check fullname
		chkFullName(ContactForm);
		if (sw==0) return false;
		// check email
		chkEmail(ContactForm);
		if (sw==0) return false;
		// check street
		chkStreet(ContactForm);
		if (sw==0) return false;
		// check city
		chkCity(ContactForm);
		if (sw==0) return false;
		// check prov/state
		chkProv_State(ContactForm);
		if (sw==0) return false;
		// check postal/zip
		chkPostal_Zip(ContactForm);
		if (sw==0) return false;
		// check daytime phone
		chkDaytimePhone(ContactForm);
		if (sw==0) return false;
		// check evening phone
		chkEveningPhone(ContactForm);
		if (sw==0) return false;
		
		if (ContactForm.faxPhone.value == "") {
        ContactForm.faxPhone.value = "- Intentionally Left Blank -";
		}
		if (ContactForm.personalLease.value == "") {
        ContactForm.personalLease.value = "- Intentionally Left Blank -";
    }

}

////////////////////////////////////////////
////////////////////////////////////////////
////////////////////////////////////////////


function chkFullName(form_id) {
    if (form_id.fullName.value == "") {
        alert("Please enter your full name");
        form_id.fullName.focus();
        sw = 0;
    }   
    else sw = 1;
}   

function chkEmail(form_id) {
    if (form_id.email.value == "") {
        alert("Please enter your email address");
        form_id.email.focus();
        sw = 0;
    } else {
        var emailAdd = new String();
            emailAdd = form_id.email.value;
            len = emailAdd.length;

            // check for the @ and .
            if ( (emailAdd.indexOf('@') > 0) || (emailAdd.indexOf('.') > 0) ||
            (emailAdd.indexOf('.') != len-1) || (emailAdd.indexOf('@') !=
len-1)) {

                // go here when @ and .'s position are somewhat valid then test
                // the domain and user name
                at = emailAdd.indexOf('@');
                user = emailAdd.substring(0,at);
                domain = emailAdd.substring(at+1,len+1);

                // check the validity of the user and domain name
                if ( (domain.indexOf('@') >= 0) || (domain.lastIndexOf('.') ==
                    domain.length-1) || (domain.indexOf('.') == 0) ||
(domain.indexOf('.') < 0) ){
                    alert("Invalid email address!");
                    form_id.email.focus();
                    sw = 0;
                }
                else if ( (user.lastIndexOf('.') == user.length-1) ||
                    (user.indexOf('.') == 0) ) {

                    alert("Invalid email address!");
                    form_id.email.focus();
                    sw = 0;
                }
                else {

                    form_id.email.focus();
                    sw = 1;
                }
                // end check for validity of the user and domain name

            } // end inner if
            // go here when @ and/or  .'s position are invalid
            else {

            alert("Invalid email address!");
            form_id.email.focus();
            sw = 0;
            }
    } // end outermost else
}

function chkStreet(form_id) {
    if (form_id.stAddress.value == "") {
        alert("Please enter your residence street");
        form_id.stAddress.focus();
        sw = 0;
    }
    else sw = 1;
}

function chkCity(form_id) {
    if (form_id.city.value == "") {
        alert("Please enter your city");
        form_id.city.focus();
        sw = 0;
    }   
    else sw = 1;
}   

function chkProv_State(form_id) {
    if (form_id.state_prov.value == "") {
        alert("Please enter your Province or State");
        form_id.state_prov.focus();
        sw = 0;
    }   
    else sw = 1;
}   

function chkPostal_Zip(form_id) {
    if (form_id.post_zip.value == "") {
        alert("Please enter your Postal Code or Zip Code");
        form_id.post_zip.focus();
        sw = 0;
    }   
    else sw = 1;
}   

function chkDaytimePhone(form_id) {
    if (form_id.dayPhone.value == "") {
        alert("Please enter your daytime phone number");
    form_id.dayPhone.focus();
        sw = 0;
    }
    else sw = 1;
}

function chkEveningPhone(form_id) {
    if (form_id.evePhone.value == "") {
        alert("Please enter your evening phone number");
    form_id.evePhone.focus();
        sw = 0;
    }   
    else sw = 1;
}   
