﻿var map = null;
function setMap() {
    var div = document.getElementById('myMap');
    var lat = document.getElementById('ctl00_ContentPlaceHolderMain_lblLatitude').innerHTML;
    var lng = document.getElementById('ctl00_ContentPlaceHolderMain_lblLongitude').innerHTML;
    var add = document.getElementById('ctl00_ContentPlaceHolderMain_lblAddress').innerHTML;
    var name = document.getElementById('ctl00_ContentPlaceHolderMain_lblCentreName').innerHTML;
    if (div != null && lat != 0 && lng != 0) {
        map = new VEMap('myMap');
        map.LoadMap(new VELatLong(lat, lng), 12, 's', false);
        var pin = new VEShape(VEShapeType.Pushpin, new VELatLong(lat, lng));
        pin.SetTitle(name);
        pin.SetDescription(add);

        map.AddShape(pin);

    }
}

$(document).ready(function() {
    var $search = $(".SearchBox");

    if ($search != null) {
        //Setup the Search box label
        $search.addClass("OverLabel");
        var $searchInput = $search.find('input');
        var $searchLabel = $search.find('label');

        if ($searchInput.val()) {
            $searchLabel.hide();
        }

        $searchInput.focus(function() {
            $searchLabel.hide();
        }).blur(function() {
            if (this.value == '') {
                $searchLabel.show();
            }
        });

        $searchLabel.click(function() {
            $searchInput.trigger('focus');
        });

    }

    $("#faq dd").hide();
    $("#faq dt").click(function() {
        $(this).next("dd").slideToggle();
        $(this).toggleClass("active");
    });

    //Some hacks for IE for AdvancedSearch page
    if (typeof jQuery.fn.selectbox == "function") {
        // SelectBox is available
        //	alert(parseInt($.browser.version));
        if ($.browser.msie != true || ((parseInt($.browser.version)) > 7)) {
            $("select[id$='ddlCQCRating']").selectbox();
        }
    }
    if ($.browser.msie && ((parseInt($.browser.version)) == 8)) {
        $("dd > fieldset > legend").css("margin-left", "0");
    }
    if ($.browser.msie && ((parseInt($.browser.version)) == 6)) {
        $("dd > fieldset > div").css("margin-left", "3px");
    }
});
