<!--//--><![CDATA[//><!--
sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

//--><!]]>

/* 
** resets search fields
*/
function resetSearch() {
	$('ListingLowprice').value = 0;
	$('ListingHighprice').value = 9999999999;
	$('ListingBedrooms').value = 0;
	$('ListingBaths').value = 0;
	$('ListingProperty').value = "";
}

function unselectAll(element) {
	element = $(element) || document;
	if( element && element.getElementsByTagName ){
		var inputs = element.getElementsByTagName("input");
		for(var i = 0; inputs && i < inputs.length; i++){
			if(inputs[i].type == "checkbox") {
				inputs[i].checked = false;
			}
		}
	}
}

function doSave() {
	var result = prompt('Enter a friendly name to save this search as:', '');
	var alphaExp = /^[-_a-zA-Z\s\d]+$/;
	
	if(result.match(alphaExp) && result != ""){
		$("result").value = result;
		return true;
	}else{
		alert('Please only use letters, numbers, spaces, dashes, and underscores');
		return false;
	}
}
function expandCities() { 
	if($('cities').getStyle('height') == "330px") {
		$('cities').setStyle({height: 85+"px"});
		$('cityToggle').innerHTML = "Show More Cities...";
		
		/* incase they scroll down through the list, lets bring them back to the top */
		$('cities').scrollTop = 0;
	} else {
		$('cities').setStyle({height: 330+"px"});
		$('cityToggle').innerHTML = "Show Less Cities...";
	}
}

function spin_div(div_id) {
  container = $(div_id);
  positioning = 'top: '+container.offsetTop+'px; width: '+container.offsetWidth+'px; height: '+container.offsetHeight+'px; ';
  container.innerHTML += '<div class="spin_div" style="position: absolute; ' + positioning + '"></div>';
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function openWindow(url) {
popupWin = window.open(url, 'remote', 'menubar=no, toolbar=no, location=no, directories=no, status=no, scrollbars=no, resizable=yes, dependent, width=770, height=710, left=50, top=50')
}

FlashOK={
		show:function(){
		  $('message-ok').visualEffect('appear');
			this.timer=setTimeout('FlashOK.hide()',5000);
		},
		hide:function(){
 		  $('message-ok').visualEffect('fade');
			clearTimeout(this.timer);
			return false;
		}
            };
FlashBAD={
		show:function(){
		  $('message-bad').visualEffect('appear');
			this.timer=setTimeout('FlashBAD.hide()',5000);
		},
		hide:function(){
 		  $('message-bad').visualEffect('fade');
			clearTimeout(this.timer);
			return false;
		}
            };
