function initResults() {
	var isFirefox = navigator.userAgent.indexOf('Firefox') > -1;
	$("#boxController").toggle(
		function() {			
			if (isFirefox) {
				$("#search-box").hide();
			} else {
  				$("#search-box").slideUp('slow');
			}
  			this.innerHTML = "Show Search";
		},function() {
			if (isFirefox) {
				$("#search-box").show();
			} else {
  				$("#search-box").slideDown('slow');
			}  			
  			this.innerHTML = "Hide Search";
		}
	);
}

function initSearch() {
	$(document).ready(function() {	
		$('#propertyType').bind('change', 
			function() {				
				if (this.value == 'All' || this.value == 'Condominium') {
					$("#condosRow").show();
				} else {
					$("#condosRow").hide();
				}				
			} 
		);			
		var propType = $('#propertyType').get(0).value;		
		if (propType == 'All' || propType == 'Condominium') {
			$("#condosRow").show();
		} else {
			$("#condosRow").hide();
		}				
	});	
}

var MAIN_IMG = null;
var MAIN_IMG_SRC = null;
var MAIN_WIDTH = -1;
var imageCache = new Array();
function initListing() {
	$(document).ready(function() {	
		MAIN_IMG = $('#mainImg').get(0);
		MAIN_IMG_SRC = MAIN_IMG.src;		
		MAIN_WIDTH   = MAIN_IMG.width;
		$(".thickbox").each(
			function() {				
				if (this.rel == 'house-pics') {
					var img = this.firstChild;
					if (img.getAttribute('id') != 'mainImg') {
						var tempImg = new Image();
						tempImg.src = this.href;						
						imageCache[this.href] = tempImg;
						//jQuery("<img>").attr("src", this.src);						
					}					
				}				
			}
		);		
	});	
}

function changeImages(link, width) {	
	//if (MAIN_HEIGHT == -1) {	
		//MAIN_HEIGHT = MAIN_IMG.height;
	//}
	
	var temp = imageCache[link.href];	

	var mainImg = $('#mainImg').get(0);	
	
	mainImg.width  = width;
	mainImg.src = temp.src;		
	mainImg.height = 300;
}

function clearImages() {	
	MAIN_IMG.src = MAIN_IMG_SRC;
	MAIN_IMG.width = MAIN_WIDTH;
}