function redirect(URLStr){location = URLStr;}

function confirmarDel(ae,campo,id) {
	var conf=confirm('¿Seguro que desea eliminar est'+ae+' '+campo+'?');
	if (conf) { window.location = '?iddel='+id; }
}

var nav4 = window.Event ? true : false;
function soloNum(evt){
   var key = nav4 ? evt.which : evt.keyCode;
   return (key <= 13 || (key >= 48 && key <= 57));
}
function val_caracter(evt){
   var key = nav4 ? evt.which : evt.keyCode;
   return (key==32|| key <= 13 || (key >= 65 && key <= 90)||(key >= 97 && key <= 122)|| (key >= 40 && key <= 57) || (key>=130&&key<=250)||key==95 ||key==241 ||key==209);
}
function val_caract_email(evt){
   var key = nav4 ? evt.which : evt.keyCode;
   return (key <= 13 || (key >= 64 && key <= 90)||(key >= 97 && key <= 122)|| (key >= 48 && key <= 57)||key==95||key==46);
}
function val_numero_letra(evt){
   var key = nav4 ? evt.which : evt.keyCode;
   return (key <= 13 || (key >= 65 && key <= 90)||(key >= 97 && key <= 122)|| (key >= 48 && key <= 57) ||key==241 ||key==209);
}

function soloLetras(evt){
   var key = nav4 ? evt.which : evt.keyCode;
   return (key==32||key <= 13 || (key >= 65 && key <= 90)||(key >= 97 && key <= 122)||(key>=193&&key<=250)||key==95 ||key==241 ||key==209);
}

function validaEmail(id){
   // #5
   valor = document.getElementById(id).value;
   correo = valor.indexOf('@');   
   band=true;
   if (correo != -1){
      email = valor.split('@');
      point = email[1].indexOf('.');
      punto = email[1].split('.');
      if (point != -1 && point!=''){
         if (punto[1].length<2 || punto[1].length>5){
			 document.formulario.email.focus();
            alert('El dominio de la direccion de email no es valido!\nEjemplo: mi_email@gmail.com');
            band=false;
         }
      }
      else{
		  document.formulario.email.focus();
         alert('Falta el dominio del email!\nEjemplo: mi_email@gmail.com');
         band=false;
      }
   }
   else{
	   document.formulario.email.focus();
		alert('El email es incorrecto!\nEjemplo: mi_email@gmail.com');
		band=false;	   
   }
   
   		
   if (band==true)    
      return 2;   
   else return 3;
}

function soloDecimal(evt, id_campo){
   var key = nav4 ? evt.which : evt.keyCode;
   cadena=document.getElementById(id_campo).value;
   document.getElementById(id_campo).value= str_replace('.', ',', cadena);
   if(key==46){
      key=44;
   }
   if ((checkForCharacters(cadena, ',') != -1 && key ==44)||(cadena.length== 0 && key ==44)){
      return false;

   }
   return (key <= 13 || (key >= 48 && key <= 57)|| key==45 || key==44);
}

function abre_popup(URL,titulo,ancho,alto){
   ventana_win=window.open(URL, titulo, "scrollbars=yes, menubar=no, directories=no , channelmode=no, location=no");
   ventana_win.resizeTo(ancho, alto);
   centrox=(screen.width/2)-(ancho/2);
   centroy=(screen.height/2)-(alto/2);
   ventana_win.moveTo(centrox, centroy);
}

function cerrar(esta){
   document.getElementById(esta).style.display="none";
}

function findPos(obj) {
   var curleft = curtop = 0;
   if (obj.offsetParent){
      curleft = obj.offsetLeft;
      curtop = obj.offsetTop;
      while (obj = obj.offsetParent) {
         curleft += obj.offsetLeft;
         curtop += obj.offsetTop;
      }
   }
   return [curleft, curtop];
}

function setCheckedValue(formu,radioObjt, newValue) {
	evaluado=eval("document."+formu+"."+radioObjt);
	for(i=0; i<evaluado.length; i++)		
		evaluado[i].checked = (evaluado[i].value == newValue.toString());	
}
function checkbox_checked(nombre_checkbox,valor){
   calculo=valor.split("|");
   for(i=0; i<calculo.length; i++)
   		document.getElementById(nombre_checkbox+i).checked=(calculo[i]!=' ');	
}
function select_selected(nomb_sel,valor){
 select_tipo = document.getElementById(nomb_sel).getElementsByTagName('OPTION');  
   for (i=0; i<select_tipo.length; i++)
	    select_tipo[i].selected=(select_tipo[i].getAttribute('value')==valor.toString());   			
}