(function() {
    var Dom = YAHOO.util.Dom,
        Event = YAHOO.util.Event,
        layout = null,
        resize = null;
		
		
	 var initLeftMenu = function() {
                /*
                     Instantiate a Menu:  The first argument passed to the 
                     constructor is the id of the element in the page 
                     representing the Menu; the second is an object literal 
                     of configuration properties.
                */

                var oMenu = new YAHOO.widget.Menu("productsandservices2", { 
                                                        position: "static", 
                                                        hidedelay:  800, 
                                                        lazyload: true,
                                                            effect: { 
                                                                effect: YAHOO.widget.ContainerEffect.FADE,
                                                                duration: 0.15
                                                            } 
                                                        });


                /*
                     Define an array of object literals, each containing 
                     the data necessary to create a submenu.
                */

         		<!-- <LAYOUT> -->
		var aSubmenuData = [ {id: "14",itemdata: []},
{id: "15",itemdata: []},
{id: "16",itemdata: []},
{id: "18",itemdata: [{text: "Saison 2011/12", url: "index.php?status=81&me_id=18&mei_id=234"},{text: "Saison 2010/11", url: "index.php?status=82&me_id=18&mei_id=189"},{text: "Saison 2009/10", url: "index.php?status=83&me_id=18&mei_id=115"},{text: "Saison 2008/09", url: "index.php?status=84&me_id=18&mei_id=46"},]},
{id: "25",itemdata: [{text: "Saison 2011/12", url: "index.php?status=91&me_id=25&mei_id=236"},{text: "Saison 2010/11", url: "index.php?status=92&me_id=25&mei_id=190"},{text: "Saison 2009/10", url: "index.php?status=93&me_id=25&mei_id=171"},{text: "Saison 2008/09", url: "index.php?status=94&me_id=25&mei_id=40"},]},
{id: "9",itemdata: [{text: "Teamevent 15./16.August 2009", url: "index.php?status=101&me_id=9&mei_id=169&gallerieID=_luky_20090818_23_19_10_FlmadWdfRqXKBnStTCOyuZ5KudVGtpt"},]},
 ]; 
		oMenu.subscribe("beforeRender", function () {

                    if (this.getRoot() == this) {

		this.getItem(2).cfg.setProperty("submenu", aSubmenuData[0]);
this.getItem(4).cfg.setProperty("submenu", aSubmenuData[1]);
this.getItem(5).cfg.setProperty("submenu", aSubmenuData[2]);
this.getItem(7).cfg.setProperty("submenu", aSubmenuData[3]);
this.getItem(8).cfg.setProperty("submenu", aSubmenuData[4]);
this.getItem(9).cfg.setProperty("submenu", aSubmenuData[5]);
 }

                });
		<!-- </LAYOUT> -->
				
                /*
                     Call the "render" method with no arguments since the 
                     markup for this Menu instance is already exists in the page.
                */

                oMenu.render();
        };
      
    Event.onDOMReady(function() {
	
	var footerHeight 	= 10;
	var topHeight 		= 0;
	var contentHeight	= 140;
    var demoWidth		= 20;
	var contentWidth	= 0;
	var rightNavWidth	= 10;
	var leftNavWidth	= 150;

	footerHeight 	= document.getElementById('wigedPanelfooter').offsetHeight + footerHeight;
	topHeight 		= document.getElementById('wigedPaneltop').offsetHeight + topHeight;
	contentHeight 	= document.getElementById('wigedPaneltcontent').offsetHeight + contentHeight;
	
	rightNavWidth	= document.getElementById('wigedPaneltrightNav').offsetWidth + rightNavWidth;

	
	
	if(contentHeight < 600)
	contentHeight = 600;
	
	demoWidth 		= document.getElementById('wigedPaneltcontent').offsetWidth + rightNavWidth + leftNavWidth + demoWidth;
	if(document.getElementById('wigedPaneltcontent').offsetWidth + rightNavWidth + leftNavWidth < 1024)
	demoWidth = 1024;
	
	demoWidth = 1050;

        var panel = new YAHOO.widget.Panel('wigedPanelbase', {
            draggable: false,
            close: false,
            autofillheight: "body", // default value, specified here to highlight its use in the example            
            underlay: 'none',
            width: demoWidth,
			height: ((footerHeight + topHeight + contentHeight) + (contentHeight/4)) ,
			modal: false,
			xy: [0, 0]
        });
       
        panel.setBody('<div id="wigedPanellayout"></div>');
        panel.beforeRenderEvent.subscribe(function() {
            Event.onAvailable('wigedPanellayout', function() {
                layout = new YAHOO.widget.Layout('wigedPanellayout', {
                    height: Dom.get('wigedPanelbase').offsetHeight - 10,
                    width: Dom.get('wigedPanelbase').offsetWidth -10 ,
                    units: [
						{ 
							position: 'top', 
							height: topHeight -2 , 
							resize: false, 
							body: 'wigedPaneltop', 
							gutter: '0 0 2 0',
							zIndex: 2  
						},  
		                { 
							position: 'right', 
							header: 'Partner', 
							width: rightNavWidth, 
							resize: false, 
							gutter: '2 0 0 2', 
							collapse: true,
							collapseSize: 22,  
							scroll: true, 
							body: 'wigedPanelrightNav', 
							animate: true 
						},
		                { 
							position: 'left', 
							header: 'Navigation', 
							width: leftNavWidth, 
							resize: false, 
							body: 'wigedPanelleftNav', 
							gutter: '2 2 0 0', 
							collapse: true, 
							close: false, 
							collapseSize: 22, 
							scroll: null, 
							animate: true,
							zIndex: 1 
						},
		                { 
							position: 'center',
							header: navitem,  
							body: 'wigedPanelcontent',
							collapse: true,
							//top right botoom left
							gutter: '2 2 0 2',
							scroll: true
						},
						{ 
							position: 'bottom',
							height: footerHeight , 
							body: 'wigedPanelfooter', 
							gutter: '0'
						}  
                    ]
                });
                
				
				layout.on('render', function() {
				            YAHOO.util.Event.onContentReady("productsandservices2", initLeftMenu);        
				        });
				        
                layout.render();
                
            });
        });
        panel.render();
       
    });
})();


