base = "http://www.magodimas.com/web2011/";

function validarComentario()
{
	
	if(document.form_addComentario.autor.value.length==0)
	{
		alert("Como te llamas");
	}
}

function botonOver(imagen)
{
 switch (imagen)
 {
	 
	 case "btnfacebook":
	 document.getElementById('infoFB').style.display = "";
	 document.getElementById('infoTT').style.display = "none";
	 document.getElementById('infoYT').style.display = "none";
	 break
	 
	 case "btntwitter":
	 document.getElementById('infoFB').style.display = "none";
	 document.getElementById('infoTT').style.display = "";
	 document.getElementById('infoYT').style.display = "none";
	 break
	 
	 case "btnyoutube":
	 document.getElementById('infoFB').style.display = "none";
	 document.getElementById('infoTT').style.display = "none";
	 document.getElementById('infoYT').style.display = "";
	 break
	 case "btnbuscar":
	 document.getElementById('infoBuscar').style.display = "";
	 break
 }
}

function botonOut(imagen)
{
 switch (imagen)
 {
	 
	 case "btnfacebook":
	 document.getElementById('infoFB').style.display = "none";
	 break
	 
	 case "btntwitter":
	 document.getElementById('infoTT').style.display = "none";
	 break
	 
	 case "btnyoutube":
	 document.getElementById('infoYT').style.display = "none";
	 break
	 
	 case "btnbuscar":
	 document.getElementById('infoBuscar').style.display = "none";
	 break
 }
}

function permitido(esto)
{
	if(document.getElementById(esto).value.length > 0)
	{
		document.getElementById('btnbuscar').disabled = "";
	}else{
		document.getElementById('btnbuscar').disabled = "disabled";
	}
}

function enviar(esto)
{
	if(document.getElementById(esto).value.length > 0 && /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById(esto).value))
	{
		document.getElementById('activo').style.display = "";
		document.getElementById('desactivo').style.display = "none";
			
		document.getElementById('infomail1').style.display = "none";
		document.getElementById('infomail2').style.display = "none";
		document.getElementById('infomail3').style.display = "";
	
	}else if(document.getElementById(esto).value.length > 0)
	{
		document.getElementById('activo').style.display = "none";
		document.getElementById('desactivo').style.display = "";
		
		document.getElementById('infomail1').style.display = "none";
		document.getElementById('infomail2').style.display = "";
		document.getElementById('infomail3').style.display = "none";
	}else{
		document.getElementById('activo').style.display = "none";
		document.getElementById('desactivo').style.display = "";
		
		document.getElementById('infomail1').style.display = "";
		document.getElementById('infomail2').style.display = "none";
		document.getElementById('infomail3').style.display = "none";
	}
	if (document.formContacto.email.value.length==0)
	{ 
	 alert("Por favor, escriba un email para poder responderle.");
	 document.formContacto.email.focus();
	 return 0; 
	}
	/*if (document.formContacto.email.value == "" || !/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.formContacto.email.value))
	{
		alert("La dirección de correo electronico a de ser correcta");
		document.formContacto.email.focus();
		return 0; 
	}*/
}

function actualizar_captcha(photo)
{
 var img=document.getElementById(photo);
 img.src="";
 img.src="captcha/imagen.php?"+Date();
}

function validar(codigo){ 
	//valido el nombre 
	if (document.formContacto.nombre.value.length==0)
	{ 
	 alert("Por favor, escribe tu nombre para poder dirigime a usted.");
	 document.formContacto.nombre.focus();
	 return 0; 
	}
	
	if (document.formContacto.email.value.length==0)
	{ 
	 alert("Por favor, escriba un email para poder responderle.");
	 document.formContacto.email.focus();
	 return 0; 
	}
	if (document.formContacto.email.value == "" || !/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.formContacto.email.value))
	{
		alert("La dirección de correo electronico a de ser correcta");
		document.formContacto.email.focus();
		return 0; 
	}
	
	if (document.formContacto.mensaje.value.length==0)
	{ 
	 alert("Por favor, no me envies un correo sin contenido.");
	 document.formContacto.mensaje.focus();
	 return 0; 
	}
	
	if (document.formContacto.code2.value.length==0)
	{ 
	 alert("El código de seguridad debe ser correcto.");
	 document.formContacto.code2.focus();
	 return 0; 
	}
	/*
	if (document.formContacto.code2.value != codigo)
	{ 
	 alert("El código de seguridad debe ser correcto1.");
	 document.formContacto.code2.focus();
	 return 0; 
	}*/
		document.formContacto.submit();
} 
function fondoFocus(id)
{
	document.getElementById(id).style.background = "#E6FFE6";
}

function fondoNormal(id)
{
	document.getElementById(id).style.background = "#FFF";
}

function mostrarInformacion(id) {
	
	div = document.getElementById("informacionEventoID" + id);
	
	div.style.display = "";
	document.getElementById("verInformacionID" + id).style.display ="none";
	document.getElementById("cerrarInformacionID" + id).style.display = "";

}

function cerrarInformacion(id) {

	div = document.getElementById("informacionEventoID" + id);
	
	div.style.display="none";
	document.getElementById("verInformacionID" + id).style.display ="";
	document.getElementById("cerrarInformacionID" + id).style.display = "none";

}

function cambiarBordeOver(id)
{
	document.getElementById(id).style.border = "5px #FFF solid";
}

function cambiarBordeOut(id)
{
	document.getElementById(id).style.border = "5px #CCC solid";
}

function cambiarFondoOver(id)
{
	document.getElementById(id).style.backgroundColor = "#CCC";
}

function cambiarFondoOut(id)
{
	document.getElementById(id).style.backgroundColor = "#FFF";
}


