menu1 = new Array(
"Homes for Sale","display_SD.asp","_top",
"Land for Sale","display_LL.asp","_top",
"Mobile Homes for Sale","display_MH.asp","_top",
"All Local Listings","idx_init.asp","_top"
);

menu2 = new Array(
"About Valley Center","about.asp","_top",
"Get Directions","directions.asp","_top",
"Community Links","links.asp","_top"
);

menu3 = new Array(
"Meet Our Agents","agents.asp","_top",
"Client Testimonials","testimonials.asp","_top"
);

function makeMenu(menu) { 
	num_items = eval(menu + ".length");
	ns = (navigator.appName == "Netscape") ? true : false;
	menu_table = (ns) ? "<table cellspacing=0 cellpadding=0 border=0>" : "<table cellspacing=0 cellpadding=3 border=0>";
	z = 0;
	if (ns) {
		for (x = 0; x < num_items; x += 3) { 
			z++;
			menu_table += "<tr><td height=1 bgcolor=#CC0000></td></tr>" +
			"<tr height=22 bgColor='#660000' onMouseOver=\"this.bgColor='#FFCC00'\" " +
			"onMouseOut=\"this.bgColor='#660000'\">" +
			"<td name=row" + z + " style=\"cursor: hand; color: #FFFFCC; font-family: arial; font-size: 10pt\" " +
			"onMouseover=\"this.style.color='#660000'\" " +
			"onMouseout=\"this.style.color='#FFFFCC'\">&nbsp;" +
			"<a href=\"" + eval(menu + '[x+1]') + "\" target=\"" + eval(menu + '[x+2]') + "\" style=\"color:#FFFFCC;text-decoration:none\" " +
			"onMouseover=\"this.style.color='#660000'\" " +
			"onMouseout=\"this.style.color='#FFFFCC'\">" +
			eval(menu + '[x]') + "</a>&nbsp;&nbsp;</td></tr>";
		} 
	} else {
		for (x = 0; x < num_items; x += 3) { 
			z++;
			menu_table += "<tr><td height=1 bgcolor=#CC0000></td></tr>" +
			"<tr height=22 bgColor='#660000' onMouseOver=\"this.bgColor='#FFCC00'\" " +
			"onMouseOut=\"this.bgColor='#660000'\">" +
			"<a href=\"" + eval(menu + '[x+1]') + "\" target=\"" + eval(menu + '[x+2]') + "\">" +
			"<td name=row" + z + " style=\"cursor: hand; color: #FFFFCC; font-family: arial; font-size: 10pt\" " +
			"onMouseover=\"this.style.color='#660000'\" " +
			"onMouseout=\"this.style.color='#FFFFCC'\">&nbsp;" +
			eval(menu + '[x]') + "&nbsp;&nbsp;</td></a></tr>";
		}
	}
	menu_table += "<tr><td height=1 bgcolor=#CC0000></td></tr></table>";
	document.write(menu_table);
}

function show(menu) { 
	hideAll();
	for (x = 1; x <= 3; x++) { 
		eval("document.getElementById('menu" + x + "_div').style.visibility = 'hidden'")
	}
	document.getElementById(menu).style.visibility = 'visible';
}

function hideAll() { 
	for (x = 1; x <= 3; x++) { 
		eval("document.getElementById('menu" + x + "_div').style.visibility = 'hidden'")
	}
}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}
function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}
var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		news_over = newImage("images/news-over.jpg");
		contact_over = newImage("images/contact-over.jpg");
		home_over = newImage("images/home-over.jpg");
		property_over = newImage("images/property-over.jpg");
		community_over = newImage("images/community-over.jpg");
		about_over = newImage("images/about-over.jpg");
		value_over = newImage("images/value-over.jpg");
		preloadFlag = true;
	}
}
function checkForm() {
	msg = "Please give us your ";
	hasName = false;
	thisName = document.forms[0].elements["yourname"].value;
	thisEmail = document.forms[0].elements["email"].value;
	if (thisName == "") {
		msg += "Name ";
		hasName = true;
	}
	if (thisEmail == "") {
		comma = hasName ? "and " : "";
		msg = msg + comma + "Email Address";
	}
	if (msg != "Please give us your ") {
		alert(msg);
		return false;
	}
	var emailRE = /^(\w+-?\w*\.)*\w+-?\w*\@(\w+-?\w*\.)*\w+-?\w*\.\w\w\w?$/;
	var emailM = emailRE.test(thisEmail);
	if (!emailM) {alert('Please format email address: someone@somewhere.com');return false}
}
function win(URL) { 
   swidth = (screen.width-700)/2;
   sheight = (screen.availHeight-400)/2
   var Win = window.open(URL,'Win','width=700,height=400,top=' + sheight + ',left=' + swidth + ',resizable=yes,scrollbars=yes');
   Win.focus();
}
