function checkSkiHotelFields(accommodationId){
	if(document.getElementById("skiHotelStartTravelDate") && !document.getElementById("skiHotelStartTravelDate").value){
		alert(lang_s["error.selectDate"]);
		return false;
	}
	if(document.getElementById("skiHotelPersons").value && !document.getElementById("skiHotelStartTravelDate").value){
		alert(lang_s["error.selectDate"]);
		return false;
	}

	if(document.getElementById("skiHotelPersons") && !document.getElementById("skiHotelPersons").value){
		alert(lang_s["error.personsIncorrectValue"]);
		return false;
	}
	
	if(document.getElementById("skiHotelDuration") && !document.getElementById("skiHotelDuration").value){
		alert(lang_s["error.durationIncorrectValue"]);
		return false;
	}

	if(document.getElementById("skiHotelPersons") && document.getElementById("skiHotelPersons").value){
		var reg=/^\d+$/;
		if(!reg.test(document.getElementById("skiHotelPersons").value)){
			alert(lang_s["error.personsIncorrectValue"]);
			return false;
		}
	}

	if(document.getElementById("skiHotelStartTravelDate").value && document.getElementById("skiHotelPersons").value && document.getElementById("skiHotelDuration").value){
		var weekId = document.getElementById("skiHotelStartTravelDate").value;
		var persons = document.getElementById("skiHotelPersons").value;
		var duration = document.getElementById("skiHotelDuration").value;
		showSkiRooms(accommodationId,weekId,persons,duration,"singleHotel");
	}
}

function showSkiRooms(id,weekId,persons,duration,mode){
	try{
		var strParams = "";
		var link = lang_s["URL"]+"ajax.php?grandparent=site";
		strParams += "&m=accomodations";
		strParams += "&id="+id;
		switch(mode){
			case "singleHotel":
				strParams += "&a=250";
				strParams += "&WeekID="+weekId;
				strParams += "&Persons="+persons;
				strParams += "&Duration="+duration;
				document.getElementById("skiHotelRoomsData").style.align = "center";
				document.getElementById("skiHotelRoomsData").innerHTML = "<table width=100%><tr><td width=47%>&nbsp;</td><td width=16px; padding=0px><img style='width:16px;border:0px;' src=\"/images/loading.gif\"/></td><td padding=0px width=100% align='left'>"+lang_s["label.common.ajaxLoading"]+"</td></tr></table>";
				document.getElementById("skiHotelRoomsDataHeader").style.display = "block";
				var objAj = new Ajax.Updater("skiHotelRoomsData", link + strParams);
			break;
		}

    }catch(e){
    	alert(e.toString());
    }
}

function setFakeWidth(){
	id = "ifr";
	var myIframe = document.getElementById(id);
	if (myIframe) {
		if (myIframe.contentDocument && myIframe.contentDocument.body.offsetHeight) {
			// W3C DOM (and Mozilla) syntax
			myIframe.height = myIframe.contentDocument.body.offsetHeight + 20;    
		} else if (myIframe.Document && myIframe.Document.body.scrollHeight) {
			// IE DOM syntax
			myIframe.height = myIframe.Document.body.scrollHeight + 20;
		}
	}
}

function openBooking(locationUrl){
	var settings='width=900,height=700,top=100,left=100,location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=yes,resizable=yes,dependent=no';
	window.open(locationUrl,"StartBooking",settings);
}