$(function() {
	// Use this example, or...
	//$('a[@rel*=lightbox]').lightBox(); // Select all links that contains lightbox in the attribute rel
	// This, or...
	//$('#gallery a').lightBox(); // Select all links in object with gallery ID
	// This, or...
	$('a.lightbox').lightBox(); // Select all links with lightbox class
	// This, or...
	//$('a').lightBox(); // Select all links in the page
	// ... The possibility are many. Use your creative or choose one in the examples above
});
$(document).ready(function() {
 //   $('.datepicker').datepicker({inline: true});
//    $('.datepicker').datepicker();
    $('div.flash').click(function() {
        $(this).fadeOut(700)
    });

    $('input[title]').each(function() {
        if($(this).val() === '') {
            $(this).val($(this).attr('title'));
        }

        $(this).focus(function() {
            if($(this).val() === $(this).attr('title')) {
                $(this).val('').addClass('focused');
            }
        });

        $(this).blur(function() {
            if($(this).val() === '') {
                $(this).val($(this).attr('title')).removeClass('focused');
            }
        });
    });

    $('div.add').hide();
    $('a.add').toggle(
        function() {
            $(this).next().slideDown();
            return false;
        },

        function() {
            $(this).next().slideUp();
            return false;
        }
    );

    $('#reportError').dialog({
        autoOpen: false,
        height: 400,
        width: 500,
        modal: true,
        title: 'Nahlásit chybu'
    })
    $('#myButton').click(function(e) {
          e.preventDefault();
	  $('#myModal').reveal();
     })
    $( "#accordion" ).accordion({
	autoHeight: false,
	navigation: true
    })
	

    $('a.report').click(function() {
        $('#reportError').dialog('open');
    });


});

$(window).load(function() {
var total = $('#slider img').length;
var rand = Math.floor(Math.random()*total);
	$('#slider').nivoSlider({
    startSlide:rand,
	effect:'fade',
	animSpeed:500,
	pauseTime:5000,
	controlNavThumbs:false,
	captionOpacity: 0.9,
	controlNav:false,
	directionNavHide:false,
	directionNav:false
});


});

$('#myModal').reveal({
     animation: 'fadeAndPop',                   //fade, fadeAndPop, none
     animationspeed: 300,                       //how fast animtions are
     closeonbackgroundclick: true,              //if you click background will modal close?
     dismissmodalclass: 'close-reveal-modal'    //the class of a button or element that will close an open modal
});




