window.DEBUG=true;
(function(){
    eval(liligo.namespace);
    
/*
 * Included file begin: /seo/v3/common/js/forms/hotel.js
 * Included from:       /seo/v3/common/js/_main_hotel.js:4
 */

/*
 * Included file begin: /seo/v3/common/js/forms/_common.js
 * Included from:       /seo/v3/common/js/forms/hotel.js:1
 */

/*
 * Included file begin: /v3/searchforms/common/js/formbase.js
 * Included from:       /seo/v3/common/js/forms/_common.js:1
 */

	/**
	 * we'd like a common base class, for UrchinTracker/tracking
	 * the submit actions of the forms
	 */
	var FormBase = new Class({
	
		constructor: function(form) {
			this.form = $(form);
		},

		submit: function() {
			FormBase._fireEvent("submit", this.form);
			this.form.submit();
		}
		
	}, {
	
		init: function() {
			Observable.makeIt(this);
		},
		
		/**
		 * Change the submit function of the form to fire
		 * the static FormBase.submit event before the
		 * real submitting.
		 * Note: if you dont call the submit method of form,
		 * then this code will not work. In this case
		 * you have to add an event manager for the submit
		 * event of form.  
		 */
		hookSubmit: function(form) {
			var realSubmit = form.submit;
			form._ = form.submit;
			form.submit = function() {
			FormBase._fireEvent("submit", this);
			this.submit = realSubmit;
			this.submit();
			this.submit = arguments.callee;
		   }
		 }
	
	});
/*
 * Included file end: /v3/searchforms/common/js/formbase.js
 * Included from:     /seo/v3/common/js/forms/_common.js:1
 */


/*
 * Included file begin: /v3/searchforms/common/js/searchform.js
 * Included from:       /seo/v3/common/js/forms/_common.js:2
 */

	var SearchForm = liligo.SearchForm = new Abstract(Observable, {
		
		name: null, // required abstract
		ajaxHP: false, // is the form run in an ajax environment (like seo pages)?
		allowMultipleSubmits: false,
		
		errorMessageBgImage: "/v3/homepage/img/error-msg-bg.png",
		submitBtnLoadingImage: "/v3/searchforms/common/img/"+liligo.getLang()+"/submit-loading.png",
		
		/**
		 * you can access in the javascript, the last created
		 * searchform singleton with the static SearchForm.last.
		 * This constructor store that. 
		 */
		init: function() {
			SearchForm.last = this; 
		},
		
		/**
		 * Initialize the form and events
		 */
		initialize: function() {
			if (window.config && window.config.ajaxHP) {
				this.ajaxHP = true;
			}
				
			var that = this;
			if (!that._form) {
				that._form = $("searchform-"+that.name);
			}
			if (that._form) {
				__Eo(that._form, "submit", __EbS(that._onSubmit, that));
				if (typeof FormBase != "undefined") {
					FormBase.hookSubmit(that._form);
				}
			} else {
				return false;
			}
			if (!that._submitButton) {
				that._submitButton = $(that.name+"-submit");
				that._submitButton.disabled = this._submitted;
			}
			that.initialized = true;
			this.preload();
			return true;
		},
		
		preload: function() {
			preload([
				this.errorMessageBgImage,
				this.submitBtnLoadingImage
			]);
		},
		
		/**
		 * Override it if you need form validation 
		 */
		_validate: function() {
			return true;
		},
		
		/**
		 * Override it if the form can be filled from a json
		 */
		fill: nullFunc,
		
		preset: function() {
			var values = 
					( config && config[this.name] &&
					  extend(config[this.name].preset,(this.getValuesInCookie2JSON ? this.getValuesInCookie2JSON(): {}))
					) 
				 || ( this.getValuesInCookie2JSON && 
					 this.getValuesInCookie2JSON() );
			if (values && this.fill != nullFunc) {
				this.fill(values);
			}
		},
		
		_submitted: false,

		_onSubmit: function(event) {
			if (this._submitted && !this.allowMultipleSubmits) return;
			if (this._validate()) {
				this._submitted = true;
				this._doSubmit();
			}
		},
		
		/**
		 * Override (and call the base inside) if you want
		 * to do something (e.g. fill up a hidden field) before
		 * submit. Don't do validation here, this function
		 * have to submit the form.
		 */
		_doSubmit: function() {
			this._fireEvent("doSubmit");
			if (this._submitButton) {
				
				//multiclick fix #2
				if (!this.allowMultipleSubmits) {
					this._submitButton.src = this.submitBtnLoadingImage;
					this._submitButton.setAttribute("disabled", "disabled");
				}
			}
			this._form.submit();
			return true;
		},
		
		/**
		 * @return   true if there was an error
		 */
		_setError: function(field, error, notArray) {
			if (!notArray && (typeof field == "object") && (field.constructor == [].constructor)) {
				var result = false;
				forEach(field, function(field) {
					if (this._setError(field, error, true)) {
						result = true;
					}
				}, this);
				return result;
			}
			Style.setClassIf(error, field, "error");
			Style.setClassIf(error, this._form, "error");
			if (error) {
				$(this._form.id+"-error").innerHTML = labels[error];
				try {
					$(field).focus();
				} catch(e) {};
			}
			return !!error;
		},
		
		/**
		 * Add an <input type="hidden" /> element into form
		 */
		addHidden: function(name, value) {
			if (DEBUG) {
				if (!this._form) {
					var message = "No form in the SearchForm.addHidden. this.name: '"+this.name+"'"; 
					console.log("Error! "+message);
					throw new Error(message);
				}
			}
			var elem = Element("input", {
				type: "hidden",
				name: name,
				value: value
			});
			this._form.appendChild(elem);
			return elem;
		}
			
	});
/*
 * Included file end: /v3/searchforms/common/js/searchform.js
 * Included from:     /seo/v3/common/js/forms/_common.js:2
 */


/*
 * Included file begin: /v3/searchforms/common/js/popunders.js
 * Included from:       /seo/v3/common/js/forms/_common.js:3
 */

	var PopUnders = new Class(Observable, {
		
		constructor: function() {
			this._list = [];
		},
		
		add: function(options) {
			this._list.push(options);
		},
		
		open: function() {
			var
				list = this._list,
				total = list.length, i, win, doc, options,
				screenWidth = screen.availWidth || 800,
				screenHeight = screen.availHeight || 600,
				width = Math.min(800, Math.floor(screenWidth/total - 10));
			try {
				for (i=0;i<total;i++) {
					options = list[i];
					win = open(
						"", "", "height="+screenHeight+",width="+width+",left="+Math.floor((width+10) * i)+","+
						"top=0,menubar=1,location=1,resizable=1,scrollbars=1,toolbar=1,status=1"
					);
					win.blur();
					doc = win.document;
					doc.write("<body></body>");
					doc.close();
					doc.body.appendChild(form = Element("form", {
						method: "post",
						action: options.url
					}, doc));
					if (options.parameters) {
						forEach(options.parameters, function(value, name) {
							form.appendChild(Element("input", {
								type: "hidden",
								name: name,
								value: value
							}, doc));
						});
					}
					form.submit();
				}
			} catch (ignored) {
				return false;
			} finally {
				focus();
			}
			return true;
		}
		
	});
/*
 * Included file end: /v3/searchforms/common/js/popunders.js
 * Included from:     /seo/v3/common/js/forms/_common.js:3
 */


/*
 * Included file begin: /v3/searchforms/common/js/morelesssearchform.js
 * Included from:       /seo/v3/common/js/forms/_common.js:4
 */
	
	var MoreLessSearchForm = new Abstract(SearchForm, {
		
		name: null, // required abstract
		
		withMore: false,
		
		initialize: function() {
			if (!this._base_initialize()) return false;
			if($(this.name+"-more-")) __Eo(this.name+"-more-", "click", __EbS(this.moreLess, this, true));
			if($(this.name+"-more")) __Eo(this.name+"-more", "click", __EbS(this.moreLess, this, true));
			__Eo(this.name+"-less", "click", __EbS(this.moreLess, this, false));
			return true;
		},
		
		/**
		 * Override if you want to do something after change
		 */
		toMore: nullFunc,
		toLess: nullFunc,
		
		moreLess: function(e, more) {
			this.withMore = typeof more != "undefined" ? more :  this.withMore;
			Style.setClassIf(this.withMore, this._form, "more");
			more ? this.toMore() : this.toLess();
		}
		
	});
/*
 * Included file end: /v3/searchforms/common/js/morelesssearchform.js
 * Included from:     /seo/v3/common/js/forms/_common.js:4
 */

/*
 * Included file end: /seo/v3/common/js/forms/_common.js
 * Included from:     /seo/v3/common/js/forms/hotel.js:1
 */


/*
 * Included file begin: /v3/searchforms/hotel/js/form.js
 * Included from:       /seo/v3/common/js/forms/hotel.js:2
 */
	
	
/*
 * Included file begin: /v3/searchforms/hotel/js/compareSite.js
 * Included from:       /v3/searchforms/hotel/js/form.js:2
 */
	
	var CompareSite = Class({
		
		constructor : function(_block, _popUnders, _form) {
						
			this._block = _block;
			this._popUnders = _popUnders;
			this._inputElem = document.getElementsByName("fromLocation")[0];			
			this._isFetching = false;
			this._cache = {};
			this._form = _form;
			this._prevContent = "";
			this._checkBoxState = {};
			this._isHotelResultsPage = false;
			
			if (window.header && window.header.LocationCode){
				this._isHotelResultsPage = true;
			}
			this._setCheckboxes();
			
			if (window.config.hotel && config.hotel.preset.toCode || window.header && window.header.LocationCode){
				this._defaultHTML = "";
				this._isDefault = false;
				this._prevContent = this._inputElem.value;
			}else{
				this._defaultHTML = this._block.innerHTML;
				this._isDefault = true;
			}	
						
			Event.observe(_form._city,"keydown",bind(function(event){				
				if (event.keyCode == Event.KEY_TAB || event.keyCode == Event.KEY_RETURN) return;
				this._reset();
			},this))			
			__Eo(_form._city, "change", bind(this._change, this));
			__Eo(_form._city, "unchange", bind(this._change, this));				
		},
		
		_setCheckboxes : function(){
			forEach($$("input", this._block), function(input) {				
				if(this._isHotelResultsPage) input.checked = false
				else
					input.checked = Style.hasClass(input, "checked");				
			}, this);
		},
		
		_storeCheckboxState : function(){
			forEach($$("input", this._block), function(input) {
				this._checkBoxState[input.id] = input.checked;				
			}, this);
		},
		
		_restoreCheckboxState : function(){
			forEach($$("input", this._block), function(input) {				
				input.checked = this._checkBoxState[input.id] != undefined ? this._checkBoxState[input.id] : input.checked;
			}, this);
		},
		
		_reset : function(){
			
			if(this._isDefault ) {
				this._isFetching = false;
				return;
			}						
			if (this._isFetching) return;
			
			this._isFetching = true;
			this._storeCheckboxState();
			this._prevContent = "";
			this._resetDo();		
		},
		
		_resetDo : function(){			
			var that = this;			
			if (that._defaultHTML){						
				that._isFetching = false;
				that._resetFinish(that._defaultHTML); 
				return;			
			}			
			new AjaxRequest("/v3/searchforms/hotel/data/compareSite.jsp", {
				method: "post",					
				onSuccess: function(xhr,responseText){						
					that._defaultHTML = responseText;
					that._isFetching = false;
					that._resetFinish(responseText);
				}
			});						
		},
		
		_resetFinish : function(_html){
			this._block.innerHTML = _html;				
			this._setCheckboxes();				
			this._restoreCheckboxState();	
			this._isDefault = true;			
		},			
		
		_change : function(_,_item){
			if (this._prevContent == _item.label) return;
			this._isDefault = false;
			this._prevContent = _item.label;
			this._storeCheckboxState();
			this._changeDo(_,_item);			
		},
		
		_changeDo : function(_, _item){			
			var that = this, actToCityId = _item.value.split(",")[0];			
			if (that._cache[actToCityId]){				
				that._isFetching = false;			
				that._changeFinish(that._cache[actToCityId]);
				return;
			}
			
			new AjaxRequest("/v3/searchforms/hotel/data/compareSite.jsp", {
				method: "post",
				parameters : {
					toCityId : actToCityId 
				},
				onSuccess: function(xhr,responseText){						
					that._prevContent = _item.label;
					that._cache[actToCityId] = responseText;					
					that._isFetching = false;
					that._changeFinish(responseText);
				}
			});
		},
		
		_changeFinish : function(_html){
			this._isDefault = false;		
			this._block.innerHTML = _html;				
			this._setCheckboxes();				
			this._restoreCheckboxState();	
		},
		
		setDefaultStateToFalse : function(){
			this._defaultHTML = "";
			this._isDefault = false;
		},
		
		updateCompareSite : function(_item){
			this._change(null,_item);
		},
		
		launchCompareSites : function() {			
			var parameters = {}, list = [];
			forEach(this._form._form.elements, function(input) {
				parameters[input.name] = input.value;
			})
			forEach($$("input", this._block), function(input) {
				if (input.checked) {					
					list.push(input.id.replace(/hotel-cs-/,""));
					this._popUnders.add({
						url: "/hotel_v4/compareSite/launch.jsp",
						parameters: extend({
							compareSiteId : input.value
						}, parameters)
					});
				}
			}, this);			
			return list;
		}		
});
/*
 * Included file end: /v3/searchforms/hotel/js/compareSite.js
 * Included from:     /v3/searchforms/hotel/js/form.js:2
 */

	
	new Singleton(MoreLessSearchForm, {

		name: "hotel",
		maxNights: 60,	

		initialize: function() {			
			if (!this._base_initialize()) return;			
			if (typeof(PopUnders) != "undefined") {//quick fix
				this._popUnders = new PopUnders();
			} else {
				this._popUnders = {open: nullFunc, add: nullFunc};
			}
			var layerHolder, form = this._form;
			if (Query.up(form, "table.popup")) {
				Style.set(layerHolder = Element("div"), {
					width: "100%",
					position: "absolute",
					left: 0
				});
				form.appendChild(layerHolder);
			}			
			this._city = new CompLoc({
				type: "hotel",
				field: "hotel-city",
				hidden: "hotel-cityCode",
				nextFocus: "hotel-from-date",
				container: layerHolder
			});
			__Eo(this._city, "keydown", bind(this._setError, this, "hotel-city", ""));
			this._fromDate = new DatePicker({
				direction: DatePicker.DIR_DEP,
				field:     "hotel-from-date",
				nextFocus: "hotel-to-date",
				preReturnDays: 1,
				offsetLeft: 5,
				oldNaming: true,
				container: layerHolder
			});
			__Eo(this._fromDate, "set", bind(this.updateNights, this));
			this._toDate = new DatePicker({
				direction: DatePicker.DIR_RET,
				field:     "hotel-to-date",
				nextFocus: "hotel-rooms",
				depPicker: this._fromDate,
				preReturnDays: 1,
				offsetLeft: 4,
				minDays:   1,
				oldNaming: true,
				container: layerHolder
			});
			var contentElem = $("hotel-content");
			this._splitCompareSite = contentElem.className.match(/splitCompareSite\-(\d)/)[1]*1;
			this._compareSiteSplitted = Style.hasClass("hotel-content", "compareSiteSplitted");
			
			__Eo(this._toDate, "set", bind(this.updateNights, this));
			this._fromDate.retPicker = this._toDate;
			this.updateNights();
			this._initRooms();
			if ($("hotel-category") && $("hotel-category").nodeName == "SELECT"){
				for (var i=1; i<=5; i++) {
					if($("hotel-category-"+i)) $("hotel-category-"+i).checked = false;
				}
			} else {
				for (var i=1; i<=5; i++) {
					if($("hotel-category-"+i)) $("hotel-category-"+i).checked = true;
				}		
			}
			this.moreLess();
			
			//manage subcategories
			var hotelSubCat = $("hotel-subcategory-hotel");
			if ((hotelSubCat) && (!this.ajaxHP)) {
				hotelSubCat.checked = true;
				__Eo(hotelSubCat, "click", bind(this.subCategoryClick, this));
				Event.observe($("hotel-subcategory-hotel-byname-a"), 'click', bind(function(e){ this.setValues2Cookie(); },this));
				__Eo("hotel-subcategory-hotel-byname", "click", bind(this.subCategoryClick, this));
			};
			
			try{
				if ($("hotel-city")){
					$("hotel-city").value = "";
					$("hotel-city").focus();
				};
			}catch(e){};
						
			if (this._splitCompareSite) {
				this.compareSite = new CompareSite($("hotel-compare"), this._popUnders, this);
			}			
			return true;			
		},
		
		updateCompareSite : function(elem){
			this.compareSite && this.compareSite.updateCompareSite(elem);
		},
		
		subCategoryClick: function(delay) {
			this.setValues2Cookie();
			var radio = $("hotel-subcategory-hotel-byname");
			if (!radio.checked) radio = $("hotel-subcategory-hotel");
			window.location.href = $$("label[for="+radio.id+"] a", radio.parentNode)[0].href;
		},

		fill: function(values) {
			if (!values) return;
			var value;
			if (value = values.to) $("hotel-city").value = value;
			if (value = values.toCode) $("hotel-cityCode").value = value;
			if (value = values.arrDate) this._fromDate.set(value);
			if (value = values.depDate) this._toDate.set(value);
			this.updateNights();			
			if (
				(values.minPrice !== undefined && values.minPrice >= 0 ) &&
				(values.maxPrice !== undefined && values.maxPrice >= 0)) {
				$("hotel-max-price").value = String(parseInt(values.minPrice)) + "-" + String(parseInt(values.maxPrice));
			}
			if (value = values.stars && $("hotel-category") && $("hotel-category").nodeName == "SELECT"){
				$("hotel-category").value = (values.stars.length == 5) ? -1 : 6 - values.stars.length;
				for (var i=1;i<=5;i++) {
					$("hotel-category-"+i).checked = false;
				}
			}else if(value = values.stars){
				for (var i=1;i<=5;i++) {
					$("hotel-category-"+i).checked = false;
				}
				forEach(value, function(star) {
					$("hotel-category-"+star).checked = true;
				});
			}
			if (value = values.rooms) {
				$("hotel-rooms").value = value.length;
				this._onRoomsChange();
				forEach(value, function(room, index) {
					index++;
					$("hotel-adults-"   + index).value = room.adults;
					$("hotel-children-" + index).value = room.children;
				});
			}
			
			if(window.liligo && liligo.hp && this._splitCompareSite && values.toCode){
				this.compareSite.updateCompareSite($("hotel-cityCode"));				
			}
			
			
			if (values.submit) {
				this._onSubmit();
			}
		},		
		
		getValuesInJSON : function(){
			var that = this;		
			return  {
				to 			: $(that.name + "-city").value,
				toCode		: $(that.name + "-cityCode").value,
				arrDate		: that._fromDate.value.getTime(),
				depDate		: that._toDate.value.getTime(),
				rooms		: (function(){
								var rooms = [];
								for (var room = 1; room <= $( that.name + "-rooms").value; room++)
									rooms.push({
										"adults"	: $( that.name + "-adults-" + room).value,
										"children"	: $( that.name + "-children-" + room).value
									});
								return rooms;					
							  })(),
				minPrice	: ( $(that.name + "-max-price").value == -1 ) ? -1 : $(that.name + "-max-price").value.split("-")[0],
				maxPrice	: ( $(that.name + "-max-price").value == -1 ) ? -1 : $(that.name + "-max-price").value.split("-")[1],
				stars		: (function(){
								var stars = [];
								if ($("hotel-category") && $("hotel-category").nodeName == "SELECT"){
									for (var i=parseInt($("hotel-category").value);i<=5;i++){
										stars.push(star)
									};
								}else{									
									for (var star = 1; star <= $$("." + that.name + "-category-row").length; star++)
										if($(that.name + "-category-" + star).checked) stars.push(star);
								}
								return stars;	
							  })()								
			};
		},
		
		getValuesInJSON2String : function(){
			return JSON.escape(JSON.encode(this.getValuesInJSON())).replace(/,/g,"%%");
		},
		
		getValuesInCookie2JSON : function() {
			if (!(window.Cookie && Cookie.load && Cookie.destroy)) return;
			var values = Cookie.load("getSearchJSON");
			if(values) values = values.replace(/%%/g,",");	
			Cookie.destroy("getSearchJSON");
			return JSON.decode(JSON.decode(values)) || false;
		},
		
		setValues2Cookie : function(){
			if (!(window.Cookie && Cookie.save)) return;
			Cookie.save("getSearchJSON",this.getValuesInJSON2String());					
		},
		
		setCookie2Values : function(){
			if (values = this.getValuesInCookie2JSON())
				this.fill(values);
		},	

		updateNights: function() {
			var nights = Math.round((this._toDate.value-this._fromDate.value)/86400000);
			this.nights = nights;
			$("hotel-nights").innerHTML = nights;
			var cont = $("hotel-nights").parentNode;
			Style.setClassIf(nights > 1, cont, "plural");
			Style.setClassIf(nights < 2, cont, "singular");
			if (nights > this.maxNights) {
				this._setError("hotel-to-date-picker", "homepage_top_form_hotel_alert_nights");
				return false;
			} else {
				this._setError("hotel-to-date-picker");
				return true;
			}
		},

		toLess: function() {
			var rooms = $("hotel-rooms").value;
			for (var i=1; i<=rooms; i++) {
				$("hotel-adults-"+i).value = 2;
				$("hotel-children-"+i).value = 0;
			}
			try { // try-catch focus for IE
				$("hotel-city").focus();
			} catch(e) {}
		},

		toMore: function() {
			try { // try-catch focus for IE
				$("hotel-city").focus();
			} catch(e) {}
		},

		_initRooms: function() {
			var
				roomCount = 3, // $("hotel-rooms").options.length,
				template = new VTemplate("/v3/searchforms/hotel/templates/room.vm", function (context) { 
var text = new liligo.__VT_StringCat(), _function = 'function', 
velocityCount = 0;
if (context.velocityCount) velocityCount=context.velocityCount;

text.push('	<label for="hotel-adults-');
text.push( context.roomNumber);
text.push('" class="number">');
text.push( context.roomNumber);
text.push('.</label>	<select id="hotel-adults-');
text.push( context.roomNumber);
text.push('" name="room');
text.push( context.roomNumber);
text.push('adults" class="adults">		<option value="0">0</option><option value="1">1</option><option value="2" selected="selected">2</option>		<option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option>	</select>	<select id="hotel-children-');
text.push( context.roomNumber);
text.push('" name="room');
text.push( context.roomNumber);
text.push('children" class="children">		<option value="0" selected="selected">0</option><option value="1">1</option><option value="2">2</option>		<option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option>	</select>');
return text.toString();
}
);
				rooms = this._rooms = {};
			for (var i = 1; i<=roomCount; i++) {
				var room = rooms[i] = $("hotel-room-"+i);
				Style.hide(room);
				room.innerHTML = template.process({
					roomNumber: i
				});
				__Eo(room, "mousedown", __Eb(this._onRoomAction, this, i));
				__Eo(room, "change", __Eb(this._onRoomAction, this, i));
			}
			Style.show(rooms[1]);
			this._onRoomsChange();
			__Eo("hotel-rooms", "change", bind(this._onRoomsChange, this));
		},

		_onRoomAction: function(event, roomNumber) {		
			var element = Event.element(event);
			if (element.nodeName != "SELECT") return;
			this._setError([
				"hotel-adults-"  +roomNumber,
				"hotel-children-"+roomNumber
			]);
		},

		_onRoomsChange: function() {		
			var value = $("hotel-rooms").value, rooms = this._rooms;
			Style.setClassIf(value == 1, "hotel-persons", "single");
			Style.showIf(value > 1, rooms[2]);
			Style.showIf(value > 2, rooms[3]);
		},

		_validate: function() {
			var errorLabelPrefix = "homepage_top_form_hotel_alert_alert_";
			if (!$("hotel-city").value || !$("hotel-cityCode").value) {
				this._setError("hotel-city", errorLabelPrefix+"city");
				return false;
			}
			this._setError("hotel-city", "");
			var rooms = 1*$("hotel-rooms").value;
			for (var i=1; i<=rooms; i++) {
				var
					adults   = 1*$("hotel-adults-"+i).value,
					children = 1*$("hotel-children-"+i).value,
					fields   = ["hotel-adults-"+i, "hotel-children-"+i];
				if (adults + children > 10) {
					return !this._setError(fields, errorLabelPrefix+"guests");
				}
				this._setError(fields, "");
				if (!adults && children) {
					return !this._setError(fields, errorLabelPrefix+"adults");
				}
				this._setError(fields, "");
				if (!adults && !children) {
					return !this._setError(fields, errorLabelPrefix+"rooms");
				}
				this._setError(fields, "");
			}
			return this.updateNights();
		},

		_doSubmit: function() {
			var minMax = $("hotel-max-price").value;
			if (minMax == "-1") {
				minMax = [-1, -1];
			} else {
				minMax = minMax.split(/-/);
			}
			this.addHiddens({
				roomdetails: "true",
				room1type:   1,
				room2type:   1,
				room3type:   1,
				nights:      this.nights,
				minPrice:    minMax[0],
				maxPrice:    minMax[1],
				javaDates:   1				
			});
			
			if ($("hotel-category") && $("hotel-category").nodeName == "SELECT"){
				for (var i= parseInt( (parseInt($("hotel-category").value) < 0) ? 1 : $("hotel-category").value) ;i<=5;i++){					
					$("hotel-category-" + i).checked = true;
				};
			}
			
			var splitCompareSite = this._splitCompareSite, checkedCompareSites;			
			if (splitCompareSite) {
				checkedCompareSites = this.compareSite.launchCompareSites();
				if (checkedCompareSites.length) {
					this.addHidden("focusResults", "1");
				}
			}
			this._popUnders.open();
			if (this._compareSiteSplitted) {
				this.addHidden("splitCompareSite", splitCompareSite);
				var
					trackingPrefix = "/Comparesite/Hotel",
					trackingSearchLaunched = trackingPrefix+"/SearchLaunched";
				urchinTracker(trackingSearchLaunched);
				if (splitCompareSite) {
					urchinTracker(trackingSearchLaunched+"/"+checkedCompareSites.length);
					forEach(checkedCompareSites, function(code) {
						urchinTracker(trackingPrefix+"/CompareLaunched/"+code);
					});
				}
			}
			this._base__doSubmit();
		},

		addHiddens: function(hiddensMap) {
			forEach(hiddensMap, function(value, name) {
				this.addHidden(name, value);
			}, this);
		}

	});
/*
 * Included file end: /v3/searchforms/hotel/js/form.js
 * Included from:     /seo/v3/common/js/forms/hotel.js:2
 */

/*
 * Included file end: /seo/v3/common/js/forms/hotel.js
 * Included from:     /seo/v3/common/js/_main_hotel.js:4
 */

    liligo.SEOSearchForm = SearchForm.last;
    
/*
 * Included file begin: /seo/v3/common/js/full.js
 * Included from:       /seo/v3/common/js/_main_hotel.js:6
 */

/*
 * Included file begin: /v3/popups/js/popup.js
 * Included from:       /seo/v3/common/js/full.js:1
 */

	//maintain the number of opened cover layers
	if (!liligo._v3_popup_overlays_shown) liligo._v3_popup_overlays_shown = 0;
		
	var Popup = new Class(Observable, {
	
		y: 100, // y position of the popup from the top part of view
	
		skin: "default",
		close: true,   // show or not the close button?
		className: "", // additional className
		
		overlay: true, // show or not an overlay? (aka background fading)
		fixOverlay: false, // click on overlay will not close the popup
		opacity: 0.8,  // opacity of overlay layer
		bgColor: "#b4cf01", // color of overlay layer
		canvasWidth: "100%", // the width of the container
		
		/**
		 * Required in options:
		 *   - content:  HTML string or a DOM node (not just an id)
		 *   - template: the template of popup (V, S, os TPTemplate)
		 */
		constructor: function(options) {
			extend(this, options || {});
			this.id = unique();
			this.templateData = extend({
				id:   this.id,
				skin: this.skin,
				close: this.close
			}, this.templateData || {});
		},
	
		/**
		 * Show/hide the popup. If the popup is not yet created,
		 * then create it.
		 * @param show  if false (===false), then hide the layer, otherwise show
		 */
		show: function(show) {
			this.create();
			if (!show) this._fireEvent("hide");
			show = show !== false;
			this._showOverlay(show);
			if (show && IE6) {
				this._reposition();
			}
			Style.showIf(show, this._container);
			if (IE6) {
				if (this.wheelObserver) {
					this._wheelObserver.stop();
					this._resizeObserver.stop();
					this._scrollObserver.stop();
				}
				if (show) {
					this._wheelObserver = new Event.Observer(
						document, "resize", bind(this._reposition, this)
					);
					this._resizeObserver = new Event.Observer(
						window, "resize", bind(this._reposition, this)
					);
					this._scrollObserver = new Event.Observer(
						window, "scroll", bind(this._reposition, this)
					);
				}
				forEach($$("select"), function(select) {
					select.style.visibility = !show
						? "visible"
						: "hidden";
				});
				forEach($$("select", this._container), function(select) {
					select.style.visibility = "visible";
				});
			}
			if (show) this._fireEvent("show");
		},
		
		hide: function() { this.show(false); },
		
		create: function() {
			if (this._container) return;
			var container = Element("div", {
				className: "skin-"+this.skin+" "+this.className,
				innerHTML: this.template.process(this.templateData)
			});
			Style.set(container, {
				display:  "none",
				position: "fixed",
				top: this.y+"px",
				left: 0,
				width: this.canvasWidth,
				zIndex: 45
			});
			DOM.add(container);
			__Eo(container, "click", __Eb(this._containerClick, this));
			var
				content = this.content,
				contentElem = $("popup-"+this.id+"-content"),
				closeElem = $("popup-"+this.id+"-close");
			if (typeof content == "string") {
				contentElem.innerHTML = content;
			} else {
				contentElem.appendChild(content);
				Style.show(content);
			}
			if (closeElem) {
				__Eo(closeElem, "click", __EbS(this.hide, this));
			}
			if (this.title) {
				var titleElem = $("popup-"+this.id+"-title");
				if (titleElem) {
					titleElem.innerHTML = this.title;
				}
			}
			this._container = container;
		},
		
		_containerClick: function(event) {
			var elem = Event.element(event);
			if (elem == this._container) {
				this.hide();
			}
		},
		
		/**
		 * Recalculate the real y position of the popup (only for IE6)
		 */
		_reposition: function() {
			if (this._overlay) this._updateOverlay();
			var container = this._container;
			container.style.position = "absolute";
			container.style.top =
				document.documentElement.scrollTop + this.y + "px";
		},
		
		/**
		 * Show/hide the overlay layer. If the overlay is not yet
		 * created, then create it.
		 * @param show  if false (===false), then hide the layer, otherwise show
		 */
		_showOverlay: function(show) {
			if (!this.overlay) return;
			show = show !== false;
			if (!this._overlay) {
				var overlay = DOM.add("div");
				Style.set(overlay, {
					position: "fixed",
					display: "none",
					opacity: this.opacity,
			    top: 0,
			    left: 0,
			    width: "100%",
			    height: "100%",
			    zIndex: 40,
			    backgroundColor: this.bgColor
				});
				this._overlay = overlay; 
				if (IE6) {
					this._updateOverlay();
				}
				if (!this.fixOverlay) {
					__Eo(this._overlay, "click", bind(this.hide, this));
				}
			}
			Style.showIf(show, this._overlay);
			
			//add a class to the body, so that one may hide certain flash banners;
			// + take care of stacking; for example:
			//   modify search + add more results + wait message
			var action = "addClass"
			if (show) {
				liligo._v3_popup_overlays_shown++;
			} else {
				if (--liligo._v3_popup_overlays_shown <= 0) {//-1 on hotel?
					action = "removeClass";
					liligo._v3_popup_overlays_shown = 0;
				}
			}
			Style[action](document.body, "v3-popup-with-overlay");
			
			if (IE6) {
				if (this._ieInterval) {
					clearInterval(this._ieInterval);
					this._resizeObserver.stop();
					this._scrollObserver.stop();
				}
				if (show) {
					this._ieInterval = setInterval(
						bind(this._updateOverlay, this),
						300
					);
					this._resizeObserver = new Event.Observer(
						window, "resize", bind(this._updateOverlay, this)
					);
					this._scrollObserver = new Event.Observer(
						window, "scroll", bind(this._updateOverlay, this)
					);
				}
			}
		},
		
		/**
		 * Update the size of overlay layer. Only for IE6
		 */
		_updateOverlay: function() {
			var
				body = document.body,
				winHeight =
					document.documentElement.clientHeight || // IE6 strict
					body.clientHeight; // IE6 quirks
			body.style.height = "auto";
			Style.set(this._overlay, {
				position: "absolute",
		    width:  body.scrollWidth+"px",
		    height: Math.max(body.scrollHeight, winHeight)+"px"
		  });
		}
		
	});
/*
 * Included file end: /v3/popups/js/popup.js
 * Included from:     /seo/v3/common/js/full.js:1
 */

this.Popup = Popup;

//anclude("airwidget.js");
//anclude("airwidget_form.js");

/*
 * Included file begin: /seo/v3/common/js/hotelwidget.js
 * Included from:       /seo/v3/common/js/full.js:6
 */
HotelWidget = new Class(Observable, {
	targetId: "hotelwidget",
	container : "seo-result",
	containerOffsetX : 445,	
	visible: null,
	
	constructor: function(params){
		extend(this, params);
		this.target = $(this.targetId);
		Event.observe(window,"resize",bind(function(){
			this.hide();
		},this));
		Event.observe(this.target, "click", bindAsEventListener(this.onWidgetClick, this));
		Mediator.addEventListener("Filters", function(_source,_action){
			if (_action == "before_startFiltering") {
				this.hide();
			};
		}, this);
		Mediator.addEventListener("Layout.ResultDisplay", function(_source,_action){
			if (_action == "before_setPage") {
				this.hide();
			};
		}, this);
		
		if (BOM.detect("ie6")){
			this.safelayer = new params.safelayer("safelayer",this.targetId);
		}		
	},
	
	onWidgetClick: function(e){
		var self = Event.element(e);
		if (self.id == "swclosebtn"){
			this.hide();
			Event.stop(e);
			return;
		}
		if (self.name == "hotel-submit"){
			this._fireEvent("doSubmit");
			this.hide();
		}
	},
	
	show: function(itemnum, self){	
	
		var containerPos = Geometry.position($("seo-result")),
			selfPos = Geometry.position(self.parentNode),
			searchJSON = this.getSearchJSON(itemnum);		
		if (this.hotelform) this.hotelform.moreLess(null, false);
		this.hotelform.fill(searchJSON);
		this.hotelform.resetSubmit();
		var offsetX = containerPos[0] + this.containerOffsetX,
			offsetY = containerPos[1] + (selfPos[1] - containerPos[1] - 80);
		this.target.style.left = offsetX + "px";		
		this.target.style.top = offsetY + "px";		
		if (BOM.detect("ie6")){
			this.safelayer.move(offsetX, offsetY);
			this.safelayer.show();
		}		
		Style.show(this.target);		
		this.visible = itemnum;		
	},
	
	hide: function(){
		if (this.hotelform) this.hotelform.moreLess(null, false);
		Style.hide(this.target);
		if (BOM.detect("ie6")){
			this.safelayer.hide();
		}
		this.visible = null;
	},
	
	getSearchJSON: function(itemnum){
		var item = window.results[itemnum];
		return {
			to: (item.to) ? item.to : window.config.hotel.preset.to,
			toCode: (item.toCode) ? item.toCode : window.config.hotel.preset.toCode,
			name: item.acc_name,
			stars: item.acc_stars
		}
	}
});
/*
 * Included file end: /seo/v3/common/js/hotelwidget.js
 * Included from:     /seo/v3/common/js/full.js:6
 */


/*
 * Included file begin: /seo/v3/common/js/hotelwidget_form.js
 * Included from:       /seo/v3/common/js/full.js:7
 */

HotelForm = new Class(MoreLessSearchForm, {

		name: "UID-hotel",
		maxNights: 60,

		initialize: function() {
			if (!this._base_initialize()) return;
			this._city = new CompLoc({
				type: "hotel",
				field: "UID-hotel-city",
				hidden: "UID-hotel-cityCode",
				nextFocus: "UID-hotel-from-date"
			});
			__Eo(this._city, "keydown", bind(this._setError, this, "hotel-city", ""));
			$("UID-hotel-city").value = "";
			this._fromDate = new DatePicker({
				direction: DatePicker.DIR_DEP,
				field:     "UID-hotel-from-date",
				nextFocus: "UID-hotel-to-date",
				offsetLeft: 5,
				preReturnDays: 1,
				oldNaming: true
			});
			__Eo(this._fromDate, "set", bind(this.updateNights, this));
			this._toDate = new DatePicker({
				direction: DatePicker.DIR_RET,
				field:     "UID-hotel-to-date",
				nextFocus: "UID-hotel-rooms",
				depPicker: this._fromDate,
				offsetLeft: 4,
				preReturnDays: 1,
				minDays:   1,
				oldNaming: true
			});
			__Eo(this._toDate, "set", bind(this.updateNights, this));
			this._fromDate.retPicker = this._toDate;
			this.updateNights();
			this._initRooms();
			for (var i=1; i<=5; i++) {
				$("UID-hotel-category-"+i).checked = true;
			}
			this.moreLess();
			return true;
		},
		
		constructor: function() {
			this.initialize();
		},
		
		resetSubmit: function(){
			this._submitted = false;
			this._submitButton.disabled = false;
		},

		fill: function(values) {
			if (!values) return;
			var value;
			if (value = values.name) $("UID-hotel-name").value = value;
			if (value = values.to) $("UID-hotel-city").value = value;
			if (value = values.toCode) $("UID-hotel-cityCode").value = value;
			if (value = values.arrDate) this._fromDate.set(value);
			if (value = values.depDate) this._toDate.set(value);
			this.updateNights();
			if (
				(values.minPrice !== undefined) &&
				(values.maxPrice !== undefined)) {
				$("UID-hotel-max-price").value = values.minPrice + "-" + values.maxPrice;
			}
			/*if (values.stars != null){
				var value = values.stars;
				if (value > 0) {
					for (var i=1;i<=5;i++) {
						$("UID-hotel-category-"+i).checked = false;
					}
					$("UID-hotel-category-"+value).checked = true;
				} else {
					for (var i=1;i<=5;i++) {
						$("UID-hotel-category-"+i).checked = true;
					}
				}
			}*/
			if (value = values.rooms) {
				$("UID-hotel-rooms").value = value.length;
				this._onRoomsChange();
				forEach(value, function(room, index) {
					index++;
					$("UID-hotel-adults-"   + index).value = room.adults;
					$("UID-hotel-children-" + index).value = room.children;
				});
			}
			if (values.submit) {
				this._onSubmit();
			}
		},

		updateNights: function() {
			var nights = Math.ceil((this._toDate.value-this._fromDate.value)/86400000);
			this.nights = nights;
			$("UID-hotel-nights").innerHTML = nights;
			var cont = $("UID-hotel-nights").parentNode;
			Style.setClassIf(nights > 1, cont, "plural");
			Style.setClassIf(nights < 2, cont, "singular");
			if (nights > this.maxNights) {
				this._setError("UID-hotel-to-date-picker", "homepage_top_form_hotel_alert_nights");
				return false;
			} else {
				this._setError("UID-hotel-to-date-picker");
				return true;
			}
		},

		toLess: function() {
			var rooms = $("UID-hotel-rooms").value;
			for (var i=1; i<=rooms; i++) {
				$("UID-hotel-adults-"+i).value = 2;
				$("UID-hotel-children-"+i).value = 0;
			}
			try { // try-catch focus for IE
				$("UID-hotel-city").focus();
			} catch(e) {}
		},

		toMore: function() {
			try { // try-catch focus for IE
				$("UID-hotel-city").focus();
			} catch(e) {}
		},

		_initRooms: function() {
			var
				roomCount = 3, // $("UID-hotel-rooms").options.length,
				template = new VTemplate("/seo/v3/common/templates/hotel-room.vm", function (context) { 
var text = new liligo.__VT_StringCat(), _function = 'function', 
velocityCount = 0;
if (context.velocityCount) velocityCount=context.velocityCount;

text.push('	<label for="UID-hotel-adults-');
text.push( context.roomNumber);
text.push('" class="number">');
text.push( context.roomNumber);
text.push('.</label>	<select id="UID-hotel-adults-');
text.push( context.roomNumber);
text.push('" name="room');
text.push( context.roomNumber);
text.push('adults" class="adults">		<option value="0">0</option><option value="1">1</option><option value="2" selected="selected">2</option>		<option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option>	</select>	<select id="UID-hotel-children-');
text.push( context.roomNumber);
text.push('" name="room');
text.push( context.roomNumber);
text.push('children" class="children">		<option value="0" selected="selected">0</option><option value="1">1</option><option value="2">2</option>		<option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option>	</select>');
return text.toString();
}
);
				rooms = this._rooms = {};
			for (var i = 1; i<=roomCount; i++) {
				var room = rooms[i] = $("UID-hotel-room-"+i);
				Style.hide(room);
				room.innerHTML = template.process({
					roomNumber: i
				});
				__Eo(room, "mousedown", __Eb(this._onRoomAction, this, i));
				__Eo(room, "change", __Eb(this._onRoomAction, this, i));
			}
			Style.show(rooms[1]);
			this._onRoomsChange();
			__Eo("UID-hotel-rooms", "change", bind(this._onRoomsChange, this));
		},

		_onRoomAction: function(event, roomNumber) {
			var element = Event.element(event);
			if (element.nodeName != "SELECT") return;
			this._setError([
				"UID-hotel-adults-"  +roomNumber,
				"UID-hotel-children-"+roomNumber
			]);
		},

		_onRoomsChange: function() {
			var value = $("UID-hotel-rooms").value, rooms = this._rooms;
			Style.setClassIf(value == 1, "UID-hotel-persons", "single");
			Style.showIf(value > 1, rooms[2]);
			Style.showIf(value > 2, rooms[3]);
		},

		_validate: function() {
			var errorLabelPrefix = "homepage_top_form_hotel_alert_alert_";
			if (!$("UID-hotel-city").value) {
				this._setError("UID-hotel-city", errorLabelPrefix+"city");
				return false;
			}
			this._setError("UID-hotel-city", "");
			var rooms = 1*$("UID-hotel-rooms").value;
			for (var i=1; i<=rooms; i++) {
				var
					adults   = 1*$("UID-hotel-adults-"+i).value,
					children = 1*$("UID-hotel-children-"+i).value,
					fields   = ["UID-hotel-adults-"+i, "UID-hotel-children-"+i];
				if (adults + children > 10) {
					return !this._setError(fields, errorLabelPrefix+"guests");
				}
				this._setError(fields, "");
				if (!adults && children) {
					return !this._setError(fields, errorLabelPrefix+"adults");
				}
				this._setError(fields, "");
				if (!adults && !children) {
					return !this._setError(fields, errorLabelPrefix+"rooms");
				}
				this._setError(fields, "");
			}
			return this.updateNights();
		},

		_doSubmit: function() {
			var minMax = $("UID-hotel-max-price").value;
			if (minMax == "-1") {
				minMax = [-1, -1];
			} else {
				minMax = minMax.split(/-/);
			}
			this.addHiddens({
				roomdetails: "true",
				room1type:   1,
				room2type:   1,
				room3type:   1,
				nights:      this.nights,
				minPrice:    minMax[0],
				maxPrice:    minMax[1],
				javaDates:   1
			});
			this._base__doSubmit();
			this._submitButton.src = "/seo/v3/common/img/"+getLang()+"/searchwidget_submit.png";
		},

		addHiddens: function(hiddensMap) {
			forEach(hiddensMap, function(value, name) {
				this.addHidden(name, value);
			}, this);
		}

	});
/*
 * Included file end: /seo/v3/common/js/hotelwidget_form.js
 * Included from:     /seo/v3/common/js/full.js:7
 */


/*
 * Included file begin: /myliligo/popups/common/js/popup.js
 * Included from:       /seo/v3/common/js/full.js:8
 */

	window.hpPopup = Abstract({
		
		name: null,
		submit: null,
		
		opener: false,
		noForm: false,
		
		initialize: function() {
			if (this.initialized) return;
			this.initialized = true;
			if (this.opener) {
				__Eo(this.opener, "click", __EbS(this.show, this));
			}
			if (!this.noForm) {
				Event.observe("hp-"+this.name+"-form", "submit",
					this.bindedSubmit = Event.bindStop(this.submit, this)
				);
			}
			__Eo("hp-"+this.name+"-close", "click", __EbS(this.close, this));
		},
		
		// If the hash of url contains the name of popup, then show it (e.g.: #register)
		hashOpen: function() {
			var hash = document.location.hash;
			if (hash && hash.indexOf(this.name) != -1) {
				this.show();
			}
		},
		
		show: function() {
			if (!this.initialized) this.initialize();
			if (!this.noFade) {
				hpPopupTools.setPosition("hp-"+this.name);
				hpPopupTools.fadeScreen(true);
			}
			Style.show("hp-"+this.name);
		},
		
		close: function() {
			Style.hide("hp-"+this.name);
			if (!this.noFade) {
				hpPopupTools.fadeScreen(false);
			}
		},
		
		setError: function(target, error, toParent) {
			target = $(target);
			if (toParent) target = target.parentNode;
			if (error === null) {
				Style.removeClass(target, "error");
				Style.removeClass(target, "valid");
			} else {
				Style.setClassIf(error,  target, "error");
				Style.setClassIf(!error, target, "valid");
			}
			return error;
		}
		
	});
/*
 * Included file end: /myliligo/popups/common/js/popup.js
 * Included from:     /seo/v3/common/js/full.js:8
 */


/*
 * Included file begin: /myliligo/popups/common/js/popuptools.js
 * Included from:       /seo/v3/common/js/full.js:9
 */

	window.hpPopupTools = Singleton({
		
		tabChain: 
/*
 * Included file begin: /myliligo/popups/common/js/tabchain.js
 * Included from:       /myliligo/popups/common/js/popuptools.js:4
 */

	Class({
		
		constructor: function() {
			var
				observers = this.observers = this.observers || [],
				chain = arguments,
				listener,
				_Event = Event;
			if (chain.length == 1 && typeof chain[0] == "object" && chain[0].length) {
				chain = chain[0];
			}
			this.list = chain;
			for (var i=0; i<chain.length-1; i++) {
				listener = function(event, index) {
					if (event.keyCode == _Event.KEY_TAB) {
						try {
							if (event.shiftKey) {
								if (index) $(chain[index-1]).focus();
							} else {
								$(chain[index+1]).focus();
							}
						} catch (e) {}
						_Event.stop(event);
					}
				};
				listener = _Event.bind(listener, 0, i);
				observers.push(
					new _Event.Observer(chain[i], "keydown", listener)
				);
			}
		},
		
		remove: function() {
			var observers = this.observers, observer;
			while (observer = observers.shift()) {
				observer.stop();
			}
			delete this.list;
		}
		
	})
/*
 * Included file end: /myliligo/popups/common/js/tabchain.js
 * Included from:     /myliligo/popups/common/js/popuptools.js:4
 */
,
		Shadow:   
/*
 * Included file begin: /myliligo/popups/common/js/shadow.js
 * Included from:       /myliligo/popups/common/js/popuptools.js:5
 */
	
	Class({
			
		constructor: function(elem, params) {
			params = params || {};
			this.params = {
				offsetX: 4,
				offsetY: 4,
				opacity: 0.25,
				color: "#9d9d9d",
				zIndex: 55,
				img: "/myliligo/popups/common/img/shadow-gray-alpha.png"
			};
			if ((params.color == "#c9db58") && !params.img) {
				params.img = "/myliligo/popups/common/img/shadow-green-alpha.png";
			}
			params = extend(this.params, params);
			var
				dim = Geometry.dimension(this.elem = elem = $(elem)),
				pos = Geometry.position(elem),
				html = [];
			Style.hide(this.div = Element("div"));
			document.body.insertBefore(this.div, document.body.firstChild);
			Style.set(this.div, {
				opacity: params.opacity,
				zIndex: params.zIndex
			});
			(this.inner = Element("div")).style.position = "relative";
			this.div.appendChild(this.inner);
			if (dim[0] > 20) html.push(
				'<div style="height:20px;width:', dim[0]-20, 'px;position:absolute;background:', params.color, ';right:20px;bottom:0"></div>'
			);
			if (dim[1] > 20) html.push(
				'<div style="width:', dim[0],
				'px;height:', dim[1]-20, 'px;position:absolute;background:', params.color, ';bottom:20px;right:0"></div>'
			);
			html.push('<div style="width:', Math.min(dim[0], 20), 'px;height:', Math.min(dim[0], 20), 'px;position:absolute;bottom:0;right:0;');
			if (IE) {
				html.push('filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'', params.img, '\', sizingmethod=\'crop\')');
			} else {
				html.push('background:url(', params.img, ') 100% 100%;');
			}
			html.push('"></div>');
			this.inner.innerHTML = html.join("");
			Style.set(this.inner, {
				height: dim[1]+"px",
				width: dim[0]+"px"
			});
			Style.set(this.div, {
				position: "absolute",
				display: "block",
				left: pos[0]+params.offsetX+"px",
				top: pos[1]+params.offsetY+"px"
			});
		},
		
		remove: function() {
			this.div.removeChild(this.inner);
			document.body.removeChild(this.div);
			delete this.inner;
			delete this.div;
			this.remove = nullFunc;
		}
		
	})
/*
 * Included file end: /myliligo/popups/common/js/shadow.js
 * Included from:     /myliligo/popups/common/js/popuptools.js:5
 */
,
		
		setPosition: function(popup, diff, center) {
			popup = $(popup);
			if (self.pageYOffset) {
				offset = self.pageYOffset;
			} else if (document.documentElement && document.documentElement.scrollTop) {
				offset = document.documentElement.scrollTop;
			} else if (document.body) {
				offset = document.body.scrollTop;
			}
			if (center) {
				var docElem, winHeight = 0;
				if (self.innerHeight) {
					winHeight = self.innerHeight;
				} else if ((docElem = document.documentElement) && docElem.clientHeight) {
					winHeight = docElem.clientHeight;
				} else if (document.body) {
					winHeight = document.body.clientHeight;
				}
				diff = Math.round((winHeight-Geometry.dimension(popup)[1])/2);
			} else {
				if (diff == undefined) diff = 100;
			}
			popup.style.top = offset+diff+"px"
		},
		
		getViewportY: function() {
			var docElem;
			if (self.innerHeight) {
				return [window.pageYOffset, window.pageYOffset+self.innerHeight];
			} else if ((docElem = document.documentElement) && docElem.clientHeight) {
				return [docElem.scrollTop, docElem.scrollTop+docElem.clientHeight];
			} else if (document.body) {
				return [document.body.scrollTop, document.body.scrollTop+document.body.clientHeight];
			}
		},
		
		fadeScreen: function(show, _params) {
			var params = {
				opacity: 0.8,
				zIndex: 40,
				color: "#abc600",
				minHeight: 0
			};
			extend(params, _params || {});
			if (!this.fader) {
				this.fader = Element("div");
				Style.set(this.fader, {
					position: "absolute",
					top: 0,
					left: 0,
					overflow: "hidden",
					display: "none"
				});
				document.body.insertBefore(this.fader, document.body.firstChild);
			}
			if (show) {
				var dim, docElem, winHeight = 0;
				if (self.innerHeight) {
					winHeight = self.innerHeight;
				} else if ((docElem = document.documentElement) && docElem.clientHeight) {
					winHeight = docElem.clientHeight;
				} else if (document.body) {
					winHeight = document.body.clientHeight;
				}
				var oldHeight = document.body.style.height;
				document.body.style.height = "auto";
				if (document.body && (document.body.scrollWidth || document.body.scrollHeight)) {
					dim = [document.body.scrollWidth+"px", Math.max(document.body.scrollHeight, params.minHeight, winHeight)+"px"];
				} else if( document.body.offsetWidth ) {
					dim = [document.body.offsetWidth+"px", Math.max(document.body.offsetHeight, params.minHeight, winHeight)+"px"];
				} else {
					dim = ["100%", "100%"];
				}
				document.body.style.height = oldHeight;
				DatePicker && DatePicker.actual && DatePicker.actual.close();
				Style.set(this.fader, {
					opacity: params.opacity,
					zIndex: params.zIndex,
					backgroundColor: params.color,
					width: dim[0],
					height: dim[1]
				});
				if (IE) {
					forEach($$("select"), function(sel) {
						sel.style.visibility = "hidden";
					});
				}
				Style.show(this.fader);
			} else {
				Style.hide(this.fader);
				if (IE) {
					forEach($$("select"), function(sel) {
						sel.style.visibility = "visible";
					});
				}
			}
		}
		
	});
/*
 * Included file end: /myliligo/popups/common/js/popuptools.js
 * Included from:     /seo/v3/common/js/full.js:9
 */


/*
 * Included file begin: /seo/v3/common/js/crosslink-widget.js
 * Included from:       /seo/v3/common/js/full.js:10
 */
CrosslinkPager = new Class({
	constructor: function(widget) {
		this.widget = widget;
		this.current = 1;
		
		this.box = $("crosslink-"+this.widget);
		this.prevPage = $("crosslink-"+this.widget+"-prev");
		this.nextPage = $("crosslink-"+this.widget+"-next");
		this.items = $$(".crosslink-items li", $("crosslink-"+this.widget));
		this.pagers = $$(".crosslink-pages a", $("crosslink-"+this.widget));
		
		Event.observe(this.prevPage, "click", Event.bindStop(function() {
			this.prevnext(-1);
		}, this));
		Event.observe(this.nextPage, "click", Event.bindStop(function() {
			this.prevnext(+1);
		}, this));
		forEach(this.pagers, function(pager, index) {
			Event.observe(pager, "click", Event.bindStop(function() {
				this.setpage(index+1);
			}, this));
		}, this);
		Event.observe(this.box, "mouseover", bind(function() {
			clearInterval(this.timerId);
		}, this));
		Event.observe(this.box, "mouseout", bind(function(e) {
			this.mouseout(e);
		}, this));

		this.starttimer();
	},
	
	setpage: function(page) {
		Style.hide(this.items[this.current-1]);
		Style.removeClass(this.pagers[this.current-1], "active");
		Style.show(this.items[page-1]);
		Style.addClass(this.pagers[page-1], "active");
		this.current = page;
	},
	
	prevnext: function(pDelta) {
		if ((pDelta > 0) && (this.current + pDelta > this.items.length)) this.setpage(1);
		else if ((pDelta < 0) && (this.current + pDelta < 1)) this.setpage(this.items.length);
		else this.setpage(this.current + pDelta);
	},
	
	starttimer: function() {
		this.timerId = setInterval(bind(function() {
			this.prevnext(1);
		}, this), 8000);
	},
	
	mouseout: function(e) {
		var tg = (window.event) ? e.srcElement : e.target;
		if (tg.className != "hp-widget-content") return;

		var reltg = (e.relatedTarget) ? e.relatedTarget : e.toElement;
		if (reltg) {
			while (reltg != tg && reltg.nodeName != 'BODY') reltg = reltg.parentNode
			if (reltg == tg) return;
			
			setTimeout(bind(function() {
				this.prevnext(1);
				this.starttimer();
			}, this), 1000);
		}
	}
	
});
/*
 * Included file end: /seo/v3/common/js/crosslink-widget.js
 * Included from:     /seo/v3/common/js/full.js:10
 */


liligo.jsOp=function(s, ext) {
	s = s.replace(/ /g,"/");//spacebol legyen slash
	if (!s.match(/.*\/$/)) s += (!ext ? ".jsp" : "." + ext);//es ha nincs a vegen slash, akkor legyen default .jsp
	window.open(s, "_self")
}

liligo.SEOApp = new Application({
	
	init : function(){},
	
	initialize: function(){
		if ($("airwidget")) {
			airWidget = new AirWidget({
				airform: new AirForm()
			});
			/*Event.observe(Query.selectNode("body"), "click", function(e) {
				var el = Event.element(e), up = Query.up(el, "#airwidget");
				if (!up && el.tagName != "A") airWidget.hide();
			});*/
		} else if ($("hotelwidget")) {
			
			hotelWidget = new HotelWidget({					
				hotelform: new HotelForm(),
				safelayer: new Class(SafeLayer, {
					constructor : function(iframe,element){
					element = this.element = $(element);
					element.style.zIndex = 91;
					this.iframe = $(iframe);
					this.container = document.body;
				}})						
			});
			/*Event.observe(Query.selectNode("body"), "click", function(e) {
				var el = Event.element(e), up = Query.up(el, "#hotelwidget");
				if (!up && el.className != "button-small") hotelWidget.hide();
			});*/
		}
		
		forEach(["guide","air","route","hotel","car","news","depnews","lang"], function(tab) {
			if ($("seopage-"+tab)) {
				Event.observe($$("a", $("seotab-"+tab))[0], "click", function(e) {
					Event.stop(e);
					if (tab == "lang") {
						popup = new Popup({
							y: 220,
							template: new liligo.VTemplate("/v3/popups/templates/default.vm", function (context) { 
var text = new liligo.__VT_StringCat(), _function = 'function', 
velocityCount = 0;
if (context.velocityCount) velocityCount=context.velocityCount;

text.push('	<table class="popup" cellspacing="0">		<tr>			<td class="popup-frame-tl">				<div id="popup-');
text.push( context.id);
text.push('-title" class="popup-title"></div>				');
if (context.close) {
text.push('					<a id="popup-');
text.push( context.id);
text.push('-close" class="popup-close" href="');
text.push('#close');
text.push('">						');
text.push( context.labels.common_popup_close);
text.push('					</a>				');
}
text.push('			</td>			<td class="popup-frame-tr"></td>		</tr>		<tr>			<td class="popup-content" id="popup-');
text.push( context.id);
text.push('-content">			</td>			<td class="popup-frame-right"></td>		</tr>		<tr>			<td colspan="2">				<span class="popup-frame-bl"></span>				<span class="popup-frame-br"></span>			</td>		</tr>	</table>');
return text.toString();
}
),
							content: $("seopage-lang"),
							skin: "default-whitebg",
							close: true,
							title: labels.seotab_language
						});
						popup.create();
						popup.show();
					} else $('seo-content').className = tab;
				});
			}
		});
		
		forEach(["package","route","hotel","car"], function(crosscat) {
			if ($("crosslink-"+crosscat)) new CrosslinkPager(crosscat);
		});
		
		if ($("seo-lang")) __Eo("seo-lang", "click", __Eb(this.langClick, this));
		
		new FooterNofollow("footer-nofollow");		
		
	},

	langClick: function(event) {
		var elem = Event.element(event);
		
		//show/hide flags; the wrapper box is needed for IE
		if ((Style.hasClass(elem, "langsel")) || (Style.hasClass(elem.parentNode, "langsel"))) {
			Event.stop(event);
			this.box = Query.selectNode("div.lang_wrapper", this._div);
			Style.showIf(this.box.style.display, this.box);
		}
	}	
	
});

domLoaded(function(){
	liligo.SEOApp.initialize();
    liligo.addScript(config.ajaxHPsrc);
    var interval = setInterval(function(){
        if (liligo.hp) {
            clearInterval(interval);
            liligo.hp.formHtmls[window.config.form] = $("searchbox").innerHTML;
            //so that we can catch subcategory clicks
            new liligo.hp.formEventTracker("searchbox");
        }
    }, 100)
    
});
    
//# copy urls from buffer (noindex nofollow request)
var FooterNofollow = new Class({
    constructor: function(target){
        if (!(this.target = $(target))) 
            return false;
        var match;
        
        forEach($$("a[class]", this.target), function(link){
            if ((match = link.className.match(/url:([^ ]*)/)) && (match[1])) {
                link.href = match[1];
                link.className = link.className.replace(/url:[^ ]*/, "");
            }
        });
    }
    
});  





/*
 * Included file end: /seo/v3/common/js/full.js
 * Included from:     /seo/v3/common/js/_main_hotel.js:6
 */

	
})()
    

/*
 * Included file begin: /seo/v3/common/js/_main_common.js
 * Included from:       /seo/v3/common/js/_main_hotel.js:10
 */
function buzzrelaunch(i, outdate, retdate){
	document.getElementById("searchid").value = i;
	
	if ((outdate) && (retdate)) {
		document.getElementById("relform_outdate").value = outdate;
		document.getElementById("relform_retdate").value = retdate;
	}
	
	var relForm = document.getElementsByName('relaunch')[0];
	relForm.action = ((window.config && window.config.flightUrl) ? window.config.flightUrl : "") + "/air/callbackSearch.jsp?buzz=true";
	relForm.submit();
}


function carSearch(i){
	document.getElementById("searchid").value = i;
	
	var relForm = document.getElementsByName('relaunch')[0];
	relForm.action = ((window.config && window.config.carUrl) ? window.config.carUrl : "") + "/cars/sc.jsp";
	relForm.submit();
}


function redirectLink(json){
	var linkParams = eval(json);
	var queryParams = linkParams.query.split("&");
	var form = document.getElementById("redirectForm");

	form.innerHTML = "";
	form.action = linkParams.server + linkParams.url;
	
	for (var i=0;i<queryParams.length;i++) {
		var pair = queryParams[i].split("=");
		var input = document.createElement('input');		
		input.type = "hidden";
		input.name = pair[0];
		input.value = pair[1];
		form.appendChild(input);
	}

	form.submit();
	return false;				
}
/*
 * Included file end: /seo/v3/common/js/_main_common.js
 * Included from:     /seo/v3/common/js/_main_hotel.js:10
 */



