    var menuFixed = "";
    String.prototype.trim = function() {
    	return this.replace(/^\s+|\s+$/g,"");
    }
    
    $(document).ready(function() {        
        $('div.menu_boton').click(
            function(){
                if(menuFixed != ""){
                    if($(this).attr('id') != menuFixed){
                        $('#'+menuFixed).removeClass('menu_boton_hover');
                        if($('#tab_'+menuFixed+'_options').css('display') == 'block')
                            $('#tab_'+menuFixed+'_options').hide('slide', { direction: "up" });
                        menuFixed = $(this).attr('id');
                        $('#tab_'+menuFixed+'_options').show('slide', { direction: "up" });
                    }
					else{
						if($('#tab_'+menuFixed+'_options').css('display') == 'block')
							$('#tab_'+menuFixed+'_options').hide('slide', { direction: "up" });
                        else
                            $('#tab_'+menuFixed+'_options').show('slide', { direction: "up" });
					}
                }
                else{
                    menuFixed = $(this).attr('id');
                    $('#tab_'+menuFixed+'_options').show('slide', { direction: "up" });
                }  
            }
            
        );
		
        $('div.menu_boton').hover(
            function () {
                $(this).addClass("menu_boton_hover");
            },
            function () {
				if(menuFixed != $(this).attr('id'))
                	$(this).removeClass("menu_boton_hover");
            }
        );
    });
    
    function select_empresa(){
        $('#datos_empresa').hide('slide', { direction: "up" });
        $('#seleccionar_emprea').show('slide', { direction: "down" });
    }
    
    function seleccionar(){
        document.formEmpresas.submit();        
    }
    
    function crearPerfil(){
        var left = (screen.width-550)/2;
        var alto = screen.height;
        if (window.showModalDialog) 
            window.showModalDialog("add_perfil.php","name","dialogWidth:550px;dialogHeight:"+alto+"px; dialogLeft:"+left+"px");
        else
            window.open('add_perfil.php','name', 'height='+alto+',width=550,left='+left+', toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no ,modal=yes');
    }
    
    function crearProceso(){
        var left = (screen.width-550)/2;
        var alto = screen.height;
        if (window.showModalDialog) 
            window.showModalDialog("add_proceso.php","name","dialogWidth:550px;dialogHeight:"+alto+"px; dialogLeft:"+left+"px");
        else
            window.open('add_proceso.php','name', 'height='+alto+',width=550,left='+left+', toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no ,modal=yes');
    }
