/*
      CK BRENNA WEB javascripts - Nothing interesting to see
      ====================================================
      Author: Martin Havelka <base@arnoost.com>
      WWW: http://www.arnoost.com
      WWW: http://www.brenna.cz
*/
/*
    otevirani single obrazku (mapy apod)
*/
jQuery(document).ready(function() {
	    $("a.single").fancybox({
			'zoomSpeedIn'		: 600,
			'zoomSpeedOut'	    : 500,
			'easingIn'		    : 'easeOutBack',
			'easingOut'		    : 'easeInBack',
                  'padding'	          : 0,
			'titleShow'		    : true,
			'titlePosition'	    : 'over',
                  'margin'	          : 0
	    });

	    $("a.group").fancybox({
			'speedIn'		    :	400, 
			'speedOut'		    :	200,
			'titleShow'		    : true,
			'titlePosition'	    : 'over',
                  'padding'	          : 0,
                  'margin'	          : 0
	    });

	    $(".check").fancybox({
			'transitionIn'	    : 'none',
			'transitionOut'	    : 'none',
			'autoScale'     	    : false,
			'type'			: 'iframe',
			'width'			: 500,
			'height'		    : 300,
			'titleShow'		    : true,
			'titlePosition'	    : 'over',
			'hideOnOverlayClick'    : false
	    });

	    $(".manual").fancybox({
			'transitionIn'	    : 'none',
			'transitionOut'	    : 'none',
			'autoScale'     	    : false,
			'type'			    : 'iframe',
			'width'			    : 700,
			'height'		    : 450,
			'titleShow'		    : true,
			'titlePosition'	    : 'inside',
			'hideOnOverlayClick'    : false,
                  'padding'	          : 0,
                  'margin'	          : 0
	    });
        
	    var dates = $( "#departuredate, #departuredatetill" ).datepicker({
			  defaultDate: "+1w",
			  //changeMonth: true,
			  numberOfMonths: 2,
			  showButtonPanel: true,
			  firstDay: 1,
			  currentText: "Dnes",
			  closeText: "Zavřít",
			  monthNames: ['Leden','Únor','Březen','Duben','Květen','Červen','Červenec','Srpen','Září','Říjen','Listopad','Prosinec'],
			  dayNamesMin: ['Ne', 'Po', 'Út', 'St', 'Čt', 'Pa', 'So'],
			  dateFormat: 'dd.mm.yy',
			  onSelect: function( selectedDate ) {
					var option = this.id == "departuredate" ? "minDate" : "maxDate",
						    instance = $( this ).data( "datepicker" ),
						    date = $.datepicker.parseDate(
								  instance.settings.dateFormat ||
								  $.datepicker._defaults.dateFormat,
								  selectedDate, instance.settings );
					dates.not( this ).datepicker( "option", option, date );
			  }
		  });
	    });

/*
	scrool obrazky na detailu hotelu
*/
$(document).ready(function() {                
        // execute your scripts when the DOM is ready. this is mostly a good habit
        // initialize scrollable
        $(".scrollable").scrollable();
        });

/*
    tooltips
*/
$(function() {
	    $('.east').tipsy({gravity: 'e'});
	    $('.south').tipsy({gravity: 'n'});
	    $('.west').tipsy({gravity: 'w'});
	    });

/*
        popup Window na stred
        Kalkulace klasika, help vzhledavac
*/
function popupCenter(pageURL,title,w,h) {
	    var left = (screen.width/2)-(w/2);
	    var top = (screen.height/2)-(h/2);
	    var targetWin = window.open(pageURL, title,'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left); targetWin.focus();
	    }
	    
/*
	    country tabs
*/

$(document).ready(function() {

	    //When page loads...
	    $(".tab_content").hide(); //Hide all content
	    $("ul.tabs li:first").addClass("active").show(); //Activate first tab
	    $(".tab_content:first").show(); //Show first tab content
    
	    //On Click Event
	    $("ul.tabs li").click(function() {
    
			  $("ul.tabs li").removeClass("active"); //Remove any "active" class
			  $(this).addClass("active"); //Add "active" class to selected tab
			  $(".tab_content").hide(); //Hide all tab content
	  
			  var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
			  $(activeTab).fadeIn(); //Fade in the active ID content
			  return false;
	    });
});

$(document).ready(function() {

	    //When page loads...
	    $(".tab_content").hide(); //Hide all content
	    $("ul.smalltabs li:first").addClass("active").show(); //Activate first tab
	    $(".tab_content:first").show(); //Show first tab content
    
	    //On Click Event
	    $("ul.smalltabs li").click(function() {
    
			  $("ul.smalltabs li").removeClass("active"); //Remove any "active" class
			  $(this).addClass("active"); //Add "active" class to selected tab
			  $(".tab_content").hide(); //Hide all tab content
	  
			  var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
			  $(activeTab).fadeIn(); //Fade in the active ID content
			  return false;
	    });
});

/*
          home image slider
*/
$(function(){
          $('#slides').slides({
                    preload: true,
			  preloadImage: '/_design/layout/loading.gif',
                    play: 5000,
                    pause: 2500,
                    hoverPause: true
                    });
          });

/*
          home image slider
*/
$(function(){
          $('#responses').slides({
                    preload: false,
			  preloadImage: '/_design/layout/loading.gif',
                    autoHeight: true,
                    generatePagination: false
                    });
          });

/*
          fake loading
*/
$(function() {
    $("#frmreza").submit(function() {
        $(":submit").replaceWith('<img src="../_design/layout/loading.gif" id="loading" alt="loading" />');
    });
});
