	//A lefoglalt CheckIn és checkOut dátumok
	var _CheckInDate;
	var _CheckOutDate;    
	
	//Aktuális hónapok nevei
	var _StepCheckInMonthName;
	var _StepCheckOutMonthName;
	
	//Léptetés változói
	var _StepCheckInYear;
	var _StepCheckInMonth;
	var _StepCheckOutYear;
	var _StepCheckOutMonth;
	
	//Hibaüzenetek
	var _MsgThisDayIsFull;
	var _AlertExistFullDay;
	var _AlertEmptyField;
	var _AlertEmptyFields;
	var _AlertWrongNumberFormat;
	var _AlertWrongEmailFormat;
	var _AlertWrongPhoneFormat;
	var _AlertToShortPhone;
	var _AlertMissingBoardType;
	var _AlertBothBookedDateNeed;
	var _AlertNoDataSaveDecl;
	var _AlertNoPassingDate;
	var _AlertNoPassingBoardType;
	var _AlertNoPassingNightNumber;
	var _AlertOverSessionRange;
	var _NightNumberTitle;
	var _DateTitleFormat;
	
	//Foglalási és ajánlatkérő paraméterek
	var _ReserveParameters = "";
	var _MiniFormParameters = "";
		
	//Aktuális év és hónap
	var _ThisYear;
	var _ThisMonth;	
	
	//Aktuálisan kiválasztott ajánlat
	var _ActActionID = 'ActionsLi0';
	var _ActParking = 'ParkingLi0';
	
	//SetTimeOut változója
	var timeoutID;	
	
	$(document).ready(function() 
	{	
		$('#CheckInPrevMonth').css('display','inline');
		$('#CheckOutPrevMonth').css('display','inline');
		
		var date = new Date();
		
		_ActActionID = ($('.actions_li_active')[0] != null) ? $('.actions_li_active').attr('id') : 'ActionsLi0'; 
	
		_StepCheckInYear = _ThisYear = date.getFullYear();
		_StepCheckInMonth = _ThisMonth = date.getUTCMonth() + 1;		
	
		date.setDate(date.getDate()+3);
		_StepCheckOutYear = date.getFullYear();
		_StepCheckOutMonth = date.getUTCMonth() + 1;	

		_MsgThisDayIsFull = GetSettings('HomeSiteSettings', 'FullDayDesc');
		_AlertExistFullDay = GetPageSettings('SiteReserveForm', 'ExistFullDate');
		_AlertBothBookedDateNeed = GetPageSettings('SiteReserveForm', 'BothBookedDateNeed');
		_AlertEmptyFields = GetPageSettings('SiteReserveForm', 'AlertEmptyInputFields');
		_AlertWrongNumberFormat =  GetPageSettings('SiteReserveForm', 'AlertWrongNumberFormat');
		_NightNumberTitle =  GetPageSettings('SiteReserveForm', 'NightNumberTitle');
		_DateTitleFormat =  GetPageSettings('SiteReserveForm', 'DateTitleFormat');
	
		_CheckInDate = GetBookedDate('CheckInDate', true);
		_CheckOutDate = GetBookedDate('CheckOutDate', true);
		
		CalendarSettings(true,true);
		
		$('#BtnReserveMiniForm').click(function(){
			if (CheckMiniFormFields()) {
				$.ajax({
					type: 'GET',
					url: AjaxURL+"&action=set_miniform_data"+_MiniFormParameters+"&langid="+_PublicLanguageMenuId,
					success: function() {
						JumpToPricePage();
					}
				})					
			}
		});
			
		//ha létezik a vezetéknév mező, akkor a többi hibaüzenet lekérdezése 
		if ($('#CustomFields_21_3')[0] != null) 
		{
			$('#CustomFields_21_3').val(GetPublicSessionParam2('ReserveForm', 'FirstName'));
			$('#CustomFields_22_3').val(GetPublicSessionParam2('ReserveForm', 'LastName'));
			$('#CustomFields_23_3').val(GetPublicSessionParam2('ReserveForm', 'EmailAddress'));
			$('#CustomFields_26_3').val(GetPublicSessionParam2('ReserveForm', 'Country'));
			$('#CustomFields_27_3').val(GetPublicSessionParam2('ReserveForm', 'PostalCode'));
			$('#CustomFields_28_3').val(GetPublicSessionParam2('ReserveForm', 'City'));
			$('#CustomFields_29_3').val(GetPublicSessionParam2('ReserveForm', 'Street'));
			$('#CustomFields_54_3').val(GetPublicSessionParam2('ReserveForm', 'HouseNumber'));
			
			_AlertEmptyField = GetPageSettings('SiteReserveForm', 'AlertEmptyInputField');
			_AlertWrongEmailFormat =  GetPageSettings('SiteReserveForm', 'AlertWrongEmailFormat');
			_AlertWrongPhoneFormat =  GetPageSettings('SiteReserveForm', 'AlertWrongPhoneFormat');
			_AlertToShortPhone =  GetPageSettings('SiteReserveForm', 'AlertToShortPhone');
			_AlertMissingBoardType =  GetPageSettings('SiteReserveForm', 'AlertMissingBoardType');
			_AlertNoDataSaveDecl =  GetPageSettings('SiteReserveForm', 'AlertNoDataSaveDecl');
			_AlertNoPassingDate =  GetPageSettings('SiteReserveForm', 'NoPassingDate');	
			_AlertNoPassingBoardType = GetPageSettings('SiteReserveForm', 'NoPassingBoardType');
			_AlertNoPassingNightNumber =  GetPageSettings('SiteReserveForm', 'NoPassingNightNumber');
			_AlertOverSessionRange =  GetPageSettings('SiteReserveForm', 'OverSessionRange');						
				
			$('#BtnReserve').click(function(){
				SetBtnLoading('ActionButtonsContainer', true);
				if (CheckReserveFormFields()) 
				{			
					//E-mail küldése
					$.ajax({
						type: 'POST',
						url: DocumentBaseURL+"admin/index.php?page=SendEmail&action=send_reserve_form_mails",
						data: _ReserveParameters,
						error: function(response) 
						{
							SetBtnLoading('ActionButtonsContainer', false);								
						},
						success: function(response) 
						{
							//Adatok átadása a Protopmailnek
							//alert(response);
							$('#ReserveForm').submit();									
						}
					})	
				}
				else
				{
					SetBtnLoading('ActionButtonsContainer', false);
				}
			});
			
			$('#BtnRequest').click(function(){
				SetBtnLoading('ActionButtonsContainer', true);
				if (CheckReserveFormFields()) 
				{
					//E-mail küldése
					$.ajax({
						type: 'POST',
						url: DocumentBaseURL+"admin/index.php?page=SendEmail&action=send_request_form_mails",
						data: _ReserveParameters,
						error: function(response) 
						{
							SetBtnLoading('ActionButtonsContainer', false);								
						},
						success: function() 
						{						
							//Adatok átadása a Protopmailnek
							$('#RequestForm').submit();								
						}
					})	
				}
				else
				{
					SetBtnLoading('ActionButtonsContainer', false);
				}
			});
		}
		
		
		if ($('#DataDeclaration')[0] != null) 
		{
			$('#DataDeclaration').click(function(){
				ShowDataDeclaration();
			});
		}
		
				
		/*
		* Ajánlatkérésnél, vagy foglalásnál a lenyíló lista vezérlése - parkolás
		*/
		if ($('.parking_li_inactive')[0] != null) 
		{
			$('.parking_li_inactive').mouseover(function(){
				if ($(this).attr('class') != 'parking_li_selected') $(this).attr('class','parking_li_active');
			});
			$('.parking_li_inactive').mouseout(function(){
				if ($(this).attr('class') != 'parking_li_selected') $(this).attr('class','parking_li_inactive');
			});	
			
			$('.field_inp_parking').click(function() {
				parkingUlClass = ($('.parking_ul').css("display") == "block") ? "none" : "block";
				$('.parking_ul').css("display",parkingUlClass);								
			});	
			
			$('.parking_ul').mouseleave(function(){
				$('.parking_ul').css("display","none");	
			});					
				
			$('.parking_li_inactive').click(function() {			
				var thisID = $(this).attr('id');
				
				_ActParking = thisID;
				
				$('.parking_li_selected').attr('class','parking_li_inactive');
					
				$('#'+thisID).attr('class','parking_li_selected');
				
				parkingUlClass = ($('.parking_ul').css("display") == "block") ? "none" : "block";
				$('.parking_ul').css("display",parkingUlClass);																	
				
				$('.field_inp_parking').html($('#'+thisID).html());
			});
			
			
			/*
			* Ajánlatkérésnél, vagy foglalásnál a lenyíló lista vezérlése - akciós ajánlat
			*/		
			$('.actions_li_active').click(function() {
				actionsUlClass = ($('.actions_ul').css("display") == "block") ? "none" : "block";
				$('.actions_ul').css("display",actionsUlClass);	
			});
			
			$('.actions_li_inactive').mouseover(function(){
				if ($(this).attr('class') != 'actions_li_selected') $(this).attr('class','actions_li_active');
			});
			$('.actions_li_inactive').mouseout(function(){
				if ($(this).attr('class') != 'actions_li_selected') $(this).attr('class','actions_li_inactive');
			});	
			
			$('.field_inp_actions').click(function() {
				actionsUlClass = ($('.actions_ul').css("display") == "block") ? "none" : "block";
				$('.actions_ul').css("display",actionsUlClass);								
			});	
			
			$('.actions_ul').mouseleave(function(){
				$('.actions_ul').css("display","none");	
			});					
				
			$('.actions_li_inactive,#ActionsLi0').click(function() 
			{	
					
				var thisID = $(this).attr('id');
				
				_ActActionID = thisID;
				
				$('.actions_li_selected').attr('class','actions_li_inactive');
					
				$('#'+thisID).attr('class','actions_li_selected');
				
				actionsUlClass = ($('.actions_ul').css("display") == "block") ? "none" : "block";
				$('.actions_ul').css("display",actionsUlClass);																	
				
				$('.field_inp_actions').html($('#'+thisID).html());
				
				ActID = _ActActionID.replace("ActionsLi", "");
				SetBenefitTitleAndHidField(ActID);
				
				AutoChekOutDate();
			});
			
			$('.actions_li_active').click(function() {
				actionsUlClass = ($('.actions_ul').css("display") == "block") ? "none" : "block";
				$('.actions_ul').css("display",actionsUlClass);	
			});	
		}
		
		if ($('#BoardType1').attr('checked') == false || $('#BoardType2').attr('checked') == false || $('#BoardType3').attr('checked') == false)
		{
			$('#BoardType2').attr('checked', 'true');
		}
				
	}); //END function $(document).ready
	
	
	
	
	//Minden léptetéskor, illetve induláskor az alapbeállítsok meghívása
	function CalendarSettings(checkincal, checkoutcal) 
	{	
		_StepCheckInMonthName =  GetSettings('HomeSiteSettings', 'Month'+((_StepCheckInMonth < 10) ? "0" : "")+_StepCheckInMonth);
		_StepCheckOutMonthName =  GetSettings('HomeSiteSettings', 'Month'+((_StepCheckOutMonth < 10) ? "0" : "")+_StepCheckOutMonth);
		
		if (checkincal)
		{
			//Ha a CheckIn naptáron valamelyik általános napra kattintunk - nem lehet foglalt nap, és nem lehet már elmúlt nap sem
			$('.calendar_day_checkin,.calendar_day_booked_checkin').click(function() {
			
				var thisID = $(this).attr('id');
				thisID = thisID.replace('_checkin', '');

				//Ha CheckIn dátuma nagyobb, mint a CheckOut dátuma - CheckOut dátum törlése
				if (parseInt(thisID) >= parseInt(_CheckOutDate) && $('.calendar_day_booked_checkout')[0] != null) 
				{
					$('.calendar_day_booked_checkout').removeClass('calendar_day_booked_checkout').addClass('calendar_day_checkout');
					DeleteBookedDate('CheckOut');
					_CheckOutDate = GetBookedDate('CheckOutDate', false);
					SetCalendarDate('', 'CheckOut');
				}
				else  //HIBA: ha a foglalási tartományban található teltházas nap
				{
					COD = GetBookedDate('CheckOutDay', false);
					COD = (COD.substr(0,1) == '0') ? COD.substr(1,1) : COD;
					
					if (parseInt(COD) != 0)
					{
						if (ExistFullDay(thisID, _CheckOutDate, 'CheckIn')) 
						{
							alert(_AlertExistFullDay);
							return;
						}
					}
				}
			
				
				//Megfelelő stílus osztályok cseréje
				if ($('.calendar_day_booked_checkin')[0] != null) {
					$('.calendar_day_booked_checkin').removeClass('calendar_day_booked_checkin').addClass('calendar_day_checkin');
				}
				$(this).removeClass('calendar_day_checkin').addClass('calendar_day_booked_checkin');
				
				//SESSION változóba helyezés
				SetCalendarDate(thisID, 'CheckIn');
				
				_CheckInDate = thisID;				
				SetBookedDate(thisID,'_checkin');
			});//END $('.calendar_day_checkin,.calendar_day_booked_checkin').click
		}
		
		if (checkoutcal)
		{
			//Ha a CheckOut naptáron valamelyik általános napra kattintunk - nem lehet foglalt nap, és nem lehet már elmúlt nap sem
			$('.calendar_day_checkout,.calendar_day_booked_checkout').click(function() {			
				
				var go = true;
				var thisID = $(this).attr('id');
				thisID = thisID.replace('_checkout', '');
				
				if (parseInt(thisID) <= parseInt(_CheckInDate)) //HIBA: ha a CheckOut dátum kisebb, mint a CheckIn dátum
				{
					$('.calendar_day_booked_checkin').removeClass('calendar_day_booked_checkin').addClass('calendar_day_checkin');
					DeleteBookedDate('CheckIn');
					_CheckInDate = GetBookedDate('CheckInDate', false);
					SetCalendarDate('', 'CheckIn');
				} 
				else  //HIBA: ha a foglalási tartományban található teltházas nap
				{
					CID = GetBookedDate('CheckInDay', false);
					CID = (CID.substr(0,1) == '0') ? CID.substr(1,1) : CID;
					
					if (parseInt(CID) != 0)
					{
						if (ExistFullDay(_CheckInDate, thisID, 'CheckOut')) {
							alert(_AlertExistFullDay);
							go = false;
						}
					}
				}
				
				
				if (go) {
					//Megfelelő stílus osztályok cseréje
					if ($('.calendar_day_booked_checkout')[0] != null) {
						$('.calendar_day_booked_checkout').removeClass('calendar_day_booked_checkout').addClass('calendar_day_checkout');
					}
					$(this).removeClass('calendar_day_checkout').addClass('calendar_day_booked_checkout');
					
					//SESSION változóba helyezés
					SetCalendarDate(thisID, 'CheckOut');
					_CheckOutDate = thisID;
					SetBookedDate(thisID,'_checkout');
					
					//Éjszakák számának a beállítása
					SetNightNumber();
				}
			});	//END $('.calendar_day_checkout,.calendar_day_booked_checkout').click
		}

		//Teltházas kiírása felugró ablakban
		$('.calendar_day_full').mouseover(function(){				
			var thisID=this.id;				

			$('<div class="HelpToolTip_Placeholder" style="font-size: 12px; color: #000; display:block; position: absolute; margin-left: 10px; margin-top: 0px; width: 240px; background-color: #FEFCD5; border: solid 1px #942625; padding: 10px;">'
				+ _MsgThisDayIsFull 
				+ '</div>').appendTo(this);
		});		
		
		$('.calendar_day_full').mouseout(function(){
			 $('div.HelpToolTip_Placeholder', this).remove();
		});			
	}//END function CalendarSettings()
	
	
	
	//CheckIn naptár havi léptetése visszafelé
	function SetCheckInPrevMonth()
	{
		if (_StepCheckInMonth == 1) {
			pMonth = 12;
			_StepCheckInMonth = 12;
			_StepCheckInYear--;
			pYear = _StepCheckInYear;							
		} else {
			_StepCheckInMonth--;
			pMonth = _StepCheckInMonth;
			pYear = _StepCheckInYear;
		}									
		
		if (_ThisYear == pYear && _ThisMonth == pMonth) {
			//$('#CheckInPrevMonth').css('display','none');
		}
		$('#CalendarStart').html(GetCalendar(pYear, pMonth, '_checkin'));
		CalendarSettings(true, false);	
		SetCalendarDate('', 'CheckIn');	
	} //END function SetCheckInPrevMonth
	


	//CheckIn naptár havi léptetése előre
	function SetCheckInNextMonth()
	{		
		if (_StepCheckInMonth == 12) {
			pMonth = 1;
			_StepCheckInMonth = 1;
			_StepCheckInYear++;
			pYear = _StepCheckInYear;							
		} 
		else {
			_StepCheckInMonth++;
			pMonth = _StepCheckInMonth;
			pYear = _StepCheckInYear;
		}									
		
		//$('#CheckInPrevMonth').css('display','inline');
		$('#CalendarStart').html(GetCalendar(pYear, pMonth, '_checkin'));
		CalendarSettings(true, false);	
		SetCalendarDate('', 'CheckIn');	
		
		//Következő hónapra léptetés a CheckOut esetében is, ha az évek és a hónapok azonosak
		if ((_StepCheckOutYear == _StepCheckInYear && _StepCheckOutMonth < _StepCheckInMonth) || (_StepCheckOutYear < _StepCheckInYear)) 
		{
			//$('#CheckOutPrevMonth').css('display','inline');
			_StepCheckOutMonth = _StepCheckInMonth;
			_StepCheckOutYear = _StepCheckInYear;
			$('#CalendarEnd').html(GetCalendar(pYear, pMonth, '_checkout'));
			CalendarSettings(false, true);
			SetCalendarDate('', 'CheckOut');
		}
	} //END function SetCheckInNextMonth

	

	//Checkout naptár havi léptetése visszafelé
	function SetCheckOutPrevMonth()
	{
		if (_StepCheckOutMonth == 1) {
			pMonth = 12;
			_StepCheckOutMonth = 12;
			_StepCheckOutYear--;
			pYear = _StepCheckOutYear;							
		} else {
			_StepCheckOutMonth--;
			pMonth = _StepCheckOutMonth;
			pYear = _StepCheckOutYear;
		}									
		
		if (_ThisYear == pYear && _ThisMonth == pMonth) {
			//$('#CheckOutPrevMonth').css('display','none');
		}
		$('#CalendarEnd').html(GetCalendar(pYear, pMonth, '_checkout'));
		CalendarSettings(false, true);	
		SetCalendarDate('', 'CheckOut');	
		
		//Előző hónapra léptetés a CheckIn esetében is, ha az évek és a hónapok azonosak
		if ((_StepCheckOutYear == _StepCheckInYear && _StepCheckOutMonth < _StepCheckInMonth) || (_StepCheckOutYear < _StepCheckInYear)) 
		{
			//$('#CheckInPrevMonth').css('display','inline');
			_StepCheckInMonth = _StepCheckOutMonth;
			_StepCheckInYear = _StepCheckOutYear;
			if (_ThisYear == pYear && _ThisMonth == pMonth) {
				//$('#CheckInPrevMonth').css('display','none');
			}			
			$('#CalendarStart').html(GetCalendar(pYear, pMonth, '_checkin'));
			CalendarSettings(true, false);
			SetCalendarDate('', 'CheckIn');
		}	
	} //END function SetCheckOutPrevMonth
	


	//CheckOut naptár havi léptetése előre
	function SetCheckOutNextMonth()
	{
		if (_StepCheckOutMonth == 12) {
			pMonth = 1;
			_StepCheckOutMonth = 1;
			_StepCheckOutYear++;
			pYear = _StepCheckOutYear;							
		} 
		else {
			_StepCheckOutMonth++;
			pMonth = _StepCheckOutMonth;
			pYear = _StepCheckOutYear;
		}									
		
		//$('#CheckOutPrevMonth').css('display','inline');
		$('#CalendarEnd').html(GetCalendar(pYear, pMonth, '_checkout'));
		CalendarSettings(false, true);	
		SetCalendarDate('', 'CheckOut');
	} //END function SetCheckOutNextMonth

	

	//Nap, hónap vagy év lekérde4zése. 
	function GetBookedDate(booked, check) 
	{
		var response = $.ajax({
			url: AjaxURL+"&action=get_booked_date&booked="+booked,
			async: false
		}).responseText;
		
		r = response.replace('\t', '');
		
		var r0 = r.substr(0,1);
		var r1 = r.substr(1,1);
		var r2 = r.substr(2,1);
		var r3 = r.substr(3,1);
		var r4 = r.substr(4,1);
		var r5 = r.substr(5,1);
				
		if (booked == 'CheckInDate' && check)
		{
			if (r != "")
			{
				chInYear = parseInt(r0 + r1 + r2 + r3);
				if (r0 + r1 + r2 + r3 != '0000')
				{
					if (_StepCheckInYear != chInYear) _StepCheckInYear = chInYear;
				}
				
				chInMonth = (r4 == '0') ? parseInt(r5) : parseInt(r4 + r5);			
				if (r4 + r5 != '00')
				{
					if (_StepCheckInMonth != chInMonth) 
					{
						_StepCheckInMonth = chInMonth;
					}
				}

			}
		}
		else if (booked == 'CheckOutDate' && check)
		{
			if (r != "")
			{		
				chOutYear = parseInt(r0 + r1 + r2 + r3);

				if (r0 + r1 + r2 + r3 != '0000')
				{
					if (_StepCheckOutYear != chOutYear) _StepCheckOutYear = chOutYear;
				}		
			
				chOutMonth = (r4 == '0') ? parseInt(r5) : parseInt(r4 + r5);
				if (r4 + r5 != '00')
				{
					if (_StepCheckOutMonth != chOutMonth) _StepCheckOutMonth = chOutMonth;
				}
			}
		}
		
		return response.replace('\t', '');		
	}//END function GetBookedDate
	
	
	
	
	//Az adott év és hónap alapján a naptár lekérdezése
	function GetCalendar(year, month, booked) 
	{
		uri =  AjaxURL+"&action=get_calendar&year="+year+"&month="+month+"&booked="+booked;

		var response = $.ajax({
			url: uri,
			async: false
		}).responseText; 
		
		//alert(response);
		return response;		
	}//END function GetCalendar
	
	
	
	
	//Az adott év és hónap alapján a naptár lekérdezése
	function SetBookedDate(bookedDate, booked) 
	{
		$.ajax({
			type: 'GET',
			url: AjaxURL+"&action=set_booked_date&bookedDate="+bookedDate+"&booked="+booked,
			success: function() {
				if (booked == '_checkin')
				{
					//Automatikus beállítása a távozási dátumnak
					AutoChekOutDate();
				}
			}
		})		
	}//END function SetBookedDate	
	



	//Az adott év és hónap alapján a naptár lekérdezése
	function DeleteBookedDate(booked) 
	{
		$.ajax({
			type: 'GET',
			url: AjaxURL+"&action=delete_booked_date&booked="+booked,
			success: function() {
			}
		})		
	}//END function DeleteBookedDate	


	
	
	//Annak vizsgálata, hogy a két dátum között van-e foglalt nap
	function ExistFullDay(checkInDate, checkOutDate, bookedType)
	{
		var response = $.ajax({
			url: AjaxURL+"&action=exist_fullday&checkin="+checkInDate+"&checkout="+checkOutDate+"&langid="+_PublicLanguageMenuId,
			async: false
		}).responseText; 
		
		return (response == 1) ? true : false;
	}//END function ExistFullDay
	
	

	//A léptető gombok közötti dátum cimke beállítása
	function SetCalendarDate(date, booked)
	{
		$('#CheckInPrevMonth').css('display','inline');
		$('#CheckOutPrevMonth').css('display','inline');
		
		y = this["_Step"+booked+"Year"]+". ";
		m = ((this["_Step"+booked+"Month"] < 10) ? "0" : "")+this["_Step"+booked+"Month"];
		mname = this["_Step"+booked+"MonthName"]+" ";

		if (date != '')
		{
			d = date.substr(6,2)+".";
		}
		else
		{
			bdate =  this["_"+booked+"Date"];
			by = date.substr(0,4);
			bm = date.substr(4,2);
			bm = date.substr(6,2);
			
			if (by == y && bm == m && bd != "00") {
				d = bdate.substr(6,2) + " ";
			} 
			else {
				d = "";
			}
		}
			
		var titleDate;
		if (_DateTitleFormat == 'ymd') {titleDate= y+mname+d;}
			else if (_DateTitleFormat == 'ydm') {titleDate= y+d+mname;}
			else if (_DateTitleFormat == 'myd') {titleDate= mname+y+d;}
			else if (_DateTitleFormat == 'mdy') {titleDate= mname+d+y;}
			else if (_DateTitleFormat == 'dym') {titleDate= d+y+mname;}
			else if (_DateTitleFormat == 'dmy') {titleDate= d+mname+y;}
			else {titleDate= y+mname+d;}
			
		$('#Calendar'+booked+'Date').html(titleDate);
	}//END function SetCalendarDate
	
		
	
	function CheckReserveFormFields()
	{ 		
		var outputStr = "";
			
		//Vezetéknév értékének ellenőrzése
		if (!CheckValueLength("CustomFields_21_3",_AlertEmptyField+" "+$('#FirstNameLabel').html())) return;
		outputStr += "&record[FirstName]='"+$('#CustomFields_21_3').val()+"'";
		
		//Keresztnév értékének ellenőrzése
		if (!CheckValueLength("CustomFields_22_3",_AlertEmptyField+" "+$('#LastNameLabel').html())) return;
		outputStr += "&record[LastName]='"+$('#CustomFields_22_3').val()+"'";
		
		//Email cím értékének és szintaktikájának ellenőrzése
		if (!CheckEmailRequired("CustomFields_23_3", _AlertEmptyField+" "+$('#EmailLabel').html(),  _AlertWrongEmailFormat)) return;
		outputStr += "&record[Email]='"+$('#CustomFields_23_3').val()+"'";
		
		//Telefonszám értékének ellenőrzése		
		//1. lépés: annak vizsgálata, hogy nem üres a mező
		if (!CheckValueLength("CustomFields_24_3",_AlertEmptyField+" "+$('#PhoneLabel').html())) return;
		//2. lépés: legalább 9 jegyűnek kell lennie, és egy gyenge szintaktikai ellenőrzés
		if (!CheckPhoneFormat("CustomFields_24_3", _AlertToShortPhone, _AlertWrongPhoneFormat)) return;
		outputStr += "&record[Phone]='"+$('#CustomFields_24_3').val()+"'";	
		
		if ($('#CustomFields_25_3').val() != '' && !CheckNumberFormat('CustomFields_25_3',_AlertWrongNumberFormat+" "+$('#FaxLabel').html())) return;
		outputStr += "&record[Fax]="+$('#CustomFields_25_3').val()+"'";	
		
		//Ország értékének vizsgálata
		//if (!CheckValueLength("CustomFields_26_3",_AlertEmptyField+" "+$('#CountryLabel').html())) return;
		outputStr += "&record[Country]='"+$('#CustomFields_26_3').val()+"'";
		
		//Irányítószám értékének vizsgálata
		//if (!CheckValueLength("CustomFields_27_3",_AlertEmptyField+" "+$('#PostalCodeLabel').html())) return;
		if ($('#CustomFields_27_3').val() != '' && !CheckNumberFormat('CustomFields_27_3',_AlertWrongNumberFormat+" "+$('#PostalCodeLabel').html())) return;
		outputStr += "&record[PostalCode]='"+$('#CustomFields_27_3').val()+"'";	
		
		//Város értékének vizsgálata
		//if (!CheckValueLength("CustomFields_28_3",_AlertEmptyField+" "+$('#CityLabel').html())) return;
		outputStr += "&record[City]='"+$('#CustomFields_28_3').val()+"'";	
		
		//Utca (cím) értékének vizsgálata
		//if (!CheckValueLength("CustomFields_29_3",_AlertEmptyField+" "+$('#StreetLabel').html())) return;
		outputStr += "&record[Street]='"+$('#CustomFields_29_3').val()+"'";
		
		//Házszám értékének vizsgálata
		//if (!CheckValueLength("CustomFields_54_3",_AlertEmptyField+" "+$('#HouseNumberLabel').html())) return;
		outputStr += "&record[HouseNumber]='"+$('#CustomFields_54_3').val()+"'";

		//Nemzetiség értékének vizsgálata
		if (!CheckValueLength("CustomFields_30_3",_AlertEmptyField+" "+$('#NationLabel').html())) return;
		outputStr += "&record[Nation]='"+$('#CustomFields_30_3').val()+"'";		
		
		//Szállás típusának ellenőrzése
		//1. lépésben: hogy legalább az egyik mező nem üres
		empty = false;
		if (
			$('#CustomFields_31_3').val() == '' && 
			$('#CustomFields_32_3').val() == '' && 
			$('#CustomFields_33_3').val() == '' && 
			$('#CustomFields_34_3').val() == '' && 
			$('#CustomFields_35_3').val() == '' && 
			$('#CustomFields_36_3').val() == '' && 
			$('#CustomFields_37_3').val() == '' && 
			$('#CustomFields_38_3').val() == '' 			
		)
		{
			alert(_AlertEmptyFields+" "+$('#RoomTypeLabel').html());
			return;
		}
		//2. lépés, amelyik mező nem üres, ott a számformátum ellenőrzése
		if ($('#CustomFields_31_3').val() != '' && !CheckNumberFormat('CustomFields_31_3',_AlertWrongNumberFormat+" "+$('#OneBedRoomLabel').html())) return;
		outputStr += "&record[OneBedRoom]='"+$('#CustomFields_31_3').val()+"'";
		if ($('#CustomFields_32_3').val() != '' && !CheckNumberFormat('CustomFields_32_3',_AlertWrongNumberFormat+" "+$('#TwoBedRoomLabel').html())) return;
		outputStr += "&record[TwoBedRoom]='"+$('#CustomFields_32_3').val()+"'";
		if ($('#CustomFields_33_3').val() != '' && !CheckNumberFormat('CustomFields_33_3',_AlertWrongNumberFormat+" "+$('#TwoBedRoomSupLabel').html())) return;
		outputStr += "&record[TwoBedRoomSup]='"+$('#CustomFields_33_3').val()+"'";
		if ($('#CustomFields_34_3').val() != '' && !CheckNumberFormat('CustomFields_34_3',_AlertWrongNumberFormat+" "+$('#ContactRoomLabel').html())) return;
		outputStr += "&record[ContactRoom]='"+$('#CustomFields_34_3').val()+"'";
		if ($('#CustomFields_35_3').val() != '' && !CheckNumberFormat('CustomFields_35_3',_AlertWrongNumberFormat+" "+$('#DisabledRoomLabel').html())) return;
		outputStr += "&record[DisabledRoom]='"+$('#CustomFields_35_3').val()+"'";
		if ($('#CustomFields_36_3').val() != '' && !CheckNumberFormat('CustomFields_36_3',_AlertWrongNumberFormat+" "+$('#ApartRoomSupLabel').html())) return;
		outputStr += "&record[ApartRoomSup]='"+$('#CustomFields_36_3').val()+"'";
		if ($('#CustomFields_37_3').val() != '' && !CheckNumberFormat('CustomFields_37_3',_AlertWrongNumberFormat+" "+$('#ApartRoomLabel').html())) return;
		outputStr += "&record[ApartRoom]='"+$('#CustomFields_37_3').val()+"'";
		if ($('#CustomFields_38_3').val() != '' && !CheckNumberFormat('CustomFields_38_3',_AlertWrongNumberFormat+" "+$('#SuiteRoomLabel').html())) return;
		outputStr += "&record[SuitRoom]='"+$('#CustomFields_38_3').val()+"'";		
		
		//Személyek számának ellenőrzése
		//1. lépés: annak ellenőrzése, hogy a Felnőtt vagy a gyermek száma ki lett-e töltve
		if ($('#CustomFields_39_3').val() == '' && $('#CustomFields_40_3').val() == '')
		{
			alert(_AlertEmptyFields+" "+$('#CountPersonsLabel').html());
			return;
		}		
		//2. lépés: a számformátumok ellenőrzése
		if ($('#CustomFields_39_3').val() != '' && !CheckNumberFormat('CustomFields_39_3',_AlertWrongNumberFormat+" "+$('#CountAdultsLabel').html())) return;
		if ($('#CustomFields_40_3').val() != '' && !CheckNumberFormat('CustomFields_40_3',_AlertWrongNumberFormat+" "+$('#CountChildrenLabel').html())) return;
		outputStr += "&record[CountChildren]='"+$('#CustomFields_40_3').val()+"'";
		outputStr += "&record[CountAdults]='"+$('#CustomFields_39_3').val()+"'";
		
		//Ha a gyermekek száma mező nem üres, akkor annak ellenőrzése, hogy gyermekek kora mező meg lett-e adva
		if ($('#CustomFields_40_3').val() != '') 
		{
			if (!CheckValueLength("CustomFields_41_3",_AlertEmptyField+" "+$('#AgeChildrenLabel').html())) return;
		}
		outputStr += "&record[AgeChildren]='"+$('#CustomFields_41_3').val()+"'";
		
		//Dátumok ellenőrzése, azaz, hogy mindkettő meg lett-e határozva
		//1. lépés - csak a kezdeti dátum ellenőrzése
		if ((_CheckInDate.substr(6,1) == '0' && _CheckInDate.substr(7,1) == '0') || (_CheckOutDate.substr(6,1) == '0' && _CheckOutDate.substr(7,1) == '0')) {
			alert(_AlertBothBookedDateNeed);
			return;
		}
			
		outputStr += "&record[CheckInDate]='"+_CheckInDate.substr(0,4)+'.'+_CheckInDate.substr(4,2)+'.'+_CheckInDate.substr(6,2)+"'";
		outputStr += "&record[CheckOutDate]='"+_CheckOutDate.substr(0,4)+'.'+_CheckOutDate.substr(4,2)+'.'+_CheckOutDate.substr(6,2)+"'";
				
		//Ellátás típusának ellenőrzése
		var BoardType = "";
		if ($('#BoardType1').attr('checked') == false && $('#BoardType2').attr('checked') == false && $('#BoardType3').attr('checked') == false) 
		{
			alert(_AlertMissingBoardType);
			$('#BoardType1').focus();
			return;
		}
		else {
			if ($('#BoardType1').attr('checked') == true) {BoardType = "b"; outputStr += "&record[BoardType]='"+$('#BoardType1').val()+"'";}
				else if ($('#BoardType2').attr('checked') == true) {BoardType = "h"; outputStr += "&record[BoardType]='"+$('#BoardType2').val()+"'";}
				else if ($('#BoardType2').attr('checked') == true) {BoardType = "f"; outputStr += "&record[BoardType]='"+$('#BoardType2').val()+"'";}
		}
		
		//Parkolás meghatározása
		$('#CustomFields_55_3').val($('#Parking').html());
		outputStr += "&record[Parking]='"+((_ActParking == "" || _ActParking == "ParkingLi0") ? 'nem' : 'igen')+"'";
		
		//Választott akció meghatározása
		$('#CustomFields_47_3').val($('#Actions').html());
		
		//Annak ellenőrzése, hogy van-e kiválasztva ajánlat.
		actionid = _ActActionID.replace(/ActionsLi/gi, '');
		outputStr += "&record[Action]=''";
		if (actionid != '0' && actionid != 'FromMenu')
		{	
			outputStr += "&record[Action]='"+$('#Actions').html()+"'";
		
			//1. lépés: Ha igen, akkor a megadott dátumok az érvényességi időszakon belül vannak-e
			var response = $.ajax({
				url: AjaxURL+"&action=check_date_range&actionid="+actionid+"&checkin="+_CheckInDate+"&checkout="+_CheckOutDate,
				async: false
			}).responseText;	

			response = response.replace("\t", "");
			
			if (response != 1) {
				alert(_AlertNoPassingDate+" "+response);
				return;
			}
			
			//2. lépés: Ha igen, akkor megadott dátumok valóban annyi éjszakát fednek le, mint amennyi az akcióban meg van adva
			var response = $.ajax({
				url: AjaxURL+"&action=check_night_number&actionid="+actionid+"&checkin="+_CheckInDate+"&checkout="+_CheckOutDate,
				async: false
			}).responseText;	

			response = response.replace("\t", "");
			
			if (response != 1) {
				alert(_AlertNoPassingNightNumber+" "+response);
				return;
			}			
			
			//3. lépés: Ha igen, akkor olyan ellátást kért-e a látogató, amilyen az ajánlathoz meg van jelölve
			var response = $.ajax({
				url: AjaxURL+"&action=check_board_type&actionid="+actionid+"&boardtype="+BoardType+"&type1="+$('#BoardTypeLabel1').html()+"&type2="+$('#BoardTypeLabel2').html()+"&type3="+$('#BoardTypeLabel3').html(),
				async: false
			}).responseText;	

			response = response.replace("\t", "");
			
			if (response != 1) {
				alert(_AlertNoPassingBoardType+" "+response);
				return;
			}
		}	
		else if (actionid == 'FromMenu') 
		{
			outputStr += "&record[Action]='"+$('#Actions').html()+"'";
		
			//Figyelmeztetés, hogy a szezonális ajánlatnál megadott időpontok nem fedik a látogató által jelölteket
			var response = $.ajax({
				url: AjaxURL+"&action=check_session_range&checkin="+_CheckInDate+"&checkout="+_CheckOutDate,
				async: false
			}).responseText;	

			response = response.replace("\t", "");
			
			if (response != 1) {
				var conf = confirm(_AlertOverSessionRange);
				if (!conf) {
					return false;
				}
			}
		}

		//Megjegyzés
		outputStr += "&record[Message]='"+$('#CustomFields_48_3').val()+"'";

		//Hol hallott rólunk értékének ellenőrzése
		if (!CheckValueLength("CustomFields_49_3",_AlertEmptyField+" "+$('#WhereHearUsLabel').html())) return;
		outputStr += "&record[WhereHereUs]='"+$('#CustomFields_49_3').val()+"'";
		
		//Annak ellenőrzése, hogy az adatvédelmi nyilatkozat gombot kipipálta-e		
		if ($('#CustomFields_50_3').attr('checked') == false) 
		{			
			alert(_AlertNoDataSaveDecl);
			$('#CustomFields_50_3').focus();
			return;
		}	
		
		
		$('#CustomFields_42_3').val(_CheckInDate);
		$('#CustomFields_43_3').val(_CheckOutDate);		
		var d = new Date();
		$('#CustomFields_51_3').val(d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate()+" "+d.getHours()+":"+d.getMinutes());
		$('#CustomFields_55_3').val($('#Parking').html());
		$('#CustomFields_47_3').val($('#Actions').html());
		var rand = Math.random()*10000000000000000
		$('#EmailAddress').val(d.getFullYear()+"."+(d.getMonth()+1)+"."+d.getDate()+"_"+d.getHours()+"."+d.getMinutes()+"."+d.getSeconds()+"."+d.getMilliseconds()+"@europafit.hu");
		$('#CustomFields_53_3').val(_PublicLanguage);
		
		outputStr += "&record[HidBenefit]='"+$('#HidBenefit').val()+"'";
		
		outputStr += "&record[menuid]='"+_PublicLanguageMenuId+"'";
		
		_ReserveParameters = outputStr;
		
		return true;
	}//END function CheckReserveFormFields
	
	
	
	//Ellenőrzés a nyitóoldali mini form-on
	function CheckMiniFormFields() 
	{
		_MiniFormParameters = "";
		
		//Dátumok ellenőrzése, azaz, hogy mindkettő meg lett-e határozva
		if ((_CheckInDate.substr(6,1) == '0' && _CheckInDate.substr(7,1) == '0') || (_CheckOutDate.substr(6,1) == '0' && _CheckOutDate.substr(7,1) == '0')) {
			alert(_AlertBothBookedDateNeed);
			return;
		}

		//Személyek számának ellenőrzése
		//1. lépés: annak ellenőrzése, hogy a Felnőtt vagy a gyermek száma ki lett-e töltve
		if ($('#CustomFields_39_3').val() == '' && $('#CustomFields_40_3').val() == '')
		{
			alert(_AlertEmptyFields+" "+$('#CountPersonsLabel').html());
			return;
		}		
		//2. lépés: a számformátumok ellenőrzése
		if ($('#CustomFields_39_3').val() != '' && !CheckNumberFormat('CustomFields_39_3',_AlertWrongNumberFormat+" "+$('#CountAdultsLabel').html())) return;
		if ($('#CustomFields_40_3').val() != '' && !CheckNumberFormat('CustomFields_40_3',_AlertWrongNumberFormat+" "+$('#CountChildrenLabel').html())) return;		
		
		_MiniFormParameters += "&countadults="+$('#CustomFields_39_3').val();
		_MiniFormParameters += "&countchildren="+$('#CustomFields_40_3').val();
		
		return true;
	}//END function CheckMiniFormFields
	

	
	//Ugrás arra az oldalra, ami meg lett határozva, ha valaki a mini form-ot kitöltötte	
	function JumpToPricePage()
	{
		$.ajax({
			type: 'GET',
			url: AjaxURL+"&action=get_price_page"+"&langid="+_PublicLanguageMenuId,
			success: function(response) {
				location.href = DocumentBaseURL+response;
			}
		})		
	}	
	
	
	
	//Éjszakák számának lekérdezése
	function SetNightNumber()
	{		
		var response = $.ajax({
			url: AjaxURL+"&action=get_night_number&checkin="+_CheckInDate+"&checkout="+_CheckOutDate,
			async: false
		}).responseText;	

		response = response.replace("\t", "");
		
		if (parseInt(response) == 0) {
			$('#NightNumber').css('display','none');			
		}		
		else {
			$('#NightNumber').css('display','inline');
			$('#NightNumber').html(_NightNumberTitle+' '+response);	
		}
	}
	
	
	
	function SetBenefitTitleAndHidField(ActID)
	{
		$.ajax({
			url: AjaxURL+"&action=set_benefit_title_and_hid_field&actionid="+ActID+"&langid="+_PublicLanguageMenuId,
			success: function(response) 
			{
				response = response.replace("\t", "");
				title = response.substr(0,response.indexOf('###'));
				hid = response.substr(response.indexOf('###')+3);
				
				if (title == 'NoTitle')
				{
					$('#BenefitLabel').css('display', 'none');
				}
				else 
				{
					$('#BenefitLabel').css('display', 'block');
					$('#BenefitLabel').html(title);
				}
				
				$('#HidBenefit').val(hid);
			}
		});			
	}//END fucntion SetBenefitTitleAndHidField
	
	
	
	
	function AutoChekOutDate()
	{
		ActID = _ActActionID.replace("ActionsLi", "");
		
		$.ajax({
			url: AjaxURL+"&action=auto_checkout_date&actionid="+ActID,
			success: function(response) 
			{
				result = response.replace('\t','');

				if (result != '0') 
				{
					$('#CalendarEnd').html(GetCalendar('0000', '00', '_checkout'));
					
					_StepCheckOutYear = parseInt(result.substr(0,4));
					_StepCheckOutMonth = (result.substr(4,1) == 0) ? parseInt(result.substr(5,1)) : parseInt(result.substr(4,2));	
					_CheckOutDate = result;
					_StepCheckOutMonthName =  GetSettings('HomeSiteSettings','Month'+result.substr(4,2));	
					SetCalendarDate(result, 'CheckOut');
					SetNightNumber();
					CalendarSettings(false, true);
				}
			}
		});
		
	}//END function SetAutoChekOutDate()
	

