
function submitSearch()
{
	var strDelimiter = "|";
	
	/* GETTING COUNTRIES, REGIONS AND TOWN/CITY */
	var continent = document.getElementById("ddlContinent"); 
	var country = document.getElementById("ddlCountry"); 
	var region = document.getElementById("ddlRegion"); 
	var townCity = document.getElementById("ddlTownCity"); 
	
	var strContinent = "";
	if (continent.length != 0 && continent.options[continent.selectedIndex].value != "Please Choose")
	{
		strContinent = "ContinentId=" + continent.options[continent.selectedIndex].value + "&";
	}
	
	
	var strCountry = "";
	if (country.length != 0 && country.options[country.selectedIndex].value != "Please Choose")
	{
		strCountry = "Country=" + country.options[country.selectedIndex].value + "&";
	}
	
	var strRegion = "";
	if (region.length != 0 && region.options[region.selectedIndex].value != "Please Choose")
	{
		strRegion = "Region=" + region.options[region.selectedIndex].value + "&";
	}
	
	var strTownCity = "";
	if (townCity.length != 0 && townCity.options[townCity.selectedIndex].value != "Please Choose")
	{
		strTownCity = "TownCity=" + townCity.options[townCity.selectedIndex].value + "&";
	}

	/* GETTING MINPRICE AND MAX PRICES.*/
	var minPrice = document.getElementById("ddlMinPrice"); 
	var maxPrice = document.getElementById("ddlMaxPrice"); 
	
	var strMinPrice = "minprice=" + minPrice.options[minPrice.selectedIndex].value + "&";
	var strMaxPrice = "maxprice=" + maxPrice.options[maxPrice.selectedIndex].value + "&";
		
	/* GETTING PROPERTY TYPES BASED ON SELECTION*/
	oSelect = document.getElementById("ddlPropertyTypes"); 
	var PropertyType = oSelect.options[oSelect.selectedIndex].value
	var strPropertyType = "";
	
	if (PropertyType == "All")
	{
		for(var i = 0; i < oSelect.length ; i++)
		{
			if (oSelect.options[i].value != "All")
				strPropertyType = strPropertyType + oSelect.options[i].value + strDelimiter
		}
		strPropertyType = "Type=" + strPropertyType.substr(0, strPropertyType.length -1);
	}
	else
	{
		strPropertyType = "Type=" + PropertyType;
	}

	var strRedirect = "PropertySearch.aspx?" + strContinent + strCountry + strRegion + strTownCity + strMinPrice + strMaxPrice + strPropertyType;
	window.location.href = strRedirect;
	
}

function submitSearchByRef()
{
	/* GETTING txtSearchByRef VALUE*/
	var SearchByRef = document.getElementById("BannerFooter1_txtSearchByRef"); 
	
	var strSearchByRef = "";
	if (SearchByRef.length != 0 && SearchByRef.value != "")
	{
		strSearchByRef = "Id=" + SearchByRef.value
	}
	strRedirect = "PropertySearch.aspx?" + strSearchByRef;
	var strRedirect = "PropertySearch.aspx?" + strSearchByRef;
	document.location.href = strRedirect;
		
	return false;
}

function doClick(buttonName,e)
{
	//the purpose of this function is to allow the enter key to 
	//point to the correct button to click.
	var key;

    if(window.event)
		key = window.event.keyCode; //IE
	else
		key = e.which;				//Firefox

	if(key == 13)
    {
		//Get the button the user wants to have clicked
		var btn = document.getElementById(buttonName);
        if(btn != null)
        { //If we find the button click it
			btn.click();
            event.keyCode = 0
		}
	}
}
