// the number you pass to initLeft doesn't matter since it will get
// changed onactivate
		
var screenY,screenX=20,dimensionY=800,dimensionX=781;
var isIE = false;
var menu1X = (screenX * 6);
var scrollPage = "no";

if(navigator.appName == "Microsoft Internet Explorer"){
  screenY = window.screen.availWidth;
  isIE = true;
	menu1X = (menu1X -2);
}else{
  screenY = window.innerWidth;
	menu1X = (menu1X -8);
}
	
screenY = (screenY - dimensionY);

var myMenu1 = new ypSlideOutMenu("menu1", "down", screenY, 250, 125, menu1X);
var myMenu2 = new ypSlideOutMenu("menu2", "down", screenY, 125, 125, menu1X);
// for each menu, we set up hte onactivate event to call repositionMenu with the amount offset from center, in pixels
myMenu1.onactivate = function() { repositionMenu(myMenu1, -15); }
myMenu2.onactivate = function() { repositionMenu(myMenu2, -90); }
// this function repositions a menu to the speicified offset from center
function repositionMenu(menu, offset){
	// the new left position should be the center of the window + the offset
	if(isIE)
		offset = offset - 20;
	else
		if(scrollPage=="yes")
			offset = offset - 12;
	var newLeft = getWindowWidth() / 2 + offset;

    // setting the left position in netscape is a little different than IE
	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 + 21);
}	
		 
ypSlideOutMenu.writeCSS();

//determines the height and width of existing screen.
var popupY,popupX,popupH=450,popupW=450;
if(navigator.appName == "Microsoft Internet Explorer") {
  popupY = window.screen.availHeight;
  popupX = window.screen.availWidth;
}else{
  popupY = window.outerHeight
  popupX = window.outerWidth
}
popupY = (popupY - popupH) / 2;
popupX = (popupX - popupW) / 2;

var windowObj = null;

//Creates new window in the center of the screen.
function launchForm(){
  var config = "menubar=no,height="+popupH+",width="+popupW+",left="+popupX+",top="+popupY+"dependent=true";
  var winObj = window.open("mailForm.html","New_Window",config);
  windowObj = winObj;
  return;
}

//if popup window has been left open then close it
function checkPopup(){
  if(windowObj)
    windowObj.close();
}