
/* esta funcion es para verificar ke no se envien blankos*/
function validarblancos(campo){
	cadena = campo; 
	cadena = cadena.replace(/(^\s*)|(\s*$)/g,""); 
	if (cadena.length==0){
		return false;
	}else{
		return true;
	}
}

/* esta funcion es para validar mail */
/* With RegExp */
function isEmail2(who) {
	var email=/^[A-Za-z0-9][\w-.]+@[A-Za-z0-9]([\w-.]+[A-Za-z0-9]\.)+([A-Za-z]){2,4}$/i;
	return(email.test(who));
}
//revisa todos los checkbox ke existen el el formulario con mismo nombre
function val_chk(valor)
 {
	cont=0;
	pri_chk=""
	for(x=0;x<document.formm.chk_priv.length;x++)
	{
		//alert(document.formm.chk_priv[x].checked)
		if(document.formm.chk_priv[x].checked==true)
		{
			pri_chk=pri_chk+"&priv"+cont+"="+document.formm.chk_priv[x].value
			cont++;
		}
		
	}
	pri_chk=pri_chk+"&cont="+cont
	return pri_chk
 }
 
 //pppppppppppppSeleccionar todos los check y deseleccionar
 function sel_all_check(y)
 {
	
	if(document.formm.chk_priv[y].checked==true)
	{
		for(x = 0; x < document.formm.chk_priv.length ; x++)
		{
			document.formm.chk_priv[x].checked = true
		}
	}else{
		for(x=0;x<document.formm.chk_priv.length;x++)
		{
			document.formm.chk_priv[x].checked=false
		}
	}
 }
 function ver_direcc(direccion)
{
	var dir="";
	for(x=direccion.length;x>=0;x=x-1)
	{
		//alert(direccion.substring(x,direccion.length))
		if(direccion.charAt(x)=="/")
		{
			dir = direccion.substring(x+1,direccion.length);
			x=0;
		}
	}
	alert(dir)
}

	function valida_folleto(opt)
{
	if (validarblancos(document.formm.txt_nombre.value)==false)
	{
		alert("Ingrese el nombre del folleto")
		document.formm.txt_nombre.focus()
		return false
	}
	var height = parseInt(document.formm.txt_height.value)
	if(isNaN(height))//isNaN
	{
		alert("Ingrese el alto del flash, solo números")
		document.formm.txt_height.focus()
		return false
	}
	var width = parseInt(document.formm.txt_width.value)
	if(isNaN(width))//isNaN
	{
		alert("Ingrese el Largo del flash, solo números")
		document.formm.txt_width.focus()
		return false
	}
	if(opt==1)
	{
		if (validarblancos(document.formm.archivo.value)==false)
		{
			alert("Seleccione la imagen flash para subir")
			document.formm.archivo.focus()
			return false
		}
	}
}
function compruebafile(){//valida ke el boton chk_cambia este presionado si es asi obliga a ke se ingrese una imagen
		if (document.formm.chk_cambia.checked==true){
			if(validarblancos(document.formm.archivo.value)==false)
			{
				alert("Seleccione la nueva imagen")
				document.formm.archivo.focus()
				return false
			}
		}
		return true
  	}
function comprueva_todo(){//comprueba todos los 
	for (i=0; i < document.formm.elements.length; i++)
	{
		if(document.formm.elements[i].type == "file" || document.formm.elements[i].type == "text" )
		{
				if (validarblancos(document.formm.elements[i].value)==false){
					alert("Favor de completar todos los campos del formulario");
					document.formm.elements[i].focus();
					return false;
				}
		}
	}
}
 