text: /**
   * TimepickerInputMask
   * 
   * @category   jquery
   * @package    plugin
   * @copyright  Víctor Bueno García 2012 neobytec@gmail.com http://www.neobytec.com
   * @license    MIT License (LICENSE.txt)
   * @version    1.0
   * 
   */
  (function(a){a.fn.TimepickerInputMask=function(b){var c=null,d=null,e=null;var b=a.extend({seconds:true,spinners:false,separator:":",currentHour:null,bgcolor:"#fff",arrowColor:"#000"},b);var f=0,g=0,h=0;var i=2,j=0,k=b.seconds?2:1,l=false,m=b.separator;var n={init:function(){e=c;if(b.spinners){n.initSpinners();e=d}e.bind("focus",n.events.focus);e.bind("blur",n.events.blur);e.bind("click",n.events.focus);e.bind("keydown",n.events.keyDown);e.bind("keyup",n.events.keyUp);a(document).bind("mousewheel",n.events.mousewheel);e.bind("drag drop",function(){return false});if(n.checkHour(c.val())){n.parseValue(c.val())}else{if(b.currentHour!="now"&&n.checkHour(b.currentHour)){n.parseValue(b.currentHour)}else{var i=new Date;f=i.getHours();g=i.getMinutes();h=i.getSeconds()}}n.showValue()},events:{focus:function(a){l=true;j=0;a.preventDefault();if(!n.checkHour(c.val())){n.showValue()}n.setPosition(j)},blur:function(a){l=false},keyDown:function(a){if(a.keyCode>=48&&a.keyCode<=57||a.keyCode>=96&&a.keyCode<=105){i--}else if(a.keyCode==9){if(j!=k){a.preventDefault();n.setPosition(++j)}else{return true}}else{return false}},keyUp:function(a){if(i<=0){i=2;if(n.checkHour(c.val())){n.parseValue(c.val());if(j<k){j++}}else{n.showValue()}n.setPosition(j)}},mousewheel:function(a,b){if(l){a.preventDefault();var c=b==1?"up":"down";n.changeValue(c)}},clickSpinner:function(b){var c=a(b.currentTarget);var d=c.parent().attr("class");j=d=="hours"?0:d=="minutes"?1:2;n.changeValue(c.attr("class"))}},checkHour:function(a){if(a!=null&&a!=undefined){var c="^([0-1]{1}[0-9]{1}|2[0-3]{1})\\"+b.separator+"[0-5]{1}[0-9]{1}"+"(\\"+b.separator+"[0-5]{1}[0-9]{1})?$";var d=new RegExp(c);return a.match(d)}return false},parseValue:function(a){if(a.indexOf(b.separator)!=-1){var c=a.split(b.separator);f=parseInt(c[0],10);g=parseInt(c[1],10);h=c[2]!=undefined?parseInt(c[2],10):h}},showValue:function(a,e){var i=[f<10?"0"+f:f,g<10?"0"+g:g];if(b.seconds){i[2]=h<10?"0"+h:h}if(b.spinners){d.val(i.join(m))}if(a){return e?i.join(m):i.join(b.separator)}c.val(i.join(b.separator))},selectText:function(a,b){if(e.get(0).createTextRange){var c=e.get(0).createTextRange();c.collapse(true);c.moveStart("character",a);c.moveEnd("character",b);c.select()}else if(e.get(0).setSelectionRange){e.get(0).setSelectionRange(a,b)}else if(e.get(0).selectionStart){e.get(0).selectionStart=a;e.get(0).selectionEnd=b}},setPosition:function(a){var c=b.spinners?m.length:b.separator.length,d=2+c,e=d+(2+c);switch(a){case 0:default:j=0;n.selectText(0,2);break;case 1:j=a;n.selectText(d,d+2);break;case 2:j=a;n.selectText(e,e+2);break}},initSpinners:function(){m=b.separator+b.separator+b.separator+b.separator;d=c.clone().attr("name","spinnerElement");var e=c.position(),f=c.height(),g=c.width();var h=n.showValue(true,true),i=h.split(m),j=n.getTextWidth(i[0]),k=j+n.getTextWidth(m+i[1]),l=k+n.getTextWidth(m+i[2]),o=n.getTextWidth(m),p=parseInt(c.css("border-top-width").replace("px",""),10),q=parseInt(c.css("border-left-width").replace("px",""),10);var r=2*f/21,s=12*f/21,t=6*f/21,u=2*f/21;var v='<div class="TimepickerInputMask.spinners" style="position: absolute; background: transparent;"></div>',w='<div class="spinners.container" style="position: absolute; background: transparent;"></div>',x='<div style="position: absolute;background: '+b.bgcolor+";height: 100%;width: "+o+'px;top: 0;"></span>',y='<a href="javascript:;" class="up" style="position: absolute;width: 0;height: 0;border-left: '+t+"px solid transparent;border-right: "+t+"px solid transparent;border-bottom: "+t+"px solid "+b.arrowColor+';" tabindex="9999"></a>',z='<a href="javascript:;" class="down" style="position: absolute;width: 0;height: 0;border-left: '+t+"px solid transparent;border-right: "+t+"px solid transparent;border-top: "+t+"px solid "+b.arrowColor+';" tabindex="9999"></a>';var A=a(v).insertAfter(c).css({top:e.top,left:e.left,height:f});c.attr("tabindex","9999");A.append(d);var B=a(w).appendTo(A).css({top:p,left:q,height:f});var C=a(x).appendTo(B).css({left:j}).addClass("hours");a(y).appendTo(C).css({top:r,left:u}).bind("click",n.events.clickSpinner);a(z).appendTo(C).css({top:s,left:u}).bind("click",n.events.clickSpinner);var D=a(x).appendTo(B).css({left:k}).addClass("minutes");a(y).appendTo(D).css({top:r,left:u}).bind("click",n.events.clickSpinner);a(z).appendTo(D).css({top:s,left:u}).bind("click",n.events.clickSpinner);if(b.seconds){var E=a(x).appendTo(B).css({left:l}).addClass("seconds");a(y).appendTo(E).css({top:r,left:u}).bind("click",n.events.clickSpinner);a(z).appendTo(E).css({top:s,left:u}).bind("click",n.events.clickSpinner)}},changeValue:function(a){switch(j){case 0:f=a=="up"?++f:--f;f=f>=24?0:f<0?23:f;break;case 1:g=a=="up"?++g:--g;g=g>=60?0:g<0?59:g;break;case 2:h=a=="up"?++h:--h;h=h>=60?0:h<0?59:h;break}n.showValue();n.setPosition(j)},getTextWidth:function(b){var d=a("<span>"+b+"</span>").appendTo(c.parent()).css({fontSize:c.css("font-size"),fontWeight:c.css("font-weight"),fontFamily:c.css("font-family")});var e=d.width();d.remove();return e}};return this.each(function(){c=a(this);n.init()})}})(jQuery)