// JavaScript Document

var totalDropMenus = 4;

window.onload = initDropMenus;

function initDropMenus() {
	for (i=1; i <= totalDropMenus; i++) {		
		navMenu = document.getElementById("navMenu" + i);
		dropMenu = document.getElementById("dropMenu" + i);
		dropMenu.style.visibility = "hidden";
		navMenu.onmouseover = (function(index) {
			return function(){
				showDropMenu(index);
			}
		})( i );
		navMenu.onmouseout = (function(index) {
			return function(){
				hideDropMenu(index);
			}
		})( i );	
		dropMenu.onmouseover = (function(index) {
			return function(){
				showDropMenu(index);
			}
		})( i );
		dropMenu.onmouseout = (function(index) {
			return function(){
				hideDropMenu(index);
			}
		})( i );
	}
	
	if (document.title.indexOf("The Office") != -1) {
		initializeGoogleMap();//calls this function which is located in the goole_map.js file.
	}
	
	if (document.title.indexOf("Home") != -1 || document.title.indexOf("About") != -1 || document.title.indexOf("Services") != -1 || document.title.indexOf("Library") != -1 || document.title.indexOf("Testimonials") != -1 || document.title.indexOf("F.A.Q") != -1) {
		initializeTextSizers();//calls this function which is located in the text_size.js file.	
	}
}

function showDropMenu(index) {
	button = document.getElementById("navMenu" + index);
	menu = document.getElementById("dropMenu" + index);
	buttonImage = document.getElementById("navButtonImg" + index);
	menu.style.visibility = "visible";
	xPos = button.offsetLeft;
	minW = button.offsetWidth - 4;
	menu.style.left = xPos + "px";	
	menu.style.minWidth = minW + "px";
	buttonImage.style.filter = "progid:DXImageTransform.Microsoft.BasicImage(opacity=0.0)";
	buttonImage.style.opacity = 0.0;
}

function hideDropMenu(index) {
	menu = document.getElementById("dropMenu" + index);
	buttonImage = document.getElementById("navButtonImg" + index);
    menu.style.visibility = "hidden";
	buttonImage.style.filter = "progid:DXImageTransform.Microsoft.BasicImage(opacity=1.0)";
	buttonImage.style.opacity = 1.0;
}