/*______________
|       ______  |   U I Z E     J A V A S C R I P T     A P I
|     /      /  |   -----------------------------------------
|    /    O /   |    MODULE : Uize.Widget.Bar.Slider Class (version 1.2.2)
|   /    / /    |    AUTHOR : Chris van Rensburg (http://www.tomkidding.com)
|  /    / /  /| |    ONLINE : http://www.tomkidding.com/uize/uize-js-api
| /____/ /__/_| | COPYRIGHT : (c)2005-2006 Chris van Rensburg
|           |__ |   LICENSE : Distributed under the terms of the GNU General Public License
|_______________|             http://www.gnu.org/licenses/gpl.txt
*/
(function(){var d_a=true,d_b=false,d_c=document,d_d=Uize.Element,d_e=Uize.Widget;var d_f=d_e.Bar,d_g=d_f.Slider=d_f.subclass(),d_h=d_g.prototype;d_h.d_i=function(){this.d_j=null;this.fireEvent('Value Change After Rest');};d_h.d_k=function(d_l){var d_m=this,d_n=d_m.get('value');d_m.set({value:d_l});if(d_m.get('value')!=d_n){if(d_m.wired()&&d_m.widgets.map.drag.get('inDrag')){if(d_m.d_j)clearTimeout(d_m.d_j);d_m.d_j=setTimeout(
function(){d_m.d_i()},d_m.d_o);}else{d_m.d_i();}}};d_h.wireUi=function(){var d_m=this;if(!d_m.wired()){var d_p=d_m.getNode('track'),d_q=d_m.getNode('knob'),d_r,d_s,d_t,d_u,d_v;function d_w(){d_r=d_m.get('orientation')=='vertical'?1:0;d_s=d_d.getDimensions(d_p);d_t=[d_s.width,d_s.height];d_u=d_d.getDimensions(d_q);d_v=[d_u.width,d_u.height];}function d_x(d_y){return d_y*(1-d_r*2)*(d_m.get('maxValue')-d_m.get('minValue'))/(d_t[d_r]-d_v[d_r]);}var d_z=new d_e.Drag({element:d_q}),d_A;d_z.addEventHandlers({'Drag Start':function(){d_m.set({d_B:d_a});d_w();d_A=d_m.get('value');},'Drag Update':function(){d_m.d_k(d_A+d_x([d_z.eventDeltaPos[0],d_z.eventDeltaPos[1]][d_r]));},'Drag Done':function(){d_m.set({d_B:d_b});clearTimeout(d_m.d_j);d_m.d_j=null;d_m.d_i();}});d_m.widgets.add('drag',d_z);d_m.wireNodeEvent([d_p,'full','empty'],'onmousedown',function(d_C){if(!d_C)d_C=event;d_w();var d_D=d_d.getCoords(d_p);function d_E(d_F){var d_G='scroll'+d_F;
return Math.max(d_c.body[d_G],d_c.documentElement?d_c.documentElement[d_G]:0);}d_m.d_k(d_m.get('minValue')+d_x((d_r?d_C.clientY+d_E('Top'):d_C.clientX+d_E('Left'))-d_v[d_r]/2*(1-d_r*2)-[d_D.x,d_D.bottom][d_r]));return d_z.mousedown(d_C);});d_f.prototype.wireUi.call(d_m);}};d_g.presets={};d_g.registerProperties({d_B:'inDrag',d_o:'restTime'});d_g.set({d_B:d_b,d_o:250});})();
