function isEmailAddress(theElement)
{
var s = theElement.value;
var filter=/^[A-Za-z_\-.][A-Za-z0-9_\-.]*@[A-Za-z0-9_]+\.[A-Za-z0-9_.]+[A-za-z]$/;
if (s.length == 0 ) theElement.focus();
if (filter.test(s))
return true;
else
theElement.className="success";

return false;
}

function validarFormFacebook(captcha_texto_session){
	var texto_ingresado = document.getElementById("texto_ingresado").value;
	var captcha_texto = captcha_texto_session;
	var error="";
	if (document.getElementById("nombre_contacto").value==""){
		document.getElementById("nombre_contacto").className="succes";
		error+="El nombre no puede estar vacio.\n";
	}
	
	if (document.getElementById("email_contacto").value==""){
		document.getElementById("email_contacto").className="succes";
		error+="El email no puede estar vacio.\n";
		}else if(!isEmailAddress(document.getElementById("email_contacto"))){
			document.getElementById("email_contacto").className="succes";
			error+="Ingrese una dirección de correo válida.\n";
	}

	if (!document.getElementById("terminosycondiciones").checked){
		document.getElementById("terminosycondiciones").className="succes";
		error+="Debe leer y aceptar nuestros términos y condiciones del concurso.\n";
	}

	if (texto_ingresado != captcha_texto) {
		document.getElementById("texto_ingresado").className="succes";
		error+= "El texto del captcha ingresado no coincide. Por favor intentelo de nuevo!";
	} 
	
		
	if (error=="")
		document.getElementById("formfacebook").submit();

	else
		alert(error);
}

function ventanaterminos(URL){
   window.open(URL,"TérminosyCondiciones","width=600,height=400,scrollbars=YES")
} 

function setMetaEtiquetas(){
var meta;
var meta1;
if (document.createElement &&
(meta = document.createElement('meta'))) {
// set properties
meta.property = "og:title";
meta.content = "Concurso Vídeo Ecológico y Vida Sostenible";

// now add the meta element to the head
document.getElementsByTagName('head').item(0).appendChild(meta);
}

if (document.createElement &&
(meta = document.createElement('meta1'))) {
// set properties
meta.property = "og:description";
meta.content = "¡Participa en el concurso Vídeo Ecológico y Vida Sostenible de Actigreen y gana un estupendo pack ecológico!";

// now add the meta element to the head
document.getElementsByTagName('head').item(0).appendChild(meta1);

}

}
function limpiarClass(nameElement){
	document.getElementById(nameElement).className="";
}



