function popitup(url) {
	newwindow=window.open(url,'name','height=430,width=400');
	if (window.focus) {newwindow.focus()}
	return false;
}

var Calls = {};

$(document).ready(function(){

	$("#call-result").hide();
	$("#email-form").hide();

    $('.form-register-row').mouseover( function(){
        $(this).css('background-color', '#E6F1F9');
    });
    $('.form-register-row').mouseout( function(){
        $(this).css('background-color', '#FFF');
    });

	$('input#phone').keyup(function(e) {
		//alert(e.keyCode);
		if(e.keyCode == 13) {
			Calls.makeCall();
		}
	});	
	
	Calls.makeCall = function(){
		//$("#prospects-content").fadeOut('slow');
		
		//alert($('#the_url').val());
		
		if( $('input#phone').val() != ""){
			var dataString = "phone=" + $('input#phone').val();	
			$.ajax({
				type: "POST",
				url: $('#the_url').val() + "callback.php",
				data: dataString,
				cache: false,
				error: function(request, settings){
					$('#call-result').html("Error");
				},
				success: function(msg){
					window.setTimeout(Calls.showEmailForm, 5000);
					$('#call-result').html("Thank you. You will receive a call shortly. <img border='0' src='images/ajax-loader.gif' />");
					$("#call-result").fadeIn('slow');
				}
			});		
		}else{
			alert("You must enter a phone number");
		}
	}
	
	Calls.showEmailForm = function(){
		$('#call-result').html("Please fill the form with your information");
		$("#email-form").fadeIn('slow');
	}	
	
});
