﻿$(document).ready(function() {
    $("#lnk1").click(function() {
        tp1.showPanel(0);
        $("#mstimg").attr("src", "/images/mst-new.gif");
        $("#tabImg1").attr("src", "/images/new_booking.gif");
        $("#tabImg2").attr("src", "/images/already_booked.gif");
        $("#spline1").text("New Booking");
        $("#spline2").text("Enquiry");
        return false;
    });
    $("#lnk2").click(function() {
        tp1.showPanel(1);
        $("#mstimg").attr("src", "/images/mst-booked.gif");
        $("#tabImg1").attr("src", "/images/new_booking1.gif");
        $("#tabImg2").attr("src", "/images/already_booked1.gif");
        $("#spline1").text("Already");
        $("#spline2").text("Booked");
        return false;
    });
    $("#btnSubmit").click(ContactValidate);
    $("#img_EqSend").click(EnqValidate);
    $("#imgLogin").click(LoginValidate);
});
function LoginValidate() {
    var isValid = true;
    $("#errortext").css("display", "none");
    if ((jQuery.trim($("#txt_lgEmail").val())).length == 0) {
        isValid = false;
    }
    if ((jQuery.trim($("#txt_lgPassword").val())).length == 0) {
        isValid = false;
    }
    if (isValid == false) {
        $("#errortext").css("display", "block");
        return false;
    }
    return true;
}
function EnqValidate() {
    var isValid = true;
    $("#errortext").css("display", "none");
    if ((jQuery.trim($("#txt_EqName").val())).length == 0) {
        isValid = false;
    }
    if ((jQuery.trim($("#txt_EqEmail").val())).length == 0 || isEmail($("#txt_EqEmail").val()) == false) {
        isValid = false;
    }
    if ((jQuery.trim($("#txt_EqResNo").val())).length == 0) {
        isValid = false;
    }
    if ((jQuery.trim($("#txtEqMessage").val())).length == 0) {
        isValid = false;
    }
    if (isValid == false) {
        $("#errortext").css("display", "block");
        return false;
    }
    return true;
}
function ContactValidate() {
    var isValid = true;
    $("#errortext").css("display", "none");
    if ((jQuery.trim($("#txtFName").val())).length == 0) {
        isValid = false;
    }
    if ((jQuery.trim($("#txtLName").val())).length == 0) {
        isValid = false;
    }
    if ((jQuery.trim($("#txtEmail").val())).length == 0 || isEmail($("#txtEmail").val()) == false) {
        isValid = false;
    }
    if ((jQuery.trim($("#txtEmail1").val())).length == 0 || isEmail($("#txtEmail1").val()) == false) {
        isValid = false;
    }
    if (isEqual(jQuery.trim($("#txtEmail").val()), jQuery.trim($("#txtEmail1").val())) == false) {
        isValid = false;
    }
    if ((jQuery.trim($("#txtCCode").val())).length == 0 || isInteger($("#txtCCode").val()) == false) {
        isValid = false;
    }
    if ((jQuery.trim($("#txtACode").val())).length == 0 || isInteger($("#txtACode").val()) == false) {
        isValid = false;
    }
    if ((jQuery.trim($("#txtTel").val())).length == 0 || isInteger($("#txtTel").val()) == false) {
        isValid = false;
    }
    if ((jQuery.trim($("#txtMobCCode").val())).length == 0 || isInteger($("#txtMobCCode").val()) == false) {
        isValid = false;
    }
    if ((jQuery.trim($("#txtMobACode").val())).length == 0 || isInteger($("#txtMobACode").val()) == false) {
        isValid = false;
    }
    if ((jQuery.trim($("#txtMob").val())).length == 0 || isInteger($("#txtMob").val()) == false) {
        isValid = false;
    }
    if ((jQuery.trim($("#date3").val())).length == 0 || isInteger($("#txtMob").val()) == false) {
        isValid = false;
    }
    if ($("#ddlCountry").val() == "0") {
        isValid = false;
    }
    if (Date.fromString($("#date3").val()) == false) {
        isValid = false;
    }
    if (Date.fromString($("#date4").val()) == false) {
        isValid = false;
    }
    if (isValid == false) {
        $("#errortext").css("display", "block");
        return false;
    }
    return true;
}