//if page scrolls, set variable to true. will reposition drop down and left menu correctly
var scrollPage;

//Drop Down Menu Parameters
var menuName = new Array(4);
var menuURL = new Array(4);


//Arrays for Technical Library Drop Down Menu
nameArray = new Array("Home","About Us");
urlArray = new Array("index.html","about.html");

menuName[0] = nameArray;
menuURL[0] = urlArray;

//Arrays for Technical Library Drop Down Menu
nameArray = new Array("Clients","California Land Surveyors");
urlArray = new Array("clients.html","notClient.html");

menuName[1] = nameArray;
menuURL[1] = urlArray;

//Arrays for Technical Library Drop Down Menu
nameArray = new Array("Company News","Consumer Links");
urlArray = new Array("news.html","links.html");

menuName[2] = nameArray;
menuURL[2] = urlArray;

//Arrays for Training Drop Down Menu
var nameArray = new Array("Contact Us","F.A.Q.","Employment Opportunities");
var urlArray = new Array("contact.html","faq.html","employment.html");

menuName[3] = nameArray;
menuURL[3] = urlArray;


//Top Menu
function buildTopMenu(index){
	for(i=0;i<menuName[index].length;i++)
		document.write("<a href='"+menuURL[index][i]+"' class='dropDownLink'>"+menuName[index][i]+"</a><br />");
	return;
}

// the number you pass to initLeft doesn't matter since it will get
		// changed onactivate
		
		var isIE = (navigator.appName == "Microsoft Internet Explorer") ? true : false;
	
		var height0 = (menuName[0].length * 18) + 25;
		var height1 = (menuName[1].length * 18) + 25;
		var height2 = (menuName[2].length * 18) + 25;
		var height3 = (menuName[3].length * 18) + 25;
		
		var dropDownTop =110;

		var myMenu1 = new ypSlideOutMenu("menu1", "down", 0, dropDownTop, 150, height0);
     	var myMenu2 = new ypSlideOutMenu("menu2", "down", 0, dropDownTop, 180, height1);
     	var myMenu3 = new ypSlideOutMenu("menu3", "down", 0, dropDownTop, 180, height2);
     	var myMenu4 = new ypSlideOutMenu("menu4", "down", 0, dropDownTop, 180, height3);

    // for each menu, we set up hte onactivate event to call repositionMenu with the amount offset from center, in pixels
		
		var left1 = (isIE) ? -440 : -438;
		var left2 = (isIE) ? -268 : -264;
		var left3 = (isIE) ? -82 : -64;
		var left4 = (isIE) ? 92 : 108;
		
		myMenu1.onactivate = function() { repositionMenu(myMenu1, left1); }	
		myMenu2.onactivate = function() { repositionMenu(myMenu2, left2); }	
		myMenu3.onactivate = function() { repositionMenu(myMenu3, left3); }	
		myMenu4.onactivate = function() { repositionMenu(myMenu4, left4); }	
		
    // this function repositions a menu to the speicified offset from center
		function repositionMenu(menu, offset)
		{			
			var newLeft = getWindowWidth() / 2 + offset;
			menu.container.style ? menu.container.style.left = newLeft + "px" : menu.container.left = newLeft;
		}
		
		
		 
    // this function calculates the window's width - different for IE and netscape
		function getWindowWidth()
		{
			return window.innerWidth ? window.innerWidth : document.body.offsetWidth;
		}	


    ypSlideOutMenu.writeCSS();

//determines the height and width of existing screen.
var screenY,screenX,dimensionY=300,dimensionX=400;
if(navigator.appName == "Microsoft Internet Explorer") {
  screenY = window.screen.availHeight;
  screenX = window.screen.availWidth;
}else{
  screenY = window.outerHeight
  screenX = window.outerWidth
}
screenY = (screenY - dimensionY) / 2;
screenX = (screenX - dimensionX) / 2;

function popUpFAQ(faqPage){
	var config = "menubar=no,height=300,width=400,left="+screenX+",top="+screenY;
	window.open(faqPage,'',config);
	return;
}