var vpics = [];
var isSafari3 = false;
var dotBackground = "url('/graphics/cityDot.gif')";
var dotBackgroundS = "url('/graphics/cityDotS.gif')";
var oldCityColor;
var highlightColor = "#efefef";
if( window.devicePixelRatio &&  window.getMatchedCSSRules && !window.Opera){
    isSafari3  =  !!window.getMatchedCSSRules(document.documentElement,'');
}
function validateFields(){		
	if ((document.search.city.value == "") 		
		 && (document.search.bdrms.value == "") 		
		 && (document.search.price.value == "") 		
		 && (document.search.name.value == "") )	{		
		/**Check for selection*/				
			alert("You must select at least one option to perform a search.");				
			document.search.city.focus();				
			return false;		
	}		
	if (document.search.city.value == "0") {				
		if (!confirm("You have selected all areas. Please be patient as this may take some time. We have a LOT of properties!")) {					
			return false;				
		}		
	}			
	/**Submit the form.*/		
	return true;
}
function setcityidx(){		document.search.cityidx.value = document.search.city.selectedIndex;}
function highlightOther(e) {
	var thisLink = e.currentTarget;
	var thisID = thisLink.id;
	var otherID;
	if (thisID.indexOf("-") == -1) {
		otherID = thisID + "-dot";
		document.getElementById(otherID).style.backgroundImage = dotBackgroundS;
	}
	else {
		otherID = thisID.split("-")[0];
		document.getElementById(otherID).style.textDecoration = "underline";
		oldCityColor = document.getElementById(otherID).style.color;
		document.getElementById(otherID).style.color = highlightColor;
		document.getElementById(thisID).style.backgroundImage = dotBackgroundS;
	}
}
function unHighlightOther(e) {
	var thisLink = e.currentTarget;
	var thisID = thisLink.id;
	var otherID;
	if (thisID.indexOf("-") == -1) {
		otherID = thisID + "-dot";
		document.getElementById(otherID).style.backgroundImage = dotBackground;
	}
	else {
		otherID = thisID.split("-")[0];
		document.getElementById(otherID).style.textDecoration = "none";
		document.getElementById(otherID).style.color = oldCityColor;
		document.getElementById(thisID).style.backgroundImage = dotBackground;
	}
}
function loadPage() {
	if (document.all) {
		addEvent(getElementsByClassName("proppopupv"),"click",event_popup_features(propPopupParms3IE));	
	}
	else if (BrowserDetect.browser == "Safari") { //check for Safari
		addEvent(getElementsByClassName("proppopupv"),"click",event_popup_features(propPopupParms3w));
	}
	else {
		addEvent(getElementsByClassName("proppopupv"),"click",event_popup_features(propPopupParms3));	
	}
	addEvent(getElementsByClass("dot"),"mouseover",highlightOther);
	addEvent(getElementsByClass("vpage"),"mouseover",highlightOther);
	addEvent(getElementsByClass("dot"),"mouseout",unHighlightOther);
	addEvent(getElementsByClass("vpage"),"mouseout",unHighlightOther);
	addlLoads();
	document.getElementById("loadmsg").style.display = "none";
	if (document.getElementById("villadivs")) {
		document.getElementById("villadivs").style.display = "block";
		document.getElementById("homediv").style.display = "none";
	}
	setVillanamePopups();
}
addLoadEvent(loadPage);
