// SAVED PROPERTIES (start) ************************************************************
//**************************************************************************************

var pendingSaveID;
var pendingSaveType;
var bypass;

function setCookie(c_name,value,exdays)
{
	var exdate=new Date();
	exdate.setDate(exdate.getDate() + exdays);
	var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
	document.cookie=c_name + "=" + c_value;
}

function getCookie(c_name)
{
var i,x,y,ARRcookies=document.cookie.split(";");
for (i=0;i<ARRcookies.length;i++)
{
  x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
  y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
  x=x.replace(/^\s+|\s+$/g,"");
  if (x==c_name)
    {
    return unescape(y);
    }
  }
}

function save_property(id, type) {
		
	var username=getCookie("username");
		
	if(username != null && username != '' || bypass == 1){
		
		setCookie("'saveBox",1,365);
	
		var ajx = new ajax();
		ajx.open("get","/includes/ajax_realestate.php?action=save_property&id=" + id + "&type=" + type + "&random=" + Math.random(9999999999), true);
		ajx.onreadystatechange = function() {
			if(ajx.readyState == 4) {
				document.getElementById('saved_properties_content').innerHTML = ajx.responseText;
			}
		}
		ajx.send(null);
		
		var totcart = document.getElementById('dolickCounter').innerHTML;
		
		totcart = parseInt(totcart);
		
		totcart++;
		
		document.getElementById('dolickCounter').innerHTML = totcart;
		
		deleteOpt('#dolickCounter', 'The property was added to your cart.', 'topRight');
	
	} else {
	
		pendingSaveID = id;
		pendingSaveType = type;
	
		$('#registerBox_fade').fadeIn();
		$('#registerBox').fadeIn();
		
	}
	
}

function saveListingData(){
	
	if($('#register_name').val() != '' && $('#register_email').val() != '' && $('#register_phone').val() != '') {
		
		bypass = 1;
		
		save_property(pendingSaveID, pendingSaveType);
		
		var ajx = new ajax();
		ajx.open("get","/includes/ajax_realestate.php?action=registration&name=" + $('#register_name').val() + "&email=" + $('#register_email').val() + "&phone=" + $('#register_phone').val() + "&mls=" + pendingSaveID + "&random=" + Math.random(9999999999), true);
		ajx.onreadystatechange = function() {
			if(ajx.readyState == 4) {
				
			}
		}
		ajx.send(null);		
		
		$('#registerBox_fade').fadeOut();
		$('#registerBox').fadeOut();
		
	} else {
		alert('Please fill in all fields to continue');	
	}
}

function cancelListingData(){
	$('#registerBox_fade').fadeOut();
	$('#registerBox').fadeOut();
}


function delete_saved_property(mls) {	
	var ajx = new ajax();
	ajx.open("get","/includes/ajax_realestate.php?action=delete_saved_property&mls=" + mls + "&random=" + Math.random(9999999999), true);
	ajx.onreadystatechange = function() {
		if(ajx.readyState == 4) {
			document.getElementById('saved_properties_content').innerHTML = ajx.responseText;
			//load_saved_properties();
		}
	}
	ajx.send(null);
	
	var totcart = document.getElementById('dolickCounter').innerHTML;
	
	totcart = parseInt(totcart);
	
	totcart--;
	
	document.getElementById('dolickCounter').innerHTML = totcart;
	
	deleteOpt('#dolickCounter', 'The property was removed from your cart.', 'topRight');	
	
}

function load_saved_properties() {
	document.getElementById('saved_properties_content').innerHTML = "<br /><center><img src='/images/loading/loading_circle.gif' height='54' width='55' alt='loading' /></center><br /><br />";
	var ajx = new ajax();
	ajx.open("get","/includes/ajax_realestate.php?action=load_saved_properties&random=" + Math.random(9999999999), true);
	ajx.onreadystatechange = function() {
		if(ajx.readyState == 4) {
			document.getElementById('saved_properties_content').innerHTML = ajx.responseText;
		}
	}
	ajx.send(null);
}
// SAVED PROPERTIES (end) **************************************************************
//**************************************************************************************




// SLIDESHOW (start) *********************

var ss_interval;
var ss_timeout;
var ss_currentPhoto = 1;
var ss_showingImage = 1; //which of the 2 <img> is currently visible
var ss_imageId = "photo_lrg"; //imageId would be "photo_lrg" if the 2 divs are photo_lrg1 and photo_lrg2
var ss_numPhotos;
var ss_mls;
var ss_slideTime = 5000;
function start_slideshow(mls, numPhotos, startNum) {
	ss_currentPhoto = startNum;
	if(mls != "") ss_mls = mls;
	if(numPhotos > 0) ss_numPhotos = numPhotos;
	if(mls == "") mls = ss_mls;
	ss_interval = setInterval("run_slideshow('"+ss_mls+"', '"+ss_numPhotos+"', '"+startNum+"');", ss_slideTime);
}
function run_slideshow() {
	if(ss_currentPhoto == ss_numPhotos) {
		var nextPhoto = 1;
		ss_currentPhoto = 1;
	} else {
		var nextPhoto = ss_currentPhoto + 1;
		ss_currentPhoto++;
	}
	if(nextPhoto == 1) {
		var img = "http://photo.wfrmls.com:443/nocache.php?p=280x220/" + ss_mls + ".jpg";
		var lrgImg = "http://photo.wfrmls.com:443/nocache.php?p=640x480/" + ss_mls + ".jpg";
	} else {
		var img = "http://photo.wfrmls.com:443/nocache.php?p=mul280x220/" + ss_mls + "_" + (nextPhoto-1) + ".jpg";
		var lrgImg = "http://photo.wfrmls.com:443/nocache.php?p=mul640x480/" + ss_mls + "_" + (nextPhoto-1) + ".jpg";	
	}

	if(ss_showingImage == 1) {
		$("#"+ss_imageId+"2").css("display","none");
		$("#"+ss_imageId+"2").css("z-index","200");
		$("#"+ss_imageId+"1").css("z-index","100");
		changeSrc(ss_imageId+"2", img);
		/*changeHref(ss_imageId+"2_link", lrgImg);
		changeHref("photo_lrg_magnify", lrgImg);*/
		changeHref(ss_imageId+"1_link", "http://www.utahmore.com/modules/photos_realestate.php?id=" + ss_mls + "&photo=" + ss_currentPhoto);
		changeHref("photo_lrg_magnify", "http://www.utahmore.com/modules/photos_realestate.php?id=" + ss_mls + "&photo=" + ss_currentPhoto);
		$("#"+ss_imageId+"2").fadeIn('slow');
		ss_showingImage = 2;
	} else {
		$("#"+ss_imageId+"1").css("display","none");
		$("#"+ss_imageId+"1").css("z-index","200");
		$("#"+ss_imageId+"2").css("z-index","100");
		changeSrc(ss_imageId+"1", img);
		/*changeHref(ss_imageId+"1_link", lrgImg);
		changeHref("photo_lrg_magnify", lrgImg);*/
		changeHref(ss_imageId+"2_link", "http://www.utahmore.com/modules/photos_realestate.php?id=" + ss_mls + "&photo=" + ss_currentPhoto);
		changeHref("photo_lrg_magnify", "http://www.utahmore.com/modules/photos_realestate.php?id=" + ss_mls + "&photo=" + ss_currentPhoto);
		$("#"+ss_imageId+"1").fadeIn('slow');
		ss_showingImage = 1;
	}
}

function changeSrc(id,img) {
	document.getElementById(id).src = img;
}
function changeHref(id,href) {
	document.getElementById(id).href = href;
}

function thumbnail_clicked(imageNum) {
	if(imageNum == 1) {
		changeSrc(ss_imageId+"1", "http://photo.wfrmls.com:443/nocache.php?p=280x220/" + ss_mls + ".jpg");
		changeSrc(ss_imageId+"2", "http://photo.wfrmls.com:443/nocache.php?p=280x220/" + ss_mls + ".jpg");
		/*changeHref(ss_imageId+"1_link", "http://photo.wfrmls.com:443/nocache.php?p=640x480/" + ss_mls + ".jpg");
		changeHref(ss_imageId+"2_link", "http://photo.wfrmls.com:443/nocache.php?p=640x480/" + ss_mls + ".jpg");
		changeHref("photo_lrg_magnify", "http://photo.wfrmls.com:443/nocache.php?p=640x480/" + ss_mls + ".jpg");*/
		changeHref(ss_imageId+"1_link", "http://www.utahmore.com/modules/photos_realestate.php?id=" + ss_mls);
		changeHref(ss_imageId+"2_link", "http://www.utahmore.com/modules/photos_realestate.php?id=" + ss_mls);
		changeHref("photo_lrg_magnify", "http://www.utahmore.com/modules/photos_realestate.php?id=" + ss_mls);
	} else {
		changeSrc(ss_imageId+"1", "http://photo.wfrmls.com:443/nocache.php?p=mul280x220/" + ss_mls + "_" + (imageNum-1) + ".jpg");
		changeSrc(ss_imageId+"2", "http://photo.wfrmls.com:443/nocache.php?p=mul280x220/" + ss_mls + "_" + (imageNum-1) + ".jpg");
		/*changeHref(ss_imageId+"1_link", "http://photo.wfrmls.com:443/nocache.php?p=mul640x480/" + ss_mls + "_" + (imageNum-1) + ".jpg");
		changeHref(ss_imageId+"2_link", "http://photo.wfrmls.com:443/nocache.php?p=mul640x480/" + ss_mls + "_" + (imageNum-1) + ".jpg");
		changeHref("photo_lrg_magnify", "http://photo.wfrmls.com:443/nocache.php?p=mul640x480/" + ss_mls + "_" + (imageNum-1) + ".jpg");*/
		changeHref(ss_imageId+"1_link", "http://www.utahmore.com/modules/photos_realestate.php?id=" + ss_mls + "&photo=" + imageNum);
		changeHref(ss_imageId+"2_link", "http://www.utahmore.com/modules/photos_realestate.php?id=" + ss_mls + "&photo=" + imageNum);
		changeHref("photo_lrg_magnify", "http://www.utahmore.com/modules/photos_realestate.php?id=" + ss_mls + "&photo=" + imageNum);
	}
	ss_currentPhoto = imageNum;	
	clearInterval(ss_interval);
	clearTimeout(ss_timeout);
	ss_timeout = setTimeout("start_slideshow('', 0, "+imageNum+");",ss_slideTime*1.5);
}

function thumbnail_new(imageNum) {
	document.getElementById('photo_lrg1').src = document.getElementById('imgthmb_' + imageNum).src;
}

// SLIDESHOW (end) **********************




function tooltip(item, contents, top) {
	
		$(item).qtip({
	
			content: '<div style="color:#333;" id="tip_content">' + contents + '</div>', // Set the tooltip content to the current corner
			position: {
			  corner: {
				 tooltip: top, // Use the corner...
				 target: 'bottomMiddle' // ...and opposite corner
			  }
			},
			show: {
                  when: false, // Don't specify a show event
                  ready: true // Show the tooltip when ready
			},
			hide: {
					when: 'mouseout'
				},
			style: {
			  border: {
				 width: 2,
				 radius: 10
			  },
			  padding: 10, 
			  textAlign: 'center',
			  tip: true, // Give it a speech bubble tip with automatic corner detection
			  name: 'cream' // Style it according to the preset 'cream' style
			}
		});		
}

function tooltip_stay(item, contents, top) {
	
		$(item).qtip({
	
			content: '<div style="color:#333;" id="tip_content">' + contents + '</div>', // Set the tooltip content to the current corner
			delay: 500,
			position: {
			  corner: {
				 tooltip: top, // Use the corner...
				 target: 'bottomMiddle' // ...and opposite corner
			  }
			},
			show: {
                  when: false, // Don't specify a show event
                  ready: true // Show the tooltip when ready
			},
			hide: {
					when: 'mouseout',
					fixed: true
				},
			style: {
			  border: {
				 width: 2,
				 radius: 10
			  },
			  padding: 10, 
			  textAlign: 'center',
			  tip: true, // Give it a speech bubble tip with automatic corner detection
			  name: 'cream' // Style it according to the preset 'cream' style
			}
		});		
}

function deleteOpt(item, contents, top) {
	
		$(item).qtip({
	
			content: '<div style="color:#333;" id="tip_content">' + contents + '</div>', // Set the tooltip content to the current corner
			position: {
			  corner: {
				 tooltip: top, // Use the corner...
				 target: 'bottomMiddle' // ...and opposite corner
			  }
			},
			show: {
                  when: false, // Don't specify a show event
                  ready: true // Show the tooltip when ready
			},
			hide: {
					when: 'inactive',
					delay: 2					
				},
			style: {
			  border: {
				 width: 2,
				 radius: 10
			  },
			  padding: 10, 
			  textAlign: 'center',
			  tip: true, // Give it a speech bubble tip with automatic corner detection
			  name: 'cream' // Style it according to the preset 'cream' style
			},
			
			api: {
			   onShow: function() { 
				  setTimeout(this.hide, 2000); /// hide after a second
			   }
			}
			
		});		
}


function CommaFormatted(amount) {
	var delimiter = ","; // replace comma if desired
	var a = amount.split('.',2)
	var d = a[1];
	var i = parseInt(a[0]);
	if(isNaN(i)) { return ''; }
	var minus = '';
	if(i < 0) { minus = '-'; }
	i = Math.abs(i);
	var n = new String(i);
	var a = [];
	while(n.length > 3)
	{
		var nn = n.substr(n.length-3);
		a.unshift(nn);
		n = n.substr(0,n.length-3);
	}
	if(n.length > 0) { a.unshift(n); }
	n = a.join(delimiter);
	if(d.length < 1) { amount = n; }
	else { amount = n + '.' + d; }
	amount = minus + amount;
	return amount;
}

function submitSearchForm(which,type) {
	//THIS LITTLE GUY WILL DISABLE FIELDS THAT AREN'T FILLED IN BEFORE THE FORM IS SUBMITTED TO MAKE A SHORTER URL
	
	switch(which) {
		
		case "homeSearchForm":
		
			switch(type) {
		
				case "land":
					//?type=land&q=&city=&minprice=&maxprice=&mls=&zip=&minacre=&minacre=
					if(document.land_search.q.value == '') document.land_search.q.disabled = true;
					if(document.land_search.city.selectedIndex == 0) document.land_search.city.disabled = true;
					if(document.land_search.minprice.value == '') document.land_search.minprice.disabled = true;
					if(document.land_search.maxprice.value == '') document.land_search.maxprice.disabled = true;
					if(document.land_search.mls.value == '') document.land_search.mls.disabled = true;
					if(document.land_search.zip.value == '') document.land_search.zip.disabled = true;
					if(document.land_search.minacre.selectedIndex == 0) document.land_search.minacre.disabled = true;
					if(document.land_search.maxacre.selectedIndex == 0) document.land_search.maxacre.disabled = true;
					document.land_search.submit();
					break;
					
				case "new":
					//?type=new&q=&proptype=&city=&minprice=&maxprice=&sqmin=&mls=&bed=&bath=&garage=&zip=
					//if(document.home_search.q.value == '') document.home_search.q.disabled = true;
					//if(document.home_search.proptype.selectedIndex == 0) document.home_search.proptype.disabled = true;
					if(document.home_search.city.selectedIndex == 0) document.home_search.city.disabled = true;
					if(document.home_search.minprice.value == '') document.home_search.minprice.disabled = true;
					if(document.home_search.maxprice.value == '') document.home_search.maxprice.disabled = true;
					if(document.home_search.sqmin.selectedIndex == 0) document.home_search.sqmin.disabled = true;
					//if(document.home_search.mls.value == '') document.home_search.mls.disabled = true;
					if(document.home_search.bed.selectedIndex == 0) document.home_search.bed.disabled = true;
					if(document.home_search.bath.selectedIndex == 0) document.home_search.bath.disabled = true;
					//if(document.home_search.garage.selectedIndex == 0) document.home_search.garage.disabled = true;
					if(document.home_search.zip.value == '') document.home_search.zip.disabled = true;
					document.home_search.submit();
					break;
					
				case "webid":
					if(document.home_search.adid.value == '') document.home_search.adid.disabled = true;
					
					if(document.home_search.adid.value.length > 4){
					
						document.location.href = '/realestate/details.php?id=' + document.home_search.adid.value;
						
					} else {
						document.home_search.submit();
					}
				
					break;
					
				case "commercial":
					//?type=com&q=&mls=&city=&minprice=&maxprice=&sqmin=&zip=
					if(document.home_search.q.value == '') document.home_search.q.disabled = true;
					if(document.home_search.mls.value == '') document.home_search.mls.disabled = true;
					if(document.home_search.city.selectedIndex == 0) document.home_search.city.disabled = true;
					if(document.home_search.minprice.value == '') document.home_search.minprice.disabled = true;
					if(document.home_search.maxprice.value == '') document.home_search.maxprice.disabled = true;
					if(document.home_search.sqmin.selectedIndex == 0) document.home_search.sqmin.disabled = true;
					if(document.home_search.zip.value == '') document.home_search.zip.disabled = true;
					
					document.home_search.submit();
					break;
					
				case "rentals":
					//?type=rentals&city=&minprice=&maxprice=&sqmin=&zip=
					if(document.home_search.city.selectedIndex == 0) document.home_search.city.disabled = true;
					if(document.home_search.minprice.value == '') document.home_search.minprice.disabled = true;
					if(document.home_search.maxprice.value == '') document.home_search.maxprice.disabled = true;
					if(document.home_search.sqmin.selectedIndex == 0) document.home_search.sqmin.disabled = true;
					if(document.home_search.zip.value == '') document.home_search.zip.disabled = true;
					document.home_search.submit();
					break;
				
				case "foreclosure":
					//if(document.home_search.q.value == '') document.home_search.q.disabled = true;
					if(document.home_search.proptype.selectedIndex == 0) document.home_search.proptype.disabled = true;
					if(document.home_search.city.selectedIndex == 0) document.home_search.city.disabled = true;
					if(document.home_search.minprice.value == '') document.home_search.minprice.disabled = true;
					if(document.home_search.maxprice.value == '') document.home_search.maxprice.disabled = true;
					if(document.home_search.sqmin.selectedIndex == 0) document.home_search.sqmin.disabled = true;
					if(document.home_search.bed.selectedIndex == 0) document.home_search.bed.disabled = true;
					if(document.home_search.bath.selectedIndex == 0) document.home_search.bath.disabled = true;
					if(document.home_search.zip.value == '') document.home_search.zip.disabled = true;
					
					document.home_search.submit();
				
					break;
				
				default:
				
					//?q=&proptype=&city=&minprice=&maxprice=&sqmin=&mls=&bed=&bath=&garage=&zip=
					if(document.home_search.q.value == '') document.home_search.q.disabled = true;
					if(document.home_search.proptype.selectedIndex == 0) document.home_search.proptype.disabled = true;
					if(document.home_search.city.selectedIndex == 0) document.home_search.city.disabled = true;
					if(document.home_search.minprice.value == '') document.home_search.minprice.disabled = true;
					if(document.home_search.maxprice.value == '') document.home_search.maxprice.disabled = true;
					if(document.home_search.sqmin.selectedIndex == 0) document.home_search.sqmin.disabled = true;
					if(document.home_search.mls.value == '') document.home_search.mls.disabled = true;
					if(document.home_search.bed.selectedIndex == 0) document.home_search.bed.disabled = true;
					if(document.home_search.bath.selectedIndex == 0) document.home_search.bath.disabled = true;
					if(document.home_search.garage.selectedIndex == 0) document.home_search.garage.disabled = true;
					if(document.home_search.zip.value == '') document.home_search.zip.disabled = true;
					
					document.home_search.submit();
				
					break;
			}
		
			break;
			
		case "searchForm":
			
			switch(type) {
				
				case "com":
					if(document.searchForm.city.selectedIndex == 0) document.searchForm.city.disabled = true;
					if(document.searchForm.mls.value == '') document.searchForm.mls.disabled = true;
					if(document.searchForm.zip.value == '') document.searchForm.zip.disabled = true;
					if(document.searchForm.minprice.value == '') document.searchForm.minprice.disabled = true;
					if(document.searchForm.maxprice.value == '') document.searchForm.maxprice.disabled = true;
					if(document.searchForm.minacre.selectedIndex == 0) document.searchForm.minacre.disabled = true;
					if(document.searchForm.maxacre.selectedIndex == 0) document.searchForm.maxacre.disabled = true;
					if(document.searchForm.sqmin.selectedIndex == 0) document.searchForm.sqmin.disabled = true;
					if(document.searchForm.sqmax.selectedIndex == 0) document.searchForm.sqmax.disabled = true;
					break;
					
				case "land":
					if(document.searchForm.city.selectedIndex == 0) document.searchForm.city.disabled = true;
					if(document.searchForm.mls.value == '') document.searchForm.mls.disabled = true;
					if(document.searchForm.zip.value == '') document.searchForm.zip.disabled = true;
					if(document.searchForm.minprice.value == '') document.searchForm.minprice.disabled = true;
					if(document.searchForm.maxprice.value == '') document.searchForm.maxprice.disabled = true;
					if(document.searchForm.minacre.selectedIndex == 0) document.searchForm.minacre.disabled = true;
					if(document.searchForm.maxacre.selectedIndex == 0) document.searchForm.maxacre.disabled = true;
					break;
					
				case "rentals":
				
					if(document.searchForm.city.selectedIndex == 0) document.searchForm.city.disabled = true;
					if(document.searchForm.zip.value == '') document.searchForm.zip.disabled = true;
					if(document.searchForm.minprice.value == '') document.searchForm.minprice.disabled = true;
					if(document.searchForm.maxprice.value == '') document.searchForm.maxprice.disabled = true;
					if(document.searchForm.bed.selectedIndex == 0) document.searchForm.bed.disabled = true;
					if(document.searchForm.bath.selectedIndex == 0) document.searchForm.bath.disabled = true;
					if(document.searchForm.sqmin.selectedIndex == 0) document.searchForm.sqmin.disabled = true;
					if(document.searchForm.sqmax.selectedIndex == 0) document.searchForm.sqmax.disabled = true;
					break;

				case "new":
					if(document.searchForm.city.selectedIndex == 0) document.searchForm.city.disabled = true;
					if(document.searchForm.zip.value == '') document.searchForm.zip.disabled = true;
					if(document.searchForm.minprice.value == '') document.searchForm.minprice.disabled = true;
					if(document.searchForm.maxprice.value == '') document.searchForm.maxprice.disabled = true;
					if(document.searchForm.bed.selectedIndex == 0) document.searchForm.bed.disabled = true;
					if(document.searchForm.bath.selectedIndex == 0) document.searchForm.bath.disabled = true;
					if(document.searchForm.sqmin.selectedIndex == 0) document.searchForm.sqmin.disabled = true;
					if(document.searchForm.sqmax.selectedIndex == 0) document.searchForm.sqmax.disabled = true;
					//if(document.searchForm.garage.value == '') document.searchForm.garage.disabled = true;
					break;

				case "foreclosure":
					if(document.searchForm.proptype.selectedIndex == 0) document.searchForm.proptype.disabled = true;
					if(document.searchForm.city.selectedIndex == 0) document.searchForm.city.disabled = true;
					if(document.searchForm.zip.value == '') document.searchForm.zip.disabled = true;
					if(document.searchForm.minprice.value == '') document.searchForm.minprice.disabled = true;
					if(document.searchForm.maxprice.value == '') document.searchForm.maxprice.disabled = true;
					if(document.searchForm.bed.selectedIndex == 0) document.searchForm.bed.disabled = true;
					if(document.searchForm.bath.selectedIndex == 0) document.searchForm.bath.disabled = true;
					if(document.searchForm.sqmin.selectedIndex == 0) document.searchForm.sqmin.disabled = true;
					if(document.searchForm.sqmax.selectedIndex == 0) document.searchForm.sqmax.disabled = true;
					break;

				default:
					if(document.searchForm.proptype.selectedIndex == 0) document.searchForm.proptype.disabled = true;
					if(document.searchForm.city.selectedIndex == 0) document.searchForm.city.disabled = true;
					if(document.searchForm.mls.value == '') document.searchForm.mls.disabled = true;
					if(document.searchForm.zip.value == '') document.searchForm.zip.disabled = true;
					if(document.searchForm.minprice.value == '') document.searchForm.minprice.disabled = true;
					if(document.searchForm.maxprice.value == '') document.searchForm.maxprice.disabled = true;
					if(document.searchForm.bed.selectedIndex == 0) document.searchForm.bed.disabled = true;
					if(document.searchForm.bath.selectedIndex == 0) document.searchForm.bath.disabled = true;
					if(document.searchForm.sqmin.selectedIndex == 0) document.searchForm.sqmin.disabled = true;
					if(document.searchForm.sqmax.selectedIndex == 0) document.searchForm.sqmax.disabled = true;
					if(document.searchForm.minacre.selectedIndex == 0) document.searchForm.minacre.disabled = true;
					if(document.searchForm.maxacre.selectedIndex == 0) document.searchForm.maxacre.disabled = true;
					if(document.searchForm.house.value == '') document.searchForm.house.disabled = true;
					if(document.searchForm.garage.value == '') document.searchForm.garage.disabled = true;
					break;
					
			}
			
			document.searchForm.minprice.value = document.searchForm.minprice.value.replace(/,/g,"");
			document.searchForm.minprice.value = document.searchForm.minprice.value.replace("$","");
			document.searchForm.maxprice.value = document.searchForm.maxprice.value.replace(/,/g,"");
			document.searchForm.maxprice.value = document.searchForm.maxprice.value.replace("$","");
			
			if(document.searchForm.view.value == '') document.searchForm.view.disabled = true;
			if(document.searchForm.type.value == '') document.searchForm.type.disabled = true;
			
			document.searchForm.submit();
			
			break;
	
	
	}

}



function closeHelpWindow() {
	document.getElementById('wouldLikeHelp').style.display = "none";
	document.getElementById('content_fade').style.display = "none";
}

function hideLegend(){
	$('#map_tip').fadeOut();	
	$('.openbtn').fadeIn();		
}

function showLegend(){
	$('#map_tip').fadeIn();	
	$('.openbtn').fadeOut();			
}

function showBuilder(id) {
	document.getElementById('community_view').style.display = "block";
	document.getElementById('featured_communities').style.display = "none";
	document.getElementById('community_view').innerHTML = '<div align="center" style=" padding-top:10px;padding-bottom:25px;"><img src="/images/re_loader.gif"><h2>Loading Communities</h2></div>';	
	pullBuilder(id);
}





/* START - SLIDESHOW ON HOMEPAGE */





/* END - SLIDESHOW ON HOMEPAGE */

