function acerca_voluntariado_show()
{
	document.location.href = '#';
	msgbox_show('dialog_volunteer');
}

function acerca_voluntariado()
{
	if (!document.sending && acerca_valido()) {
		document.sending = true;
        var data = {	
                    nombre: $('#nombre').val().trim(),
                    horarios: $('#horarios').val().trim(),
                    telefono: $('#telefono').val().trim(),
					email: $('#email').val().trim(),
                    domicilio: $('#domicilio').val().trim(),
                    departamento: $('#departamento').val().trim(),
					cumple: $('#cumple').val().trim() ,
                    tarea: $('#tarea').val().trim(),
                    profesional: $('#profesional').val().trim(),
                    trabaja: $('#trabaja').val().trim(),
                    motivo: $('#motivos').val().trim(),
                    localidad: $('#localidad').val().trim(),
					comentario: $('#comentarios').val().trim()
                }
		$.ajax({
			type: "POST",
			url: WEB_PATH + "app/ajax/voluntariado_send.php",
			data:  data,
			success: function(response) {
				document.sending = false;
                if (response ==1) {
                    $('#nombre').val('');
                    $('#horarios').val('');
                    $('#telefono').val('');
					$('#email').val('');
                    $('#domicilio').val('');
                    $('#departamento').val('');
					$('#cumple').val('');
                    $('#tarea').val('');
                    $('#profesional').val('');
                    $('#trabaja').val('');
                    $('#motivos').val('');
                    $('#localidad').val('');
					$('#comentarios').val('');
                    $('#acerca_error').html('Tu solicitud fue enviada');
                }
                else{
                    $('#acerca_error').html('Error de env&iacute;o. Vuelve a intentar en unos minutos');
                }
			},
			error: function(obj, what_happen, other_obj) {
                document.sending = false;
			}
		});
	}
}

function acerca_valido()
{
	var valid = true;
	if ($('#nombre').val().trim() == '')
	{
		valid = false;
		$('#acerca_error').html('Debe ingresar su nombre');
	}
	else if ($('#cumple').val().trim() == '')
	{
		valid = false;
		$('#acerca_error').html('Debe ingresar su fecha de nacimiento');
	}
	else if ($('#domicilio').val().trim() == '')
	{
		valid = false;
		$('#acerca_error').html('Debe ingresar su domicilio');
	}
	else if ($('#localidad').val().trim() == '')
	{
		valid = false;
		$('#acerca_error').html('Debe ingresar una localidad');
	}

	else if ($('#departamento').val().trim() == '')
	{
		valid = false;
		$('#acerca_error').html('Debe ingresar un departamento');
	}
	else if ($('#telefono').val().trim() == '')
	{
		valid = false;
		$('#acerca_error').html('Debe ingresar un tel&eacute;fono o celular');
	}
   	else if (($('#email').val().trim()==''))
	{
		valid = false;
		$('#acerca_error').html('Debe ingresar un email');
	}
	else if (!is_email($('#email').val()))
	{
		valid = false;
		$('#acerca_error').html('El email ingresado no es v&aacute;lido');
	}
	else if ($('#profesional').val().trim() == '')
	{
		valid = false;
		$('#acerca_error').html('Debe ingresar su profesi&oacute;n o estudio');
	}

	else if ($('#horarios').val().trim() == '')
	{
		valid = false;
		$('#acerca_error').html('Debe ingresar D&iacute;as y Horarios Disponibles');
	}

	else if ($('#tarea').val().trim() == '')
	{
		valid = false;
		$('#acerca_error').html('Debe ingresar una tarea');
	}
	else if ($('#trabaja').val().trim() == '')
	{
		valid = false;
		$('#acerca_error').html('Debe ingresar su trabajo actual o último trabajo');
	}
	else if ($('#motivos').val().trim() == '')
	{
		valid = false;
		$('#acerca_error').html('Debe ingresar el por qu&eacute; le interesa trabajar con nosotros');
	}
	return valid;
}

function acerca_prensa_list(pagina)
{
	if (!document.sending) {
		document.sending = true;
        
		$.ajax({
			type: "POST",
			url: WEB_PATH + "app/ajax/prensa_list.php",
			data: { p: pagina },
			success: function(response) {
                
				document.sending = false;
				$('#div_prensa').html(response);
			},
			error: function(obj, what_happen, other_obj) {
                document.sending = false;
			}
		});
	}
}