// Drop down and slide menu controls - including the link to the ypslideoutmenusc.js file in each page of the site
 
//Start Menu Code
var myOffset = 0;
// the number you pass to initLeft doesn't matter since it will get
// changed onactivate

// postions mean left, top, width, height
var myMenu1 = new ypSlideOutMenu("menu1", "down", 0, 94, 212, 210);  
var myMenu2 = new ypSlideOutMenu("menu2", "down", 0, 94, 250, 420);

var myMenu21 = new ypSlideOutMenu("menu21", "right", 0, 91, 253, 420);
var myMenu22 = new ypSlideOutMenu("menu22", "right", 0, 112, 253, 420);
var myMenu23 = new ypSlideOutMenu("menu23", "right", 0, 132, 253, 420);
var myMenu24 = new ypSlideOutMenu("menu24", "right", 0, 152, 253, 420);
var myMenu25 = new ypSlideOutMenu("menu25", "right", 0, 174, 253, 420);
var myMenu26 = new ypSlideOutMenu("menu26", "right", 0, 195, 253, 420);
var myMenu27 = new ypSlideOutMenu("menu27", "right", 0, 195, 253, 420);
var myMenu28 = new ypSlideOutMenu("menu28", "right", 0, 229, 253, 420);
var myMenu29 = new ypSlideOutMenu("menu29", "right", 0, 229, 253, 420);
var myMenu30 = new ypSlideOutMenu("menu30", "right", 0, 216, 253, 420);
var myMenu31 = new ypSlideOutMenu("menu31", "right", 0, 237, 253, 420);
var myMenu32 = new ypSlideOutMenu("menu32", "right", 0, 258, 253, 420);

// 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, 140); }
myMenu2.onactivate = function() { repositionMenu(myMenu2, 224); }

myMenu21.onactivate = function() { repositionMenu(myMenu21, 364); }
myMenu22.onactivate = function() { repositionMenu(myMenu22, 364); }
myMenu23.onactivate = function() { repositionMenu(myMenu23, 364); }
myMenu24.onactivate = function() { repositionMenu(myMenu24, 364); }
myMenu25.onactivate = function() { repositionMenu(myMenu25, 364); }
myMenu26.onactivate = function() { repositionMenu(myMenu26, 364); }
myMenu27.onactivate = function() { repositionMenu(myMenu27, 364); }
myMenu28.onactivate = function() { repositionMenu(myMenu28, 364); }
myMenu29.onactivate = function() { repositionMenu(myMenu29, 364); }
myMenu30.onactivate = function() { repositionMenu(myMenu30, 364); }
myMenu31.onactivate = function() { repositionMenu(myMenu31, 364); }
myMenu32.onactivate = function() { repositionMenu(myMenu32, 364); }

    // 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
			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;
		}	
// this function calculates the window's width - different for IE and netscape
    function getWindowWidth()
    {
        BrowserWidth = window.innerWidth ? window.innerWidth : document.body.offsetWidth;
        
        return (BrowserWidth < 988 ) ? 988 : BrowserWidth;
    }

