jQuery(function(a){a.fn.dffbah_autowidget=function(q){var g={prefix:"dffbah_autowidget"};if(typeof q=="object"){q=a.extend(g,q)}else{q=g}q.scope=this;var c=q.scope.find("."+q.prefix+"_window");var b=q.scope.find("."+q.prefix+"_content");var d=q.scope.find("."+q.prefix+"_bar");var i=q.scope.find("."+q.prefix+"_bar_container");var p=c.innerHeight();var e=b.outerHeight();var h=p-e;var j=Math.ceil(p-28);i.css("height",j+"px").on("click",function(r){var s=i.offset();o(Math.floor(-1*l-e*(r.pageY-s.top)/j))});if(p>=e){d.css("height",Math.ceil(p-28)+"px");return}d.css("height",Math.ceil((p-28)*(p/e))+"px");var m=function(r,s){if(r.addEventListener){r.addEventListener("DOMMouseScroll",s,false);r.addEventListener("mousewheel",s,false)}else{if(r.attachEvent){r.attachEvent("onmousewheel",s,false)}}};var f=function(r,s){if(r.removeEventListener){r.removeEventListener("DOMMouseScroll",s,false);r.removeEventListener("mousewheel",s,false)}else{if(r.detachEvent){r.detachEvent("onmousewheel",s)}}};var l=0;var o=function(r){l=l+r;if(l>0){l=0}if(l<=h){l=h}b.css("margin-top",l+"px");d.css("margin-top",Math.ceil((28-p)*(l/e))+"px")};var k=function(r){r=r?r:window.event;var s=r.detail?r.detail*-1:r.wheelDelta/40;o(s*4);if(r.stopPropagation){r.stopPropagation()}if(r.preventDefault){r.preventDefault()}r.cancelBubble=true;r.cancel=true;r.returnValue=true;return false};m(c[0],k);var n;q.scope.find("."+q.prefix+"_up").bind("mousedown",function(){n=window.setInterval(function(){o(6)},100)}).bind("mouseup",function(){if(typeof n!="undefined"){window.clearInterval(n)}}).bind("mouseleave",function(){if(typeof n!="undefined"){window.clearInterval(n)}});q.scope.find("."+q.prefix+"_down").bind("mousedown",function(){n=window.setInterval(function(){o(-6)},100)}).bind("mouseup",function(){if(typeof n!="undefined"){window.clearInterval(n)}}).bind("mouseleave",function(){if(typeof n!="undefined"){window.clearInterval(n)}})}});