function nextm(show,hide) 
{
	var tid = document.getElementById(show);
	tid.style.display = '';
	var tid = document.getElementById(hide);
	tid.style.display = 'none';
}

function habilitarBoton(idCheck, idBoton)
{
	var checkItem = document.getElementById(idCheck);
	var buttonItem = document.getElementById(idBoton);
	buttonItem.disabled = (!checkItem.checked);
}
var camposNecesarios = new Array();

function verificarFormulario(idForm, idCheck)
{
	var check = document.getElementById(idCheck);
	var formulario = document.getElementById(idForm);
	var i = 0;
	var completo = true;

	for (; i < formulario.elements.length; i++)
	{
		for (var j = 0; j < camposNecesarios.length; j++)
		{
			if (formulario.elements[i].name == camposNecesarios[j])
			{
				if (formulario.elements[i].value.length == 0)
				{
					completo = false;
					break;
				}
			}
		}
		if (!completo) break;
	}

	if (!completo)
	{
		alert("Debe completar todos los campos requeridos");
	}
	else
	{	
		if (!check.checked)
		{
			alert("Debes aceptar los términos de privacidad de Acuerdociudadano.org");
		}
		else
		{
			formulario.submit();
		}
	}
}

function sendNewsLetterForm(idCampo, idForm, accion)
{
	var email = document.getElementById(idCampo);
	var formulario = document.getElementById(idForm);
    var re = /^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$/;
    if (!re.exec(email.value))    
	{
		alert("Debe insertar una dirección válida");
        return false;
    }
	else
	{
		var campoAccion = document.getElementById('idAccion');
		campoAccion.value = accion;
		formulario.submit();
		return true;
    }
}