var OTPClosed = false;

$(document).keydown(function(e) {
    // ESCAPE key pressed
    if (e.keyCode == 27) {
        CloseOTP();
    }
});

$(document).ready(function() {
    if ($.browser.msie) {
        $(".OTP").show();
    }
    else {
        $(".OTP").show("drop", { direction: "up" });
    }
    $(".Close").click(function() {
        CloseOTP();
    });
})

function CloseOTP() {
    if (OTPClosed == false) {
        if ($.browser.msie) {
            $(".OTP").hide();
            $(".OTPBackground").fadeOut();
        }
        else {
            $(".OTP").hide("drop", { direction: "up" }, function() {
                $(".OTPBackground").fadeOut();
            });
        }
        OTPClosed = true;
        $("body").css("overflow", "auto");
    }
}