$("document").ready(function() {
	
    $.preloadCssImages();
	
    theRotator();
    $('div.rotator').fadeIn(200);
    $('div.rotator ul li').fadeIn(200);
	
	
    $('#flags a:not(".active")').fadeTo(1,0.65);
	
    $('#flags a').mouseover(function () {
        $(this).stop(true,true).fadeTo("normal",1);
    });
    $('#flags a:not(".active")').mouseout(function () {
        $(this).stop(true,true).fadeTo("normal",0.65);
    });
	
    $('#menu a').hover(
        function () {
            $(this).stop(true,true).animate({
                marginLeft: "36px",
                color:"#867a74"
            }, 200 );
        },
        function () {
            $(this).stop(true,true).animate({
                marginLeft: "30px",
                color:"#534741"
            }, 200 );
        }
        );
	
    $('a.gallery_menu').mouseover(function () {
        $(this).stop(true,true).fadeTo("slow",1);
        $(this).stop(true,true).fadeTo("slow",0.75);
        $(this).find('span').stop(true,true).animate({
            marginLeft: "20px",
            color:"#fff"
        }, 200 );
    });
    $('a.gallery_menu').mouseout(function () {
        $(this).stop(true,true).fadeTo("slow",1);
        $(this).find('span').stop(true,true).animate({
            marginLeft: "6px",
            color:"#b88953"
        }, 200 );
    });
});




/******************************* image Rotator **************************************/

function theRotator() {
    $('div.rotator ul li').css({
        opacity: 0.0
    });
    $('div.rotator ul li:first').css({
        opacity: 1.0
    });
    setInterval('rotate()',7000);
}

function rotate() {	
    var current = ($('div.rotator ul li.show')?  $('div.rotator ul li.show') : $('div.rotator ul li:first'));
    if ( current.length == 0 ) current = $('div.rotator ul li:first');
    var next = ((current.next().length) ? ((current.next().hasClass('show')) ? $('div.rotator ul li:first') :current.next()) : $('div.rotator ul li:first'));

    next.css({
        opacity: 0.0
    })
    .addClass('show')
    .animate({
        opacity: 1.0
    }, 5000);
    current.animate({
        opacity: 0.0
    }, 5000)
    .removeClass('show');
	
};

$(function() {
    $('#galery_image_list a').lightBox();
});

$(function() {
    $('#juraj_zsok a').lightBox();
});

