(function(a){var b=a.telerik;b.scripts.push("telerik.timepicker.js");b.timeView=function(c){a.extend(this,c);var d=this.dropDown=new b.dropDown({attr:this.dropDownAttr,effects:this.effects,onClick:function(f){var g=f.item;c.onChange(g.innerText||g.textContent)}});d.$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 j=b.timeView.getTimeMilliseconds;var g=[];var c=this.format;var n=this.interval;var p=new b.datetime(this.minValue);var d=j(p);var f=j(this.maxValue);var l=n*b.datetime.msPerMinute;var k=parseInt(b.datetime.msPerDay/(n*b.datetime.msPerMinute));if(d!=f){var o=di?i+d:i;h=e>h?h+d:h;return e-h==0||i>=e&&i<=h},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(d,e){a.extend(this,e);if(d.nodeName.toLowerCase()!=="input"&&d.type.toLowerCase()!=="text"){throw"Target element is not a INPUT"}this.element=d;var f=this.$element=a(d).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)});if(!f.parent().hasClass("t-picker-wrap")){f.wrap('
');if(e.showButton){var i=new b.stringBuilder(),g=e.buttonTitle;a(i.cat('').cat('').string()).insertAfter(f)}}this.timeView=new b.timeView({effects:this.effects,dropDownAttr:this.dropDownAttr,format:this.format,interval:this.interval,isRtl:f.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){if(j!=this.inputValue){this._update(j)}this._close()},this)});this.inputValue=f.val();var c=this.selectedValue||this.inputValue;if(c){this._value(this.parse(c))}var h=this.enabled?a.proxy(this._togglePopup,this):b.preventDefault;this.$wrapper=f.closest(".t-timepicker").find(".t-icon").bind("click",h).end();a(document.documentElement).bind("mousedown",a.proxy(function(m){var l=this.$element.val();if(l!=this.inputValue){this._update(l)}var j=this.timeView.dropDown.$element;var k=j&&j.parent().length>0;if(!k||a.contains(this.$wrapper[0],m.target)||a.contains(j.parent()[0],m.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(f){var k=this.minValue,c=this.maxValue,f=this.parse(f),d=this.selectedValue;if(f!=null&&!b.timeView.isInRange(f,k,c)){var e=b.timeView.getTimeMilliseconds,i=e(f),j=Math.abs(e(k)-i),l=Math.abs(e(c)-i);f=new Date(j