﻿$(document).ready(function() {
    $("input[id$=UserName]").bind("keyup", function() {
        var reg = /[`~@#%&():;<>,.\/?\\^+=\"\']/;
        if (this.value.match(reg)) {
            this.value = this.value.toLowerCase().replaceAll(reg, "");
        }
    });
    $("input[id$=UserName]").bind("blur", function() {
        var reg = /[`~@#%&():;<>,.\/?\\^+=\"\']/;
        if (this.value.match(reg)) {
            this.value = this.value.toLowerCase().replaceAll(reg, "");
        }
    });
});

String.prototype.replaceAll = function(search, replace) {
    return this.split(search).join(replace);
}
