$(document).ready(function () {

    loadMapTab();
    setTimeout("LoadAdvertisement('master', 'banner', 0)", 10);
    setTimeout("LoadAdvertisement('master', 'left', 0)", 10);

    $("#tabsholder").tytabs({
        tabinit: "2",
        fadespeed: "fast"
    });
    $("#tabsholder1").tytabs({
        prefixtabs: "tabz",
        prefixcontent: "contentz",
        classcontent: "tabscontent",
        tabinit: "3",
        catchget: "tab0",
        fadespeed: "normal"
    });
    $('.list-menu ul').hide();
    $('.list-news > ul > li > a').click(function () {
        if ($(this).parent().find('ul').length > 0) {
            $(this).next().addClass('ulActive');
            $('.list-menu li ul:visible:not(.ulActive)').hide('normal');
            $(this).next().stop(true, true).removeClass('ulActive').toggle('normal');
            return false;
        }
    });
    $('ul.menu-prd ul li a').hover(function () {
        $(this).next().stop(true, true).show(500);
    }, function () { });
    $('ul.menu-prd ul > li').hover(function () {
        $(this).find('ul:first').stop(true, true).show(500);
    }, function () {
        $(this).find('ul:first').stop(true, true).slideUp("slow");
    });

});

function LoadAdvertisement(page, position, key) {
    $.ajax({
        type: "POST",
        url: "/WebServices/AdsService.asmx/GetAdvertisement",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        data: "{'pageAlias':'" + page + "','positionAlias':'" + position + "','key':'" + key + "'}",
        beforeSend: function () {
        },
        async: true,
        success: function (m) {
            var result = m.d;
            if (result.length > 0) {
                $("#" + page + "-" + position).html(m.d);
            }
        }
    });
}

var mapInited = 0;
function loadMapTab() {
    $('#tab8').click(function () {
        if (mapInited == 0) {
            $('#mapview,#content8').css({ 'width': '700px' });
            setTimeout('initialize()',1000);
            mapInited = 1;

        }
    });
    
}
