/**
 * 19:56 23td apríl 2010
 *
 * general.js
 *
 * by Branislav Zvolensky
 */

// jQuery code
jQuery(document).ready(function($){
   // Error and Flash Messages
   $('div.flash-errors').delay(5000).fadeOut('slow');
   $('div.flash-messages').delay(5000).fadeOut('slow');
   
   // DELETE Confirmation
   $('a.delete').click(function(){
     var redirect = $(this).attr('href');
	 if(confirm('Ste si istý? Táto operácia je nezvratná!')){
	    self.location = redirect;
	 }
	 else{
	    return false;
	 }
   });
   
   /*
    * Following code set the same height to div #sidebar1 and div #mainContent
	* Uncomment if you want it applied
	*/
	/*
	var sidebarLeftHeight = $('#sidebar1').height();
	var sidebarRightHeight = $('#sidebar2').height();
	var contentHeight = $('#mainContent').height();
	if(contentHeight > sidebarLeftHeight){
	  $('#sidebar1').height(contentHeight);
	}
	if(contentHeight > sidebarRightHeight){
	  $('#sidebar2').height(contentHeight);
	}
	*/
   
   
   //Gallery page hacks Fancybox
   $("a.gallery_elements").fancybox();
   
   // navBar hover
   $('div.menu-nav-bar .menu-item').mouseover(function(){
     $(this).addClass('hover');
   });
   
   $('div.menu-nav-bar .menu-item').mouseout(function(){
     $(this).removeClass('hover');
   });
   
   
   //Carousel
   $(function() {
    $(".content-gallery").jCarouselLite({
        btnNext: ".next",
        btnPrev: ".prev",
        vertical: true,
		scroll: 3,
		auto: 5000,
		speed: 1000
    });
   });
   
   // Date picker
   $(function() {
		$("input[name=date]").datepicker();
		$("input[name=date_from]").datepicker();
		$("input[name=date_to]").datepicker();
	});

});
