Tabs = {}

Tabs.show = function(name)
{

    $('.service-act').hide();
    $(' a').removeClass('selected');
    $('a.'+name).addClass('selected');
    $('#' + name + '-tab-act').show();
    $('.service-pas').show();
    $('#' + name + '-tab').hide();

    $('.table[id*="-tab-body"]').hide();
    $('#' + name + '-tab-body').show();
}

Tabs.show_first = function()
{
    for (var i = 0; i < arguments.length; i++)
    {
        name = arguments[i];
        if ($('#' + name + '-tab-body').length)
        {
            this.show(name);
            return;
        }
    }
    $('.service-tab-body').hide();
}

Places = {}

Places.initIcons = function()
{
    var a = 19,
        b = 13;
    var redFlagIcon = new GIcon(G_DEFAULT_ICON);
    redFlagIcon.image = MEDIA_URL+"i/redflag_"+a.toString()+"_"+b.toString()+".png";
    redFlagIcon.shadow = "";
    redFlagIcon.iconSize = new GSize(a, b);
    redFlagIcon.iconAnchor = new GPoint(5, 20);
    this.redFlagIcon = redFlagIcon;
    var blueFlagIcon = new GIcon(G_DEFAULT_ICON);
    blueFlagIcon.image = MEDIA_URL+"i/blueflag_"+a.toString()+"_"+b.toString()+".png";
    blueFlagIcon.shadow = "";
    blueFlagIcon.iconSize = new GSize(a, b);
    blueFlagIcon.iconAnchor = new GPoint(5, 20);
    this.blueFlagIcon = blueFlagIcon;
//     mainMarkerOptions = { icon:redFlagIcon };
//     var marker = new GMarker( new GLatLng( 56, 92.9 ), mainMarkerOptions );
}

Places.fixGoogle = function()
{
    $('#gmap > div').css('white-space', 'normal')
    $($('#gmap > div')[2]).css('bottom', '-28px')
    $('#gmap').css('margin-bottom', '40px')
}

Places.fixPatience = 3;
Places.fixDelay = 1000;
Places.fixGooglePatiently = function() // Терпеливо патчим гуглокарту
{
    if (Places.fixPatience) setTimeout(Places.fixGooglePatiently, Places.fixDelay);
    Places.fixGoogle(); // Да, мы вызовем это несколько раз, лучше перебдеть, чем недобдеть
                        // Невозможно определить когда скрипт гугла отработает и можно будет делать фикс
    Places.fixPatience--; Places.fixDelay *= 2;
}

Places.initGMap = function(center_lat, center_lon, zoom)
{
    var map = new google.maps.Map2(document.getElementById("gmap"));
    map.setCenter(new GLatLng(center_lat, center_lon), zoom);
    map.addControl(new GSmallZoomControl());
    //map.addControl(new GSmallMapControl());
    //map.addControl(new GMapTypeControl());
    map.addMapType(G_PHYSICAL_MAP);
    map.setMapType(G_PHYSICAL_MAP);
    //map.enableDoubleClickZoom();

    this.map = map;

    this.initIcons();
    //this.fixGooglePatiently();
}
