$("input").bind('input propertychange', function() {
var value = $(this).val();
if(value.length > 0) {
var temp = value.split(".");
if(temp.length >= 2) {
var l1 = temp[0].length + 1;
var l2 = 0;
if(temp[1].length > 2) {
l2 = 2;
} else {
l2 = temp[1].length;
}
value = value.substr(0, l1 + l2);
}
}
$(this).val(value);
});