﻿// function to check if textboxs are empty onblur, if so add value
function CheckForEmptyFields() {
    var name = document.getElementById("ctl00_Nametxt");
    var additinfo = document.getElementById("ctl00_Infotxt");
    var telno = document.getElementById("ctl00_TelNotxt");
    var email = document.getElementById("ctl00_Emailtxt");

    if (name.value == "") {
        name.value = 'Name';
    }
    if (additinfo.value == "") {
        additinfo.value = 'Additional Information';
    }
    if (telno.value == "") {
        telno.value = 'Telephone Number';
    }
    if (email.value == "") {
        email.value = 'Email';
    }
}

// check if they haven't entered anything on click, then empty the textbox
function ClickControl(obj) {

    if (obj.value == "Name" || obj.value == "Additional Information" || obj.value == "Telephone Number" || obj.value == "Email") {
        obj.value = '';
    }
}

//Validation to check if the defaults have been changed
function NameValidateCB(source, arguments) {
    if (arguments.Value == "Name") {
        arguments.IsValid = false;
    }
    else {
        arguments.IsValid = true;
    }
}
function TelNoValidateCB(source, arguments) {
    if (arguments.Value == "Telephone Number") {
        arguments.IsValid = false;
    }
    else {
        arguments.IsValid = true;
    }
}
function EmailValidateCB(source, arguments) {
    if (arguments.Value == "Email") {
        arguments.IsValid = false;
    }
    else {
        arguments.IsValid = true;
    }
}
