function SuscribirNewsletter(frm)
{
	if(!EmailValido(frm.email.value))
	{
		alert("La direccion de email ingresada es invalida!");
		frm.email.focus();					
	}
	else
	{
		doSuscripcion(frm);
	}
}

function EmailValido(emailAddr) 
{
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(emailAddr))
		return (true);
	else
		return (false);
}

function doSuscripcion(frm)
{
	var aj = new Ajax();
	postData = formData2QueryString(frm);
	aj.doPost('/design/wp-content/themes/design/pag_news_ajax.php', postData, self.handleNewsResp);
}

function handleNewsResp(str)
{
	if(str == '1')
	{
		document.getElementById("news_ingreso").style.display = 'none';
		document.getElementById("news_resultado").style.display = 'block';
	}
	else
	{
		alert("Se produjo un error al suscribirlo a nuestro newsletter quincenal");
	}
}

function ExpandCollapse(id)
{
	var icon = document.getElementById("icon-" + id);
	var guia = document.getElementById("guia-" + id);
	
	if(icon && guia)
	{
		if(guia.style.display == "block")
		{
			guia.style.display = "none";
			icon.src = "/design/wp-content/themes/design/images/down.png";
			icon.title = "Ver mas informacion";
		}
		else
		{
			guia.style.display = "block";
			icon.src = "/design/wp-content/themes/design/images/up.png";
			icon.title = "Ocultar informacion";
		}	
	}
}

function Pagina(NumPagina)
{
	var frm = document.getElementById("filtros");
	if(frm)
	{
		frm.page.value = NumPagina;
		frm.submit();
	}
}

