YAHOO.util.Event.onDOMReady(function () {
	var aItemData = [
		{text:"About PPI",url:"about_ppi.html"},
		{text:"Safety and Environmental",url:"safety.html",submenu: { id: "safety", itemdata: [ ,
			{text:"Safety Statistics 2009",url:"ss_2007.html"}
		] }
		},
		{text:"The PPI Advantage",url:"advantage.html"},
		{text:"Services",url:"services.html", submenu: { id: "services", itemdata: [ ,
																 
			{text:"Drilling Management",url:"drilling.html"},
			{text:"Quality Assurance",url:"qual_ass.html"},
			{text:"Critical Well Engineering",url:"critical.html"},
			{text:"Construction and Engineering",url:"construct.html"},
			{text:"Production",url:"production.html"},
			{text:"Deep Foundation Services",url:"deep_foundation.html"},
			{text:"Asset Tracking and Management",url:"http://ppiatm.com/"}
		] }
		},
		{text:"Quality",url:"quality.html"},											   
		{text:"PPI Team",url:"ppiteam.html"},
		{text:"Locations",url:"locations.html"},
		{text:"Careers",url:"careers.html"},
		{text:"News",url:"news.html"}
	]; 
	var oMenuBar = new YAHOO.widget.MenuBar("mainmenubar", {lazyload:true,itemdata:aItemData,autosubmenudisplay:true});
	oMenuBar.render(document.getElementById('mm_container'));
	
	function onSubmenuShow() {

		var oIFrame,oElement,nOffsetWidth;


		// Keep the left-most submenu against the left edge of the browser viewport

		if (this.id == "yahoo") {
			
			YAHOO.util.Dom.setX(this.element, 0);

			oIFrame = this.iframe;            


			if (oIFrame) {
	
				YAHOO.util.Dom.setX(oIFrame, 0);
	
			}
			
			this.cfg.setProperty("x", 0, true);
		
		}


		/*
			Need to set the width for submenus of submenus in IE to prevent the mouseout 
			event from firing prematurely when the user mouses off of a MenuItem's 
			text node.
		*/

		if ((this.id == "safety" || this.id == "services" || this.id == "quality") && YAHOO.env.ua.ie) {

			oElement = this.element;
			nOffsetWidth = oElement.offsetWidth;
	
			/*
				Measuring the difference of the offsetWidth before and after
				setting the "width" style attribute allows us to compute the 
				about of padding and borders applied to the element, which in 
				turn allows us to set the "width" property correctly.
			*/
			
			oElement.style.width = nOffsetWidth + "px";
			oElement.style.width = (nOffsetWidth - (oElement.offsetWidth - nOffsetWidth)) + "px";
		
		}

	}
    

    // Subscribe to the "show" event for each submenu
    
    oMenuBar.subscribe("show", onSubmenuShow);
	
	
	
	slideshow2 = new YAHOO.hdrimg.slideshow("header");
	slideshow2.loop();
});
