$(document).ready(function() {
	
	$("#search_type").change(function() {
		if ($("#search_type option:selected").text() == 'Rentals') {
			$("#advSearch").attr("href", "search_rentals.aspx");
		} else if ($("#search_type option:selected").text() == 'Sales') {
			$("#advSearch").attr("href", "search_sales.aspx");
		} else if ($("#search_type option:selected").text() == 'Townhouses') {
			$("#advSearch").attr("href", "search_townhouse.aspx");
		}
	});
	
	//change the #content div's id so the banner extends to 100% width
	$("#content").attr("id", "homecontent");

	  /**********************/
	 /* Homepage Slideshow */
	/**********************/
	
	// Make "Follow Your Dreams" transparent, then remove the hidden class
	$(".overtext").fadeOut(10);
	$(this).removeClass('hidden');	
	
	// Animate the three boxes	
	$("#ot1").delay(500).fadeIn(500, function() {
		$("#ot2").fadeIn(500, function() {
			$("#ot3").fadeIn(500, function() {
				$("#ot1").delay(1200).fadeOut(500, function() {
					$("#ot2").fadeOut(500, function() {
						$("#ot3").fadeOut(500, function() {
							$(".sky").fadeOut(800, function() {
								$(".overimg").delay(2000).fadeOut(1600);
							});
						});
					});
				});
			});
		});
	});	
	
});


function validate()
{
   var min_price = document.getElementById('price_min').value.replace("$", "").replace(",","");
   var max_price = document.getElementById('price_max').value.replace("$", "").replace(",","");
   
   if (min_price == "" || max_price == "")
   {
     alert("You must provide a price range for the quick search.");
     return false;
   }
   
   return true;
}