	function validarInicio(){
		var emailis = document.getElementById("emailis").value;
		if (emailis == '') {
		alert("Debe Ingresar su Email");
		return false;
		}
		var re=/^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$/;
   		if(!re.exec(emailis)){
		//if(!(/\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)/.test(valor))) {
		alert("Email Incorrecto");
  		return false;
		}	
		var passwordis = document.getElementById("passwordis").value;
		if (passwordis == '') {
		alert("Debe Ingresar su Clave");
		return false;
		}	
	}
	$(document).ready(function () {
			//Buscador
		$('#q2').blur(function() {
			var buscador = document.getElementById('q2').value;
  			if(buscador==""){
			document.getElementById('q2').value="Buscador";	
			}
		});
		$('#q2').focus(function() {
			var buscador = document.getElementById('q2').value;
  			if(buscador=="" || buscador=="Buscador"){
  			document.getElementById('q2').value="";
			}
		});	
		
		
		/*---------------*/
	$('#nombrenl').blur(function() {
		var buscador = document.getElementById('nombrenl').value;
  		if(buscador==""){
			//alert("buscador"+ buscador);
		document.getElementById('nombrenl').value="Nombre";	
			
		}else{
			//alert("jejeej");
		}
	});
	$('#nombrenl').focus(function() {
		//alert("Hola");
		var buscador = document.getElementById('nombrenl').value;
  		if(buscador=="" || buscador=="Nombre"){
  		document.getElementById('nombrenl').value="";
		}
	});
		$('#emailnl').blur(function() {
		var buscador = document.getElementById('emailnl').value;
  		if(buscador==""){
			//alert("buscador"+ buscador);
		document.getElementById('emailnl').value="Email";	
			
		}else{
			//alert("jejeej");
		}
	});
	$('#emailnl').focus(function() {
		//alert("Hola");
		var buscador = document.getElementById('emailnl').value;
  		if(buscador=="" || buscador=="Email"){
  		document.getElementById('emailnl').value="";
		}
	});		
	//Fin Reready(function ()
});
	function ValidarSearchFooter(){
		var buscLength = document.getElementById('q2').value;
  		if(buscLength.length<=3){
			alert("Debe ingresar como minimo 4 letras");
  			return false;		
		}
	}
		
function enviarNewsLetter(){	
	//alert("jejej");
	var name = document.getElementById("nombrenl").value;
	if (name == '' || name == "Nombre") {
		alert("Debe Ingresar un Nombre");
		return false;
	}
	var email = document.getElementById("emailnl").value;
	if (email == '') {
		alert("Debe Ingresar su Email");
		return false;
	}
	var re=/^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$/;
   	if(!re.exec(email)){
		//if(!(/\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)/.test(valor))) {
		alert("Email Incorrecto");
  		return false;
	}
	$('#aceptarnl').attr('disabled','-1')
	$('div#newsletter').css({opacity: 0.5}).load('user-news-letter.jsp?nombre='+name+'&email='+email + '#newsletter', function(){
	$('#newsletter').css({opacity: 1});
	});
	
	$("div#newsletter").load("user-news-letter.jsp?nombre="+name+"&email="+email);
}
	function iniciosesion(id){
		if ($("div#is").is(":visible")) {
    		$("div#is").hide();
			$("div#titleis").css({'background-color' : '#F2F2F2', 'border-color' : '' , 'color' : '#F2F2F2'});	
		}else{
			$("div#is").show();
			$("div#titleis").css({'background-color' : '#CCCCCC', 'border-color' : '#CCCCCC' , 'color' : '#1a729e'});
		}
	}
	
	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;
	}

function cargarEncuesta(){
	divResultado = document.getElementById('resultadosEncuesta');
	//obtengo la IP
	ip=document.frmencuesta.ip.value;
	//obtengo el codigo de la encuesta
	codenc=document.frmencuesta.cod.value;
	//obtengo el numero de opciones
	nroopc=document.frmencuesta.nroopciones.value;
	//creo un bucle para ver si alguna opcion esta checked
	//si esta checked ese valor lo envio por post
	i=1;
	while(i<=nroopc){
		opcion=document.getElementById('opcion_'+i).checked;
		if (opcion==true){
			radiovalor=document.getElementById('opcion_'+i).value;
			alt=i;
		}
		i++;
	}
	alert(codenc+" "+nroopc+" radio:"+radiovalor+" "+ip);
	ajax=nuevoAjax();
	ajax.open("POST", "actualizar_encuesta.jsp",true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			divResultado.innerHTML = ajax.responseText
		}
	}
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	//envio dos valores el id de la encuesta y la opcion elegida de la encuesta
	ajax.send("idenc="+codenc+"&alternativa="+radiovalor+"&ip="+ip)
	}
	
