function valida_form_vataciones(lang, id_mail){

	if(lang=="es"){
		msn = "El campo email es obligatorio y debe ser un email correcto";
		msn_acepto ="Acepta las condiciones de uso";
	}
	if(lang=="ca"){
		msn = "El camp e-mail s obligatori i deu ser un e-mail correcte";
		msn_acepto ="Ha d'acceptar les condicions d'us";
	}
	if(lang=="en"){
		msn = "The e-mail field is compulsory and you must indicate a valid e-mail";
		msn_acepto ="Accept Use Conditions";
	}
	acepto_var = document.getElementById('acepto_'+id_mail).checked;
	
	if((document.getElementById('email_'+id_mail).value!="") && valEmail(document.getElementById('email_'+id_mail).value)){
		if(acepto_var){
		document.getElementById('form_'+id_mail).submit();
		}else{
			document.getElementById('msg_vota_'+id_mail).innerHTML = msn_acepto;
			$('#msg_vota_'+id_mail).fadeIn('slow');
		}
	}else{
		document.getElementById('msg_vota_'+id_mail).innerHTML = msn;
		$('#msg_vota_'+id_mail).fadeIn('slow');
	}


}

function valEmail(valor){
    re=/^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$/
    if(!re.exec(valor))    {
        return false;
    }else{
        return true;
    }
}

// Muestra formulario votaciones
function MuestraFormVotos(lang, id_mail){


	fecha_inicio 	= 	"2010321";
	fecha_fin		=	"2010517";
	fa			 	= 	new Date();
	fecha_actual	=	fa.getFullYear()+""+fa.getMonth()+""+fa.getDate();

	if(lang=="es"){
		msn = "Votaciones cerradas. Los 5 relojes ms votados sern presentados nuevamente al jurado quien determinar el proyecto ganador. ";
		//"Debido a una saturacin del servidor (provocada por la participacin masiva que ha habido en el concurso online), se ha desactivado temporalmente el sistema de votaciones. Por favor, disculpad las molestias, trabajamos para solucionar cuanto antes la incidencia.";
		//"El sistema de votaciones estar activo desde el 21 hasta el 23 de Mayo (ambos incluidos)";
	}
	if(lang=="ca"){
		msn ="Votacions tancades"; 
		//"Degut a una saturaci del servidor (provocada per la participaci massiva que ha hagut al concurs online), s'ha desactivat temporalment el sistema de votacions. Si us plau, disculpeu les molsties, treballem per tal de solucionar la incidncia"
		//msn = "El sistema de votacions ser actiu des del 21 fins al 23 de maig (ambds inclosos)";
	}
	if(lang=="en"){
		msn = "Closed votes";
		//"Due to a saturation of the server (due to the massive participation in the contest online), the voting system has been temporarily turned off. The votes registered until this moment will be saved. Sorry for the inconvenience; we are working to solve this situation.";
		//msn = "The voting system will be operative from 21th to 23rd May (both included)";
	}		
	
	
	if(fecha_actual>fecha_inicio && fecha_actual<fecha_fin){
		valida_form_vataciones(lang, id_mail);
	}else{
		alert(msn);
	}
}
$(document).ready(function () {


});

