﻿sfHover = function(){ 
var sfEls = document.getElementById("mainNav").getElementsByTagName("LI");
var sfEls2 = document.getElementById("mainNav").getElementsByTagName("LI");
	 for (var i=0; i<sfEls.length; i++)
	 {
		 //
		 // create yahoo divs
		 //
		 element=sfEls[i];
		 children = element.getElementsByTagName("ul");
	 
		 if(children.length >0){
			container = document.createElement("div");
			container.setAttribute("class","yuimenu");
			element.appendChild(container);
			body = document.createElement("div");
			body.className="bd";
			children[0].style.display="block";
			body.appendChild(children[0]);
			container.appendChild(body);
		}
     }
	 for (var i=0; i<sfEls2.length; i++)
	 {
		 //
		 // create yahoo divs
		 //
		 element=sfEls2[i];
		 children = element.getElementsByTagName("ul");
	 
		 if(children.length >0){
			container = document.createElement("div");
			container.setAttribute("class","yuimenu");
			element.appendChild(container);
			body = document.createElement("div");
			body.className="bd";
			children[0].style.display="block";
			body.appendChild(children[0]);
			container.appendChild(body);
		}
     }

 } 
 
 

 // yahoo menu code
 
 YAHOO.example.onMenuBarReady = function() {

                // Animation object

                var oAnim;


                // Utility function used to setup animation for submenus

                function setupMenuAnimation(p_oMenu) {

                    if(!p_oMenu.animationSetup) {

                        var aItems = p_oMenu.getItemGroups();
    
                        if(aItems && aItems[0]) {
    
                            var i = aItems[0].length - 1;
                            var oSubmenu;

                            do {

                                oSubmenu = p_oMenu.getItem(i).cfg.getProperty("submenu");
        
                                if(oSubmenu) {
        
                                    oSubmenu.beforeShowEvent.subscribe(onMenuBeforeShow, oSubmenu, true);
                                    oSubmenu.showEvent.subscribe(onMenuShow, oSubmenu, true);
        
                                }
                            
                            }
                            while(i--);
                        
                        }

                        p_oMenu.animationSetup = true;

                    }

                }


                // "beforeshow" event handler for each submenu of the menu bar

                function onMenuBeforeShow(p_sType, p_sArgs, p_oMenu) {

                    if(oAnim && oAnim.isAnimated()) {
                    
                        oAnim.stop();
                        oAnim = null;
                    
                    }

                    YAHOO.util.Dom.setStyle(this.element, "overflow", "hidden");
                    YAHOO.util.Dom.setStyle(this.body, "marginTop", ("-" + this.body.offsetHeight + "px"));

                }


                // "show" event handler for each submenu of the menu bar

                function onMenuShow(p_sType, p_sArgs, p_oMenu) {
                   
                    oAnim = new YAHOO.util.Anim(
                        this.body, 
                        { marginTop: { to: 0 } },
                        .5, 
                        YAHOO.util.Easing.easeOut
                    );

                    oAnim.animate();

                    var me = this;
                        
                    function onTween() {

                        me.cfg.refireEvent("iframe");
                    
                    }

                    function onAnimationComplete() {

                        YAHOO.util.Dom.setStyle(me.body, "marginTop", ("0px"));
                        YAHOO.util.Dom.setStyle(me.element, "overflow", "visible");

                        setupMenuAnimation(me);

                    }
                    

                    /*
                         Refire the event handler for the "iframe" 
                         configuration property with each tween so that the  
                         size and position of the iframe shim remain in sync 
                         with the menu.
                    */

                    if(this.cfg.getProperty("iframe") == true) {

                        oAnim.onTween.subscribe(onTween);

                    }

                    oAnim.onComplete.subscribe(onAnimationComplete);
                
                }


                // "render" event handler for the menu bar

                function onMenuRender(p_sType, p_sArgs, p_oMenu) {

                    setupMenuAnimation(p_oMenu);

                }


                // Instantiate and render the menu bar

                var oMenuBar = new YAHOO.widget.MenuBar("mainNavBar", { autosubmenudisplay:true, hidedelay:750, lazyload:true });


                // Subscribe to the "render" event

                oMenuBar.renderEvent.subscribe(onMenuRender, oMenuBar, true);

                oMenuBar.render();
               
                document.getElementById('mainNav').style.overflow="visible";
            };


            // Initialize and render the menu bar when it is available in the DOM

         
            YAHOO.util.Event.onDOMReady(sfHover); 
            YAHOO.util.Event.onDOMReady(YAHOO.example.onMenuBarReady);
           
/*            
// rightclick disablen
var closeWin="0"; // Do you want to close window (1 for yes 0 for no)
var alertVis="1"; // Do you want to alert the visitor (1 for yes 0 for no)
var message="Copyright Outing Holland 2007"; // Your no right click message here

function detail(){
	  if(alertVis == "1") alert(message); 
          if(closeWin == "1") self.close();
          return false;
}
function IE() {
     if (event.button == "2" || event.button == "3"){ detail();}
}
function NS(e) {
     if (document.layers || (document.getElementById && !document.all))
     {
          if (e.which == "2" || e.which == "3"){ detail();}
     }
}
document.onmousedown=IE;document.onmouseup=NS;document.oncontextmenu=new Function("return false");
*/	
