// JavaScript Document

function DropDownOptionSelected(Value) {

	DropDown = document.getElementById('dropdown_dd');

	if(DropDown) {

		if(DropDown.LastRanForCheck == "guests") {

			InputField = document.getElementById('guests');
			DDLabel = document.getElementById('guests_label');

		}

		if(DropDown.LastRanForCheck == "beds") {

			InputField = document.getElementById('beds');
			DDLabel = document.getElementById('beds_label');

		}

		if(InputField)
			InputField.value = Value;

		if(DDLabel)
			DDLabel.innerHTML = Value;

	}

	DelayedHideDropDown();

	return false;
}


function ShowDropDown(RunForCheck) {

	DropDown = document.getElementById('dropdown_dd');

	if(!DropDown)
		return;

	DropDown.LastRanForCheck = RunForCheck;

	InputFix = document.getElementById('search_' + RunForCheck + '_holder');

	if(!InputFix)
		return false;

	fixPos = findPos(InputFix);

	document.getElementById('dropdown_holder').style.width = (InputFix.offsetWidth - 6) + "px";

	DropDown.style.left = fixPos[0] + "px";
	DropDown.style.top  = fixPos[1] + 26 + "px";

	DropDown.style.display = "block";

	return false;

}

function HideDropDown() {
	document.DropDownHideTimer = window.setTimeout("DelayedHideDropDown()", 500);
}

function DelayedHideDropDown() {
	DropDown = document.getElementById('dropdown_dd');

	if(DropDown)
		DropDown.style.display = "none";

	return false;

}

function CancelHideDropDown() {
	window.clearTimeout(document.DropDownHideTimer);
}

