/*! TimeInput - v0.1.3 - 2013-04-03 * https://github.com/manuelvanrijn/jquery-timeInput * Copyright (c) 2013 Manuel van Rijn; Licensed MIT */ (function(e){var t=function(t,n){this.elem=t,this.$elem=e(t),this.options=n};t.prototype={init:function(){var t=this;return t.options=e.extend({},e.fn.timeInput.defaults,t.options),t.$elem.on("keydown",function(e){var n=t.$elem.val();switch(t.isNumericOrSeperatingValue(e)===!1&&e.preventDefault(),e.which){case 188:case 190:case 110:case 186:2!==n.split(":").length&&(n=n+=":",t.$elem.val(n))}}).on("blur",function(){var e=t.$elem.val().replace(/[^0-9.,:]/g,"");e=t.parseInput(e),t.$elem.val(e),t.options.onChange.call(this,e)}),t},isNumericOrSeperatingValue:function(e){if(e.ctrlKey)return!0;switch(e.which){case 48:case 96:case 49:case 97:case 50:case 98:case 51:case 99:case 52:case 100:case 53:case 101:case 54:case 102:case 55:case 103:case 56:case 104:case 57:case 105:case 0:case 8:case 9:case 35:case 36:case 37:case 39:case 144:case 91:case 17:return!0;default:return!1}},padNumber:function(e,t,n){for(;t>(""+e).length;)e+=n;return e},parseInput:function(e){var t,n,s;return 1===e.split(":").length?(s=parseInt(e,10),10>s?e=this.timeToString(s,0):s>=10&&60>s?e=this.timeToString(0,s):s>=100&&2360>s?(t=parseInt(s/100,10),n=s-100*t,e=this.timeToString(t,n)):e=this.timeToString(0,s)):(t=e.split(":")[0],n=e.split(":")[1],""===t&&(t=0),""===n&&(n=0),e=this.timeToString(t,n)),e},timeToString:function(e,t){var n=0;if(isNaN(parseInt(t,10))===!0&&(t=0),null!==this.options.roundMinutesUpStep){var s=Math.ceil(t/this.options.roundMinutesUpStep);t=s*this.options.roundMinutesUpStep}return parseInt(t,10)>=60&&(n=parseInt(t/60,10),t-=60*n),e=parseInt(e,10)+n,e+":"+this.padNumber(t,2,"0")}},e.fn.timeInput=function(n){return this.each(function(){e.data(this,"timeInput")||e.data(this,"timeInput",new t(this,n).init())})},e.fn.timeInput.defaults={roundMinutesUpStep:null,onChange:function(){}}})(jQuery,window,document);