 var interval = 6000;                    //rychlost s jakou se meni obrazky
            
function zobrazFace(_id)
{
    var div = "#_js_face_" + _id;
    var menu = "#_js_menu_" + _id;
    $(div).show();
    $(menu).show();
    //$(menu).show();
                        
}
function skryjFace(_id)
{
    var div = "#_js_face_" + _id;
    var menu = "#_js_menu_" + _id;
    $(div).hide();
    $(menu).slideUp("fast");
    //$(menu).hide();
}
                    
function vymenObrazek(_id)
{
    var div = "#_js_main_img_" + _id;
                        
    $("._js_main_img").css("z-index","1");
    $(div).css("z-index","10");
}
                    
function galleryShowHideOver()
{
    $("#_js_main_img").show();          //zobrazeni obrazku
    $("#_js_gallery").hide();           //skryti galerie
    clearInterval(refreshIntervalId);   //zastaveni casovace
}
function galleryShowHideOut()
{
    $("#_js_gallery").show();                           //zobrazeni galerie
    $("#_js_main_img").hide();                          //skryti obrazku
    refreshIntervalId = setInterval('gallery()', interval);  //spusteni slideru
}
                    
                    
//automaticka vymena obrazku
                    
$(document).ready(function() {		
	
    //Execute the slideShow
    slideShow();

});

//idecko timeru
var refreshIntervalId;

function slideShow() {

    //Set the opacity of all images to 0
    $('#_js_gallery a').css({
        opacity: 0.0
    });

    //Get the first image and display it (set it to full opacity)
    $('#_js_gallery a:first').css({
        opacity: 1.0
    });

    //Call the gallery function to run the slideshow, 6000 = change to next image after 6 seconds
   refreshIntervalId = setInterval('gallery()',interval);

}

function gallery() {

    //if no IMGs have the show class, grab the first image
    var current = ($('#_js_gallery a.show')?  $('#_js_gallery a.show') : $('#_js_gallery a:first'));
    
    //Get next image, if it reached the end of the slideshow, rotate it back to the first image
    var next = ((current.next().length) ? ((current.next().hasClass('caption'))? $('#_js_gallery a:first') :current.next()) : $('#_js_gallery a:first'));	

    //Set the fade in effect for the next image, show class has higher z-index
    next.css({
        opacity: 0.0
        })
        .addClass('show')
            .animate({
                opacity: 1.0
            }, 2000);

    //Hide the current image
    current.animate({
        opacity: 0.0
        }, 2000)
            .removeClass('show');


}


function info()
{
    //if no IMGs have the show class, grab the first image
    var current = ($('#_js_info div.show')?  $('#_js_info div.show') : $('#_js_info div:first'));
    
    //Get next image, if it reached the end of the slideshow, rotate it back to the first image
    var next = ((current.next().length) ? ((current.next().hasClass('caption'))? $('#_js_info div:first') :current.next()) : $('#_js_info div:first'));	

    //Set the fade in effect for the next image, show class has higher z-index
    next.css({
        opacity: 0.0
        })
        .addClass('show')
            .animate({
                opacity: 1.0
            }, 2000);

    //Hide the current image
    current.animate({
        opacity: 0.0
        }, 2000)
            .removeClass('show');
}
