var lat=52.391935;
var lng=16.85027;
var zoom=15;
function load() {
    if (GBrowserIsCompatible()) {
        //var map = new GMap2($('#maps'));
        //map.setCenter(new GLatLng(lat, lng), zoom);
        //var point = new GLatLng(lat, lng);
        //map.addOverlay(createMarker(point, 'info1',icon));
        var map = new google.maps.Map2(document.getElementById("maps"));
        map.setCenter(new GLatLng(lat, lng), zoom);
        var marker = new GMarker(new GLatLng(lat, lng));
        map.addOverlay(marker);
        var info = '<div class="google_info"><strong>LEVANT Import-Export</strong><hr/>ul. Smoluchowskiego 11a<br/>60-179 Poznan - Poland<br/>tel. +48 / 61 / 88 66 600<br/>fax +48 / 61 / 88 66 601<br/><a href="mailto:info@levant.pl">info@levant.pl</a><br/>';
        GEvent.addListener(marker, "click", function() {
            marker.openInfoWindowHtml(info);
        });
        map.setUIToDefault();
    }
}



$(document).ready(function() {


    $("a[rel^='product_info']").prettyPhoto();


    $('#menu li').mouseover(function() {
        $('img', this).attr('src', urlBase+'img/'+$('img', this).attr('name')+'_hover_'+lang+'.png');
    });

    $('#menu li').mouseout(function() {
        if($('img', this).attr('class') != 'menu_button_on') {
            $('img', this).attr('src', urlBase+'img/'+$('img', this).attr('name')+'_'+lang+'.png');
        }

    });

    $('.left').mouseover(function() {
        //$("#brands_logos").animate({"margin-left": "-=50px"}, "fast");
        });

    $('.right').mouseover(function() {
        //$("#brands_logos").animate({"margin-left": "+=50px"}, "slow");
        });

    $('#brands_logos img.brand_logos_change').mouseover(function() {
        var link = $(this).attr('src');
        var image = link.split('small/');
        var imagelink = image[1].split('-');
        if(imagelink[2]!=undefined) {
            var imagelinkNoExt = imagelink[2].split('.');
            if(imagelinkNoExt[0]=='active') {
                imagelinkNoExt[0]='pasive';
            }
            else {
                imagelinkNoExt[0]='active';
            }

            //alert(imagelink[0]+'-'+imagelink[1]+'-'+imagelink[2]);
            $(this).attr('src', urlBase+'files/page_icons/small/'+imagelink[0]+'-'+imagelink[1]+'-'+imagelinkNoExt[0]+'.'+imagelinkNoExt[1]);
        }
    });

    $('#brands_logos img.brand_logos_change').mouseout(function() {
        var link = $(this).attr('src');
        var image = link.split('small/');
        var imagelink = image[1].split('-');
        if(imagelink[2]!=undefined) {
            var imagelinkNoExt = imagelink[2].split('.');
            if(imagelinkNoExt[0]=='active') {
                imagelinkNoExt[0]='pasive';
            }
            else {
                imagelinkNoExt[0]='active';
            }

            //alert(imagelink[0]+'-'+imagelink[1]+'-'+imagelink[2]);
            $(this).attr('src', urlBase+'files/page_icons/small/'+imagelink[0]+'-'+imagelink[1]+'-'+imagelinkNoExt[0]+'.'+imagelinkNoExt[1]);
        }
    });

    var searchQueryString = $('#query').val();

    $('#query', this).focus(function() {
        if('...szukaj' == $('#query').val() || '...search' == $('#query').val()) {
            $('#query').val('');
        }
    });

    $('#query', this).blur(function() {
        if('' == $('#query').val() || '' == $('#query').val()) {
            $('#query').val(searchQueryString);
        }
    });

    /*
    $('#product_list') {
        var domElement = $(this);
        var ulElements = document.getElementsByName('ul');
        alert(ulElements.length);
    });
*/
    $("#brands_check").smoothDivScroll({
        scrollingSpeed: 12,
        mouseDownSpeedBooster: 3,
        autoScrollDirection: "endlessloop",
        autoScrollSpeed: 3,
        visibleHotSpots: "",
        hotSpotsVisibleTime: 9,
        startAtElementId: "startAtMe"
    });

    $('[class^="pagesParentId"]').click(function() {
        var sClass = $(this).attr('class');
        var aCatId = sClass.split('-');
        $('#pagesTree-'+aCatId[1]).slideToggle('slow');
        if($(this).html()=='rozwiń') {
            $(this).html('zwiń');
        }
        else {
            $(this).html('rozwiń');
        }
    });


    $('.jScroll, #description').jScrollPane({
        scrollbarWidth: 10
    });


   

    load();



}) ;


