/**
 * Created by Bart Martinez on 9/26/2016.
 */

$(document).ready(function() {

    /*
     * Turn off IE's built in cap lock detection for password fields
     */
    document.msCapsLockWarningOff = true;


    /*
     * Bind to capslockstate events and update display based on state.
     * We only need to set the message when caps lock is on. All other states are empty.
     */
    $(window).bind("capsOn", function(event) {
        $("#statetext").addClass("statetext-info");
        $("#statetext").html("Caps Lock is On");
    });
    $(window).bind("capsOff", function(event) {
        $("#statetext").removeClass("statetext-info");
        $("#statetext").html("");
    });
    $(window).bind("capsUnknown", function(event) {
        $("#statetext").removeClass("statetext-info");
        $("#statetext").html("");
    });

    /*
     * Initialize the capslockstate plugin.
     * Monitoring is happening at the window level.
     */
    $(window).capslockstate();

    // Call the "state" method to retreive the state at page load
    $("#statetext").html("");

});
