////////////////////////////////
///    LLENA CAMPOS SELECT   ///
////////////////////////////////
//
//




////////////////////////////////
///  VERIFICA CAMPOS LLENOS  ///
////////////////////////////////
//
//
//~~Verifica peticion de catalogo
function verifica_soporte() {
 var cad = '';
 var ban = 0;
 if (document.form1.nombre.value == '') {
     cad += "Escribe tu nombre.\n";
	 ban++;
 }
 if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.form1.email.value)){
   //alert("La dirección de email " + valor    + " es correcta.") 
   //return (true)
 } else {
     cad += "Escribe tu correo electrónico.\n";
	 ban++;
 } 
 if (document.form1.asunto.value == '') {
     cad += "Escribe el asunto.\n";
	 ban++;
 }
 if (document.form1.msg.value == '') {
     cad += "Escribe tu comentario.\n";
	 ban++;
 }
 if (ban != 0) {
     alert(cad);
     return(false);
 } else {
	 alert('Correo enviado');
	 return(false);
	 
     /*
	 document.form1.method = 'POST'; 
     document.form1.action = 'soporte_send.php'; 
     document.form1.submit();
	 */
 }
}





////////////////////////////////
///          STUFF           ///
////////////////////////////////
//
//
//ABRE MAIN
function admin (id_sec,cate,limite,id_sel,tipo) {
   if(id_sec) document.form1.id_sec.value = id_sec;
   if(cate)   document.form1.cate.value   = cate;
   if(limite) document.form1.limite.value = limite;
   if(id_sel) document.form1.id_sel.value = id_sel;
   var page;
   switch (tipo) {
	case 1: page = 'index.php';    break;   	   
	case 2: page = 'index_en.php'; break;   	   
   }
   document.form1.method = 'POST'; 
   document.form1.action = page; 
   document.form1.submit();
}
//
//
function printmovie(url,w,h) {
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+w+'" height="'+h+'">');
document.write('<param name="movie" value="'+url+'">');
document.write('<param name="scale" value="noscale">');
document.write('<param name="bgcolor" value="#000000">');
document.write('<param name="quality" value="best">');
document.write('<param name="salign" value="t">');
document.write('<param name="wmode" value="transparent">');
document.write('<param name="allowscriptaccess" value="samedomain">');
document.write('<embed src="'+url+'" scale="noscale" bgcolor="#000000" quality="best" salign="t" wmode="transparent" swliveconnect="true" allowscriptaccess="samedomain" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'"></embed></object>');
}
//
//
function init(id){
		var stretchers = document.getElementsByClassName('stretcher'); //div that stretches
		var toggles = document.getElementsByClassName('display'); //h3s where I click on
		//accordion effect
		var myAccordion = new fx.Accordion(
			toggles, stretchers, {opacity: true, duration: 400}
		);

		//hash function
		
		function checkHash(){
			var found = false;
			toggles.each(function(h3, i){
				if (window.location.href.indexOf(h3.title) > 0) {
					myAccordion.showThisHideOpen(stretchers[i]);
					found = true;
				}
			});
			return found;
		}
		if (!checkHash()) myAccordion.showThisHideOpen(stretchers[id]);
}






////////////////////////////////
///        GENERICAS         ///
////////////////////////////////
//
//
function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}
//
//
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//
//
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
//
//
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//
//
///////////////////////////////////////////
//             SECCION DE AJAX           //
///////////////////////////////////////////
//
//
//Crea objeto Ajax
function nuevoAjax(){
	var xmlhttp=false;
 	try {
 		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 	} catch (e) {
 		try {
 			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
 		} catch (E) {
 			xmlhttp = false;
 		}
  	}

	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
 		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}
//
//






/*
////////////////////////////////
///    LLENA CAMPOS SELECT   ///
////////////////////////////////
//
//
//~~Llena componentes en los archivos de listado: *_list.php
function com_list(tipo) {
  var success1 = -1;
  
  for (var i = 0; i < document.form1.limite.length; i++) {
    if (document.form1.limite.options[i].value == document.form1.limiteB.value)
      success1 = [i];
  } 
  document.form1.limite.selectedIndex = success1;
  //---- Si tenemos Catgoria (grupo) ejecutamos este codigo
  if (tipo == 1) {
      var success2 = -1;
  
      for (var i = 0; i < document.form1.cate.length; i++) {
           if (document.form1.cate.options[i].value == document.form1.cateB.value)
               success2 = [i];
      } 
      document.form1.cate.selectedIndex = success2;
  }
  //---- Si tenemos Catgoria (grupo) ejecutamos este codigo
}
//
//
//~~Llena componentes en incidente_new
function com_incidente_new() {
  var success1 = -1;
  var success2 = -1;
  var success3 = -1;
  var success4 = -1;
  var success5 = -1;
  
  for (var i = 0; i < document.form1.minuto.length; i++) {
    if (document.form1.minuto.options[i].value == document.form1.minutoB.value)
      success1 = [i];
  } 
  for (var i = 0; i < document.form1.hora.length; i++) {
    if (document.form1.hora.options[i].value == document.form1.horaB.value)
      success2 = [i];
  } 
  for (var i = 0; i < document.form1.dia.length; i++) {
    if (document.form1.dia.options[i].value == document.form1.diaB.value)
      success3 = [i];
  } 
  for (var i = 0; i < document.form1.mes.length; i++) {
    if (document.form1.mes.options[i].value == document.form1.mesB.value)
      success4 = [i];
  } 
  for (var i = 0; i < document.form1.anio.length; i++) {
    if (document.form1.anio.options[i].value == document.form1.anioB.value)
      success5 = [i];
  } 
  document.form1.minuto.selectedIndex = success1;
  document.form1.hora.selectedIndex   = success2;
  document.form1.dia.selectedIndex    = success3;
  document.form1.mes.selectedIndex    = success4;
  document.form1.anio.selectedIndex   = success5;
  document.form1.region.focus();
}
//
//
//~~Llena componentes en user_adm_edit
function com_user_adm() {
  var success1 = -1;
  
  for (var i = 0; i < document.form1.id_suc.length; i++) {
    if (document.form1.id_suc.options[i].value == document.form1.id_sucB.value)
      success1 = [i];
  } 
  document.form1.id_suc.selectedIndex = success1;
}
//
//
////////////////////////////////
///  VERIFICA CAMPOS LLENOS  ///
////////////////////////////////
//
//
//~~verifica Index
function verifica_index_suc() {
 var cad = '';
 var ban = 0;
 if (document.form1.user.value == '') {
     cad += "Escribe el nombre de usuario.\n";
	 ban++;
 }
 if (document.form1.pass.value == '') {
     cad += "Escribe la contraseña.\n";
	 ban++;
 }
 if (ban != 0) {
     alert(cad);
     return(false);
 } else {
     document.form1.method = 'POST'; 
     document.form1.action = './functions/valida_suc.php'; 
     document.form1.submit();
 }
}
//
//
//~~verifica sucursal nueva
function verifica_suc_new() {
 var cad = '';
 var ban = 0;
 if (document.form1.tienda.value == '') {
     cad += "Escribe el nombre de la tienda.\n";
	 ban++;
 }
 if (document.form1.gerente.value == '') {
     cad += "Escribe el nombre del gerente.\n";
	 ban++;
 }
 if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.form1.email.value)){
   //alert("La dirección de email " + valor    + " es correcta.") 
   //return (true)
  } else {
     cad += "Escribe el correo electrónico del gerente.\n";
	 ban++;
 } 
 if (document.form1.dir.value == '') {
     cad += "Escribe la dirección de la tienda.\n";
	 ban++;
 }
 //
 if (ban != 0) {
     alert(cad);
     return(false);
 } else {
     document.form1.method = 'POST'; 
     document.form1.action = './suc_adm_save.php'; 
     document.form1.submit();
 }
}
//
//
//~~verifica edicion de sucursal
function verifica_suc_edit() {
 var cad = '';
 var ban = 0;
 if (document.form1.tienda.value == '') {
     cad += "Escribe el nombre de la tienda.\n";
	 ban++;
 }
 if (document.form1.gerente.value == '') {
     cad += "Escribe el nombre del gerente.\n";
	 ban++;
 }
 if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.form1.email.value)){
   //alert("La dirección de email " + valor    + " es correcta.") 
   //return (true)
  } else {
     cad += "Escribe el correo electrónico del gerente.\n";
	 ban++;
 } 
 if (document.form1.dir.value == '') {
     cad += "Escribe la dirección de la tienda.\n";
	 ban++;
 }
 //
 if (ban != 0) {
     alert(cad);
     return(false);
 } else {
     document.form1.method = 'POST'; 
     document.form1.action = './suc_adm_update.php'; 
     document.form1.submit();
 }
}
//
//
//~~Verifica nuevo usuer_clientes
function veri_user_suc_new() {
 var cad = '';
 var ban = 0;
 if (document.form1.nombre.value == '') {
     cad += "Escribe el nombre del usuario.\n";
	 ban++;
 }
 if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.form1.email.value)){
   //alert("La dirección de email " + valor    + " es correcta.") 
   //return (true)
  } else {
     cad += "Escribe el correo electrónico.\n";
	 ban++;
  } 
  if (document.form1.user.value == '') {
     cad += "Escribe el usuario.\n";
	 ban++;
 }
 if (document.form1.pass.value == '') {
     cad += "Escribe la contraseña.\n";
	 ban++;
 }
 if (ban != 0) {
     alert(cad);
     return(false);
 } else {
	 //Ajax para hacer la consulta a la tabla
	 ajax = nuevoAjax();
	 var email = document.form1.email.value;
	 var user  = document.form1.user.value;
	 var pass  = document.form1.pass.value;
	 ajax.open("GET", "user_suc_repeat_new.php?email="+email+"&user="+user+"&pass="+pass,true);
	 ajax.onreadystatechange = function() {
		if (ajax.readyState==4) {
			var arreglo = ajax.responseText.split("rbnrbn");
			document.form1.res.value = arreglo[0];
		}
	 }
	 ajax.send(null);
	 setTimeout("user_suc_time(1);",1500);
 }
}
//~~Verifica editar usuer_clientes
function veri_user_suc_edit() {
 var cad = '';
 var ban = 0;
 if (document.form1.nombre.value == '') {
     cad += "Escribe el nombre del usuario.\n";
	 ban++;
 }
 if (document.form1.apellidos.value == '') {
     cad += "Escribe los apellidos.\n";
	 ban++;
 }
 if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.form1.email.value)){
   //alert("La dirección de email " + valor    + " es correcta.") 
   //return (true)
  } else {
     cad += "Escribe el correo electrónico.\n";
	 ban++;
  } if (document.form1.user.value == '') {
     cad += "Escribe el usuario.\n";
	 ban++;
 }
 if (document.form1.pass.value == '') {
     cad += "Escribe la contraseña.\n";
	 ban++;
 }
 if (ban != 0) {
     alert(cad);
     return(false);
 } else {
	 //Ajax para hacer la consulta a la tabla
	 ajax = nuevoAjax();
	 var email  = document.form1.email.value;
	 var user   = document.form1.user.value;
	 var pass   = document.form1.pass.value;
	 var id_sel = document.form1.id_admin.value;
	 ajax.open("GET", "user_suc_repeat_edit.php?email="+email+"&user="+user+"&pass="+pass+"&id_sel="+id_sel,true);
	 ajax.onreadystatechange = function() {
		if (ajax.readyState==4) {
			var arreglo = ajax.responseText.split("rbnrbn");
			document.form1.res.value = arreglo[0];
		}
	 }
	 ajax.send(null);
	 setTimeout("user_suc_time(2);",1500);
 }
}
//Complemento de verifica_admin_new() y verifica_admin_edit(), muestra el mensaje correspondiente
function user_suc_time(action) {
	var id = document.form1.res.value;
	switch(id) {
	  case '0': document.form1.action = (action == 1) ? 'user_suc_save.php' : 'user_suc_update.php';
	   		    document.form1.submit();
			  break;
	  case '1': alert('Correo ya existe. Intente otro');
	          break;
	  case '2': alert('Contraseña ya existe. Intente otra');
	          break;
	}
}
//
//
//~~Verifica nuevo usuer_clientes ASDM
function veri_user_adm_new() {
 var cad = '';
 var ban = 0;
 if (document.form1.nombre.value == '') {
     cad += "Escribe el nombre del usuario.\n";
	 ban++;
 }
 if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.form1.email.value)){
   //alert("La dirección de email " + valor    + " es correcta.") 
   //return (true)
  } else {
     cad += "Escribe el correo electrónico.\n";
	 ban++;
  } 
  if (document.form1.user.value == '') {
     cad += "Escribe el usuario.\n";
	 ban++;
 }
 if (document.form1.pass.value == '') {
     cad += "Escribe la contraseña.\n";
	 ban++;
 }
 if (ban != 0) {
     alert(cad);
     return(false);
 } else {
	 //Ajax para hacer la consulta a la tabla
	 ajax = nuevoAjax();
	 var email = document.form1.email.value;
	 var user  = document.form1.user.value;
	 var pass  = document.form1.pass.value;
	 ajax.open("GET", "user_adm_repeat_new.php?email="+email+"&user="+user+"&pass="+pass,true);
	 ajax.onreadystatechange = function() {
		if (ajax.readyState==4) {
			var arreglo = ajax.responseText.split("rbnrbn");
			document.form1.res.value = arreglo[0];
		}
	 }
	 ajax.send(null);
	 setTimeout("user_adm_time(1);",1500);
 }
}
//~~Verifica editar usuer_clientes
function veri_user_adm_edit() {
 var cad = '';
 var ban = 0;
 if (document.form1.nombre.value == '') {
     cad += "Escribe el nombre del usuario.\n";
	 ban++;
 }
 if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.form1.email.value)){
   //alert("La dirección de email " + valor    + " es correcta.") 
   //return (true)
  } else {
     cad += "Escribe el correo electrónico.\n";
	 ban++;
  } if (document.form1.user.value == '') {
     cad += "Escribe el usuario.\n";
	 ban++;
 }
 if (document.form1.pass.value == '') {
     cad += "Escribe la contraseña.\n";
	 ban++;
 }
 if (ban != 0) {
     alert(cad);
     return(false);
 } else {
	 //Ajax para hacer la consulta a la tabla
	 ajax = nuevoAjax();
	 var email  = document.form1.email.value;
	 var user   = document.form1.user.value;
	 var pass   = document.form1.pass.value;
	 var id_sel = document.form1.id_sel.value;
	 ajax.open("GET", "user_adm_repeat_edit.php?email="+email+"&user="+user+"&pass="+pass+"&id_sel="+id_sel,true);
	 ajax.onreadystatechange = function() {
		if (ajax.readyState==4) {
			var arreglo = ajax.responseText.split("rbnrbn");
			document.form1.res.value = arreglo[0];
		}
	 }
	 ajax.send(null);
	 setTimeout("user_adm_time(2);",1500);
 }
}
//Complemento de verifica_admin_new() y verifica_admin_edit(), muestra el mensaje correspondiente
function user_adm_time(action) {
	var id = document.form1.res.value;
	switch(id) {
	  case '0': document.form1.action = (action == 1) ? 'user_adm_save.php' : 'user_adm_update.php';
	   		    document.form1.submit();
			  break;
	  case '1': alert('Correo ya existe. Intente otro');
	          break;
	  case '2': alert('Contraseña ya existe. Intente otra');
	          break;
	}
}
//
//
//~~verifica nuevo incidente
function verifica_incidente() {
 var cad = '';
 var ban = 0;
 if (document.form1.desc_incidente.value == '') {
     cad += "Escribe la descripción del incidente.\n";
	 ban++;
 }
 if (ban != 0) {
     alert(cad);
     return(false);
 } else {
     document.form1.method = 'POST'; 
     document.form1.action = './incidente_suc_save.php'; 
     document.form1.submit();
 }
}
//
//
//~~verifica nuevo reporte de equipo
function verifica_equipo() {
 var cad = '';
 var ban = 0;
 if (document.form1.id_equipo.value == '') {
     cad += "Selecciona el equipo.\n";
	 ban++;
 }
 if (document.form1.texto.value == '') {
     cad += "Escribe la descripción de la falla en el equipo.\n";
	 ban++;
 }
 if (ban != 0) {
     alert(cad);
     return(false);
 } else {
     document.form1.method = 'POST'; 
     document.form1.action = './equipos_suc_save.php'; 
     document.form1.submit();
 }
}
//
//
//~~03 Campos New Promo
function verifica_promo_new() {
 var cad = '';
 var ban = 0;
 if (document.form1.nombre.value == '') {
     cad += "Escribe el nombre.\n";
	 ban++;
 }
if (document.form1.dia.value == 0) {
     cad += "Selecciona el dia de inicio.\n";
	 ban++;
 }
 if (document.form1.mes.value == 0) {
     cad += "Selecciona el mes de inicio.\n";
	 ban++;
 }
 if (document.form1.anio.value == 0) {
     cad += "Selecciona el año de inicio.\n";
	 ban++;
 }
if (document.form1.dia2.value == 0) {
     cad += "Selecciona el dia de fin.\n";
	 ban++;
 }
 if (document.form1.mes2.value == 0) {
     cad += "Selecciona el mes de fin.\n";
	 ban++;
 }
 if (document.form1.anio2.value == 0) {
     cad += "Selecciona el año de fin.\n";
	 ban++;
 }
 
 if (document.form1.img_ch.value != '') {
     var ln = document.form1.img_ch.value.length-3;
     var ext = document.form1.img_ch.value.substr(ln,3);
	 ext = ext.toLowerCase();
     if (ext != 'jpg') {
		 cad += "Imagen pequeña no valida. Solo 'jpg'\n";
		 ban++; 
	 }
 }
 if (document.form1.img_g.value != '') {
     var ln = document.form1.img_g.value.length-3;
     var ext = document.form1.img_g.value.substr(ln,3);
	 ext = ext.toLowerCase();
     if (ext != 'jpg') {
		 cad += "Imagen grande no valida. Solo 'jpg'\n";
		 ban++; 
	 }
 }
 if (ban != 0) {
     alert(cad);
     return(false);
 } else {
	 //Ajax para hacer la consulta a la tabla
	 ajax = nuevoAjax();
	 var nom   = document.form1.nombre.value;
	 ajax.open("GET", "promo_repeat_new.php?nom="+nom,true);
	 ajax.onreadystatechange = function() {
		if (ajax.readyState==4) {
			var arreglo = ajax.responseText.split("rbnrbn");
			document.form1.res.value = arreglo[0];
		}
	 }
	 ajax.send(null);
	 setTimeout("promo_time(1);",1500);
 }
}
//
//
//~~04 Campos Edit Equipo
function verifica_promo_edit() {
 var cad = '';
 var ban = 0;
 if (document.form1.nombre.value == '') {
     cad += "Escribe el nombre.\n";
	 ban++;
 }
if (document.form1.dia.value == 0) {
     cad += "Selecciona el dia de inicio.\n";
	 ban++;
 }
 if (document.form1.mes.value == 0) {
     cad += "Selecciona el mes de inicio.\n";
	 ban++;
 }
 if (document.form1.anio.value == 0) {
     cad += "Selecciona el año de inicio.\n";
	 ban++;
 }
if (document.form1.dia2.value == 0) {
     cad += "Selecciona el dia de fin.\n";
	 ban++;
 }
 if (document.form1.mes2.value == 0) {
     cad += "Selecciona el mes de fin.\n";
	 ban++;
 }
 if (document.form1.anio2.value == 0) {
     cad += "Selecciona el año de fin.\n";
	 ban++;
 }
 if (ban != 0) {
     alert(cad);
     return(false);
 } else {
	 //Ajax para hacer la consulta a la tabla
	 ajax = nuevoAjax();
	 var nom    = document.form1.nombre.value;
	 var id_sel = document.form1.id_admin.value;
	 ajax.open("GET", "promo_repeat_edit.php?nom="+nom+"&id_sel="+id_sel,true);
	 ajax.onreadystatechange = function() {
		if (ajax.readyState==4) {
			var arreglo = ajax.responseText.split("rbnrbn");
			document.form1.res.value = arreglo[0];
		}
	 }
	 ajax.send(null);
	 setTimeout("promo_time(2);",1500);
 }
}
//Complemento de verifica_promo_new() y verifica_promo_edit(), muestra el mensaje correspondiente
function promo_time(action) {
	var id = document.form1.res.value;
	switch(id) {
	  case '0': document.form1.action = (action == 1) ? 'promo_save.php' : 'promo_update.php';
				document.form1.submit();
			  break;
	  case '1': alert('Promocion ya existe. Intente otra');
	          break;
	}
}
//
//
////////////////////////////////
///          STUFF           ///
////////////////////////////////
//
//
//Autoriza reporte
function autoriza_reporte(url) {
   var agree=confirm("¿Autorizar reporte?");
   if (agree) {
	   //alert(url);
	   window.location = url;
   } else {
	   return false ;
   }
}
//
//
//ABRE MAIN
function admin (id_sec,cate,limite,id_sel,tipo) {
   if(id_sec) document.form1.id_sec.value = id_sec;
   if(cate)   document.form1.cate.value   = cate;
   if(limite) document.form1.limite.value = limite;
   if(id_sel) document.form1.id_sel.value = id_sel;
   var page;
   switch (tipo) {
	case 1: page = 'main_suc.php'; break;   	   
	case 2: page = 'main_adm.php'; break;   	   
   }
   document.form1.method = 'POST'; 
   document.form1.action = page; 
   document.form1.submit();
}
//
//
//MARCA TODOS LOS REGISTROS A MOVER O A ELIMINAR
function marca_todos() {
  with (document.form1) {
    for (var i=0; i < elements.length; i++) {
     if (elements[i].type == 'checkbox') {
         if (selCheck.checked == true)
             elements[i].checked = true;
         else 
             elements[i].checked = false;
     }
    }
  }
}
//
//
//~~Elimina varios registros
function borra_todos(txt, url) {
  var veri = 0;
  for (var i=0; i < document.form1.elements.length; i++) {
       if (document.form1.elements[i].type == 'checkbox') {
           if (document.form1.elements[i].checked == true)
             veri++;
     }
   }
   if (veri >= 1) {
       var agree=confirm("Si das click en ACEPTAR, los "+txt+" seleccionados se eliminarán permanentemente.");
       if (agree) {
	       //document.form1.method = 'post';
	       document.form1.action = url;
		   document.form1.submit(); 
	  } else {
	     return false ;
	  }
   } else {
     alert("Selecciona un registro a borrar.");
   }
}
//
//
//Elimina un solo registro
function borra_registro(rname,url) {
   var agree=confirm("¿Borrar registro no.: " + rname +"?");
   if (agree) {
	   window.location = url;
   } else {
	   return false ;
   }
}
//
//
//return validar_num(event);
function validar_num(e) { // 1
    tecla = (document.all) ? e.keyCode : e.which; // 2
    if (tecla==8) return true; // 3
    //patron =/[A-Za-z\s]/; // 4
	patron = /\d/;
    te = String.fromCharCode(tecla); // 5
    return patron.test(te); // 6
}
//
//
*/