$(document).ready(function() {
    theRotator();

    $('a[rel*=lightbox]').lightBox();

    $("#footer ul li ul:last").find('a').addClass('white');
    $("#footer ul li").find('ul li:first a').addClass('white');

    $("input:text, textarea").focus(function () {
        if($(this).attr('value')==$(this).attr('rel'))
            $(this).attr('value','');
    });

    $("input:text, textarea").focusout(function () {

        if($(this).attr('value')=='')
            $(this).attr('value',$(this).attr('rel'));
    });

    $('ul#wdrozenia li:first ul').show().addClass('on');
    
    $('ul#wdrozenia li h4').click(function() {
        $('ul#wdrozenia .on').hide().removeClass('on');
        $(this).next().show().addClass('on');
    });

    $('ul#wdrozenia li ul li>a').click(function() {
        $('ul#wdrozenia li ul li a').removeClass('on');
        $(this).addClass('on').next().show();
        return false;
    });
});	

function pokaz_ukryj(blok) {
    if (document.getElementById(blok).style.display=="block") {
        $(".submenu").css("display","none");
    } else {
        $(".submenu").css("display","none");
        document.getElementById(blok).style.display="block";
    }
}

function ukryj(blok) {
    document.getElementById(blok).style.display="none";
}
function print_site() {
    window.print()
}
	
	
function load() {
    if (GBrowserIsCompatible()) {
        //wczytanie mapy
        var map = new GMap2(document.getElementById("map"));
        map.setCenter(new GLatLng(49.752223, 18.801512), 13);

        //zoom
        var mapy = map.getMapTypes();
        var ograniczenieZoom = [10,14];
        for (var i=0; i<mapy.length; i++)
        {
            mapy[i].getMinimumResolution = function() {
                return ograniczenieZoom[0];
            }
            mapy[i].getMaximumResolution = function() {
                return ograniczenieZoom[1];
            }
        }

        //kontrolki
        map.addControl(new GLargeMapControl());

        //miniaturka
        map.addControl(new GOverviewMapControl());

        // stworzenie markera
        var punkt  = new GLatLng(49.749223, 18.805512);
        var marker = new GMarker(punkt,{
            title: 'Dataland Sp. z o.o.'
        });

        // dodanie markera na map?
        map.addOverlay(marker);


    }
}
function theRotator() {
    //Set the opacity of all images to 0
    $('div#rotator ul li').css({
        opacity: 0.0
    });

    //Get the first image and display it (gets set to full opacity)
    $('div#rotator ul li:first').css({
        opacity: 1.0
    });

    //Call the rotator function to run the slideshow, 6000 = change to next image after 6 seconds
    setInterval('rotate()',6000);

}
        

function rotate() {
    //Get the first image
    var current = ($('div#rotator ul li.show')?  $('div#rotator ul li.show') : $('div#rotator ul li:first'));

    //Get next image, when it reaches the end, rotate it back to the first image
    var next = ((current.next().length) ? ((current.next().hasClass('show')) ? $('div#rotator ul li:first') :current.next()) : $('div#rotator ul li:first'));

    //Set the fade in effect for the next image, the show class has higher z-index
    next.css({
        opacity: 0.0
    })
    .addClass('show')
    .animate({
        opacity: 1.0
    }, 1000);

    //Hide the current image
    current.animate({
        opacity: 0.0
    }, 1000)
    .removeClass('show');

};


