/*
function render_llamada(){
	$('l1').hide; $('l2'); $('l3'); 
        if (http_request.readyState == 4) {		
            if (http_request.status == 200) {
            //alert(http_request.responseText);
		$0('l1'); $1('l2'); $0('l3');
		setTimeout("pedir('formularios/llamada_formulario.html','render_l');",5000);
		  } else {
                alert('Hubo problemas con el envio de la información por favor vuelva a intentarlo.');
				setTimeout("pedir('formularios/llamada_formulario.html','render_l');",2000);
            }
        }
		}
		
function press_llamada(tecla){
if (tecla == 13)  { enviar_llamada(); }
}

function enviar_llamada(){
if(($('#nombrel).value!='')&&($('#emaill).value!='')&&($('#horal).value!='')&&($('#telefonol).value!='')){
pedir('formularios/llamada_envio.php?'+
'email='+$('#emaill).value+
'&nombre='+$('#nombrel).value+
'&telefono='+$('#telefonol).value+
'&hora='+$('#horal).value+
'&ajax=ran','render_llamada')
} else {
alert('por favor escriba su nombre, su email, su telefono y la hora a la que desea que lo llamemos y despues haga clic en ok.');
}
}*/

function validar_registro()
{	
	var paco = $('#nombrel').val();
	if($('#nombrel').val()=="")
	{alert("Debe ingresar su nombre");	$('#nombrel').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='+$('#telefonol').val()+'&hora='+$('#horal').val();

	$.ajax({
		async:true,
		url: 'formularios/llamada_envio.php',
		data:pag,
		type: "POST",
		cache: false,
		beforeSend: function(objeto){
       		$('#l1').hide(); $('#l3').hide(); $('#l2').show();
        },
        success: function(rpta){		
			$('#l1').hide(); $('#l2').show(); $('#l3').hide();
			setTimeout(recargar,3000);
        }
	});

}

}
function recargar(){
	document.location.reload();
}
