
function dialog(error, button) {
  Dialog.alert(error, 
               {windowParameters: {className: "alphacube", width:300, height:100}, okLabel: button ? button : "Aceptar", 
                ok:function(win) {debug("validate alert panel"); return true;}, cancel:function(win) {debug("validate cancel panel"); return true;}});
}



function openAdmin()
{
  var win = new Window("master" ,{url: "admin/index.php", id: "win2", className: "alphacube", title: "Administración", width:700, height:500}); 
  win.setDestroyOnClose(); 
  win.showCenter();
  win.setConstraint(true, {left:0, right:0, top: 10, bottom:10})
  win.toFront();
}


function validateImport(){
	if(!document.getElementById('import_file').value)
		dialog("Debe Seleccionar un archivo");
	else{
		dialog('<div id="alphacube_progress"></div>', 'Importando');
		document.importData.submit(); 
	}
		
	
}


function validateData(form){
	
	 for(a = 0; a < document.forms[0].elements.length; a+=1){ 
	 	
	 		if(!document.forms[0].elements[a].value){
	 			dialog("Debe rellenar todos los campos del formulario");
	 			return false;
	 		}
	 }
	 
	 document.forms[0].submit();
}

function outsideWindow() {
    var win = new Window("win3", {url: "http://www.google.es", className: "alphacube", top:40, left:0, width:200, height:100, title:"Outside Window",
                          maximizable: false, minimizable: false});
    win.setDestroyOnClose();
    win.show();
    win.toFront();
  }
  
  
  function deleteLan(id){
  		if(confirm('Está a punto de borrar el lenguje completamente. ¿Desea continuar?')){
  			xajax_deleteLanguage(id);
  		}
  		else
  			return false;
  	
  }
  
  
  function deleteReg(id, table){
  		if(confirm('Desea borrar el registro seleccionado?')){
  			xajax_deleteReg(id, table);
  		}
  		else
  			return false;
  	
  }
  