// ventanas y alertas

var mostrarContenido = function($destino) {

		new Ajax.Updater('mensaje',
			$destino,{
				method: 'post',
				onFailure: function(){
				alerta('Error: El servicio no esta disponible');
				   					
							},
				onSuccess: function(){
					$('mensaje').appear();
					return false;
				}
				
			});
 	}
 	

function open_list_archivos(url) {
	mostrarContenido();
  }
  
  
 	function alerta($mensaje) {
			Dialog.alert($mensaje, 
             {
             	className: "mac_os_x",
             	width:300,
             	height:100,
             	okLabel: "Cerrar", 
              	ok:function(win) {
              		debug("validate alert panel");
              		return true;
              	}
             });
 
 	}  
 	
 	
 	
 	function alertaConfirmacion($mensaje,$funcion) {
 		Dialog.confirm($mensaje,
 			{
 				className: "mac_os_x",
 				$width:300,
 				height:100,
 				okLabel: "Si estoy seguro",
 				id: "myDialogId",
 				cancel:function(win)
 					{
 						debug("cancel confirm panel")
 					},
 				ok:function(win)
 					{    
 					return 'ok'
 					}
 			});
 	}
 	
 	
 function ventanaView($contenido,$titulo) {
		new Window({
			url: $contenido,
			className: "alphacube",
	 		width:420,
	 		height:380,
	 		zIndex:100,
	 		resizable: true,
	 		title: $titulo,
	 		//showEffect:Effect.BlindDown,
	 		//hideEffect: Effect.SwitchOff,
	 		draggable:true,
	 		wiredDrag: true	
			}).show();
		 
 	}
 	
 	
 	
 	
 	
 	function ventanaDragable(div) {
 		new Draggable(div);
 	}
 	

 	function openAjaxVentanaModal() {
      Dialog.alert({url: 'publicar.php', options: {method: 'post'}}, 
                     {top: 50,
                     height:380,
                     width:400,
                     className: "alphacube",
                     okLabel: "Cerrar",
                     ok: closeGestorImagen,
                     cancelLabel:"Cancelar",
                     onCancel:closeAllModalWindows,
                     buttonClass:"botones_a",
                     draggable:true
                     })
	  //abrirBibliotecaImagenes();
  }
  
    
    function closeGestorImagen() {
   		Windows.closeAllModalWindows();
   		open_list_archivos('acciones/list_archivos_temporales.php');
    return true;
  }
  
  
      function closeAllModalWindows() {
   		Windows.closeAllModalWindows();
    return true;
  }