// Show Filter Popups
function ShowFilterPopup(FilterButtonID, FilterArrowID, FilterPopupID) {
	var FilterButton = document.getElementById(FilterButtonID);
	var FilterArrow = document.getElementById(FilterArrowID);
	var FilterPopup = document.getElementById(FilterPopupID);

	// Open/Close Popup
	if (FilterPopup.style.display != "block") {
		HideFilterAllPopups();
		
		FilterPopup.style.display = "block";
		FilterArrow.style.backgroundImage = "url(../../images/To604/Summary/SearchForm/ArrowOn.gif)";
		
		//Brower Check
		if (!checkIt('compatible'))
		{
			FilterPopup.style.top = FilterButton.offsetTop + FilterButton.offsetHeight + 130;
		} else {
			FilterPopup.style.top = FilterButton.offsetTop + FilterButton.offsetHeight + 145;
		}
	} else {
		HideFilterAllPopups();
	}
}

//Close All Filter Popups
function HideFilterAllPopups() {
	var AreaChoices = document.getElementById("AreaChoices");
	var CuisineChoices = document.getElementById("CuisineChoices");
	var PriceChoices = document.getElementById("PriceChoices");
	var FeatureChoices = document.getElementById("FeatureChoices");
	
	var AreaArrow = document.getElementById("AreaArrow");
	var CuisineArrow = document.getElementById("CuisineArrow");
	var PriceArrow = document.getElementById("PriceArrow");
	var FeatureArrow = document.getElementById("FeatureArrow");
	
	AreaChoices.style.display = "none";
	CuisineChoices.style.display = "none";
	PriceChoices.style.display = "none";
	FeatureChoices.style.display = "none";
	
	// Change BG Images
	AreaArrow.style.backgroundImage = "url(../../images/To604/Summary/SearchForm/ArrowOff.gif)";
	CuisineArrow.style.backgroundImage = "url(../../images/To604/Summary/SearchForm/ArrowOff.gif)";
	PriceArrow.style.backgroundImage = "url(../../images/To604/Summary/SearchForm/ArrowOff.gif)";
	FeatureArrow.style.backgroundImage = "url(../../images/To604/Summary/SearchForm/ArrowOff.gif)";
}

//Check/Uncheck Search Checkboxes
function SelectCheckBoxes(ChoiceCheckboxName, ChoiceHiddenBoxID, ChoiceLabelHiddenBox, FilterButtonID, FilterButtonTextID, DefaultText) {
	var ChoiceCheckbox = document.getElementsByName(ChoiceCheckboxName);
	var ChoiceLabelHiddenBox = document.getElementsByName(ChoiceLabelHiddenBox);
	var ChoiceHiddenBox = document.getElementById(ChoiceHiddenBoxID);
	var FilterButtonText = document.getElementById(FilterButtonTextID);
	var FilterButton = document.getElementById(FilterButtonID);

	var varSelectedChoices = "";
	var varSelectedLabel = "";
	var intCount = 0;
	var intSelected = 0;
	
	//Search Selected Checkboxes
	for (intCount=0; intCount < ChoiceCheckbox.length; intCount++) {
		if (ChoiceCheckbox[intCount].checked) {
			varSelectedChoices += ChoiceCheckbox[intCount].value + ",";
			varSelectedLabel = ChoiceLabelHiddenBox[intCount].value;
			intSelected++;
		}
	}
	
	ChoiceHiddenBox.value = varSelectedChoices.substr(0, varSelectedChoices.length - 1);
	
	if (ChoiceHiddenBox.value == "") {
		ChoiceHiddenBox.value = "0";
	}
	
	//Change Filter Button Label
	if (intSelected > 1) {
		FilterButtonText.innerHTML = "Multiple";
		FilterButton.className = "SelectedFilter";
	} else if (intSelected == 1) {
		FilterButtonText.innerHTML = varSelectedLabel;
		FilterButton.className = "SelectedFilter";
	} else {
		FilterButton.className = "Filter";
		FilterButtonText.innerHTML = DefaultText;
	}
}

function LoadSelectedChoices(ChoiceCheckboxName, ChoiceHiddenBoxID, ChoiceLabelHiddenBox, FilterButtonID, FilterButtonTextID, DefaultText)
{
	var ChoiceCheckbox = document.getElementsByName(ChoiceCheckboxName);
	var ChoiceLabelHiddenBox = document.getElementsByName(ChoiceLabelHiddenBox);
	var ChoiceHiddenBox = document.getElementById(ChoiceHiddenBoxID);
	var FilterButtonText = document.getElementById(FilterButtonTextID);
	var FilterButton = document.getElementById(FilterButtonID);

	var SelectedChoices = "";
	var varSelectedLabel = "";
	var intCount = 0;
	var intCount2 = 0;
	var intSelected = 0;

	SelectedChoices = ChoiceHiddenBox.value.split(",");

	if (SelectedChoices.length > 0 && SelectedChoices[0] != 0) {
		//Search Selected Choices in Hidden Box
		for (intCount=0; intCount < SelectedChoices.length; intCount++) {
			//Search Selected Checkboxes
			for (intCount2=0; intCount2 < ChoiceCheckbox.length; intCount2++) {
				if (ChoiceCheckbox[intCount2].value == SelectedChoices[intCount]) {
					ChoiceCheckbox[intCount2].checked = true;
					varSelectedLabel = ChoiceLabelHiddenBox[intCount2].value;
					intSelected++;
				}
			}
		}
	}
	
	//Change Filter Button Label
	if (intSelected > 1) {
		FilterButtonText.innerHTML = "Multiple";
		FilterButton.className = "SelectedFilter";
	} else if (intSelected == 1) {
		FilterButtonText.innerHTML = varSelectedLabel;
		FilterButton.className = "SelectedFilter";
	} else {
		FilterButton.className = "Filter";
		FilterButtonText.innerHTML = DefaultText;
	}
}

/**************************************************************************/

function TriggerFeelingHungrySearch(SearchTypeHiddenBox)
{
}

function TriggerRegularSearch(btnSearchButtonID)
{
	var btnSearchButton = document.getElementById(btnSearchButtonID);
	btnSearchButton.click();
}

/**************************************************************************/