(function(a){var b=a.telerik;b.scripts.push("telerik.timepicker.js");b.timeView=function(d){a.extend(this,d);var c=this.dropDown=new b.dropDown({attr:this.dropDownAttr,effects:this.effects,onClick:function(f){var g=f.item;d.onChange(g.innerText||g.textContent)}});c.$element.addClass("t-time-popup").css("direction",this.isRtl?"rtl":"")};b.timeView.prototype={_ensureItems:function(){if(!this.dropDown.$items){this.bind()}},open:function(c){this._ensureItems();this.dropDown.open(c)},close:function(){this.dropDown.close()},bind:function(){var g=b.timeView.getTimeMilliseconds;var d=[];var e=this.format;var j=this.interval;var p=new b.datetime(this.minValue);var m=g(p);var l=g(this.maxValue);var k=j*b.datetime.msPerMinute;var n=parseInt(b.datetime.msPerDay/(j*b.datetime.msPerMinute));if(m!=l){var o=mi?i+h:i;f=g>f?f+h:f;return g-f==0||i>=g&&i<=f},getTimeMilliseconds:function(c){c=c.value?c:new b.datetime(c);return((c.hours()*60)+c.minutes())*b.datetime.msPerMinute+c.seconds()*1000+c.milliseconds()}});b.timepicker=function(f,g){a.extend(this,g);if(f.nodeName.toLowerCase()!=="input"&&f.type.toLowerCase()!=="text"){throw"Target element is not a INPUT"}this.element=f;var c=this.$element=a(f).addClass("t-input").attr("autocomplete","off").bind({keydown:a.proxy(this._keydown,this),focus:a.proxy(function(j){if(this.openOnFocus){this._open()}this.$element.removeClass("t-state-error")},this),blur:a.proxy(function(j){this._bluring=setTimeout(a.proxy(function(){this._update(c.val())},this),100)},this)});if(!c.parent().hasClass("t-picker-wrap")){c.wrap('
');if(g.showButton){var d=new b.stringBuilder(),h=g.buttonTitle;a(d.cat('').cat('').string()).insertAfter(c)}}this.timeView=new b.timeView({effects:this.effects,dropDownAttr:this.dropDownAttr,format:this.format,interval:this.interval,isRtl:c.closest(".t-rtl").length,minValue:this.minValue,maxValue:this.maxValue,onNavigateWithOpenPopup:a.proxy(function(j){this.$element.val(j)},this),onChange:a.proxy(function(j){clearTimeout(this._bluring);if(j!=this.inputValue){this._update(j)}this._close();window.setTimeout(function(){c.focus()},1)},this)});this.inputValue=c.val();var i=this.selectedValue||this.inputValue;if(i){this._value(this.parse(i))}var e=this.enabled?a.proxy(this._togglePopup,this):b.preventDefault;this.$wrapper=c.closest(".t-timepicker").find(".t-icon").bind("click",e).end();a(document.documentElement).bind("mousedown",a.proxy(function(k){var m=this.$element.val();if(m!=this.inputValue){this._update(m)}var j=this.timeView.dropDown.$element;var l=j&&j.parent().length>0;if(!l||a.contains(this.$wrapper[0],k.target)||a.contains(j.parent()[0],k.target)){return}this._close()},this));b.bind(this,{open:this.onOpen,close:this.onClose,valueChange:this.onChange,load:this.onLoad})};b.timepicker.prototype={_close:function(){var c=this.timeView.dropDown;if(!c.$element.is(":animated")&&c.isOpened()){this._trigger("close")}},_open:function(){if(!this.timeView.isOpened()){this._trigger("open")}},_trigger:function(c){if(!b.trigger(this.element,c)){this[c]()}},_togglePopup:function(){if(this.timeView.isOpened()){this._close()}else{this.element.focus();this._open()}},_update:function(l){var i=this.minValue,g=this.maxValue,l=this.parse(l),k=this.selectedValue;if(l!=null&&!b.timeView.isInRange(l,i,g)){var e=b.timeView.getTimeMilliseconds,j=e(l),h=Math.abs(e(i)-j),f=Math.abs(e(g)-j);l=new Date(h