/*
 * jQuery UI @VERSION
 *
 * Copyright (c) 2008 Paul Bakaus (ui.jquery.com)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI
 *
 * $Date: 2008-04-01 09:23:47 -0400 (Tue, 01 Apr 2008) $
 * $Rev: 5174 $
 */
;(function($){$.ui=$.ui||{};$.extend($.ui,{plugin:{add:function(a,b,c){var d=$.ui[a].prototype;for(var i in c){d.plugins[i]=d.plugins[i]||[];d.plugins[i].push([b,c[i]])}},call:function(a,b,c){var d=a.plugins[b];if(!d)return;for(var i=0;i<d.length;i++){if(a.options[d[i][0]])d[i][1].apply(a.element,c)}}},cssCache:{},css:function(a){if($.ui.cssCache[a])return $.ui.cssCache[a];var b=$('<div class="ui-resizable-gen">').addClass(a).css({position:'absolute',top:'-5000px',left:'-5000px',display:'block'}).appendTo('body');$.ui.cssCache[a]=!!((!/auto|default/.test(b.css('cursor'))||(/^[1-9]/).test(b.css('height'))||(/^[1-9]/).test(b.css('width'))||!(/none/).test(b.css('backgroundImage'))||!(/transparent|rgba\(0, 0, 0, 0\)/).test(b.css('backgroundColor'))));try{$('body').get(0).removeChild(b.get(0))}catch(e){}return $.ui.cssCache[a]},disableSelection:function(e){e.unselectable="on";e.onselectstart=function(){return false};if(e.style)e.style.MozUserSelect="none"},enableSelection:function(e){e.unselectable="off";e.onselectstart=function(){return true};if(e.style)e.style.MozUserSelect=""},hasScroll:function(e,a){var b=/top/.test(a||"top")?'scrollTop':'scrollLeft',has=false;if(e[b]>0)return true;e[b]=1;has=e[b]>0?true:false;e[b]=0;return has}});$.each(['Left','Top'],function(i,a){if(!$.fn['scroll'+a])$.fn['scroll'+a]=function(v){return v!=undefined?this.each(function(){this==window||this==document?window.scrollTo(a=='Left'?v:$(window)['scrollLeft'](),a=='Top'?v:$(window)['scrollTop']()):this['scroll'+a]=v}):this[0]==window||this[0]==document?self[(a=='Left'?'pageXOffset':'pageYOffset')]||$.boxModel&&document.documentElement['scroll'+a]||document.body['scroll'+a]:this[0]['scroll'+a]}});var f=$.fn.remove;$.fn.extend({position:function(){var a=this.offset();var b=this.offsetParent();var c=b.offset();return{top:a.top-num(this[0],'marginTop')-c.top-num(b,'borderTopWidth'),left:a.left-num(this[0],'marginLeft')-c.left-num(b,'borderLeftWidth')}},offsetParent:function(){var a=this[0].offsetParent;while(a&&(!/^body|html$/i.test(a.tagName)&&$.css(a,'position')=='static'))a=a.offsetParent;return $(a)},mouseInteraction:function(o){return this.each(function(){new $.ui.mouseInteraction(this,o)})},removeMouseInteraction:function(o){return this.each(function(){if($.data(this,"ui-mouse"))$.data(this,"ui-mouse").destroy()})},remove:function(){jQuery("*",this).add(this).trigger("remove");return f.apply(this,arguments)}});function num(a,b){return parseInt($.curCSS(a.jquery?a[0]:a,b,true))||0};$.ui.mouseInteraction=function(a,b){var c=this;this.element=a;$.data(this.element,"ui-mouse",this);this.options=$.extend({},b);$(a).bind('mousedown.draggable',function(){return c.click.apply(c,arguments)});if($.browser.msie)$(a).attr('unselectable','on');$(a).mouseup(function(){if(c.timer)clearInterval(c.timer)})};$.extend($.ui.mouseInteraction.prototype,{destroy:function(){$(this.element).unbind('mousedown.draggable')},trigger:function(){return this.click.apply(this,arguments)},click:function(e){if(e.which!=1||$.inArray(e.target.nodeName.toLowerCase(),this.options.dragPrevention||[])!=-1||(this.options.condition&&!this.options.condition.apply(this.options.executor||this,[e,this.element])))return true;var a=this;var b=function(){a._MP={left:e.pageX,top:e.pageY};$(document).bind('mouseup.draggable',function(){return a.stop.apply(a,arguments)});$(document).bind('mousemove.draggable',function(){return a.drag.apply(a,arguments)});if(!a.initalized&&Math.abs(a._MP.left-e.pageX)>=a.options.distance||Math.abs(a._MP.top-e.pageY)>=a.options.distance){if(a.options.start)a.options.start.call(a.options.executor||a,e,a.element);if(a.options.drag)a.options.drag.call(a.options.executor||a,e,this.element);a.initialized=true}};if(this.options.delay){if(this.timer)clearInterval(this.timer);this.timer=setTimeout(b,this.options.delay)}else{b()}return false},stop:function(e){var o=this.options;if(!this.initialized)return $(document).unbind('mouseup.draggable').unbind('mousemove.draggable');if(this.options.stop)this.options.stop.call(this.options.executor||this,e,this.element);$(document).unbind('mouseup.draggable').unbind('mousemove.draggable');this.initialized=false;return false},drag:function(e){var o=this.options;if($.browser.msie&&!e.button)return this.stop.apply(this,[e]);if(!this.initialized&&(Math.abs(this._MP.left-e.pageX)>=o.distance||Math.abs(this._MP.top-e.pageY)>=o.distance)){if(this.options.start)this.options.start.call(this.options.executor||this,e,this.element);this.initialized=true}else{if(!this.initialized)return false}if(o.drag)o.drag.call(this.options.executor||this,e,this.element);return false}})})(jQuery);