// JavaScript Document
(function() {
    var Dom = YAHOO.util.Dom,
        Event = YAHOO.util.Event,
		returnImg="";
		
 
         // Get the image link from within its (parent) container.
        function getImage(parent) {
            var el = parent.firstChild;
                    
            while (el) { // walk through till as long as there's an element
                if (el.nodeName.toUpperCase() == "IMG") { // found an image
                    // flickr uses "_s" suffix for small, and "_m" for big
                    // images respectively
					returnImg = el.src.replace(/_s\.jpg$/, "_m.jpg");
                    return returnImg;
                }
                el = el.nextSibling;
            }
            
            return "";
        }
 
    Event.onDOMReady(function() {
        var layout = new YAHOO.widget.Layout('doc4', {
            height: Dom.get('doc4').offsetHeight, //Height of the viewport Dom.getClientHeight()
            width: Dom.get('doc4').offsetWidth, //Width of the outer element
            minHeight: 150, //So it doesn't get too small
            units: [
                { position: 'top', height: 137, body: 'hd', scroll: null, zIndex: 0  },
                { position: 'left', width: 180, body: 'nav', grids: true, zIndex: 1, scroll: null },
                { position: 'right', width: 180, body: 'sponsors', grids: true, scroll: null },
                { position: 'bottom', height: 25, body: 'ft' },
                { position: 'center', body: 'bd', grids: true, scroll: null }
            ]
        });
        layout.on('beforeResize', function() {
								
         if ( Dom.get('doc4').offsetHeight>Dom.getClientHeight() ) {										   
            Dom.setStyle('doc4', 'height', Dom.get('doc4').offsetHeight + 'px');
		 }
		 else {           
		   Dom.setStyle('doc4', 'height', Dom.getClientHeight() + 'px');
		 }
			
			
        });
 
 	  layout.render();

  // Initialize and render the Menu when its elements are ready to be scripted

  YAHOO.util.Event.onContentReady("productsandservices", function () {

    /*
		Instantiate a Menu:  The first argument passed to the constructor
		is the id for the Menu element to be created, the second is an 
		object literal of configuration properties.
    */
    
    var oMenu = new YAHOO.widget.Menu("productsandservices", { 
                                            position: "static", 
                                            hidedelay:  750, 
                                            lazyload: true });

 });
       
 
        //Handle the resizing of the window
        Event.on(window, 'resize', layout.resize, layout, true);
		

 
	
	
    });
	
	
})();