function valForm(){
    var isValid = true;
    var message = '';

    //var emailInvalid = document.getElementById('emailInvalid');
    //var nameInvalid = document.getElementById('nameInvalid');
    //var captchaInvalid = document.getElementById('captchaInvalid');
    //emailInvalid.style.display = 'none';
    //nameInvalid.style.display = 'none';
    //captchaInvalid.style.display = 'none';
    var emailField = document.getElementById('email');

    var email = document.getElementById('email').value;
    if(email.length == 0){
        isValid = false;
        message += 'Invalid Email';
        //emailInvalid.style.display = 'inline';
    } else if(!checkEmail(email)){
        isValid = false;
        message += 'Invalid Email';
        //emailInvalid.style.display = 'inline';
    }
    /*var name = document.getElementById('name').value;
    if(name.length == 0){
        isValid = false;
        message += '<li>Please enter your name</li>';
        nameInvalid.style.display = 'inline';
    }*/


    //var captcha = document.getElementById('captcha').value;
    //if(captcha.length == 0){
        //isValid = false;
        //message += '<li>Please enter the text in the image</li>';
        //captchaInvalid.style.display = 'inline';
    //}

    //var errorBlock = document.getElementById('errorBlock');
    if(!isValid){
        emailField.value = message;
        emailField.style.color = '#ff0000';
    }else{
        //Only do this if the email address is valid
        //Check the value of the list(s) required
        if(document.getElementById('newsRadio').checked==true){
            jQuery('#offersListID').remove();
            //alert('remove offers id hidden field');
        }
    }
    return isValid;
}

function valBaseForm(){
    var isValid = true;
    var message = '';

    //var emailInvalid = document.getElementById('emailInvalid');
    //var nameInvalid = document.getElementById('nameInvalid');
    //var captchaInvalid = document.getElementById('captchaInvalid');
    //emailInvalid.style.display = 'none';
    //nameInvalid.style.display = 'none';
    //captchaInvalid.style.display = 'none';
    var emailField = document.getElementById('baseemail');

    var email = document.getElementById('baseemail').value;
    if(email.length == 0){
        isValid = false;
        message += 'Invalid Email';
        //emailInvalid.style.display = 'inline';
    } else if(!checkEmail(email)){
        isValid = false;
        message += 'Invalid Email';
        //emailInvalid.style.display = 'inline';
    }
    /*var name = document.getElementById('name').value;
    if(name.length == 0){
        isValid = false;
        message += '<li>Please enter your name</li>';
        nameInvalid.style.display = 'inline';
    }*/


    //var captcha = document.getElementById('captcha').value;
    //if(captcha.length == 0){
        //isValid = false;
        //message += '<li>Please enter the text in the image</li>';
        //captchaInvalid.style.display = 'inline';
    //}

    //var errorBlock = document.getElementById('errorBlock');
    if(!isValid){
        emailField.value = message;
        emailField.style.color = '#ff0000';
    }else{
        //Only do this if the email address is valid
        //Check the value of the list(s) required
        if(document.getElementById('basenewsRadio').checked==true){
            jQuery('#baseoffersListID').remove();
            //alert('remove offers id hidden field');
        }
    }
    return isValid;
}

var bookNowSub = '';
function valBookNow(){
    var isValid = true;
    var message = '';
    var name = document.getElementById('bkNowName').value;
    var tel = document.getElementById('bkNowTel').value;
    var errBlock = document.getElementById('bkNowErrs');
    var email = document.getElementById('bkNowEmail').value;
    if(name.length == 0){
        isValid = false;
        message += "<p>Please enter your name</p>";
    }
    if(bookNowSub == 'phone' && tel.length == 0){
        isValid = false;
        message += "<p>Please enter your telephone number</p>";
    }
    if(bookNowSub == 'email' && email.length == 0){
        isValid = false;
        message += "<p>Please enter your email address</p>";
    }
    if(email.length != 0){
        if(!checkEmail(email)){
            isValid = false;
            message += '<p>Please enter a valid email address</p>';
            //emailInvalid.style.display = 'inline';
        }
    }
    if(isValid==false){
        errBlock.innerHTML = message;
    }
    return isValid;
}

function checkEmail(email) {
    var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
    return filter.test(email);
}
