// Macromedia (Dreamweaver) jump menu scripts

// This contains the generic dynamic menus for pages with tabs
// There is an accompanying script specific to each tab - maybe, still thinking it through
				
var ns6,ns4,ie4,TimerID;
// Show/Hide functions for non-pointer layer/objects
ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false
ns6 = false;

//layerNames = new Array ("home","login","listings","buyers","sellers","about","contact");
//layerNames = new Array ("home","listings","buyers","sellers","about","contact");

//if the DOM is not IE and not NS4, it must be NS6
if (ns4 == ie4) {
	ns6 = true;
	ie4 = ns4 = false;
}

function show(id) {
    if (document.layers){
        if (document.layers[id]){
            if (ns4) document.layers[id].visibility = "show";
        }
    }
    else if (ie4){
    	if (document.all[id]){
    		document.all[id].style.visibility = "visible";
    	}
  	}
    else if (ns6){
    	if (document.getElementById(id)){ 
    		document.getElementById(id).style.visibility = "visible";
   		}
  	}
}
function hide(id) {
    if (document.layers){
        if (document.layers[id]){
            if (ns4) document.layers[id].visibility = "hide";
        }
    }
    else if (ie4) {
    	if (document.all[id]){
    		document.all[id].style.visibility = "hidden";
   		}
 	}
    else if (ns6) {
    	if (document.getElementById(id)){
    		document.getElementById(id).style.visibility = "hidden";
   		}
 	}
}

//hide the pop out menu
function hideMenu(active){
	TimerID = setTimeout('hideAll()','100');
}


//show the pop out menu
function showMenu(theMenu,imgName,currDir){
	var pth = "img/nav/";
	//hide all menus that are showing
	hideAll();
	if (!currDir) { document[imgName].src = pth + imgName + "_over.png"; }
	show(theMenu);
	clearTimeout(TimerID);
}

//hide all layers and turn off highlighted images
function hideAll(){
	var pth = "img/nav/";
	var i;
	var link = activeLink; // printed in header
    for (i = 0; i < layerNames.length;i++) {
		img = layerNames[i] ; 
		hide(img + "Menu");
		if (i != link) { document[img].src = pth + img + ".png"; }
    }
}    

        
function rollOut(i){
	document.images[imgArray[i]].src = imgOut[i].src;
}

function rollOver(i){
	document.images[imgArray[i]].src = imgOver[i].src;
}



// PRELOADER

var pth = "img/nav/";
var imgOut = new Array();
var imgOver = new Array();

if (document.images){
	for (i=0;i<layerNames.length;i++){
		imgOut[i] = new Image();
		imgOut[i].src = pth + layerNames[i] + ".png";
		imgOver[i] = new Image();
		imgOver[i].src = pth + layerNames[i] + "_over.png";
	}
}

