﻿$(document).ready(function() {
    //setup the border of text boxes in the subpage
    $(".textBlock > div").after("<span class='bottomBorder'></span>");

    var currentPageName = $("#subPageContainer").attr("class");

    $("#nav ." + currentPageName).addClass("selected");



    $(".enquiryForm").validate({
        onsubmit: false,
        highlight: function(input) {
            $(input).addClass("ui-state-highlight");
        },
        unhighlight: function(input) {
            $(input).removeClass("ui-state-highlight");
        }


    });

    $("input:submit").button();


    $(".enquiryForm input:submit").click(function(evt) {
        // Validate the form and retain the result.
        var isValid = $(".enquiryForm").valid();

        // If the form didn't validate, prevent the
        //  form submission.
        if (!isValid) {
            evt.preventDefault();
        }

    });

    if (currentPageName == "map") {
        initialize();
    }


});





