// add images to slideshow
function onBefore(curr, next, opts) {
    if (opts.addSlide) // <-- important!
        while(stack.length)
            opts.addSlide(stack.shift()); 
};

$(document).ready(function() {
        
    $('#search input.text').blur(function() {
        if($(this).attr("value")=="")
            $(this).attr("value","zadejte hledaný text ...");
    });

    $('#search input.text').click(function() {
        $(this).attr("value","");
    });
        
    $('.newsMail form div.email input').blur(function() {
        if($(this).attr("value")=="")
            $(this).attr("value","Zde zadejte Váš e-mail");
    });
	
	$('.newsMail form div.jmeno input').blur(function() {
        if($(this).attr("value")=="")
            $(this).attr("value","Zde zadejte Váše jméno");
    });
    
    $('.newsMail form div.text input').click(function() {
        $(this).attr("value","");
    });

    $(function() {
        var stack = [];
        // preload images into an array
    	$('#slideshow img:first').fadeIn(1000, function() {
          $("#slideshow").cycle({
              timeout: 5000,
              speed:   1000,
              pager:  '#foto-nav',
              before:  onBefore
          });
        });
        // add images to slideshow
        function onBefore(curr, next, opts) {
            if (opts.addSlide) // <-- important!
                while(stack.length)
                    opts.addSlide(stack.shift()); 
        };
    });
 var date_now = new Date();
var date_now_1 = new Date();
var date_now_2 = new Date();
var date_now_3 = new Date();
var date_now_4 = new Date();
var date_now_5 = new Date();
var date_now_6 = new Date();

date_now_1.setDate(date_now_1.getDate()+1);
date_now_2.setDate(date_now_2.getDate()+2);
date_now_3.setDate(date_now_3.getDate()+3);
date_now_4.setDate(date_now_4.getDate()+4);
date_now_5.setDate(date_now_5.getDate()+5);
date_now_6.setDate(date_now_6.getDate()+6);

date_now = date_now.format("m-d-yyyy");
date_now_1 = date_now_1.format("m-d-yyyy");
date_now_2 = date_now_2.format("m-d-yyyy");
date_now_3 = date_now_3.format("m-d-yyyy");
date_now_4 = date_now_4.format("m-d-yyyy");
date_now_5 = date_now_5.format("m-d-yyyy");
date_now_6 = date_now_6.format("m-d-yyyy");

$("table.soucasnytyden tbody tr").addClass('hide');
$("table.soucasnytyden tbody tr."+date_now).removeClass();
$("table.soucasnytyden tbody tr."+date_now_1).removeClass();
$("table.soucasnytyden tbody tr."+date_now_2).removeClass();
$("table.soucasnytyden tbody tr."+date_now_3).removeClass();
$("table.soucasnytyden tbody tr."+date_now_4).removeClass();
$("table.soucasnytyden tbody tr."+date_now_5).removeClass();
$("table.soucasnytyden tbody tr."+date_now_6).removeClass();
/*	$('a[rel*=lightbox]').lightBox(); // Select all links that contains lightbox in the attribute rel */
    
});  

