// JavaScript Document
function set_dropdown(set_this, to_this)
{
	document.getElementById(set_this).value = to_this;
}

function clear_default_text(clear_this, if_its_this)
{
	if (document.getElementById(clear_this).value == if_its_this)
	{
		document.getElementById(clear_this).value = '';
	}
}

function set_textbox_value(textbox_name, set_to_this)
{
	document.getElementById(textbox_name).value = set_to_this;
}

function swap_images(this_src, big1_src, small_src)
{
	document.getElementById("big1").src = this_src;
	document.getElementById(small_src).src = big1_src;
}

function searchFromResultsPage()
{
	if (document.propertyForm.property_location.value != '')
	{
		var property_location = document.propertyForm.property_location.value;
		var county = document.propertyForm.county.options[document.propertyForm.county.selectedIndex].value;
		var property_type = document.propertyForm.property_type.options[document.propertyForm.property_type.selectedIndex].value;
		var property_min_price = document.propertyForm.property_min_price.options[document.propertyForm.property_min_price.selectedIndex].value;
		var property_max_price = document.propertyForm.property_max_price.options[document.propertyForm.property_max_price.selectedIndex].value;
		var property_min_bedrooms = document.propertyForm.property_min_bedrooms.options[document.propertyForm.property_min_bedrooms.selectedIndex].value;
		
		var myUrl = 'http://www.thebigpropertylist.co.uk/results/'+document.propertyForm.property_location.value+'/'+county+'/'+property_type+'/'+property_min_price+'_'+property_max_price+'_'+property_min_bedrooms+'_sale/true/price_high_to_low/ls/1/id/'
		document.location.href=myUrl.replace(" ", "+");
	}
	else
	{
		alert("Enter location...");
		return false;
	}
}

function validate(formIn) {
	//alert(formIn.property_location.value);
	if(formIn.property_location.value == ""){
		return false;
	}else if(formIn.property_location.value == "Enter location..."){
		return false;
	}else{
		return true;
	}
}