// nombre: nombre de la ventana (con ruta)
// w : atributo width
// h : atributo height
function openWindow(nombre,w,h) {
   var n = nombre.substring(nombre.lastIndexOf('/')+1,nombre.lastIndexOf('.'));
   var ww = w;
   var hh = h;
   var l = (screen.availWidth-w)/2;
   var t = (screen.availHeight-h)/2;
   if (screen.availWidth <= w) {
   	ww = screen.availWidth - 5;
   	l = (screen.width-w)/2;
   }
   if (screen.availHeight <= h) {
   	hh = screen.availHeight - 27;
		t = (screen.height-h)/2;
   }
   var v1 = window.open(nombre,n,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width='+ww+',height='+hh+',left='+l+',top='+t);
   v1.focus();
   return false;
}
// nombre: nombre de la ventana (con ruta)
// w : atributo width
// h : atributo height
function openWindowNoScroll(nombre,w,h) {
   var n = nombre.substring(nombre.lastIndexOf('/')+1,nombre.lastIndexOf('.'));
   var ww = w;
   var hh = h;
   var l = (screen.availWidth-w)/2;
   var t = (screen.availHeight-h)/2;
   if (screen.availWidth <= w) {
   	ww = screen.availWidth - 5;
   	l = (screen.width-w)/2;
   }
   if (screen.availHeight <= h) {
   	hh = screen.availHeight - 27;
		t = (screen.height-h)/2;
   }
   var v2 = window.open(nombre,n,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width='+ww+',height='+hh+',left='+l+',top='+t);
   v2.focus();
   return false;
}
// Agregar a favoritos
function addBookmark() {
   if (navigator.appName=="Netscape") {
      alert('Para añadir este sitio a sus favoritos pulse Ctrl+D');
   }
   else if (parseInt(navigator.appVersion)>3) {
      window.external.AddFavorite(top.location.href, document.title);
   }
}
// Cierra ventana
function closeWindow() {
   //window.opener.focus();
   window.top.close();
   return false;
}
// Imprime 
function printWindow() {
   window.print();
   return false;
}
// Comprueba si un campo de texto de un formulario esta vacio. Si es asi, devuelve
//true, si no, devuelve false. El parámetro pasado corresponde al nombre de formulario
//junto con el nombre del campo (nombre_formulario.nombre_fichero)
function vacio(c) {
   eval("v = document." + c + ".value;");
   if (v != "") 
      return false;
   return true;
}