$(document).ready(function(){
   $('.join').bind("blur", function(e){
      var form_id = this.id;
      var join_type = "c"; // Credit card by default

      if ( form_id == "join-telefono" ) {
         join_type = "d"; // Set dialer code
      }

      $.get("/track_join.php", { jt : join_type } );
   });
});

function arrowScroll(e) {
   if ( e.keyCode == 40 || e.keyCode == 38 || e.keyCode == 33 || e.keyCode == 34 ) return false;
}

function showLB( divID ) {
   $("#"+divID).show();
   $("#"+divID).blur();
   $("#overlay").show();
   hideScroll();
   $(window).bind("keydown", arrowScroll);
   $(window).bind("keypress", arrowScroll);
}

function hideLB( divID ) {
   $("#overlay").hide();
   $("#"+divID).hide();
   showScroll();
   $(window).unbind("keydown");
   $(window).unbind("keypress");
}

function showScroll() {
   $("body","html").css({height: "auto", width: "auto"});
   
   var userAgent = navigator.userAgent.toLowerCase();
   if (userAgent.indexOf('safari') != -1) {
      $("html").css("overflow","scroll");
   } else {
      $("html").css("overflow","");
   }
}

function hideScroll() {
   $("body","html").css({height: "100%", width: "100%"});
   $("html").css("overflow","hidden");
}