		$(document).ready(function(){
		
    	// BUTTONS
    	$('.fg-button').hover(
    		function(){ $(this).removeClass('ui-state-default').addClass('ui-state-focus'); },
    		function(){ $(this).removeClass('ui-state-focus').addClass('ui-state-default'); }
    	);
    	
    	// MENUS
		var m = ['#op_sistema']; 
		for (i in m) {
			$(m[i]).menu({ content: $(m[i]).next().html(), showSpeed: 200	}); 
		};		
		

				$('#avisar').dialog({
					autoOpen: false,
					modal: true,
					width: 400,
							buttons: {
								"Aceptar": function() { 
									$(this).dialog("close");
									 
								} 
							}
				});
							
				$('#espere').dialog({
					autoOpen: false,
					modal: true,
					width: 400,
							buttons: {
								"Aceptar": function() { 
									$(this).dialog("close"); 
								} 
							}
				});
				$('#dialogo').dialog({
					autoOpen: false,
					modal: true,
					width: 400,
							buttons: {
								"Aceptar": function() { 
									$(this).dialog("close");
									aceptar(); 
								},
								"Cancelar": function() { 
									$(this).dialog("close"); 
								} 
							}
				});						
				$('#dtitulo').dialog({
					autoOpen: true,
					modal: false,
					width: 460,
							buttons: {
								"Actualizar": function() { 
									$('#espere').dialog("open");
							        $.ajax({
							            type: 'POST',
							            url: $('#ftitulo').attr('action'),
							            data: $('#ftitulo').serialize(),
							            dataType : 'json',
							            // Mostramos un mensaje con la respuesta de PHP
							            success: function(data) {
							            	$('#espere').dialog("close");
							            	$('#avisar').html(data.mens);
							            	$('#avisar').dialog('open');
							            }
							        });									
								} 
							}
				});						
				$('#dlogin').dialog({
					autoOpen: true,
					modal: false,
					width: 300,
							buttons: {
								"Aceptar": function() { 
									$(this).dialog("close");
									$('#flogin').submit(); 
								},
								"Cancelar": function() { 
									$(this).dialog("close"); 
								} 
							}
				});
				$('#dcargar').dialog({
					autoOpen: true,
					modal: false,
					width: 550,
							buttons: {
								"Cargar": function() { 
									$('#espere').dialog("open");
							        $('#cargarf').submit();
								} 
							}
				});
										
				$("#vd").click(function(){ $("#avisar").dialog('open');});
				$("#manual").click(function(){
					window.open('http://www.618webed.com/index.php?c=23');
					return false;
				});
				   
				$("#act_css").click(function(){
					$('#espere').dialog("open");
			        $.ajax({
			            type: 'POST',
			            url: $('#festilo').attr('action'),
			            data: $('#festilo').serialize(),
			            dataType : 'json',
			            // Mostramos un mensaje con la respuesta de PHP
			            success: function(data) {
			            	$('#espere').dialog("close");
			            	$('#avisar').html(data.mens);
			            	$('#avisar').dialog('open');
			            }
			        });
				});
					
	});

function get_val(f){
	 $.get("index.php?_get_form="+f, function(data){
  		alert("Data Loaded: " + data);
	});
	return data;
}