var flechas={vertical:['claseflechavertical', 'http://www.oager.com/oager2/img/arrow-down.gif', 5], horizontal:['claseflechahorizontal', 'http://www.oager.com/oager2/img/arrow-right.gif','claseflechaderecha','http://www.oager.com/oager2/img/arrow-left.gif']}
var jquerycssmenu=
    {
    cargarMenu:function(menuid, flechasMenu)
        {
	        jQuery(document).ready(function($)
	            {
		        var $menuPrincipal=$("#"+menuid+">ul")
		        var $cabeceras=$menuPrincipal.find("ul").parent()
        		
		        $cabeceras.each(function(i)
		            {
		            $(this).css({zIndex:i+1})
			            var $curobj=$(this)
			            var $subul=$(this).find('ul:eq(0)')
			            this._dimensions={w:this.offsetWidth, h:this.offsetHeight, subulw:$subul.outerWidth(), subulh:$subul.outerHeight()}
			            this.esCabecera=$curobj.parents("ul").length==1? true : false
			            $subul.css({top:this.esCabecera? this._dimensions.h+"px" : 0})
			            var num;
			            if($(this).attr("title")=="1")
			                {num=0;}
			            else
			                {num=2}
				            $curobj.children("a:eq(0)").css(this.esCabecera? {paddingRight: flechasMenu.vertical[2]} : {}).append(
				            '<img src="'+ (this.esCabecera? flechasMenu.vertical[1] : flechasMenu.horizontal[num+1])
				            +'" class="' + (this.esCabecera? flechasMenu.vertical[0] : flechasMenu.horizontal[num])
				            + '" style="border:0;" />'
			            )
			            $curobj.hover(
				            function(e){
					            var $targetul=$(this).children("ul:eq(0)")
					            this._offsets={left:$(this).offset().left, top:$(this).offset().top}
					            var anchoMenu=this.esCabecera? 0 : this._dimensions.w
					            anchoMenu=(this._offsets.left+anchoMenu+this._dimensions.subulw>$(window).width())? (this.esCabecera? -this._dimensions.subulw+this._dimensions.w : -this._dimensions.w) : anchoMenu
            					if($(this).attr("title")=="1")
            					    {
            					    if (!this.esCabecera)
            					        {anchoMenu=-200}
            					    }
            					else
            					    {
            					    if (!this.esCabecera)
            					        {anchoMenu=202}
            					    }
            				
					            $targetul.css({left:anchoMenu-1+"px"}).fadeIn(50);
					            
                                            /*if(document.getElementById && document.all && navigator.appVersion.indexOf("MSIE 6.")>=0) {
					                                //SI ES EXPLORER 6 SE OCULTAN LOS COMBOS
					                                $("select").fadeOut(200);
					                                }*/
				                },
				                function(e){
					                $(this).children("ul:eq(0)").fadeOut(300,function(){ 
					                //SI ES EXPLORER 6 SE OCULTAN LOS COMBOS
//                                            if(document.getElementById && document.all && navigator.appVersion.indexOf("MSIE 6.")>=0) {
//					                            var visibles;
//					                            visibles=$(".padremenu:visible")
//					                            if (visibles.length==0)
//					                                $("select").fadeIn(200);}
                                        });
					              
				                }
			            ) //fin de hover
		            }) //fin de  $cabeceras.each()
		        $menuPrincipal.find("ul").css({display:'none', visibility:'visible'})
	            }) //fin de  document.ready
        }
    }

//Cargo el menú con la ID="menuDinamico" en la página:
jquerycssmenu.cargarMenu("menuDinamico", flechas)