function encuesta(nombre){

	var form = document.getElementById(nombre);

	var radios = form.v.length;

	var check = "";

	for(i=0;i<radios;i++){

		var rad = form.v[i];

		if(rad.checked){

			check = rad.value;

			break;

		}

	}

	if(check==""){

		alert("Seleccione una opción");	

	}else{

		form.submit();

	}

	

}

function enviarVaciar(tipo){

	if(tipo=="email"){

		if(document.enviar_amigo.EmailAmigo.value=="Email de tu amigo"){

			document.enviar_amigo.EmailAmigo.value ="";

		}

	}

	if(tipo=="nombre"){

		if(document.enviar_amigo.NombreAmigo.value=="Tu nombre"){

			document.enviar_amigo.NombreAmigo.value ="";

		}

	}

}

function enviarVaciarSus(){

	if(document.suscripcion.EmailSusc.value=="Tu email"){

		document.suscripcion.EmailSusc.value ="";

	}

}

function enviarAmigo(){

	var nombre = document.enviar_amigo.NombreAmigo.value;

	var email = document.enviar_amigo.EmailAmigo.value;

	var error="";

	if(nombre=="" || nombre=="Tu nombre"){

		error+="Ingresa tu Nombre.\n";	

	}

	if(email=="" || email=="Email de tu amigo"){

		error+="Ingresa el Email de tu amigo.\n";	

	}else{

		var p = email.indexOf("@");

		if(p<1){

			error+= "El Email de tu amigo debe ser una dirección correcta.\n";

		}

	}

	if(error!=""){

		alert(error);

	}else{

		document.enviar_amigo.submit();

	}	

}

function enviarSuscripcion(){

	var email = document.suscripcion.EmailSusc.value;

	var error="";

	if(email=="" || email=="Tu email"){

		error+="Ingresa tu Email.\n";	

	}else{

		var p = email.indexOf("@");

		if(p<1){

			error+= "Tu Email debe ser una dirección correcta.\n";

		}

	}

	if(error!=""){

		alert(error);

	}else{

		document.suscripcion.submit();

	}	

}

function busqueda(){

	var cl = document.buscador.pb.value;

	var error="";

	if(cl==""){

		error="Ingresa una palabra";	

	}else{

		if(cl.length<3){

			error="La palabra debe contener como mínimo 3 caracteres";

		}

	}

	if(error!=""){

		alert(error);

	}else{

		document.buscador.submit();	

	}

}



function abrirVentana(url,nombre,anchoV,altoV) { 

  var ancho=screen.width;

  var alto=screen.height; 

  var pos = (ancho-anchoV)/2;

  var vtn = window.open(url,nombre,'scrollbars=yes,width='+anchoV+',height='+altoV+',top=200,left='+pos);

}



function activarItem(id){

	var td1 = document.getElementById(id);

	if(td1){

		td1.style.backgroundPosition='0 -18px';

	}

}

function desactivarItem(id){

	var td1 = document.getElementById(id);

	if(td1){

		td1.style.backgroundPosition='0 0px';

	}

}



function enviarContacto(){

	var nombre = document.contacto.Nombre.value;

	var email = document.contacto.Email.value;

	var com = document.contacto.Mensaje.value;

	var error="";

	if(nombre==""){

		error+="Ingresa tu Nombre.\n";	

	}

	if(email==""){

		error+="Ingresa tu Email.\n";	

	}else{

		var p = email.indexOf("@");

		if(p<1){

			error+= "Tu Email debe ser una dirección correcta.\n";

		}

	}

	if(com==""){

		error+="Ingresa el Mensaje.\n";	

	}

	if(error!=""){

		alert(error);

	}else{

		document.contacto.submit();

	}

}

function enviarComentario(){

	var nombre = document.comentario.Nombre.value;

	var email = document.comentario.Email.value;

	var com = document.comentario.Mensaje.value;

	var error="";

	if(nombre==""){

		error+="Ingresa tu Nombre.\n";	

	}

	if(email!=""){

		var p = email.indexOf("@");

		if(p<1){

			error+= "Tu Email debe ser una dirección correcta.\n";

		}

	}

	if(com==""){

		error+="Ingresa el Mensaje.\n";	

	}

	if(error!=""){

		alert(error);

	}else{

		document.comentario.submit();

	}

}

function enviarComentarioSocio(){

	var socio = document.comentario.Socio.value;

	var com = document.comentario.Mensaje.value;

	var error="";

	if(socio==""){

		error+="Ingresa tu Cédula.\n";	

	}

	if(com==""){

		error+="Ingresa el Mensaje.\n";	

	}

	if(error!=""){

		alert(error);

	}else{

		document.comentario.submit();

	}

}

function mostrarFormComentario(onload){

	var form = document.getElementById("comentarios_formulario");

	if(onload==1){

		if(comentarios==1){

			form.style.display = "block";

		}else{

			form.style.display = "none";

		}

	}else{

		if(form.style.display == "none"){

			form.style.display = "block"

		}else{

			form.style.display = "none"

		}

	}

}

function validaComentariosContacto(){ 

   var permitidos = 250;

   var contenid="";

   num_caracteres = document.contacto.Mensaje.value.length 

   if (num_caracteres > permitidos){ 

      document.contacto.Mensaje.value = contenido; 

   }else{ 

      contenido =  document.contacto.Mensaje.value 

   } 

} 

function validaComentarios(){ 

   var permitidos = 250;

   var contenid="";

   num_caracteres = document.comentario.Mensaje.value.length 

   if (num_caracteres > permitidos){ 

      document.comentario.Mensaje.value = contenido; 

   }else{ 

      contenido =  document.comentario.Mensaje.value 

   } 

} 



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];}

}

function MM_openBrWindow(theURL,winName,features) { //v2.0

  window.open(theURL,winName,features);

}
