﻿/**
 *
 *
 * @author		@-SatNet
 * @copyright		Copyright (c) 2008, @-SatNet Arkadiusz Stasiak <www.e-SatNet.pl>
 *
 */

  /** ObsĹ�uga j. polskiego moduĹ�: Date picker */
jQuery(function($){
        $.datepicker.regional['pl'] = {
                clearText: 'Wyczyść', clearStatus: 'Wyczyść obecną datę',
                closeText: 'Zamknij', closeStatus: 'Zamknij bez zapisywania',
                prevText: '', prevStatus: 'Pokaż poprzedni miesiąc',
                prevBigText: '', prevBigStatus: '',
                nextText: '', nextStatus: 'Pokaż następny miesiąc',
                nextBigText: '&#x3e;&#x3e;', nextBigStatus: '',
                currentText: 'Dziś', currentStatus: 'Pokaż aktualny miesiąc',
                monthNames: ['Styczeń','Luty','Marzec','Kwiecień','Maj','Czerwiec',
                'Lipiec','Sierpień','Wrzesień','Październik','Listopad','Grudzień'],
                monthNamesShort: ['Sty','Lu','Mar','Kw','Maj','Cze',
                'Lip','Sie','Wrz','Pa','Lis','Gru'],
                monthStatus: 'Pokaż inny miesiąc', yearStatus: 'Pokaż inny rok',
                weekHeader: 'Tydz', weekStatus: 'Tydzień roku',
                dayNames: ['Niedziela','Poniedzialek','Wtorek','Środa','Czwartek','Piątek','Sobota'],
                dayNamesShort: ['Nie','Pn','Wt','Śr','Czw','Pt','So'],
                dayNamesMin: ['N','Pn','Wt','Śr','Cz','Pt','So'],
                dayStatus: 'Ustaw DD jako pierwszy dzień tygodnia', dateStatus: 'Wybierz D, M d',
                dateFormat: 'yy-mm-dd', firstDay: 1, 
                initStatus: 'Wybierz datę', isRTL: false};
                if(lazienkowski_lang == "polski") { $.datepicker.setDefaults($.datepicker.regional['pl']); }
});

  $(document).ready(function(){
    $('.kalendarz-js').datepicker({ dateFormat: "dd.mm.yy", yearRange: "-0:01", minDate: "0y"});
  });
  
    $(document).ready(function(){
    $(".block").draggable();
  });
  
      function valer() {
    var validatora = $("#reservation").validate({
	  errorPlacement: function(error, element) { error.appendTo( element.parent("input") ); },
    rules: {
      imie: "required",
      nazwisko: "required",
      data_przyjazdu: "required",
      data_wyjazdu: "required",
      numer: { required: true, number: true },
      email: { required: true, email: true }
    }
	});
	validatora.form();
if ( validatora.form() ) { PobierzDodatki(''); Krok(2); }
}


		function Oblicz() {

			var p = $("#data_przyjazdu").val();
			var w = $("#data_wyjazdu").val();
			var pp = $("#pokoj").val();
			var r = $("#rabat").val();
		
			

			$.post(base_url+"pl/panel/Oblicz_do_zaplaty", { przyjazd: p, wyjazd: w, pokoj: pp, rabat: r },
  function(data){
    var do_zaplaty = data;
    var d = $("#dodatki").text();
    if(d == "") { var d = 0} 
    var suma = parseFloat(data)+parseFloat(d);
   		$("#kwota_do_zaplaty").text(suma+" zł");
  });

	}
	
	
	function PobierzDodatki(u) {
	
	 			var pp = $("#pokoj").val();
	 			
	$.post(base_url+"pl/ajax/DodatkiDlaPokoju/"+pp, { pokoj: pp },
  function(data){
   $("#dodatki_block").html(data);
  });
	 			
  
  }
  
  
  		function Krok(i) {

      if(i == "3") {
          	$("#step_2").hide('slow');
            $("#step_3").show('slow');
      }
			if(i == "2") {

				$("#step_1").hide('slow');
				$("#step_2").show('slow');

			}


			if(i == "1") {

				$("#step_2").hide('slow');
				$("#step_1").show('slow');

			}
		}
		
		
function ZlozNowaRezerwacje(u) {

  var imie = $("#imie").val();
	var nazwisko = $("#nazwisko").val();
	var numer = $("#numer").val();
	var email = $("#email").val();
	var data_przyjazdu = $("#data_przyjazdu").val();
	var data_wyjazdu = $("#data_wyjazdu").val();
	var pokoj = $("#pokoj").val();
	var preferencje = $("#preferencje").val();
	var uwagi = $("#uwagi").val();
	var rabat = $("#rabat").val();
	var dodatek = $("#dodatek").val();
	
	if(lazienkowski_lang == "english") { var op = 'en/'; } else { var op = 'pl/'; }
	
		$.post(u+op+"panel/Nowa_Rezerwacja", { imie: imie, nazwisko: nazwisko, numer: numer, email: email, data_przyjazdu: data_przyjazdu, data_wyjazdu: data_wyjazdu, pokoj: pokoj, preferencje: preferencje, uwagi: uwagi, rabat: rabat, dodatek: dodatek },
  function(data){
          if(data == "ok") {
                if(lazienkowski_lang == "english") {
                  $("#step_3").html('<h2 style="text-align: center; width: auto; margin:0; ">Reservations made correctly!</h2>');
                
                  } else {
                  
                  $("#step_3").html('<h2 style="text-align: center; width: auto; margin:0; ">Dziękujemy za skorzystanie z rezerwacji on-line.<br />Pracownik recepcji skontaktuje się z Państwem telefonicznie bądź e-mailowo w celu potwierdzenia rezerwacji</h2>');
                  
                  }
         }
  });
}


jQuery.easing.easeOutQuart = function (x, t, b, c, d) {
	return -c * ((t=t/d-1)*t*t*t - 1) + b;
};
jQuery(function( $ ){
	/**
	 * Most jQuery.serialScroll's settings, actually belong to jQuery.ScrollTo, check it's demo for an example of each option.
	 * @see http://flesler.demos.com/jquery/scrollTo/
	 * You can use EVERY single setting of jQuery.ScrollTo, in the settings hash you send to jQuery.serialScroll.
	 */
	
	/**
	 * The plugin binds 6 events to the container to allow external manipulation.
	 * prev, next, goto, start, stop and notify
	 * You use them like this: $(your_container).trigger('next'), $(your_container).trigger('goto', [5]) (0-based index).
	 * If for some odd reason, the element already has any of these events bound, trigger it with the namespace.
	 */		
	
	/**
	 * IMPORTANT: this call to the plugin specifies ALL the settings (plus some of jQuery.ScrollTo)
	 * This is done so you can see them. You DON'T need to specify the commented ones.
	 * A 'target' is specified, that means that #screen is the context for target, prev, next and navigation.
	 */
	$('#subcontent').serialScroll({
		target:'#sections',
		items:'li', // Selector to the items ( relative to the matched elements, '#sections' in this case )
		prev:'input#oferta_wstecz',// Selector to the 'prev' button (absolute!, meaning it's relative to the document)
		next:'input#oferta_dalej',// Selector to the 'next' button (absolute too)
		axis:'xy',// The default is 'y' scroll on both ways
		navigation:'#navigation li a',
		duration:700,// Length of the animation (if you scroll 2 axes and use queue, then each axis take half this time)
		force:true, // Force a scroll to the element specified by 'start' (some browsers don't reset on refreshes)
		
		//queue:false,// We scroll on both axes, scroll both at the same time.
		//event:'click',// On which event to react (click is the default, you probably won't need to specify it)
		//stop:false,// Each click will stop any previous animations of the target. (false by default)
		//lock:true, // Ignore events if already animating (true by default)		
		//start: 0, // On which element (index) to begin ( 0 is the default, redundant in this case )		
		//cycle:true,// Cycle endlessly ( constant velocity, true is the default )
		//step:1, // How many items to scroll each time ( 1 is the default, no need to specify )
		//jump:false, // If true, items become clickable (or w/e 'event' is, and when activated, the pane scrolls to them)
		//lazy:false,// (default) if true, the plugin looks for the items on each event(allows AJAX or JS content, or reordering)
		//interval:1000, // It's the number of milliseconds to automatically go to the next
		//constant:true, // constant speed
		
		onBefore:function( e, elem, $pane, $items, pos ){
			/**
			 * 'this' is the triggered element 
			 * e is the event object
			 * elem is the element we'll be scrolling to
			 * $pane is the element being scrolled
			 * $items is the items collection at this moment
			 * pos is the position of elem in the collection
			 * if it returns false, the event will be ignored
			 */
			 //those arguments with a $ are jqueryfied, elem isn't.
			e.preventDefault();
			if( this.blur )
				this.blur();
		},
		onAfter:function( elem ){
			//'this' is the element being scrolled ($pane) not jqueryfied
		}
	});
});


function windowOpener(windowHeight, windowWidth, windowName, windowUri)
{
    var centerWidth = (window.screen.width - windowWidth) / 2;
    var centerHeight = (window.screen.height - windowHeight) / 2;

    newWindow = window.open(windowUri, windowName, 'resizable=0,width=' + windowWidth + 
        ',height=' + windowHeight + 
        ',left=' + centerWidth + 
        ',top=' + centerHeight);

    newWindow.focus();
    return newWindow.name;
}


function Mapa(u) {
windowOpener("330", "400", "", u);
}

function GenerujZdjecia() {
    var nnnitem =  Math.floor(Math.random() * 3);
    $.get(base_url+"pl/ajax/losowezdjecia/"+nnnitem, function(data){
    $("div#ajax_zdjecie_"+nnnitem).html(data);
  })

    }
    
    setInterval("GenerujZdjecia();", 3500);




