/*!
 * jQuery UI @VERSION
 *
 * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI
 */
!function(t,e){
// selectors
function n(e,n){var r=e.nodeName.toLowerCase();if("area"===r){var o,s=e.parentNode,u=s.name;return e.href&&u&&"map"===s.nodeName.toLowerCase()?(o=t("img[usemap=#"+u+"]")[0],!!o&&i(o)):!1}return(/input|select|textarea|button|object/.test(r)?!e.disabled:"a"==r?e.href||n:n)&&i(e)}function i(e){return!t(e).parents().andSelf().filter(function(){return"hidden"===t.curCSS(this,"visibility")||t.expr.filters.hidden(this)}).length}
// prevent duplicate loading
// this is only a problem because we proxy existing functions
// and we don't want to double proxy them
t.ui=t.ui||{},t.ui.version||(t.extend(t.ui,{version:"@VERSION",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,// COMMAND
COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,// COMMAND_RIGHT
NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}}),
// plugins
t.fn.extend({propAttr:t.fn.prop||t.fn.attr,_focus:t.fn.focus,focus:function(e,n){return"number"==typeof e?this.each(function(){var i=this;setTimeout(function(){t(i).focus(),n&&n.call(i)},e)}):this._focus.apply(this,arguments)},scrollParent:function(){var e;return e=t.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(t.curCSS(this,"position",1))&&/(auto|scroll)/.test(t.curCSS(this,"overflow",1)+t.curCSS(this,"overflow-y",1)+t.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(t.curCSS(this,"overflow",1)+t.curCSS(this,"overflow-y",1)+t.curCSS(this,"overflow-x",1))}).eq(0),/fixed/.test(this.css("position"))||!e.length?t(document):e},zIndex:function(n){if(n!==e)return this.css("zIndex",n);if(this.length)for(var i,r,o=t(this[0]);o.length&&o[0]!==document;){if(i=o.css("position"),("absolute"===i||"relative"===i||"fixed"===i)&&(r=parseInt(o.css("zIndex"),10),!isNaN(r)&&0!==r))return r;o=o.parent()}return 0},disableSelection:function(){return this.bind((t.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(t){t.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),t.each(["Width","Height"],function(n,i){function r(e,n,i,r){return t.each(o,function(){n-=parseFloat(t.curCSS(e,"padding"+this,!0))||0,i&&(n-=parseFloat(t.curCSS(e,"border"+this+"Width",!0))||0),r&&(n-=parseFloat(t.curCSS(e,"margin"+this,!0))||0)}),n}var o="Width"===i?["Left","Right"]:["Top","Bottom"],s=i.toLowerCase(),u={innerWidth:t.fn.innerWidth,innerHeight:t.fn.innerHeight,outerWidth:t.fn.outerWidth,outerHeight:t.fn.outerHeight};t.fn["inner"+i]=function(n){return n===e?u["inner"+i].call(this):this.each(function(){t(this).css(s,r(this,n)+"px")})},t.fn["outer"+i]=function(e,n){return"number"!=typeof e?u["outer"+i].call(this,e):this.each(function(){t(this).css(s,r(this,e,!0,n)+"px")})}}),t.extend(t.expr[":"],{data:function(e,n,i){return!!t.data(e,i[3])},focusable:function(e){return n(e,!isNaN(t.attr(e,"tabindex")))},tabbable:function(e){var i=t.attr(e,"tabindex"),r=isNaN(i);return(r||i>=0)&&n(e,!r)}}),
// support
t(function(){var e=document.body,n=e.appendChild(n=document.createElement("div"));
// access offsetHeight before setting the style to prevent a layout bug
// in IE 9 which causes the elemnt to continue to take up space even
// after it is removed from the DOM (#8026)
n.offsetHeight,t.extend(n.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0}),t.support.minHeight=100===n.offsetHeight,t.support.selectstart="onselectstart"in n,
// set display to none to avoid a layout bug in IE
// http://dev.jquery.com/ticket/4014
e.removeChild(n).style.display="none"}),
// deprecated
t.extend(t.ui,{
// $.ui.plugin is deprecated.  Use the proxy pattern instead.
plugin:{add:function(e,n,i){var r=t.ui[e].prototype;for(var o in i)r.plugins[o]=r.plugins[o]||[],r.plugins[o].push([n,i[o]])},call:function(t,e,n){var i=t.plugins[e];if(i&&t.element[0].parentNode)for(var r=0;r<i.length;r++)t.options[i[r][0]]&&i[r][1].apply(t.element,n)}},
// will be deprecated when we switch to jQuery 1.4 - use jQuery.contains()
contains:function(t,e){return document.compareDocumentPosition?16&t.compareDocumentPosition(e):t!==e&&t.contains(e)},
// only used by resizable
hasScroll:function(e,n){
//If overflow is hidden, the element might have extra content, but the user wants to hide it
if("hidden"===t(e).css("overflow"))return!1;var i=n&&"left"===n?"scrollLeft":"scrollTop",r=!1;
// TODO: determine which cases actually cause this to happen
// if the element doesn't have the scroll set, see if it's possible to
// set the scroll
return e[i]>0?!0:(e[i]=1,r=e[i]>0,e[i]=0,r)},
// these are odd functions, fix the API or move into individual plugins
isOverAxis:function(t,e,n){
//Determines when x coordinate is over "b" element axis
return t>e&&e+n>t},isOver:function(e,n,i,r,o,s){
//Determines when x, y coordinates is over "b" element
return t.ui.isOverAxis(e,i,o)&&t.ui.isOverAxis(n,r,s)}}))}(jQuery);

/*!
 * jQuery UI Widget @VERSION
 *
 * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Widget
 */
!function(t,e){
// jQuery 1.4+
if(t.cleanData){var i=t.cleanData;t.cleanData=function(e){for(var n,s=0;null!=(n=e[s]);s++)try{t(n).triggerHandler("remove")}catch(a){}i(e)}}else{var n=t.fn.remove;t.fn.remove=function(e,i){return this.each(function(){return i||e&&!t.filter(e,[this]).length||t("*",this).add([this]).each(function(){try{t(this).triggerHandler("remove")}catch(e){}}),n.call(t(this),e,i)})}}t.widget=function(e,i,n){var s,a=e.split(".")[0];e=e.split(".")[1],s=a+"-"+e,n||(n=i,i=t.Widget),t.expr[":"][s]=function(i){return!!t.data(i,e)},t[a]=t[a]||{},t[a][e]=function(t,e){arguments.length&&this._createWidget(t,e)};var r=new i;
// we need to make the options hash a property directly on the new instance
// otherwise we'll modify the options hash on the prototype that we're
// inheriting from
//	$.each( basePrototype, function( key, val ) {
//		if ( $.isPlainObject(val) ) {
//			basePrototype[ key ] = $.extend( {}, val );
//		}
//	});
r.options=t.extend(!0,{},r.options),t[a][e].prototype=t.extend(!0,r,{namespace:a,widgetName:e,widgetEventPrefix:t[a][e].prototype.widgetEventPrefix||e,widgetBaseClass:s},n),t.widget.bridge(e,t[a][e])},t.widget.bridge=function(i,n){t.fn[i]=function(s){var a="string"==typeof s,r=Array.prototype.slice.call(arguments,1),o=this;
// prevent calls to internal methods
// allow multiple hashes to be passed on init
// prevent calls to internal methods
return s=!a&&r.length?t.extend.apply(null,[!0,s].concat(r)):s,a&&"_"===s.charAt(0)?o:(a?this.each(function(){var n=t.data(this,i),a=n&&t.isFunction(n[s])?n[s].apply(n,r):n;return a!==n&&a!==e?(o=a,!1):void 0}):this.each(function(){var e=t.data(this,i);e?e.option(s||{})._init():t.data(this,i,new n(s,this))}),o)}},t.Widget=function(t,e){
// allow instantiation without initializing for simple inheritance
arguments.length&&this._createWidget(t,e)},t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:!1},_createWidget:function(e,i){
// $.widget.bridge stores the plugin instance, but we do it anyway
// so that it's stored even before the _create function runs
t.data(i,this.widgetName,this),this.element=t(i),this.options=t.extend(!0,{},this.options,this._getCreateOptions(),e);var n=this;this.element.bind("remove."+this.widgetName,function(){n.destroy()}),this._create(),this._trigger("create"),this._init()},_getCreateOptions:function(){return t.metadata&&t.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName),this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")},widget:function(){return this.element},option:function(i,n){var s=i;if(0===arguments.length)
// don't return a reference to the internal hash
return t.extend({},this.options);if("string"==typeof i){if(n===e)return this.options[i];s={},s[i]=n}return this._setOptions(s),this},_setOptions:function(e){var i=this;return t.each(e,function(t,e){i._setOption(t,e)}),this},_setOption:function(t,e){return this.options[t]=e,"disabled"===t&&this.widget()[e?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",e),this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_trigger:function(e,i,n){var s,a,r=this.options[e];if(n=n||{},i=t.Event(i),i.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase(),i.target=this.element[0],a=i.originalEvent)for(s in a)s in i||(i[s]=a[s]);return this.element.trigger(i,n),!(t.isFunction(r)&&r.call(this.element[0],i,n)===!1||i.isDefaultPrevented())}}}(jQuery);

/*!
 * jQuery UI Mouse @VERSION
 *
 * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Mouse
 *
 * Depends:
 *	jquery.ui.widget.js
 */
!function(e,t){var s=!1;e(document).mouseup(function(e){s=!1}),e.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.bind("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).bind("click."+this.widgetName,function(s){return!0===e.data(s.target,t.widgetName+".preventClickEvent")?(e.removeData(s.target,t.widgetName+".preventClickEvent"),s.stopImmediatePropagation(),!1):void 0}),this.started=!1},
// TODO: make sure destroying one instance of mouse doesn't mess with
// other instances of mouse
_mouseDestroy:function(){this.element.unbind("."+this.widgetName),e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(t){
// don't let more than one widget handle mouseStart
if(!s){
// we may have missed mouseup (out of window)
this._mouseStarted&&this._mouseUp(t),this._mouseDownEvent=t;var o=this,i=1==t.which,
// event.target.nodeName works around a bug in IE 8 with
// disabled inputs (#7620)
n="string"==typeof this.options.cancel&&t.target.nodeName?e(t.target).closest(this.options.cancel).length:!1;
// Click event may never have fired (Gecko & Opera)
// these delegates are required to keep context
return i&&!n&&this._mouseCapture(t)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){o.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(t)!==!1,!this._mouseStarted)?(t.preventDefault(),!0):(!0===e.data(t.target,this.widgetName+".preventClickEvent")&&e.removeData(t.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return o._mouseMove(e)},this._mouseUpDelegate=function(e){return o._mouseUp(e)},e(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),t.preventDefault(),s=!0,!0)):!0}},_mouseMove:function(t){
// IE mouseup check - mouseup happened when mouse was out of window
// IE mouseup check - mouseup happened when mouse was out of window
return!e.browser.msie||document.documentMode>=9||t.button?this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,t)!==!1,this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted):this._mouseUp(t)},_mouseUp:function(t){return e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target==this._mouseDownEvent.target&&e.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),!1},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(e){return this.mouseDelayMet},
// These are placeholder methods, to be overriden by extending plugin
_mouseStart:function(e){},_mouseDrag:function(e){},_mouseStop:function(e){},_mouseCapture:function(e){return!0}})}(jQuery);

/*!
 * jQuery UI Position @VERSION
 *
 * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Position
 */
!function(t,e){t.ui=t.ui||{};var o=/left|center|right/,i=/top|center|bottom/,n="center",l={},f=t.fn.position,s=t.fn.offset;t.fn.position=function(e){if(!e||!e.of)return f.apply(this,arguments);
// make a copy, we don't want to modify arguments
e=t.extend({},e);var s,r,a,p=t(e.of),h=p[0],c=(e.collision||"flip").split(" "),u=e.offset?e.offset.split(" "):[0,0];
// force left top to allow flipping
// force my and at to have valid horizontal and veritcal positions
// if a value is missing or invalid, it will be converted to center 
// normalize collision option
// normalize offset option
return 9===h.nodeType?(s=p.width(),r=p.height(),a={top:0,left:0}):h.setTimeout?(s=p.width(),r=p.height(),a={top:p.scrollTop(),left:p.scrollLeft()}):h.preventDefault?(e.at="left top",s=r=0,a={top:e.of.pageY,left:e.of.pageX}):(s=p.outerWidth(),r=p.outerHeight(),a=p.offset()),t.each(["my","at"],function(){var t=(e[this]||"").split(" ");1===t.length&&(t=o.test(t[0])?t.concat([n]):i.test(t[0])?[n].concat(t):[n,n]),t[0]=o.test(t[0])?t[0]:n,t[1]=i.test(t[1])?t[1]:n,e[this]=t}),1===c.length&&(c[1]=c[0]),u[0]=parseInt(u[0],10)||0,1===u.length&&(u[1]=u[0]),u[1]=parseInt(u[1],10)||0,"right"===e.at[0]?a.left+=s:e.at[0]===n&&(a.left+=s/2),"bottom"===e.at[1]?a.top+=r:e.at[1]===n&&(a.top+=r/2),a.left+=u[0],a.top+=u[1],this.each(function(){var o,i=t(this),f=i.outerWidth(),p=i.outerHeight(),h=parseInt(t.curCSS(this,"marginLeft",!0))||0,g=parseInt(t.curCSS(this,"marginTop",!0))||0,d=f+h+(parseInt(t.curCSS(this,"marginRight",!0))||0),m=p+g+(parseInt(t.curCSS(this,"marginBottom",!0))||0),y=t.extend({},a);"right"===e.my[0]?y.left-=f:e.my[0]===n&&(y.left-=f/2),"bottom"===e.my[1]?y.top-=p:e.my[1]===n&&(y.top-=p/2),
// prevent fractions if jQuery version doesn't support them (see #5280)
l.fractions||(y.left=Math.round(y.left),y.top=Math.round(y.top)),o={left:y.left-h,top:y.top-g},t.each(["left","top"],function(i,n){t.ui.position[c[i]]&&t.ui.position[c[i]][n](y,{targetWidth:s,targetHeight:r,elemWidth:f,elemHeight:p,collisionPosition:o,collisionWidth:d,collisionHeight:m,offset:u,my:e.my,at:e.at})}),t.fn.bgiframe&&i.bgiframe(),i.offset(t.extend(y,{using:e.using}))})},t.ui.position={fit:{left:function(e,o){var i=t(window),n=o.collisionPosition.left+o.collisionWidth-i.width()-i.scrollLeft();e.left=n>0?e.left-n:Math.max(e.left-o.collisionPosition.left,e.left)},top:function(e,o){var i=t(window),n=o.collisionPosition.top+o.collisionHeight-i.height()-i.scrollTop();e.top=n>0?e.top-n:Math.max(e.top-o.collisionPosition.top,e.top)}},flip:{left:function(e,o){if(o.at[0]!==n){var i=t(window),l=o.collisionPosition.left+o.collisionWidth-i.width()-i.scrollLeft(),f="left"===o.my[0]?-o.elemWidth:"right"===o.my[0]?o.elemWidth:0,s="left"===o.at[0]?o.targetWidth:-o.targetWidth,r=-2*o.offset[0];e.left+=o.collisionPosition.left<0?f+s+r:l>0?f+s+r:0}},top:function(e,o){if(o.at[1]!==n){var i=t(window),l=o.collisionPosition.top+o.collisionHeight-i.height()-i.scrollTop(),f="top"===o.my[1]?-o.elemHeight:"bottom"===o.my[1]?o.elemHeight:0,s="top"===o.at[1]?o.targetHeight:-o.targetHeight,r=-2*o.offset[1];e.top+=o.collisionPosition.top<0?f+s+r:l>0?f+s+r:0}}}},
// offset setter from jQuery 1.4
t.offset.setOffset||(t.offset.setOffset=function(e,o){
// set position first, in-case top/left are set even on static elem
/static/.test(t.curCSS(e,"position"))&&(e.style.position="relative");var i=t(e),n=i.offset(),l=parseInt(t.curCSS(e,"top",!0),10)||0,f=parseInt(t.curCSS(e,"left",!0),10)||0,s={top:o.top-n.top+l,left:o.left-n.left+f};"using"in o?o.using.call(e,s):i.css(s)},t.fn.offset=function(e){var o=this[0];return o&&o.ownerDocument?e?this.each(function(){t.offset.setOffset(this,e)}):s.call(this):null}),
// fraction support test (older versions of jQuery don't support fractions)
function(){var e,o,i,n,f,s=document.getElementsByTagName("body")[0],r=document.createElement("div");e=document.createElement(s?"div":"body"),i={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},s&&t.extend(i,{position:"absolute",left:"-1000px",top:"-1000px"});for(var a in i)e.style[a]=i[a];e.appendChild(r),o=s||document.documentElement,o.insertBefore(e,o.firstChild),r.style.cssText="position: absolute; left: 10.7432222px; top: 10.432325px; height: 30px; width: 201px;",n=t(r).offset(function(t,e){return e}).offset(),e.innerHTML="",o.removeChild(e),f=n.top+n.left+(s?2e3:0),l.fractions=f>21&&22>f}()}(jQuery);

/*!
 * jQuery UI Draggable @VERSION
 *
 * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Draggables
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.mouse.js
 *	jquery.ui.widget.js
 */
!function(t,e){t.widget("ui.draggable",t.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1},_create:function(){"original"!=this.options.helper||/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative"),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._mouseInit()},destroy:function(){return this.element.data("draggable")?(this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._mouseDestroy(),this):void 0},_mouseCapture:function(e){var s=this.options;
// among others, prevent a drag on a resizable-handle
// among others, prevent a drag on a resizable-handle
//Quit if we're not on a valid handle
return this.helper||s.disabled||t(e.target).is(".ui-resizable-handle")?!1:(this.handle=this._getHandle(e),this.handle?(s.iframeFix&&t(s.iframeFix===!0?"iframe":s.iframeFix).each(function(){t('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1e3}).css(t(this).offset()).appendTo("body")}),!0):!1)},_mouseStart:function(e){var s=this.options;
//Trigger event + callbacks
//Create and append the visible helper
//Cache the helper size
//If ddmanager is used for droppables, set the global draggable
/*
		 * - Position generation -
		 * This block generates everything position related - it's the core of draggables.
		 */
//Cache the margins of the original element
//Store the helper's css position
//The element's absolute position on the page minus margins
//Generate the original position
//Adjust the mouse offset relative to the helper if 'cursorAt' is supplied
//Set a containment if given in the options
//Trigger event + callbacks
//Recache the helper size
//Prepare the droppable offsets
//Execute the drag once - this causes the helper not to be visible before getting its correct position
//If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003)
return this.helper=this._createHelper(e),this._cacheHelperProportions(),t.ui.ddmanager&&(t.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(),this.offset=this.positionAbs=this.element.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},t.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.originalPosition=this.position=this._generatePosition(e),this.originalPageX=e.pageX,this.originalPageY=e.pageY,s.cursorAt&&this._adjustOffsetFromHelper(s.cursorAt),s.containment&&this._setContainment(),this._trigger("start",e)===!1?(this._clear(),!1):(this._cacheHelperProportions(),t.ui.ddmanager&&!s.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this.helper.addClass("ui-draggable-dragging"),this._mouseDrag(e,!0),t.ui.ddmanager&&t.ui.ddmanager.dragStart(this,e),!0)},_mouseDrag:function(e,s){
//Call plugins and callbacks and use the resulting position if something is returned
if(
//Compute the helpers position
this.position=this._generatePosition(e),this.positionAbs=this._convertPositionTo("absolute"),!s){var i=this._uiHash();if(this._trigger("drag",e,i)===!1)return this._mouseUp({}),!1;this.position=i.position}return this.options.axis&&"y"==this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"==this.options.axis||(this.helper[0].style.top=this.position.top+"px"),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),!1},_mouseStop:function(e){
//If we are using droppables, inform the manager about the drop
var s=!1;t.ui.ddmanager&&!this.options.dropBehaviour&&(s=t.ui.ddmanager.drop(this,e)),
//if a drop comes from outside (a sortable)
this.dropped&&(s=this.dropped,this.dropped=!1);for(
//if the original element is no longer in the DOM don't bother to continue (see #8269)
var i=this.element[0],o=!1;i&&(i=i.parentNode);)i==document&&(o=!0);if(!o&&"original"===this.options.helper)return!1;if("invalid"==this.options.revert&&!s||"valid"==this.options.revert&&s||this.options.revert===!0||t.isFunction(this.options.revert)&&this.options.revert.call(this.element,s)){var n=this;t(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){n._trigger("stop",e)!==!1&&n._clear()})}else this._trigger("stop",e)!==!1&&this._clear();return!1},_mouseUp:function(e){
//If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003)
return this.options.iframeFix===!0&&t("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)}),t.ui.ddmanager&&t.ui.ddmanager.dragStop(this,e),t.ui.mouse.prototype._mouseUp.call(this,e)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(e){var s=!this.options.handle||!t(this.options.handle,this.element).length;return t(this.options.handle,this.element).find("*").andSelf().each(function(){this==e.target&&(s=!0)}),s},_createHelper:function(e){var s=this.options,i=t.isFunction(s.helper)?t(s.helper.apply(this.element[0],[e])):"clone"==s.helper?this.element.clone().removeAttr("id"):this.element;return i.parents("body").length||i.appendTo("parent"==s.appendTo?this.element[0].parentNode:s.appendTo),i[0]==this.element[0]||/(fixed|absolute)/.test(i.css("position"))||i.css("position","absolute"),i},_adjustOffsetFromHelper:function(e){"string"==typeof e&&(e=e.split(" ")),t.isArray(e)&&(e={left:+e[0],top:+e[1]||0}),"left"in e&&(this.offset.click.left=e.left+this.margins.left),"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left),"top"in e&&(this.offset.click.top=e.top+this.margins.top),"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)},_getParentOffset:function(){
//Get the offsetParent and cache its position
this.offsetParent=this.helper.offsetParent();var e=this.offsetParent.offset();
// This is a special case where we need to modify a offset calculated on start, since the following happened:
// 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
// 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
//    the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
//Ugly IE fix
return"absolute"==this.cssPosition&&this.scrollParent[0]!=document&&t.ui.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&"html"==this.offsetParent[0].tagName.toLowerCase()&&t.browser.msie)&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"==this.cssPosition){var t=this.element.position();return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:t.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e=this.options;if("parent"==e.containment&&(e.containment=this.helper[0].parentNode),"document"!=e.containment&&"window"!=e.containment||(this.containment=["document"==e.containment?0:t(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,"document"==e.containment?0:t(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,("document"==e.containment?0:t(window).scrollLeft())+t("document"==e.containment?document:window).width()-this.helperProportions.width-this.margins.left,("document"==e.containment?0:t(window).scrollTop())+(t("document"==e.containment?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(e.containment)||e.containment.constructor==Array)e.containment.constructor==Array&&(this.containment=e.containment);else{var s=t(e.containment),i=s[0];if(!i)return;var o=(s.offset(),"hidden"!=t(i).css("overflow"));this.containment=[(parseInt(t(i).css("borderLeftWidth"),10)||0)+(parseInt(t(i).css("paddingLeft"),10)||0),(parseInt(t(i).css("borderTopWidth"),10)||0)+(parseInt(t(i).css("paddingTop"),10)||0),(o?Math.max(i.scrollWidth,i.offsetWidth):i.offsetWidth)-(parseInt(t(i).css("borderLeftWidth"),10)||0)-(parseInt(t(i).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(o?Math.max(i.scrollHeight,i.offsetHeight):i.offsetHeight)-(parseInt(t(i).css("borderTopWidth"),10)||0)-(parseInt(t(i).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relative_container=s}},_convertPositionTo:function(e,s){s||(s=this.position);var i="absolute"==e?1:-1,o=(this.options,"absolute"!=this.cssPosition||this.scrollParent[0]!=document&&t.ui.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent),n=/(html|body)/i.test(o[0].tagName);return{top:s.top+this.offset.relative.top*i+this.offset.parent.top*i-(t.browser.safari&&t.browser.version<526&&"fixed"==this.cssPosition?0:("fixed"==this.cssPosition?-this.scrollParent.scrollTop():n?0:o.scrollTop())*i),left:s.left+this.offset.relative.left*i+this.offset.parent.left*i-(t.browser.safari&&t.browser.version<526&&"fixed"==this.cssPosition?0:("fixed"==this.cssPosition?-this.scrollParent.scrollLeft():n?0:o.scrollLeft())*i)}},_generatePosition:function(e){var s=this.options,i="absolute"!=this.cssPosition||this.scrollParent[0]!=document&&t.ui.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,o=/(html|body)/i.test(i[0].tagName),n=e.pageX,r=e.pageY;/*
		 * - Position constraining -
		 * Constrain the position to a mix of grid, containment.
		 */
if(this.originalPosition){//If we are not dragging yet, we won't check for options
var a;if(this.containment){if(this.relative_container){var l=this.relative_container.offset();a=[this.containment[0]+l.left,this.containment[1]+l.top,this.containment[2]+l.left,this.containment[3]+l.top]}else a=this.containment;e.pageX-this.offset.click.left<a[0]&&(n=a[0]+this.offset.click.left),e.pageY-this.offset.click.top<a[1]&&(r=a[1]+this.offset.click.top),e.pageX-this.offset.click.left>a[2]&&(n=a[2]+this.offset.click.left),e.pageY-this.offset.click.top>a[3]&&(r=a[3]+this.offset.click.top)}if(s.grid){
//Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950)
var h=s.grid[1]?this.originalPageY+Math.round((r-this.originalPageY)/s.grid[1])*s.grid[1]:this.originalPageY;r=a&&(h-this.offset.click.top<a[1]||h-this.offset.click.top>a[3])?h-this.offset.click.top<a[1]?h+s.grid[1]:h-s.grid[1]:h;var c=s.grid[0]?this.originalPageX+Math.round((n-this.originalPageX)/s.grid[0])*s.grid[0]:this.originalPageX;n=a&&(c-this.offset.click.left<a[0]||c-this.offset.click.left>a[2])?c-this.offset.click.left<a[0]?c+s.grid[0]:c-s.grid[0]:c}}return{top:r-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(t.browser.safari&&t.browser.version<526&&"fixed"==this.cssPosition?0:"fixed"==this.cssPosition?-this.scrollParent.scrollTop():o?0:i.scrollTop()),left:n-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(t.browser.safari&&t.browser.version<526&&"fixed"==this.cssPosition?0:"fixed"==this.cssPosition?-this.scrollParent.scrollLeft():o?0:i.scrollLeft())}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]==this.element[0]||this.cancelHelperRemoval||this.helper.remove(),
//if($.ui.ddmanager) $.ui.ddmanager.current = null;
this.helper=null,this.cancelHelperRemoval=!1},
// From now on bulk stuff - mainly helpers
_trigger:function(e,s,i){//The absolute position has to be recalculated after plugins
return i=i||this._uiHash(),t.ui.plugin.call(this,e,[s,i]),"drag"==e&&(this.positionAbs=this._convertPositionTo("absolute")),t.Widget.prototype._trigger.call(this,e,s,i)},plugins:{},_uiHash:function(t){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),t.extend(t.ui.draggable,{version:"@VERSION"}),t.ui.plugin.add("draggable","connectToSortable",{start:function(e,s){var i=t(this).data("draggable"),o=i.options,n=t.extend({},s,{item:i.element});i.sortables=[],t(o.connectToSortable).each(function(){var s=t.data(this,"sortable");s&&!s.options.disabled&&(i.sortables.push({instance:s,shouldRevert:s.options.revert}),s.refreshPositions(),// Call the sortable's refreshPositions at drag start to refresh the containerCache since the sortable container cache is used in drag and needs to be up to date (this will ensure it's initialised as well as being kept in step with any changes that might have happened on the page).
s._trigger("activate",e,n))})},stop:function(e,s){
//If we are still over the sortable, we fake the stop event of the sortable, but also remove helper
var i=t(this).data("draggable"),o=t.extend({},s,{item:i.element});t.each(i.sortables,function(){this.instance.isOver?(this.instance.isOver=0,i.cancelHelperRemoval=!0,//Don't remove the helper in the draggable instance
this.instance.cancelHelperRemoval=!1,//Remove it in the sortable instance (so sortable plugins like revert still work)
//The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert: 'valid/invalid'
this.shouldRevert&&(this.instance.options.revert=!0),
//Trigger the stop of the sortable
this.instance._mouseStop(e),this.instance.options.helper=this.instance.options._helper,
//If the helper has been the original item, restore properties in the sortable
"original"==i.options.helper&&this.instance.currentItem.css({top:"auto",left:"auto"})):(this.instance.cancelHelperRemoval=!1,//Remove the helper in the sortable instance
this.instance._trigger("deactivate",e,o))})},drag:function(e,s){var i=t(this).data("draggable"),o=this;t.each(i.sortables,function(n){
//Copy over some variables to allow calling the sortable's native _intersectsWith
this.instance.positionAbs=i.positionAbs,this.instance.helperProportions=i.helperProportions,this.instance.offset.click=i.offset.click,this.instance._intersectsWith(this.instance.containerCache)?(
//If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once
this.instance.isOver||(this.instance.isOver=1,
//Now we fake the start of dragging for the sortable instance,
//by cloning the list group item, appending it to the sortable and using it as inst.currentItem
//We can then fire the start event of the sortable with our passed browser event, and our own helper (so it doesn't create a new one)
this.instance.currentItem=t(o).clone().removeAttr("id").appendTo(this.instance.element).data("sortable-item",!0),this.instance.options._helper=this.instance.options.helper,//Store helper option to later restore it
this.instance.options.helper=function(){return s.helper[0]},e.target=this.instance.currentItem[0],this.instance._mouseCapture(e,!0),this.instance._mouseStart(e,!0,!0),
//Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes
this.instance.offset.click.top=i.offset.click.top,this.instance.offset.click.left=i.offset.click.left,this.instance.offset.parent.left-=i.offset.parent.left-this.instance.offset.parent.left,this.instance.offset.parent.top-=i.offset.parent.top-this.instance.offset.parent.top,i._trigger("toSortable",e),i.dropped=this.instance.element,//draggable revert needs that
//hack so receive/update callbacks work (mostly)
i.currentItem=i.element,this.instance.fromOutside=i),
//Provided we did all the previous steps, we can fire the drag event of the sortable on every draggable drag, when it intersects with the sortable
this.instance.currentItem&&this.instance._mouseDrag(e)):
//If it doesn't intersect with the sortable, and it intersected before,
//we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval
this.instance.isOver&&(this.instance.isOver=0,this.instance.cancelHelperRemoval=!0,
//Prevent reverting on this forced stop
this.instance.options.revert=!1,
// The out event needs to be triggered independently
this.instance._trigger("out",e,this.instance._uiHash(this.instance)),this.instance._mouseStop(e,!0),this.instance.options.helper=this.instance.options._helper,
//Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size
this.instance.currentItem.remove(),this.instance.placeholder&&this.instance.placeholder.remove(),i._trigger("fromSortable",e),i.dropped=!1)})}}),t.ui.plugin.add("draggable","cursor",{start:function(e,s){var i=t("body"),o=t(this).data("draggable").options;i.css("cursor")&&(o._cursor=i.css("cursor")),i.css("cursor",o.cursor)},stop:function(e,s){var i=t(this).data("draggable").options;i._cursor&&t("body").css("cursor",i._cursor)}}),t.ui.plugin.add("draggable","opacity",{start:function(e,s){var i=t(s.helper),o=t(this).data("draggable").options;i.css("opacity")&&(o._opacity=i.css("opacity")),i.css("opacity",o.opacity)},stop:function(e,s){var i=t(this).data("draggable").options;i._opacity&&t(s.helper).css("opacity",i._opacity)}}),t.ui.plugin.add("draggable","scroll",{start:function(e,s){var i=t(this).data("draggable");i.scrollParent[0]!=document&&"HTML"!=i.scrollParent[0].tagName&&(i.overflowOffset=i.scrollParent.offset())},drag:function(e,s){var i=t(this).data("draggable"),o=i.options,n=!1;i.scrollParent[0]!=document&&"HTML"!=i.scrollParent[0].tagName?(o.axis&&"x"==o.axis||(i.overflowOffset.top+i.scrollParent[0].offsetHeight-e.pageY<o.scrollSensitivity?i.scrollParent[0].scrollTop=n=i.scrollParent[0].scrollTop+o.scrollSpeed:e.pageY-i.overflowOffset.top<o.scrollSensitivity&&(i.scrollParent[0].scrollTop=n=i.scrollParent[0].scrollTop-o.scrollSpeed)),o.axis&&"y"==o.axis||(i.overflowOffset.left+i.scrollParent[0].offsetWidth-e.pageX<o.scrollSensitivity?i.scrollParent[0].scrollLeft=n=i.scrollParent[0].scrollLeft+o.scrollSpeed:e.pageX-i.overflowOffset.left<o.scrollSensitivity&&(i.scrollParent[0].scrollLeft=n=i.scrollParent[0].scrollLeft-o.scrollSpeed))):(o.axis&&"x"==o.axis||(e.pageY-t(document).scrollTop()<o.scrollSensitivity?n=t(document).scrollTop(t(document).scrollTop()-o.scrollSpeed):t(window).height()-(e.pageY-t(document).scrollTop())<o.scrollSensitivity&&(n=t(document).scrollTop(t(document).scrollTop()+o.scrollSpeed))),o.axis&&"y"==o.axis||(e.pageX-t(document).scrollLeft()<o.scrollSensitivity?n=t(document).scrollLeft(t(document).scrollLeft()-o.scrollSpeed):t(window).width()-(e.pageX-t(document).scrollLeft())<o.scrollSensitivity&&(n=t(document).scrollLeft(t(document).scrollLeft()+o.scrollSpeed)))),n!==!1&&t.ui.ddmanager&&!o.dropBehaviour&&t.ui.ddmanager.prepareOffsets(i,e)}}),t.ui.plugin.add("draggable","snap",{start:function(e,s){var i=t(this).data("draggable"),o=i.options;i.snapElements=[],t(o.snap.constructor!=String?o.snap.items||":data(draggable)":o.snap).each(function(){var e=t(this),s=e.offset();this!=i.element[0]&&i.snapElements.push({item:this,width:e.outerWidth(),height:e.outerHeight(),top:s.top,left:s.left})})},drag:function(e,s){for(var i=t(this).data("draggable"),o=i.options,n=o.snapTolerance,r=s.offset.left,a=r+i.helperProportions.width,l=s.offset.top,h=l+i.helperProportions.height,c=i.snapElements.length-1;c>=0;c--){var p=i.snapElements[c].left,f=p+i.snapElements[c].width,d=i.snapElements[c].top,g=d+i.snapElements[c].height;
//Yes, I know, this is insane ;)
if(r>p-n&&f+n>r&&l>d-n&&g+n>l||r>p-n&&f+n>r&&h>d-n&&g+n>h||a>p-n&&f+n>a&&l>d-n&&g+n>l||a>p-n&&f+n>a&&h>d-n&&g+n>h){if("inner"!=o.snapMode){var u=Math.abs(d-h)<=n,m=Math.abs(g-l)<=n,v=Math.abs(p-a)<=n,P=Math.abs(f-r)<=n;u&&(s.position.top=i._convertPositionTo("relative",{top:d-i.helperProportions.height,left:0}).top-i.margins.top),m&&(s.position.top=i._convertPositionTo("relative",{top:g,left:0}).top-i.margins.top),v&&(s.position.left=i._convertPositionTo("relative",{top:0,left:p-i.helperProportions.width}).left-i.margins.left),P&&(s.position.left=i._convertPositionTo("relative",{top:0,left:f}).left-i.margins.left)}var b=u||m||v||P;if("outer"!=o.snapMode){var u=Math.abs(d-l)<=n,m=Math.abs(g-h)<=n,v=Math.abs(p-r)<=n,P=Math.abs(f-a)<=n;u&&(s.position.top=i._convertPositionTo("relative",{top:d,left:0}).top-i.margins.top),m&&(s.position.top=i._convertPositionTo("relative",{top:g-i.helperProportions.height,left:0}).top-i.margins.top),v&&(s.position.left=i._convertPositionTo("relative",{top:0,left:p}).left-i.margins.left),P&&(s.position.left=i._convertPositionTo("relative",{top:0,left:f-i.helperProportions.width}).left-i.margins.left)}!i.snapElements[c].snapping&&(u||m||v||P||b)&&i.options.snap.snap&&i.options.snap.snap.call(i.element,e,t.extend(i._uiHash(),{snapItem:i.snapElements[c].item})),i.snapElements[c].snapping=u||m||v||P||b}else i.snapElements[c].snapping&&i.options.snap.release&&i.options.snap.release.call(i.element,e,t.extend(i._uiHash(),{snapItem:i.snapElements[c].item})),i.snapElements[c].snapping=!1}}}),t.ui.plugin.add("draggable","stack",{start:function(e,s){var i=t(this).data("draggable").options,o=t.makeArray(t(i.stack)).sort(function(e,s){return(parseInt(t(e).css("zIndex"),10)||0)-(parseInt(t(s).css("zIndex"),10)||0)});if(o.length){var n=parseInt(o[0].style.zIndex)||0;t(o).each(function(t){this.style.zIndex=n+t}),this[0].style.zIndex=n+o.length}}}),t.ui.plugin.add("draggable","zIndex",{start:function(e,s){var i=t(s.helper),o=t(this).data("draggable").options;i.css("zIndex")&&(o._zIndex=i.css("zIndex")),i.css("zIndex",o.zIndex)},stop:function(e,s){var i=t(this).data("draggable").options;i._zIndex&&t(s.helper).css("zIndex",i._zIndex)}})}(jQuery);

/*!
 * jQuery UI Resizable @VERSION
 *
 * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Resizables
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.mouse.js
 *	jquery.ui.widget.js
 */
!function(t,e){t.widget("ui.resizable",t.ui.mouse,{widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1e3},_create:function(){var e=this,i=this.options;if(this.element.addClass("ui-resizable"),t.extend(this,{_aspectRatio:!!i.aspectRatio,aspectRatio:i.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:i.helper||i.ghost||i.animate?i.helper||"ui-resizable-helper":null}),
//Wrap the element if it cannot hold child nodes
this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)&&(
//Create a wrapper element and set the wrapper to the new current internal element
this.element.wrap(t('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),
//Overwrite the original this.element
this.element=this.element.parent().data("resizable",this.element.data("resizable")),this.elementIsWrapper=!0,
//Move margins to the wrapper
this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0}),
//Prevent Safari textarea resize
this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),
//Push the actual element to our proportionallyResize internal array
this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),
// avoid IE jump (hard set the margin)
this.originalElement.css({margin:this.originalElement.css("margin")}),
// fix handlers offset
this._proportionallyResize()),this.handles=i.handles||(t(".ui-resizable-handle",this.element).length?{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"}:"e,s,se"),this.handles.constructor==String){"all"==this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw");var s=this.handles.split(",");this.handles={};for(var h=0;h<s.length;h++){var n=t.trim(s[h]),o="ui-resizable-"+n,a=t('<div class="ui-resizable-handle '+o+'"></div>');
// Apply zIndex to all handles - see #7960
a.css({zIndex:i.zIndex}),
//TODO : What's going on here?
"se"==n&&a.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),
//Insert into internal handles object and append to element
this.handles[n]=".ui-resizable-"+n,this.element.append(a)}}this._renderAxis=function(e){e=e||this.element;for(var i in this.handles){
//Apply pad to wrapper element, needed to fix axis position (textarea, inputs, scrolls)
if(this.handles[i].constructor==String&&(this.handles[i]=t(this.handles[i],this.element).show()),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var s=t(this.handles[i],this.element),h=0;
//Checking the correct pad and border
h=/sw|ne|nw|se|n|s/.test(i)?s.outerHeight():s.outerWidth();
//The padding type i have to apply...
var n=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join("");e.css(n,h),this._proportionallyResize()}t(this.handles[i]).length}},
//TODO: make renderAxis a prototype function
this._renderAxis(this.element),this._handles=t(".ui-resizable-handle",this.element).disableSelection(),
//Matching axis name
this._handles.mouseover(function(){if(!e.resizing){if(this.className)var t=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);
//Axis, default = se
e.axis=t&&t[1]?t[1]:"se"}}),
//If we want to auto hide the elements
i.autoHide&&(this._handles.hide(),t(this.element).addClass("ui-resizable-autohide").hover(function(){i.disabled||(t(this).removeClass("ui-resizable-autohide"),e._handles.show())},function(){i.disabled||e.resizing||(t(this).addClass("ui-resizable-autohide"),e._handles.hide())})),
//Initialize the mouse interaction
this._mouseInit()},destroy:function(){this._mouseDestroy();var e=function(e){t(e).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};
//TODO: Unwrap at same DOM position
if(this.elementIsWrapper){e(this.element);var i=this.element;i.after(this.originalElement.css({position:i.css("position"),width:i.outerWidth(),height:i.outerHeight(),top:i.css("top"),left:i.css("left")})).remove()}return this.originalElement.css("resize",this.originalResizeStyle),e(this.originalElement),this},_mouseCapture:function(e){var i=!1;for(var s in this.handles)t(this.handles[s])[0]==e.target&&(i=!0);return!this.options.disabled&&i},_mouseStart:function(e){var s=this.options,h=this.element.position(),n=this.element;this.resizing=!0,this.documentScroll={top:t(document).scrollTop(),left:t(document).scrollLeft()},
// bugfix for http://dev.jquery.com/ticket/1749
(n.is(".ui-draggable")||/absolute/.test(n.css("position")))&&n.css({position:"absolute",top:h.top,left:h.left}),this._renderProxy();var o=i(this.helper.css("left")),a=i(this.helper.css("top"));s.containment&&(o+=t(s.containment).scrollLeft()||0,a+=t(s.containment).scrollTop()||0),
//Store needed variables
this.offset=this.helper.offset(),this.position={left:o,top:a},this.size=this._helper?{width:n.outerWidth(),height:n.outerHeight()}:{width:n.width(),height:n.height()},this.originalSize=this._helper?{width:n.outerWidth(),height:n.outerHeight()}:{width:n.width(),height:n.height()},this.originalPosition={left:o,top:a},this.sizeDiff={width:n.outerWidth()-n.width(),height:n.outerHeight()-n.height()},this.originalMousePosition={left:e.pageX,top:e.pageY},
//Aspect Ratio
this.aspectRatio="number"==typeof s.aspectRatio?s.aspectRatio:this.originalSize.width/this.originalSize.height||1;var r=t(".ui-resizable-"+this.axis).css("cursor");return t("body").css("cursor","auto"==r?this.axis+"-resize":r),n.addClass("ui-resizable-resizing"),this._propagate("start",e),!0},_mouseDrag:function(e){
//Increase performance, avoid regex
var i=this.helper,s=(this.options,this.originalMousePosition),h=this.axis,n=e.pageX-s.left||0,o=e.pageY-s.top||0,a=this._change[h];if(!a)return!1;
// Calculate the attrs that will be change
var r=a.apply(this,[e,n,o]);t.browser.msie&&t.browser.version<7,this.sizeDiff;
// Put this in the mouseDrag handler since the user can start pressing shift while resizing
// plugins callbacks need to be called first
// calling the user callback at the end
return this._updateVirtualBoundaries(e.shiftKey),(this._aspectRatio||e.shiftKey)&&(r=this._updateRatio(r,e)),r=this._respectSize(r,e),this._propagate("resize",e),i.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"}),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),this._updateCache(r),this._trigger("resize",e,this.ui()),!1},_mouseStop:function(e){this.resizing=!1;var i=this.options,s=this;if(this._helper){var h=this._proportionallyResizeElements,n=h.length&&/textarea/i.test(h[0].nodeName),o=n&&t.ui.hasScroll(h[0],"left")?0:s.sizeDiff.height,a=n?0:s.sizeDiff.width,r={width:s.helper.width()-a,height:s.helper.height()-o},l=parseInt(s.element.css("left"),10)+(s.position.left-s.originalPosition.left)||null,p=parseInt(s.element.css("top"),10)+(s.position.top-s.originalPosition.top)||null;i.animate||this.element.css(t.extend(r,{top:p,left:l})),s.helper.height(s.size.height),s.helper.width(s.size.width),this._helper&&!i.animate&&this._proportionallyResize()}return t("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",e),this._helper&&this.helper.remove(),!1},_updateVirtualBoundaries:function(t){var e,i,h,n,o,a=this.options;o={minWidth:s(a.minWidth)?a.minWidth:0,maxWidth:s(a.maxWidth)?a.maxWidth:1/0,minHeight:s(a.minHeight)?a.minHeight:0,maxHeight:s(a.maxHeight)?a.maxHeight:1/0},(this._aspectRatio||t)&&(e=o.minHeight*this.aspectRatio,h=o.minWidth/this.aspectRatio,i=o.maxHeight*this.aspectRatio,n=o.maxWidth/this.aspectRatio,e>o.minWidth&&(o.minWidth=e),h>o.minHeight&&(o.minHeight=h),i<o.maxWidth&&(o.maxWidth=i),n<o.maxHeight&&(o.maxHeight=n)),this._vBoundaries=o},_updateCache:function(t){this.options;this.offset=this.helper.offset(),s(t.left)&&(this.position.left=t.left),s(t.top)&&(this.position.top=t.top),s(t.height)&&(this.size.height=t.height),s(t.width)&&(this.size.width=t.width)},_updateRatio:function(t,e){var i=(this.options,this.position),h=this.size,n=this.axis;return s(t.height)?t.width=t.height*this.aspectRatio:s(t.width)&&(t.height=t.width/this.aspectRatio),"sw"==n&&(t.left=i.left+(h.width-t.width),t.top=null),"nw"==n&&(t.top=i.top+(h.height-t.height),t.left=i.left+(h.width-t.width)),t},_respectSize:function(t,e){var i=(this.helper,this._vBoundaries),h=(this._aspectRatio||e.shiftKey,this.axis),n=s(t.width)&&i.maxWidth&&i.maxWidth<t.width,o=s(t.height)&&i.maxHeight&&i.maxHeight<t.height,a=s(t.width)&&i.minWidth&&i.minWidth>t.width,r=s(t.height)&&i.minHeight&&i.minHeight>t.height;a&&(t.width=i.minWidth),r&&(t.height=i.minHeight),n&&(t.width=i.maxWidth),o&&(t.height=i.maxHeight);var l=this.originalPosition.left+this.originalSize.width,p=this.position.top+this.size.height,d=/sw|nw|w/.test(h),g=/nw|ne|n/.test(h);a&&d&&(t.left=l-i.minWidth),n&&d&&(t.left=l-i.maxWidth),r&&g&&(t.top=p-i.minHeight),o&&g&&(t.top=p-i.maxHeight);
// fixing jump error on top/left - bug #2330
var f=!t.width&&!t.height;return f&&!t.left&&t.top?t.top=null:f&&!t.top&&t.left&&(t.left=null),t},_proportionallyResize:function(){this.options;if(this._proportionallyResizeElements.length)for(var e=this.helper||this.element,i=0;i<this._proportionallyResizeElements.length;i++){var s=this._proportionallyResizeElements[i];if(!this.borderDif){var h=[s.css("borderTopWidth"),s.css("borderRightWidth"),s.css("borderBottomWidth"),s.css("borderLeftWidth")],n=[s.css("paddingTop"),s.css("paddingRight"),s.css("paddingBottom"),s.css("paddingLeft")];this.borderDif=t.map(h,function(t,e){var i=parseInt(t,10)||0,s=parseInt(n[e],10)||0;return i+s})}t.browser.msie&&(t(e).is(":hidden")||t(e).parents(":hidden").length)||s.css({height:e.height()-this.borderDif[0]-this.borderDif[2]||0,width:e.width()-this.borderDif[1]-this.borderDif[3]||0})}},_renderProxy:function(){var e=this.element,i=this.options;if(this.elementOffset=e.offset(),this._helper){this.helper=this.helper||t('<div style="overflow:hidden;"></div>');
// fix ie6 offset TODO: This seems broken
var s=t.browser.msie&&t.browser.version<7,h=s?1:0,n=s?2:-1;this.helper.addClass(this._helper).css({width:this.element.outerWidth()+n,height:this.element.outerHeight()+n,position:"absolute",left:this.elementOffset.left-h+"px",top:this.elementOffset.top-h+"px",zIndex:++i.zIndex}),this.helper.appendTo("body").disableSelection()}else this.helper=this.element},_change:{e:function(t,e,i){return{width:this.originalSize.width+e}},w:function(t,e,i){var s=(this.options,this.originalSize),h=this.originalPosition;return{left:h.left+e,width:s.width-e}},n:function(t,e,i){var s=(this.options,this.originalSize),h=this.originalPosition;return{top:h.top+i,height:s.height-i}},s:function(t,e,i){return{height:this.originalSize.height+i}},se:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},sw:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[e,i,s]))},ne:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},nw:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[e,i,s]))}},_propagate:function(e,i){t.ui.plugin.call(this,e,[i,this.ui()]),"resize"!=e&&this._trigger(e,i,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),t.extend(t.ui.resizable,{version:"@VERSION"}),/*
 * Resizable Extensions
 */
t.ui.plugin.add("resizable","alsoResize",{start:function(e,i){var s=t(this).data("resizable"),h=s.options,n=function(e){t(e).each(function(){var e=t(this);e.data("resizable-alsoresize",{width:parseInt(e.width(),10),height:parseInt(e.height(),10),left:parseInt(e.css("left"),10),top:parseInt(e.css("top"),10)})})};"object"!=typeof h.alsoResize||h.alsoResize.parentNode?n(h.alsoResize):h.alsoResize.length?(h.alsoResize=h.alsoResize[0],n(h.alsoResize)):t.each(h.alsoResize,function(t){n(t)})},resize:function(e,i){var s=t(this).data("resizable"),h=s.options,n=s.originalSize,o=s.originalPosition,a={height:s.size.height-n.height||0,width:s.size.width-n.width||0,top:s.position.top-o.top||0,left:s.position.left-o.left||0},r=function(e,s){t(e).each(function(){var e=t(this),h=t(this).data("resizable-alsoresize"),n={},o=s&&s.length?s:e.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];t.each(o,function(t,e){var i=(h[e]||0)+(a[e]||0);i&&i>=0&&(n[e]=i||null)}),e.css(n)})};"object"!=typeof h.alsoResize||h.alsoResize.nodeType?r(h.alsoResize):t.each(h.alsoResize,function(t,e){r(t,e)})},stop:function(e,i){t(this).removeData("resizable-alsoresize")}}),t.ui.plugin.add("resizable","animate",{stop:function(e,i){var s=t(this).data("resizable"),h=s.options,n=s._proportionallyResizeElements,o=n.length&&/textarea/i.test(n[0].nodeName),a=o&&t.ui.hasScroll(n[0],"left")?0:s.sizeDiff.height,r=o?0:s.sizeDiff.width,l={width:s.size.width-r,height:s.size.height-a},p=parseInt(s.element.css("left"),10)+(s.position.left-s.originalPosition.left)||null,d=parseInt(s.element.css("top"),10)+(s.position.top-s.originalPosition.top)||null;s.element.animate(t.extend(l,d&&p?{top:d,left:p}:{}),{duration:h.animateDuration,easing:h.animateEasing,step:function(){var i={width:parseInt(s.element.css("width"),10),height:parseInt(s.element.css("height"),10),top:parseInt(s.element.css("top"),10),left:parseInt(s.element.css("left"),10)};n&&n.length&&t(n[0]).css({width:i.width,height:i.height}),
// propagating resize, and updating values for each animation step
s._updateCache(i),s._propagate("resize",e)}})}}),t.ui.plugin.add("resizable","containment",{start:function(e,s){var h=t(this).data("resizable"),n=h.options,o=h.element,a=n.containment,r=a instanceof t?a.get(0):/parent/.test(a)?o.parent().get(0):a;if(r)if(h.containerElement=t(r),/document/.test(a)||a==document)h.containerOffset={left:0,top:0},h.containerPosition={left:0,top:0},h.parentData={element:t(document),left:0,top:0,width:t(document).width(),height:t(document).height()||document.body.parentNode.scrollHeight};else{var l=t(r),p=[];t(["Top","Right","Left","Bottom"]).each(function(t,e){p[t]=i(l.css("padding"+e))}),h.containerOffset=l.offset(),h.containerPosition=l.position(),h.containerSize={height:l.innerHeight()-p[3],width:l.innerWidth()-p[1]};var d=h.containerOffset,g=h.containerSize.height,f=h.containerSize.width,c=t.ui.hasScroll(r,"left")?r.scrollWidth:f,u=t.ui.hasScroll(r)?r.scrollHeight:g;h.parentData={element:r,left:d.left,top:d.top,width:c,height:u}}},resize:function(e,i){var s=t(this).data("resizable"),h=s.options,n=(s.containerSize,s.containerOffset),o=(s.size,s.position),a=s._aspectRatio||e.shiftKey,r={top:0,left:0},l=s.containerElement;l[0]!=document&&/static/.test(l.css("position"))&&(r=n),o.left<(s._helper?n.left:0)&&(s.size.width=s.size.width+(s._helper?s.position.left-n.left:s.position.left-r.left),a&&(s.size.height=s.size.width/s.aspectRatio),s.position.left=h.helper?n.left:0),o.top<(s._helper?n.top:0)&&(s.size.height=s.size.height+(s._helper?s.position.top-n.top:s.position.top),a&&(s.size.width=s.size.height*s.aspectRatio),s.position.top=s._helper?n.top:0),s.offset.left=s.parentData.left+s.position.left,s.offset.top=s.parentData.top+s.position.top;var p=Math.abs((s._helper?s.offset.left-r.left:s.offset.left-r.left)+s.sizeDiff.width),d=Math.abs((s._helper?s.offset.top-r.top:s.offset.top-n.top)+s.sizeDiff.height),g=s.containerElement.get(0)==s.element.parent().get(0),f=/relative|absolute/.test(s.containerElement.css("position"));g&&f&&(p-=s.parentData.left),p+s.size.width>=s.parentData.width&&(s.size.width=s.parentData.width-p,a&&(s.size.height=s.size.width/s.aspectRatio)),d+s.size.height>=s.parentData.height&&(s.size.height=s.parentData.height-d,a&&(s.size.width=s.size.height*s.aspectRatio))},stop:function(e,i){var s=t(this).data("resizable"),h=s.options,n=(s.position,s.containerOffset),o=s.containerPosition,a=s.containerElement,r=t(s.helper),l=r.offset(),p=r.outerWidth()-s.sizeDiff.width,d=r.outerHeight()-s.sizeDiff.height;s._helper&&!h.animate&&/relative/.test(a.css("position"))&&t(this).css({left:l.left-o.left-n.left,width:p,height:d}),s._helper&&!h.animate&&/static/.test(a.css("position"))&&t(this).css({left:l.left-o.left-n.left,width:p,height:d})}}),t.ui.plugin.add("resizable","ghost",{start:function(e,i){var s=t(this).data("resizable"),h=s.options,n=s.size;s.ghost=s.originalElement.clone(),s.ghost.css({opacity:.25,display:"block",position:"relative",height:n.height,width:n.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass("string"==typeof h.ghost?h.ghost:""),s.ghost.appendTo(s.helper)},resize:function(e,i){var s=t(this).data("resizable");s.options;s.ghost&&s.ghost.css({position:"relative",height:s.size.height,width:s.size.width})},stop:function(e,i){var s=t(this).data("resizable");s.options;s.ghost&&s.helper&&s.helper.get(0).removeChild(s.ghost.get(0))}}),t.ui.plugin.add("resizable","grid",{resize:function(e,i){var s=t(this).data("resizable"),h=s.options,n=s.size,o=s.originalSize,a=s.originalPosition,r=s.axis;h._aspectRatio||e.shiftKey;h.grid="number"==typeof h.grid?[h.grid,h.grid]:h.grid;var l=Math.round((n.width-o.width)/(h.grid[0]||1))*(h.grid[0]||1),p=Math.round((n.height-o.height)/(h.grid[1]||1))*(h.grid[1]||1);/^(se|s|e)$/.test(r)?(s.size.width=o.width+l,s.size.height=o.height+p):/^(ne)$/.test(r)?(s.size.width=o.width+l,s.size.height=o.height+p,s.position.top=a.top-p):/^(sw)$/.test(r)?(s.size.width=o.width+l,s.size.height=o.height+p,s.position.left=a.left-l):(s.size.width=o.width+l,s.size.height=o.height+p,s.position.top=a.top-p,s.position.left=a.left-l)}});var i=function(t){return parseInt(t,10)||0},s=function(t){return!isNaN(parseInt(t,10))}}(jQuery);

/*!
 * jQuery UI Button @VERSION
 *
 * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Button
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.widget.js
 */
!function(t,e){var i,n,s,o,u="ui-button ui-widget ui-state-default ui-corner-all",a="ui-state-hover ui-state-active ",r="ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",l=function(){var e=t(this).find(":ui-button");setTimeout(function(){e.button("refresh")},1)},d=function(e){var i=e.name,n=e.form,s=t([]);return i&&(s=n?t(n).find("[name='"+i+"']"):t("[name='"+i+"']",e.ownerDocument).filter(function(){return!this.form})),s};t.widget("ui.button",{options:{disabled:null,text:!0,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset.button").bind("reset.button",l),"boolean"!=typeof this.options.disabled?this.options.disabled=!!this.element.propAttr("disabled"):this.element.propAttr("disabled",this.options.disabled),this._determineButtonType(),this.hasTitle=!!this.buttonElement.attr("title");var e=this,a=this.options,r="checkbox"===this.type||"radio"===this.type,h="ui-state-hover"+(r?"":" ui-state-active"),b="ui-state-focus";null===a.label&&(a.label=this.buttonElement.html()),this.buttonElement.addClass(u).attr("role","button").bind("mouseenter.button",function(){a.disabled||(t(this).addClass("ui-state-hover"),this===i&&t(this).addClass("ui-state-active"))}).bind("mouseleave.button",function(){a.disabled||t(this).removeClass(h)}).bind("click.button",function(t){a.disabled&&(t.preventDefault(),t.stopImmediatePropagation())}),this.element.bind("focus.button",function(){
// no need to check disabled, focus won't be triggered anyway
e.buttonElement.addClass(b)}).bind("blur.button",function(){e.buttonElement.removeClass(b)}),r&&(this.element.bind("change.button",function(){o||e.refresh()}),
// if mouse moves between mousedown and mouseup (drag) set clickDragged flag
// prevents issue where button state changes but checkbox/radio checked state
// does not in Firefox (see ticket #6970)
this.buttonElement.bind("mousedown.button",function(t){a.disabled||(o=!1,n=t.pageX,s=t.pageY)}).bind("mouseup.button",function(t){a.disabled||n===t.pageX&&s===t.pageY||(o=!0)})),"checkbox"===this.type?this.buttonElement.bind("click.button",function(){return a.disabled||o?!1:(t(this).toggleClass("ui-state-active"),void e.buttonElement.attr("aria-pressed",e.element[0].checked))}):"radio"===this.type?this.buttonElement.bind("click.button",function(){if(a.disabled||o)return!1;t(this).addClass("ui-state-active"),e.buttonElement.attr("aria-pressed","true");var i=e.element[0];d(i).not(i).map(function(){return t(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed","false")}):(this.buttonElement.bind("mousedown.button",function(){return a.disabled?!1:(t(this).addClass("ui-state-active"),i=this,void t(document).one("mouseup",function(){i=null}))}).bind("mouseup.button",function(){return a.disabled?!1:void t(this).removeClass("ui-state-active")}).bind("keydown.button",function(e){return a.disabled?!1:void(e.keyCode!=t.ui.keyCode.SPACE&&e.keyCode!=t.ui.keyCode.ENTER||t(this).addClass("ui-state-active"))}).bind("keyup.button",function(){t(this).removeClass("ui-state-active")}),this.buttonElement.is("a")&&this.buttonElement.keyup(function(e){e.keyCode===t.ui.keyCode.SPACE&&
// TODO pass through original event correctly (just as 2nd argument doesn't work)
t(this).click()})),
// TODO: pull out $.Widget's handling for the disabled option into
// $.Widget.prototype._setOptionDisabled so it's easy to proxy and can
// be overridden by individual plugins
this._setOption("disabled",a.disabled),this._resetButton()},_determineButtonType:function(){if(this.element.is(":checkbox")?this.type="checkbox":this.element.is(":radio")?this.type="radio":this.element.is("input")?this.type="input":this.type="button","checkbox"===this.type||"radio"===this.type){
// we don't search against the document in case the element
// is disconnected from the DOM
var t=this.element.parents().filter(":last"),e="label[for='"+this.element.attr("id")+"']";this.buttonElement=t.find(e),this.buttonElement.length||(t=t.length?t.siblings():this.element.siblings(),this.buttonElement=t.filter(e),this.buttonElement.length||(this.buttonElement=t.find(e))),this.element.addClass("ui-helper-hidden-accessible");var i=this.element.is(":checked");i&&this.buttonElement.addClass("ui-state-active"),this.buttonElement.attr("aria-pressed",i)}else this.buttonElement=this.element},widget:function(){return this.buttonElement},destroy:function(){this.element.removeClass("ui-helper-hidden-accessible"),this.buttonElement.removeClass(u+" "+a+" "+r).removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html()),this.hasTitle||this.buttonElement.removeAttr("title"),t.Widget.prototype.destroy.call(this)},_setOption:function(e,i){return t.Widget.prototype._setOption.apply(this,arguments),"disabled"===e?void(i?this.element.propAttr("disabled",!0):this.element.propAttr("disabled",!1)):void this._resetButton()},refresh:function(){var e=this.element.is(":disabled");e!==this.options.disabled&&this._setOption("disabled",e),"radio"===this.type?d(this.element[0]).each(function(){t(this).is(":checked")?t(this).button("widget").addClass("ui-state-active").attr("aria-pressed","true"):t(this).button("widget").removeClass("ui-state-active").attr("aria-pressed","false")}):"checkbox"===this.type&&(this.element.is(":checked")?this.buttonElement.addClass("ui-state-active").attr("aria-pressed","true"):this.buttonElement.removeClass("ui-state-active").attr("aria-pressed","false"))},_resetButton:function(){if("input"===this.type)return void(this.options.label&&this.element.val(this.options.label));var e=this.buttonElement.removeClass(r),i=t("<span></span>",this.element[0].ownerDocument).addClass("ui-button-text").html(this.options.label).appendTo(e.empty()).text(),n=this.options.icons,s=n.primary&&n.secondary,o=[];n.primary||n.secondary?(this.options.text&&o.push("ui-button-text-icon"+(s?"s":n.primary?"-primary":"-secondary")),n.primary&&e.prepend("<span class='ui-button-icon-primary ui-icon "+n.primary+"'></span>"),n.secondary&&e.append("<span class='ui-button-icon-secondary ui-icon "+n.secondary+"'></span>"),this.options.text||(o.push(s?"ui-button-icons-only":"ui-button-icon-only"),this.hasTitle||e.attr("title",i))):o.push("ui-button-text-only"),e.addClass(o.join(" "))}}),t.widget("ui.buttonset",{options:{items:":button, :submit, :reset, :checkbox, :radio, a, :data(button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(e,i){"disabled"===e&&this.buttons.button("option",e,i),t.Widget.prototype._setOption.apply(this,arguments)},refresh:function(){var e="rtl"===this.element.css("direction");this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return t(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(e?"ui-corner-right":"ui-corner-left").end().filter(":last").addClass(e?"ui-corner-left":"ui-corner-right").end().end()},destroy:function(){this.element.removeClass("ui-buttonset"),this.buttons.map(function(){return t(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy"),t.Widget.prototype.destroy.call(this)}})}(jQuery);

/*!
 * jQuery UI Dialog @VERSION
 *
 * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Dialog
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.widget.js
 *  jquery.ui.button.js
 *	jquery.ui.draggable.js
 *	jquery.ui.mouse.js
 *	jquery.ui.position.js
 *	jquery.ui.resizable.js
 */
!function(i,e){var t="ui-dialog ui-widget ui-widget-content ui-corner-all ",o={buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},a={maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0},
// support for jQuery 1.3.2 - handle common attrFn methods for dialog
n=i.attrFn||{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0,click:!0};i.widget("ui.dialog",{options:{autoOpen:!0,buttons:{},closeOnEscape:!0,closeText:"close",dialogClass:"",draggable:!0,hide:null,height:"auto",maxHeight:!1,maxWidth:!1,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",collision:"fit",
// ensure that the titlebar is never outside the document
using:function(e){var t=i(this).css(e).offset().top;0>t&&i(this).css("top",e.top-t)}},resizable:!0,show:null,stack:!0,title:"",width:300,zIndex:1e3},_create:function(){this.originalTitle=this.element.attr("title"),
// #5742 - .attr() might return a DOMElement
"string"!=typeof this.originalTitle&&(this.originalTitle=""),this.options.title=this.options.title||this.originalTitle;var e=this,o=e.options,a=o.title||"&#160;",n=i.ui.dialog.getTitleId(e.element),s=(e.uiDialog=i("<div></div>")).appendTo(document.body).hide().addClass(t+o.dialogClass).css({zIndex:o.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(t){o.closeOnEscape&&!t.isDefaultPrevented()&&t.keyCode&&t.keyCode===i.ui.keyCode.ESCAPE&&(e.close(t),t.preventDefault())}).attr({role:"dialog","aria-labelledby":n}).mousedown(function(i){e.moveToTop(!1,i)}),l=(e.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(s),(e.uiDialogTitlebar=i("<div></div>")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(s)),d=i('<a href="#"></a>').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){d.addClass("ui-state-hover")},function(){d.removeClass("ui-state-hover")}).focus(function(){d.addClass("ui-state-focus")}).blur(function(){d.removeClass("ui-state-focus")}).click(function(i){return e.close(i),!1}).appendTo(l);(e.uiDialogTitlebarCloseText=i("<span></span>")).addClass("ui-icon ui-icon-closethick").text(o.closeText).appendTo(d),i("<span></span>").addClass("ui-dialog-title").attr("id",n).html(a).prependTo(l);
//handling of deprecated beforeclose (vs beforeClose) option
//Ticket #4669 http://dev.jqueryui.com/ticket/4669
//TODO: remove in 1.9pre
i.isFunction(o.beforeclose)&&!i.isFunction(o.beforeClose)&&(o.beforeClose=o.beforeclose),l.find("*").add(l).disableSelection(),o.draggable&&i.fn.draggable&&e._makeDraggable(),o.resizable&&i.fn.resizable&&e._makeResizable(),e._createButtons(o.buttons),e._isOpen=!1,i.fn.bgiframe&&s.bgiframe()},_init:function(){this.options.autoOpen&&this.open()},destroy:function(){var i=this;return i.overlay&&i.overlay.destroy(),i.uiDialog.hide(),i.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body"),i.uiDialog.remove(),i.originalTitle&&i.element.attr("title",i.originalTitle),i},widget:function(){return this.uiDialog},close:function(e){var t,o,a=this;if(!1!==a._trigger("beforeClose",e))
// adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
return a.overlay&&a.overlay.destroy(),a.uiDialog.unbind("keypress.ui-dialog"),a._isOpen=!1,a.options.hide?a.uiDialog.hide(a.options.hide,function(){a._trigger("close",e)}):(a.uiDialog.hide(),a._trigger("close",e)),i.ui.dialog.overlay.resize(),a.options.modal&&(t=0,i(".ui-dialog").each(function(){this!==a.uiDialog[0]&&(o=i(this).css("z-index"),isNaN(o)||(t=Math.max(t,o)))}),i.ui.dialog.maxZ=t),a},isOpen:function(){return this._isOpen},
// the force parameter allows us to move modal dialogs to their correct
// position on open
moveToTop:function(e,t){var o,a=this,n=a.options;
//Save and then restore scroll since Opera 9.5+ resets when parent z-Index is changed.
//  http://ui.jquery.com/bugs/ticket/3193
return n.modal&&!e||!n.stack&&!n.modal?a._trigger("focus",t):(n.zIndex>i.ui.dialog.maxZ&&(i.ui.dialog.maxZ=n.zIndex),a.overlay&&(i.ui.dialog.maxZ+=1,a.overlay.$el.css("z-index",i.ui.dialog.overlay.maxZ=i.ui.dialog.maxZ)),o={scrollTop:a.element.scrollTop(),scrollLeft:a.element.scrollLeft()},i.ui.dialog.maxZ+=1,a.uiDialog.css("z-index",i.ui.dialog.maxZ),a.element.attr(o),a._trigger("focus",t),a)},open:function(){if(!this._isOpen){var e=this,t=e.options,o=e.uiDialog;
// prevent tabbing out of modal dialogs
// set focus to the first tabbable element in the content area or the first button
// if there are no tabbable elements, set focus on the dialog itself
return e.overlay=t.modal?new i.ui.dialog.overlay(e):null,e._size(),e._position(t.position),o.show(t.show),e.moveToTop(!0),t.modal&&o.bind("keydown.ui-dialog",function(e){if(e.keyCode===i.ui.keyCode.TAB){var t=i(":tabbable",this),o=t.filter(":first"),a=t.filter(":last");return e.target!==a[0]||e.shiftKey?e.target===o[0]&&e.shiftKey?(a.focus(1),!1):void 0:(o.focus(1),!1)}}),i(e.element.find(":tabbable").get().concat(o.find(".ui-dialog-buttonpane :tabbable").get().concat(o.get()))).eq(0).focus(),e._isOpen=!0,e._trigger("open"),e}},_createButtons:function(e){var t=this,o=!1,a=i("<div></div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),s=i("<div></div>").addClass("ui-dialog-buttonset").appendTo(a);
// if we already have a button pane, remove it
t.uiDialog.find(".ui-dialog-buttonpane").remove(),"object"==typeof e&&null!==e&&i.each(e,function(){return!(o=!0)}),o&&(i.each(e,function(e,o){o=i.isFunction(o)?{click:o,text:e}:o;var a=i('<button type="button"></button>').click(function(){o.click.apply(t.element[0],arguments)}).appendTo(s);
// can't use .attr( props, true ) with jQuery 1.3.2.
i.each(o,function(i,e){"click"!==i&&(i in n?a[i](e):a.attr(i,e))}),i.fn.button&&a.button()}),a.appendTo(t.uiDialog))},_makeDraggable:function(){function e(i){return{position:i.position,offset:i.offset}}var t,o=this,a=o.options,n=i(document);o.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(n,s){t="auto"===a.height?"auto":i(this).height(),i(this).height(i(this).height()).addClass("ui-dialog-dragging"),o._trigger("dragStart",n,e(s))},drag:function(i,t){o._trigger("drag",i,e(t))},stop:function(s,l){a.position=[l.position.left-n.scrollLeft(),l.position.top-n.scrollTop()],i(this).removeClass("ui-dialog-dragging").height(t),o._trigger("dragStop",s,e(l)),i.ui.dialog.overlay.resize()}})},_makeResizable:function(t){function o(i){return{originalPosition:i.originalPosition,originalSize:i.originalSize,position:i.position,size:i.size}}t=t===e?this.options.resizable:t;var a=this,n=a.options,
// .ui-resizable has position: relative defined in the stylesheet
// but dialogs have to use absolute or fixed positioning
s=a.uiDialog.css("position"),l="string"==typeof t?t:"n,e,s,w,se,sw,ne,nw";a.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:a.element,maxWidth:n.maxWidth,maxHeight:n.maxHeight,minWidth:n.minWidth,minHeight:a._minHeight(),handles:l,start:function(e,t){i(this).addClass("ui-dialog-resizing"),a._trigger("resizeStart",e,o(t))},resize:function(i,e){a._trigger("resize",i,o(e))},stop:function(e,t){i(this).removeClass("ui-dialog-resizing"),n.height=i(this).height(),n.width=i(this).width(),a._trigger("resizeStop",e,o(t)),i.ui.dialog.overlay.resize()}}).css("position",s).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_minHeight:function(){var i=this.options;return"auto"===i.height?i.minHeight:Math.min(i.minHeight,i.height)},_position:function(e){var t,o=[],a=[0,0];e?(
// deep extending converts arrays to objects in jQuery <= 1.3.2 :-(
//		if (typeof position == 'string' || $.isArray(position)) {
//			myAt = $.isArray(position) ? position : position.split(' ');
("string"==typeof e||"object"==typeof e&&"0"in e)&&(o=e.split?e.split(" "):[e[0],e[1]],1===o.length&&(o[1]=o[0]),i.each(["left","top"],function(i,e){+o[i]===o[i]&&(a[i]=o[i],o[i]=e)}),e={my:o.join(" "),at:o.join(" "),offset:a.join(" ")}),e=i.extend({},i.ui.dialog.prototype.options.position,e)):e=i.ui.dialog.prototype.options.position,t=this.uiDialog.is(":visible"),t||this.uiDialog.show(),this.uiDialog.css({top:0,left:0}).position(i.extend({of:window},e)),t||this.uiDialog.hide()},_setOptions:function(e){var t=this,n={},s=!1;i.each(e,function(i,e){t._setOption(i,e),i in o&&(s=!0),i in a&&(n[i]=e)}),s&&this._size(),this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option",n)},_setOption:function(e,o){var a=this,n=a.uiDialog;switch(e){
//handling of deprecated beforeclose (vs beforeClose) option
//Ticket #4669 http://dev.jqueryui.com/ticket/4669
//TODO: remove in 1.9pre
case"beforeclose":e="beforeClose";break;case"buttons":a._createButtons(o);break;case"closeText":
// ensure that we always pass a string
a.uiDialogTitlebarCloseText.text(""+o);break;case"dialogClass":n.removeClass(a.options.dialogClass).addClass(t+o);break;case"disabled":o?n.addClass("ui-dialog-disabled"):n.removeClass("ui-dialog-disabled");break;case"draggable":var s=n.is(":data(draggable)");s&&!o&&n.draggable("destroy"),!s&&o&&a._makeDraggable();break;case"position":a._position(o);break;case"resizable":
// currently resizable, becoming non-resizable
var l=n.is(":data(resizable)");l&&!o&&n.resizable("destroy"),
// currently resizable, changing handles
l&&"string"==typeof o&&n.resizable("option","handles",o),
// currently non-resizable, becoming resizable
l||o===!1||a._makeResizable(o);break;case"title":
// convert whatever was passed in o a string, for html() to not throw up
i(".ui-dialog-title",a.uiDialogTitlebar).html(""+(o||"&#160;"))}i.Widget.prototype._setOption.apply(a,arguments)},_size:function(){/* If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
		 * divs will both have width and height set, so we need to reset them
		 */
var e,t,o=this.options,a=this.uiDialog.is(":visible");if(
// reset content sizing
this.element.show().css({width:"auto",minHeight:0,height:0}),o.minWidth>o.width&&(o.width=o.minWidth),e=this.uiDialog.css({height:"auto",width:o.width}).height(),t=Math.max(0,o.minHeight-e),"auto"===o.height)
// only needed for IE6 support
if(i.support.minHeight)this.element.css({minHeight:t,height:"auto"});else{this.uiDialog.show();var n=this.element.css("height","auto").height();a||this.uiDialog.hide(),this.element.height(Math.max(n,t))}else this.element.height(Math.max(o.height-e,0));this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())}}),i.extend(i.ui.dialog,{version:"@VERSION",uuid:0,maxZ:0,getTitleId:function(i){var e=i.attr("id");return e||(this.uuid+=1,e=this.uuid),"ui-dialog-title-"+e},overlay:function(e){this.$el=i.ui.dialog.overlay.create(e)}}),i.extend(i.ui.dialog.overlay,{instances:[],
// reuse old instances due to IE memory leak with alpha transparency (see #5185)
oldInstances:[],maxZ:0,events:i.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(i){return i+".dialog-overlay"}).join(" "),create:function(e){0===this.instances.length&&(
// prevent use of anchors and inputs
// we use a setTimeout in case the overlay is created from an
// event that we're going to be cancelling (see #2804)
setTimeout(function(){
// handle $(el).dialog().dialog('close') (see #4065)
i.ui.dialog.overlay.instances.length&&i(document).bind(i.ui.dialog.overlay.events,function(e){return i(e.target).zIndex()<i.ui.dialog.overlay.maxZ?!1:void 0})},1),
// allow closing by pressing the escape key
i(document).bind("keydown.dialog-overlay",function(t){e.options.closeOnEscape&&!t.isDefaultPrevented()&&t.keyCode&&t.keyCode===i.ui.keyCode.ESCAPE&&(e.close(t),t.preventDefault())}),
// handle window resize
i(window).bind("resize.dialog-overlay",i.ui.dialog.overlay.resize));var t=(this.oldInstances.pop()||i("<div></div>").addClass("ui-widget-overlay")).appendTo(document.body).css({width:this.width(),height:this.height()});return i.fn.bgiframe&&t.bgiframe(),this.instances.push(t),t},destroy:function(e){var t=i.inArray(e,this.instances);-1!=t&&this.oldInstances.push(this.instances.splice(t,1)[0]),0===this.instances.length&&i([document,window]).unbind(".dialog-overlay"),e.remove();
// adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
var o=0;i.each(this.instances,function(){o=Math.max(o,this.css("z-index"))}),this.maxZ=o},height:function(){var e,t;
// handle IE 6
// handle IE 6
return i.browser.msie&&i.browser.version<7?(e=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight),t=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight),t>e?i(window).height()+"px":e+"px"):i(document).height()+"px"},width:function(){var e,t;
// handle IE
// handle IE
return i.browser.msie?(e=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth),t=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth),t>e?i(window).width()+"px":e+"px"):i(document).width()+"px"},resize:function(){/* If the dialog is draggable and the user drags it past the
		 * right edge of the window, the document becomes wider so we
		 * need to stretch the overlay. If the user then drags the
		 * dialog back to the left, the document will become narrower,
		 * so we need to shrink the overlay to the appropriate size.
		 * This is handled by shrinking the overlay before setting it
		 * to the full document size.
		 */
var e=i([]);i.each(i.ui.dialog.overlay.instances,function(){e=e.add(this)}),e.css({width:0,height:0}).css({width:i.ui.dialog.overlay.width(),height:i.ui.dialog.overlay.height()})}}),i.extend(i.ui.dialog.overlay.prototype,{destroy:function(){i.ui.dialog.overlay.destroy(this.$el)}})}(jQuery);

/*!
// ----------------------------------------------------------------------------
// markItUp! Universal MarkUp Engine, JQuery plugin
// v 1.1.7
// Dual licensed under the MIT and GPL licenses.
// ----------------------------------------------------------------------------
// Copyright (C) 2007-2010 Jay Salvat
// http://markitup.jaysalvat.com/
// ----------------------------------------------------------------------------
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// 
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
// 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
// ----------------------------------------------------------------------------
*/
!function($){$.fn.markItUp=function(settings,extraSettings){var options,ctrlKey,shiftKey,altKey;
// compute markItUp! path
return ctrlKey=shiftKey=altKey=!1,options={id:"",nameSpace:"",root:"",previewInWindow:"",previewAutoRefresh:!0,previewPosition:"after",previewTemplatePath:"~/templates/preview.html",previewParserPath:"",previewParserVar:"data",resizeHandle:!0,beforeInsert:"",afterInsert:"",onEnter:{},onShiftEnter:{},onCtrlEnter:{},onTab:{},markupSet:[{}]},$.extend(options,settings,extraSettings),options.root||$("script").each(function(e,t){miuScript=$(t).get(0).src.match(/(.*)jquery\.markitup(\.pack)?\.js$/),null!==miuScript&&(options.root=miuScript[1])}),this.each(function(){function localize(e,t){return t?e.replace(/("|')~\//g,"$1"+options.root):e.replace(/^~\//,options.root)}function init(){id="",nameSpace="",options.id?id='id="'+options.id+'"':$$.attr("id")&&(id='id="markItUp'+$$.attr("id").substr(0,1).toUpperCase()+$$.attr("id").substr(1)+'"'),options.nameSpace&&(nameSpace='class="'+options.nameSpace+'"'),$$.wrap("<div "+nameSpace+"></div>"),$$.wrap("<div "+id+' class="markItUp"></div>'),$$.wrap('<div class="markItUpContainer"></div>'),$$.addClass("markItUpEditor"),header=$('<div class="markItUpHeader"></div>').insertBefore($$),$(dropMenus(options.markupSet)).appendTo(header),footer=$('<div class="markItUpFooter"></div>').insertAfter($$),options.resizeHandle===!0&&$.browser.safari!==!0&&(resizeHandle=$('<div class="markItUpResizeHandle"></div>').insertAfter($$).bind("mousedown",function(e){var t,r,i=$$.height(),n=e.clientY;t=function(e){return $$.css("height",Math.max(20,e.clientY+i-n)+"px"),!1},r=function(e){return $("html").unbind("mousemove",t).unbind("mouseup",r),!1},$("html").bind("mousemove",t).bind("mouseup",r)}),footer.append(resizeHandle)),$$.keydown(keyPressed).keyup(keyPressed),$$.bind("insertion",function(e,t){t.target!==!1&&get(),textarea===$.markItUp.focused&&markup(t)}),$$.focus(function(){$.markItUp.focused=this})}function dropMenus(markupSet){var ul=$("<ul></ul>"),i=0;return $("li:hover > ul",ul).css("display","block"),$.each(markupSet,function(){var button=this,t="",title,li,j;if(title=button.key?(button.name||"")+" [Ctrl+"+button.key+"]":button.name||"",key=button.key?'accesskey="'+button.key+'"':"",button.separator)li=$('<li class="markItUpSeparator">'+(button.separator||"")+"</li>").appendTo(ul);else{for(i++,j=levels.length-1;j>=0;j--)t+=levels[j]+"-";li=$('<li class="markItUpButton markItUpButton'+t+i+" "+(button.className||"")+'"><a href="" '+key+' title="'+title+'">'+(button.name||"")+"</a></li>").bind("contextmenu",function(){return!1}).click(function(){return!1}).mousedown(function(){return button.call&&eval(button.call)(),setTimeout(function(){markup(button)},1),!1}).hover(function(){$("> ul",this).show(),$(document).one("click",function(){$("ul ul",header).hide()})},function(){$("> ul",this).hide()}).appendTo(ul),button.dropMenu&&(levels.push(i),$(li).addClass("markItUpDropMenu").append(dropMenus(button.dropMenu)))}}),levels.pop(),ul}function magicMarkups(e){return e?(e=e.toString(),e=e.replace(/\(\!\(([\s\S]*?)\)\!\)/g,function(e,t){var r=t.split("|!|");return altKey===!0?void 0!==r[1]?r[1]:r[0]:void 0===r[1]?"":r[0]}),e=e.replace(/\[\!\[([\s\S]*?)\]\!\]/g,function(e,t){var r=t.split(":!:");return abort===!0?!1:(value=prompt(r[0],r[1]?r[1]:""),null===value&&(abort=!0),value)})):""}function prepare(e){return $.isFunction(e)&&(e=e(hash)),magicMarkups(e)}function build(e){return openWith=prepare(clicked.openWith),placeHolder=prepare(clicked.placeHolder),replaceWith=prepare(clicked.replaceWith),closeWith=prepare(clicked.closeWith),""!==replaceWith?block=openWith+replaceWith+closeWith:""===selection&&""!==placeHolder?block=openWith+placeHolder+closeWith:block=openWith+(e||selection)+closeWith,{block:block,openWith:openWith,replaceWith:replaceWith,placeHolder:placeHolder,closeWith:closeWith}}function markup(e){var t,r,i,n;if(hash=clicked=e,get(),$.extend(hash,{line:"",root:options.root,textarea:textarea,selection:selection||"",caretPosition:caretPosition,ctrlKey:ctrlKey,shiftKey:shiftKey,altKey:altKey}),prepare(options.beforeInsert),prepare(clicked.beforeInsert),ctrlKey===!0&&shiftKey===!0&&prepare(clicked.beforeMultiInsert),$.extend(hash,{line:1}),ctrlKey===!0&&shiftKey===!0){for(lines=selection.split(/\r?\n/),r=0,i=lines.length,n=0;i>n;n++)""!==$.trim(lines[n])?($.extend(hash,{line:++r,selection:lines[n]}),lines[n]=build(lines[n]).block):lines[n]="";string={block:lines.join("\n")},start=caretPosition,t=string.block.length+($.browser.opera?i:0)}else ctrlKey===!0?(string=build(selection),start=caretPosition+string.openWith.length,t=string.block.length-string.openWith.length-string.closeWith.length,t-=fixIeBug(string.block)):shiftKey===!0?(string=build(selection),start=caretPosition,t=string.block.length,t-=fixIeBug(string.block)):(string=build(selection),start=caretPosition+string.block.length,t=0,start-=fixIeBug(string.block));""===selection&&""===string.replaceWith&&(caretOffset+=fixOperaBug(string.block),start=caretPosition+string.openWith.length,t=string.block.length-string.openWith.length-string.closeWith.length,caretOffset=$$.val().substring(caretPosition,$$.val().length).length,caretOffset-=fixOperaBug($$.val().substring(0,caretPosition))),$.extend(hash,{caretPosition:caretPosition,scrollPosition:scrollPosition}),string.block!==selection&&abort===!1?(insert(string.block),set(start,t)):caretOffset=-1,get(),$.extend(hash,{line:"",selection:selection}),ctrlKey===!0&&shiftKey===!0&&prepare(clicked.afterMultiInsert),prepare(clicked.afterInsert),prepare(options.afterInsert),previewWindow&&options.previewAutoRefresh&&refreshPreview(),shiftKey=altKey=ctrlKey=abort=!1}function fixOperaBug(e){return $.browser.opera?e.length-e.replace(/\n*/g,"").length:0}function fixIeBug(e){return $.browser.msie?e.length-e.replace(/\r*/g,"").length:0}function insert(e){if(document.selection){var t=document.selection.createRange();t.text=e}else $$.val($$.val().substring(0,caretPosition)+e+$$.val().substring(caretPosition+selection.length,$$.val().length))}function set(e,t){if(textarea.createTextRange){if($.browser.opera&&$.browser.version>=9.5&&0==t)return!1;range=textarea.createTextRange(),range.collapse(!0),range.moveStart("character",e),range.moveEnd("character",t),range.select()}else textarea.setSelectionRange&&textarea.setSelectionRange(e,e+t);textarea.scrollTop=scrollPosition,textarea.focus()}function get(){if(textarea.focus(),scrollPosition=textarea.scrollTop,document.selection)if(selection=document.selection.createRange().text,$.browser.msie){var e=document.selection.createRange(),t=e.duplicate();for(t.moveToElementText(textarea),caretPosition=-1;t.inRange(e);)t.moveStart("character"),caretPosition++}else caretPosition=textarea.selectionStart;else caretPosition=textarea.selectionStart,selection=$$.val().substring(caretPosition,textarea.selectionEnd);return selection}function preview(){!previewWindow||previewWindow.closed?options.previewInWindow?previewWindow=window.open("","preview",options.previewInWindow):(iFrame=$('<iframe class="markItUpPreviewFrame"></iframe>'),"after"==options.previewPosition?iFrame.insertAfter(footer):iFrame.insertBefore(header),previewWindow=iFrame[iFrame.length-1].contentWindow||frame[iFrame.length-1]):altKey===!0&&(iFrame?iFrame.remove():previewWindow.close(),previewWindow=iFrame=!1),options.previewAutoRefresh||refreshPreview()}function refreshPreview(){renderPreview()}function renderPreview(){return""!==options.previewParserPath?$.ajax({type:"POST",url:options.previewParserPath,data:options.previewParserVar+"="+encodeURIComponent($$.val()),success:function(e){writeInPreview(localize(e,1))}}):template||$.ajax({url:options.previewTemplatePath,success:function(e){writeInPreview(localize(e,1).replace(/<!-- content -->/g,$$.val()))}}),!1}function writeInPreview(e){if(previewWindow.document){try{sp=previewWindow.document.documentElement.scrollTop}catch(t){sp=0}previewWindow.document.open(),previewWindow.document.write(e),previewWindow.document.close(),previewWindow.document.documentElement.scrollTop=sp}options.previewInWindow&&previewWindow.focus()}function keyPressed(e){if(shiftKey=e.shiftKey,altKey=e.altKey,ctrlKey=e.altKey&&e.ctrlKey?!1:e.ctrlKey,"keydown"===e.type){if(ctrlKey===!0&&(li=$('a[accesskey="'+String.fromCharCode(e.keyCode)+'"]',header).parent("li"),0!==li.length))return ctrlKey=!1,setTimeout(function(){li.triggerHandler("mousedown")},1),!1;if(13===e.keyCode||10===e.keyCode)return ctrlKey===!0?(ctrlKey=!1,markup(options.onCtrlEnter),options.onCtrlEnter.keepDefault):shiftKey===!0?(shiftKey=!1,markup(options.onShiftEnter),options.onShiftEnter.keepDefault):(markup(options.onEnter),options.onEnter.keepDefault);if(9===e.keyCode)return 1==shiftKey||1==ctrlKey||1==altKey?!1:-1!==caretOffset?(get(),caretOffset=$$.val().length-caretOffset,set(caretOffset,0),caretOffset=-1,!1):(markup(options.onTab),options.onTab.keepDefault)}}var $$,textarea,levels,scrollPosition,caretPosition,caretOffset,clicked,hash,header,footer,previewWindow,template,iFrame,abort;$$=$(this),textarea=this,levels=[],abort=!1,scrollPosition=caretPosition=0,caretOffset=-1,options.previewParserPath=localize(options.previewParserPath),options.previewTemplatePath=localize(options.previewTemplatePath),init()})},$.fn.markItUpRemove=function(){return this.each(function(){var e=$(this).unbind().removeClass("markItUpEditor");e.parent("div").parent("div.markItUp").parent("div").replaceWith(e)})},$.markItUp=function(e){var t={target:!1};return $.extend(t,e),t.target?$(t.target).each(function(){$(this).focus(),$(this).trigger("insertion",[t])}):void $("textarea").trigger("insertion",[t])}}(jQuery);

/**
 * @license 
 * jQuery Tools 1.2.1 / Mask - Dim the lights
 * 
 * NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.
 * 
 * http://flowplayer.org/tools/toolbox/mask.html
 *
 * Since: Mar 2010
 * Date:    Tue May 11 09:22:32 2010 +0000 
 */
!function(n){/* one of the greatest headaches in the tool. finally made it */
function o(){
// the horror case
if(n.browser.msie){
// if there are no scrollbars then use window.height
var o=n(document).height(),e=n(window).height();return[window.innerWidth||// ie7+
document.documentElement.clientWidth||// ie6  
document.body.clientWidth,20>o-e?e:o]}
// other well behaving browsers
return[n(window).width(),n(document).height()]}function e(o){return o?o.call(n.mask):void 0}
// static constructs
n.tools=n.tools||{version:"1.2.1"};var t;t=n.tools.expose={conf:{maskId:"exposeMask",loadSpeed:"slow",closeSpeed:"fast",closeOnClick:!0,closeOnEsc:!0,
// css settings
zIndex:9998,opacity:.8,startOpacity:0,color:"#fff",
// callbacks
onLoad:null,onClose:null}};var i,s,c,d,a;n.mask={load:function(r,u){
// already loaded ?
if(c)return this;
// configuration
"string"==typeof r&&(r={color:r}),r=r||d,d=r=n.extend(n.extend({},t.conf),r),i=n("#"+r.maskId),i.length||(i=n("<div/>").attr("id",r.maskId),n("body").append(i));
// set position and dimensions 			
var l=o();i.css({position:"absolute",top:0,left:0,width:l[0],height:l[1],display:"none",opacity:r.startOpacity,zIndex:r.zIndex});
// background color 
var f=i.css("backgroundColor");
// onBeforeLoad
// onBeforeLoad
// esc button
// mask click closes
// resize mask when window is resized
// exposed elements
// make sure element is positioned absolutely or relatively
// make elements sit on top of the mask
// reveal mask
return f&&"transparent"!=f&&"rgba(0, 0, 0, 0)"!=f||i.css("backgroundColor",r.color),e(r.onBeforeLoad)===!1?this:(r.closeOnEsc&&n(document).bind("keydown.mask",function(o){27==o.keyCode&&n.mask.close(o)}),r.closeOnClick&&i.bind("click.mask",function(o){n.mask.close(o)}),n(window).bind("resize.mask",function(){n.mask.fit()}),u&&u.length&&(a=u.eq(0).css("zIndex"),n.each(u,function(){var o=n(this);/relative|absolute|fixed/i.test(o.css("position"))||o.css("position","relative")}),s=u.css({zIndex:Math.max(r.zIndex+1,"auto"==a?0:a)})),i.css({display:"block"}).fadeTo(r.loadSpeed,r.opacity,function(){n.mask.fit(),e(r.onLoad)}),c=!0,this)},close:function(){if(c){
// onBeforeClose
if(e(d.onBeforeClose)===!1)return this;i.fadeOut(d.closeSpeed,function(){e(d.onClose),s&&s.css({zIndex:a})}),
// unbind various event listeners
n(document).unbind("keydown.mask"),i.unbind("click.mask"),n(window).unbind("resize.mask"),c=!1}return this},fit:function(){if(c){var n=o();i.css({width:n[0],height:n[1]})}},getMask:function(){return i},isLoaded:function(){return c},getConf:function(){return d},getExposed:function(){return s}},n.fn.mask=function(o){return n.mask.load(o),this},n.fn.expose=function(o){return n.mask.load(o,this),this}}(jQuery);

/**
 * @license 
 * jQuery Tools 1.2.3 Overlay - Overlay base. Extend it.
 * 
 * NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.
 * 
 * http://flowplayer.org/tools/overlay/
 *
 * Since: March 2008
 * Date:    Mon Jun 7 13:43:53 2010 +0000 
 */
!function(e){function t(t,i){
// private variables
var r,c,l,s=this,a=t.add(s),f=e(window),d=e.tools.expose&&(i.mask||i.expose),u=Math.random().toString().slice(10);
// mask configuration
d&&("string"==typeof d&&(d={color:d}),d.closeOnClick=d.closeOnEsc=!1);
// get overlay and triggerr
var g=i.target||t.attr("rel");
// overlay not found. cannot continue
if(c=g?e(g):t,!c.length)throw"Could not find Overlay: "+g;
// trigger's click event
t&&-1==t.index(c)&&t.click(function(e){return s.load(e),e.preventDefault()}),
// API methods  
e.extend(s,{load:function(t){
// can be opened only once
if(s.isOpened())return s;
// find the effect
var r=o[i.effect];if(!r)throw'Overlay: cannot find effect : "'+i.effect+'"';if(
// close other instances?
i.oneInstance&&e.each(n,function(){this.close(t)}),t=t||e.Event(),t.type="onBeforeLoad",a.trigger(t),t.isDefaultPrevented())return s;l=!0,d&&e(c).expose(d);
// position & dimensions 
var g=i.top,h=i.left,p=c.outerWidth({margin:!0}),v=c.outerHeight({margin:!0});
// load effect  		 		
// mask.click closes overlay
// when window is clicked outside overlay, we close
// keyboard::escape
// one callback is enough if multiple instances are loaded simultaneously
return"string"==typeof g&&(g="center"==g?Math.max((f.height()-v)/2,0):parseInt(g,10)/100*f.height()),"center"==h&&(h=Math.max((f.width()-p)/2,0)),r[0].call(s,{top:g,left:h},function(){l&&(t.type="onLoad",a.trigger(t))}),d&&i.closeOnClick&&e.mask.getMask().one("click",s.close),i.closeOnClick&&e(document).bind("click."+u,function(t){e(t.target).parents(c).length||s.close(t)}),i.closeOnEsc&&e(document).bind("keydown."+u,function(e){27==e.keyCode&&s.close(e)}),s},close:function(t){
// close effect
// unbind the keyboard / clicking actions
return s.isOpened()?(t=t||e.Event(),t.type="onBeforeClose",a.trigger(t),t.isDefaultPrevented()?void 0:(l=!1,o[i.effect][1].call(s,function(){t.type="onClose",a.trigger(t)}),e(document).unbind("click."+u).unbind("keydown."+u),d&&e.mask.close(),s)):s},getOverlay:function(){return c},getTrigger:function(){return t},getClosers:function(){return r},isOpened:function(){return l},
// manipulate start, finish and speeds
getConf:function(){return i}}),
// callbacks	
e.each("onBeforeLoad,onStart,onLoad,onBeforeClose,onClose".split(","),function(t,n){
// configuration
e.isFunction(i[n])&&e(s).bind(n,i[n]),
// API
s[n]=function(t){return e(s).bind(n,t),s}}),r=c.find(i.close||".close"),r.length||i.close||(r=e('<a class="close"></a>'),c.prepend(r)),r.click(function(e){s.close(e)}),i.load&&s.load()}
// static constructs
e.tools=e.tools||{version:"1.2.3"},e.tools.overlay={addEffect:function(e,t,n){o[e]=[t,n]},conf:{close:null,closeOnClick:!0,closeOnEsc:!0,closeSpeed:"fast",effect:"default",
// since 1.2. fixed positioning not supported by IE6
fixed:!e.browser.msie||e.browser.version>6,left:"center",load:!1,// 1.2
mask:null,oneInstance:!0,speed:"normal",target:null,// target element to be overlayed. by default taken from [rel]  
top:"10%"}};var n=[],o={};
// the default effect. nice and easy!
e.tools.overlay.addEffect("default",/* 
			onLoad/onClose functions must be called otherwise none of the 
			user supplied callback methods won't be called
		*/
function(t,n){var o=this.getConf(),i=e(window);o.fixed||(t.top+=i.scrollTop(),t.left+=i.scrollLeft()),t.position=o.fixed?"fixed":"absolute",this.getOverlay().css(t).fadeIn(o.speed,n)},function(e){this.getOverlay().fadeOut(this.getConf().closeSpeed,e)}),
// jQuery plugin initialization
e.fn.overlay=function(o){
// already constructed --> return API
var i=this.data("overlay");return i?i:(e.isFunction(o)&&(o={onBeforeLoad:o}),o=e.extend(!0,{},e.tools.overlay.conf,o),this.each(function(){i=new t(e(this),o),n.push(i),e(this).data("overlay",i)}),o.api?i:this)}}(jQuery);

/*!
 * jQuery Templates Plugin 1.0.0pre
 * http://github.com/jquery/jquery-tmpl
 * Requires jQuery 1.4.2
 *
 * Copyright Software Freedom Conservancy, Inc.
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 */
!function(t,e){function n(e,n,l,a){
// Returns a template item data structure for a new rendered instance of a template (a 'template item').
// The content field is a hierarchical array of strings and nested items (to be
// removed and replaced by nodes field of dom elements, once inserted in DOM).
var r={data:a||0===a||a===!1?a:n?n.data:{},_wrap:n?n._wrap:null,tmpl:null,parent:n||null,nodes:[],calls:c,nest:f,wrap:m,html:s,update:d};
// Build the hierarchical content to be used during insertion into DOM
// Keep track of new template item, until it is stored as jQuery Data on DOM element
return e&&t.extend(r,e,{nodes:[],parent:n}),l&&(r.tmpl=l,r._ctnt=r._ctnt||r.tmpl(t,r),r.key=++k,(j.length?v:g)[k]=r),r}
//========================== Private helper functions, used by code above ==========================
function l(e,n,r){
// Convert hierarchical content into flat string array
// and finally return array of fragments ready for DOM insertion
var p,i=r?t.map(r,function(t){
// Insert template item annotations, to be converted to jQuery.data( "tmplItem" ) when elems are inserted into DOM.
// This is a child template item. Build nested template.
return"string"==typeof t?e.key?t.replace(/(<\w+)(?=[\s>])(?![^>]*_tmplitem)([^>]*)/g,"$1 "+h+'="'+e.key+'" $2'):t:l(t,e,t._ctnt)}):
// If content is not defined, insert tmplItem directly. Not a template item. May be a string, or a string array, e.g. from {{html $item.html()}}.
e;
// top-level template
// Support templates which have initial or final text nodes, or consist only of text
// Also support HTML entities within the HTML markup.
return n?i:(i=i.join(""),i.replace(/^\s*([^<\s][^<]*)?(<[\w\W]+>)([^>]*[^>\s])?\s*$/,function(e,n,l,r){p=t(l).get(),u(p),n&&(p=a(n).concat(p)),r&&(p=p.concat(a(r)))}),p?p:a(i))}function a(e){
// Use createElement, since createTextNode will not render HTML entities correctly
var n=document.createElement("div");return n.innerHTML=e,t.makeArray(n.childNodes)}
// Generate a reusable function that will serve to render a template against data
function r(e){
// Use the variable __ to hold a string array while building the compiled template. (See https://github.com/jquery/jquery-tmpl/issues#issue/10).
// Convert the template into pure JavaScript
return new Function("jQuery","$item","var $=jQuery,call,__=[],$data=$item.data;with($data){__.push('"+t.trim(e).replace(/([\\'])/g,"\\$1").replace(/[\r\t\n]/g," ").replace(/\$\{([^\}]*)\}/g,"{{= $1}}").replace(/\{\{(\/?)(\w+|.)(?:\(((?:[^\}]|\}(?!\}))*?)?\))?(?:\s+(.*?)?)?(\(((?:[^\}]|\}(?!\}))*?)\))?\s*\}\}/g,function(e,n,l,a,r,p,o){var u,c,f,m=t.tmpl.tag[l];if(!m)throw"Unknown template tag: "+l;
// Support for target being things like a.toLowerCase();
// In that case don't call with template item as 'this' pointer. Just evaluate...
return u=m._default||[],p&&!/\w$/.test(r)&&(r+=p,p=""),r?(r=i(r),o=o?","+i(o)+")":p?")":"",c=p?r.indexOf(".")>-1?r+i(p):"("+r+").call($item"+o:r,f=p?c:"(typeof("+r+")==='function'?("+r+").call($item):("+r+"))"):f=c=u.$1||"null",a=i(a),"');"+m[n?"close":"open"].split("$notnull_1").join(r?"typeof("+r+")!=='undefined' && ("+r+")!=null":"true").split("$1a").join(f).split("$1").join(c).split("$2").join(a||u.$2||"")+"__.push('"})+"');}return __;")}function p(e,n){
// Build the wrapped content.
e._wrap=l(e,!0,t.isArray(n)?n:[y.test(n)?n:t(n).html()]).join("")}function i(t){return t?t.replace(/\\'/g,"'").replace(/\\\\/g,"\\"):null}function o(t){var e=document.createElement("div");return e.appendChild(t.cloneNode(!0)),e.innerHTML}
// Store template items in jQuery.data(), ensuring a unique tmplItem data data structure for each rendered template instance.
function u(e){function l(e){function l(t){t+=u,p=c[t]=c[t]||n(p,g[p.parent.key+u]||p.parent)}var a,r,p,i,o=e;
// Ensure that each rendered template inserted into the DOM has its own template item,
if(i=e.getAttribute(h)){for(;o.parentNode&&1===(o=o.parentNode).nodeType&&!(a=o.getAttribute(h)););a!==i&&(o=o.parentNode?11===o.nodeType?0:o.getAttribute(h)||0:0,(p=g[i])||(p=v[i],p=n(p,g[o]||v[o]),p.key=++k,g[k]=p),T&&l(i)),e.removeAttribute(h)}else T&&(p=t.data(e,"tmplItem"))&&(
// This was a rendered element, cloned during append or appendTo etc.
// TmplItem stored in jQuery data has already been cloned in cloneCopyEvent. We must replace it with a fresh cloned tmplItem.
l(p.key),g[p.key]=p,o=t.data(e.parentNode,"tmplItem"),o=o?o.key:0);if(p){
// Find the template item of the parent element.
// (Using !=, not !==, since pntItem.key is number, and pntNode may be a string)
for(r=p;r&&r.key!=o;)
// Add this element as a top-level node for this rendered template item, as well as for any
// ancestor items between this item and the item of its parent element
r.nodes.push(e),r=r.parent;
// Delete content built during rendering - reduce API surface area and memory use, and avoid exposing of stale data after rendering...
delete p._ctnt,delete p._wrap,
// Store template item as jQuery data on the element
t.data(e,"tmplItem",p)}}var a,r,p,i,o,u="_"+T,c={};for(p=0,i=e.length;i>p;p++)if(1===(a=e[p]).nodeType){for(r=a.getElementsByTagName("*"),o=r.length-1;o>=0;o--)l(r[o]);l(a)}}
//---- Helper functions for template item ----
function c(t,e,n,l){return t?void j.push({_:t,tmpl:e,item:this,data:n,options:l}):j.pop()}function f(e,n,l){
// nested template, using {{tmpl}} tag
return t.tmpl(t.template(e),n,l,this)}function m(e,n){
// nested template, using {{wrap}} tag
var l=e.options||{};
// Apply the template, which may incorporate wrapped content,
return l.wrapped=n,t.tmpl(t.template(e.tmpl),e.data,l,e.item)}function s(e,n){var l=this._wrap;return t.map(t(t.isArray(l)?l.join(""):l).filter(e||"*"),function(t){return n?t.innerText||t.textContent:t.outerHTML||o(t)})}function d(){var e=this.nodes;t.tmpl(null,null,null,this).insertBefore(e[0]),t(e).remove()}var $,_=t.fn.domManip,h="_tmplitem",y=/^[^<]*(<[\w\W]+>)[^>]*$|\{\{\! /,g={},v={},w={key:0,data:{}},k=0,T=0,j=[];
// Override appendTo etc., in order to provide support for targeting multiple elements. (This code would disappear if integrated in jquery core).
t.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,n){t.fn[e]=function(l){var a,r,p,i,o=[],u=t(l),c=1===this.length&&this[0].parentNode;if($=g||{},c&&11===c.nodeType&&1===c.childNodes.length&&1===u.length)u[n](this[0]),o=this;else{for(r=0,p=u.length;p>r;r++)T=r,a=(r>0?this.clone(!0):this).get(),t(u[r])[n](a),o=o.concat(a);T=0,o=this.pushStack(o,e,u.selector)}return i=$,$=null,t.tmpl.complete(i),o}}),t.fn.extend({
// Use first wrapped element as template markup.
// Return wrapped set of template items, obtained by rendering template against data.
tmpl:function(e,n,l){return t.tmpl(this[0],e,n,l)},
// Find which rendered template item the first wrapped DOM element belongs to
tmplItem:function(){return t.tmplItem(this[0])},
// Consider the first wrapped element as a template declaration, and get the compiled template or store it as a named template.
template:function(e){return t.template(e,this[0])},domManip:function(e,n,l,a){if(e[0]&&t.isArray(e[0])){for(var r,p=t.makeArray(arguments),i=e[0],o=i.length,u=0;o>u&&!(r=t.data(i[u++],"tmplItem")););r&&T&&(p[2]=function(e){
// Handler called by oldManip when rendered template has been inserted into DOM.
t.tmpl.afterManip(this,e,l)}),_.apply(this,p)}else _.apply(this,arguments);return T=0,$||t.tmpl.complete(g),this}}),t.extend({
// Return wrapped set of template items, obtained by rendering template against data.
tmpl:function(e,a,r,i){var o,u=!i;if(u)i=w,e=t.template[e]||t.template(null,e),v={};else if(!e)
// Rebuild, without creating a new template item
// The template item is already associated with DOM - this is a refresh.
// Re-evaluate rendered template for the parentItem
return e=i.tmpl,g[i.key]=i,i.nodes=[],i.wrapped&&p(i,i.wrapped),t(l(i,null,i.tmpl(t,i)));return e?("function"==typeof a&&(a=a.call(i||{})),r&&r.wrapped&&p(r,r.wrapped),o=t.isArray(a)?t.map(a,function(t){return t?n(r,i,e,t):null}):[n(r,i,e,a)],u?t(l(i,null,o)):o):[]},
// Return rendered template item for an element.
tmplItem:function(e){var n;for(e instanceof t&&(e=e[0]);e&&1===e.nodeType&&!(n=t.data(e,"tmplItem"))&&(e=e.parentNode););return n||w},
// Set:
// Use $.template( name, tmpl ) to cache a named template,
// where tmpl is a template string, a script element or a jQuery instance wrapping a script element, etc.
// Use $( "selector" ).template( name ) to provide access by name to a script block template declaration.
// Get:
// Use $.template( name ) to access a cached template.
// Also $( selectorToScriptBlock ).template(), or $.template( null, templateString )
// will return the compiled template, without adding a name reference.
// If templateString includes at least one HTML tag, $.template( templateString ) is equivalent
// to $.template( null, templateString )
template:function(e,n){
// Compile template and associate with name
// This is an HTML string being passed directly in.
// If this is a template block, use cached copy, or generate tmpl function and cache.
// If not in map, and not containing at least on HTML tag, treat as a selector.
// (If integrated with core, use quickExpr.exec)
return n?("string"==typeof n?n=r(n):n instanceof t&&(n=n[0]||{}),n.nodeType&&(n=t.data(n,"tmpl")||t.data(n,"tmpl",r(n.innerHTML))),"string"==typeof e?t.template[e]=n:n):e?"string"!=typeof e?t.template(null,e):t.template[e]||t.template(null,y.test(e)?e:t(e)):null},encode:function(t){
// Do HTML encoding replacing < > & and ' and " by corresponding entities.
return(""+t).split("<").join("&lt;").split(">").join("&gt;").split('"').join("&#34;").split("'").join("&#39;")}}),t.extend(t.tmpl,{tag:{tmpl:{_default:{$2:"null"},open:"if($notnull_1){__=__.concat($item.nest($1,$2));}"},wrap:{_default:{$2:"null"},open:"$item.calls(__,$1,$2);__=[];",close:"call=$item.calls();__=call._.concat($item.wrap(call,__));"},each:{_default:{$2:"$index, $value"},open:"if($notnull_1){$.each($1a,function($2){with(this){",close:"}});}"},"if":{open:"if(($notnull_1) && $1a){",close:"}"},"else":{_default:{$1:"true"},open:"}else if(($notnull_1) && $1a){"},html:{
// Unecoded expression evaluation.
open:"if($notnull_1){__.push($1a);}"},"=":{
// Encoded expression evaluation. Abbreviated form is ${}.
_default:{$1:"$data"},open:"if($notnull_1){__.push($.encode($1a));}"},"!":{
// Comment tag. Skipped by parser
open:""}},
// This stub can be overridden, e.g. in jquery.tmplPlus for providing rendered events
complete:function(t){g={}},
// Call this from code which overrides domManip, or equivalent
// Manage cloning/storing template items etc.
afterManip:function(e,n,l){
// Provides cloned fragment ready for fixup prior to and after insertion into DOM
var a=11===n.nodeType?t.makeArray(n.childNodes):1===n.nodeType?[n]:[];
// Return fragment to original caller (e.g. append) for DOM insertion
l.call(e,n),
// Fragment has been inserted:- Add inserted nodes to tmplItem data structure. Replace inserted element annotations by jQuery.data.
u(a),T++}})}(jQuery);

//     Underscore.js 1.4.4
//     http://underscorejs.org
//     (c) 2009-2013 Jeremy Ashkenas, DocumentCloud Inc.
//     Underscore may be freely distributed under the MIT license.
(function(){
// Baseline setup
// --------------
// Establish the root object, `window` in the browser, or `global` on the server.
var n=this,t=n._,r={},e=Array.prototype,u=Object.prototype,i=Function.prototype,a=e.push,o=e.slice,c=e.concat,l=u.toString,f=u.hasOwnProperty,s=e.forEach,p=e.map,h=e.reduce,v=e.reduceRight,d=e.filter,y=e.every,g=e.some,m=e.indexOf,b=e.lastIndexOf,x=Array.isArray,_=Object.keys,w=i.bind,j=function(n){return n instanceof j?n:this instanceof j?void(this._wrapped=n):new j(n)};
// Export the Underscore object for **Node.js**, with
// backwards-compatibility for the old `require()` API. If we're in
// the browser, add `_` as a global object via a string identifier,
// for Closure Compiler "advanced" mode.
"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=j),exports._=j):n._=j,
// Current version.
j.VERSION="1.4.4";
// Collection Functions
// --------------------
// The cornerstone, an `each` implementation, aka `forEach`.
// Handles objects with the built-in `forEach`, arrays, and raw objects.
// Delegates to **ECMAScript 5**'s native `forEach` if available.
var A=j.each=j.forEach=function(n,t,e){if(null!=n)if(s&&n.forEach===s)n.forEach(t,e);else if(n.length===+n.length){for(var u=0,i=n.length;i>u;u++)if(t.call(e,n[u],u,n)===r)return}else for(var a in n)if(j.has(n,a)&&t.call(e,n[a],a,n)===r)return};
// Return the results of applying the iterator to each element.
// Delegates to **ECMAScript 5**'s native `map` if available.
j.map=j.collect=function(n,t,r){var e=[];return null==n?e:p&&n.map===p?n.map(t,r):(A(n,function(n,u,i){e[e.length]=t.call(r,n,u,i)}),e)};var E="Reduce of empty array with no initial value";
// **Reduce** builds up a single result from a list of values, aka `inject`,
// or `foldl`. Delegates to **ECMAScript 5**'s native `reduce` if available.
j.reduce=j.foldl=j.inject=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),h&&n.reduce===h)return e&&(t=j.bind(t,e)),u?n.reduce(t,r):n.reduce(t);if(A(n,function(n,i,a){u?r=t.call(e,r,n,i,a):(r=n,u=!0)}),!u)throw new TypeError(E);return r},
// The right-associative version of reduce, also known as `foldr`.
// Delegates to **ECMAScript 5**'s native `reduceRight` if available.
j.reduceRight=j.foldr=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),v&&n.reduceRight===v)return e&&(t=j.bind(t,e)),u?n.reduceRight(t,r):n.reduceRight(t);var i=n.length;if(i!==+i){var a=j.keys(n);i=a.length}if(A(n,function(o,c,l){c=a?a[--i]:--i,u?r=t.call(e,r,n[c],c,l):(r=n[c],u=!0)}),!u)throw new TypeError(E);return r},
// Return the first value which passes a truth test. Aliased as `detect`.
j.find=j.detect=function(n,t,r){var e;return O(n,function(n,u,i){return t.call(r,n,u,i)?(e=n,!0):void 0}),e},
// Return all the elements that pass a truth test.
// Delegates to **ECMAScript 5**'s native `filter` if available.
// Aliased as `select`.
j.filter=j.select=function(n,t,r){var e=[];return null==n?e:d&&n.filter===d?n.filter(t,r):(A(n,function(n,u,i){t.call(r,n,u,i)&&(e[e.length]=n)}),e)},
// Return all the elements for which a truth test fails.
j.reject=function(n,t,r){return j.filter(n,function(n,e,u){return!t.call(r,n,e,u)},r)},
// Determine whether all of the elements match a truth test.
// Delegates to **ECMAScript 5**'s native `every` if available.
// Aliased as `all`.
j.every=j.all=function(n,t,e){t||(t=j.identity);var u=!0;return null==n?u:y&&n.every===y?n.every(t,e):(A(n,function(n,i,a){return(u=u&&t.call(e,n,i,a))?void 0:r}),!!u)};
// Determine if at least one element in the object matches a truth test.
// Delegates to **ECMAScript 5**'s native `some` if available.
// Aliased as `any`.
var O=j.some=j.any=function(n,t,e){t||(t=j.identity);var u=!1;return null==n?u:g&&n.some===g?n.some(t,e):(A(n,function(n,i,a){return u||(u=t.call(e,n,i,a))?r:void 0}),!!u)};
// Determine if the array or object contains a given value (using `===`).
// Aliased as `include`.
j.contains=j.include=function(n,t){return null==n?!1:m&&n.indexOf===m?-1!=n.indexOf(t):O(n,function(n){return n===t})},
// Invoke a method (with arguments) on every item in a collection.
j.invoke=function(n,t){var r=o.call(arguments,2),e=j.isFunction(t);return j.map(n,function(n){return(e?t:n[t]).apply(n,r)})},
// Convenience version of a common use case of `map`: fetching a property.
j.pluck=function(n,t){return j.map(n,function(n){return n[t]})},
// Convenience version of a common use case of `filter`: selecting only objects
// containing specific `key:value` pairs.
j.where=function(n,t,r){return j.isEmpty(t)?r?void 0:[]:j[r?"find":"filter"](n,function(n){for(var r in t)if(t[r]!==n[r])return!1;return!0})},
// Convenience version of a common use case of `find`: getting the first object
// containing specific `key:value` pairs.
j.findWhere=function(n,t){return j.where(n,t,!0)},
// Return the maximum element or (element-based computation).
// Can't optimize arrays of integers longer than 65,535 elements.
// See: https://bugs.webkit.org/show_bug.cgi?id=80797
j.max=function(n,t,r){if(!t&&j.isArray(n)&&n[0]===+n[0]&&n.length<65535)return Math.max.apply(Math,n);if(!t&&j.isEmpty(n))return-(1/0);var e={computed:-(1/0),value:-(1/0)};return A(n,function(n,u,i){var a=t?t.call(r,n,u,i):n;a>=e.computed&&(e={value:n,computed:a})}),e.value},
// Return the minimum element (or element-based computation).
j.min=function(n,t,r){if(!t&&j.isArray(n)&&n[0]===+n[0]&&n.length<65535)return Math.min.apply(Math,n);if(!t&&j.isEmpty(n))return 1/0;var e={computed:1/0,value:1/0};return A(n,function(n,u,i){var a=t?t.call(r,n,u,i):n;a<e.computed&&(e={value:n,computed:a})}),e.value},
// Shuffle an array.
j.shuffle=function(n){var t,r=0,e=[];return A(n,function(n){t=j.random(r++),e[r-1]=e[t],e[t]=n}),e};
// An internal function to generate lookup iterators.
var k=function(n){return j.isFunction(n)?n:function(t){return t[n]}};
// Sort the object's values by a criterion produced by an iterator.
j.sortBy=function(n,t,r){var e=k(t);return j.pluck(j.map(n,function(n,t,u){return{value:n,index:t,criteria:e.call(r,n,t,u)}}).sort(function(n,t){var r=n.criteria,e=t.criteria;if(r!==e){if(r>e||void 0===r)return 1;if(e>r||void 0===e)return-1}return n.index<t.index?-1:1}),"value")};
// An internal function used for aggregate "group by" operations.
var F=function(n,t,r,e){var u={},i=k(t||j.identity);return A(n,function(t,a){var o=i.call(r,t,a,n);e(u,o,t)}),u};
// Groups the object's values by a criterion. Pass either a string attribute
// to group by, or a function that returns the criterion.
j.groupBy=function(n,t,r){return F(n,t,r,function(n,t,r){(j.has(n,t)?n[t]:n[t]=[]).push(r)})},
// Counts instances of an object that group by a certain criterion. Pass
// either a string attribute to count by, or a function that returns the
// criterion.
j.countBy=function(n,t,r){return F(n,t,r,function(n,t){j.has(n,t)||(n[t]=0),n[t]++})},
// Use a comparator function to figure out the smallest index at which
// an object should be inserted so as to maintain order. Uses binary search.
j.sortedIndex=function(n,t,r,e){r=null==r?j.identity:k(r);for(var u=r.call(e,t),i=0,a=n.length;a>i;){var o=i+a>>>1;r.call(e,n[o])<u?i=o+1:a=o}return i},
// Safely convert anything iterable into a real, live array.
j.toArray=function(n){return n?j.isArray(n)?o.call(n):n.length===+n.length?j.map(n,j.identity):j.values(n):[]},
// Return the number of elements in an object.
j.size=function(n){return null==n?0:n.length===+n.length?n.length:j.keys(n).length},
// Array Functions
// ---------------
// Get the first element of an array. Passing **n** will return the first N
// values in the array. Aliased as `head` and `take`. The **guard** check
// allows it to work with `_.map`.
j.first=j.head=j.take=function(n,t,r){return null!=n?null==t||r?n[0]:o.call(n,0,t):void 0},
// Returns everything but the last entry of the array. Especially useful on
// the arguments object. Passing **n** will return all the values in
// the array, excluding the last N. The **guard** check allows it to work with
// `_.map`.
j.initial=function(n,t,r){return o.call(n,0,n.length-(null==t||r?1:t))},
// Get the last element of an array. Passing **n** will return the last N
// values in the array. The **guard** check allows it to work with `_.map`.
j.last=function(n,t,r){return null!=n?null==t||r?n[n.length-1]:o.call(n,Math.max(n.length-t,0)):void 0},
// Returns everything but the first entry of the array. Aliased as `tail` and `drop`.
// Especially useful on the arguments object. Passing an **n** will return
// the rest N values in the array. The **guard**
// check allows it to work with `_.map`.
j.rest=j.tail=j.drop=function(n,t,r){return o.call(n,null==t||r?1:t)},
// Trim out all falsy values from an array.
j.compact=function(n){return j.filter(n,j.identity)};
// Internal implementation of a recursive `flatten` function.
var R=function(n,t,r){return A(n,function(n){j.isArray(n)?t?a.apply(r,n):R(n,t,r):r.push(n)}),r};
// Return a completely flattened version of an array.
j.flatten=function(n,t){return R(n,t,[])},
// Return a version of the array that does not contain the specified value(s).
j.without=function(n){return j.difference(n,o.call(arguments,1))},
// Produce a duplicate-free version of the array. If the array has already
// been sorted, you have the option of using a faster algorithm.
// Aliased as `unique`.
j.uniq=j.unique=function(n,t,r,e){j.isFunction(t)&&(e=r,r=t,t=!1);var u=r?j.map(n,r,e):n,i=[],a=[];return A(u,function(r,e){(t?e&&a[a.length-1]===r:j.contains(a,r))||(a.push(r),i.push(n[e]))}),i},
// Produce an array that contains the union: each distinct element from all of
// the passed-in arrays.
j.union=function(){return j.uniq(c.apply(e,arguments))},
// Produce an array that contains every item shared between all the
// passed-in arrays.
j.intersection=function(n){var t=o.call(arguments,1);return j.filter(j.uniq(n),function(n){return j.every(t,function(t){return j.indexOf(t,n)>=0})})},
// Take the difference between one array and a number of other arrays.
// Only the elements present in just the first array will remain.
j.difference=function(n){var t=c.apply(e,o.call(arguments,1));return j.filter(n,function(n){return!j.contains(t,n)})},
// Zip together multiple lists into a single array -- elements that share
// an index go together.
j.zip=function(){for(var n=o.call(arguments),t=j.max(j.pluck(n,"length")),r=new Array(t),e=0;t>e;e++)r[e]=j.pluck(n,""+e);return r},
// Converts lists into objects. Pass either a single array of `[key, value]`
// pairs, or two parallel arrays of the same length -- one of keys, and one of
// the corresponding values.
j.object=function(n,t){if(null==n)return{};for(var r={},e=0,u=n.length;u>e;e++)t?r[n[e]]=t[e]:r[n[e][0]]=n[e][1];return r},
// If the browser doesn't supply us with indexOf (I'm looking at you, **MSIE**),
// we need this function. Return the position of the first occurrence of an
// item in an array, or -1 if the item is not included in the array.
// Delegates to **ECMAScript 5**'s native `indexOf` if available.
// If the array is large and already in sort order, pass `true`
// for **isSorted** to use binary search.
j.indexOf=function(n,t,r){if(null==n)return-1;var e=0,u=n.length;if(r){if("number"!=typeof r)return e=j.sortedIndex(n,t),n[e]===t?e:-1;e=0>r?Math.max(0,u+r):r}if(m&&n.indexOf===m)return n.indexOf(t,r);for(;u>e;e++)if(n[e]===t)return e;return-1},
// Delegates to **ECMAScript 5**'s native `lastIndexOf` if available.
j.lastIndexOf=function(n,t,r){if(null==n)return-1;var e=null!=r;if(b&&n.lastIndexOf===b)return e?n.lastIndexOf(t,r):n.lastIndexOf(t);for(var u=e?r:n.length;u--;)if(n[u]===t)return u;return-1},
// Generate an integer Array containing an arithmetic progression. A port of
// the native Python `range()` function. See
// [the Python documentation](http://docs.python.org/library/functions.html#range).
j.range=function(n,t,r){arguments.length<=1&&(t=n||0,n=0),r=arguments[2]||1;for(var e=Math.max(Math.ceil((t-n)/r),0),u=0,i=new Array(e);e>u;)i[u++]=n,n+=r;return i},
// Function (ahem) Functions
// ------------------
// Create a function bound to a given object (assigning `this`, and arguments,
// optionally). Delegates to **ECMAScript 5**'s native `Function.bind` if
// available.
j.bind=function(n,t){if(n.bind===w&&w)return w.apply(n,o.call(arguments,1));var r=o.call(arguments,2);return function(){return n.apply(t,r.concat(o.call(arguments)))}},
// Partially apply a function by creating a version that has had some of its
// arguments pre-filled, without changing its dynamic `this` context.
j.partial=function(n){var t=o.call(arguments,1);return function(){return n.apply(this,t.concat(o.call(arguments)))}},
// Bind all of an object's methods to that object. Useful for ensuring that
// all callbacks defined on an object belong to it.
j.bindAll=function(n){var t=o.call(arguments,1);if(0===t.length)throw new Error("bindAll must be passed function names");return A(t,function(t){n[t]=j.bind(n[t],n)}),n},
// Memoize an expensive function by storing its results.
j.memoize=function(n,t){var r={};return t||(t=j.identity),function(){var e=t.apply(this,arguments);return j.has(r,e)?r[e]:r[e]=n.apply(this,arguments)}},
// Delays a function for the given number of milliseconds, and then calls
// it with the arguments supplied.
j.delay=function(n,t){var r=o.call(arguments,2);return setTimeout(function(){return n.apply(null,r)},t)},
// Defers a function, scheduling it to run after the current call stack has
// cleared.
j.defer=function(n){return j.delay.apply(j,[n,1].concat(o.call(arguments,1)))},
// Returns a function, that, when invoked, will only be triggered at most once
// during a given window of time.
j.throttle=function(n,t){var r,e,u,i,a=0,o=function(){a=new Date,u=null,i=n.apply(r,e)};return function(){var c=new Date,l=t-(c-a);return r=this,e=arguments,0>=l?(clearTimeout(u),u=null,a=c,i=n.apply(r,e)):u||(u=setTimeout(o,l)),i}},
// Returns a function, that, as long as it continues to be invoked, will not
// be triggered. The function will be called after it stops being called for
// N milliseconds. If `immediate` is passed, trigger the function on the
// leading edge, instead of the trailing.
j.debounce=function(n,t,r){var e,u;return function(){var i=this,a=arguments,o=function(){e=null,r||(u=n.apply(i,a))},c=r&&!e;return clearTimeout(e),e=setTimeout(o,t),c&&(u=n.apply(i,a)),u}},
// Returns a function that will be executed at most one time, no matter how
// often you call it. Useful for lazy initialization.
j.once=function(n){var t,r=!1;return function(){return r?t:(r=!0,t=n.apply(this,arguments),n=null,t)}},
// Returns the first function passed as an argument to the second,
// allowing you to adjust arguments, run code before and after, and
// conditionally execute the original function.
j.wrap=function(n,t){return function(){var r=[n];return a.apply(r,arguments),t.apply(this,r)}},
// Returns a function that is the composition of a list of functions, each
// consuming the return value of the function that follows.
j.compose=function(){var n=arguments;return function(){for(var t=arguments,r=n.length-1;r>=0;r--)t=[n[r].apply(this,t)];return t[0]}},
// Returns a function that will only be executed after being called N times.
j.after=function(n,t){return 0>=n?t():function(){return--n<1?t.apply(this,arguments):void 0}},
// Object Functions
// ----------------
// Retrieve the names of an object's properties.
// Delegates to **ECMAScript 5**'s native `Object.keys`
j.keys=_||function(n){if(n!==Object(n))throw new TypeError("Invalid object");var t=[];for(var r in n)j.has(n,r)&&(t[t.length]=r);return t},
// Retrieve the values of an object's properties.
j.values=function(n){var t=[];for(var r in n)j.has(n,r)&&t.push(n[r]);return t},
// Convert an object into a list of `[key, value]` pairs.
j.pairs=function(n){var t=[];for(var r in n)j.has(n,r)&&t.push([r,n[r]]);return t},
// Invert the keys and values of an object. The values must be serializable.
j.invert=function(n){var t={};for(var r in n)j.has(n,r)&&(t[n[r]]=r);return t},
// Return a sorted list of the function names available on the object.
// Aliased as `methods`
j.functions=j.methods=function(n){var t=[];for(var r in n)j.isFunction(n[r])&&t.push(r);return t.sort()},
// Extend a given object with all the properties in passed-in object(s).
j.extend=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)n[r]=t[r]}),n},
// Return a copy of the object only containing the whitelisted properties.
j.pick=function(n){var t={},r=c.apply(e,o.call(arguments,1));return A(r,function(r){r in n&&(t[r]=n[r])}),t},
// Return a copy of the object without the blacklisted properties.
j.omit=function(n){var t={},r=c.apply(e,o.call(arguments,1));for(var u in n)j.contains(r,u)||(t[u]=n[u]);return t},
// Fill in a given object with default properties.
j.defaults=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)null==n[r]&&(n[r]=t[r])}),n},
// Create a (shallow-cloned) duplicate of an object.
j.clone=function(n){return j.isObject(n)?j.isArray(n)?n.slice():j.extend({},n):n},
// Invokes interceptor with the obj, and then returns obj.
// The primary purpose of this method is to "tap into" a method chain, in
// order to perform operations on intermediate results within the chain.
j.tap=function(n,t){return t(n),n};
// Internal recursive comparison function for `isEqual`.
var S=function(n,t,r,e){
// Identical objects are equal. `0 === -0`, but they aren't identical.
// See the Harmony `egal` proposal: http://wiki.ecmascript.org/doku.php?id=harmony:egal.
if(n===t)return 0!==n||1/n==1/t;
// A strict comparison is necessary because `null == undefined`.
if(null==n||null==t)return n===t;
// Unwrap any wrapped objects.
n instanceof j&&(n=n._wrapped),t instanceof j&&(t=t._wrapped);
// Compare `[[Class]]` names.
var u=l.call(n);if(u!=l.call(t))return!1;switch(u){
// Strings, numbers, dates, and booleans are compared by value.
case"[object String]":
// Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
// equivalent to `new String("5")`.
return n==String(t);case"[object Number]":
// `NaN`s are equivalent, but non-reflexive. An `egal` comparison is performed for
// other numeric values.
return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case"[object Date]":case"[object Boolean]":
// Coerce dates and booleans to numeric primitive values. Dates are compared by their
// millisecond representations. Note that invalid dates with millisecond representations
// of `NaN` are not equivalent.
return+n==+t;
// RegExps are compared by their source patterns and flags.
case"[object RegExp]":return n.source==t.source&&n.global==t.global&&n.multiline==t.multiline&&n.ignoreCase==t.ignoreCase}if("object"!=typeof n||"object"!=typeof t)return!1;for(
// Assume equality for cyclic structures. The algorithm for detecting cyclic
// structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
var i=r.length;i--;)
// Linear search. Performance is inversely proportional to the number of
// unique nested structures.
if(r[i]==n)return e[i]==t;
// Add the first object to the stack of traversed objects.
r.push(n),e.push(t);var a=0,o=!0;
// Recursively compare objects and arrays.
if("[object Array]"==u){if(a=n.length,o=a==t.length)
// Deep compare the contents, ignoring non-numeric properties.
for(;a--&&(o=S(n[a],t[a],r,e)););}else{
// Objects with different constructors are not equivalent, but `Object`s
// from different frames are.
var c=n.constructor,f=t.constructor;if(c!==f&&!(j.isFunction(c)&&c instanceof c&&j.isFunction(f)&&f instanceof f))return!1;
// Deep compare objects.
for(var s in n)if(j.has(n,s)&&(
// Count the expected number of properties.
a++,!(o=j.has(t,s)&&S(n[s],t[s],r,e))))break;
// Ensure that both objects contain the same number of properties.
if(o){for(s in t)if(j.has(t,s)&&!a--)break;o=!a}}
// Remove the first object from the stack of traversed objects.
return r.pop(),e.pop(),o};
// Perform a deep comparison to check if two objects are equal.
j.isEqual=function(n,t){return S(n,t,[],[])},
// Is a given array, string, or object empty?
// An "empty" object has no enumerable own-properties.
j.isEmpty=function(n){if(null==n)return!0;if(j.isArray(n)||j.isString(n))return 0===n.length;for(var t in n)if(j.has(n,t))return!1;return!0},
// Is a given value a DOM element?
j.isElement=function(n){return!(!n||1!==n.nodeType)},
// Is a given value an array?
// Delegates to ECMA5's native Array.isArray
j.isArray=x||function(n){return"[object Array]"==l.call(n)},
// Is a given variable an object?
j.isObject=function(n){return n===Object(n)},
// Add some isType methods: isArguments, isFunction, isString, isNumber, isDate, isRegExp.
A(["Arguments","Function","String","Number","Date","RegExp"],function(n){j["is"+n]=function(t){return l.call(t)=="[object "+n+"]"}}),
// Define a fallback version of the method in browsers (ahem, IE), where
// there isn't any inspectable "Arguments" type.
j.isArguments(arguments)||(j.isArguments=function(n){return!(!n||!j.has(n,"callee"))}),
// Optimize `isFunction` if appropriate.
"function"!=typeof/./&&(j.isFunction=function(n){return"function"==typeof n}),
// Is a given object a finite number?
j.isFinite=function(n){return isFinite(n)&&!isNaN(parseFloat(n))},
// Is the given value `NaN`? (NaN is the only number which does not equal itself).
j.isNaN=function(n){return j.isNumber(n)&&n!=+n},
// Is a given value a boolean?
j.isBoolean=function(n){return n===!0||n===!1||"[object Boolean]"==l.call(n)},
// Is a given value equal to null?
j.isNull=function(n){return null===n},
// Is a given variable undefined?
j.isUndefined=function(n){return void 0===n},
// Shortcut function for checking if an object has a given property directly
// on itself (in other words, not on a prototype).
j.has=function(n,t){return f.call(n,t)},
// Utility Functions
// -----------------
// Run Underscore.js in *noConflict* mode, returning the `_` variable to its
// previous owner. Returns a reference to the Underscore object.
j.noConflict=function(){return n._=t,this},
// Keep the identity function around for default iterators.
j.identity=function(n){return n},
// Run a function **n** times.
j.times=function(n,t,r){for(var e=Array(n),u=0;n>u;u++)e[u]=t.call(r,u);return e},
// Return a random integer between min and max (inclusive).
j.random=function(n,t){return null==t&&(t=n,n=0),n+Math.floor(Math.random()*(t-n+1))};
// List of HTML entities for escaping.
var I={escape:{"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","/":"&#x2F;"}};I.unescape=j.invert(I.escape);
// Regexes containing the keys and values listed immediately above.
var M={escape:new RegExp("["+j.keys(I.escape).join("")+"]","g"),unescape:new RegExp("("+j.keys(I.unescape).join("|")+")","g")};
// Functions for escaping and unescaping strings to/from HTML interpolation.
j.each(["escape","unescape"],function(n){j[n]=function(t){return null==t?"":(""+t).replace(M[n],function(t){return I[n][t]})}}),
// If the value of the named property is a function then invoke it;
// otherwise, return it.
j.result=function(n,t){if(null!=n){var r=n[t];return j.isFunction(r)?r.call(n):r}},
// Add your own custom functions to the Underscore object.
j.mixin=function(n){A(j.functions(n),function(t){var r=j[t]=n[t];j.prototype[t]=function(){var n=[this._wrapped];return a.apply(n,arguments),D.call(this,r.apply(j,n))}})};
// Generate a unique integer id (unique within the entire client session).
// Useful for temporary DOM ids.
var N=0;j.uniqueId=function(n){var t=++N+"";return n?n+t:t},
// By default, Underscore uses ERB-style template delimiters, change the
// following template settings to use alternative delimiters.
j.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};
// When customizing `templateSettings`, if you don't want to define an
// interpolation, evaluation or escaping regex, we need one that is
// guaranteed not to match.
var T=/(.)^/,q={"'":"'","\\":"\\","\r":"r","\n":"n","	":"t","\u2028":"u2028","\u2029":"u2029"},B=/\\|'|\r|\n|\t|\u2028|\u2029/g;
// JavaScript micro-templating, similar to John Resig's implementation.
// Underscore templating handles arbitrary delimiters, preserves whitespace,
// and correctly escapes quotes within interpolated code.
j.template=function(n,t,r){var e;r=j.defaults({},r,j.templateSettings);
// Combine delimiters into one regular expression via alternation.
var u=new RegExp([(r.escape||T).source,(r.interpolate||T).source,(r.evaluate||T).source].join("|")+"|$","g"),i=0,a="__p+='";n.replace(u,function(t,r,e,u,o){return a+=n.slice(i,o).replace(B,function(n){return"\\"+q[n]}),r&&(a+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'"),e&&(a+="'+\n((__t=("+e+"))==null?'':__t)+\n'"),u&&(a+="';\n"+u+"\n__p+='"),i=o+t.length,t}),a+="';\n",r.variable||(a="with(obj||{}){\n"+a+"}\n"),a="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+a+"return __p;\n";try{e=new Function(r.variable||"obj","_",a)}catch(o){throw o.source=a,o}if(t)return e(t,j);var c=function(n){return e.call(this,n,j)};
// Provide the compiled function source as a convenience for precompilation.
return c.source="function("+(r.variable||"obj")+"){\n"+a+"}",c},
// Add a "chain" function, which will delegate to the wrapper.
j.chain=function(n){return j(n).chain()};
// OOP
// ---------------
// If Underscore is called as a function, it returns a wrapped object that
// can be used OO-style. This wrapper holds altered versions of all the
// underscore functions. Wrapped objects may be chained.
// Helper function to continue chaining intermediate results.
var D=function(n){return this._chain?j(n).chain():n};
// Add all of the Underscore functions to the wrapper object.
j.mixin(j),
// Add all mutator Array functions to the wrapper.
A(["pop","push","reverse","shift","sort","splice","unshift"],function(n){var t=e[n];j.prototype[n]=function(){var r=this._wrapped;return t.apply(r,arguments),"shift"!=n&&"splice"!=n||0!==r.length||delete r[0],D.call(this,r)}}),
// Add all accessor Array functions to the wrapper.
A(["concat","join","slice"],function(n){var t=e[n];j.prototype[n]=function(){return D.call(this,t.apply(this._wrapped,arguments))}}),j.extend(j.prototype,{
// Start chaining a wrapped Underscore object.
chain:function(){return this._chain=!0,this},
// Extracts the result from a wrapped and chained object.
value:function(){return this._wrapped}})}).call(this);

var smiley_map = {};function insert_smiley(smiley, field_id) {var el = document.getElementsByName(field_id)[0], newStart;if ( ! el && smiley_map[field_id]) {el = document.getElementById(smiley_map[field_id]);if ( ! el)return false;}el.focus();smiley = " " + smiley;if ('selectionStart' in el) {newStart = el.selectionStart + smiley.length;el.value = el.value.substr(0, el.selectionStart) +smiley +el.value.substr(el.selectionEnd, el.value.length);el.setSelectionRange(newStart, newStart);}else if (document.selection) {document.selection.createRange().text = smiley;}}

/*!
 * ExpressionEngine - by EllisLab
 *
 * @package		ExpressionEngine
 * @author		EllisLab Dev Team
 * @copyright	Copyright (c) 2003 - 2015, EllisLab, Inc.
 * @license		http://ellislab.com/expressionengine/user-guide/license.html
 * @link		http://ellislab.com
 * @since		Version 2.0
 * @filesource
 */
//Dynamically set the textarea name
function setFieldName(e){e!=selField&&(selField=e,clear_state(),tagarray=new Array,usedarray=new Array,running=0)}
// Insert tag
function taginsert(item,tagOpen,tagClose){
// Determine which tag we are dealing with
var which=eval("item.name");if(!selField)return $.ee_notice(no_cursor),!1;var theSelection=!1,result=!1,theField=document.getElementById("entryform")[selField];
// Is this a Windows user?
// If so, add tags around selection
if("guided"==selMode&&(data=prompt(enter_text,""),null!=data&&""!=data&&(result=tagOpen+data+tagClose)),document.selection)return theSelection=document.selection.createRange().text,theField.focus(),theSelection?document.selection.createRange().text=0==result?tagOpen+theSelection+tagClose:result:document.selection.createRange().text=0==result?tagOpen+tagClose:result,theSelection="",theField.blur(),void theField.focus();if(!isNaN(theField.selectionEnd)){var newStart,scrollPos=theField.scrollTop,selLength=theField.textLength,selStart=theField.selectionStart,selEnd=theField.selectionEnd;2>=selEnd&&"undefined"!=typeof selLength&&(selEnd=selLength);var s1=theField.value.substring(0,selStart),s2=theField.value.substring(selStart,selEnd).s3=theField.value.substring(selEnd,selLength);return 0==result?(newStart=selStart+tagOpen.length+s2.length+tagClose.length,theField.value=0==result?s1+tagOpen+s2+tagClose+s3:result):(newStart=selStart+result.length,theField.value=s1+result+s3),theField.focus(),theField.selectionStart=newStart,theField.selectionEnd=newStart,void(theField.scrollTop=scrollPos)}if("guided"==selMode)return curField=document.submit_post[selfField],curField.value+=result,curField.blur(),void curField.focus();
// Add single open tags
if("other"==item)eval("document.getElementById('entryform')."+selField+".value += tagOpen");else if(0==eval(which)){var result=tagOpen;eval("document.getElementById('entryform')."+selField+".value += result"),eval(which+" = 1"),arraypush(tagarray,tagClose),arraypush(usedarray,which),running++,styleswap(which)}else{for(
// Close tags
n=0,i=0;i<tagarray.length;i++)if(tagarray[i]==tagClose){for(n=i,running--;tagarray[n];)closeTag=arraypop(tagarray),eval("document.getElementById('entryform')."+selField+".value += closeTag");for(;usedarray[n];)clearState=arraypop(usedarray),eval(clearState+" = 0"),document.getElementById(clearState).className="htmlButtonA"}running<=0&&"htmlButtonB"==document.getElementById("close_all").className&&(document.getElementById("close_all").className="htmlButtonA")}curField=eval("document.getElementById('entryform')."+selField),curField.blur(),curField.focus()}var selField=!1,selMode="normal";$(document).ready(function(){$(".js_show").show(),$(".js_hide").hide(),void 0!==EE.publish.markitup&&void 0!==EE.publish.markitup.fields&&$.each(EE.publish.markitup.fields,function(e,t){$("#"+e).markItUp(mySettings)}),EE.publish.smileys===!0&&($("a.glossary_link").click(function(){return $(this).parent().siblings(".glossary_content").slideToggle("fast"),$(this).parent().siblings(".smileyContent .spellcheck_content").hide(),!1}),$("a.smiley_link").toggle(function(){which=$(this).attr("id").substr(12),$("#smiley_table_"+which).slideDown("fast",function(){$(this).css("display","")})},function(){$("#smiley_table_"+which).slideUp("fast")}),$(this).parent().siblings(".glossary_content, .spellcheck_content").hide(),$(".glossary_content a").click(function(){return $.markItUp({replaceWith:$(this).attr("title")}),!1})),$(".btn_plus a").click(function(){return confirm(EE.lang.confirm_exit,"")}),
// inject the collapse button into the formatting buttons list
$(".markItUpHeader ul").prepend('<li class="close_formatting_buttons"><a href="#"><img width="10" height="10" src="'+EE.THEME_URL+'images/publish_minus.gif" alt="Close Formatting Buttons"/></a></li>'),$(".close_formatting_buttons a").toggle(function(){$(this).parent().parent().children(":not(.close_formatting_buttons)").hide(),$(this).parent().parent().css("height","13px"),$(this).children("img").attr("src",EE.THEME_URL+"images/publish_plus.png")},function(){$(this).parent().parent().children().show(),$(this).parent().parent().css("height","auto"),$(this).children("img").attr("src",EE.THEME_URL+"images/publish_minus.gif")});var e="";EE.publish.show_write_mode===!0&&$("#write_mode_textarea").markItUp(myWritemodeSettings),$(".write_mode_trigger").click(function(){
// put contents from other page into here
return e=$(this).attr("id").match(/^id_\d+$/)?"field_"+$(this).attr("id"):$(this).attr("id").replace(/id_/,""),$("#write_mode_textarea").val($("#"+e).val()),$("#write_mode_textarea").focus(),!1})});