/*
 * jQuery UI 1.0 - New Wave User Interface
 *
 * Copyright (c) 2007 John Resig (jquery.com)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 */
(function($){$.ui=$.ui||{};$.extend($.ui,{plugin:{add:function(w,c,o,p){var a=$.ui[w].prototype;if(!a.plugins[c])a.plugins[c]=[];a.plugins[c].push([o,p]);},call:function(instance,name,arguments){var c=instance.plugins[name];if(!c)return;var o=instance.interaction?instance.interaction.options:instance.options;var e=instance.interaction?instance.interaction.element:instance.element;for(var i=0;i<c.length;i++){if(o[c[i][0]])c[i][1].apply(e,arguments);}}}});$.fn.mouseInteractionDestroy=function(){this.each(function(){if($.data(this,"ui-mouse"))$.data(this,"ui-mouse").destroy();});}
$.ui.mouseInteraction=function(el,o){if(!o)var o={};this.element=el;$.data(this.element,"ui-mouse",this);this.options={};$.extend(this.options,o);$.extend(this.options,{handle:o.handle?($(o.handle,el)[0]?$(o.handle,el):$(el)):$(el),helper:o.helper||'original',preventionDistance:o.preventionDistance||0,dragPrevention:o.dragPrevention?o.dragPrevention.toLowerCase().split(','):['input','textarea','button','select','option'],cursorAt:{top:((o.cursorAt&&o.cursorAt.top)?o.cursorAt.top:0),left:((o.cursorAt&&o.cursorAt.left)?o.cursorAt.left:0),bottom:((o.cursorAt&&o.cursorAt.bottom)?o.cursorAt.bottom:0),right:((o.cursorAt&&o.cursorAt.right)?o.cursorAt.right:0)},cursorAtIgnore:(!o.cursorAt)?true:false,appendTo:o.appendTo||'parent'})
o=this.options;if(!this.options.nonDestructive&&(o.helper=='clone'||o.helper=='original')){o.margins={top:parseInt($(el).css('marginTop'))||0,left:parseInt($(el).css('marginLeft'))||0,bottom:parseInt($(el).css('marginBottom'))||0,right:parseInt($(el).css('marginRight'))||0};if(o.cursorAt.top!=0)o.cursorAt.top=o.margins.top;if(o.cursorAt.left!=0)o.cursorAt.left+=o.margins.left;if(o.cursorAt.bottom!=0)o.cursorAt.bottom+=o.margins.bottom;if(o.cursorAt.right!=0)o.cursorAt.right+=o.margins.right;if(o.helper=='original')
o.wasPositioned=$(el).css('position');}else{o.margins={top:0,left:0,right:0,bottom:0};}
var self=this;this.mousedownfunc=function(e){return self.click.apply(self,[e]);}
o.handle.bind('mousedown',this.mousedownfunc);if($.browser.msie)$(this.element).attr('unselectable','on');}
$.extend($.ui.mouseInteraction.prototype,{plugins:{},currentTarget:null,lastTarget:null,timer:null,slowMode:false,init:false,destroy:function(){this.options.handle.unbind('mousedown',this.mousedownfunc);},trigger:function(e){return this.click.apply(this,arguments);},click:function(e){var o=this.options;window.focus();if(e.which!=1)return true;var targetName=(e.target)?e.target.nodeName.toLowerCase():e.srcElement.nodeName.toLowerCase();for(var i=0;i<o.dragPrevention.length;i++){if(targetName==o.dragPrevention[i])return true;}
if(o.startCondition&&!o.startCondition.apply(this,[e]))return true;var self=this;this.mouseup=function(e){return self.stop.apply(self,[e]);}
this.mousemove=function(e){return self.drag.apply(self,[e]);}
var initFunc=function(){$(document).bind('mouseup',self.mouseup);$(document).bind('mousemove',self.mousemove);self.opos=[e.pageX,e.pageY];}
if(o.preventionTimeout){if(this.timer)clearInterval(this.timer);this.timer=setTimeout(function(){initFunc();},o.preventionTimeout);return false;}
initFunc();return false;},start:function(e){var o=this.options;var a=this.element;o.co=$(a).offset();this.helper=typeof o.helper=='function'?$(o.helper.apply(a,[e,this]))[0]:(o.helper=='clone'?$(a).clone()[0]:a);if(o.appendTo=='parent'){var cp=a.parentNode;while(cp){if(cp.style&&($(cp).css('position')=='relative'||$(cp).css('position')=='absolute')){o.pp=cp;o.po=$(cp).offset();o.ppOverflow=!!($(o.pp).css('overflow')=='auto'||$(o.pp).css('overflow')=='scroll');break;}
cp=cp.parentNode?cp.parentNode:null;};if(!o.pp)o.po={top:0,left:0};}
this.pos=[this.opos[0],this.opos[1]];this.rpos=[this.pos[0],this.pos[1]];if(o.cursorAtIgnore){o.cursorAt.left=this.pos[0]-o.co.left+o.margins.left;o.cursorAt.top=this.pos[1]-o.co.top+o.margins.top;}
if(o.pp){this.pos[0]-=o.po.left;this.pos[1]-=o.po.top;}
this.slowMode=(o.cursorAt&&(o.cursorAt.top-o.margins.top>0||o.cursorAt.bottom-o.margins.bottom>0)&&(o.cursorAt.left-o.margins.left>0||o.cursorAt.right-o.margins.right>0))?true:false;if(!o.nonDestructive)$(this.helper).css('position','absolute');if(o.helper!='original')$(this.helper).appendTo((o.appendTo=='parent'?a.parentNode:o.appendTo)).show();if(o.cursorAt.right&&!o.cursorAt.left)o.cursorAt.left=this.helper.offsetWidth+o.margins.right+o.margins.left-o.cursorAt.right;if(o.cursorAt.bottom&&!o.cursorAt.top)o.cursorAt.top=this.helper.offsetHeight+o.margins.top+o.margins.bottom-o.cursorAt.bottom;this.init=true;if(o._start)o._start.apply(a,[this.helper,this.pos,o.cursorAt,this,e]);this.helperSize={width:$(this.helper).outerWidth(),height:$(this.helper).outerHeight()};return false;},stop:function(e){var o=this.options;var a=this.element;var self=this;$(document).unbind('mouseup',self.mouseup);$(document).unbind('mousemove',self.mousemove);if(this.init==false)return this.opos=this.pos=null;if(o._beforeStop)o._beforeStop.apply(a,[this.helper,this.pos,o.cursorAt,this,e]);if(this.helper!=a&&!o.beQuietAtEnd){$(this.helper).remove();this.helper=null;}
if(!o.beQuietAtEnd){if(o._stop)o._stop.apply(a,[this.helper,this.pos,o.cursorAt,this,e]);}
this.init=false;this.opos=this.pos=null;return false;},drag:function(e){if(!this.opos||($.browser.msie&&!e.button))return this.stop.apply(this,[e]);var o=this.options;this.pos=[e.pageX,e.pageY];if(this.rpos&&this.rpos[0]==this.pos[0]&&this.rpos[1]==this.pos[1])return false;this.rpos=[this.pos[0],this.pos[1]];if(o.pp){this.pos[0]-=o.po.left;this.pos[1]-=o.po.top;}
if((Math.abs(this.rpos[0]-this.opos[0])>o.preventionDistance||Math.abs(this.rpos[1]-this.opos[1])>o.preventionDistance)&&this.init==false)
this.start.apply(this,[e]);else{if(this.init==false)return false;}
if(o._drag)o._drag.apply(this.element,[this.helper,this.pos,o.cursorAt,this,e]);return false;}});})(jQuery);
(function($){$.extend($.expr[':'],{draggable:"(' '+a.className+' ').indexOf(' ui-draggable ')"});var methods="destroy,enable,disable".split(",");for(var i=0;i<methods.length;i++){var cur=methods[i],f;eval('f = function() { var a = arguments; return this.each(function() { if(jQuery(this).is(".ui-draggable")) jQuery.data(this, "ui-draggable")["'+cur+'"](a); }); }');$.fn["draggable"+cur.substr(0,1).toUpperCase()+cur.substr(1)]=f;};$.fn.draggableInstance=function(){if($(this[0]).is(".ui-draggable"))return $.data(this[0],"ui-draggable");return false;};$.fn.draggable=function(o){return this.each(function(){if(!$(this).is(".ui-draggable"))new $.ui.draggable(this,o);});}
$.ui.ddmanager={current:null,droppables:[],prepareOffsets:function(t,e){var dropTop=$.ui.ddmanager.dropTop=[];var dropLeft=$.ui.ddmanager.dropLeft;var m=$.ui.ddmanager.droppables;for(var i=0;i<m.length;i++){if(m[i].item.disabled)continue;m[i].offset=$(m[i].item.element).offset();if(t&&m[i].item.options.accept(t.element))
m[i].item.activate.call(m[i].item,e);}},fire:function(oDrag,e){var oDrops=$.ui.ddmanager.droppables;var oOvers=$.grep(oDrops,function(oDrop){if(!!oDrop&&!oDrop.item.disabled&&$.ui.intersect(oDrag,oDrop,oDrop.item.options.tolerance))
oDrop.item.drop.call(oDrop.item,e);});$.each(oDrops,function(i,oDrop){if(!oDrop.item.disabled&&oDrop.item.options.accept(oDrag.element)){oDrop.out=1;oDrop.over=0;oDrop.item.deactivate.call(oDrop.item,e);}});},update:function(oDrag,e){if(oDrag.options.refreshPositions)$.ui.ddmanager.prepareOffsets();var oDrops=$.ui.ddmanager.droppables;var oOvers=$.grep(oDrops,function(oDrop){if(oDrop.item.disabled)return false;var isOver=$.ui.intersect(oDrag,oDrop,oDrop.item.options.tolerance)
if(!isOver&&oDrop.over==1){oDrop.out=1;oDrop.over=0;oDrop.item.out.call(oDrop.item,e);}
return isOver;});$.each(oOvers,function(i,oOver){if(oOver.over==0){oOver.out=0;oOver.over=1;oOver.item.over.call(oOver.item,e);}});}};$.ui.draggable=function(el,o){var options={};$.extend(options,o);var self=this;$.extend(options,{_start:function(h,p,c,t,e){self.start.apply(t,[self,e]);},_beforeStop:function(h,p,c,t,e){self.stop.apply(t,[self,e]);},_drag:function(h,p,c,t,e){self.drag.apply(t,[self,e]);},startCondition:function(e){return!(e.target.className.indexOf("ui-resizable-handle")!=-1||self.disabled);}});$.data(el,"ui-draggable",this);if(options.ghosting==true)options.helper='clone';$(el).addClass("ui-draggable");this.interaction=new $.ui.mouseInteraction(el,options);}
$.extend($.ui.draggable.prototype,{plugins:{},currentTarget:null,lastTarget:null,destroy:function(){$(this.interaction.element).removeClass("ui-draggable").removeClass("ui-draggable-disabled");this.interaction.destroy();},enable:function(){$(this.interaction.element).removeClass("ui-draggable-disabled");this.disabled=false;},disable:function(){$(this.interaction.element).addClass("ui-draggable-disabled");this.disabled=true;},prepareCallbackObj:function(self){return{helper:self.helper,position:{left:self.pos[0],top:self.pos[1]},offset:self.options.cursorAt,draggable:self,options:self.options}},start:function(that,e){var o=this.options;$.ui.ddmanager.current=this;$.ui.plugin.call(that,'start',[e,that.prepareCallbackObj(this)]);$(this.element).triggerHandler("dragstart",[e,that.prepareCallbackObj(this)],o.start);if(this.slowMode&&$.ui.droppable&&!o.dropBehaviour)
$.ui.ddmanager.prepareOffsets(this,e);return false;},stop:function(that,e){var o=this.options;$.ui.plugin.call(that,'stop',[e,that.prepareCallbackObj(this)]);$(this.element).triggerHandler("dragstop",[e,that.prepareCallbackObj(this)],o.stop);if(this.slowMode&&$.ui.droppable&&!o.dropBehaviour)
$.ui.ddmanager.fire(this,e);$.ui.ddmanager.current=null;$.ui.ddmanager.last=this;return false;},drag:function(that,e){var o=this.options;$.ui.ddmanager.update(this,e);this.pos=[this.pos[0]-o.cursorAt.left,this.pos[1]-o.cursorAt.top];$.ui.plugin.call(that,'drag',[e,that.prepareCallbackObj(this)]);var nv=$(this.element).triggerHandler("drag",[e,that.prepareCallbackObj(this)],o.drag);var nl=(nv&&nv.left)?nv.left:this.pos[0];var nt=(nv&&nv.top)?nv.top:this.pos[1];$(this.helper).css('left',nl+'px').css('top',nt+'px');return false;}});})(jQuery);
(function($){$.ui.plugin.add("draggable","stop","effect",function(e,ui){var t=ui.helper;if(ui.options.effect[1]){if(t!=this){ui.options.beQuietAtEnd=true;switch(ui.options.effect[1]){case'fade':$(t).fadeOut(300,function(){$(this).remove();});break;default:$(t).remove();break;}}}});$.ui.plugin.add("draggable","start","effect",function(e,ui){if(ui.options.effect[0]){switch(ui.options.effect[0]){case'fade':$(ui.helper).hide().fadeIn(300);break;}}});$.ui.plugin.add("draggable","start","cursor",function(e,ui){var t=$('body');if(t.css("cursor"))ui.options.ocursor=t.css("cursor");t.css("cursor",ui.options.cursor);});$.ui.plugin.add("draggable","stop","cursor",function(e,ui){if(ui.options.ocursor)$('body').css("cursor",ui.options.ocursor);});$.ui.plugin.add("draggable","start","zIndex",function(e,ui){var t=$(ui.helper);if(t.css("zIndex"))ui.options.ozIndex=t.css("zIndex");t.css('zIndex',ui.options.zIndex);});$.ui.plugin.add("draggable","stop","zIndex",function(e,ui){if(ui.options.ozIndex)$(ui.helper).css('zIndex',ui.options.ozIndex);});$.ui.plugin.add("draggable","start","opacity",function(e,ui){var t=$(ui.helper);if(t.css("opacity"))ui.options.oopacity=t.css("opacity");t.css('opacity',ui.options.opacity);});$.ui.plugin.add("draggable","stop","opacity",function(e,ui){if(ui.options.oopacity)$(ui.helper).css('opacity',ui.options.oopacity);});$.ui.plugin.add("draggable","stop","revert",function(e,ui){var o=ui.options;var rpos={left:0,top:0};o.beQuietAtEnd=true;if(ui.helper!=this){rpos=$(ui.draggable.sorthelper||this).offset({border:false});var nl=rpos.left-o.po.left-o.margins.left;var nt=rpos.top-o.po.top-o.margins.top;}else{var nl=o.co.left-(o.po?o.po.left:0);var nt=o.co.top-(o.po?o.po.top:0);}
var self=ui.draggable;$(ui.helper).animate({left:nl,top:nt},500,function(){if(o.wasPositioned)$(self.element).css('position',o.wasPositioned);if(o.stop)o.stop.apply(self.element,[self.helper,self.pos,[o.co.left-o.po.left,o.co.top-o.po.top],self]);if(self.helper!=self.element)window.setTimeout(function(){$(self.helper).remove();},0);});});$.ui.plugin.add("draggable","start","iframeFix",function(e,ui){var o=ui.options;if(!ui.draggable.slowMode){if(o.iframeFix.constructor==Array){for(var i=0;i<o.iframeFix.length;i++){var co=$(o.iframeFix[i]).offset({border:false});$("<div class='DragDropIframeFix' style='background: #fff;'></div>").css("width",$(o.iframeFix[i])[0].offsetWidth+"px").css("height",$(o.iframeFix[i])[0].offsetHeight+"px").css("position","absolute").css("opacity","0.001").css("z-index","1000").css("top",co.top+"px").css("left",co.left+"px").appendTo("body");}}else{$("iframe").each(function(){var co=$(this).offset({border:false});$("<div class='DragDropIframeFix' style='background: #fff;'></div>").css("width",this.offsetWidth+"px").css("height",this.offsetHeight+"px").css("position","absolute").css("opacity","0.001").css("z-index","1000").css("top",co.top+"px").css("left",co.left+"px").appendTo("body");});}}});$.ui.plugin.add("draggable","stop","iframeFix",function(e,ui){if(ui.options.iframeFix)$("div.DragDropIframeFix").each(function(){this.parentNode.removeChild(this);});});$.ui.plugin.add("draggable","start","containment",function(e,ui){var o=ui.options;if(!o.cursorAtIgnore||o.containment.left!=undefined||o.containment.constructor==Array)return;if(o.containment=='parent')o.containment=this.parentNode;if(o.containment=='document'){o.containment=[0-o.margins.left,0-o.margins.top,$(document).width()-o.margins.right,($(document).height()||document.body.parentNode.scrollHeight)-o.margins.bottom];}else{var ce=$(o.containment)[0];var co=$(o.containment).offset({border:false});o.containment=[co.left-o.margins.left,co.top-o.margins.top,co.left+(ce.offsetWidth||ce.scrollWidth)-o.margins.right,co.top+(ce.offsetHeight||ce.scrollHeight)-o.margins.bottom];}});$.ui.plugin.add("draggable","drag","containment",function(e,ui){var o=ui.options;if(!o.cursorAtIgnore)return;var h=$(ui.helper);var c=o.containment;if(c.constructor==Array){if((ui.draggable.pos[0]<c[0]-o.po.left))ui.draggable.pos[0]=c[0]-o.po.left;if((ui.draggable.pos[1]<c[1]-o.po.top))ui.draggable.pos[1]=c[1]-o.po.top;if(ui.draggable.pos[0]+h[0].offsetWidth>c[2]-o.po.left)ui.draggable.pos[0]=c[2]-o.po.left-h[0].offsetWidth;if(ui.draggable.pos[1]+h[0].offsetHeight>c[3]-o.po.top)ui.draggable.pos[1]=c[3]-o.po.top-h[0].offsetHeight;}else{if(c.left&&(ui.draggable.pos[0]<c.left))ui.draggable.pos[0]=c.left;if(c.top&&(ui.draggable.pos[1]<c.top))ui.draggable.pos[1]=c.top;var p=$(o.pp);if(c.right&&ui.draggable.pos[0]+h[0].offsetWidth>p[0].offsetWidth-c.right)ui.draggable.pos[0]=(p[0].offsetWidth-c.right)-h[0].offsetWidth;if(c.bottom&&ui.draggable.pos[1]+h[0].offsetHeight>p[0].offsetHeight-c.bottom)ui.draggable.pos[1]=(p[0].offsetHeight-c.bottom)-h[0].offsetHeight;}});$.ui.plugin.add("draggable","drag","grid",function(e,ui){var o=ui.options;if(!o.cursorAtIgnore)return;ui.draggable.pos[0]=o.co.left+o.margins.left-o.po.left+Math.round((ui.draggable.pos[0]-o.co.left-o.margins.left+o.po.left)/o.grid[0])*o.grid[0];ui.draggable.pos[1]=o.co.top+o.margins.top-o.po.top+Math.round((ui.draggable.pos[1]-o.co.top-o.margins.top+o.po.top)/o.grid[1])*o.grid[1];});$.ui.plugin.add("draggable","drag","axis",function(e,ui){var o=ui.options;if(!o.cursorAtIgnore)return;if(o.constraint)o.axis=o.constraint;o.axis?(o.axis=='x'?ui.draggable.pos[1]=o.co.top-o.margins.top-o.po.top:ui.draggable.pos[0]=o.co.left-o.margins.left-o.po.left):null;});$.ui.plugin.add("draggable","drag","scroll",function(e,ui){var o=ui.options;o.scrollSensitivity=o.scrollSensitivity||20;o.scrollSpeed=o.scrollSpeed||20;if(o.pp&&o.ppOverflow){}else{if((ui.draggable.rpos[1]-$(window).height())-$(document).scrollTop()>-o.scrollSensitivity)window.scrollBy(0,o.scrollSpeed);if(ui.draggable.rpos[1]-$(document).scrollTop()<o.scrollSensitivity)window.scrollBy(0,-o.scrollSpeed);if((ui.draggable.rpos[0]-$(window).width())-$(document).scrollLeft()>-o.scrollSensitivity)window.scrollBy(o.scrollSpeed,0);if(ui.draggable.rpos[0]-$(document).scrollLeft()<o.scrollSensitivity)window.scrollBy(-o.scrollSpeed,0);}});$.ui.plugin.add("draggable","drag","wrapHelper",function(e,ui){var o=ui.options;if(o.cursorAtIgnore)return;var t=ui.helper;if(!o.pp||!o.ppOverflow){var wx=$(window).width()-($.browser.mozilla?20:0);var sx=$(document).scrollLeft();var wy=$(window).height();var sy=$(document).scrollTop();}else{var wx=o.pp.offsetWidth+o.po.left-20;var sx=o.pp.scrollLeft;var wy=o.pp.offsetHeight+o.po.top-20;var sy=o.pp.scrollTop;}
ui.draggable.pos[0]-=((ui.draggable.rpos[0]-o.cursorAt.left-wx+t.offsetWidth+o.margins.right)-sx>0||(ui.draggable.rpos[0]-o.cursorAt.left+o.margins.left)-sx<0)?(t.offsetWidth+o.margins.left+o.margins.right-o.cursorAt.left*2):0;ui.draggable.pos[1]-=((ui.draggable.rpos[1]-o.cursorAt.top-wy+t.offsetHeight+o.margins.bottom)-sy>0||(ui.draggable.rpos[1]-o.cursorAt.top+o.margins.top)-sy<0)?(t.offsetHeight+o.margins.top+o.margins.bottom-o.cursorAt.top*2):0;});})(jQuery);
(function($){$.extend($.expr[':'],{droppable:"(' '+a.className+' ').indexOf(' ui-droppable ')"});var methods="destroy,enable,disable".split(",");for(var i=0;i<methods.length;i++){var cur=methods[i],f;eval('f = function() { var a = arguments; return this.each(function() { if(jQuery(this).is(".ui-droppable")) jQuery.data(this, "ui-droppable")["'+cur+'"](a); }); }');$.fn["droppable"+cur.substr(0,1).toUpperCase()+cur.substr(1)]=f;};$.fn.droppableInstance=function(){if($(this[0]).is(".ui-droppable"))return $.data(this[0],"ui-droppable");return false;};$.fn.droppable=function(o){return this.each(function(){new $.ui.droppable(this,o);});}
$.ui.droppable=function(el,o){if(!o)var o={};this.element=el;if($.browser.msie)el.droppable=1;$.data(el,"ui-droppable",this);this.options={};$.extend(this.options,o);var accept=o.accept;$.extend(this.options,{accept:o.accept&&o.accept.constructor==Function?o.accept:function(d){return $(d).is(accept);},tolerance:o.tolerance||'intersect'});o=this.options;var self=this;$.ui.ddmanager.droppables.push({item:this,over:0,out:1});$(this.element).addClass("ui-droppable");};$.extend($.ui.droppable.prototype,{plugins:{},prepareCallbackObj:function(c){return{draggable:c,droppable:this,element:c.element,helper:c.helper,options:this.options}},destroy:function(){$(this.element).removeClass("ui-droppable").removeClass("ui-droppable-disabled");for(var i=0;i<$.ui.ddmanager.droppables.length;i++){if($.ui.ddmanager.droppables[i].item==this)$.ui.ddmanager.droppables.splice(i,1);}},enable:function(){$(this.element).removeClass("ui-droppable-disabled");this.disabled=false;},disable:function(){$(this.element).addClass("ui-droppable-disabled");this.disabled=true;},move:function(e){if(!$.ui.ddmanager.current)return;var o=this.options;var c=$.ui.ddmanager.current;var findCurrentTarget=function(e){if(e.currentTarget)return e.currentTarget;var el=e.srcElement;do{if(el.droppable)return el;el=el.parentNode;}while(el);}
if(c&&o.accept(c.element))c.currentTarget=findCurrentTarget(e);c.drag.apply(c,[e]);e.stopPropagation?e.stopPropagation():e.cancelBubble=true;},over:function(e){var c=$.ui.ddmanager.current;if(!c||c.element==this.element)return;var o=this.options;if(o.accept(c.element)){$.ui.plugin.call(this,'over',[e,this.prepareCallbackObj(c)]);$(this.element).triggerHandler("dropover",[e,this.prepareCallbackObj(c)],o.over);}},out:function(e){var c=$.ui.ddmanager.current;if(!c||c.element==this.element)return;var o=this.options;if(o.accept(c.element)){$.ui.plugin.call(this,'out',[e,this.prepareCallbackObj(c)]);$(this.element).triggerHandler("dropout",[e,this.prepareCallbackObj(c)],o.out);}},drop:function(e){var c=$.ui.ddmanager.current;if(!c||c.element==this.element)return;var o=this.options;if(o.accept(c.element)){if(o.greedy&&!c.slowMode){if(c.currentTarget==this.element){$.ui.plugin.call(this,'drop',[e,{draggable:c,droppable:this,element:c.element,helper:c.helper}]);$(this.element).triggerHandler("drop",[e,{draggable:c,droppable:this,element:c.element,helper:c.helper}],o.drop);}}else{$.ui.plugin.call(this,'drop',[e,this.prepareCallbackObj(c)]);$(this.element).triggerHandler("drop",[e,this.prepareCallbackObj(c)],o.drop);}}},activate:function(e){var c=$.ui.ddmanager.current;$.ui.plugin.call(this,'activate',[e,this.prepareCallbackObj(c)]);if(c)$(this.element).triggerHandler("dropactivate",[e,this.prepareCallbackObj(c)],this.options.activate);},deactivate:function(e){var c=$.ui.ddmanager.current;$.ui.plugin.call(this,'deactivate',[e,this.prepareCallbackObj(c)]);if(c)$(this.element).triggerHandler("dropdeactivate",[e,this.prepareCallbackObj(c)],this.options.deactivate);}});$.ui.intersect=function(oDrag,oDrop,toleranceMode){if(!oDrop.offset)
return false;var x1=oDrag.rpos[0]-oDrag.options.cursorAt.left+oDrag.options.margins.left,x2=x1+oDrag.helperSize.width,y1=oDrag.rpos[1]-oDrag.options.cursorAt.top+oDrag.options.margins.top,y2=y1+oDrag.helperSize.height;var l=oDrop.offset.left,r=l+oDrop.item.element.offsetWidth,t=oDrop.offset.top,b=t+oDrop.item.element.offsetHeight;switch(toleranceMode){case'fit':return(l<x1&&x2<r&&t<y1&&y2<b);break;case'intersect':return(l<x1+(oDrag.helperSize.width/2)&&x2-(oDrag.helperSize.width/2)<r&&t<y1+(oDrag.helperSize.height/2)&&y2-(oDrag.helperSize.height/2)<b);break;case'pointer':return(l<oDrag.rpos[0]&&oDrag.rpos[0]<r&&t<oDrag.rpos[1]&&oDrag.rpos[1]<b);break;case'touch':return((l<x1&&x1<r&&t<y1&&y1<b)||(l<x1&&x1<r&&t<y2&&y2<b)||(l<x2&&x2<r&&t<y1&&y1<b)||(l<x2&&x2<r&&t<y2&&y2<b));break;default:return false;break;}}})(jQuery);
(function($){$.ui.plugin.add("droppable","activate","activeClass",function(e,ui){$(this).addClass(ui.options.activeClass);});$.ui.plugin.add("droppable","deactivate","activeClass",function(e,ui){$(this).removeClass(ui.options.activeClass);});$.ui.plugin.add("droppable","drop","activeClass",function(e,ui){$(this).removeClass(ui.options.activeClass);});$.ui.plugin.add("droppable","over","hoverClass",function(e,ui){$(this).addClass(ui.options.hoverClass);});$.ui.plugin.add("droppable","out","hoverClass",function(e,ui){$(this).removeClass(ui.options.hoverClass);});$.ui.plugin.add("droppable","drop","hoverClass",function(e,ui){$(this).removeClass(ui.options.hoverClass);});})(jQuery);
if(window.Node&&Node.prototype&&!Node.prototype.contains){Node.prototype.contains=function(arg){return!!(this.compareDocumentPosition(arg)&16)}}
(function($){$.extend($.expr[':'],{sortable:"(' '+a.className+' ').indexOf(' ui-sortable ')"});$.fn.sortable=function(o){return this.each(function(){new $.ui.sortable(this,o);});}
var methods="destroy,enable,disable,refresh".split(",");for(var i=0;i<methods.length;i++){var cur=methods[i],f;eval('f = function() { var a = arguments; return this.each(function() { if(jQuery(this).is(".ui-sortable")) jQuery.data(this, "ui-sortable")["'+cur+'"](a); }); }');$.fn["sortable"+cur.substr(0,1).toUpperCase()+cur.substr(1)]=f;};$.fn.sortableInstance=function(){if($(this[0]).is(".ui-sortable"))return $.data(this[0],"ui-sortable");return false;};$.ui.sortable=function(el,o){this.element=el;this.set=[];var options={};var self=this;$.data(this.element,"ui-sortable",this);$(el).addClass("ui-sortable");$.extend(options,o);$.extend(options,{items:options.items||'> li',smooth:options.smooth!=undefined?options.smooth:true,helper:'clone',containment:options.containment?(options.containment=='sortable'?el:options.containment):null,zIndex:options.zIndex||1000,_start:function(h,p,c,t,e){self.start.apply(t,[self,e]);},_beforeStop:function(h,p,c,t,e){self.stop.apply(t,[self,e]);},_drag:function(h,p,c,t,e){self.drag.apply(t,[self,e]);},startCondition:function(){return!self.disabled;}});var items=$(options.items,el);options.floating=/left|right/.test(items.css('float'));if($(el).css('position')=='static')$(el).css('position','relative');options.offset=$(el).offset({border:false});items.each(function(){new $.ui.mouseInteraction(this,options);});items.each(function(){self.set.push([this,null]);});this.options=options;}
$.extend($.ui.sortable.prototype,{plugins:{},currentTarget:null,lastTarget:null,prepareCallbackObj:function(self,that){if(!self.pos)self.pos=[0,0];return{helper:self.helper,position:{left:self.pos[0],top:self.pos[1]},offset:self.options.cursorAt,draggable:self,current:that,options:self.options}},refresh:function(){var self=this;var items=$(this.options.items,this.element);var unique=[];items.each(function(){old=false;for(var i=0;i<self.set.length;i++){if(self.set[i][0]==this)old=true;}
if(!old)unique.push(this);});for(var i=0;i<unique.length;i++){new $.ui.mouseInteraction(unique[i],self.options);}
this.set=[];items.each(function(){self.set.push([this,null]);});},destroy:function(){$(this.element).removeClass("ui-sortable").removeClass("ui-sortable-disabled");$(this.options.items,this.element).mouseInteractionDestroy();},enable:function(){$(this.element).removeClass("ui-sortable-disabled");this.disabled=false;},disable:function(){$(this.element).addClass("ui-sortable-disabled");this.disabled=true;},start:function(that,e){var o=this.options;if(o.hoverClass){that.helper=$('<div class="'+o.hoverClass+'"></div>').appendTo('body').css({height:this.element.offsetHeight+'px',width:this.element.offsetWidth+'px',position:'absolute'});}
if(o.zIndex){if($(this.helper).css("zIndex"))o.ozIndex=$(this.helper).css("zIndex");$(this.helper).css('zIndex',o.zIndex);}
that.firstSibling=$(this.element).prev()[0];$(this.element).css('visibility','hidden');$(this.element).triggerHandler("sortstart",[e,that.prepareCallbackObj(this)],o.start);return false;},stop:function(that,e){var o=this.options;var self=this;o.beQuietAtEnd=true;if(o.smooth){var os=$(this.element).offset();$(this.helper).animate({left:os.left-o.po.left,top:os.top-o.po.top},500,stopIt);}else{stopIt();}
function stopIt(){$(self.element).css('visibility','visible');if(that.helper)that.helper.remove();if(self.helper!=self.element)$(self.helper).remove();if(o.ozIndex)
$(self.helper).css('zIndex',o.ozIndex);if($(self.element).prev()[0]!=that.firstSibling){$(self.element).triggerHandler("sortupdate",[e,that.prepareCallbackObj(self,that)],o.update);}
$(self.element).triggerHandler("sortstop",[e,that.prepareCallbackObj(self,that)],o.stop);}
return false;},drag:function(that,e){var o=this.options;this.pos=[this.pos[0]-(o.cursorAt.left?o.cursorAt.left:0),this.pos[1]-(o.cursorAt.top?o.cursorAt.top:0)];var nv=$(this.element).triggerHandler("sort",[e,that.prepareCallbackObj(this)],o.sort);var nl=(nv&&nv.left)?nv.left:this.pos[0];var nt=(nv&&nv.top)?nv.top:this.pos[1];var m=that.set;var p=this.pos[1];for(var i=0;i<m.length;i++){var ci=$(m[i][0]);var cio=m[i][0];if(this.element.contains(cio))continue;var cO=ci.offset();cO={top:cO.top,left:cO.left};var mb=function(e){if(true||o.lba!=cio){ci.before(e);o.lba=cio;}}
var ma=function(e){if(true||o.laa!=cio){ci.after(e);o.laa=cio;}}
if(o.floating){var overlap=((cO.left-(this.pos[0]+(this.options.po?this.options.po.left:0)))/this.helper.offsetWidth);if(!(cO.top<this.pos[1]+(this.options.po?this.options.po.top:0)+cio.offsetHeight/2&&cO.top+cio.offsetHeight>this.pos[1]+(this.options.po?this.options.po.top:0)+cio.offsetHeight/2))continue;}else{var overlap=((cO.top-(this.pos[1]+(this.options.po?this.options.po.top:0)))/this.helper.offsetHeight);if(!(cO.left<this.pos[0]+(this.options.po?this.options.po.left:0)+cio.offsetWidth/2&&cO.left+cio.offsetWidth>this.pos[0]+(this.options.po?this.options.po.left:0)+cio.offsetWidth/2))continue;}
if(overlap>=0&&overlap<=0.5){ci.prev().length?ma(this.element):mb(this.element);break;}
if(overlap<0&&overlap>-0.5){ci.next()[0]==this.element?mb(this.element):ma(this.element);break;}}
if($(this.element).prev()[0]!=that.lastSibling){$(this.element).triggerHandler("sortchange",[e,that.prepareCallbackObj(this,that)],this.options.change);that.lastSibling=$(this.element).prev()[0];}
if(that.helper){var to=$(this.element).offset();that.helper.css({top:to.top+'px',left:to.left+'px'});}
$(this.helper).css('left',nl+'px').css('top',nt+'px');return false;}});})(jQuery);
(function($)
{var methods="destroy,enable,disable,toggle".split(",");for(var i=0;i<methods.length;i++){var cur=methods[i],f;eval('f = function() { var a = arguments; return this.each(function() { if(jQuery(this).is(".ui-selectable")) jQuery.data(this, "ui-selectable")["'+cur+'"](a); }); }');$.fn["selectable"+cur.substr(0,1).toUpperCase()+cur.substr(1)]=f;};$.extend($.expr[':'],{selectable:"(' '+a.className+' ').indexOf(' ui-selectable ')"});$.extend($.expr[':'],{selectee:"(' '+a.className+' ').indexOf(' ui-selectee ')"});$.fn.selectable=function(o){return this.each(function(){if(!$(this).is(".ui-selectable"))new $.ui.selectable(this,o);});}
$.ui.selectable=function(el,o){var options={filter:'*',tolerance:'touch'};var o=o||{};$.extend(options,o);this.element=el;var self=this;$.data(this.element,"ui-selectable",this);self.dragged=false;$.extend(options,{appendTo:'body',helper:function(){return $(document.createElement('div')).css({border:'1px dotted black'});},_start:function(h,p,c,t,e){self.start.apply(t,[self,e]);},_drag:function(h,p,c,t,e){self.dragged=true;self.drag.apply(t,[self,e]);},_stop:function(h,p,c,t,e){self.stop.apply(t,[self,e]);self.dragged=false;}});this.mouse=new $.ui.mouseInteraction(el,options);$(this.element).addClass("ui-selectable");$(this.element).children(options.filter).addClass("ui-selectee");}
$.extend($.ui.selectable.prototype,{toggle:function(){if(this.disabled){this.enable();}else{this.disable();}},destroy:function(){$(this.element).removeClass("ui-selectable").removeClass("ui-selectable-disabled");this.mouse.destroy();},enable:function(){$(this.element).removeClass("ui-selectable-disabled");this.disabled=false;},disable:function(){$(this.element).addClass("ui-selectable-disabled");this.disabled=true;},start:function(self,ev){if(self.disabled)
return;$(self.element).triggerHandler("selectablestart",[ev,{selectable:self.element,options:this.options}],this.options.start);self.childBoxes=[];$(this.options.filter,self.element).each(function(){var el=$(this),pos=el.offset();self.childBoxes.push([this,pos.left,pos.left+el.width(),pos.top,pos.top+el.height()]);});$(self.mouse.helper).css({'z-index':100,position:'absolute',left:ev.clientX,top:ev.clientY,width:0,height:0});if(ev.ctrlKey){if($(ev.target).is('.ui-selected')){$(ev.target).removeClass('ui-selected').addClass('ui-unselecting');$(self.element).triggerHandler("selectableunselecting",[ev,{selectable:self.element,unselecting:ev.target,options:this.options}],this.options.unselecting);}}else{self.unselecting(self,ev,this.options);}},childBoxes:[],drag:function(self,ev){if(self.disabled)
return;var x1=self.mouse.opos[0],y1=self.mouse.opos[1],x2=ev.pageX,y2=ev.pageY;if(x1>x2){var tmp=x2;x2=x1;x1=tmp;}
if(y1>y2){var tmp=y2;y2=y1;y1=tmp;}
$(self.mouse.helper).css({left:x1,top:y1,width:x2-x1,height:y2-y1});for(var i=0,len=self.childBoxes.length;i<len;i++){var box=self.childBoxes[i],hit=false;var bL=box[1],bR=box[2],bT=box[3],bB=box[4];if(this.options.tolerance=='touch'){hit=(!(bL>x2||bR<x1||bT>y2||bB<y1));}else if(this.options.tolerance=='fit'){hit=(bL>x1&&bR<x2&&bT>y1&&bB<y2);}
if(hit){self.selecting(self,ev,this.options,box[0]);}else{self.unselecting(self,ev,this.options,box[0]);}}},stop:function(self,ev){var options=this.options;$('.ui-selecting',self.element).each(function(){$(this).removeClass('ui-selecting').addClass('ui-selected');$(self.element).triggerHandler("selectableselected",[ev,{selectable:self.element,selected:this,options:options}],options.selected);});$('.ui-unselecting',self.element).each(function(){$(this).removeClass('ui-unselecting');$(self.element).triggerHandler("selectableunselected",[ev,{selectable:self.element,unselected:this,options:options}],options.unselected);});},selecting:function(self,ev,options,selectee){if($(selectee).is('.ui-selectee:not(.ui-selecting)')){$(selectee).removeClass('ui-selected').removeClass('ui-unselecting').addClass('ui-selecting');$(self.element).triggerHandler("selectableselecting",[ev,{selectable:self.element,selecting:selectee,options:options}],options.selecting);}},unselecting:function(self,ev,options,selectee){if($(selectee).is('.ui-selected')||$(selectee).is('.ui-selecting')){$(selectee).removeClass('ui-selected').removeClass('ui-selecting').addClass('ui-unselecting');$(self.element).triggerHandler("selectableunselecting",[ev,{selectable:self.element,unselecting:selectee,options:options}],options.unselecting);}}});})(jQuery);
(function($){$.extend($.expr[':'],{resizable:"(' '+a.className+' ').indexOf(' ui-resizable ')"});$.fn.resizable=function(o){return this.each(function(){if(!$(this).is(".ui-resizable"))new $.ui.resizable(this,o);});}
var methods="destroy,enable,disable".split(",");for(var i=0;i<methods.length;i++){var cur=methods[i],f;eval('f = function() { var a = arguments; return this.each(function() { if(jQuery(this).is(".ui-resizable")) jQuery.data(this, "ui-resizable")["'+cur+'"](a); if(jQuery(this.parentNode).is(".ui-resizable")) jQuery.data(this, "ui-resizable")["'+cur+'"](a); }); }');$.fn["resizable"+cur.substr(0,1).toUpperCase()+cur.substr(1)]=f;};$.fn.resizableInstance=function(){if($(this[0]).is(".ui-resizable")||$(this[0].parentNode).is(".ui-resizable"))return $.data(this[0],"ui-resizable");return false;};$.ui.resizable=function(el,o){var options={};o=o||{};$.extend(options,o);this.element=el;var self=this;$.data(this.element,"ui-resizable",this);if(options.proxy){var helper=function(e,that){var helper=$('<div></div>').css({width:$(this).width(),height:$(this).height(),position:'absolute',left:that.options.co.left,top:that.options.co.top}).addClass(that.options.proxy);return helper;}}else{var helper="original";}
if(options.containment){if(options.containment.left!=undefined||options.containment.constructor==Array)return;if(options.containment=='parent')options.containment=this.element.parentNode;if(options.containment=='document'){options.containment=[0,0,$(document).width(),($(document).height()||document.body.parentNode.scrollHeight)];}else{var ce=$(options.containment)[0];var co=$(options.containment).offset({border:false});options.containment=[co.left,co.top,co.left+(ce.offsetWidth||ce.scrollWidth),co.top+(ce.offsetHeight||ce.scrollHeight)];}}
if(el.nodeName.match(/textarea|input|select|button|img/i))options.destructive=true;if(options.destructive){$(el).wrap('<div class="ui-wrapper"  style="position: relative; width: '+$(el).outerWidth()+'px; height: '+$(el).outerHeight()+';"></div>');var oel=el;el=el.parentNode;this.element=el;$(el).css({marginLeft:$(oel).css("marginLeft"),marginTop:$(oel).css("marginTop"),marginRight:$(oel).css("marginRight"),marginBottom:$(oel).css("marginBottom")});$(oel).css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});o.proportionallyResize=o.proportionallyResize||[];o.proportionallyResize.push(oel);var b=[parseInt($(oel).css('borderTopWidth')),parseInt($(oel).css('borderRightWidth')),parseInt($(oel).css('borderBottomWidth')),parseInt($(oel).css('borderLeftWidth'))];}else{var b=[0,0,0,0];}
if(options.destructive||!$(".ui-resizable-handle",el).length){var t=function(a,b){$(el).append("<div class='ui-resizable-"+a+" ui-resizable-handle' style='"+b+"'></div>");};t('e','right: '+b[1]+'px;'+(options.zIndex?'z-index: '+options.zIndex+';':''));t('s','bottom: '+b[1]+'px;'+(options.zIndex?'z-index: '+options.zIndex+';':''));t('se','bottom: '+b[2]+'px; right: '+b[1]+'px;'+(options.zIndex?'z-index: '+options.zIndex+';':''));}
options.modifyThese=[];if(o.proportionallyResize){options.proportionallyResize=o.proportionallyResize.slice(0);var propRes=options.proportionallyResize;for(var i in propRes){if(propRes[i].constructor==String)
propRes[i]=$(propRes[i],el);if(!$(propRes[i]).length)continue;var x=$(propRes[i]).width()-$(el).width();var y=$(propRes[i]).height()-$(el).height();options.modifyThese.push([$(propRes[i]),x,y]);}}
options.handles={};if(!o.handles)o.handles={n:'.ui-resizable-n',e:'.ui-resizable-e',s:'.ui-resizable-s',w:'.ui-resizable-w',se:'.ui-resizable-se',sw:'.ui-resizable-sw',ne:'.ui-resizable-ne',nw:'.ui-resizable-nw'};for(var i in o.handles){options.handles[i]=o.handles[i];}
for(var i in options.handles){if(options.handles[i].constructor==String)
options.handles[i]=$(options.handles[i],el);if(!$(options.handles[i]).length)continue;$(options.handles[i]).bind('mousedown',function(e){self.interaction.options.axis=this.resizeAxis;})[0].resizeAxis=i;}
if(o.autohide)
$(this.element).addClass("ui-resizable-autohide").hover(function(){$(this).removeClass("ui-resizable-autohide");},function(){if(self.interaction.options.autohide&&!self.interaction.init)$(this).addClass("ui-resizable-autohide");});if(o.aspectRatio&&(o.aspectRatio=='preserve'||o.aspectRatio===true))
options.aspectRatio=$(this.element).width()/$(this.element).height();$.extend(options,{helper:helper,nonDestructive:true,dragPrevention:'input,button,select',minHeight:options.minHeight||50,minWidth:options.minWidth||100,aspectRatio:options.aspectRatio||false,startCondition:function(e){if(self.disabled)return false;for(var i in options.handles){if($(options.handles[i])[0]==e.target)return true;}
return false;},_start:function(h,p,c,t,e){self.start.apply(t,[self,e]);},_beforeStop:function(h,p,c,t,e){self.stop.apply(t,[self,e]);},_drag:function(h,p,c,t,e){self.drag.apply(t,[self,e]);}});this.interaction=new $.ui.mouseInteraction(el,options);$(this.element).addClass("ui-resizable");}
$.extend($.ui.resizable.prototype,{plugins:{},prepareCallbackObj:function(self){return{helper:self.helper,resizable:self,axis:self.options.axis,options:self.options}},destroy:function(){$(this.element).removeClass("ui-resizable").removeClass("ui-resizable-disabled");this.interaction.destroy();},enable:function(){$(this.element).removeClass("ui-resizable-disabled");this.disabled=false;},disable:function(){$(this.element).addClass("ui-resizable-disabled");this.disabled=true;},start:function(that,e){this.options.originalSize=[$(this.element).width(),$(this.element).height()];this.options.originalPosition=$(this.element).css("position");this.options.originalPositionValues=$(this.element).position();if(this.options.modifyThese.length==0||!this.options.modifyThese[this.options.modifyThese.length-1][0].is('.ui-resizable'))
this.options.modifyThese.push([$(this.helper),0,0]);$(that.element).triggerHandler("resizestart",[e,that.prepareCallbackObj(this)],this.options.start);return false;},stop:function(that,e){var o=this.options;$(that.element).triggerHandler("resizestop",[e,that.prepareCallbackObj(this)],this.options.stop);if(o.proxy){$(this.element).css({width:$(this.helper).width(),height:$(this.helper).height()});if(o.originalPosition=="absolute"||o.originalPosition=="fixed")
$(this.element).css({top:$(this.helper).css("top"),left:$(this.helper).css("left")});}
return false;},drag:function(that,e){var o=this.options;var rel=(o.originalPosition!="absolute"&&o.originalPosition!="fixed");var co=rel?o.co:this.options.originalPositionValues;var p=o.originalSize;this.pos=rel?[this.rpos[0]-o.cursorAt.left,this.rpos[1]-o.cursorAt.top]:[this.pos[0]-o.cursorAt.left,this.pos[1]-o.cursorAt.top];var nw=p[0]+(this.pos[0]-co.left);var nh=p[1]+(this.pos[1]-co.top);if(e.shiftKey&&!o.aspectRatio)o.aspectRatio=p[0]/p[1];if(o.axis){switch(o.axis){case'e':nh=p[1];break;case's':nw=p[0];break;case'n':case'ne':if(!o.proxy&&(o.originalPosition!="absolute"&&o.originalPosition!="fixed"))return false;if(o.axis=='n')nw=p[0];var mod=(this.pos[1]-co.top);nh=nh-(mod*2);mod=nh<=o.minHeight?p[1]-o.minHeight:(nh>=o.maxHeight?0-(o.maxHeight-p[1]):mod);if(o.containment&&co.top+mod<o.containment[1]-o.po.top){mod=(o.containment[1]-o.po.top)-co.top;nh=nh+this.pos[1]-(o.containment[1]-o.po.top);}
$(this.helper).css('top',co.top+mod);break;case'w':case'sw':if(!o.proxy&&(o.originalPosition!="absolute"&&o.originalPosition!="fixed"))return false;if(o.axis=='w')nh=p[1];var mod=(this.pos[0]-co.left);nw=nw-(mod*2);mod=nw<=o.minWidth?p[0]-o.minWidth:(nw>=o.maxWidth?0-(o.maxWidth-p[0]):mod);if(o.containment&&co.left+mod<o.containment[0]-o.po.left){mod=(o.containment[0]-o.po.left)-co.left;nw=nw+this.pos[0]-(o.containment[0]-o.po.left);}
$(this.helper).css('left',co.left+mod);break;case'nw':if(!o.proxy&&(o.originalPosition!="absolute"&&o.originalPosition!="fixed"))return false;var modx=(this.pos[0]-co.left);nw=nw-(modx*2);modx=nw<=o.minWidth?p[0]-o.minWidth:(nw>=o.maxWidth?0-(o.maxWidth-p[0]):modx);var mody=(this.pos[1]-co.top);nh=nh-(mody*2);mody=nh<=o.minHeight?p[1]-o.minHeight:(nh>=o.maxHeight?0-(o.maxHeight-p[1]):mody);if(o.containment&&co.top+mody<o.containment[1]-o.po.top){mody=(o.containment[1]-o.po.top)-co.top;nh=nh+this.pos[1]-(o.containment[1]-o.po.top);}
if(o.containment&&co.left+modx<o.containment[0]-o.po.left){modx=(o.containment[0]-o.po.left)-co.left;nw=nw+this.pos[0]-(o.containment[0]-o.po.left);}
$(this.helper).css({left:co.left+modx,top:co.top+mody});break;}}
if(e.shiftKey)nh=nw*(1/o.aspectRatio);if(o.minWidth)nw=nw<=o.minWidth?o.minWidth:nw;if(o.minHeight)nh=nh<=o.minHeight?o.minHeight:nh;if(o.maxWidth)nw=nw>=o.maxWidth?o.maxWidth:nw;if(o.maxHeight)nh=nh>=o.maxHeight?o.maxHeight:nh;if(e.shiftKey)nh=nw*(1/o.aspectRatio);var modifier=$(that.element).triggerHandler("resize",[e,that.prepareCallbackObj(this)],o.resize);if(!modifier)modifier={};var left_handle_pos=co.left<this.pos[0]?co.left:this.pos[0];var top_handle_pos=co.top<this.pos[1]?co.top:this.pos[1];if(o.containment&&left_handle_pos+nw>o.containment[2]-o.po.left)
nw=(o.containment[2]-o.po.left)-left_handle_pos;if(o.containment&&top_handle_pos+nh>o.containment[3]-o.po.top)
nh=(o.containment[3]-o.po.top)-top_handle_pos;for(var i in this.options.modifyThese){var c=this.options.modifyThese[i];c[0].css({width:modifier.width?modifier.width+c[1]:nw+c[1],height:modifier.height?modifier.height+c[2]:nh+c[2]});}
return false;}});})(jQuery);
(function($){$.ui=$.ui||{};$.ui.accordion={};$.extend($.ui.accordion,{defaults:{selectedClass:"selected",alwaysOpen:true,animated:'slide',event:"click",header:"a",autoheight:true},animations:{slide:function(settings,additions){settings=$.extend({easing:"swing",duration:300},settings,additions);if(!settings.toHide.size()){settings.toShow.animate({height:"show"},{duration:settings.duration,easing:settings.easing,complete:settings.finished});return;}
var hideHeight=settings.toHide.height(),showHeight=settings.toShow.height(),difference=showHeight/hideHeight;settings.toShow.css({height:0,overflow:'hidden'}).show();settings.toHide.filter(":hidden").each(settings.finished).end().filter(":visible").animate({height:"hide"},{step:function(now){settings.toShow.height((hideHeight-(now))*difference);},duration:settings.duration,easing:settings.easing,complete:settings.finished});},bounceslide:function(settings){this.slide(settings,{easing:settings.down?"bounceout":"swing",duration:settings.down?1000:200});},easeslide:function(settings){this.slide(settings,{easing:"easeinout",duration:700})}}});$.fn.extend({accordion:function(settings){if(!this.length)
return this;settings=$.extend({},$.ui.accordion.defaults,settings);if(settings.navigation){var current=this.find("a").filter(function(){return this.href==location.href;});if(current.length){if(current.filter(settings.header).length){settings.active=current;}else{settings.active=current.parent().parent().prev();current.addClass("current");}}}
var container=this,headers=container.find(settings.header),active=findActive(settings.active),running=0;if(settings.fillSpace){var maxHeight=this.parent().height();headers.each(function(){maxHeight-=$(this).outerHeight();});var maxPadding=0;headers.next().each(function(){maxPadding=Math.max(maxPadding,$(this).innerHeight()-$(this).height());}).height(maxHeight-maxPadding);}else if(settings.autoheight){var maxHeight=0;headers.next().each(function(){maxHeight=Math.max(maxHeight,$(this).outerHeight());}).height(maxHeight);}
headers.not(active||"").next().hide();active.parent().andSelf().addClass(settings.selectedClass);function findActive(selector){return selector!=undefined?typeof selector=="number"?headers.filter(":eq("+selector+")"):headers.not(headers.not(selector)):selector===false?$("<div>"):headers.filter(":eq(0)");}
function toggle(toShow,toHide,data,clickedActive,down){var finished=function(cancel){running=cancel?0:--running;if(running)
return;container.trigger("change",data);};running=toHide.size()==0?toShow.size():toHide.size();if(settings.animated){if(!settings.alwaysOpen&&clickedActive){toShow.slideToggle(settings.animated);finished(true);}else{$.ui.accordion.animations[settings.animated]({toShow:toShow,toHide:toHide,finished:finished,down:down});}}else{if(!settings.alwaysOpen&&clickedActive){toShow.toggle();}else{toHide.hide();toShow.show();}
finished(true);}}
function clickHandler(event){if(!event.target&&!settings.alwaysOpen){active.parent().andSelf().toggleClass(settings.selectedClass);var toHide=active.next();var toShow=active=$([]);toggle(toShow,toHide);return;}
var clicked=$(event.target);if(clicked.parents(settings.header).length)
while(!clicked.is(settings.header))
clicked=clicked.parent();var clickedActive=clicked[0]==active[0];if(running||(settings.alwaysOpen&&clickedActive)||!clicked.is(settings.header))
return;active.parent().andSelf().toggleClass(settings.selectedClass);if(!clickedActive){clicked.parent().andSelf().addClass(settings.selectedClass);}
var toShow=clicked.next(),toHide=active.next(),data=[clicked,active,toShow,toHide],down=headers.index(active[0])>headers.index(clicked[0]);active=clickedActive?$([]):clicked;toggle(toShow,toHide,data,clickedActive,down);return false;};function activateHandler(event,index){if(arguments.length==1)
return;clickHandler({target:findActive(index)[0]});};return container.bind(settings.event||"",clickHandler).bind("activate",activateHandler);},activate:function(index){return this.trigger('activate',[index]);},unaccordion:function(){return this.find("*").andSelf().unbind().end().end();}});})(jQuery);
(function($)
{$.ui=$.ui||{};$.fn.dialog=function(o){return this.dialogInit(o).dialogOpen();}
$.fn.dialogInit=function(o){return this.each(function(){if(!$(this).is(".ui-dialog-content")){new $.ui.dialogInit(this,o);}});}
$.fn.dialogOpen=function(){return this.each(function(){var contentEl;if($(this).parents(".ui-dialog").length)contentEl=this;if(!contentEl&&$(this).is(".ui-dialog"))contentEl=$('.ui-dialog-content',this)[0];$.ui.dialogOpen(contentEl)});}
$.fn.dialogClose=function(){return this.each(function(){var contentEl;var closeEl=$(this);if(closeEl.is('.ui-dialog-content')){var contentEl=closeEl;}else if(closeEl.hasClass('ui-dialog')){contentEl=closeEl.find('.ui-dialog-content');}else{contentEl=closeEl.parents('.ui-dialog:first').find('.ui-dialog-content');}
$.ui.dialogClose(contentEl[0]);});}
$.ui.dialogInit=function(el,o){var options={width:300,height:200,minWidth:150,minHeight:100,position:'center',buttons:[],draggable:true,resizable:true};var o=o||{};$.extend(options,o);this.element=el;var self=this;$.data(this.element,"ui-dialog",this);var uiDialogContent=$(el).addClass('ui-dialog-content');if(!uiDialogContent.parent().length){uiDialogContent.appendTo('body');}
uiDialogContent.wrap(document.createElement('div')).wrap(document.createElement('div'));var uiDialogContainer=uiDialogContent.parent().addClass('ui-dialog-container').css({position:'relative'});var uiDialog=uiDialogContainer.parent().hide().addClass('ui-dialog').css({position:'absolute',width:options.width,height:options.height,overflow:'hidden'});var classNames=uiDialogContent.attr('className').split(' ');$.each(classNames,function(i,className){if(className!='ui-dialog-content')
uiDialog.addClass(className);});if(options.resizable){uiDialog.append("<div class='ui-resizable-n ui-resizable-handle'></div>").append("<div class='ui-resizable-s ui-resizable-handle'></div>").append("<div class='ui-resizable-e ui-resizable-handle'></div>").append("<div class='ui-resizable-w ui-resizable-handle'></div>").append("<div class='ui-resizable-ne ui-resizable-handle'></div>").append("<div class='ui-resizable-se ui-resizable-handle'></div>").append("<div class='ui-resizable-sw ui-resizable-handle'></div>").append("<div class='ui-resizable-nw ui-resizable-handle'></div>");uiDialog.resizable({maxWidth:options.maxWidth,maxHeight:options.maxHeight,minWidth:options.minWidth,minHeight:options.minHeight});}
uiDialogContainer.prepend('<div class="ui-dialog-titlebar"></div>');var uiDialogTitlebar=$('.ui-dialog-titlebar',uiDialogContainer);var title=(options.title)?options.title:(uiDialogContent.attr('title'))?uiDialogContent.attr('title'):'';uiDialogTitlebar.append('<span class="ui-dialog-title">'+title+'</span>');uiDialogTitlebar.append('<div class="ui-dialog-titlebar-close"></div>');$('.ui-dialog-titlebar-close',uiDialogTitlebar).hover(function(){$(this).addClass('ui-dialog-titlebar-close-hover');},function(){$(this).removeClass('ui-dialog-titlebar-close-hover');}).mousedown(function(ev){ev.stopPropagation();}).click(function(){self.close();});var l=0;$.each(options.buttons,function(){l=1;return false;});if(l==1){uiDialog.append('<div class="ui-dialog-buttonpane"></div>');var uiDialogButtonPane=$('.ui-dialog-buttonpane',uiDialog);$.each(options.buttons,function(name,value){var btn=$(document.createElement('button')).text(name).click(value);uiDialogButtonPane.append(btn);});}
if(options.draggable){uiDialog.draggable({handle:'.ui-dialog-titlebar'});}
this.open=function(){uiDialog.appendTo('body');var wnd=$(window),doc=$(document),top=doc.scrollTop(),left=doc.scrollLeft();if(options.position.constructor==Array){top+=options.position[1];left+=options.position[0];}else{switch(options.position){case'center':top+=(wnd.height()/2)-(uiDialog.height()/2);left+=(wnd.width()/2)-(uiDialog.width()/2);break;case'top':top+=0;left+=(wnd.width()/2)-(uiDialog.width()/2);break;case'right':top+=(wnd.height()/2)-(uiDialog.height()/2);left+=(wnd.width())-(uiDialog.width());break;case'bottom':top+=(wnd.height())-(uiDialog.height());left+=(wnd.width()/2)-(uiDialog.width()/2);break;case'left':top+=(wnd.height()/2)-(uiDialog.height()/2);left+=0;break;default:top+=(wnd.height()/2)-(uiDialog.height()/2);left+=(wnd.width()/2)-(uiDialog.width()/2);}}
top=top<doc.scrollTop()?doc.scrollTop():top;uiDialog.css({top:top,left:left});uiDialog.show();var openEV=null;var openUI={options:options};$(this.element).triggerHandler("dialogopen",[openEV,openUI],options.open);};this.close=function(){uiDialog.hide();var closeEV=null;var closeUI={options:options};$(this.element).triggerHandler("dialogclose",[closeEV,closeUI],options.close);};}
$.ui.dialogOpen=function(el){$.data(el,"ui-dialog").open();}
$.ui.dialogClose=function(el){$.data(el,"ui-dialog").close();}})(jQuery);
(function($){if(window['webforms']){$(document).ready(function(){$("input").each(function(){if(this.getAttribute("type")=="range"){var cur=$(this);var slider=$("<div class='ui-slider'></div>").css({width:cur.innerWidth()+"px",height:cur.innerHeight()+"px"}).insertAfter(cur);var handle=$("<div class='ui-slider-handle'></div>").appendTo(slider);slider.css({"position":cur.css("position")=="absolute"?"absolute":"relative","left":cur.css("left"),"right":cur.css("right"),"zIndex":cur.css("zIndex"),"float":cur.css("float"),"clear":cur.css("clear")});cur.css({position:"absolute",opacity:0,top:"-1000px",left:"-1000px"});slider.slider({maxValue:cur.attr("max"),minValue:cur.attr("min"),startValue:this.getAttribute("value"),stepping:cur.attr("step"),change:function(e,ui){cur[0].value=ui.value;cur[0].setAttribute("value",ui.value);}});slider=slider.sliderInstance();cur.bind("keydown",function(e){var o=slider.interaction.options;switch(e.keyCode){case 37:slider.moveTo(slider.interaction.curValue+o.minValue-(o.stepping||1));break;case 39:slider.moveTo(slider.interaction.curValue+o.minValue+(o.stepping||1));break;}
if(e.keyCode!=9)return false;});};});});}
$.extend($.expr[':'],{slider:"(' '+a.className+' ').indexOf(' ui-slider ') != -1"});$.fn.slider=function(o){return this.each(function(){new $.ui.slider(this,o);});}
var methods="destroy,enable,disable,moveTo".split(",");for(var i=0;i<methods.length;i++){var cur=methods[i],f;eval('f = function() { var a = arguments; return this.each(function() { if(jQuery(this).is(".ui-slider")) jQuery.data(this, "ui-slider")["'+cur+'"](a); }); }');$.fn["slider"+cur.substr(0,1).toUpperCase()+cur.substr(1)]=f;};$.fn.sliderInstance=function(){if($(this[0]).is(".ui-slider"))return $.data(this[0],"ui-slider");return false;};$.ui.slider=function(el,o){var options={};o=o||{};$.extend(options,o);$.extend(options,{axis:o.axis||(el.offsetWidth<el.offsetHeight?'vertical':'horizontal'),maxValue:parseInt(o.maxValue)||100,minValue:parseInt(o.minValue)||0,startValue:parseInt(o.startValue)||0,_start:function(h,p,c,t,e){self.start.apply(t,[self,e]);},_beforeStop:function(h,p,c,t,e){self.stop.apply(t,[self,e]);},_drag:function(h,p,c,t,e){self.drag.apply(t,[self,e]);},startCondition:function(){return!self.disabled;}});var self=this;var o=options;$.data(el,"ui-slider",this);o.stepping=parseInt(o.stepping)||(o.steps?o.maxValue/o.steps:0);o.realValue=(o.maxValue-o.minValue);this.handle=options.handle?$(options.handle,el):$('.ui-slider-handle',el);if(this.handle.length==1){this.interaction=new $.ui.mouseInteraction(this.handle[0],options);this.multipleHandles=false;}else{this.interactions=[];this.handle.each(function(){self.interactions.push(new $.ui.mouseInteraction(this,options));});this.multipleHandles=true;}
this.element=el;$(this.element).addClass("ui-slider");if(o.axis=='horizontal'){this.parentSize=$(this.element).outerWidth()-this.handle.outerWidth();this.prop='left';}
if(o.axis=='vertical'){this.parentSize=$(this.element).outerHeight()-this.handle.outerHeight();this.prop='top';}
if(!this.multipleHandles){$(el).bind('click',function(e){self.click.apply(self,[e]);});if(!isNaN(o.startValue))this.moveTo(o.startValue,options.realValue,null,false);}}
$.extend($.ui.slider.prototype,{currentTarget:null,lastTarget:null,destroy:function(){$(this.element).removeClass("ui-slider").removeClass("ui-slider-disabled");this.interaction.destroy();},enable:function(){$(this.element).removeClass("ui-slider-disabled");this.disabled=false;},disable:function(){$(this.element).addClass("ui-slider-disabled");this.disabled=true;},nonvalidRange:function(self){for(var i=0;i<this.interactions.length;i++){if(self==this.interactions[i]){if(this.interactions[i-1]){if(this.interactions[i-1].curValue>this.interactions[i].curValue)return this.interactions[i-1].curValue;}
if(this.interactions[i+1]){if(this.interactions[i+1].curValue<this.interactions[i].curValue)return this.interactions[i+1].curValue;}}}
return false;},prepareCallbackObj:function(self,m){var cur=this;var func=function(){var retVal=[];for(var i=0;i<cur.interactions.length;i++){retVal.push((cur.interactions[i].curValue||0)+self.options.minValue);}
return retVal;};return{handle:self.helper,pixel:m,value:self.curValue+self.options.minValue,values:this.multipleHandles?func():self.curValue+self.options.minValue,slider:self}},click:function(e){var o=this.interaction.options;var pointer=[e.pageX,e.pageY];var offset=$(this.interaction.element).offsetParent().offset({border:false});if(this.interaction.element==e.target||this.disabled)return;this.interaction.pickValue=this.interaction.curValue;this.drag.apply(this.interaction,[this,e,[pointer[0]-offset.left-this.handle[0].offsetWidth/2,pointer[1]-offset.top-this.handle[0].offsetHeight/2]]);if(this.interaction.pickValue!=this.interaction.curValue)
$(this.element).triggerHandler("slidechange",[e,this.prepareCallbackObj(this.interaction)],o.change);},start:function(that,e){var o=this.options;$(that.element).triggerHandler("slidestart",[e,that.prepareCallbackObj(this)],o.start);this.pickValue=this.curValue;return false;},stop:function(that,e){var o=this.options;$(that.element).triggerHandler("slidestop",[e,that.prepareCallbackObj(this)],o.stop);if(this.pickValue!=this.curValue)$(that.element).triggerHandler("slidechange",[e,that.prepareCallbackObj(this)],o.change);return false;},drag:function(that,e,pos){var o=this.options;this.pos=pos||[this.pos[0]-this.element.offsetWidth/2,this.pos[1]-this.element.offsetHeight/2];if(o.axis=='horizontal')var m=this.pos[0];if(o.axis=='vertical')var m=this.pos[1];var p=that.parentSize;var prop=that.prop;if(m<0)m=0;if(m>p)m=p;this.curValue=(Math.round((m/p)*o.realValue));if(o.stepping){this.curValue=Math.round(this.curValue/o.stepping)*o.stepping;m=((this.curValue)/o.realValue)*p;}
if(that.interactions){nonvalidRange=that.nonvalidRange(this);if(nonvalidRange){this.curValue=nonvalidRange;m=((this.curValue)/o.realValue)*p;}}
$(this.element).css(prop,m+'px');$(that.element).triggerHandler("slide",[e,that.prepareCallbackObj(this,m)],o.slide);return false;},moveTo:function(value,scale,changeslide,p){if(this.multipleHandles)return false;var o=this.interaction.options;var offset=$(this.interaction.element).offsetParent().offset({border:false});this.interaction.pickValue=this.interaction.curValue;value=value-o.minValue;var modifier=scale||o.realValue;if(!p)var p=this.parentSize;var prop=this.prop;var m=Math.round(((value)/modifier)*p);if(m<0)m=0;if(m>p)m=p;this.interaction.curValue=(Math.round((m/p)*o.realValue));if(o.stepping){this.interaction.curValue=Math.round(this.interaction.curValue/o.stepping)*o.stepping;m=((this.interaction.curValue)/o.realValue)*p;}
$(this.interaction.element).css(prop,m+'px');if(!changeslide&&this.interaction.pickValue!=this.interaction.curValue&&!p)
$(this.element).triggerHandler("slidechange",[null,this.prepareCallbackObj(this.interaction)],o.change);if(changeslide)
$(this.element).triggerHandler("slide",[null,this.prepareCallbackObj(this.interaction)],o.slide);}});})(jQuery);
(function($){$.ui=$.ui||{};$.fn.tabs=function(initial,options){if(initial&&initial.constructor==Object){options=initial;initial=null;}
options=options||{};initial=initial&&initial.constructor==Number&&--initial||0;return this.each(function(){new $.ui.tabs(this,$.extend(options,{initial:initial}));});};$.each(['Add','Remove','Enable','Disable','Click','Load','Href'],function(i,method){$.fn['tabs'+method]=function(){var args=arguments;return this.each(function(){var instance=$.ui.tabs.getInstance(this);instance[method.toLowerCase()].apply(instance,args);});};});$.fn.tabsSelected=function(){var selected=-1;if(this[0]){var instance=$.ui.tabs.getInstance(this[0]),$lis=$('li',this);selected=$lis.index($lis.filter('.'+instance.options.selectedClass)[0]);}
return selected>=0?++selected:-1;};$.ui.tabs=function(el,options){this.source=el;this.options=$.extend({initial:0,event:'click',disabled:[],cookie:null,unselected:false,unselect:options.unselected?true:false,spinner:'Loading&#8230;',cache:false,idPrefix:'ui-tabs-',ajaxOptions:{},fxSpeed:'normal',add:function(){},remove:function(){},enable:function(){},disable:function(){},click:function(){},hide:function(){},show:function(){},load:function(){},tabTemplate:'<li><a href="#{href}"><span>#{text}</span></a></li>',panelTemplate:'<div></div>',navClass:'ui-tabs-nav',selectedClass:'ui-tabs-selected',unselectClass:'ui-tabs-unselect',disabledClass:'ui-tabs-disabled',panelClass:'ui-tabs-panel',hideClass:'ui-tabs-hide',loadingClass:'ui-tabs-loading'},options);this.options.event+='.ui-tabs';this.options.cookie=$.cookie&&$.cookie.constructor==Function&&this.options.cookie;$.data(el,$.ui.tabs.INSTANCE_KEY,this);this.tabify(true);};$.ui.tabs.INSTANCE_KEY='ui_tabs_instance';$.ui.tabs.getInstance=function(el){return $.data(el,$.ui.tabs.INSTANCE_KEY);};$.extend($.ui.tabs.prototype,{tabId:function(a){return a.title?a.title.replace(/\s/g,'_'):this.options.idPrefix+$.data(a);},tabify:function(init){this.$tabs=$('a:first-child',this.source);this.$panels=$([]);var self=this,o=this.options;this.$tabs.each(function(i,a){if(a.hash&&a.hash.replace('#','')){self.$panels=self.$panels.add(a.hash);}
else if($(a).attr('href')!='#'){$.data(a,'href',a.href);var id=self.tabId(a);a.href='#'+id;self.$panels=self.$panels.add($('#'+id)[0]||$(o.panelTemplate).attr('id',id).addClass(o.panelClass).insertAfter(self.$panels[i-1]||self.source));}
else{o.disabled.push(i+1);}});if(init){$(this.source).hasClass(o.navClass)||$(this.source).addClass(o.navClass);this.$panels.each(function(){var $this=$(this);$this.hasClass(o.panelClass)||$this.addClass(o.panelClass);});for(var i=0,position;position=o.disabled[i];i++){this.disable(position);}
this.$tabs.each(function(i,a){if(location.hash){if(a.hash==location.hash){o.initial=i;if($.browser.msie||$.browser.opera){var $toShow=$(location.hash),toShowId=$toShow.attr('id');$toShow.attr('id','');setTimeout(function(){$toShow.attr('id',toShowId);},500);}
scrollTo(0,0);return false;}}else if(o.cookie){o.initial=parseInt($.cookie($.ui.tabs.INSTANCE_KEY+$.data(self.source)))||0;return false;}else if($(a).parent('li').hasClass(o.selectedClass)){o.initial=i;return false;}});var n=this.$tabs.length;while(this.$tabs.eq(o.initial).parent('li').hasClass(o.disabledClass)&&n){o.initial=++o.initial<this.$tabs.length?o.initial:0;n--;}
if(!n){o.unselected=o.unselect=true;}
var $lis=this.$tabs.parent('li');this.$panels.addClass(o.hideClass);$lis.removeClass(o.selectedClass);if(!o.unselected){this.$panels.eq(o.initial).show().removeClass(o.hideClass);$lis.eq(o.initial).addClass(o.selectedClass);}
var href=!o.unselected&&$.data(this.$tabs[o.initial],'href');if(href){this.load(o.initial+1,href);}}
var showAnim={},showSpeed=o.fxShowSpeed||o.fxSpeed,hideAnim={},hideSpeed=o.fxHideSpeed||o.fxSpeed;if(o.fxSlide||o.fxFade){if(o.fxSlide){showAnim['height']='show';hideAnim['height']='hide';}
if(o.fxFade){showAnim['opacity']='show';hideAnim['opacity']='hide';}}else{if(o.fxShow){showAnim=o.fxShow;}else{showAnim['min-width']=0;showSpeed=1;}
if(o.fxHide){hideAnim=o.fxHide;}else{hideAnim['min-width']=0;hideSpeed=1;}}
var resetCSS={display:'',overflow:'',height:''};if(!$.browser.msie){resetCSS['opacity']='';}
function hideTab(clicked,$hide,$show){$hide.animate(hideAnim,hideSpeed,function(){$hide.addClass(o.hideClass).css(resetCSS);if($.browser.msie&&hideAnim['opacity']){$hide[0].style.filter='';}
o.hide(clicked,$hide[0],$show&&$show[0]||null);if($show){showTab(clicked,$show,$hide);}});}
function showTab(clicked,$show,$hide){if(!(o.fxSlide||o.fxFade||o.fxShow)){$show.css('display','block');}
$show.animate(showAnim,showSpeed,function(){$show.removeClass(o.hideClass).css(resetCSS);if($.browser.msie&&showAnim['opacity']){$show[0].style.filter='';}
o.show(clicked,$show[0],$hide&&$hide[0]||null);});}
function switchTab(clicked,$hide,$show){$(clicked).parents('li:eq(0)').addClass(o.selectedClass).siblings().removeClass(o.selectedClass);hideTab(clicked,$hide,$show);}
this.$tabs.unbind(o.event).bind(o.event,function(){var $li=$(this).parent('li'),$hide=self.$panels.filter(':visible'),$show=$(this.hash);if(($li.hasClass(o.selectedClass)&&!o.unselect)||$li.hasClass(o.disabledClass)||o.click(this,$show[0],$hide[0])===false){this.blur();return false;}
if(o.cookie){$.cookie($.ui.tabs.INSTANCE_KEY+$.data(self.source),self.$tabs.index(this),o.cookie);}
if(o.unselect){if($li.hasClass(o.selectedClass)){$li.removeClass(o.selectedClass);self.$panels.stop();hideTab(this,$hide);this.blur();return false;}else if(!$hide.length){self.$panels.stop();if($.data(this,'href')){var a=this;self.load(self.$tabs.index(this)+1,$.data(this,'href'),function(){$li.addClass(o.selectedClass).addClass(o.unselectClass);showTab(a,$show);});}else{$li.addClass(o.selectedClass).addClass(o.unselectClass);showTab(this,$show);}
this.blur();return false;}}
self.$panels.stop();if($show.length){if($.data(this,'href')){var a=this;self.load(self.$tabs.index(this)+1,$.data(this,'href'),function(){switchTab(a,$hide,$show);});}else{switchTab(this,$hide,$show);}}else{throw'jQuery UI Tabs: Mismatching fragment identifier.';}
this.blur();return false;});},add:function(url,text,position){if(url&&text){position=position||this.$tabs.length;var o=this.options,$li=$(o.tabTemplate.replace(/#\{href\}/,url).replace(/#\{text\}/,text));var id=url.indexOf('#')==0?url.replace('#',''):this.tabId($('a:first-child',$li)[0]);var $panel=$('#'+id);$panel=$panel.length&&$panel||$(o.panelTemplate).attr('id',id).addClass(o.panelClass).addClass(o.hideClass);if(position>=this.$tabs.length){$li.appendTo(this.source);$panel.appendTo(this.source.parentNode);}else{$li.insertBefore(this.$tabs.eq(position-1).parent('li'));$panel.insertBefore(this.$panels[position-1]);}
this.tabify();if(this.$tabs.length==1){$li.addClass(o.selectedClass);$panel.removeClass(o.hideClass);var href=$.data(this.$tabs[0],'href');if(href){this.load(position+1,href);}}
o.add(this.$tabs[position],this.$panels[position]);}else{throw'jQuery UI Tabs: Not enough arguments to add tab.';}},remove:function(position){if(position&&position.constructor==Number){var o=this.options,$li=this.$tabs.eq(position-1).parent('li').remove(),$panel=this.$panels.eq(position-1).remove();if($li.hasClass(o.selectedClass)&&this.$tabs.length>1){this.click(position+(position<this.$tabs.length?1:-1));}
this.tabify();o.remove($li.end()[0],$panel[0]);}},enable:function(position){var o=this.options,$li=this.$tabs.eq(position-1).parent('li');$li.removeClass(o.disabledClass);if($.browser.safari){$li.css('display','inline-block');setTimeout(function(){$li.css('display','block')},0)}
o.enable(this.$tabs[position-1],this.$panels[position-1]);},disable:function(position){var o=this.options;this.$tabs.eq(position-1).parent('li').addClass(o.disabledClass);o.disable(this.$tabs[position-1],this.$panels[position-1]);},click:function(position){this.$tabs.eq(position-1).trigger(this.options.event);},load:function(position,url,callback){var self=this,o=this.options,$a=this.$tabs.eq(position-1),a=$a[0],$span=$('span',a);if(url&&url.constructor==Function){callback=url;url=null;}
if(url){$.data(a,'href',url);}else{url=$.data(a,'href');}
if(o.spinner){$.data(a,'title',$span.html());$span.html('<em>'+o.spinner+'</em>');}
var finish=function(){self.$tabs.filter('.'+o.loadingClass).each(function(){$(this).removeClass(o.loadingClass);if(o.spinner){$('span',this).html($.data(this,'title'));}});self.xhr=null;};var ajaxOptions=$.extend(o.ajaxOptions,{url:url,success:function(r){$(a.hash).html(r);finish();if(callback&&callback.constructor==Function){callback();}
if(o.cache){$.removeData(a,'href');}
o.load(self.$tabs[position-1],self.$panels[position-1]);}});if(this.xhr){this.xhr.abort();finish();}
$a.addClass(o.loadingClass);setTimeout(function(){self.xhr=$.ajax(ajaxOptions);},0);},href:function(position,href){$.data(this.$tabs.eq(position-1)[0],'href',href);}});})(jQuery);
