function funSearch(strPage) {
	if (eval(document.frmListings.MinPrice.value) > eval(document.frmListings.MaxPrice.value))
	{
		alert("The minimum price must not be greater than the maximum price.");
		document.frmListings.MinPrice.focus();
		return false;
	}
	if (eval(document.frmListings.MinBedroom.value) > eval(document.frmListings.MaxBedroom.value))
	{
		alert("The minimum number of bedrooms must not be greater than the maximum number of bedrooms.");
		document.frmListings.MinBedroom.focus();
		return false;
	}
	if (eval(document.frmListings.MinBathroom.value) > eval(document.frmListings.MaxBathroom.value))
	{
		alert("The minimum number of bathrooms must not be greater than the maximum number of bathrooms.");
		document.frmListings.MinBathroom.focus();
		return false;
	}
	if (eval(document.frmListings.MinSqFootage.value) > eval(document.frmListings.MaxSqFootage.value))
	{
		alert("The minimum square footage of bathrooms must not be greater than the maximum square footage.");
		document.frmListings.MinSqFootage.focus();
		return false;
	}
	
	//if (!isDigits(document.frmListings.PropertyID.value)) 
	//{
	//	alert("The WhereToLive.com ID must be a number.");
	//	document.frmListings.PropertyID.focus();
	//	document.frmListings.PropertyID.select();
	//	return false;
	//}
	
	document.frmListings.StartRow.value = "1";

	document.frmListings.action = strPage

}

function funSort(s) {
	//if (document.frmListings.SortColumn.value == s)
	//{ 
	//	if (document.frmListings.SortOrder.value == 'ASC') document.frmListings.SortOrder.value = 'DESC'
	//	else document.frmListings.SortOrder.value = 'ASC'
	//}
	//else document.frmListings.SortOrder.value = 'ASC'
	//document.frmListings.SortColumn.value = s;
	document.frmListings.StartRow.value = "1";
	
}

function funSave(strPage) {


	if (validateString(document.forms[0].Description, "You must enter a description for your search."))
		{
		document.frmListings.action = strPage + "?DataAction=Save";
		document.frmListings.submit();
		}

}

function funSaveHomeDelivery(strPage) {
	
	// Check for search description.
	if (validateString(document.forms[0].SearchDesc, "You must enter a description for your search."))
		{
		// Does email input exist, if so then not an agent.
		if (document.forms[0].AltEmailAddr)
			{
			// Does email address exist on forms[0].
			if (trim(document.forms[0].AltEmailAddr.value) != "") 
				{
				// Is email address valid.
				if (validateEmail(document.forms[0].AltEmailAddr, "The e-mail address you entered is not valid."))
					{
					document.frmListings.action = strPage + "?DataAction=Save";
					document.frmListings.submit();
					}
				}
			// Then use email address exist on frmListings.
			else
				{
				
				document.frmListings.action = strPage + "?DataAction=Save";
				document.frmListings.submit();
				}
			}
		// Email input does not exist, then user is an agent.
		else
			{
			// Does agent guest select exist?
			if (document.forms[0].AgentGuestSelect) 
				{
			
				// Build multiple guest querystring.
				var selAgent = document.forms[0].AgentGuestSelect; 			
				var i, strGuestIDs
			
				strGuestIDs = ""
				
				for (i = 0; i < selAgent.length; i++) 
				{

					if (selAgent.options[i].selected)
					{
											
					strGuestIDs = strGuestIDs + "&GuestID=" + selAgent.options[i].value;
					}
				}
				
				document.frmListings.action = strPage + "?DataAction=Save" + strGuestIDs;
				document.frmListings.submit();
				}
			}
		}
}

function funHelpWindow(s) {
	window.open(s,"Help",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=676,height=430');
}