/*Find.js */
function AddCity()
{
	var x = document.form.mCity.selectedIndex;
		
	if(x > -1)
	{
		for(var i=x;i<document.form.mCity.options.length; i++)
		{
			if (document.form.mCity.options[i].selected) 
			{
				var strCity = document.form.mCity.options[i].value;
				addOption(document.form.SelectedCity,strCity,strCity);
			}
		}

		document.form.City.value = GetList(document.form.SelectedCity);
	}
		
}
function GetList(selectObject)
{
	var str = "";
	for (i=0; i<selectObject.options.length; i++)
	{
		str = str + selectObject.options[i].text + ",";
		
	} 
	return str;
}

function RemoveCity()
{
	if(document.form.SelectedCity.selectedIndex > -1)
	{
		for(var i=document.form.SelectedCity.selectedIndex;i<document.form.SelectedCity.options.length; i++)
		{
			while (document.form.SelectedCity.options[i]!=null && document.form.SelectedCity.options[i].selected) 
			{
				deleteOption(document.form.SelectedCity,i);
				document.form.City.value = GetList(document.form.SelectedCity);		
			}
		}
	}
}
function DoesNotExist (selectObject, optionText, optionValue)
{ 
	var bln = true;
	for (i=0; i<selectObject.options.length; i++){
		if (optionText == selectObject.options[i].text ||  optionValue == selectObject.options[i].text ){
			bln = false;
			break
		}
	} 
	return bln;
}


function addOption(selectObject,optionText,optionValue) 
{
	var bln = DoesNotExist (selectObject, optionText, optionValue);
    if (bln )
    {
		var optionObject = new Option(optionText,optionValue)
		var optionRank = selectObject.options.length
		selectObject.options[optionRank]=optionObject
    }
    return bln;
}

function deleteOption(selectObject,optionRank) 
{
    if (selectObject.options.length!=0) { selectObject.options[optionRank]=null }
}

function ResetNarrow(blnS)
{
	var r;
	var c;
	var x;
	document.form1.pricemin.value="";
	document.form1.pricemax.value="";
	if(document.form1.byowner.selectedIndex >0)
	{
		x = document.form1.byowner.selectedIndex;
		document.form1.byowner.options[x].selected = false;
		document.form1.byowner.selectedIndex = 0;
	
	}
	if(document.form1.results.selectedIndex >0)
	{
		x = document.form1.results.selectedIndex;
		document.form1.results.options[x].selected = false;
		document.form1.results.selectedIndex = 2;
	
	}
	var a = document.getElementById("recordFilters").getElementsByTagName("input");
	for(i=0;i<a.length;i++)
	{
		//alert(a[i].type);
		if(a[i].type !="button" && a[i].type!="submit")
			a[i].value = "";
	}
	
	a = document.getElementById("recordFilters").getElementsByTagName("select");
	
	for(i=0;i<a.length;i++)
	{
		if(a[i].options.length>0 && a[i].options[0].text == "Show All" && a[i].selectedIndex > 0)
		{
			
			x = a[i].selectedIndex;
			a[i].options[x].selected = false;
			a[i].selectedIndex = 0;
		}
	}
		
	
	
	if(blnS)
	{
		document.form1.submit();
	
	}
	
}