/*
    ============== (C) Copyright Relate.IT - All rights reserved ===============

    The copyright to the contents herein is the property of Relate.IT. The 
    contents may be used and/or copied only with the written permission of
    Relate.IT, or in accordance with the terms and conditions stipulated in 
    the agreement/contract under which the contents have been supplied.

    Contact information:
    
    Relate.IT
    van Suchtelenstraat 18
    7491 KC Delden(ov)              Phone:     +31615315133
    THE NETHERLANDS                 Internet:  http://www.relate-it.eu

    ============================================================================
    $Id: inputValidation.js,v 1.1 2008/09/18 13:57:53 cvs Exp $ 
    ============================================================================
*/

function validateNewCustomerForm(theForm, isNewForm) {
	var alertString = "";

	alertString += chkFilledInField(theForm.firstname, 
		"- Uw voornaam ontbreekt / Your firstname is missing\n");
	alertString += chkFilledInField(theForm.lastname, 
		"- Uw achternaam ontbreekt / Your lastname is missing\n");
	alertString += chkEmailField(theForm.email, 
		"- Uw e-mail adres is ongeldig / Your e-mail address is invalid\n");
	if(theForm.email.value != theForm.email2.value) {
		alertString += "- De twee email adressen komen niet overeen / The e-mail addresses do not match\n";
	}

	if(isNewForm) {
		alertString += chkFilledInField(theForm.password, 
			"- Uw wachtwoord ontbreekt / Your password is missing\n");
		alertString += chkFilledInField(theForm.address_no, 
			"- Uw huisnummer ontbreekt / Your house number is missing\n");
	}
	if(theForm.password.value != theForm.password2.value) {
		alertString += "- De twee wachtwoorden komen niet overeen / The passwords do not match\n";
	}
	alertString += chkFilledInField(theForm.address, 
		"- Uw straatnaam ontbreekt / Your streetname is missing\n");
	
	if(theForm.country_code.value == "NL") {
		alertString += chkPostcodeField(theForm.postcode, 
			"- Uw postcode is ongeldig / Your postcode is invalid\n");
	} else {
		alertString += chkFilledInField(theForm.postcode,
			"- Uw postcode ontbreekt / Your postcode is missing\n");
	}
	
	alertString += chkFilledInField(theForm.city, 
		"- Uw woonplaats ontbreekt / Your city is missing\n");
	
	if(theForm.phone.value != "") {
		alertString += chkNumberField(theForm.phone, 
			"- Uw telefoonnummer is ongeldig / Your phone number is invalid\n");
	}		

    if (alertString != "") {
        alert(alertString);
        return false;
    } else {
		disableSubmitReset(theForm);
        return true;
    }
}

function validateTipForm(theForm, isNewForm) {
	var alertString = "";

	alertString += chkEmailField(theForm.to_email, 
		"- E-mail van ontvanger is ongeldig / E-mail address of receiver is invalid\n");
	alertString += chkEmailField(theForm.from_email, 
		"- Uw e-mail adres is ongeldig / Your e-mail address is invalid\n");

	alertString += chkFilledInField(theForm.msg, 
		"- Uw bericht ontbreekt / Your message is missing\n");
		
    if (alertString != "") {
        alert(alertString);
        return false;
    } else {
		disableSubmitReset(theForm);
        return true;
    }
}

function validateSubscriberForm(theForm) {
	var alertString = "";
	
	alertString += chkEmailField(theForm.email, 
		"Geen geldig e-mail adres opgegeven.\nEntered e-mail address is invalid");
		
    if (alertString != "") {
        alert(alertString);
        return false;
    } else {
        return true;
    }
}
