// preload/setup navigation images on all sub pages

if (window.homepage) {
	//grab home graphics if homepage is loaded
	var strhometext = "-home"
}

if (document.images) {
	var aboutusnorm = new Image();
	var aboutusover = new Image();
	aboutusnorm.src = "images/btn-aboutus1.gif";
	aboutusover.src = "images/btn-aboutus2.gif";
	
	var servicesnorm = new Image();
	var servicesover = new Image();
	servicesnorm.src = "images/btn-services1.gif";
	servicesover.src = "images/btn-services2.gif";

	var propertiesnorm = new Image();
	var propertiesover = new Image();
	propertiesnorm.src = "images/btn-properties1.gif";
	propertiesover.src = "images/btn-properties2.gif";
	
	var contactusnorm = new Image();
	var contactusover = new Image();
	contactusnorm.src = "images/btn-contactus1.gif";
	contactusover.src = "images/btn-contactus2.gif";	
}

// standard swap image code
function setImage(theImage,theSource) {
    if (document.images) {
		document.images[theImage].src = eval(theSource+'.src');
   }
}

//function called by popup script to reset button states onmouseout
function resetButtonImages() {
	if (document.images['btnaboutus']) setImage('btnaboutus','aboutusnorm');
	if (document.images['btnservices']) setImage('btnservices','servicesnorm');
	if (document.images['btnproperties']) setImage('btnproperties','propertiesnorm');
	if (document.images['btncontactus']) setImage('btncontactus','contactusnorm');
}

//popup menu creation code
function fwLoadMenus() {
  if (window.fw_menu_0) return;
  
  // About Us popup menu
  window.fw_menu_0 = new Menu("root",0,0,"Verdana, Arial, Helvetica, sans-serif",10,"#ffffff","#ffffff","#13507A","#3399FF");
  fw_menu_0.addMenuItem("Experience","location='experience.html'");
  fw_menu_0.addMenuItem("Associations","location='associations.html'");
  fw_menu_0.hideOnMouseOut=true;

  // Services popup menu  
  window.fw_menu_1 = new Menu("root",0,0,"Verdana, Arial, Helvetica, sans-serif",10,"#ffffff","#ffffff","#13507A","#3399FF");
  fw_menu_1.addMenuItem("Leasing","location='leasing.html'");
  fw_menu_1.addMenuItem("Property Management","location='property-mgmt.html'");
  fw_menu_1.addMenuItem("Acquisition/Disposition","location='acquisition.html'");
  fw_menu_1.addMenuItem("Accounting","location='accounting.html'");
  fw_menu_1.addMenuItem("Construction","location='construction.html'");
  fw_menu_1.hideOnMouseOut=true;

  // Properties popup menu  
  window.fw_menu_2 = new Menu("root",0,0,"Verdana, Arial, Helvetica, sans-serif",10,"#ffffff","#ffffff","#13507A","#3399FF");
  fw_menu_2.addMenuItem("Houston","location='houston.html'");
  fw_menu_2.hideOnMouseOut=true;

  // Contact Us popup menu  
  window.fw_menu_3 = new Menu("root",0,0,"Verdana, Arial, Helvetica, sans-serif",10,"#ffffff","#ffffff","#13507A","#3399FF");
  fw_menu_3.addMenuItem("Executive Team","location='executive-team.html'");
  //fw_menu_3.addMenuItem("Management Team","location='mgmt-team.html'");
  //fw_menu_3.addMenuItem("Leasing Team","location='leasing-team.html'");
  fw_menu_3.addMenuItem("MDI Investment Services","window.open('http://www.mccorddev.com')");
  fw_menu_3.addMenuItem("Corporate Office","location='corporate-office.html'");

  fw_menu_3.writeMenus();
} 

//getting x/y for image
function getLinkCoords(theImage) { //getting x/y coordinates

	//object detection for browser
	var IE, NN4, NN6;
	if (document.getElementById && document.all) { IE = true; } // Internet Explorer 5 and up
	else if (document.getElementById) {	NN6 = true;} // Netscape Navigator 6
	else if (document.layers) {	NN4 = true;} // Netscape Navigator 4 		
	else if (document.all) { IE = true; } // Internet Explorer 4

	var x = 0;
	var y = 0;
	if (IE || NN6) {
		x = document.images[theImage].offsetLeft;
		y = document.images[theImage].offsetTop;
		parentElement = document.images[theImage].offsetParent;
		while (parentElement!=null) {
			y += parentElement.offsetTop;
			x += parentElement.offsetLeft;
			parentElement = parentElement.offsetParent;
		}
	}
	else if (NN4) {
		x=document.images[theImage].x;
		y=document.images[theImage].y;  
	}

	return [x,y]
}


// standard popup window code
// interface options - toolbar, menubar, location, scrollbars, resizable
function popWin(theLocation,theWidth,theHeight,theInterface){
  popupWindow = window.open(theLocation, "popupWindow", theInterface+",width="+theWidth+",height="+theHeight);
  popupWindow.focus();
}

