
/*
function render_llamada(){
	$('#e1').hide(); $('#e3').hide(); $('#e2').show();
	if (http_request.readyState == 4) {		
        if (http_request.status == 200) {
			//alert(http_request.responseText);
			$('#e1').hide(); $('e2').hide(); $('e3').show();
		setTimeout('document.location.reload()',3);
		} else {
            alert('Hubo problemas con el envio de la informaci\xf3n por favor vuelva a intentarlo.');
		setTimeout('document.location.reload()',1);
        }
    }
}
*/

function redireccion() {
    document.location.reload();
}		

/*
function press_llamada(tecla){
if (tecla == 13)  { enviar_llamada(); }
}
*/

function validar_registro()
{	
	if($('#nombrel').val()=="")
	{alert("Debe ingresar su nombre");	$('#nombrel').focus(); return false;}
	else if($('#apellidol').val()=="")
	{alert("Debe ingresar su apellido");	$('#apellidol').focus(); return false;}
	else if($('#emaill').val()=="")
	{alert("Debe ingresar su email");	$('#emaill').focus(); return false;}
	else
	{return true;}
}


function enviar_llamada(){
if(validar_registro()){

var pag = 'email='+$('#emaill').val()+
'&nombre='+$('#nombrel').val()+
'&telefono='+$('#telefl').val()+'&apellido='+$('#apellidol').val();

	$.ajax({
		async:true,
		url: 'formularios/llamada_envio.php',
		data:pag,
		type: "POST",
		cache: false,
        dataType: "html",
		beforeSend: function(objeto){
       		$('#e1').hide(); $('#e3').hide(); $('#e2').show();
        },
        success: function(rpta){		
			$('#e1').hide(); $('#e2').hide(); $('#e3').show();
			setTimeout(document.location.reload(),3000);
        }
	});




}

}
