text: (function(){if(window.JCClock)return;function i(i){if(typeof BX!="undefined")BX.onCustomEvent("onJCClockInit",[i]);this.config=i;this.config.AmPmMode=BX.isAmPmMode();this.config.AmPm="";this.deltaHour=0;this.MESS=this.config.MESS;this.bCreated=false}i.prototype={Create:function(i){this.bCreated=true;this.pInput=document.getElementById(this.config.inputId);this.pIcon=document.getElementById(this.config.iconId);if(i&&(i=document.getElementById(i))){this.bInline=true;this.oDiv=i;this.oDiv.className="bx-clock-div bx-clock-div-inline"+(this.config.AmPmMode?"_am_pm":"");this.oDiv.style.position="relative"}else{var t=150;if(typeof this.config["zIndex"]!="undefined"){t=parseInt(this.config["zIndex"]);if(t<=0)t=150}this.oDiv=BX(this.config.inputId+"_div");if(this.oDiv)BX.cleanNode(this.oDiv,true);this.oDiv=BX.create("DIV",{props:{className:"bx-clock-div",id:this.config.inputId+"_div"},style:{zIndex:t}});document.body.appendChild(this.oDiv)}var e=BX.create("DIV",{props:{className:"bxc-clock-cont bxc-iconkit-c"}});this.arrowsContDiv=BX.create("DIV",{props:{className:"bxc-arrows-cont h0 m0"}});this.MACDiv=this.arrowsContDiv.appendChild(BX.create("DIV",{props:{className:"bxc-mouse-control-cont"}}));this.arrowsContDiv.appendChild(BX.create("IMG",{props:{src:"/bitrix/images/1.gif",className:"bxc-min-arr-cont bxc-iconkit-a"}}));this.arrowsContDiv.appendChild(BX.create("IMG",{props:{src:"/bitrix/images/1.gif",className:"bxc-hour-arr-cont bxc-iconkit-a"}}));e.appendChild(this.arrowsContDiv);this.oDiv.appendChild(e);this.CreateControls();this.InitMouseArrowControl()},CreateControls:function(){this.ControlsCont=BX.create("DIV",{props:{className:"bxc-controls-cont"}});var i,t=[],e=[],n=this;if(this.config.AmPmMode){for(i=0;i<12;i++)t.push(this.Hour2Str(i,true))}else{for(i=0;i<24;i++)t.push(this.Int2Str(i))}for(i=0;i<60;i+=this.config.step)e[i]=this.Int2Str(i);var o=this.CreateSelect(t,1,this.MESS.Hours);this.hourSelect=o.pSelect;var s=this.CreateSelect(e,this.config.step,this.MESS.Minutes);this.minSelect=s.pSelect;this.hourSelect.onchange=function(){if(!this.value||isNaN(this.value))this.value=0;n.SetTime(this.value,n.curMin,true)};this.minSelect.onchange=function(){if(!this.value||isNaN(this.value))this.value=0;n.SetTime(n.curHour,this.value,true)};this.minSelect.onfocus=function(){n.lastArrow="min"};this.hourSelect.onfocus=function(){n.lastArrow="hour"};if(!this.bInline){var r=BX.create("INPUT",{props:{type:"button",value:this.MESS.Insert}});r.onclick=function(){n.Submit()};var h=BX.create("IMG",{props:{src:"/bitrix/images/1.gif",className:"bxc-close bxc-iconkit-c",title:this.MESS.Close}});h.onclick=function(){n.Close()}}var a=BX.create("SPAN",{props:{className:"double-dot"}});a.innerHTML=":";o.pWnd.style.marginLeft="11px";this.ControlsCont.appendChild(o.pWnd);this.ControlsCont.appendChild(a);this.ControlsCont.appendChild(s.pWnd);if(this.config.AmPmMode){this.AmPm=BX.create("SPAN",{props:{className:"bxc-am-pm",title:"a.m."}});this.AmPm.innerHTML="am";this.AmPm.onclick=function(){if(this.title=="a.m."){this.title="p.m.";this.innerHTML="pm";n.config.AmPm=" pm"}else{this.title="a.m.";this.innerHTML="am";n.config.AmPm=" am"}n.SetTime(n.curHour,n.curMin,true)};this.ControlsCont.appendChild(this.AmPm)}if(!this.bInline){this.ControlsCont.appendChild(r);this.ControlsCont.appendChild(h);this.pTitle=this.ControlsCont.appendChild(BX.create("DIV",{props:{className:"bxc-title"}}));this.pTitle.onmousedown=function(i){jsFloatDiv.StartDrag(i,n.oDiv);n.bRecalculateCoordinates=true}}this.oDiv.appendChild(this.ControlsCont)},CalculateCoordinates:function(){var t=BX.pos(this.oDiv);this.top=t.top;this.left=t.left;this.centerX=t.left+(this.bInline?i.getOption("centerXInline",55):i.getOption("centerX",55));this.centerY=t.top+(this.bInline?i.getOption("centerYInline",55):i.getOption("centerY",71));var e=this,n=i.getOption("minuteLength",32),o=i.getOption("hourLength",25),s=this.centerX,r=this.centerY,h,a,c,u,l,f,d,m,p,C,M=i.getOption("inaccuracy",8);this.arHourCoords=[];this.bJumpByMinArrow30=false;for(h=0;h<12;h++){a=h*30*Math.PI/180;c=Math.round(o*Math.sin(a));u=Math.round(o*Math.cos(a));l=s+c;f=r-u;d=Math.round(16*Math.sin(a));m=Math.round(16*Math.cos(a));p=s+d;C=r-m;this.arHourCoords[h]={x:l,y:f,x_min:l-M,x_max:l+M,y_min:f-M,y_max:f+M,x_min1:p-M,x_max1:p+M,y_min1:C-M,y_max1:C+M}}this.arMinCoords={};for(h=0;h<12;h++){a=h*30*Math.PI/180;c=Math.round(n*Math.sin(a));u=Math.round(n*Math.cos(a));l=s+c;f=r-u;d=Math.round(18*Math.sin(a));m=Math.round(18*Math.cos(a));p=s+d;C=r-m;this.arMinCoords[h*5]={x:l,y:f,x_min:l-M,x_max:l+M,y_min:f-M,y_max:f+M,x_min1:p-M,x_max1:p+M,y_min1:C-M,y_max1:C+M}}this.bRecalculateCoordinates=false},Show:function(i){if(!this.bCreated)this.Create(i);this.lastArrow="min";var t=this.pInput.value.toString();if(t.indexOf(":")==-1){if(this.config.initTime.length<=0||this.config.initTime.indexOf(":")==-1)t=(new Date).getHours()+":"+(new Date).getMinutes();else t=this.config.initTime}var e=t.split(":");e[1]=e[1].split(" ");if(e[1][1]!=undefined){e[0]=parseInt(e[0],10);if(e[1][1]=="pm"&&e[0]<12)e[0]=e[0]+12;else if(e[1][1]=="am"&&e[0]==12)e[0]=0;e[1]=e[1][0]}this.SetTime(parseInt(e[0],10)||0,parseInt(e[1],10)||0);if(this.bInline){this.oDiv.style.display="block"}else{var n=this.pIcon||this.pInput;var o=this.AlignToPos(BX.pos(n));this.top=o.top;this.left=o.left;jsFloatDiv.Show(this.oDiv,this.left,this.top);this.oDiv.style.display="block";jsFloatDiv.AdjustShadow(this.oDiv)}var s=this;setTimeout(function(){s.CalculateCoordinates()},20);window["_bxc_onmousedown"+this.config.inputId]=function(i){s.CheckClick(i)};window["_bxc_onkeypress"+this.config.inputId]=function(i){s.OnKeyDown(i)};setTimeout(function(){BX.bind(document,"mousedown",window["_bxc_onmousedown"+s.config.inputId])},10);BX.bind(document,"keypress",window["_bxc_onkeypress"+this.config.inputId])},AlignToPos:function(t){var e=i.getOption("popupHeight",170),n=t.left,o=t.top-e,s=BX.GetWindowScrollPos();if(s.scrollTop>o||o<0)o=t.top+20;return{left:n,top:o}},Close:function(){if(this.bInline)return;BX.unbind(document,"mousedown",window["_bxc_onmousedown"+this.config.inputId]);BX.unbind(document,"keypress",window["_bxc_onkeypress"+this.config.inputId]);jsFloatDiv.Close(this.oDiv);this.oDiv.style.display="none"},Submit:function(){var i=this.config.AmPmMode?this.config.AmPm:"";this.pInput.value=this.Hour2Str(this.curHour,this.config.AmPmMode)+":"+this.Int2Str(this.curMin)+i;BX.fireEvent(this.pInput,"change");if(!this.bInline)this.Close()},SetTime:function(i,t,e,n){i=parseInt(i,10);if(this.config.AmPmMode){if(i>=12){if(i>12)i=i-12;if(this.config.AmPm=="")this.config.AmPm=" pm"}else if(this.config.AmPm==""){this.config.AmPm=" am"}if(i<1||i>12){i=12;this.config.AmPm=" am"}}else if(i<0||i>23)i=0;t=parseInt(t,10);var o=this.config.step;if(Math.round(t/o)!=t/o)t=Math.round(t/o)*o;if(t<0||t>59)t=0;if(!n)this.deltaHour=i>=12?12:0;this.curMin=t;this.curHour=i;if(this.pTitle)this.pTitle.innerHTML=this.Hour2Str(i,this.config.AmPmMode)+":"+this.Int2Str(t);this.SetTimeAn(i,t);if(!e)this.SetTimeDig(i,t);if(this.bInline)this.Submit()},SetTimeAnH:function(i,t){if(i==0){if(this.curHour<12&&this.curHour>6)this.deltaHour=12;if(this.curHour<24&&this.curHour>18)this.deltaHour=0}if(this.curHour==0&&i==11){i=23;this.deltaHour=12}else if(this.curHour==12&&i==11){i=11;this.deltaHour=0}else{i+=this.deltaHour}this.SetTime(i,t,false,true)},SetTimeAnM:function(i,t){t=parseInt(t,10);var e=this.config.step;if(Math.round(t/e)!=t/e)t=Math.round(t/e)*e;if(t<0||t>59)t=0;if(t==30){this.bJumpByMinArrow30=true}else if(this.bJumpByMinArrow30&&t==0){if(this.curMin>30&&this.curMin<59){this.bJumpByMinArrow30=false;this.SetTime(++i,t);return}if(this.curMin>0&&this.curMin<30){this.bJumpByMinArrow30=false;if(i==0)i=24;this.SetTime(--i,t);return}}this.SetTime(i,t)},SetTimeAn:function(i,t){i=parseInt(i,10);if(isNaN(i))i=0;t=parseInt(t,10);if(isNaN(t))t=0;if(i>=12)i-=12;var e="bxc-arrows-cont";if(i*5==t)e+=" hideh hm"+i;else e+=" h"+i+" m"+t;this.arrowsContDiv.className=e},CreateSelect:function(i,t,e){var n=!!this.config.AmPmMode;var o=BX.create("INPUT",{props:{type:"text",className:"bxc-cus-sel",size:"1",title:e}});var s=function(i){o._bxmousedown=false;if(window.bxinterval)clearTimeout(window.bxinterval)};var r=function(t){if(!o._bxmousedown){s();return}var e=parseInt(o.value,10);if(isNaN(e))e=0;e=e+t;if(e>=i.length)e=0;else if(e<0)e=i.length-1;if(typeof i[e]=="undefined"){e-=t;o.value=e-(t>0?1:-1);r(t);return}else{if(o.value=="11"&&i[e]=="00"||o.value=="01"&&i[e]=="00"&&n){o.value="12"}else if(o.value=="12"&&i[e]=="00"){o.value="01"}else o.value=i[e];o.onchange()}if(window.bxinterval)clearTimeout(window.bxinterval);window.bxinterval=setTimeout(function(){r(t)},100)};var h=function(i){if(window.bxinterval)s();o._bxmousedown=true;BX.bind(document,"mouseup",s);r(i);if(window.bxinterval)clearTimeout(window.bxinterval);window.bxinterval=setTimeout(function(){r(i)},800)};o.onkeydown=function(i){if(!i)i=window.event;if(!i)return;if(i.keyCode==38){h(t);s()}else if(i.keyCode==40){h(-t);s()}};var a=BX.create("TABLE",{props:{className:"bxc-cus-sel-tbl"}}),c=a.insertRow(-1),u=c.insertCell(-1);u.rowSpan=2;u.appendChild(o);u=c.insertCell(-1);u.appendChild(BX.create("IMG",{props:{src:"/bitrix/images/1.gif",className:"bxc-slide-up bxc-iconkit-c"}}));u.title=this.MESS.Up;u.className="bxc-pointer";u.onmousedown=function(){h(t)};u=a.insertRow(-1).insertCell(-1);u.appendChild(BX.create("IMG",{props:{src:"/bitrix/images/1.gif",className:"bxc-slide-down bxc-iconkit-c"}}));u.title=this.MESS.Down;u.className="bxc-pointer";u.onmousedown=function(){h(-t)};return{pSelect:o,pWnd:a}},SetTimeDig:function(i,t){this.hourSelect.value=this.Hour2Str(i,this.config.AmPmMode);this.minSelect.value=this.Int2Str(t);if(this.config.AmPmMode){if(this.config.AmPm==" pm"){this.AmPm.title="p.m.";this.AmPm.innerHTML="pm"}else{this.AmPm.title="a.m.";this.AmPm.innerHTML="am"}}if(this.bInline)this.Submit()},InitMouseArrowControl:function(){var i=this;this.MACDiv.onmousedown=function(t){i.MACMouseDown(t)};this.MACDiv.ondrag=BX.False;this.MACDiv.onselectstart=BX.False;this.MACDiv.style.MozUserSelect="none"},MACMouseDown:function(i){if(this.bRecalculateCoordinates)this.CalculateCoordinates();if(!i)i=window.event;var t=this,e,n=BX.GetWindowSize(),o=i.clientX+n.scrollLeft,s=i.clientY+n.scrollTop;this.ddMode=false;e=this.arMinCoords[this.curMin];if(o>e.x_min&&o<e.x_max&&s>e.y_min&&s<e.y_max||o>e.x_min1&&o<e.x_max1&&s>e.y_min1&&s<e.y_max1){this.ddMode="min";this.lastArrow="min"}if(!this.ddMode){e=this.arHourCoords[this.curHour>=12?this.curHour-12:this.curHour];if(o>e.x_min&&o<e.x_max&&s>e.y_min&&s<e.y_max||o>e.x_min1&&o<e.x_max1&&s>e.y_min1&&s<e.y_max1){this.ddMode="hour";this.lastArrow="hour"}}if(this.ddMode===false){var r,h,a=1e3,c=0;if(this.lastArrow=="hour"){for(r=0;r<12;r++){h=this.GetDistance(this.arHourCoords[r].x,this.arHourCoords[r].y,o,s);if(h<=a){a=h;c=r}}this.SetTimeAnH(c,this.curMin)}else if(this.lastArrow=="min"){for(r=0;r<12;r++){h=this.GetDistance(this.arMinCoords[r*5].x,this.arMinCoords[r*5].y,o,s);if(h<=a){a=h;c=r}}this.SetTimeAnM(this.curHour,c*5)}return}this.ControlsCont.style.zIndex="145";this.MACDiv.onmousemove=function(i){t.MACMouseMove(i)};this.MACDiv.onmouseup=function(i){t.MACMouseUp(i)}},MACMouseMove:function(i){if(!this.ddMode){this.StopDD();return}if(!i)i=window.event;var t,e,n=1e3,o=0,s=BX.GetWindowSize(),r=i.clientX+s.scrollLeft,h=i.clientY+s.scrollTop;if(this.ddMode=="hour"){for(t=0;t<12;t++){e=this.GetDistance(this.arHourCoords[t].x,this.arHourCoords[t].y,r,h);if(e<=n){n=e;o=t}}this.SetTimeAnH(o,this.curMin)}else if(this.ddMode=="min"){for(t=0;t<12;t++){e=this.GetDistance(this.arMinCoords[t*5].x,this.arMinCoords[t*5].y,r,h);if(e<=n){n=e;o=t}}this.SetTimeAnM(this.curHour,o*5)}},GetDistance:function(i,t,e,n){return Math.round(Math.sqrt(Math.pow(i-e,2)+Math.pow(t-n,2)))},MACMouseUp:function(i){this.StopDD()},StopDD:function(){this.ddMode=false;this.ControlsCont.style.zIndex="156";this.MACDiv.onmousemove=null;this.MACDiv.onmouseup=null;return false},Int2Str:function(i){i=parseInt(i,10);if(isNaN(i))i=0;return i<10?"0"+i.toString():i.toString()},Hour2Str:function(i,t){i=parseInt(i,10);if(isNaN(i))i=0;return i<10&&!t?"0"+i.toString():i.toString()},CheckClick:function(i){if(this.bRecalculateCoordinates||this.bInline)return;if(!i)i=window.event;if(!i)return;var t;if(i.target)t=i.target;else if(i.srcElement)t=i.srcElement;if(t.nodeType==3)t=t.parentNode;if(t!=this.oDiv&&!BX.findParent(t,{attribute:{id:this.oDiv.id}}))this.Close()},OnKeyDown:function(i){if(!i)i=window.event;if(!i)return;if(i.keyCode==27)this.Close()}};i.options={};i.setOptions=function(t){if(!t||typeof t!="object")return;for(var e in t)i.options[e]=t[e]};i.getOption=function(t,e){if(typeof i.options[t]!="undefined")return i.options[t];else return e};window.JCClock=i})();
  //# sourceMappingURL=clock.map.js