var fdSliderController=function(){function Q(a){function k(){E();try{var b=i.offsetWidth,p=i.offsetHeight,a=d.offsetWidth,c=d.offsetHeight;F=n?p-c:b-a;B=F/aa;G=F/Math.ceil(ba/H);ca=b;da=p;I()}catch(g){}f("redraw")}function f(b){var p={elem:g,value:v=="select"?g.options[g.selectedIndex].value:g.value};if(b in R)for(var a=0,c;c=R[b][a];a++)c(p)}function ea(){i.className=i.className.replace("focused","")+" focused";M&&!S&&(h(window,"DOMMouseScroll",j),h(document,"mousewheel",j),window.opera||h(window,
"mousewheel",j));f("focus")}function m(){i.className=i.className.replace(/focused|fd-fc-slider-hover|fd-slider-hover/g,"");M&&!S&&(e(document,"mousewheel",j),e(window,"DOMMouseScroll",j),window.opera||e(window,"mousewheel",j));f("blur")}function j(b){if(u){var b=b||window.event,p=0;b.wheelDelta?(p=b.wheelDelta/120,window.opera&&window.opera.version()<9.2&&(p=-p)):b.detail&&(p=-b.detail/3);n&&(p=-p);if(p){var a=n?d.offsetTop:d.offsetLeft,a=p<0?Math.ceil(a+G):Math.floor(a-G);J(Math.min(Math.max(a,0),
F))}return w(b)}}function fa(b){b=b||document.parentWindow.event;return b.keyCode>=33&&b.keyCode<=40||!u||b.keyCode==45||b.keyCode==46?w(b):!0}function c(b){if(!u)return!0;var b=b||document.parentWindow.event,a=b.keyCode!=null?b.keyCode:b.charCode;if(a<33||a>40&&a!=45&&a!=46)return!0;var c=v=="input"?parseFloat(g.value):g.selectedIndex;if(isNaN(c)||c<Math.min(l,r))c=Math.min(l,r);a==37||a==40||a==46||a==34?c-=b.ctrlKey||a==34?H:s:a==39||a==38||a==45||a==33?c+=b.ctrlKey||a==33?H:s:a==35?c=r:a==36&&
(c=l);I(c);f("update");return w(b)}function o(){this.className=this.className.replace(/fd\-slider\-hover/g,"")+" fd-slider-hover"}function ga(){this.className=this.className.replace(/fd\-slider\-hover/g,"")}function C(b){b=b||window.event;e(document,"mousemove",x);e(document,"mouseup",C);u=!0;if(window.opera)try{setTimeout(function(){onfocus()},0)}catch(a){}document.body.className=document.body.className.replace(/slider-drag-vertical|slider-drag-horizontal/g,"");return w(b)}function ha(b){b=b||window.event;
T=n?b.clientY:b.clientX;ia=parseInt(n?d.offsetTop:d.offsetLeft)||0;u=!1;clearTimeout(q);q=null;h(document,"mousemove",x);h(document,"mouseup",C);if(window.devicePixelRatio||document.all&&!window.opera)try{setTimeout(function(){d.focus()},0)}catch(a){}document.body.className+=" slider-drag-"+(n?"vertical":"horizontal")}function t(b){b=b||window.event;e(document,"mouseup",t);U||(clearTimeout(q),q=null,u=!0);return w(b)}function x(b){b=b||window.event;J(K(ia+(n?b.clientY-T:b.clientX-T)))}function D(b){var b=
b||window.event,a;if(b.target)a=b.target;else if(b.srcElement)a=b.srcElement;if(a.nodeType==3)a=a.parentNode;if(a.className.search("fd-slider-handle")!=-1)return!0;try{setTimeout(function(){d.focus()},0)}catch(c){}clearTimeout(q);E();q=null;u=!1;var f=a=0,g=0;if(document.documentElement&&document.documentElement.scrollTop)g=document.documentElement.scrollTop,f=document.documentElement.scrollLeft;else if(document.body)g=document.body.scrollTop,f=document.body.scrollLeft;b.pageX?a=n?b.pageY:b.pageX:
b.clientX&&(a=n?b.clientY+g:b.clientX+f);a-=n?ja+Math.round(d.offsetHeight/2):ka+Math.round(d.offsetWidth/2);a=K(a);U?P(a):na?J(a):(h(document,"mouseup",t),L=a,y())}function K(b){var a=b%B;a&&a>=B/2?b+=B-a:b-=a;return Math.min(Math.max(parseInt(b,10),0),F)}function E(){var b=0,a=0,c=i;try{for(;c.offsetParent;)b+=c.offsetLeft,a+=c.offsetTop,c=c.offsetParent}catch(d){}ka=b;ja=a}function y(){var b=n?d.offsetTop:d.offsetLeft,b=Math.round(L<b?Math.max(L,Math.floor(b-G)):Math.min(L,Math.ceil(b+G)));J(b);
b!=L?q=setTimeout(y,aa>20?50:100):u=!0}function P(b){u=!1;V=parseInt(b,10);W=parseInt(n?d.style.top:d.style.left,10);la=V-W;X=0;q||(q=setTimeout(ma,20))}function J(b){d.style[n?"top":"left"]=b+"px";b=l+Math.round(b/B)*s;z(v=="select"||s==1?Math.round(b):b)}function I(b){b=isNaN(b)?v=="input"?parseFloat(g.value):g.selectedIndex:b;isNaN(b)||b<Math.min(l,r)?b=Math.min(l,r):b>Math.max(l,r)&&(b=Math.max(l,r));z(b);d.style[n?"top":"left"]=Math.round((b-l)/s*B)+"px"}function z(b){b=isNaN(b)?l:b;if(v=="select")try{b=
parseInt(b,10);if(g.selectedIndex==b)return;g.options[b].selected=!0}catch(a){}else{b=(l+Math.round((b-l)/s)*s).toFixed(Y);if(g.value==b)return;g.value=b}A();f("update")}function A(){d.setAttribute("aria-valuenow",v=="select"?g.options[g.selectedIndex].value:g.value);d.setAttribute("aria-valuetext",v=="select"?g.options[g.selectedIndex].text:g.value)}function Q(){I();f("update");return!0}var g=a.inp,v=g.tagName.toLowerCase(),l=+a.range[0],r=+a.range[1],ba=Math.abs(r-l),s=v=="select"?1:+a.inc||1,H=
a.maxInc?a.maxInc:s*2,Y=a.inc.search(".")!=-1?a.inc.substr(a.inc.indexOf(".")+1,a.inc.length-1).length:0,aa=Math.ceil(ba/s),U=!!a.tween,Z=!!a.fullARIA,$=!!a.hideInput,na=U?!1:!!a.clickJump,n=!!a.vertical,R=a.callbacks,oa=a.classNames,S=!!a.noMouseWheel,q=null,u=!0,da=0,ca=0,V=0,W=0,la=0,X=0,ka=0,ja=0,F=0,ia=0,L=0,T=0,G=0,B=0,i,N,d,O;r<l&&(s=-s,H=-H);var ma=function(){X++;var b=la,a=X,c=W,b=Math.ceil(a==20?c+b:b*(-Math.pow(2,-10*a/20)+1)+c);J(a==20?V:b);f("move");a!=20?q=setTimeout(ma,20):(clearTimeout(q),
q=null,u=!0)};(function(){$?g.className+=" fd_hide_slider_input":h(g,"change",Q);i=document.createElement("div");i.className="fd-slider"+(n?"-vertical ":" ")+oa;i.id="fd-slider-"+g.id;N=document.createElement("span");N.className="fd-slider-inner";O=document.createElement("span");O.className="fd-slider-bar";Z?(d=document.createElement("span"),d.setAttribute("tabIndex","0")):(d=document.createElement("button"),d.setAttribute("type","button"));d.className="fd-slider-handle";d.appendChild(document.createTextNode(String.fromCharCode(160)));
i.appendChild(N);i.appendChild(O);i.appendChild(d);g.parentNode.insertBefore(i,g);h(i,"mouseover",o);h(i,"mouseout",ga);h(i,"mousedown",D);window.opera?h(d,"keypress",c):(h(d,"keydown",c),h(d,"keypress",fa));h(d,"focus",ea);h(d,"blur",m);h(d,"mousedown",ha);h(d,"mouseup",C);d.setAttribute("role","slider");d.setAttribute("aria-valuemin",l);d.setAttribute("aria-valuemax",r);var b;if(g.parentNode&&g.parentNode.tagName.toLowerCase()=="label")b=g.parentNode;else for(var a=document.getElementsByTagName("label"),
e=0,j;j=a[e];e++)if(j.htmlFor&&j.htmlFor==g.id||j.getAttribute("for")==g.id){b=j;break}if(b&&!b.id)b.id=g.id+"_label";if(b)d.setAttribute("aria-labelledby",b.id),d.id="fd-slider-handle-"+g.id,b.setAttribute("for",d.id);document.getElementById("fd_slider_describedby")&&d.setAttribute("aria-describedby","fd_slider_describedby");A();f("create");k()})();return{onResize:function(){(i.offsetHeight!=da||i.offsetWidth!=ca)&&k()},destroy:function(){try{e(i,"mouseover",o),e(i,"mouseout",ga),e(i,"mousedown",
D),e(d,"focus",ea),e(d,"blur",m),window.opera?e(d,"keypress",c):(e(d,"keydown",c),e(d,"keypress",fa)),e(d,"mousedown",ha),e(d,"mouseup",C),M&&!S&&(window.addEventListener&&!window.devicePixelRatio?window.removeEventListener("DOMMouseScroll",j,!1):(e(document,"mousewheel",j),e(window,"mousewheel",j)))}catch(b){}N=O=d=i=q=null;f("destroy");R=null},reset:function(){I()},increment:function(b){var a=v=="input"?parseFloat(g.value):g.selectedIndex;if(isNaN(a)||a<Math.min(l,r))a=Math.min(l,r);a+=s*b;I(a)}}}
var m={},Y=0,M=!0,h=function(a,k,f){a.attachEvent?(a["e"+k+f]=f,a[k+f]=function(){a["e"+k+f](window.event)},a.attachEvent("on"+k,a[k+f])):a.addEventListener(k,f,!0)},e=function(a,k,f){if(a.detachEvent)try{a.detachEvent("on"+k,a[k+f]),a[k+f]=null}catch(e){}else a.removeEventListener(k,f,!0)},w=function(a){if(a==null)a=document.parentWindow.event;a.stopPropagation&&(a.stopPropagation(),a.preventDefault());return!1},Z=function(){if(!arguments.length)return[];for(var a=[],k=0;k<arguments.length;k++)for(var f=
0,e;e=arguments[k][f];f++)a[a.length]=e;return a},$=function(a){if(a==null)return{};for(var e,f,h={},m,j,t=0,c;c=a[t];t++){f=c.match(/(fd_slider_cb_(update|create|destroy|redraw|move|focus|blur)_)([^\s|$]+)/i)[1];c=c.replace(RegExp("^"+f),"").replace(/-/g,".");f=f.replace(/^fd_slider_cb_/i,"").replace(/_$/,"");try{if(c.indexOf(".")!=-1){m=c.split(".");j=window;c=0;for(var o;o=j[m[c]];c++)o instanceof Function?function(){var a=o;e=function(c){a.apply(j,[c])}}():j=o}else e=window[c];e instanceof Function&&
(f in h||(h[f]=[]),h[f][h[f].length]=e)}catch(w){}}return h},t=function(a){for(var e=/fd_range_([-]{0,1}[0-9]+(d[0-9]+){0,1}){1}_([-]{0,1}[0-9]+(d[0-9]+){0,1}){1}/i,f=/fd_inc_([-]{0,1}[0-9]+(d[0-9]+){0,1}){1}/,h=/fd_maxinc_([-]{0,1}[0-9]+(d[0-9]+){0,1}){1}/,t=/((fd_slider_cb_(update|create|destroy|redraw|move|focus|blur)_)([^\s|$]+))/ig,j=/(fd_slider_cn_([a-zA-Z0-9_\-]+))/ig,w=a&&a.tagName&&a.tagName.search(/input|select/i)!=-1?[a]:Z(document.getElementsByTagName("input"),document.getElementsByTagName("select")),
c,o,y=0;c=w[y];y++)if((c.tagName.toLowerCase()=="input"&&c.type=="text"&&(c.className.search(e)!=-1||c.className.search(/fd_slider/)!=-1)||c.tagName.toLowerCase()=="select"&&c.className.search(/fd_slider/)!=-1)&&(a||!c.id||!document.getElementById("fd-slider-"+c.id))){c.id||Y++;o=c;var C=c.className.search(f)!=-1?c.className.match(f)[0].replace("fd_inc_","").replace("d","."):"1",z=c.className.search(h)!=-1?c.className.match(h)[0].replace("fd_maxinc_","").replace("d","."):!1,A=$(c.className.match(t)),
x;x=c.className.match(j);if(x==null)x="";else{for(var D=[],K=0,E=void 0;E=x[K];K++)D[D.length]=E.replace(/^fd_slider_cn_/,"");x=D.join(" ")}o={inp:o,inc:C,maxInc:z,range:[0,100],callbacks:A,classNames:x,tween:c.className.search(/fd_tween/i)!=-1,vertical:c.className.search(/fd_vertical/i)!=-1,hideInput:c.className.search(/fd_hide_input/i)!=-1,clickJump:c.className.search(/fd_jump/i)!=-1,fullARIA:c.className.search(/fd_full_aria/i)!=-1,noMouseWheel:c.className.search(/fd_disable_mousewheel/i)!=-1};
if(c.tagName.toLowerCase()=="select")o.range=[0,c.options.length-1];else if(c.className.search(e)!=-1)c=c.className.match(e)[0].replace("fd_range_","").replace(/d/g,".").split("_"),o.range=[c[0],c[1]];c=o;c.inp&&c.inp.id&&(P(c.inp.id),m[c.inp.id]=new Q(c))}return!0},P=function(a){return a in m?(m[a].destroy(),delete m[a],!0):!1},z=function(){for(slider in m)m[slider].destroy()},A=function(){z();m=null;e(window,"unload",A);e(window,"resize",y);e(window,"load",t)},y=function(){for(slider in m)m[slider].onResize()};
h(window,"load",t);h(window,"unload",A);h(window,"resize",y);return{create:function(a){t(a)},destroyAll:function(){z()},destroySlider:function(a){return P(a)},redrawAll:function(){y()},increment:function(a,e){if(!(a in m))return!1;m[a].increment(e)},addEvent:h,removeEvent:e,stopEvent:w,disableMouseWheel:function(){M=!1},removeOnLoadEvent:function(){e(window,"load",t)}}}();

