/* Funciones generales */
function g(id) {
    if (document.getElementById) var returnVar = document.getElementById(id);
    else if (document.all) var returnVar = document.all[id];
    else if (document.layers) var returnVar = document.layers[id];
    return returnVar; 
}

function abrirPopUp (texto, ancho, alto) {
	g("filtroPopUp").style.visibility="visible"; p=g("popUp"); 
	p.style.width=ancho+"px"; p.style.height=alto+"px"; 
	p.style.marginLeft="-"+(ancho/2)+"px"; p.style.marginTop="-"+(alto/2)+"px"; 
	g("popUpContenidos").innerHTML=texto; p.style.visibility="visible";
}

function cerrarPopUp () {
	g("popUp").style.visibility="hidden";
	g("filtroPopUp").style.visibility="hidden";
}

function validaContacto() {
	if (g("nombre").value=='') {
		alert ("Por favor, indica tu nombre.");
		g("nombre").focus();
		return false;

	} else if ((g("email").value=='') && (g("telefono").value=='')) {
		alert ("Por favor, indica una forma de contacto.");
		g("email").focus();
		return false;

	} else if (g("mensaje").value=='') {
		alert ("Por favor, indica tu consulta.");
		g("mensaje").focus();
		return false;
		
	} else return true;
}