// JavaScript Document

var revert = new Array();
var inames = new Array('home', 'scottsdaleliving', 'homesforsale', 'buyahome', 'sellyourhome', 'aboutus');
var imgs = new Array();

//pre-load the images


window.onload = function() {
	var links = document.getElementsByClassName("nav_link");
	for (var i = 0; i <= links.length -1 ; i++) {
		links[i].onmouseover = function() {
			
			this.style.backgroundColor = "#b5e5ff";
			this.style.textDecoration = "none";
		}
		links[i].onmouseout = function() {
			this.style.backgroundColor = "";
			this.style.textDecoration = "";
		}
	}
	for(i=0; i< inames.length; i++) {
		img1 = new Image();
		img1.src = "/images/ddmenu/"+inames[i]+"_over.gif";
		imgs.push(img1);
		img2 = new Image();
		img2.src = "/images/ddmenu/"+inames[i]+".gif";
		imgs.push(img2);
	}
	
	
}
// Preload Images for Mouseover

  var flipped = new Array();
  for(i=0; i< inames.length; i++) {
    flipped[i] = new Image();
    flipped[i].src = "/images/ddmenu/"+inames[i]+"_over.gif";
  }

//window.onload=show;
var currentMenu = null;


function show(id, id2) {
	
	if (currentMenu != null && currentMenu.id == id) {
	
	} else {
		if (currentMenu != null) currentMenu.style.display ="none";
		currentMenu = document.getElementById(id);
		if (currentMenu != null) currentMenu.style.display = "block";
	}
	if (id == '' && currentMenu != null) {
		currentMenu.style.display="none";
		return;
	}  

//if (id=='') {
//	$(id2).style.display='none';
//} else {
//	$(id2).style.display='block';
//}

}

// Mouseover function for image flip

function over(num) {
    revert[num] = $(inames[num]).src;
    $(inames[num]).src = flipped[num].src;
}

// Mouseout function for image revert

function out(num) {
  $(inames[num]).src = revert[num];
}


