Index: trunk/prototype/plugins/jquery/i18n/jquery.ui.datepicker-pt-BR.js
===================================================================
--- trunk/prototype/plugins/jquery/i18n/jquery.ui.datepicker-pt-BR.js	(revision 5341)
+++ trunk/prototype/plugins/jquery/i18n/jquery.ui.datepicker-pt-BR.js	(revision 5341)
@@ -0,0 +1,23 @@
+/* Brazilian initialisation for the jQuery UI date picker plugin. */
+/* Written by Leonildo Costa Silva (leocsilva@gmail.com). */
+jQuery(function($){
+	$.datepicker.regional['pt-BR'] = {
+		closeText: 'Fechar',
+		prevText: '&#x3c;Anterior',
+		nextText: 'Pr&oacute;ximo&#x3e;',
+		currentText: 'Hoje',
+		monthNames: ['Janeiro','Fevereiro','Mar&ccedil;o','Abril','Maio','Junho',
+		'Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'],
+		monthNamesShort: ['Jan','Fev','Mar','Abr','Mai','Jun',
+		'Jul','Ago','Set','Out','Nov','Dez'],
+		dayNames: ['Domingo','Segunda-feira','Ter&ccedil;a-feira','Quarta-feira','Quinta-feira','Sexta-feira','Sabado'],
+		dayNamesShort: ['Dom','Seg','Ter','Qua','Qui','Sex','Sab'],
+		dayNamesMin: ['Dom','Seg','Ter','Qua','Qui','Sex','Sab'],
+		weekHeader: 'Sm',
+		dateFormat: 'dd/mm/yy',
+		firstDay: 0,
+		isRTL: false,
+		showMonthAfterYear: false,
+		yearSuffix: ''};
+	$.datepicker.setDefaults($.datepicker.regional['pt-BR']);
+});
Index: trunk/prototype/plugins/jquery/jquery-ui.custom.min.js
===================================================================
--- trunk/prototype/plugins/jquery/jquery-ui.custom.min.js	(revision 5341)
+++ trunk/prototype/plugins/jquery/jquery-ui.custom.min.js	(revision 5341)
@@ -0,0 +1,791 @@
+/*!
+ * jQuery UI 1.8.16
+ *
+ * Copyright 2011, 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(c,j){function k(a,b){var d=a.nodeName.toLowerCase();if("area"===d){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map")return false;a=c("img[usemap=#"+d+"]")[0];return!!a&&l(a)}return(/input|select|textarea|button|object/.test(d)?!a.disabled:"a"==d?a.href||b:b)&&l(a)}function l(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.16",
+keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,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}});c.fn.extend({propAttr:c.fn.prop||c.fn.attr,_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=
+this;setTimeout(function(){c(d).focus();b&&b.call(d)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this,"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,
+"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==j)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position");if(b==="absolute"||b==="relative"||b==="fixed"){b=parseInt(a.css("zIndex"),10);if(!isNaN(b)&&b!==0)return b}a=a.parent()}}return 0},disableSelection:function(){return this.bind((c.support.selectstart?"selectstart":
+"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});c.each(["Width","Height"],function(a,b){function d(f,g,m,n){c.each(e,function(){g-=parseFloat(c.curCSS(f,"padding"+this,true))||0;if(m)g-=parseFloat(c.curCSS(f,"border"+this+"Width",true))||0;if(n)g-=parseFloat(c.curCSS(f,"margin"+this,true))||0});return g}var e=b==="Width"?["Left","Right"]:["Top","Bottom"],h=b.toLowerCase(),i={innerWidth:c.fn.innerWidth,innerHeight:c.fn.innerHeight,
+outerWidth:c.fn.outerWidth,outerHeight:c.fn.outerHeight};c.fn["inner"+b]=function(f){if(f===j)return i["inner"+b].call(this);return this.each(function(){c(this).css(h,d(this,f)+"px")})};c.fn["outer"+b]=function(f,g){if(typeof f!=="number")return i["outer"+b].call(this,f);return this.each(function(){c(this).css(h,d(this,f,true,g)+"px")})}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){return k(a,!isNaN(c.attr(a,"tabindex")))},tabbable:function(a){var b=c.attr(a,
+"tabindex"),d=isNaN(b);return(d||b>=0)&&k(a,!d)}});c(function(){var a=document.body,b=a.appendChild(b=document.createElement("div"));c.extend(b.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});c.support.minHeight=b.offsetHeight===100;c.support.selectstart="onselectstart"in b;a.removeChild(b).style.display="none"});c.extend(c.ui,{plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&
+a.element[0].parentNode)for(var e=0;e<b.length;e++)a.options[b[e][0]]&&b[e][1].apply(a.element,d)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(a,b){if(c(a).css("overflow")==="hidden")return false;b=b&&b==="left"?"scrollLeft":"scrollTop";var d=false;if(a[b]>0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a<b+d},isOver:function(a,b,d,e,h,i){return c.ui.isOverAxis(a,d,h)&&
+c.ui.isOverAxis(b,e,i)}})}})(jQuery);
+;/*!
+ * jQuery UI Widget 1.8.16
+ *
+ * Copyright 2011, 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(b,j){if(b.cleanData){var k=b.cleanData;b.cleanData=function(a){for(var c=0,d;(d=a[c])!=null;c++)try{b(d).triggerHandler("remove")}catch(e){}k(a)}}else{var l=b.fn.remove;b.fn.remove=function(a,c){return this.each(function(){if(!c)if(!a||b.filter(a,[this]).length)b("*",this).add([this]).each(function(){try{b(this).triggerHandler("remove")}catch(d){}});return l.call(b(this),a,c)})}}b.widget=function(a,c,d){var e=a.split(".")[0],f;a=a.split(".")[1];f=e+"-"+a;if(!d){d=c;c=b.Widget}b.expr[":"][f]=
+function(h){return!!b.data(h,a)};b[e]=b[e]||{};b[e][a]=function(h,g){arguments.length&&this._createWidget(h,g)};c=new c;c.options=b.extend(true,{},c.options);b[e][a].prototype=b.extend(true,c,{namespace:e,widgetName:a,widgetEventPrefix:b[e][a].prototype.widgetEventPrefix||a,widgetBaseClass:f},d);b.widget.bridge(a,b[e][a])};b.widget.bridge=function(a,c){b.fn[a]=function(d){var e=typeof d==="string",f=Array.prototype.slice.call(arguments,1),h=this;d=!e&&f.length?b.extend.apply(null,[true,d].concat(f)):
+d;if(e&&d.charAt(0)==="_")return h;e?this.each(function(){var g=b.data(this,a),i=g&&b.isFunction(g[d])?g[d].apply(g,f):g;if(i!==g&&i!==j){h=i;return false}}):this.each(function(){var g=b.data(this,a);g?g.option(d||{})._init():b.data(this,a,new c(d,this))});return h}};b.Widget=function(a,c){arguments.length&&this._createWidget(a,c)};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(a,c){b.data(c,this.widgetName,this);this.element=b(c);this.options=
+b.extend(true,{},this.options,this._getCreateOptions(),a);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return b.metadata&&b.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(a,c){var d=a;if(arguments.length===0)return b.extend({},this.options);if(typeof a==="string"){if(c===j)return this.options[a];d={};d[a]=c}this._setOptions(d);return this},_setOptions:function(a){var c=this;b.each(a,function(d,e){c._setOption(d,e)});return this},_setOption:function(a,c){this.options[a]=c;if(a==="disabled")this.widget()[c?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",
+c);return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(a,c,d){var e=this.options[a];c=b.Event(c);c.type=(a===this.widgetEventPrefix?a:this.widgetEventPrefix+a).toLowerCase();d=d||{};if(c.originalEvent){a=b.event.props.length;for(var f;a;){f=b.event.props[--a];c[f]=c.originalEvent[f]}}this.element.trigger(c,d);return!(b.isFunction(e)&&e.call(this.element[0],c,d)===false||c.isDefaultPrevented())}}})(jQuery);
+;/*!
+ * jQuery UI Mouse 1.8.16
+ *
+ * Copyright 2011, 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(b){var d=false;b(document).mouseup(function(){d=false});b.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var a=this;this.element.bind("mousedown."+this.widgetName,function(c){return a._mouseDown(c)}).bind("click."+this.widgetName,function(c){if(true===b.data(c.target,a.widgetName+".preventClickEvent")){b.removeData(c.target,a.widgetName+".preventClickEvent");c.stopImmediatePropagation();return false}});this.started=false},_mouseDestroy:function(){this.element.unbind("."+
+this.widgetName)},_mouseDown:function(a){if(!d){this._mouseStarted&&this._mouseUp(a);this._mouseDownEvent=a;var c=this,f=a.which==1,g=typeof this.options.cancel=="string"&&a.target.nodeName?b(a.target).closest(this.options.cancel).length:false;if(!f||g||!this._mouseCapture(a))return true;this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet)this._mouseDelayTimer=setTimeout(function(){c.mouseDelayMet=true},this.options.delay);if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a)){this._mouseStarted=
+this._mouseStart(a)!==false;if(!this._mouseStarted){a.preventDefault();return true}}true===b.data(a.target,this.widgetName+".preventClickEvent")&&b.removeData(a.target,this.widgetName+".preventClickEvent");this._mouseMoveDelegate=function(e){return c._mouseMove(e)};this._mouseUpDelegate=function(e){return c._mouseUp(e)};b(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);a.preventDefault();return d=true}},_mouseMove:function(a){if(b.browser.msie&&
+!(document.documentMode>=9)&&!a.button)return this._mouseUp(a);if(this._mouseStarted){this._mouseDrag(a);return a.preventDefault()}if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a))(this._mouseStarted=this._mouseStart(this._mouseDownEvent,a)!==false)?this._mouseDrag(a):this._mouseUp(a);return!this._mouseStarted},_mouseUp:function(a){b(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=
+false;a.target==this._mouseDownEvent.target&&b.data(a.target,this.widgetName+".preventClickEvent",true);this._mouseStop(a)}return false},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}})})(jQuery);
+;/*
+ * jQuery UI Position 1.8.16
+ *
+ * Copyright 2011, 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(c){c.ui=c.ui||{};var n=/left|center|right/,o=/top|center|bottom/,t=c.fn.position,u=c.fn.offset;c.fn.position=function(b){if(!b||!b.of)return t.apply(this,arguments);b=c.extend({},b);var a=c(b.of),d=a[0],g=(b.collision||"flip").split(" "),e=b.offset?b.offset.split(" "):[0,0],h,k,j;if(d.nodeType===9){h=a.width();k=a.height();j={top:0,left:0}}else if(d.setTimeout){h=a.width();k=a.height();j={top:a.scrollTop(),left:a.scrollLeft()}}else if(d.preventDefault){b.at="left top";h=k=0;j={top:b.of.pageY,
+left:b.of.pageX}}else{h=a.outerWidth();k=a.outerHeight();j=a.offset()}c.each(["my","at"],function(){var f=(b[this]||"").split(" ");if(f.length===1)f=n.test(f[0])?f.concat(["center"]):o.test(f[0])?["center"].concat(f):["center","center"];f[0]=n.test(f[0])?f[0]:"center";f[1]=o.test(f[1])?f[1]:"center";b[this]=f});if(g.length===1)g[1]=g[0];e[0]=parseInt(e[0],10)||0;if(e.length===1)e[1]=e[0];e[1]=parseInt(e[1],10)||0;if(b.at[0]==="right")j.left+=h;else if(b.at[0]==="center")j.left+=h/2;if(b.at[1]==="bottom")j.top+=
+k;else if(b.at[1]==="center")j.top+=k/2;j.left+=e[0];j.top+=e[1];return this.each(function(){var f=c(this),l=f.outerWidth(),m=f.outerHeight(),p=parseInt(c.curCSS(this,"marginLeft",true))||0,q=parseInt(c.curCSS(this,"marginTop",true))||0,v=l+p+(parseInt(c.curCSS(this,"marginRight",true))||0),w=m+q+(parseInt(c.curCSS(this,"marginBottom",true))||0),i=c.extend({},j),r;if(b.my[0]==="right")i.left-=l;else if(b.my[0]==="center")i.left-=l/2;if(b.my[1]==="bottom")i.top-=m;else if(b.my[1]==="center")i.top-=
+m/2;i.left=Math.round(i.left);i.top=Math.round(i.top);r={left:i.left-p,top:i.top-q};c.each(["left","top"],function(s,x){c.ui.position[g[s]]&&c.ui.position[g[s]][x](i,{targetWidth:h,targetHeight:k,elemWidth:l,elemHeight:m,collisionPosition:r,collisionWidth:v,collisionHeight:w,offset:e,my:b.my,at:b.at})});c.fn.bgiframe&&f.bgiframe();f.offset(c.extend(i,{using:b.using}))})};c.ui.position={fit:{left:function(b,a){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();b.left=
+d>0?b.left-d:Math.max(b.left-a.collisionPosition.left,b.left)},top:function(b,a){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();b.top=d>0?b.top-d:Math.max(b.top-a.collisionPosition.top,b.top)}},flip:{left:function(b,a){if(a.at[0]!=="center"){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();var g=a.my[0]==="left"?-a.elemWidth:a.my[0]==="right"?a.elemWidth:0,e=a.at[0]==="left"?a.targetWidth:-a.targetWidth,h=-2*a.offset[0];b.left+=
+a.collisionPosition.left<0?g+e+h:d>0?g+e+h:0}},top:function(b,a){if(a.at[1]!=="center"){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();var g=a.my[1]==="top"?-a.elemHeight:a.my[1]==="bottom"?a.elemHeight:0,e=a.at[1]==="top"?a.targetHeight:-a.targetHeight,h=-2*a.offset[1];b.top+=a.collisionPosition.top<0?g+e+h:d>0?g+e+h:0}}}};if(!c.offset.setOffset){c.offset.setOffset=function(b,a){if(/static/.test(c.curCSS(b,"position")))b.style.position="relative";var d=c(b),
+g=d.offset(),e=parseInt(c.curCSS(b,"top",true),10)||0,h=parseInt(c.curCSS(b,"left",true),10)||0;g={top:a.top-g.top+e,left:a.left-g.left+h};"using"in a?a.using.call(b,g):d.css(g)};c.fn.offset=function(b){var a=this[0];if(!a||!a.ownerDocument)return null;if(b)return this.each(function(){c.offset.setOffset(this,b)});return u.call(this)}}})(jQuery);
+;/*
+ * jQuery UI Draggable 1.8.16
+ *
+ * Copyright 2011, 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(d){d.widget("ui.draggable",d.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:true,appendTo:"parent",axis:false,connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false},_create:function(){if(this.options.helper==
+"original"&&!/^(?: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(){if(this.element.data("draggable")){this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy();return this}},_mouseCapture:function(a){var b=
+this.options;if(this.helper||b.disabled||d(a.target).is(".ui-resizable-handle"))return false;this.handle=this._getHandle(a);if(!this.handle)return false;if(b.iframeFix)d(b.iframeFix===true?"iframe":b.iframeFix).each(function(){d('<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(d(this).offset()).appendTo("body")});return true},_mouseStart:function(a){var b=this.options;
+this.helper=this._createHelper(a);this._cacheHelperProportions();if(d.ui.ddmanager)d.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};d.extend(this.offset,{click:{left:a.pageX-this.offset.left,top:a.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});
+this.originalPosition=this.position=this._generatePosition(a);this.originalPageX=a.pageX;this.originalPageY=a.pageY;b.cursorAt&&this._adjustOffsetFromHelper(b.cursorAt);b.containment&&this._setContainment();if(this._trigger("start",a)===false){this._clear();return false}this._cacheHelperProportions();d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,a);this.helper.addClass("ui-draggable-dragging");this._mouseDrag(a,true);d.ui.ddmanager&&d.ui.ddmanager.dragStart(this,a);return true},
+_mouseDrag:function(a,b){this.position=this._generatePosition(a);this.positionAbs=this._convertPositionTo("absolute");if(!b){b=this._uiHash();if(this._trigger("drag",a,b)===false){this._mouseUp({});return false}this.position=b.position}if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";d.ui.ddmanager&&d.ui.ddmanager.drag(this,a);return false},_mouseStop:function(a){var b=
+false;if(d.ui.ddmanager&&!this.options.dropBehaviour)b=d.ui.ddmanager.drop(this,a);if(this.dropped){b=this.dropped;this.dropped=false}if((!this.element[0]||!this.element[0].parentNode)&&this.options.helper=="original")return false;if(this.options.revert=="invalid"&&!b||this.options.revert=="valid"&&b||this.options.revert===true||d.isFunction(this.options.revert)&&this.options.revert.call(this.element,b)){var c=this;d(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,
+10),function(){c._trigger("stop",a)!==false&&c._clear()})}else this._trigger("stop",a)!==false&&this._clear();return false},_mouseUp:function(a){this.options.iframeFix===true&&d("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)});d.ui.ddmanager&&d.ui.ddmanager.dragStop(this,a);return d.ui.mouse.prototype._mouseUp.call(this,a)},cancel:function(){this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear();return this},_getHandle:function(a){var b=!this.options.handle||
+!d(this.options.handle,this.element).length?true:false;d(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==a.target)b=true});return b},_createHelper:function(a){var b=this.options;a=d.isFunction(b.helper)?d(b.helper.apply(this.element[0],[a])):b.helper=="clone"?this.element.clone().removeAttr("id"):this.element;a.parents("body").length||a.appendTo(b.appendTo=="parent"?this.element[0].parentNode:b.appendTo);a[0]!=this.element[0]&&!/(fixed|absolute)/.test(a.css("position"))&&
+a.css("position","absolute");return a},_adjustOffsetFromHelper:function(a){if(typeof a=="string")a=a.split(" ");if(d.isArray(a))a={left:+a[0],top:+a[1]||0};if("left"in a)this.offset.click.left=a.left+this.margins.left;if("right"in a)this.offset.click.left=this.helperProportions.width-a.right+this.margins.left;if("top"in a)this.offset.click.top=a.top+this.margins.top;if("bottom"in a)this.offset.click.top=this.helperProportions.height-a.bottom+this.margins.top},_getParentOffset:function(){this.offsetParent=
+this.helper.offsetParent();var a=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0])){a.left+=this.scrollParent.scrollLeft();a.top+=this.scrollParent.scrollTop()}if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&d.browser.msie)a={top:0,left:0};return{top:a.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:a.left+(parseInt(this.offsetParent.css("borderLeftWidth"),
+10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.element.position();return{top:a.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else 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 a=this.options;if(a.containment=="parent")a.containment=this.helper[0].parentNode;if(a.containment=="document"||a.containment=="window")this.containment=[a.containment=="document"?0:d(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,a.containment=="document"?0:d(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,
+(a.containment=="document"?0:d(window).scrollLeft())+d(a.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(a.containment=="document"?0:d(window).scrollTop())+(d(a.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(a.containment)&&a.containment.constructor!=Array){a=d(a.containment);var b=a[0];if(b){a.offset();var c=d(b).css("overflow")!=
+"hidden";this.containment=[(parseInt(d(b).css("borderLeftWidth"),10)||0)+(parseInt(d(b).css("paddingLeft"),10)||0),(parseInt(d(b).css("borderTopWidth"),10)||0)+(parseInt(d(b).css("paddingTop"),10)||0),(c?Math.max(b.scrollWidth,b.offsetWidth):b.offsetWidth)-(parseInt(d(b).css("borderLeftWidth"),10)||0)-(parseInt(d(b).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(c?Math.max(b.scrollHeight,b.offsetHeight):b.offsetHeight)-(parseInt(d(b).css("borderTopWidth"),
+10)||0)-(parseInt(d(b).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom];this.relative_container=a}}else if(a.containment.constructor==Array)this.containment=a.containment},_convertPositionTo:function(a,b){if(!b)b=this.position;a=a=="absolute"?1:-1;var c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(c[0].tagName);return{top:b.top+
+this.offset.relative.top*a+this.offset.parent.top*a-(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():f?0:c.scrollTop())*a),left:b.left+this.offset.relative.left*a+this.offset.parent.left*a-(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():f?0:c.scrollLeft())*a)}},_generatePosition:function(a){var b=this.options,c=this.cssPosition=="absolute"&&
+!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(c[0].tagName),e=a.pageX,h=a.pageY;if(this.originalPosition){var g;if(this.containment){if(this.relative_container){g=this.relative_container.offset();g=[this.containment[0]+g.left,this.containment[1]+g.top,this.containment[2]+g.left,this.containment[3]+g.top]}else g=this.containment;if(a.pageX-this.offset.click.left<g[0])e=g[0]+this.offset.click.left;
+if(a.pageY-this.offset.click.top<g[1])h=g[1]+this.offset.click.top;if(a.pageX-this.offset.click.left>g[2])e=g[2]+this.offset.click.left;if(a.pageY-this.offset.click.top>g[3])h=g[3]+this.offset.click.top}if(b.grid){h=b.grid[1]?this.originalPageY+Math.round((h-this.originalPageY)/b.grid[1])*b.grid[1]:this.originalPageY;h=g?!(h-this.offset.click.top<g[1]||h-this.offset.click.top>g[3])?h:!(h-this.offset.click.top<g[1])?h-b.grid[1]:h+b.grid[1]:h;e=b.grid[0]?this.originalPageX+Math.round((e-this.originalPageX)/
+b.grid[0])*b.grid[0]:this.originalPageX;e=g?!(e-this.offset.click.left<g[0]||e-this.offset.click.left>g[2])?e:!(e-this.offset.click.left<g[0])?e-b.grid[0]:e+b.grid[0]:e}}return{top:h-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollTop():f?0:c.scrollTop()),left:e-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(d.browser.safari&&d.browser.version<
+526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():f?0:c.scrollLeft())}},_clear:function(){this.helper.removeClass("ui-draggable-dragging");this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval&&this.helper.remove();this.helper=null;this.cancelHelperRemoval=false},_trigger:function(a,b,c){c=c||this._uiHash();d.ui.plugin.call(this,a,[b,c]);if(a=="drag")this.positionAbs=this._convertPositionTo("absolute");return d.Widget.prototype._trigger.call(this,a,b,
+c)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}});d.extend(d.ui.draggable,{version:"1.8.16"});d.ui.plugin.add("draggable","connectToSortable",{start:function(a,b){var c=d(this).data("draggable"),f=c.options,e=d.extend({},b,{item:c.element});c.sortables=[];d(f.connectToSortable).each(function(){var h=d.data(this,"sortable");if(h&&!h.options.disabled){c.sortables.push({instance:h,shouldRevert:h.options.revert});
+h.refreshPositions();h._trigger("activate",a,e)}})},stop:function(a,b){var c=d(this).data("draggable"),f=d.extend({},b,{item:c.element});d.each(c.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;c.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=false;if(this.shouldRevert)this.instance.options.revert=true;this.instance._mouseStop(a);this.instance.options.helper=this.instance.options._helper;c.options.helper=="original"&&this.instance.currentItem.css({top:"auto",left:"auto"})}else{this.instance.cancelHelperRemoval=
+false;this.instance._trigger("deactivate",a,f)}})},drag:function(a,b){var c=d(this).data("draggable"),f=this;d.each(c.sortables,function(){this.instance.positionAbs=c.positionAbs;this.instance.helperProportions=c.helperProportions;this.instance.offset.click=c.offset.click;if(this.instance._intersectsWith(this.instance.containerCache)){if(!this.instance.isOver){this.instance.isOver=1;this.instance.currentItem=d(f).clone().removeAttr("id").appendTo(this.instance.element).data("sortable-item",true);
+this.instance.options._helper=this.instance.options.helper;this.instance.options.helper=function(){return b.helper[0]};a.target=this.instance.currentItem[0];this.instance._mouseCapture(a,true);this.instance._mouseStart(a,true,true);this.instance.offset.click.top=c.offset.click.top;this.instance.offset.click.left=c.offset.click.left;this.instance.offset.parent.left-=c.offset.parent.left-this.instance.offset.parent.left;this.instance.offset.parent.top-=c.offset.parent.top-this.instance.offset.parent.top;
+c._trigger("toSortable",a);c.dropped=this.instance.element;c.currentItem=c.element;this.instance.fromOutside=c}this.instance.currentItem&&this.instance._mouseDrag(a)}else if(this.instance.isOver){this.instance.isOver=0;this.instance.cancelHelperRemoval=true;this.instance.options.revert=false;this.instance._trigger("out",a,this.instance._uiHash(this.instance));this.instance._mouseStop(a,true);this.instance.options.helper=this.instance.options._helper;this.instance.currentItem.remove();this.instance.placeholder&&
+this.instance.placeholder.remove();c._trigger("fromSortable",a);c.dropped=false}})}});d.ui.plugin.add("draggable","cursor",{start:function(){var a=d("body"),b=d(this).data("draggable").options;if(a.css("cursor"))b._cursor=a.css("cursor");a.css("cursor",b.cursor)},stop:function(){var a=d(this).data("draggable").options;a._cursor&&d("body").css("cursor",a._cursor)}});d.ui.plugin.add("draggable","opacity",{start:function(a,b){a=d(b.helper);b=d(this).data("draggable").options;if(a.css("opacity"))b._opacity=
+a.css("opacity");a.css("opacity",b.opacity)},stop:function(a,b){a=d(this).data("draggable").options;a._opacity&&d(b.helper).css("opacity",a._opacity)}});d.ui.plugin.add("draggable","scroll",{start:function(){var a=d(this).data("draggable");if(a.scrollParent[0]!=document&&a.scrollParent[0].tagName!="HTML")a.overflowOffset=a.scrollParent.offset()},drag:function(a){var b=d(this).data("draggable"),c=b.options,f=false;if(b.scrollParent[0]!=document&&b.scrollParent[0].tagName!="HTML"){if(!c.axis||c.axis!=
+"x")if(b.overflowOffset.top+b.scrollParent[0].offsetHeight-a.pageY<c.scrollSensitivity)b.scrollParent[0].scrollTop=f=b.scrollParent[0].scrollTop+c.scrollSpeed;else if(a.pageY-b.overflowOffset.top<c.scrollSensitivity)b.scrollParent[0].scrollTop=f=b.scrollParent[0].scrollTop-c.scrollSpeed;if(!c.axis||c.axis!="y")if(b.overflowOffset.left+b.scrollParent[0].offsetWidth-a.pageX<c.scrollSensitivity)b.scrollParent[0].scrollLeft=f=b.scrollParent[0].scrollLeft+c.scrollSpeed;else if(a.pageX-b.overflowOffset.left<
+c.scrollSensitivity)b.scrollParent[0].scrollLeft=f=b.scrollParent[0].scrollLeft-c.scrollSpeed}else{if(!c.axis||c.axis!="x")if(a.pageY-d(document).scrollTop()<c.scrollSensitivity)f=d(document).scrollTop(d(document).scrollTop()-c.scrollSpeed);else if(d(window).height()-(a.pageY-d(document).scrollTop())<c.scrollSensitivity)f=d(document).scrollTop(d(document).scrollTop()+c.scrollSpeed);if(!c.axis||c.axis!="y")if(a.pageX-d(document).scrollLeft()<c.scrollSensitivity)f=d(document).scrollLeft(d(document).scrollLeft()-
+c.scrollSpeed);else if(d(window).width()-(a.pageX-d(document).scrollLeft())<c.scrollSensitivity)f=d(document).scrollLeft(d(document).scrollLeft()+c.scrollSpeed)}f!==false&&d.ui.ddmanager&&!c.dropBehaviour&&d.ui.ddmanager.prepareOffsets(b,a)}});d.ui.plugin.add("draggable","snap",{start:function(){var a=d(this).data("draggable"),b=a.options;a.snapElements=[];d(b.snap.constructor!=String?b.snap.items||":data(draggable)":b.snap).each(function(){var c=d(this),f=c.offset();this!=a.element[0]&&a.snapElements.push({item:this,
+width:c.outerWidth(),height:c.outerHeight(),top:f.top,left:f.left})})},drag:function(a,b){for(var c=d(this).data("draggable"),f=c.options,e=f.snapTolerance,h=b.offset.left,g=h+c.helperProportions.width,n=b.offset.top,o=n+c.helperProportions.height,i=c.snapElements.length-1;i>=0;i--){var j=c.snapElements[i].left,l=j+c.snapElements[i].width,k=c.snapElements[i].top,m=k+c.snapElements[i].height;if(j-e<h&&h<l+e&&k-e<n&&n<m+e||j-e<h&&h<l+e&&k-e<o&&o<m+e||j-e<g&&g<l+e&&k-e<n&&n<m+e||j-e<g&&g<l+e&&k-e<o&&
+o<m+e){if(f.snapMode!="inner"){var p=Math.abs(k-o)<=e,q=Math.abs(m-n)<=e,r=Math.abs(j-g)<=e,s=Math.abs(l-h)<=e;if(p)b.position.top=c._convertPositionTo("relative",{top:k-c.helperProportions.height,left:0}).top-c.margins.top;if(q)b.position.top=c._convertPositionTo("relative",{top:m,left:0}).top-c.margins.top;if(r)b.position.left=c._convertPositionTo("relative",{top:0,left:j-c.helperProportions.width}).left-c.margins.left;if(s)b.position.left=c._convertPositionTo("relative",{top:0,left:l}).left-c.margins.left}var t=
+p||q||r||s;if(f.snapMode!="outer"){p=Math.abs(k-n)<=e;q=Math.abs(m-o)<=e;r=Math.abs(j-h)<=e;s=Math.abs(l-g)<=e;if(p)b.position.top=c._convertPositionTo("relative",{top:k,left:0}).top-c.margins.top;if(q)b.position.top=c._convertPositionTo("relative",{top:m-c.helperProportions.height,left:0}).top-c.margins.top;if(r)b.position.left=c._convertPositionTo("relative",{top:0,left:j}).left-c.margins.left;if(s)b.position.left=c._convertPositionTo("relative",{top:0,left:l-c.helperProportions.width}).left-c.margins.left}if(!c.snapElements[i].snapping&&
+(p||q||r||s||t))c.options.snap.snap&&c.options.snap.snap.call(c.element,a,d.extend(c._uiHash(),{snapItem:c.snapElements[i].item}));c.snapElements[i].snapping=p||q||r||s||t}else{c.snapElements[i].snapping&&c.options.snap.release&&c.options.snap.release.call(c.element,a,d.extend(c._uiHash(),{snapItem:c.snapElements[i].item}));c.snapElements[i].snapping=false}}}});d.ui.plugin.add("draggable","stack",{start:function(){var a=d(this).data("draggable").options;a=d.makeArray(d(a.stack)).sort(function(c,f){return(parseInt(d(c).css("zIndex"),
+10)||0)-(parseInt(d(f).css("zIndex"),10)||0)});if(a.length){var b=parseInt(a[0].style.zIndex)||0;d(a).each(function(c){this.style.zIndex=b+c});this[0].style.zIndex=b+a.length}}});d.ui.plugin.add("draggable","zIndex",{start:function(a,b){a=d(b.helper);b=d(this).data("draggable").options;if(a.css("zIndex"))b._zIndex=a.css("zIndex");a.css("zIndex",b.zIndex)},stop:function(a,b){a=d(this).data("draggable").options;a._zIndex&&d(b.helper).css("zIndex",a._zIndex)}})})(jQuery);
+;/*
+ * jQuery UI Droppable 1.8.16
+ *
+ * Copyright 2011, 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/Droppables
+ *
+ * Depends:
+ *	jquery.ui.core.js
+ *	jquery.ui.widget.js
+ *	jquery.ui.mouse.js
+ *	jquery.ui.draggable.js
+ */
+(function(d){d.widget("ui.droppable",{widgetEventPrefix:"drop",options:{accept:"*",activeClass:false,addClasses:true,greedy:false,hoverClass:false,scope:"default",tolerance:"intersect"},_create:function(){var a=this.options,b=a.accept;this.isover=0;this.isout=1;this.accept=d.isFunction(b)?b:function(c){return c.is(b)};this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};d.ui.ddmanager.droppables[a.scope]=d.ui.ddmanager.droppables[a.scope]||[];d.ui.ddmanager.droppables[a.scope].push(this);
+a.addClasses&&this.element.addClass("ui-droppable")},destroy:function(){for(var a=d.ui.ddmanager.droppables[this.options.scope],b=0;b<a.length;b++)a[b]==this&&a.splice(b,1);this.element.removeClass("ui-droppable ui-droppable-disabled").removeData("droppable").unbind(".droppable");return this},_setOption:function(a,b){if(a=="accept")this.accept=d.isFunction(b)?b:function(c){return c.is(b)};d.Widget.prototype._setOption.apply(this,arguments)},_activate:function(a){var b=d.ui.ddmanager.current;this.options.activeClass&&
+this.element.addClass(this.options.activeClass);b&&this._trigger("activate",a,this.ui(b))},_deactivate:function(a){var b=d.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass);b&&this._trigger("deactivate",a,this.ui(b))},_over:function(a){var b=d.ui.ddmanager.current;if(!(!b||(b.currentItem||b.element)[0]==this.element[0]))if(this.accept.call(this.element[0],b.currentItem||b.element)){this.options.hoverClass&&this.element.addClass(this.options.hoverClass);
+this._trigger("over",a,this.ui(b))}},_out:function(a){var b=d.ui.ddmanager.current;if(!(!b||(b.currentItem||b.element)[0]==this.element[0]))if(this.accept.call(this.element[0],b.currentItem||b.element)){this.options.hoverClass&&this.element.removeClass(this.options.hoverClass);this._trigger("out",a,this.ui(b))}},_drop:function(a,b){var c=b||d.ui.ddmanager.current;if(!c||(c.currentItem||c.element)[0]==this.element[0])return false;var e=false;this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function(){var g=
+d.data(this,"droppable");if(g.options.greedy&&!g.options.disabled&&g.options.scope==c.options.scope&&g.accept.call(g.element[0],c.currentItem||c.element)&&d.ui.intersect(c,d.extend(g,{offset:g.element.offset()}),g.options.tolerance)){e=true;return false}});if(e)return false;if(this.accept.call(this.element[0],c.currentItem||c.element)){this.options.activeClass&&this.element.removeClass(this.options.activeClass);this.options.hoverClass&&this.element.removeClass(this.options.hoverClass);this._trigger("drop",
+a,this.ui(c));return this.element}return false},ui:function(a){return{draggable:a.currentItem||a.element,helper:a.helper,position:a.position,offset:a.positionAbs}}});d.extend(d.ui.droppable,{version:"1.8.16"});d.ui.intersect=function(a,b,c){if(!b.offset)return false;var e=(a.positionAbs||a.position.absolute).left,g=e+a.helperProportions.width,f=(a.positionAbs||a.position.absolute).top,h=f+a.helperProportions.height,i=b.offset.left,k=i+b.proportions.width,j=b.offset.top,l=j+b.proportions.height;
+switch(c){case "fit":return i<=e&&g<=k&&j<=f&&h<=l;case "intersect":return i<e+a.helperProportions.width/2&&g-a.helperProportions.width/2<k&&j<f+a.helperProportions.height/2&&h-a.helperProportions.height/2<l;case "pointer":return d.ui.isOver((a.positionAbs||a.position.absolute).top+(a.clickOffset||a.offset.click).top,(a.positionAbs||a.position.absolute).left+(a.clickOffset||a.offset.click).left,j,i,b.proportions.height,b.proportions.width);case "touch":return(f>=j&&f<=l||h>=j&&h<=l||f<j&&h>l)&&(e>=
+i&&e<=k||g>=i&&g<=k||e<i&&g>k);default:return false}};d.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(a,b){var c=d.ui.ddmanager.droppables[a.options.scope]||[],e=b?b.type:null,g=(a.currentItem||a.element).find(":data(droppable)").andSelf(),f=0;a:for(;f<c.length;f++)if(!(c[f].options.disabled||a&&!c[f].accept.call(c[f].element[0],a.currentItem||a.element))){for(var h=0;h<g.length;h++)if(g[h]==c[f].element[0]){c[f].proportions.height=0;continue a}c[f].visible=c[f].element.css("display")!=
+"none";if(c[f].visible){e=="mousedown"&&c[f]._activate.call(c[f],b);c[f].offset=c[f].element.offset();c[f].proportions={width:c[f].element[0].offsetWidth,height:c[f].element[0].offsetHeight}}}},drop:function(a,b){var c=false;d.each(d.ui.ddmanager.droppables[a.options.scope]||[],function(){if(this.options){if(!this.options.disabled&&this.visible&&d.ui.intersect(a,this,this.options.tolerance))c=c||this._drop.call(this,b);if(!this.options.disabled&&this.visible&&this.accept.call(this.element[0],a.currentItem||
+a.element)){this.isout=1;this.isover=0;this._deactivate.call(this,b)}}});return c},dragStart:function(a,b){a.element.parents(":not(body,html)").bind("scroll.droppable",function(){a.options.refreshPositions||d.ui.ddmanager.prepareOffsets(a,b)})},drag:function(a,b){a.options.refreshPositions&&d.ui.ddmanager.prepareOffsets(a,b);d.each(d.ui.ddmanager.droppables[a.options.scope]||[],function(){if(!(this.options.disabled||this.greedyChild||!this.visible)){var c=d.ui.intersect(a,this,this.options.tolerance);
+if(c=!c&&this.isover==1?"isout":c&&this.isover==0?"isover":null){var e;if(this.options.greedy){var g=this.element.parents(":data(droppable):eq(0)");if(g.length){e=d.data(g[0],"droppable");e.greedyChild=c=="isover"?1:0}}if(e&&c=="isover"){e.isover=0;e.isout=1;e._out.call(e,b)}this[c]=1;this[c=="isout"?"isover":"isout"]=0;this[c=="isover"?"_over":"_out"].call(this,b);if(e&&c=="isout"){e.isout=0;e.isover=1;e._over.call(e,b)}}}})},dragStop:function(a,b){a.element.parents(":not(body,html)").unbind("scroll.droppable");
+a.options.refreshPositions||d.ui.ddmanager.prepareOffsets(a,b)}}})(jQuery);
+;/*
+ * jQuery UI Resizable 1.8.16
+ *
+ * Copyright 2011, 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(e){e.widget("ui.resizable",e.ui.mouse,{widgetEventPrefix:"resize",options:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,containment:false,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1E3},_create:function(){var b=this,a=this.options;this.element.addClass("ui-resizable");e.extend(this,{_aspectRatio:!!a.aspectRatio,aspectRatio:a.aspectRatio,originalElement:this.element,
+_proportionallyResizeElements:[],_helper:a.helper||a.ghost||a.animate?a.helper||"ui-resizable-helper":null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){/relative/.test(this.element.css("position"))&&e.browser.opera&&this.element.css({position:"relative",top:"auto",left:"auto"});this.element.wrap(e('<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")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;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});this.originalResizeStyle=
+this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=a.handles||(!e(".ui-resizable-handle",this.element).length?"e,s,se":{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"});if(this.handles.constructor==String){if(this.handles=="all")this.handles="n,e,s,w,se,sw,ne,nw";var c=this.handles.split(",");this.handles={};for(var d=0;d<c.length;d++){var f=e.trim(c[d]),g=e('<div class="ui-resizable-handle '+("ui-resizable-"+f)+'"></div>');/sw|se|ne|nw/.test(f)&&g.css({zIndex:++a.zIndex});"se"==f&&g.addClass("ui-icon ui-icon-gripsmall-diagonal-se");this.handles[f]=".ui-resizable-"+f;this.element.append(g)}}this._renderAxis=function(h){h=h||this.element;for(var i in this.handles){if(this.handles[i].constructor==
+String)this.handles[i]=e(this.handles[i],this.element).show();if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var j=e(this.handles[i],this.element),l=0;l=/sw|ne|nw|se|n|s/.test(i)?j.outerHeight():j.outerWidth();j=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join("");h.css(j,l);this._proportionallyResize()}e(this.handles[i])}};this._renderAxis(this.element);this._handles=e(".ui-resizable-handle",this.element).disableSelection();
+this._handles.mouseover(function(){if(!b.resizing){if(this.className)var h=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);b.axis=h&&h[1]?h[1]:"se"}});if(a.autoHide){this._handles.hide();e(this.element).addClass("ui-resizable-autohide").hover(function(){if(!a.disabled){e(this).removeClass("ui-resizable-autohide");b._handles.show()}},function(){if(!a.disabled)if(!b.resizing){e(this).addClass("ui-resizable-autohide");b._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy();
+var b=function(c){e(c).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){b(this.element);var a=this.element;a.after(this.originalElement.css({position:a.css("position"),width:a.outerWidth(),height:a.outerHeight(),top:a.css("top"),left:a.css("left")})).remove()}this.originalElement.css("resize",this.originalResizeStyle);b(this.originalElement);return this},_mouseCapture:function(b){var a=
+false;for(var c in this.handles)if(e(this.handles[c])[0]==b.target)a=true;return!this.options.disabled&&a},_mouseStart:function(b){var a=this.options,c=this.element.position(),d=this.element;this.resizing=true;this.documentScroll={top:e(document).scrollTop(),left:e(document).scrollLeft()};if(d.is(".ui-draggable")||/absolute/.test(d.css("position")))d.css({position:"absolute",top:c.top,left:c.left});e.browser.opera&&/relative/.test(d.css("position"))&&d.css({position:"relative",top:"auto",left:"auto"});
+this._renderProxy();c=m(this.helper.css("left"));var f=m(this.helper.css("top"));if(a.containment){c+=e(a.containment).scrollLeft()||0;f+=e(a.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:c,top:f};this.size=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalSize=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalPosition={left:c,top:f};this.sizeDiff=
+{width:d.outerWidth()-d.width(),height:d.outerHeight()-d.height()};this.originalMousePosition={left:b.pageX,top:b.pageY};this.aspectRatio=typeof a.aspectRatio=="number"?a.aspectRatio:this.originalSize.width/this.originalSize.height||1;a=e(".ui-resizable-"+this.axis).css("cursor");e("body").css("cursor",a=="auto"?this.axis+"-resize":a);d.addClass("ui-resizable-resizing");this._propagate("start",b);return true},_mouseDrag:function(b){var a=this.helper,c=this.originalMousePosition,d=this._change[this.axis];
+if(!d)return false;c=d.apply(this,[b,b.pageX-c.left||0,b.pageY-c.top||0]);this._updateVirtualBoundaries(b.shiftKey);if(this._aspectRatio||b.shiftKey)c=this._updateRatio(c,b);c=this._respectSize(c,b);this._propagate("resize",b);a.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(c);this._trigger("resize",b,this.ui());return false},
+_mouseStop:function(b){this.resizing=false;var a=this.options,c=this;if(this._helper){var d=this._proportionallyResizeElements,f=d.length&&/textarea/i.test(d[0].nodeName);d=f&&e.ui.hasScroll(d[0],"left")?0:c.sizeDiff.height;f=f?0:c.sizeDiff.width;f={width:c.helper.width()-f,height:c.helper.height()-d};d=parseInt(c.element.css("left"),10)+(c.position.left-c.originalPosition.left)||null;var g=parseInt(c.element.css("top"),10)+(c.position.top-c.originalPosition.top)||null;a.animate||this.element.css(e.extend(f,
+{top:g,left:d}));c.helper.height(c.size.height);c.helper.width(c.size.width);this._helper&&!a.animate&&this._proportionallyResize()}e("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop",b);this._helper&&this.helper.remove();return false},_updateVirtualBoundaries:function(b){var a=this.options,c,d,f;a={minWidth:k(a.minWidth)?a.minWidth:0,maxWidth:k(a.maxWidth)?a.maxWidth:Infinity,minHeight:k(a.minHeight)?a.minHeight:0,maxHeight:k(a.maxHeight)?a.maxHeight:
+Infinity};if(this._aspectRatio||b){b=a.minHeight*this.aspectRatio;d=a.minWidth/this.aspectRatio;c=a.maxHeight*this.aspectRatio;f=a.maxWidth/this.aspectRatio;if(b>a.minWidth)a.minWidth=b;if(d>a.minHeight)a.minHeight=d;if(c<a.maxWidth)a.maxWidth=c;if(f<a.maxHeight)a.maxHeight=f}this._vBoundaries=a},_updateCache:function(b){this.offset=this.helper.offset();if(k(b.left))this.position.left=b.left;if(k(b.top))this.position.top=b.top;if(k(b.height))this.size.height=b.height;if(k(b.width))this.size.width=
+b.width},_updateRatio:function(b){var a=this.position,c=this.size,d=this.axis;if(k(b.height))b.width=b.height*this.aspectRatio;else if(k(b.width))b.height=b.width/this.aspectRatio;if(d=="sw"){b.left=a.left+(c.width-b.width);b.top=null}if(d=="nw"){b.top=a.top+(c.height-b.height);b.left=a.left+(c.width-b.width)}return b},_respectSize:function(b){var a=this._vBoundaries,c=this.axis,d=k(b.width)&&a.maxWidth&&a.maxWidth<b.width,f=k(b.height)&&a.maxHeight&&a.maxHeight<b.height,g=k(b.width)&&a.minWidth&&
+a.minWidth>b.width,h=k(b.height)&&a.minHeight&&a.minHeight>b.height;if(g)b.width=a.minWidth;if(h)b.height=a.minHeight;if(d)b.width=a.maxWidth;if(f)b.height=a.maxHeight;var i=this.originalPosition.left+this.originalSize.width,j=this.position.top+this.size.height,l=/sw|nw|w/.test(c);c=/nw|ne|n/.test(c);if(g&&l)b.left=i-a.minWidth;if(d&&l)b.left=i-a.maxWidth;if(h&&c)b.top=j-a.minHeight;if(f&&c)b.top=j-a.maxHeight;if((a=!b.width&&!b.height)&&!b.left&&b.top)b.top=null;else if(a&&!b.top&&b.left)b.left=
+null;return b},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var b=this.helper||this.element,a=0;a<this._proportionallyResizeElements.length;a++){var c=this._proportionallyResizeElements[a];if(!this.borderDif){var d=[c.css("borderTopWidth"),c.css("borderRightWidth"),c.css("borderBottomWidth"),c.css("borderLeftWidth")],f=[c.css("paddingTop"),c.css("paddingRight"),c.css("paddingBottom"),c.css("paddingLeft")];this.borderDif=e.map(d,function(g,h){g=parseInt(g,10)||
+0;h=parseInt(f[h],10)||0;return g+h})}e.browser.msie&&(e(b).is(":hidden")||e(b).parents(":hidden").length)||c.css({height:b.height()-this.borderDif[0]-this.borderDif[2]||0,width:b.width()-this.borderDif[1]-this.borderDif[3]||0})}},_renderProxy:function(){var b=this.options;this.elementOffset=this.element.offset();if(this._helper){this.helper=this.helper||e('<div style="overflow:hidden;"></div>');var a=e.browser.msie&&e.browser.version<7,c=a?1:0;a=a?2:-1;this.helper.addClass(this._helper).css({width:this.element.outerWidth()+
+a,height:this.element.outerHeight()+a,position:"absolute",left:this.elementOffset.left-c+"px",top:this.elementOffset.top-c+"px",zIndex:++b.zIndex});this.helper.appendTo("body").disableSelection()}else this.helper=this.element},_change:{e:function(b,a){return{width:this.originalSize.width+a}},w:function(b,a){return{left:this.originalPosition.left+a,width:this.originalSize.width-a}},n:function(b,a,c){return{top:this.originalPosition.top+c,height:this.originalSize.height-c}},s:function(b,a,c){return{height:this.originalSize.height+
+c}},se:function(b,a,c){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[b,a,c]))},sw:function(b,a,c){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[b,a,c]))},ne:function(b,a,c){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[b,a,c]))},nw:function(b,a,c){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[b,a,c]))}},_propagate:function(b,a){e.ui.plugin.call(this,b,[a,this.ui()]);
+b!="resize"&&this._trigger(b,a,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}}});e.extend(e.ui.resizable,{version:"1.8.16"});e.ui.plugin.add("resizable","alsoResize",{start:function(){var b=e(this).data("resizable").options,a=function(c){e(c).each(function(){var d=e(this);d.data("resizable-alsoresize",{width:parseInt(d.width(),
+10),height:parseInt(d.height(),10),left:parseInt(d.css("left"),10),top:parseInt(d.css("top"),10),position:d.css("position")})})};if(typeof b.alsoResize=="object"&&!b.alsoResize.parentNode)if(b.alsoResize.length){b.alsoResize=b.alsoResize[0];a(b.alsoResize)}else e.each(b.alsoResize,function(c){a(c)});else a(b.alsoResize)},resize:function(b,a){var c=e(this).data("resizable");b=c.options;var d=c.originalSize,f=c.originalPosition,g={height:c.size.height-d.height||0,width:c.size.width-d.width||0,top:c.position.top-
+f.top||0,left:c.position.left-f.left||0},h=function(i,j){e(i).each(function(){var l=e(this),q=e(this).data("resizable-alsoresize"),p={},r=j&&j.length?j:l.parents(a.originalElement[0]).length?["width","height"]:["width","height","top","left"];e.each(r,function(n,o){if((n=(q[o]||0)+(g[o]||0))&&n>=0)p[o]=n||null});if(e.browser.opera&&/relative/.test(l.css("position"))){c._revertToRelativePosition=true;l.css({position:"absolute",top:"auto",left:"auto"})}l.css(p)})};typeof b.alsoResize=="object"&&!b.alsoResize.nodeType?
+e.each(b.alsoResize,function(i,j){h(i,j)}):h(b.alsoResize)},stop:function(){var b=e(this).data("resizable"),a=b.options,c=function(d){e(d).each(function(){var f=e(this);f.css({position:f.data("resizable-alsoresize").position})})};if(b._revertToRelativePosition){b._revertToRelativePosition=false;typeof a.alsoResize=="object"&&!a.alsoResize.nodeType?e.each(a.alsoResize,function(d){c(d)}):c(a.alsoResize)}e(this).removeData("resizable-alsoresize")}});e.ui.plugin.add("resizable","animate",{stop:function(b){var a=
+e(this).data("resizable"),c=a.options,d=a._proportionallyResizeElements,f=d.length&&/textarea/i.test(d[0].nodeName),g=f&&e.ui.hasScroll(d[0],"left")?0:a.sizeDiff.height;f={width:a.size.width-(f?0:a.sizeDiff.width),height:a.size.height-g};g=parseInt(a.element.css("left"),10)+(a.position.left-a.originalPosition.left)||null;var h=parseInt(a.element.css("top"),10)+(a.position.top-a.originalPosition.top)||null;a.element.animate(e.extend(f,h&&g?{top:h,left:g}:{}),{duration:c.animateDuration,easing:c.animateEasing,
+step:function(){var i={width:parseInt(a.element.css("width"),10),height:parseInt(a.element.css("height"),10),top:parseInt(a.element.css("top"),10),left:parseInt(a.element.css("left"),10)};d&&d.length&&e(d[0]).css({width:i.width,height:i.height});a._updateCache(i);a._propagate("resize",b)}})}});e.ui.plugin.add("resizable","containment",{start:function(){var b=e(this).data("resizable"),a=b.element,c=b.options.containment;if(a=c instanceof e?c.get(0):/parent/.test(c)?a.parent().get(0):c){b.containerElement=
+e(a);if(/document/.test(c)||c==document){b.containerOffset={left:0,top:0};b.containerPosition={left:0,top:0};b.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}}else{var d=e(a),f=[];e(["Top","Right","Left","Bottom"]).each(function(i,j){f[i]=m(d.css("padding"+j))});b.containerOffset=d.offset();b.containerPosition=d.position();b.containerSize={height:d.innerHeight()-f[3],width:d.innerWidth()-f[1]};c=b.containerOffset;
+var g=b.containerSize.height,h=b.containerSize.width;h=e.ui.hasScroll(a,"left")?a.scrollWidth:h;g=e.ui.hasScroll(a)?a.scrollHeight:g;b.parentData={element:a,left:c.left,top:c.top,width:h,height:g}}}},resize:function(b){var a=e(this).data("resizable"),c=a.options,d=a.containerOffset,f=a.position;b=a._aspectRatio||b.shiftKey;var g={top:0,left:0},h=a.containerElement;if(h[0]!=document&&/static/.test(h.css("position")))g=d;if(f.left<(a._helper?d.left:0)){a.size.width+=a._helper?a.position.left-d.left:
+a.position.left-g.left;if(b)a.size.height=a.size.width/c.aspectRatio;a.position.left=c.helper?d.left:0}if(f.top<(a._helper?d.top:0)){a.size.height+=a._helper?a.position.top-d.top:a.position.top;if(b)a.size.width=a.size.height*c.aspectRatio;a.position.top=a._helper?d.top:0}a.offset.left=a.parentData.left+a.position.left;a.offset.top=a.parentData.top+a.position.top;c=Math.abs((a._helper?a.offset.left-g.left:a.offset.left-g.left)+a.sizeDiff.width);d=Math.abs((a._helper?a.offset.top-g.top:a.offset.top-
+d.top)+a.sizeDiff.height);f=a.containerElement.get(0)==a.element.parent().get(0);g=/relative|absolute/.test(a.containerElement.css("position"));if(f&&g)c-=a.parentData.left;if(c+a.size.width>=a.parentData.width){a.size.width=a.parentData.width-c;if(b)a.size.height=a.size.width/a.aspectRatio}if(d+a.size.height>=a.parentData.height){a.size.height=a.parentData.height-d;if(b)a.size.width=a.size.height*a.aspectRatio}},stop:function(){var b=e(this).data("resizable"),a=b.options,c=b.containerOffset,d=b.containerPosition,
+f=b.containerElement,g=e(b.helper),h=g.offset(),i=g.outerWidth()-b.sizeDiff.width;g=g.outerHeight()-b.sizeDiff.height;b._helper&&!a.animate&&/relative/.test(f.css("position"))&&e(this).css({left:h.left-d.left-c.left,width:i,height:g});b._helper&&!a.animate&&/static/.test(f.css("position"))&&e(this).css({left:h.left-d.left-c.left,width:i,height:g})}});e.ui.plugin.add("resizable","ghost",{start:function(){var b=e(this).data("resizable"),a=b.options,c=b.size;b.ghost=b.originalElement.clone();b.ghost.css({opacity:0.25,
+display:"block",position:"relative",height:c.height,width:c.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof a.ghost=="string"?a.ghost:"");b.ghost.appendTo(b.helper)},resize:function(){var b=e(this).data("resizable");b.ghost&&b.ghost.css({position:"relative",height:b.size.height,width:b.size.width})},stop:function(){var b=e(this).data("resizable");b.ghost&&b.helper&&b.helper.get(0).removeChild(b.ghost.get(0))}});e.ui.plugin.add("resizable","grid",{resize:function(){var b=
+e(this).data("resizable"),a=b.options,c=b.size,d=b.originalSize,f=b.originalPosition,g=b.axis;a.grid=typeof a.grid=="number"?[a.grid,a.grid]:a.grid;var h=Math.round((c.width-d.width)/(a.grid[0]||1))*(a.grid[0]||1);a=Math.round((c.height-d.height)/(a.grid[1]||1))*(a.grid[1]||1);if(/^(se|s|e)$/.test(g)){b.size.width=d.width+h;b.size.height=d.height+a}else if(/^(ne)$/.test(g)){b.size.width=d.width+h;b.size.height=d.height+a;b.position.top=f.top-a}else{if(/^(sw)$/.test(g)){b.size.width=d.width+h;b.size.height=
+d.height+a}else{b.size.width=d.width+h;b.size.height=d.height+a;b.position.top=f.top-a}b.position.left=f.left-h}}});var m=function(b){return parseInt(b,10)||0},k=function(b){return!isNaN(parseInt(b,10))}})(jQuery);
+;/*
+ * jQuery UI Selectable 1.8.16
+ *
+ * Copyright 2011, 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/Selectables
+ *
+ * Depends:
+ *	jquery.ui.core.js
+ *	jquery.ui.mouse.js
+ *	jquery.ui.widget.js
+ */
+(function(e){e.widget("ui.selectable",e.ui.mouse,{options:{appendTo:"body",autoRefresh:true,distance:0,filter:"*",tolerance:"touch"},_create:function(){var c=this;this.element.addClass("ui-selectable");this.dragged=false;var f;this.refresh=function(){f=e(c.options.filter,c.element[0]);f.each(function(){var d=e(this),b=d.offset();e.data(this,"selectable-item",{element:this,$element:d,left:b.left,top:b.top,right:b.left+d.outerWidth(),bottom:b.top+d.outerHeight(),startselected:false,selected:d.hasClass("ui-selected"),
+selecting:d.hasClass("ui-selecting"),unselecting:d.hasClass("ui-unselecting")})})};this.refresh();this.selectees=f.addClass("ui-selectee");this._mouseInit();this.helper=e("<div class='ui-selectable-helper'></div>")},destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item");this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable");this._mouseDestroy();return this},_mouseStart:function(c){var f=this;this.opos=[c.pageX,
+c.pageY];if(!this.options.disabled){var d=this.options;this.selectees=e(d.filter,this.element[0]);this._trigger("start",c);e(d.appendTo).append(this.helper);this.helper.css({left:c.clientX,top:c.clientY,width:0,height:0});d.autoRefresh&&this.refresh();this.selectees.filter(".ui-selected").each(function(){var b=e.data(this,"selectable-item");b.startselected=true;if(!c.metaKey){b.$element.removeClass("ui-selected");b.selected=false;b.$element.addClass("ui-unselecting");b.unselecting=true;f._trigger("unselecting",
+c,{unselecting:b.element})}});e(c.target).parents().andSelf().each(function(){var b=e.data(this,"selectable-item");if(b){var g=!c.metaKey||!b.$element.hasClass("ui-selected");b.$element.removeClass(g?"ui-unselecting":"ui-selected").addClass(g?"ui-selecting":"ui-unselecting");b.unselecting=!g;b.selecting=g;(b.selected=g)?f._trigger("selecting",c,{selecting:b.element}):f._trigger("unselecting",c,{unselecting:b.element});return false}})}},_mouseDrag:function(c){var f=this;this.dragged=true;if(!this.options.disabled){var d=
+this.options,b=this.opos[0],g=this.opos[1],h=c.pageX,i=c.pageY;if(b>h){var j=h;h=b;b=j}if(g>i){j=i;i=g;g=j}this.helper.css({left:b,top:g,width:h-b,height:i-g});this.selectees.each(function(){var a=e.data(this,"selectable-item");if(!(!a||a.element==f.element[0])){var k=false;if(d.tolerance=="touch")k=!(a.left>h||a.right<b||a.top>i||a.bottom<g);else if(d.tolerance=="fit")k=a.left>b&&a.right<h&&a.top>g&&a.bottom<i;if(k){if(a.selected){a.$element.removeClass("ui-selected");a.selected=false}if(a.unselecting){a.$element.removeClass("ui-unselecting");
+a.unselecting=false}if(!a.selecting){a.$element.addClass("ui-selecting");a.selecting=true;f._trigger("selecting",c,{selecting:a.element})}}else{if(a.selecting)if(c.metaKey&&a.startselected){a.$element.removeClass("ui-selecting");a.selecting=false;a.$element.addClass("ui-selected");a.selected=true}else{a.$element.removeClass("ui-selecting");a.selecting=false;if(a.startselected){a.$element.addClass("ui-unselecting");a.unselecting=true}f._trigger("unselecting",c,{unselecting:a.element})}if(a.selected)if(!c.metaKey&&
+!a.startselected){a.$element.removeClass("ui-selected");a.selected=false;a.$element.addClass("ui-unselecting");a.unselecting=true;f._trigger("unselecting",c,{unselecting:a.element})}}}});return false}},_mouseStop:function(c){var f=this;this.dragged=false;e(".ui-unselecting",this.element[0]).each(function(){var d=e.data(this,"selectable-item");d.$element.removeClass("ui-unselecting");d.unselecting=false;d.startselected=false;f._trigger("unselected",c,{unselected:d.element})});e(".ui-selecting",this.element[0]).each(function(){var d=
+e.data(this,"selectable-item");d.$element.removeClass("ui-selecting").addClass("ui-selected");d.selecting=false;d.selected=true;d.startselected=true;f._trigger("selected",c,{selected:d.element})});this._trigger("stop",c);this.helper.remove();return false}});e.extend(e.ui.selectable,{version:"1.8.16"})})(jQuery);
+;/*
+ * jQuery UI Sortable 1.8.16
+ *
+ * Copyright 2011, 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/Sortables
+ *
+ * Depends:
+ *	jquery.ui.core.js
+ *	jquery.ui.mouse.js
+ *	jquery.ui.widget.js
+ */
+(function(d){d.widget("ui.sortable",d.ui.mouse,{widgetEventPrefix:"sort",options:{appendTo:"parent",axis:false,connectWith:false,containment:false,cursor:"auto",cursorAt:false,dropOnEmpty:true,forcePlaceholderSize:false,forceHelperSize:false,grid:false,handle:false,helper:"original",items:"> *",opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1E3},_create:function(){var a=this.options;this.containerCache={};this.element.addClass("ui-sortable");
+this.refresh();this.floating=this.items.length?a.axis==="x"||/left|right/.test(this.items[0].item.css("float"))||/inline|table-cell/.test(this.items[0].item.css("display")):false;this.offset=this.element.offset();this._mouseInit()},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");this._mouseDestroy();for(var a=this.items.length-1;a>=0;a--)this.items[a].item.removeData("sortable-item");return this},_setOption:function(a,b){if(a===
+"disabled"){this.options[a]=b;this.widget()[b?"addClass":"removeClass"]("ui-sortable-disabled")}else d.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(a,b){if(this.reverting)return false;if(this.options.disabled||this.options.type=="static")return false;this._refreshItems(a);var c=null,e=this;d(a.target).parents().each(function(){if(d.data(this,"sortable-item")==e){c=d(this);return false}});if(d.data(a.target,"sortable-item")==e)c=d(a.target);if(!c)return false;if(this.options.handle&&
+!b){var f=false;d(this.options.handle,c).find("*").andSelf().each(function(){if(this==a.target)f=true});if(!f)return false}this.currentItem=c;this._removeCurrentsFromItems();return true},_mouseStart:function(a,b,c){b=this.options;var e=this;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(a);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,
+left:this.offset.left-this.margins.left};this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");d.extend(this.offset,{click:{left:a.pageX-this.offset.left,top:a.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(a);this.originalPageX=a.pageX;this.originalPageY=a.pageY;b.cursorAt&&this._adjustOffsetFromHelper(b.cursorAt);this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};
+this.helper[0]!=this.currentItem[0]&&this.currentItem.hide();this._createPlaceholder();b.containment&&this._setContainment();if(b.cursor){if(d("body").css("cursor"))this._storedCursor=d("body").css("cursor");d("body").css("cursor",b.cursor)}if(b.opacity){if(this.helper.css("opacity"))this._storedOpacity=this.helper.css("opacity");this.helper.css("opacity",b.opacity)}if(b.zIndex){if(this.helper.css("zIndex"))this._storedZIndex=this.helper.css("zIndex");this.helper.css("zIndex",b.zIndex)}if(this.scrollParent[0]!=
+document&&this.scrollParent[0].tagName!="HTML")this.overflowOffset=this.scrollParent.offset();this._trigger("start",a,this._uiHash());this._preserveHelperProportions||this._cacheHelperProportions();if(!c)for(c=this.containers.length-1;c>=0;c--)this.containers[c]._trigger("activate",a,e._uiHash(this));if(d.ui.ddmanager)d.ui.ddmanager.current=this;d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,a);this.dragging=true;this.helper.addClass("ui-sortable-helper");this._mouseDrag(a);
+return true},_mouseDrag:function(a){this.position=this._generatePosition(a);this.positionAbs=this._convertPositionTo("absolute");if(!this.lastPositionAbs)this.lastPositionAbs=this.positionAbs;if(this.options.scroll){var b=this.options,c=false;if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){if(this.overflowOffset.top+this.scrollParent[0].offsetHeight-a.pageY<b.scrollSensitivity)this.scrollParent[0].scrollTop=c=this.scrollParent[0].scrollTop+b.scrollSpeed;else if(a.pageY-this.overflowOffset.top<
+b.scrollSensitivity)this.scrollParent[0].scrollTop=c=this.scrollParent[0].scrollTop-b.scrollSpeed;if(this.overflowOffset.left+this.scrollParent[0].offsetWidth-a.pageX<b.scrollSensitivity)this.scrollParent[0].scrollLeft=c=this.scrollParent[0].scrollLeft+b.scrollSpeed;else if(a.pageX-this.overflowOffset.left<b.scrollSensitivity)this.scrollParent[0].scrollLeft=c=this.scrollParent[0].scrollLeft-b.scrollSpeed}else{if(a.pageY-d(document).scrollTop()<b.scrollSensitivity)c=d(document).scrollTop(d(document).scrollTop()-
+b.scrollSpeed);else if(d(window).height()-(a.pageY-d(document).scrollTop())<b.scrollSensitivity)c=d(document).scrollTop(d(document).scrollTop()+b.scrollSpeed);if(a.pageX-d(document).scrollLeft()<b.scrollSensitivity)c=d(document).scrollLeft(d(document).scrollLeft()-b.scrollSpeed);else if(d(window).width()-(a.pageX-d(document).scrollLeft())<b.scrollSensitivity)c=d(document).scrollLeft(d(document).scrollLeft()+b.scrollSpeed)}c!==false&&d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,
+a)}this.positionAbs=this._convertPositionTo("absolute");if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";for(b=this.items.length-1;b>=0;b--){c=this.items[b];var e=c.item[0],f=this._intersectsWithPointer(c);if(f)if(e!=this.currentItem[0]&&this.placeholder[f==1?"next":"prev"]()[0]!=e&&!d.ui.contains(this.placeholder[0],e)&&(this.options.type=="semi-dynamic"?!d.ui.contains(this.element[0],
+e):true)){this.direction=f==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(c))this._rearrange(a,c);else break;this._trigger("change",a,this._uiHash());break}}this._contactContainers(a);d.ui.ddmanager&&d.ui.ddmanager.drag(this,a);this._trigger("sort",a,this._uiHash());this.lastPositionAbs=this.positionAbs;return false},_mouseStop:function(a,b){if(a){d.ui.ddmanager&&!this.options.dropBehaviour&&d.ui.ddmanager.drop(this,a);if(this.options.revert){var c=this;b=c.placeholder.offset();
+c.reverting=true;d(this.helper).animate({left:b.left-this.offset.parent.left-c.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:b.top-this.offset.parent.top-c.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){c._clear(a)})}else this._clear(a,b);return false}},cancel:function(){var a=this;if(this.dragging){this._mouseUp({target:null});this.options.helper=="original"?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):
+this.currentItem.show();for(var b=this.containers.length-1;b>=0;b--){this.containers[b]._trigger("deactivate",null,a._uiHash(this));if(this.containers[b].containerCache.over){this.containers[b]._trigger("out",null,a._uiHash(this));this.containers[b].containerCache.over=0}}}if(this.placeholder){this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]);this.options.helper!="original"&&this.helper&&this.helper[0].parentNode&&this.helper.remove();d.extend(this,{helper:null,
+dragging:false,reverting:false,_noFinalSort:null});this.domPosition.prev?d(this.domPosition.prev).after(this.currentItem):d(this.domPosition.parent).prepend(this.currentItem)}return this},serialize:function(a){var b=this._getItemsAsjQuery(a&&a.connected),c=[];a=a||{};d(b).each(function(){var e=(d(a.item||this).attr(a.attribute||"id")||"").match(a.expression||/(.+)[-=_](.+)/);if(e)c.push((a.key||e[1]+"[]")+"="+(a.key&&a.expression?e[1]:e[2]))});!c.length&&a.key&&c.push(a.key+"=");return c.join("&")},
+toArray:function(a){var b=this._getItemsAsjQuery(a&&a.connected),c=[];a=a||{};b.each(function(){c.push(d(a.item||this).attr(a.attribute||"id")||"")});return c},_intersectsWith:function(a){var b=this.positionAbs.left,c=b+this.helperProportions.width,e=this.positionAbs.top,f=e+this.helperProportions.height,g=a.left,h=g+a.width,i=a.top,k=i+a.height,j=this.offset.click.top,l=this.offset.click.left;j=e+j>i&&e+j<k&&b+l>g&&b+l<h;return this.options.tolerance=="pointer"||this.options.forcePointerForContainers||
+this.options.tolerance!="pointer"&&this.helperProportions[this.floating?"width":"height"]>a[this.floating?"width":"height"]?j:g<b+this.helperProportions.width/2&&c-this.helperProportions.width/2<h&&i<e+this.helperProportions.height/2&&f-this.helperProportions.height/2<k},_intersectsWithPointer:function(a){var b=d.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,a.top,a.height);a=d.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,a.left,a.width);b=b&&a;a=this._getDragVerticalDirection();
+var c=this._getDragHorizontalDirection();if(!b)return false;return this.floating?c&&c=="right"||a=="down"?2:1:a&&(a=="down"?2:1)},_intersectsWithSides:function(a){var b=d.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,a.top+a.height/2,a.height);a=d.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,a.left+a.width/2,a.width);var c=this._getDragVerticalDirection(),e=this._getDragHorizontalDirection();return this.floating&&e?e=="right"&&a||e=="left"&&!a:c&&(c=="down"&&b||c=="up"&&!b)},
+_getDragVerticalDirection:function(){var a=this.positionAbs.top-this.lastPositionAbs.top;return a!=0&&(a>0?"down":"up")},_getDragHorizontalDirection:function(){var a=this.positionAbs.left-this.lastPositionAbs.left;return a!=0&&(a>0?"right":"left")},refresh:function(a){this._refreshItems(a);this.refreshPositions();return this},_connectWith:function(){var a=this.options;return a.connectWith.constructor==String?[a.connectWith]:a.connectWith},_getItemsAsjQuery:function(a){var b=[],c=[],e=this._connectWith();
+if(e&&a)for(a=e.length-1;a>=0;a--)for(var f=d(e[a]),g=f.length-1;g>=0;g--){var h=d.data(f[g],"sortable");if(h&&h!=this&&!h.options.disabled)c.push([d.isFunction(h.options.items)?h.options.items.call(h.element):d(h.options.items,h.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),h])}c.push([d.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):d(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),
+this]);for(a=c.length-1;a>=0;a--)c[a][0].each(function(){b.push(this)});return d(b)},_removeCurrentsFromItems:function(){for(var a=this.currentItem.find(":data(sortable-item)"),b=0;b<this.items.length;b++)for(var c=0;c<a.length;c++)a[c]==this.items[b].item[0]&&this.items.splice(b,1)},_refreshItems:function(a){this.items=[];this.containers=[this];var b=this.items,c=[[d.isFunction(this.options.items)?this.options.items.call(this.element[0],a,{item:this.currentItem}):d(this.options.items,this.element),
+this]],e=this._connectWith();if(e)for(var f=e.length-1;f>=0;f--)for(var g=d(e[f]),h=g.length-1;h>=0;h--){var i=d.data(g[h],"sortable");if(i&&i!=this&&!i.options.disabled){c.push([d.isFunction(i.options.items)?i.options.items.call(i.element[0],a,{item:this.currentItem}):d(i.options.items,i.element),i]);this.containers.push(i)}}for(f=c.length-1;f>=0;f--){a=c[f][1];e=c[f][0];h=0;for(g=e.length;h<g;h++){i=d(e[h]);i.data("sortable-item",a);b.push({item:i,instance:a,width:0,height:0,left:0,top:0})}}},refreshPositions:function(a){if(this.offsetParent&&
+this.helper)this.offset.parent=this._getParentOffset();for(var b=this.items.length-1;b>=0;b--){var c=this.items[b];if(!(c.instance!=this.currentContainer&&this.currentContainer&&c.item[0]!=this.currentItem[0])){var e=this.options.toleranceElement?d(this.options.toleranceElement,c.item):c.item;if(!a){c.width=e.outerWidth();c.height=e.outerHeight()}e=e.offset();c.left=e.left;c.top=e.top}}if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(b=
+this.containers.length-1;b>=0;b--){e=this.containers[b].element.offset();this.containers[b].containerCache.left=e.left;this.containers[b].containerCache.top=e.top;this.containers[b].containerCache.width=this.containers[b].element.outerWidth();this.containers[b].containerCache.height=this.containers[b].element.outerHeight()}return this},_createPlaceholder:function(a){var b=a||this,c=b.options;if(!c.placeholder||c.placeholder.constructor==String){var e=c.placeholder;c.placeholder={element:function(){var f=
+d(document.createElement(b.currentItem[0].nodeName)).addClass(e||b.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];if(!e)f.style.visibility="hidden";return f},update:function(f,g){if(!(e&&!c.forcePlaceholderSize)){g.height()||g.height(b.currentItem.innerHeight()-parseInt(b.currentItem.css("paddingTop")||0,10)-parseInt(b.currentItem.css("paddingBottom")||0,10));g.width()||g.width(b.currentItem.innerWidth()-parseInt(b.currentItem.css("paddingLeft")||0,10)-parseInt(b.currentItem.css("paddingRight")||
+0,10))}}}}b.placeholder=d(c.placeholder.element.call(b.element,b.currentItem));b.currentItem.after(b.placeholder);c.placeholder.update(b,b.placeholder)},_contactContainers:function(a){for(var b=null,c=null,e=this.containers.length-1;e>=0;e--)if(!d.ui.contains(this.currentItem[0],this.containers[e].element[0]))if(this._intersectsWith(this.containers[e].containerCache)){if(!(b&&d.ui.contains(this.containers[e].element[0],b.element[0]))){b=this.containers[e];c=e}}else if(this.containers[e].containerCache.over){this.containers[e]._trigger("out",
+a,this._uiHash(this));this.containers[e].containerCache.over=0}if(b)if(this.containers.length===1){this.containers[c]._trigger("over",a,this._uiHash(this));this.containers[c].containerCache.over=1}else if(this.currentContainer!=this.containers[c]){b=1E4;e=null;for(var f=this.positionAbs[this.containers[c].floating?"left":"top"],g=this.items.length-1;g>=0;g--)if(d.ui.contains(this.containers[c].element[0],this.items[g].item[0])){var h=this.items[g][this.containers[c].floating?"left":"top"];if(Math.abs(h-
+f)<b){b=Math.abs(h-f);e=this.items[g]}}if(e||this.options.dropOnEmpty){this.currentContainer=this.containers[c];e?this._rearrange(a,e,null,true):this._rearrange(a,null,this.containers[c].element,true);this._trigger("change",a,this._uiHash());this.containers[c]._trigger("change",a,this._uiHash(this));this.options.placeholder.update(this.currentContainer,this.placeholder);this.containers[c]._trigger("over",a,this._uiHash(this));this.containers[c].containerCache.over=1}}},_createHelper:function(a){var b=
+this.options;a=d.isFunction(b.helper)?d(b.helper.apply(this.element[0],[a,this.currentItem])):b.helper=="clone"?this.currentItem.clone():this.currentItem;a.parents("body").length||d(b.appendTo!="parent"?b.appendTo:this.currentItem[0].parentNode)[0].appendChild(a[0]);if(a[0]==this.currentItem[0])this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")};if(a[0].style.width==
+""||b.forceHelperSize)a.width(this.currentItem.width());if(a[0].style.height==""||b.forceHelperSize)a.height(this.currentItem.height());return a},_adjustOffsetFromHelper:function(a){if(typeof a=="string")a=a.split(" ");if(d.isArray(a))a={left:+a[0],top:+a[1]||0};if("left"in a)this.offset.click.left=a.left+this.margins.left;if("right"in a)this.offset.click.left=this.helperProportions.width-a.right+this.margins.left;if("top"in a)this.offset.click.top=a.top+this.margins.top;if("bottom"in a)this.offset.click.top=
+this.helperProportions.height-a.bottom+this.margins.top},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var a=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0])){a.left+=this.scrollParent.scrollLeft();a.top+=this.scrollParent.scrollTop()}if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&d.browser.msie)a=
+{top:0,left:0};return{top:a.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:a.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.currentItem.position();return{top:a.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),
+10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var a=this.options;if(a.containment=="parent")a.containment=this.helper[0].parentNode;if(a.containment=="document"||a.containment=="window")this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,d(a.containment=="document"?
+document:window).width()-this.helperProportions.width-this.margins.left,(d(a.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(a.containment)){var b=d(a.containment)[0];a=d(a.containment).offset();var c=d(b).css("overflow")!="hidden";this.containment=[a.left+(parseInt(d(b).css("borderLeftWidth"),10)||0)+(parseInt(d(b).css("paddingLeft"),10)||0)-this.margins.left,a.top+(parseInt(d(b).css("borderTopWidth"),
+10)||0)+(parseInt(d(b).css("paddingTop"),10)||0)-this.margins.top,a.left+(c?Math.max(b.scrollWidth,b.offsetWidth):b.offsetWidth)-(parseInt(d(b).css("borderLeftWidth"),10)||0)-(parseInt(d(b).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,a.top+(c?Math.max(b.scrollHeight,b.offsetHeight):b.offsetHeight)-(parseInt(d(b).css("borderTopWidth"),10)||0)-(parseInt(d(b).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}},_convertPositionTo:function(a,b){if(!b)b=
+this.position;a=a=="absolute"?1:-1;var c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,e=/(html|body)/i.test(c[0].tagName);return{top:b.top+this.offset.relative.top*a+this.offset.parent.top*a-(d.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():e?0:c.scrollTop())*a),left:b.left+this.offset.relative.left*a+this.offset.parent.left*a-(d.browser.safari&&
+this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():e?0:c.scrollLeft())*a)}},_generatePosition:function(a){var b=this.options,c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,e=/(html|body)/i.test(c[0].tagName);if(this.cssPosition=="relative"&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0]))this.offset.relative=this._getRelativeOffset();
+var f=a.pageX,g=a.pageY;if(this.originalPosition){if(this.containment){if(a.pageX-this.offset.click.left<this.containment[0])f=this.containment[0]+this.offset.click.left;if(a.pageY-this.offset.click.top<this.containment[1])g=this.containment[1]+this.offset.click.top;if(a.pageX-this.offset.click.left>this.containment[2])f=this.containment[2]+this.offset.click.left;if(a.pageY-this.offset.click.top>this.containment[3])g=this.containment[3]+this.offset.click.top}if(b.grid){g=this.originalPageY+Math.round((g-
+this.originalPageY)/b.grid[1])*b.grid[1];g=this.containment?!(g-this.offset.click.top<this.containment[1]||g-this.offset.click.top>this.containment[3])?g:!(g-this.offset.click.top<this.containment[1])?g-b.grid[1]:g+b.grid[1]:g;f=this.originalPageX+Math.round((f-this.originalPageX)/b.grid[0])*b.grid[0];f=this.containment?!(f-this.offset.click.left<this.containment[0]||f-this.offset.click.left>this.containment[2])?f:!(f-this.offset.click.left<this.containment[0])?f-b.grid[0]:f+b.grid[0]:f}}return{top:g-
+this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(d.browser.safari&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollTop():e?0:c.scrollTop()),left:f-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(d.browser.safari&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():e?0:c.scrollLeft())}},_rearrange:function(a,b,c,e){c?c[0].appendChild(this.placeholder[0]):b.item[0].parentNode.insertBefore(this.placeholder[0],
+this.direction=="down"?b.item[0]:b.item[0].nextSibling);this.counter=this.counter?++this.counter:1;var f=this,g=this.counter;window.setTimeout(function(){g==f.counter&&f.refreshPositions(!e)},0)},_clear:function(a,b){this.reverting=false;var c=[];!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem);this._noFinalSort=null;if(this.helper[0]==this.currentItem[0]){for(var e in this._storedCSS)if(this._storedCSS[e]=="auto"||this._storedCSS[e]=="static")this._storedCSS[e]=
+"";this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();this.fromOutside&&!b&&c.push(function(f){this._trigger("receive",f,this._uiHash(this.fromOutside))});if((this.fromOutside||this.domPosition.prev!=this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!=this.currentItem.parent()[0])&&!b)c.push(function(f){this._trigger("update",f,this._uiHash())});if(!d.ui.contains(this.element[0],this.currentItem[0])){b||c.push(function(f){this._trigger("remove",
+f,this._uiHash())});for(e=this.containers.length-1;e>=0;e--)if(d.ui.contains(this.containers[e].element[0],this.currentItem[0])&&!b){c.push(function(f){return function(g){f._trigger("receive",g,this._uiHash(this))}}.call(this,this.containers[e]));c.push(function(f){return function(g){f._trigger("update",g,this._uiHash(this))}}.call(this,this.containers[e]))}}for(e=this.containers.length-1;e>=0;e--){b||c.push(function(f){return function(g){f._trigger("deactivate",g,this._uiHash(this))}}.call(this,
+this.containers[e]));if(this.containers[e].containerCache.over){c.push(function(f){return function(g){f._trigger("out",g,this._uiHash(this))}}.call(this,this.containers[e]));this.containers[e].containerCache.over=0}}this._storedCursor&&d("body").css("cursor",this._storedCursor);this._storedOpacity&&this.helper.css("opacity",this._storedOpacity);if(this._storedZIndex)this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex);this.dragging=false;if(this.cancelHelperRemoval){if(!b){this._trigger("beforeStop",
+a,this._uiHash());for(e=0;e<c.length;e++)c[e].call(this,a);this._trigger("stop",a,this._uiHash())}return false}b||this._trigger("beforeStop",a,this._uiHash());this.placeholder[0].parentNode.removeChild(this.placeholder[0]);this.helper[0]!=this.currentItem[0]&&this.helper.remove();this.helper=null;if(!b){for(e=0;e<c.length;e++)c[e].call(this,a);this._trigger("stop",a,this._uiHash())}this.fromOutside=false;return true},_trigger:function(){d.Widget.prototype._trigger.apply(this,arguments)===false&&this.cancel()},
+_uiHash:function(a){var b=a||this;return{helper:b.helper,placeholder:b.placeholder||d([]),position:b.position,originalPosition:b.originalPosition,offset:b.positionAbs,item:b.currentItem,sender:a?a.element:null}}});d.extend(d.ui.sortable,{version:"1.8.16"})})(jQuery);
+;/*
+ * jQuery UI Accordion 1.8.16
+ *
+ * Copyright 2011, 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/Accordion
+ *
+ * Depends:
+ *	jquery.ui.core.js
+ *	jquery.ui.widget.js
+ */
+(function(c){c.widget("ui.accordion",{options:{active:0,animated:"slide",autoHeight:true,clearStyle:false,collapsible:false,event:"click",fillSpace:false,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:false,navigationFilter:function(){return this.href.toLowerCase()===location.href.toLowerCase()}},_create:function(){var a=this,b=a.options;a.running=0;a.element.addClass("ui-accordion ui-widget ui-helper-reset").children("li").addClass("ui-accordion-li-fix");
+a.headers=a.element.find(b.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){b.disabled||c(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){b.disabled||c(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){b.disabled||c(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){b.disabled||c(this).removeClass("ui-state-focus")});a.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");
+if(b.navigation){var d=a.element.find("a").filter(b.navigationFilter).eq(0);if(d.length){var h=d.closest(".ui-accordion-header");a.active=h.length?h:d.closest(".ui-accordion-content").prev()}}a.active=a._findActive(a.active||b.active).addClass("ui-state-default ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");a.active.next().addClass("ui-accordion-content-active");a._createIcons();a.resize();a.element.attr("role","tablist");a.headers.attr("role","tab").bind("keydown.accordion",
+function(f){return a._keydown(f)}).next().attr("role","tabpanel");a.headers.not(a.active||"").attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).next().hide();a.active.length?a.active.attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}):a.headers.eq(0).attr("tabIndex",0);c.browser.safari||a.headers.find("a").attr("tabIndex",-1);b.event&&a.headers.bind(b.event.split(" ").join(".accordion ")+".accordion",function(f){a._clickHandler.call(a,f,this);f.preventDefault()})},_createIcons:function(){var a=
+this.options;if(a.icons){c("<span></span>").addClass("ui-icon "+a.icons.header).prependTo(this.headers);this.active.children(".ui-icon").toggleClass(a.icons.header).toggleClass(a.icons.headerSelected);this.element.addClass("ui-accordion-icons")}},_destroyIcons:function(){this.headers.children(".ui-icon").remove();this.element.removeClass("ui-accordion-icons")},destroy:function(){var a=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role");this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("tabIndex");
+this.headers.find("a").removeAttr("tabIndex");this._destroyIcons();var b=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled");if(a.autoHeight||a.fillHeight)b.css("height","");return c.Widget.prototype.destroy.call(this)},_setOption:function(a,b){c.Widget.prototype._setOption.apply(this,arguments);a=="active"&&this.activate(b);if(a=="icons"){this._destroyIcons();
+b&&this._createIcons()}if(a=="disabled")this.headers.add(this.headers.next())[b?"addClass":"removeClass"]("ui-accordion-disabled ui-state-disabled")},_keydown:function(a){if(!(this.options.disabled||a.altKey||a.ctrlKey)){var b=c.ui.keyCode,d=this.headers.length,h=this.headers.index(a.target),f=false;switch(a.keyCode){case b.RIGHT:case b.DOWN:f=this.headers[(h+1)%d];break;case b.LEFT:case b.UP:f=this.headers[(h-1+d)%d];break;case b.SPACE:case b.ENTER:this._clickHandler({target:a.target},a.target);
+a.preventDefault()}if(f){c(a.target).attr("tabIndex",-1);c(f).attr("tabIndex",0);f.focus();return false}return true}},resize:function(){var a=this.options,b;if(a.fillSpace){if(c.browser.msie){var d=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}b=this.element.parent().height();c.browser.msie&&this.element.parent().css("overflow",d);this.headers.each(function(){b-=c(this).outerHeight(true)});this.headers.next().each(function(){c(this).height(Math.max(0,b-c(this).innerHeight()+
+c(this).height()))}).css("overflow","auto")}else if(a.autoHeight){b=0;this.headers.next().each(function(){b=Math.max(b,c(this).height("").height())}).height(b)}return this},activate:function(a){this.options.active=a;a=this._findActive(a)[0];this._clickHandler({target:a},a);return this},_findActive:function(a){return a?typeof a==="number"?this.headers.filter(":eq("+a+")"):this.headers.not(this.headers.not(a)):a===false?c([]):this.headers.filter(":eq(0)")},_clickHandler:function(a,b){var d=this.options;
+if(!d.disabled)if(a.target){a=c(a.currentTarget||b);b=a[0]===this.active[0];d.active=d.collapsible&&b?false:this.headers.index(a);if(!(this.running||!d.collapsible&&b)){var h=this.active;j=a.next();g=this.active.next();e={options:d,newHeader:b&&d.collapsible?c([]):a,oldHeader:this.active,newContent:b&&d.collapsible?c([]):j,oldContent:g};var f=this.headers.index(this.active[0])>this.headers.index(a[0]);this.active=b?c([]):a;this._toggle(j,g,e,b,f);h.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);
+if(!b){a.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").children(".ui-icon").removeClass(d.icons.header).addClass(d.icons.headerSelected);a.next().addClass("ui-accordion-content-active")}}}else if(d.collapsible){this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);this.active.next().addClass("ui-accordion-content-active");var g=this.active.next(),
+e={options:d,newHeader:c([]),oldHeader:d.active,newContent:c([]),oldContent:g},j=this.active=c([]);this._toggle(j,g,e)}},_toggle:function(a,b,d,h,f){var g=this,e=g.options;g.toShow=a;g.toHide=b;g.data=d;var j=function(){if(g)return g._completed.apply(g,arguments)};g._trigger("changestart",null,g.data);g.running=b.size()===0?a.size():b.size();if(e.animated){d={};d=e.collapsible&&h?{toShow:c([]),toHide:b,complete:j,down:f,autoHeight:e.autoHeight||e.fillSpace}:{toShow:a,toHide:b,complete:j,down:f,autoHeight:e.autoHeight||
+e.fillSpace};if(!e.proxied)e.proxied=e.animated;if(!e.proxiedDuration)e.proxiedDuration=e.duration;e.animated=c.isFunction(e.proxied)?e.proxied(d):e.proxied;e.duration=c.isFunction(e.proxiedDuration)?e.proxiedDuration(d):e.proxiedDuration;h=c.ui.accordion.animations;var i=e.duration,k=e.animated;if(k&&!h[k]&&!c.easing[k])k="slide";h[k]||(h[k]=function(l){this.slide(l,{easing:k,duration:i||700})});h[k](d)}else{if(e.collapsible&&h)a.toggle();else{b.hide();a.show()}j(true)}b.prev().attr({"aria-expanded":"false",
+"aria-selected":"false",tabIndex:-1}).blur();a.prev().attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}).focus()},_completed:function(a){this.running=a?0:--this.running;if(!this.running){this.options.clearStyle&&this.toShow.add(this.toHide).css({height:"",overflow:""});this.toHide.removeClass("ui-accordion-content-active");if(this.toHide.length)this.toHide.parent()[0].className=this.toHide.parent()[0].className;this._trigger("change",null,this.data)}}});c.extend(c.ui.accordion,{version:"1.8.16",
+animations:{slide:function(a,b){a=c.extend({easing:"swing",duration:300},a,b);if(a.toHide.size())if(a.toShow.size()){var d=a.toShow.css("overflow"),h=0,f={},g={},e;b=a.toShow;e=b[0].style.width;b.width(parseInt(b.parent().width(),10)-parseInt(b.css("paddingLeft"),10)-parseInt(b.css("paddingRight"),10)-(parseInt(b.css("borderLeftWidth"),10)||0)-(parseInt(b.css("borderRightWidth"),10)||0));c.each(["height","paddingTop","paddingBottom"],function(j,i){g[i]="hide";j=(""+c.css(a.toShow[0],i)).match(/^([\d+-.]+)(.*)$/);
+f[i]={value:j[1],unit:j[2]||"px"}});a.toShow.css({height:0,overflow:"hidden"}).show();a.toHide.filter(":hidden").each(a.complete).end().filter(":visible").animate(g,{step:function(j,i){if(i.prop=="height")h=i.end-i.start===0?0:(i.now-i.start)/(i.end-i.start);a.toShow[0].style[i.prop]=h*f[i.prop].value+f[i.prop].unit},duration:a.duration,easing:a.easing,complete:function(){a.autoHeight||a.toShow.css("height","");a.toShow.css({width:e,overflow:d});a.complete()}})}else a.toHide.animate({height:"hide",
+paddingTop:"hide",paddingBottom:"hide"},a);else a.toShow.animate({height:"show",paddingTop:"show",paddingBottom:"show"},a)},bounceslide:function(a){this.slide(a,{easing:a.down?"easeOutBounce":"swing",duration:a.down?1E3:200})}}})})(jQuery);
+;/*
+ * jQuery UI Autocomplete 1.8.16
+ *
+ * Copyright 2011, 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/Autocomplete
+ *
+ * Depends:
+ *	jquery.ui.core.js
+ *	jquery.ui.widget.js
+ *	jquery.ui.position.js
+ */
+(function(d){var e=0;d.widget("ui.autocomplete",{options:{appendTo:"body",autoFocus:false,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null},pending:0,_create:function(){var a=this,b=this.element[0].ownerDocument,g;this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(c){if(!(a.options.disabled||a.element.propAttr("readOnly"))){g=
+false;var f=d.ui.keyCode;switch(c.keyCode){case f.PAGE_UP:a._move("previousPage",c);break;case f.PAGE_DOWN:a._move("nextPage",c);break;case f.UP:a._move("previous",c);c.preventDefault();break;case f.DOWN:a._move("next",c);c.preventDefault();break;case f.ENTER:case f.NUMPAD_ENTER:if(a.menu.active){g=true;c.preventDefault()}case f.TAB:if(!a.menu.active)return;a.menu.select(c);break;case f.ESCAPE:a.element.val(a.term);a.close(c);break;default:clearTimeout(a.searching);a.searching=setTimeout(function(){if(a.term!=
+a.element.val()){a.selectedItem=null;a.search(null,c)}},a.options.delay);break}}}).bind("keypress.autocomplete",function(c){if(g){g=false;c.preventDefault()}}).bind("focus.autocomplete",function(){if(!a.options.disabled){a.selectedItem=null;a.previous=a.element.val()}}).bind("blur.autocomplete",function(c){if(!a.options.disabled){clearTimeout(a.searching);a.closing=setTimeout(function(){a.close(c);a._change(c)},150)}});this._initSource();this.response=function(){return a._response.apply(a,arguments)};
+this.menu=d("<ul></ul>").addClass("ui-autocomplete").appendTo(d(this.options.appendTo||"body",b)[0]).mousedown(function(c){var f=a.menu.element[0];d(c.target).closest(".ui-menu-item").length||setTimeout(function(){d(document).one("mousedown",function(h){h.target!==a.element[0]&&h.target!==f&&!d.ui.contains(f,h.target)&&a.close()})},1);setTimeout(function(){clearTimeout(a.closing)},13)}).menu({focus:function(c,f){f=f.item.data("item.autocomplete");false!==a._trigger("focus",c,{item:f})&&/^key/.test(c.originalEvent.type)&&
+a.element.val(f.value)},selected:function(c,f){var h=f.item.data("item.autocomplete"),i=a.previous;if(a.element[0]!==b.activeElement){a.element.focus();a.previous=i;setTimeout(function(){a.previous=i;a.selectedItem=h},1)}false!==a._trigger("select",c,{item:h})&&a.element.val(h.value);a.term=a.element.val();a.close(c);a.selectedItem=h},blur:function(){a.menu.element.is(":visible")&&a.element.val()!==a.term&&a.element.val(a.term)}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data("menu");
+d.fn.bgiframe&&this.menu.element.bgiframe()},destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup");this.menu.element.remove();d.Widget.prototype.destroy.call(this)},_setOption:function(a,b){d.Widget.prototype._setOption.apply(this,arguments);a==="source"&&this._initSource();if(a==="appendTo")this.menu.element.appendTo(d(b||"body",this.element[0].ownerDocument)[0]);a==="disabled"&&
+b&&this.xhr&&this.xhr.abort()},_initSource:function(){var a=this,b,g;if(d.isArray(this.options.source)){b=this.options.source;this.source=function(c,f){f(d.ui.autocomplete.filter(b,c.term))}}else if(typeof this.options.source==="string"){g=this.options.source;this.source=function(c,f){a.xhr&&a.xhr.abort();a.xhr=d.ajax({url:g,data:c,dataType:"json",autocompleteRequest:++e,success:function(h){this.autocompleteRequest===e&&f(h)},error:function(){this.autocompleteRequest===e&&f([])}})}}else this.source=
+this.options.source},search:function(a,b){a=a!=null?a:this.element.val();this.term=this.element.val();if(a.length<this.options.minLength)return this.close(b);clearTimeout(this.closing);if(this._trigger("search",b)!==false)return this._search(a)},_search:function(a){this.pending++;this.element.addClass("ui-autocomplete-loading");this.source({term:a},this.response)},_response:function(a){if(!this.options.disabled&&a&&a.length){a=this._normalize(a);this._suggest(a);this._trigger("open")}else this.close();
+this.pending--;this.pending||this.element.removeClass("ui-autocomplete-loading")},close:function(a){clearTimeout(this.closing);if(this.menu.element.is(":visible")){this.menu.element.hide();this.menu.deactivate();this._trigger("close",a)}},_change:function(a){this.previous!==this.element.val()&&this._trigger("change",a,{item:this.selectedItem})},_normalize:function(a){if(a.length&&a[0].label&&a[0].value)return a;return d.map(a,function(b){if(typeof b==="string")return{label:b,value:b};return d.extend({label:b.label||
+b.value,value:b.value||b.label},b)})},_suggest:function(a){var b=this.menu.element.empty().zIndex(this.element.zIndex()+1);this._renderMenu(b,a);this.menu.deactivate();this.menu.refresh();b.show();this._resizeMenu();b.position(d.extend({of:this.element},this.options.position));this.options.autoFocus&&this.menu.next(new d.Event("mouseover"))},_resizeMenu:function(){var a=this.menu.element;a.outerWidth(Math.max(a.width("").outerWidth(),this.element.outerWidth()))},_renderMenu:function(a,b){var g=this;
+d.each(b,function(c,f){g._renderItem(a,f)})},_renderItem:function(a,b){return d("<li></li>").data("item.autocomplete",b).append(d("<a></a>").text(b.label)).appendTo(a)},_move:function(a,b){if(this.menu.element.is(":visible"))if(this.menu.first()&&/^previous/.test(a)||this.menu.last()&&/^next/.test(a)){this.element.val(this.term);this.menu.deactivate()}else this.menu[a](b);else this.search(null,b)},widget:function(){return this.menu.element}});d.extend(d.ui.autocomplete,{escapeRegex:function(a){return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,
+"\\$&")},filter:function(a,b){var g=new RegExp(d.ui.autocomplete.escapeRegex(b),"i");return d.grep(a,function(c){return g.test(c.label||c.value||c)})}})})(jQuery);
+(function(d){d.widget("ui.menu",{_create:function(){var e=this;this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox","aria-activedescendant":"ui-active-menuitem"}).click(function(a){if(d(a.target).closest(".ui-menu-item a").length){a.preventDefault();e.select(a)}});this.refresh()},refresh:function(){var e=this;this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem").children("a").addClass("ui-corner-all").attr("tabindex",
+-1).mouseenter(function(a){e.activate(a,d(this).parent())}).mouseleave(function(){e.deactivate()})},activate:function(e,a){this.deactivate();if(this.hasScroll()){var b=a.offset().top-this.element.offset().top,g=this.element.scrollTop(),c=this.element.height();if(b<0)this.element.scrollTop(g+b);else b>=c&&this.element.scrollTop(g+b-c+a.height())}this.active=a.eq(0).children("a").addClass("ui-state-hover").attr("id","ui-active-menuitem").end();this._trigger("focus",e,{item:a})},deactivate:function(){if(this.active){this.active.children("a").removeClass("ui-state-hover").removeAttr("id");
+this._trigger("blur");this.active=null}},next:function(e){this.move("next",".ui-menu-item:first",e)},previous:function(e){this.move("prev",".ui-menu-item:last",e)},first:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},last:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},move:function(e,a,b){if(this.active){e=this.active[e+"All"](".ui-menu-item").eq(0);e.length?this.activate(b,e):this.activate(b,this.element.children(a))}else this.activate(b,
+this.element.children(a))},nextPage:function(e){if(this.hasScroll())if(!this.active||this.last())this.activate(e,this.element.children(".ui-menu-item:first"));else{var a=this.active.offset().top,b=this.element.height(),g=this.element.children(".ui-menu-item").filter(function(){var c=d(this).offset().top-a-b+d(this).height();return c<10&&c>-10});g.length||(g=this.element.children(".ui-menu-item:last"));this.activate(e,g)}else this.activate(e,this.element.children(".ui-menu-item").filter(!this.active||
+this.last()?":first":":last"))},previousPage:function(e){if(this.hasScroll())if(!this.active||this.first())this.activate(e,this.element.children(".ui-menu-item:last"));else{var a=this.active.offset().top,b=this.element.height();result=this.element.children(".ui-menu-item").filter(function(){var g=d(this).offset().top-a+b-d(this).height();return g<10&&g>-10});result.length||(result=this.element.children(".ui-menu-item:first"));this.activate(e,result)}else this.activate(e,this.element.children(".ui-menu-item").filter(!this.active||
+this.first()?":last":":first"))},hasScroll:function(){return this.element.height()<this.element[d.fn.prop?"prop":"attr"]("scrollHeight")},select:function(e){this._trigger("selected",e,{item:this.active})}})})(jQuery);
+;/*
+ * jQuery UI Button 1.8.16
+ *
+ * Copyright 2011, 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(b){var h,i,j,g,l=function(){var a=b(this).find(":ui-button");setTimeout(function(){a.button("refresh")},1)},k=function(a){var c=a.name,e=a.form,f=b([]);if(c)f=e?b(e).find("[name='"+c+"']"):b("[name='"+c+"']",a.ownerDocument).filter(function(){return!this.form});return f};b.widget("ui.button",{options:{disabled:null,text:true,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset.button").bind("reset.button",l);if(typeof this.options.disabled!==
+"boolean")this.options.disabled=this.element.propAttr("disabled");this._determineButtonType();this.hasTitle=!!this.buttonElement.attr("title");var a=this,c=this.options,e=this.type==="checkbox"||this.type==="radio",f="ui-state-hover"+(!e?" ui-state-active":"");if(c.label===null)c.label=this.buttonElement.html();if(this.element.is(":disabled"))c.disabled=true;this.buttonElement.addClass("ui-button ui-widget ui-state-default ui-corner-all").attr("role","button").bind("mouseenter.button",function(){if(!c.disabled){b(this).addClass("ui-state-hover");
+this===h&&b(this).addClass("ui-state-active")}}).bind("mouseleave.button",function(){c.disabled||b(this).removeClass(f)}).bind("click.button",function(d){if(c.disabled){d.preventDefault();d.stopImmediatePropagation()}});this.element.bind("focus.button",function(){a.buttonElement.addClass("ui-state-focus")}).bind("blur.button",function(){a.buttonElement.removeClass("ui-state-focus")});if(e){this.element.bind("change.button",function(){g||a.refresh()});this.buttonElement.bind("mousedown.button",function(d){if(!c.disabled){g=
+false;i=d.pageX;j=d.pageY}}).bind("mouseup.button",function(d){if(!c.disabled)if(i!==d.pageX||j!==d.pageY)g=true})}if(this.type==="checkbox")this.buttonElement.bind("click.button",function(){if(c.disabled||g)return false;b(this).toggleClass("ui-state-active");a.buttonElement.attr("aria-pressed",a.element[0].checked)});else if(this.type==="radio")this.buttonElement.bind("click.button",function(){if(c.disabled||g)return false;b(this).addClass("ui-state-active");a.buttonElement.attr("aria-pressed","true");
+var d=a.element[0];k(d).not(d).map(function(){return b(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed","false")});else{this.buttonElement.bind("mousedown.button",function(){if(c.disabled)return false;b(this).addClass("ui-state-active");h=this;b(document).one("mouseup",function(){h=null})}).bind("mouseup.button",function(){if(c.disabled)return false;b(this).removeClass("ui-state-active")}).bind("keydown.button",function(d){if(c.disabled)return false;if(d.keyCode==b.ui.keyCode.SPACE||
+d.keyCode==b.ui.keyCode.ENTER)b(this).addClass("ui-state-active")}).bind("keyup.button",function(){b(this).removeClass("ui-state-active")});this.buttonElement.is("a")&&this.buttonElement.keyup(function(d){d.keyCode===b.ui.keyCode.SPACE&&b(this).click()})}this._setOption("disabled",c.disabled);this._resetButton()},_determineButtonType:function(){this.type=this.element.is(":checkbox")?"checkbox":this.element.is(":radio")?"radio":this.element.is("input")?"input":"button";if(this.type==="checkbox"||this.type===
+"radio"){var a=this.element.parents().filter(":last"),c="label[for='"+this.element.attr("id")+"']";this.buttonElement=a.find(c);if(!this.buttonElement.length){a=a.length?a.siblings():this.element.siblings();this.buttonElement=a.filter(c);if(!this.buttonElement.length)this.buttonElement=a.find(c)}this.element.addClass("ui-helper-hidden-accessible");(a=this.element.is(":checked"))&&this.buttonElement.addClass("ui-state-active");this.buttonElement.attr("aria-pressed",a)}else this.buttonElement=this.element},
+widget:function(){return this.buttonElement},destroy:function(){this.element.removeClass("ui-helper-hidden-accessible");this.buttonElement.removeClass("ui-button ui-widget ui-state-default ui-corner-all ui-state-hover ui-state-active  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").removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html());this.hasTitle||this.buttonElement.removeAttr("title");
+b.Widget.prototype.destroy.call(this)},_setOption:function(a,c){b.Widget.prototype._setOption.apply(this,arguments);if(a==="disabled")c?this.element.propAttr("disabled",true):this.element.propAttr("disabled",false);else this._resetButton()},refresh:function(){var a=this.element.is(":disabled");a!==this.options.disabled&&this._setOption("disabled",a);if(this.type==="radio")k(this.element[0]).each(function(){b(this).is(":checked")?b(this).button("widget").addClass("ui-state-active").attr("aria-pressed",
+"true"):b(this).button("widget").removeClass("ui-state-active").attr("aria-pressed","false")});else if(this.type==="checkbox")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(this.type==="input")this.options.label&&this.element.val(this.options.label);else{var a=this.buttonElement.removeClass("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"),
+c=b("<span></span>").addClass("ui-button-text").html(this.options.label).appendTo(a.empty()).text(),e=this.options.icons,f=e.primary&&e.secondary,d=[];if(e.primary||e.secondary){if(this.options.text)d.push("ui-button-text-icon"+(f?"s":e.primary?"-primary":"-secondary"));e.primary&&a.prepend("<span class='ui-button-icon-primary ui-icon "+e.primary+"'></span>");e.secondary&&a.append("<span class='ui-button-icon-secondary ui-icon "+e.secondary+"'></span>");if(!this.options.text){d.push(f?"ui-button-icons-only":
+"ui-button-icon-only");this.hasTitle||a.attr("title",c)}}else d.push("ui-button-text-only");a.addClass(d.join(" "))}}});b.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(a,c){a==="disabled"&&this.buttons.button("option",a,c);b.Widget.prototype._setOption.apply(this,arguments)},refresh:function(){var a=this.element.css("direction")===
+"ltr";this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return b(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(a?"ui-corner-left":"ui-corner-right").end().filter(":last").addClass(a?"ui-corner-right":"ui-corner-left").end().end()},destroy:function(){this.element.removeClass("ui-buttonset");this.buttons.map(function(){return b(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy");
+b.Widget.prototype.destroy.call(this)}})})(jQuery);
+;/*
+ * jQuery UI Dialog 1.8.16
+ *
+ * Copyright 2011, 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(c,l){var m={buttons:true,height:true,maxHeight:true,maxWidth:true,minHeight:true,minWidth:true,width:true},n={maxHeight:true,maxWidth:true,minHeight:true,minWidth:true},o=c.attrFn||{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true,click:true};c.widget("ui.dialog",{options:{autoOpen:true,buttons:{},closeOnEscape:true,closeText:"close",dialogClass:"",draggable:true,hide:null,height:"auto",maxHeight:false,maxWidth:false,minHeight:150,minWidth:150,modal:false,
+position:{my:"center",at:"center",collision:"fit",using:function(a){var b=c(this).css(a).offset().top;b<0&&c(this).css("top",a.top-b)}},resizable:true,show:null,stack:true,title:"",width:300,zIndex:1E3},_create:function(){this.originalTitle=this.element.attr("title");if(typeof this.originalTitle!=="string")this.originalTitle="";this.options.title=this.options.title||this.originalTitle;var a=this,b=a.options,d=b.title||"&#160;",e=c.ui.dialog.getTitleId(a.element),g=(a.uiDialog=c("<div></div>")).appendTo(document.body).hide().addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+
+b.dialogClass).css({zIndex:b.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(i){if(b.closeOnEscape&&!i.isDefaultPrevented()&&i.keyCode&&i.keyCode===c.ui.keyCode.ESCAPE){a.close(i);i.preventDefault()}}).attr({role:"dialog","aria-labelledby":e}).mousedown(function(i){a.moveToTop(false,i)});a.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(g);var f=(a.uiDialogTitlebar=c("<div></div>")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(g),
+h=c('<a href="#"></a>').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){h.addClass("ui-state-hover")},function(){h.removeClass("ui-state-hover")}).focus(function(){h.addClass("ui-state-focus")}).blur(function(){h.removeClass("ui-state-focus")}).click(function(i){a.close(i);return false}).appendTo(f);(a.uiDialogTitlebarCloseText=c("<span></span>")).addClass("ui-icon ui-icon-closethick").text(b.closeText).appendTo(h);c("<span></span>").addClass("ui-dialog-title").attr("id",
+e).html(d).prependTo(f);if(c.isFunction(b.beforeclose)&&!c.isFunction(b.beforeClose))b.beforeClose=b.beforeclose;f.find("*").add(f).disableSelection();b.draggable&&c.fn.draggable&&a._makeDraggable();b.resizable&&c.fn.resizable&&a._makeResizable();a._createButtons(b.buttons);a._isOpen=false;c.fn.bgiframe&&g.bgiframe()},_init:function(){this.options.autoOpen&&this.open()},destroy:function(){var a=this;a.overlay&&a.overlay.destroy();a.uiDialog.hide();a.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body");
+a.uiDialog.remove();a.originalTitle&&a.element.attr("title",a.originalTitle);return a},widget:function(){return this.uiDialog},close:function(a){var b=this,d,e;if(false!==b._trigger("beforeClose",a)){b.overlay&&b.overlay.destroy();b.uiDialog.unbind("keypress.ui-dialog");b._isOpen=false;if(b.options.hide)b.uiDialog.hide(b.options.hide,function(){b._trigger("close",a)});else{b.uiDialog.hide();b._trigger("close",a)}c.ui.dialog.overlay.resize();if(b.options.modal){d=0;c(".ui-dialog").each(function(){if(this!==
+b.uiDialog[0]){e=c(this).css("z-index");isNaN(e)||(d=Math.max(d,e))}});c.ui.dialog.maxZ=d}return b}},isOpen:function(){return this._isOpen},moveToTop:function(a,b){var d=this,e=d.options;if(e.modal&&!a||!e.stack&&!e.modal)return d._trigger("focus",b);if(e.zIndex>c.ui.dialog.maxZ)c.ui.dialog.maxZ=e.zIndex;if(d.overlay){c.ui.dialog.maxZ+=1;d.overlay.$el.css("z-index",c.ui.dialog.overlay.maxZ=c.ui.dialog.maxZ)}a={scrollTop:d.element.scrollTop(),scrollLeft:d.element.scrollLeft()};c.ui.dialog.maxZ+=1;
+d.uiDialog.css("z-index",c.ui.dialog.maxZ);d.element.attr(a);d._trigger("focus",b);return d},open:function(){if(!this._isOpen){var a=this,b=a.options,d=a.uiDialog;a.overlay=b.modal?new c.ui.dialog.overlay(a):null;a._size();a._position(b.position);d.show(b.show);a.moveToTop(true);b.modal&&d.bind("keypress.ui-dialog",function(e){if(e.keyCode===c.ui.keyCode.TAB){var g=c(":tabbable",this),f=g.filter(":first");g=g.filter(":last");if(e.target===g[0]&&!e.shiftKey){f.focus(1);return false}else if(e.target===
+f[0]&&e.shiftKey){g.focus(1);return false}}});c(a.element.find(":tabbable").get().concat(d.find(".ui-dialog-buttonpane :tabbable").get().concat(d.get()))).eq(0).focus();a._isOpen=true;a._trigger("open");return a}},_createButtons:function(a){var b=this,d=false,e=c("<div></div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),g=c("<div></div>").addClass("ui-dialog-buttonset").appendTo(e);b.uiDialog.find(".ui-dialog-buttonpane").remove();typeof a==="object"&&a!==null&&c.each(a,
+function(){return!(d=true)});if(d){c.each(a,function(f,h){h=c.isFunction(h)?{click:h,text:f}:h;var i=c('<button type="button"></button>').click(function(){h.click.apply(b.element[0],arguments)}).appendTo(g);c.each(h,function(j,k){if(j!=="click")j in o?i[j](k):i.attr(j,k)});c.fn.button&&i.button()});e.appendTo(b.uiDialog)}},_makeDraggable:function(){function a(f){return{position:f.position,offset:f.offset}}var b=this,d=b.options,e=c(document),g;b.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",
+handle:".ui-dialog-titlebar",containment:"document",start:function(f,h){g=d.height==="auto"?"auto":c(this).height();c(this).height(c(this).height()).addClass("ui-dialog-dragging");b._trigger("dragStart",f,a(h))},drag:function(f,h){b._trigger("drag",f,a(h))},stop:function(f,h){d.position=[h.position.left-e.scrollLeft(),h.position.top-e.scrollTop()];c(this).removeClass("ui-dialog-dragging").height(g);b._trigger("dragStop",f,a(h));c.ui.dialog.overlay.resize()}})},_makeResizable:function(a){function b(f){return{originalPosition:f.originalPosition,
+originalSize:f.originalSize,position:f.position,size:f.size}}a=a===l?this.options.resizable:a;var d=this,e=d.options,g=d.uiDialog.css("position");a=typeof a==="string"?a:"n,e,s,w,se,sw,ne,nw";d.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:d.element,maxWidth:e.maxWidth,maxHeight:e.maxHeight,minWidth:e.minWidth,minHeight:d._minHeight(),handles:a,start:function(f,h){c(this).addClass("ui-dialog-resizing");d._trigger("resizeStart",f,b(h))},resize:function(f,h){d._trigger("resize",
+f,b(h))},stop:function(f,h){c(this).removeClass("ui-dialog-resizing");e.height=c(this).height();e.width=c(this).width();d._trigger("resizeStop",f,b(h));c.ui.dialog.overlay.resize()}}).css("position",g).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_minHeight:function(){var a=this.options;return a.height==="auto"?a.minHeight:Math.min(a.minHeight,a.height)},_position:function(a){var b=[],d=[0,0],e;if(a){if(typeof a==="string"||typeof a==="object"&&"0"in a){b=a.split?a.split(" "):
+[a[0],a[1]];if(b.length===1)b[1]=b[0];c.each(["left","top"],function(g,f){if(+b[g]===b[g]){d[g]=b[g];b[g]=f}});a={my:b.join(" "),at:b.join(" "),offset:d.join(" ")}}a=c.extend({},c.ui.dialog.prototype.options.position,a)}else a=c.ui.dialog.prototype.options.position;(e=this.uiDialog.is(":visible"))||this.uiDialog.show();this.uiDialog.css({top:0,left:0}).position(c.extend({of:window},a));e||this.uiDialog.hide()},_setOptions:function(a){var b=this,d={},e=false;c.each(a,function(g,f){b._setOption(g,f);
+if(g in m)e=true;if(g in n)d[g]=f});e&&this._size();this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option",d)},_setOption:function(a,b){var d=this,e=d.uiDialog;switch(a){case "beforeclose":a="beforeClose";break;case "buttons":d._createButtons(b);break;case "closeText":d.uiDialogTitlebarCloseText.text(""+b);break;case "dialogClass":e.removeClass(d.options.dialogClass).addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+b);break;case "disabled":b?e.addClass("ui-dialog-disabled"):
+e.removeClass("ui-dialog-disabled");break;case "draggable":var g=e.is(":data(draggable)");g&&!b&&e.draggable("destroy");!g&&b&&d._makeDraggable();break;case "position":d._position(b);break;case "resizable":(g=e.is(":data(resizable)"))&&!b&&e.resizable("destroy");g&&typeof b==="string"&&e.resizable("option","handles",b);!g&&b!==false&&d._makeResizable(b);break;case "title":c(".ui-dialog-title",d.uiDialogTitlebar).html(""+(b||"&#160;"));break}c.Widget.prototype._setOption.apply(d,arguments)},_size:function(){var a=
+this.options,b,d,e=this.uiDialog.is(":visible");this.element.show().css({width:"auto",minHeight:0,height:0});if(a.minWidth>a.width)a.width=a.minWidth;b=this.uiDialog.css({height:"auto",width:a.width}).height();d=Math.max(0,a.minHeight-b);if(a.height==="auto")if(c.support.minHeight)this.element.css({minHeight:d,height:"auto"});else{this.uiDialog.show();a=this.element.css("height","auto").height();e||this.uiDialog.hide();this.element.height(Math.max(a,d))}else this.element.height(Math.max(a.height-
+b,0));this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())}});c.extend(c.ui.dialog,{version:"1.8.16",uuid:0,maxZ:0,getTitleId:function(a){a=a.attr("id");if(!a){this.uuid+=1;a=this.uuid}return"ui-dialog-title-"+a},overlay:function(a){this.$el=c.ui.dialog.overlay.create(a)}});c.extend(c.ui.dialog.overlay,{instances:[],oldInstances:[],maxZ:0,events:c.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(a){return a+".dialog-overlay"}).join(" "),
+create:function(a){if(this.instances.length===0){setTimeout(function(){c.ui.dialog.overlay.instances.length&&c(document).bind(c.ui.dialog.overlay.events,function(d){if(c(d.target).zIndex()<c.ui.dialog.overlay.maxZ)return false})},1);c(document).bind("keydown.dialog-overlay",function(d){if(a.options.closeOnEscape&&!d.isDefaultPrevented()&&d.keyCode&&d.keyCode===c.ui.keyCode.ESCAPE){a.close(d);d.preventDefault()}});c(window).bind("resize.dialog-overlay",c.ui.dialog.overlay.resize)}var b=(this.oldInstances.pop()||
+c("<div></div>").addClass("ui-widget-overlay")).appendTo(document.body).css({width:this.width(),height:this.height()});c.fn.bgiframe&&b.bgiframe();this.instances.push(b);return b},destroy:function(a){var b=c.inArray(a,this.instances);b!=-1&&this.oldInstances.push(this.instances.splice(b,1)[0]);this.instances.length===0&&c([document,window]).unbind(".dialog-overlay");a.remove();var d=0;c.each(this.instances,function(){d=Math.max(d,this.css("z-index"))});this.maxZ=d},height:function(){var a,b;if(c.browser.msie&&
+c.browser.version<7){a=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);b=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);return a<b?c(window).height()+"px":a+"px"}else return c(document).height()+"px"},width:function(){var a,b;if(c.browser.msie){a=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth);b=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth);return a<b?c(window).width()+"px":a+"px"}else return c(document).width()+
+"px"},resize:function(){var a=c([]);c.each(c.ui.dialog.overlay.instances,function(){a=a.add(this)});a.css({width:0,height:0}).css({width:c.ui.dialog.overlay.width(),height:c.ui.dialog.overlay.height()})}});c.extend(c.ui.dialog.overlay.prototype,{destroy:function(){c.ui.dialog.overlay.destroy(this.$el)}})})(jQuery);
+;/*
+ * jQuery UI Slider 1.8.16
+ *
+ * Copyright 2011, 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/Slider
+ *
+ * Depends:
+ *	jquery.ui.core.js
+ *	jquery.ui.mouse.js
+ *	jquery.ui.widget.js
+ */
+(function(d){d.widget("ui.slider",d.ui.mouse,{widgetEventPrefix:"slide",options:{animate:false,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null},_create:function(){var a=this,b=this.options,c=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),f=b.values&&b.values.length||1,e=[];this._mouseSliding=this._keySliding=false;this._animateOff=true;this._handleIndex=null;this._detectOrientation();this._mouseInit();this.element.addClass("ui-slider ui-slider-"+
+this.orientation+" ui-widget ui-widget-content ui-corner-all"+(b.disabled?" ui-slider-disabled ui-disabled":""));this.range=d([]);if(b.range){if(b.range===true){if(!b.values)b.values=[this._valueMin(),this._valueMin()];if(b.values.length&&b.values.length!==2)b.values=[b.values[0],b.values[0]]}this.range=d("<div></div>").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+(b.range==="min"||b.range==="max"?" ui-slider-range-"+b.range:""))}for(var j=c.length;j<f;j+=1)e.push("<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>");
+this.handles=c.add(d(e.join("")).appendTo(a.element));this.handle=this.handles.eq(0);this.handles.add(this.range).filter("a").click(function(g){g.preventDefault()}).hover(function(){b.disabled||d(this).addClass("ui-state-hover")},function(){d(this).removeClass("ui-state-hover")}).focus(function(){if(b.disabled)d(this).blur();else{d(".ui-slider .ui-state-focus").removeClass("ui-state-focus");d(this).addClass("ui-state-focus")}}).blur(function(){d(this).removeClass("ui-state-focus")});this.handles.each(function(g){d(this).data("index.ui-slider-handle",
+g)});this.handles.keydown(function(g){var k=true,l=d(this).data("index.ui-slider-handle"),i,h,m;if(!a.options.disabled){switch(g.keyCode){case d.ui.keyCode.HOME:case d.ui.keyCode.END:case d.ui.keyCode.PAGE_UP:case d.ui.keyCode.PAGE_DOWN:case d.ui.keyCode.UP:case d.ui.keyCode.RIGHT:case d.ui.keyCode.DOWN:case d.ui.keyCode.LEFT:k=false;if(!a._keySliding){a._keySliding=true;d(this).addClass("ui-state-active");i=a._start(g,l);if(i===false)return}break}m=a.options.step;i=a.options.values&&a.options.values.length?
+(h=a.values(l)):(h=a.value());switch(g.keyCode){case d.ui.keyCode.HOME:h=a._valueMin();break;case d.ui.keyCode.END:h=a._valueMax();break;case d.ui.keyCode.PAGE_UP:h=a._trimAlignValue(i+(a._valueMax()-a._valueMin())/5);break;case d.ui.keyCode.PAGE_DOWN:h=a._trimAlignValue(i-(a._valueMax()-a._valueMin())/5);break;case d.ui.keyCode.UP:case d.ui.keyCode.RIGHT:if(i===a._valueMax())return;h=a._trimAlignValue(i+m);break;case d.ui.keyCode.DOWN:case d.ui.keyCode.LEFT:if(i===a._valueMin())return;h=a._trimAlignValue(i-
+m);break}a._slide(g,l,h);return k}}).keyup(function(g){var k=d(this).data("index.ui-slider-handle");if(a._keySliding){a._keySliding=false;a._stop(g,k);a._change(g,k);d(this).removeClass("ui-state-active")}});this._refreshValue();this._animateOff=false},destroy:function(){this.handles.remove();this.range.remove();this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider");this._mouseDestroy();
+return this},_mouseCapture:function(a){var b=this.options,c,f,e,j,g;if(b.disabled)return false;this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.elementOffset=this.element.offset();c=this._normValueFromMouse({x:a.pageX,y:a.pageY});f=this._valueMax()-this._valueMin()+1;j=this;this.handles.each(function(k){var l=Math.abs(c-j.values(k));if(f>l){f=l;e=d(this);g=k}});if(b.range===true&&this.values(1)===b.min){g+=1;e=d(this.handles[g])}if(this._start(a,g)===false)return false;
+this._mouseSliding=true;j._handleIndex=g;e.addClass("ui-state-active").focus();b=e.offset();this._clickOffset=!d(a.target).parents().andSelf().is(".ui-slider-handle")?{left:0,top:0}:{left:a.pageX-b.left-e.width()/2,top:a.pageY-b.top-e.height()/2-(parseInt(e.css("borderTopWidth"),10)||0)-(parseInt(e.css("borderBottomWidth"),10)||0)+(parseInt(e.css("marginTop"),10)||0)};this.handles.hasClass("ui-state-hover")||this._slide(a,g,c);return this._animateOff=true},_mouseStart:function(){return true},_mouseDrag:function(a){var b=
+this._normValueFromMouse({x:a.pageX,y:a.pageY});this._slide(a,this._handleIndex,b);return false},_mouseStop:function(a){this.handles.removeClass("ui-state-active");this._mouseSliding=false;this._stop(a,this._handleIndex);this._change(a,this._handleIndex);this._clickOffset=this._handleIndex=null;return this._animateOff=false},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(a){var b;if(this.orientation==="horizontal"){b=
+this.elementSize.width;a=a.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)}else{b=this.elementSize.height;a=a.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)}b=a/b;if(b>1)b=1;if(b<0)b=0;if(this.orientation==="vertical")b=1-b;a=this._valueMax()-this._valueMin();return this._trimAlignValue(this._valueMin()+b*a)},_start:function(a,b){var c={handle:this.handles[b],value:this.value()};if(this.options.values&&this.options.values.length){c.value=this.values(b);
+c.values=this.values()}return this._trigger("start",a,c)},_slide:function(a,b,c){var f;if(this.options.values&&this.options.values.length){f=this.values(b?0:1);if(this.options.values.length===2&&this.options.range===true&&(b===0&&c>f||b===1&&c<f))c=f;if(c!==this.values(b)){f=this.values();f[b]=c;a=this._trigger("slide",a,{handle:this.handles[b],value:c,values:f});this.values(b?0:1);a!==false&&this.values(b,c,true)}}else if(c!==this.value()){a=this._trigger("slide",a,{handle:this.handles[b],value:c});
+a!==false&&this.value(c)}},_stop:function(a,b){var c={handle:this.handles[b],value:this.value()};if(this.options.values&&this.options.values.length){c.value=this.values(b);c.values=this.values()}this._trigger("stop",a,c)},_change:function(a,b){if(!this._keySliding&&!this._mouseSliding){var c={handle:this.handles[b],value:this.value()};if(this.options.values&&this.options.values.length){c.value=this.values(b);c.values=this.values()}this._trigger("change",a,c)}},value:function(a){if(arguments.length){this.options.value=
+this._trimAlignValue(a);this._refreshValue();this._change(null,0)}else return this._value()},values:function(a,b){var c,f,e;if(arguments.length>1){this.options.values[a]=this._trimAlignValue(b);this._refreshValue();this._change(null,a)}else if(arguments.length)if(d.isArray(arguments[0])){c=this.options.values;f=arguments[0];for(e=0;e<c.length;e+=1){c[e]=this._trimAlignValue(f[e]);this._change(null,e)}this._refreshValue()}else return this.options.values&&this.options.values.length?this._values(a):
+this.value();else return this._values()},_setOption:function(a,b){var c,f=0;if(d.isArray(this.options.values))f=this.options.values.length;d.Widget.prototype._setOption.apply(this,arguments);switch(a){case "disabled":if(b){this.handles.filter(".ui-state-focus").blur();this.handles.removeClass("ui-state-hover");this.handles.propAttr("disabled",true);this.element.addClass("ui-disabled")}else{this.handles.propAttr("disabled",false);this.element.removeClass("ui-disabled")}break;case "orientation":this._detectOrientation();
+this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation);this._refreshValue();break;case "value":this._animateOff=true;this._refreshValue();this._change(null,0);this._animateOff=false;break;case "values":this._animateOff=true;this._refreshValue();for(c=0;c<f;c+=1)this._change(null,c);this._animateOff=false;break}},_value:function(){var a=this.options.value;return a=this._trimAlignValue(a)},_values:function(a){var b,c;if(arguments.length){b=this.options.values[a];
+return b=this._trimAlignValue(b)}else{b=this.options.values.slice();for(c=0;c<b.length;c+=1)b[c]=this._trimAlignValue(b[c]);return b}},_trimAlignValue:function(a){if(a<=this._valueMin())return this._valueMin();if(a>=this._valueMax())return this._valueMax();var b=this.options.step>0?this.options.step:1,c=(a-this._valueMin())%b;a=a-c;if(Math.abs(c)*2>=b)a+=c>0?b:-b;return parseFloat(a.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var a=
+this.options.range,b=this.options,c=this,f=!this._animateOff?b.animate:false,e,j={},g,k,l,i;if(this.options.values&&this.options.values.length)this.handles.each(function(h){e=(c.values(h)-c._valueMin())/(c._valueMax()-c._valueMin())*100;j[c.orientation==="horizontal"?"left":"bottom"]=e+"%";d(this).stop(1,1)[f?"animate":"css"](j,b.animate);if(c.options.range===true)if(c.orientation==="horizontal"){if(h===0)c.range.stop(1,1)[f?"animate":"css"]({left:e+"%"},b.animate);if(h===1)c.range[f?"animate":"css"]({width:e-
+g+"%"},{queue:false,duration:b.animate})}else{if(h===0)c.range.stop(1,1)[f?"animate":"css"]({bottom:e+"%"},b.animate);if(h===1)c.range[f?"animate":"css"]({height:e-g+"%"},{queue:false,duration:b.animate})}g=e});else{k=this.value();l=this._valueMin();i=this._valueMax();e=i!==l?(k-l)/(i-l)*100:0;j[c.orientation==="horizontal"?"left":"bottom"]=e+"%";this.handle.stop(1,1)[f?"animate":"css"](j,b.animate);if(a==="min"&&this.orientation==="horizontal")this.range.stop(1,1)[f?"animate":"css"]({width:e+"%"},
+b.animate);if(a==="max"&&this.orientation==="horizontal")this.range[f?"animate":"css"]({width:100-e+"%"},{queue:false,duration:b.animate});if(a==="min"&&this.orientation==="vertical")this.range.stop(1,1)[f?"animate":"css"]({height:e+"%"},b.animate);if(a==="max"&&this.orientation==="vertical")this.range[f?"animate":"css"]({height:100-e+"%"},{queue:false,duration:b.animate})}}});d.extend(d.ui.slider,{version:"1.8.16"})})(jQuery);
+;/*
+ * jQuery UI Tabs 1.8.16
+ *
+ * Copyright 2011, 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/Tabs
+ *
+ * Depends:
+ *	jquery.ui.core.js
+ *	jquery.ui.widget.js
+ */
+(function(d,p){function u(){return++v}function w(){return++x}var v=0,x=0;d.widget("ui.tabs",{options:{add:null,ajaxOptions:null,cache:false,cookie:null,collapsible:false,disable:null,disabled:[],enable:null,event:"click",fx:null,idPrefix:"ui-tabs-",load:null,panelTemplate:"<div></div>",remove:null,select:null,show:null,spinner:"<em>Loading&#8230;</em>",tabTemplate:"<li><a href='#{href}'><span>#{label}</span></a></li>"},_create:function(){this._tabify(true)},_setOption:function(b,e){if(b=="selected")this.options.collapsible&&
+e==this.options.selected||this.select(e);else{this.options[b]=e;this._tabify()}},_tabId:function(b){return b.title&&b.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF-]/g,"")||this.options.idPrefix+u()},_sanitizeSelector:function(b){return b.replace(/:/g,"\\:")},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+w());return d.cookie.apply(null,[b].concat(d.makeArray(arguments)))},_ui:function(b,e){return{tab:b,panel:e,index:this.anchors.index(b)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b=
+d(this);b.html(b.data("label.tabs")).removeData("label.tabs")})},_tabify:function(b){function e(g,f){g.css("display","");!d.support.opacity&&f.opacity&&g[0].style.removeAttribute("filter")}var a=this,c=this.options,h=/^#.+/;this.list=this.element.find("ol,ul").eq(0);this.lis=d(" > li:has(a[href])",this.list);this.anchors=this.lis.map(function(){return d("a",this)[0]});this.panels=d([]);this.anchors.each(function(g,f){var i=d(f).attr("href"),l=i.split("#")[0],q;if(l&&(l===location.toString().split("#")[0]||
+(q=d("base")[0])&&l===q.href)){i=f.hash;f.href=i}if(h.test(i))a.panels=a.panels.add(a.element.find(a._sanitizeSelector(i)));else if(i&&i!=="#"){d.data(f,"href.tabs",i);d.data(f,"load.tabs",i.replace(/#.*$/,""));i=a._tabId(f);f.href="#"+i;f=a.element.find("#"+i);if(!f.length){f=d(c.panelTemplate).attr("id",i).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(a.panels[g-1]||a.list);f.data("destroy.tabs",true)}a.panels=a.panels.add(f)}else c.disabled.push(g)});if(b){this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all");
+this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.lis.addClass("ui-state-default ui-corner-top");this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom");if(c.selected===p){location.hash&&this.anchors.each(function(g,f){if(f.hash==location.hash){c.selected=g;return false}});if(typeof c.selected!=="number"&&c.cookie)c.selected=parseInt(a._cookie(),10);if(typeof c.selected!=="number"&&this.lis.filter(".ui-tabs-selected").length)c.selected=
+this.lis.index(this.lis.filter(".ui-tabs-selected"));c.selected=c.selected||(this.lis.length?0:-1)}else if(c.selected===null)c.selected=-1;c.selected=c.selected>=0&&this.anchors[c.selected]||c.selected<0?c.selected:0;c.disabled=d.unique(c.disabled.concat(d.map(this.lis.filter(".ui-state-disabled"),function(g){return a.lis.index(g)}))).sort();d.inArray(c.selected,c.disabled)!=-1&&c.disabled.splice(d.inArray(c.selected,c.disabled),1);this.panels.addClass("ui-tabs-hide");this.lis.removeClass("ui-tabs-selected ui-state-active");
+if(c.selected>=0&&this.anchors.length){a.element.find(a._sanitizeSelector(a.anchors[c.selected].hash)).removeClass("ui-tabs-hide");this.lis.eq(c.selected).addClass("ui-tabs-selected ui-state-active");a.element.queue("tabs",function(){a._trigger("show",null,a._ui(a.anchors[c.selected],a.element.find(a._sanitizeSelector(a.anchors[c.selected].hash))[0]))});this.load(c.selected)}d(window).bind("unload",function(){a.lis.add(a.anchors).unbind(".tabs");a.lis=a.anchors=a.panels=null})}else c.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"));
+this.element[c.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible");c.cookie&&this._cookie(c.selected,c.cookie);b=0;for(var j;j=this.lis[b];b++)d(j)[d.inArray(b,c.disabled)!=-1&&!d(j).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled");c.cache===false&&this.anchors.removeData("cache.tabs");this.lis.add(this.anchors).unbind(".tabs");if(c.event!=="mouseover"){var k=function(g,f){f.is(":not(.ui-state-disabled)")&&f.addClass("ui-state-"+g)},n=function(g,f){f.removeClass("ui-state-"+
+g)};this.lis.bind("mouseover.tabs",function(){k("hover",d(this))});this.lis.bind("mouseout.tabs",function(){n("hover",d(this))});this.anchors.bind("focus.tabs",function(){k("focus",d(this).closest("li"))});this.anchors.bind("blur.tabs",function(){n("focus",d(this).closest("li"))})}var m,o;if(c.fx)if(d.isArray(c.fx)){m=c.fx[0];o=c.fx[1]}else m=o=c.fx;var r=o?function(g,f){d(g).closest("li").addClass("ui-tabs-selected ui-state-active");f.hide().removeClass("ui-tabs-hide").animate(o,o.duration||"normal",
+function(){e(f,o);a._trigger("show",null,a._ui(g,f[0]))})}:function(g,f){d(g).closest("li").addClass("ui-tabs-selected ui-state-active");f.removeClass("ui-tabs-hide");a._trigger("show",null,a._ui(g,f[0]))},s=m?function(g,f){f.animate(m,m.duration||"normal",function(){a.lis.removeClass("ui-tabs-selected ui-state-active");f.addClass("ui-tabs-hide");e(f,m);a.element.dequeue("tabs")})}:function(g,f){a.lis.removeClass("ui-tabs-selected ui-state-active");f.addClass("ui-tabs-hide");a.element.dequeue("tabs")};
+this.anchors.bind(c.event+".tabs",function(){var g=this,f=d(g).closest("li"),i=a.panels.filter(":not(.ui-tabs-hide)"),l=a.element.find(a._sanitizeSelector(g.hash));if(f.hasClass("ui-tabs-selected")&&!c.collapsible||f.hasClass("ui-state-disabled")||f.hasClass("ui-state-processing")||a.panels.filter(":animated").length||a._trigger("select",null,a._ui(this,l[0]))===false){this.blur();return false}c.selected=a.anchors.index(this);a.abort();if(c.collapsible)if(f.hasClass("ui-tabs-selected")){c.selected=
+-1;c.cookie&&a._cookie(c.selected,c.cookie);a.element.queue("tabs",function(){s(g,i)}).dequeue("tabs");this.blur();return false}else if(!i.length){c.cookie&&a._cookie(c.selected,c.cookie);a.element.queue("tabs",function(){r(g,l)});a.load(a.anchors.index(this));this.blur();return false}c.cookie&&a._cookie(c.selected,c.cookie);if(l.length){i.length&&a.element.queue("tabs",function(){s(g,i)});a.element.queue("tabs",function(){r(g,l)});a.load(a.anchors.index(this))}else throw"jQuery UI Tabs: Mismatching fragment identifier.";
+d.browser.msie&&this.blur()});this.anchors.bind("click.tabs",function(){return false})},_getIndex:function(b){if(typeof b=="string")b=this.anchors.index(this.anchors.filter("[href$="+b+"]"));return b},destroy:function(){var b=this.options;this.abort();this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs");this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.anchors.each(function(){var e=
+d.data(this,"href.tabs");if(e)this.href=e;var a=d(this).unbind(".tabs");d.each(["href","load","cache"],function(c,h){a.removeData(h+".tabs")})});this.lis.unbind(".tabs").add(this.panels).each(function(){d.data(this,"destroy.tabs")?d(this).remove():d(this).removeClass("ui-state-default ui-corner-top ui-tabs-selected ui-state-active ui-state-hover ui-state-focus ui-state-disabled ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide")});b.cookie&&this._cookie(null,b.cookie);return this},add:function(b,
+e,a){if(a===p)a=this.anchors.length;var c=this,h=this.options;e=d(h.tabTemplate.replace(/#\{href\}/g,b).replace(/#\{label\}/g,e));b=!b.indexOf("#")?b.replace("#",""):this._tabId(d("a",e)[0]);e.addClass("ui-state-default ui-corner-top").data("destroy.tabs",true);var j=c.element.find("#"+b);j.length||(j=d(h.panelTemplate).attr("id",b).data("destroy.tabs",true));j.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");if(a>=this.lis.length){e.appendTo(this.list);j.appendTo(this.list[0].parentNode)}else{e.insertBefore(this.lis[a]);
+j.insertBefore(this.panels[a])}h.disabled=d.map(h.disabled,function(k){return k>=a?++k:k});this._tabify();if(this.anchors.length==1){h.selected=0;e.addClass("ui-tabs-selected ui-state-active");j.removeClass("ui-tabs-hide");this.element.queue("tabs",function(){c._trigger("show",null,c._ui(c.anchors[0],c.panels[0]))});this.load(0)}this._trigger("add",null,this._ui(this.anchors[a],this.panels[a]));return this},remove:function(b){b=this._getIndex(b);var e=this.options,a=this.lis.eq(b).remove(),c=this.panels.eq(b).remove();
+if(a.hasClass("ui-tabs-selected")&&this.anchors.length>1)this.select(b+(b+1<this.anchors.length?1:-1));e.disabled=d.map(d.grep(e.disabled,function(h){return h!=b}),function(h){return h>=b?--h:h});this._tabify();this._trigger("remove",null,this._ui(a.find("a")[0],c[0]));return this},enable:function(b){b=this._getIndex(b);var e=this.options;if(d.inArray(b,e.disabled)!=-1){this.lis.eq(b).removeClass("ui-state-disabled");e.disabled=d.grep(e.disabled,function(a){return a!=b});this._trigger("enable",null,
+this._ui(this.anchors[b],this.panels[b]));return this}},disable:function(b){b=this._getIndex(b);var e=this.options;if(b!=e.selected){this.lis.eq(b).addClass("ui-state-disabled");e.disabled.push(b);e.disabled.sort();this._trigger("disable",null,this._ui(this.anchors[b],this.panels[b]))}return this},select:function(b){b=this._getIndex(b);if(b==-1)if(this.options.collapsible&&this.options.selected!=-1)b=this.options.selected;else return this;this.anchors.eq(b).trigger(this.options.event+".tabs");return this},
+load:function(b){b=this._getIndex(b);var e=this,a=this.options,c=this.anchors.eq(b)[0],h=d.data(c,"load.tabs");this.abort();if(!h||this.element.queue("tabs").length!==0&&d.data(c,"cache.tabs"))this.element.dequeue("tabs");else{this.lis.eq(b).addClass("ui-state-processing");if(a.spinner){var j=d("span",c);j.data("label.tabs",j.html()).html(a.spinner)}this.xhr=d.ajax(d.extend({},a.ajaxOptions,{url:h,success:function(k,n){e.element.find(e._sanitizeSelector(c.hash)).html(k);e._cleanup();a.cache&&d.data(c,
+"cache.tabs",true);e._trigger("load",null,e._ui(e.anchors[b],e.panels[b]));try{a.ajaxOptions.success(k,n)}catch(m){}},error:function(k,n){e._cleanup();e._trigger("load",null,e._ui(e.anchors[b],e.panels[b]));try{a.ajaxOptions.error(k,n,b,c)}catch(m){}}}));e.element.dequeue("tabs");return this}},abort:function(){this.element.queue([]);this.panels.stop(false,true);this.element.queue("tabs",this.element.queue("tabs").splice(-2,2));if(this.xhr){this.xhr.abort();delete this.xhr}this._cleanup();return this},
+url:function(b,e){this.anchors.eq(b).removeData("cache.tabs").data("load.tabs",e);return this},length:function(){return this.anchors.length}});d.extend(d.ui.tabs,{version:"1.8.16"});d.extend(d.ui.tabs.prototype,{rotation:null,rotate:function(b,e){var a=this,c=this.options,h=a._rotate||(a._rotate=function(j){clearTimeout(a.rotation);a.rotation=setTimeout(function(){var k=c.selected;a.select(++k<a.anchors.length?k:0)},b);j&&j.stopPropagation()});e=a._unrotate||(a._unrotate=!e?function(j){j.clientX&&
+a.rotate(null)}:function(){t=c.selected;h()});if(b){this.element.bind("tabsshow",h);this.anchors.bind(c.event+".tabs",e);h()}else{clearTimeout(a.rotation);this.element.unbind("tabsshow",h);this.anchors.unbind(c.event+".tabs",e);delete this._rotate;delete this._unrotate}return this}})})(jQuery);
+;/*
+ * jQuery UI Datepicker 1.8.16
+ *
+ * Copyright 2011, 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/Datepicker
+ *
+ * Depends:
+ *	jquery.ui.core.js
+ */
+(function(d,C){function M(){this.debug=false;this._curInst=null;this._keyEvent=false;this._disabledInputs=[];this._inDialog=this._datepickerShowing=false;this._mainDivId="ui-datepicker-div";this._inlineClass="ui-datepicker-inline";this._appendClass="ui-datepicker-append";this._triggerClass="ui-datepicker-trigger";this._dialogClass="ui-datepicker-dialog";this._disableClass="ui-datepicker-disabled";this._unselectableClass="ui-datepicker-unselectable";this._currentClass="ui-datepicker-current-day";this._dayOverClass=
+"ui-datepicker-days-cell-over";this.regional=[];this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su",
+"Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:false,showMonthAfterYear:false,yearSuffix:""};this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:false,hideIfNoPrevNext:false,navigationAsDateFormat:false,gotoCurrent:false,changeMonth:false,changeYear:false,yearRange:"c-10:c+10",showOtherMonths:false,selectOtherMonths:false,showWeek:false,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",
+minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:true,showButtonPanel:false,autoSize:false,disabled:false};d.extend(this._defaults,this.regional[""]);this.dpDiv=N(d('<div id="'+this._mainDivId+'" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))}function N(a){return a.bind("mouseout",
+function(b){b=d(b.target).closest("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a");b.length&&b.removeClass("ui-state-hover ui-datepicker-prev-hover ui-datepicker-next-hover")}).bind("mouseover",function(b){b=d(b.target).closest("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a");if(!(d.datepicker._isDisabledDatepicker(J.inline?a.parent()[0]:J.input[0])||!b.length)){b.parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");
+b.addClass("ui-state-hover");b.hasClass("ui-datepicker-prev")&&b.addClass("ui-datepicker-prev-hover");b.hasClass("ui-datepicker-next")&&b.addClass("ui-datepicker-next-hover")}})}function H(a,b){d.extend(a,b);for(var c in b)if(b[c]==null||b[c]==C)a[c]=b[c];return a}d.extend(d.ui,{datepicker:{version:"1.8.16"}});var B=(new Date).getTime(),J;d.extend(M.prototype,{markerClassName:"hasDatepicker",maxRows:4,log:function(){this.debug&&console.log.apply("",arguments)},_widgetDatepicker:function(){return this.dpDiv},
+setDefaults:function(a){H(this._defaults,a||{});return this},_attachDatepicker:function(a,b){var c=null;for(var e in this._defaults){var f=a.getAttribute("date:"+e);if(f){c=c||{};try{c[e]=eval(f)}catch(h){c[e]=f}}}e=a.nodeName.toLowerCase();f=e=="div"||e=="span";if(!a.id){this.uuid+=1;a.id="dp"+this.uuid}var i=this._newInst(d(a),f);i.settings=d.extend({},b||{},c||{});if(e=="input")this._connectDatepicker(a,i);else f&&this._inlineDatepicker(a,i)},_newInst:function(a,b){return{id:a[0].id.replace(/([^A-Za-z0-9_-])/g,
+"\\\\$1"),input:a,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:b,dpDiv:!b?this.dpDiv:N(d('<div class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))}},_connectDatepicker:function(a,b){var c=d(a);b.append=d([]);b.trigger=d([]);if(!c.hasClass(this.markerClassName)){this._attachments(c,b);c.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",
+function(e,f,h){b.settings[f]=h}).bind("getData.datepicker",function(e,f){return this._get(b,f)});this._autoSize(b);d.data(a,"datepicker",b);b.settings.disabled&&this._disableDatepicker(a)}},_attachments:function(a,b){var c=this._get(b,"appendText"),e=this._get(b,"isRTL");b.append&&b.append.remove();if(c){b.append=d('<span class="'+this._appendClass+'">'+c+"</span>");a[e?"before":"after"](b.append)}a.unbind("focus",this._showDatepicker);b.trigger&&b.trigger.remove();c=this._get(b,"showOn");if(c==
+"focus"||c=="both")a.focus(this._showDatepicker);if(c=="button"||c=="both"){c=this._get(b,"buttonText");var f=this._get(b,"buttonImage");b.trigger=d(this._get(b,"buttonImageOnly")?d("<img/>").addClass(this._triggerClass).attr({src:f,alt:c,title:c}):d('<button type="button"></button>').addClass(this._triggerClass).html(f==""?c:d("<img/>").attr({src:f,alt:c,title:c})));a[e?"before":"after"](b.trigger);b.trigger.click(function(){d.datepicker._datepickerShowing&&d.datepicker._lastInput==a[0]?d.datepicker._hideDatepicker():
+d.datepicker._showDatepicker(a[0]);return false})}},_autoSize:function(a){if(this._get(a,"autoSize")&&!a.inline){var b=new Date(2009,11,20),c=this._get(a,"dateFormat");if(c.match(/[DM]/)){var e=function(f){for(var h=0,i=0,g=0;g<f.length;g++)if(f[g].length>h){h=f[g].length;i=g}return i};b.setMonth(e(this._get(a,c.match(/MM/)?"monthNames":"monthNamesShort")));b.setDate(e(this._get(a,c.match(/DD/)?"dayNames":"dayNamesShort"))+20-b.getDay())}a.input.attr("size",this._formatDate(a,b).length)}},_inlineDatepicker:function(a,
+b){var c=d(a);if(!c.hasClass(this.markerClassName)){c.addClass(this.markerClassName).append(b.dpDiv).bind("setData.datepicker",function(e,f,h){b.settings[f]=h}).bind("getData.datepicker",function(e,f){return this._get(b,f)});d.data(a,"datepicker",b);this._setDate(b,this._getDefaultDate(b),true);this._updateDatepicker(b);this._updateAlternate(b);b.settings.disabled&&this._disableDatepicker(a);b.dpDiv.css("display","block")}},_dialogDatepicker:function(a,b,c,e,f){a=this._dialogInst;if(!a){this.uuid+=
+1;this._dialogInput=d('<input type="text" id="'+("dp"+this.uuid)+'" style="position: absolute; top: -100px; width: 0px; z-index: -10;"/>');this._dialogInput.keydown(this._doKeyDown);d("body").append(this._dialogInput);a=this._dialogInst=this._newInst(this._dialogInput,false);a.settings={};d.data(this._dialogInput[0],"datepicker",a)}H(a.settings,e||{});b=b&&b.constructor==Date?this._formatDate(a,b):b;this._dialogInput.val(b);this._pos=f?f.length?f:[f.pageX,f.pageY]:null;if(!this._pos)this._pos=[document.documentElement.clientWidth/
+2-100+(document.documentElement.scrollLeft||document.body.scrollLeft),document.documentElement.clientHeight/2-150+(document.documentElement.scrollTop||document.body.scrollTop)];this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px");a.settings.onSelect=c;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);d.blockUI&&d.blockUI(this.dpDiv);d.data(this._dialogInput[0],"datepicker",a);return this},_destroyDatepicker:function(a){var b=
+d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();d.removeData(a,"datepicker");if(e=="input"){c.append.remove();c.trigger.remove();b.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)}else if(e=="div"||e=="span")b.removeClass(this.markerClassName).empty()}},_enableDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=
+a.nodeName.toLowerCase();if(e=="input"){a.disabled=false;c.trigger.filter("button").each(function(){this.disabled=false}).end().filter("img").css({opacity:"1.0",cursor:""})}else if(e=="div"||e=="span"){b=b.children("."+this._inlineClass);b.children().removeClass("ui-state-disabled");b.find("select.ui-datepicker-month, select.ui-datepicker-year").removeAttr("disabled")}this._disabledInputs=d.map(this._disabledInputs,function(f){return f==a?null:f})}},_disableDatepicker:function(a){var b=d(a),c=d.data(a,
+"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();if(e=="input"){a.disabled=true;c.trigger.filter("button").each(function(){this.disabled=true}).end().filter("img").css({opacity:"0.5",cursor:"default"})}else if(e=="div"||e=="span"){b=b.children("."+this._inlineClass);b.children().addClass("ui-state-disabled");b.find("select.ui-datepicker-month, select.ui-datepicker-year").attr("disabled","disabled")}this._disabledInputs=d.map(this._disabledInputs,function(f){return f==
+a?null:f});this._disabledInputs[this._disabledInputs.length]=a}},_isDisabledDatepicker:function(a){if(!a)return false;for(var b=0;b<this._disabledInputs.length;b++)if(this._disabledInputs[b]==a)return true;return false},_getInst:function(a){try{return d.data(a,"datepicker")}catch(b){throw"Missing instance data for this datepicker";}},_optionDatepicker:function(a,b,c){var e=this._getInst(a);if(arguments.length==2&&typeof b=="string")return b=="defaults"?d.extend({},d.datepicker._defaults):e?b=="all"?
+d.extend({},e.settings):this._get(e,b):null;var f=b||{};if(typeof b=="string"){f={};f[b]=c}if(e){this._curInst==e&&this._hideDatepicker();var h=this._getDateDatepicker(a,true),i=this._getMinMaxDate(e,"min"),g=this._getMinMaxDate(e,"max");H(e.settings,f);if(i!==null&&f.dateFormat!==C&&f.minDate===C)e.settings.minDate=this._formatDate(e,i);if(g!==null&&f.dateFormat!==C&&f.maxDate===C)e.settings.maxDate=this._formatDate(e,g);this._attachments(d(a),e);this._autoSize(e);this._setDate(e,h);this._updateAlternate(e);
+this._updateDatepicker(e)}},_changeDatepicker:function(a,b,c){this._optionDatepicker(a,b,c)},_refreshDatepicker:function(a){(a=this._getInst(a))&&this._updateDatepicker(a)},_setDateDatepicker:function(a,b){if(a=this._getInst(a)){this._setDate(a,b);this._updateDatepicker(a);this._updateAlternate(a)}},_getDateDatepicker:function(a,b){(a=this._getInst(a))&&!a.inline&&this._setDateFromField(a,b);return a?this._getDate(a):null},_doKeyDown:function(a){var b=d.datepicker._getInst(a.target),c=true,e=b.dpDiv.is(".ui-datepicker-rtl");
+b._keyEvent=true;if(d.datepicker._datepickerShowing)switch(a.keyCode){case 9:d.datepicker._hideDatepicker();c=false;break;case 13:c=d("td."+d.datepicker._dayOverClass+":not(."+d.datepicker._currentClass+")",b.dpDiv);c[0]&&d.datepicker._selectDay(a.target,b.selectedMonth,b.selectedYear,c[0]);if(a=d.datepicker._get(b,"onSelect")){c=d.datepicker._formatDate(b);a.apply(b.input?b.input[0]:null,[c,b])}else d.datepicker._hideDatepicker();return false;case 27:d.datepicker._hideDatepicker();break;case 33:d.datepicker._adjustDate(a.target,
+a.ctrlKey?-d.datepicker._get(b,"stepBigMonths"):-d.datepicker._get(b,"stepMonths"),"M");break;case 34:d.datepicker._adjustDate(a.target,a.ctrlKey?+d.datepicker._get(b,"stepBigMonths"):+d.datepicker._get(b,"stepMonths"),"M");break;case 35:if(a.ctrlKey||a.metaKey)d.datepicker._clearDate(a.target);c=a.ctrlKey||a.metaKey;break;case 36:if(a.ctrlKey||a.metaKey)d.datepicker._gotoToday(a.target);c=a.ctrlKey||a.metaKey;break;case 37:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,e?+1:-1,"D");c=
+a.ctrlKey||a.metaKey;if(a.originalEvent.altKey)d.datepicker._adjustDate(a.target,a.ctrlKey?-d.datepicker._get(b,"stepBigMonths"):-d.datepicker._get(b,"stepMonths"),"M");break;case 38:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,-7,"D");c=a.ctrlKey||a.metaKey;break;case 39:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,e?-1:+1,"D");c=a.ctrlKey||a.metaKey;if(a.originalEvent.altKey)d.datepicker._adjustDate(a.target,a.ctrlKey?+d.datepicker._get(b,"stepBigMonths"):+d.datepicker._get(b,
+"stepMonths"),"M");break;case 40:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,+7,"D");c=a.ctrlKey||a.metaKey;break;default:c=false}else if(a.keyCode==36&&a.ctrlKey)d.datepicker._showDatepicker(this);else c=false;if(c){a.preventDefault();a.stopPropagation()}},_doKeyPress:function(a){var b=d.datepicker._getInst(a.target);if(d.datepicker._get(b,"constrainInput")){b=d.datepicker._possibleChars(d.datepicker._get(b,"dateFormat"));var c=String.fromCharCode(a.charCode==C?a.keyCode:a.charCode);
+return a.ctrlKey||a.metaKey||c<" "||!b||b.indexOf(c)>-1}},_doKeyUp:function(a){a=d.datepicker._getInst(a.target);if(a.input.val()!=a.lastVal)try{if(d.datepicker.parseDate(d.datepicker._get(a,"dateFormat"),a.input?a.input.val():null,d.datepicker._getFormatConfig(a))){d.datepicker._setDateFromField(a);d.datepicker._updateAlternate(a);d.datepicker._updateDatepicker(a)}}catch(b){d.datepicker.log(b)}return true},_showDatepicker:function(a){a=a.target||a;if(a.nodeName.toLowerCase()!="input")a=d("input",
+a.parentNode)[0];if(!(d.datepicker._isDisabledDatepicker(a)||d.datepicker._lastInput==a)){var b=d.datepicker._getInst(a);if(d.datepicker._curInst&&d.datepicker._curInst!=b){d.datepicker._datepickerShowing&&d.datepicker._triggerOnClose(d.datepicker._curInst);d.datepicker._curInst.dpDiv.stop(true,true)}var c=d.datepicker._get(b,"beforeShow");c=c?c.apply(a,[a,b]):{};if(c!==false){H(b.settings,c);b.lastVal=null;d.datepicker._lastInput=a;d.datepicker._setDateFromField(b);if(d.datepicker._inDialog)a.value=
+"";if(!d.datepicker._pos){d.datepicker._pos=d.datepicker._findPos(a);d.datepicker._pos[1]+=a.offsetHeight}var e=false;d(a).parents().each(function(){e|=d(this).css("position")=="fixed";return!e});if(e&&d.browser.opera){d.datepicker._pos[0]-=document.documentElement.scrollLeft;d.datepicker._pos[1]-=document.documentElement.scrollTop}c={left:d.datepicker._pos[0],top:d.datepicker._pos[1]};d.datepicker._pos=null;b.dpDiv.empty();b.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});d.datepicker._updateDatepicker(b);
+c=d.datepicker._checkOffset(b,c,e);b.dpDiv.css({position:d.datepicker._inDialog&&d.blockUI?"static":e?"fixed":"absolute",display:"none",left:c.left+"px",top:c.top+"px"});if(!b.inline){c=d.datepicker._get(b,"showAnim");var f=d.datepicker._get(b,"duration"),h=function(){var i=b.dpDiv.find("iframe.ui-datepicker-cover");if(i.length){var g=d.datepicker._getBorders(b.dpDiv);i.css({left:-g[0],top:-g[1],width:b.dpDiv.outerWidth(),height:b.dpDiv.outerHeight()})}};b.dpDiv.zIndex(d(a).zIndex()+1);d.datepicker._datepickerShowing=
+true;d.effects&&d.effects[c]?b.dpDiv.show(c,d.datepicker._get(b,"showOptions"),f,h):b.dpDiv[c||"show"](c?f:null,h);if(!c||!f)h();b.input.is(":visible")&&!b.input.is(":disabled")&&b.input.focus();d.datepicker._curInst=b}}}},_updateDatepicker:function(a){this.maxRows=4;var b=d.datepicker._getBorders(a.dpDiv);J=a;a.dpDiv.empty().append(this._generateHTML(a));var c=a.dpDiv.find("iframe.ui-datepicker-cover");c.length&&c.css({left:-b[0],top:-b[1],width:a.dpDiv.outerWidth(),height:a.dpDiv.outerHeight()});
+a.dpDiv.find("."+this._dayOverClass+" a").mouseover();b=this._getNumberOfMonths(a);c=b[1];a.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");c>1&&a.dpDiv.addClass("ui-datepicker-multi-"+c).css("width",17*c+"em");a.dpDiv[(b[0]!=1||b[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi");a.dpDiv[(this._get(a,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");a==d.datepicker._curInst&&d.datepicker._datepickerShowing&&a.input&&a.input.is(":visible")&&
+!a.input.is(":disabled")&&a.input[0]!=document.activeElement&&a.input.focus();if(a.yearshtml){var e=a.yearshtml;setTimeout(function(){e===a.yearshtml&&a.yearshtml&&a.dpDiv.find("select.ui-datepicker-year:first").replaceWith(a.yearshtml);e=a.yearshtml=null},0)}},_getBorders:function(a){var b=function(c){return{thin:1,medium:2,thick:3}[c]||c};return[parseFloat(b(a.css("border-left-width"))),parseFloat(b(a.css("border-top-width")))]},_checkOffset:function(a,b,c){var e=a.dpDiv.outerWidth(),f=a.dpDiv.outerHeight(),
+h=a.input?a.input.outerWidth():0,i=a.input?a.input.outerHeight():0,g=document.documentElement.clientWidth+d(document).scrollLeft(),j=document.documentElement.clientHeight+d(document).scrollTop();b.left-=this._get(a,"isRTL")?e-h:0;b.left-=c&&b.left==a.input.offset().left?d(document).scrollLeft():0;b.top-=c&&b.top==a.input.offset().top+i?d(document).scrollTop():0;b.left-=Math.min(b.left,b.left+e>g&&g>e?Math.abs(b.left+e-g):0);b.top-=Math.min(b.top,b.top+f>j&&j>f?Math.abs(f+i):0);return b},_findPos:function(a){for(var b=
+this._get(this._getInst(a),"isRTL");a&&(a.type=="hidden"||a.nodeType!=1||d.expr.filters.hidden(a));)a=a[b?"previousSibling":"nextSibling"];a=d(a).offset();return[a.left,a.top]},_triggerOnClose:function(a){var b=this._get(a,"onClose");if(b)b.apply(a.input?a.input[0]:null,[a.input?a.input.val():"",a])},_hideDatepicker:function(a){var b=this._curInst;if(!(!b||a&&b!=d.data(a,"datepicker")))if(this._datepickerShowing){a=this._get(b,"showAnim");var c=this._get(b,"duration"),e=function(){d.datepicker._tidyDialog(b);
+this._curInst=null};d.effects&&d.effects[a]?b.dpDiv.hide(a,d.datepicker._get(b,"showOptions"),c,e):b.dpDiv[a=="slideDown"?"slideUp":a=="fadeIn"?"fadeOut":"hide"](a?c:null,e);a||e();d.datepicker._triggerOnClose(b);this._datepickerShowing=false;this._lastInput=null;if(this._inDialog){this._dialogInput.css({position:"absolute",left:"0",top:"-100px"});if(d.blockUI){d.unblockUI();d("body").append(this.dpDiv)}}this._inDialog=false}},_tidyDialog:function(a){a.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},
+_checkExternalClick:function(a){if(d.datepicker._curInst){a=d(a.target);a[0].id!=d.datepicker._mainDivId&&a.parents("#"+d.datepicker._mainDivId).length==0&&!a.hasClass(d.datepicker.markerClassName)&&!a.hasClass(d.datepicker._triggerClass)&&d.datepicker._datepickerShowing&&!(d.datepicker._inDialog&&d.blockUI)&&d.datepicker._hideDatepicker()}},_adjustDate:function(a,b,c){a=d(a);var e=this._getInst(a[0]);if(!this._isDisabledDatepicker(a[0])){this._adjustInstDate(e,b+(c=="M"?this._get(e,"showCurrentAtPos"):
+0),c);this._updateDatepicker(e)}},_gotoToday:function(a){a=d(a);var b=this._getInst(a[0]);if(this._get(b,"gotoCurrent")&&b.currentDay){b.selectedDay=b.currentDay;b.drawMonth=b.selectedMonth=b.currentMonth;b.drawYear=b.selectedYear=b.currentYear}else{var c=new Date;b.selectedDay=c.getDate();b.drawMonth=b.selectedMonth=c.getMonth();b.drawYear=b.selectedYear=c.getFullYear()}this._notifyChange(b);this._adjustDate(a)},_selectMonthYear:function(a,b,c){a=d(a);var e=this._getInst(a[0]);e["selected"+(c=="M"?
+"Month":"Year")]=e["draw"+(c=="M"?"Month":"Year")]=parseInt(b.options[b.selectedIndex].value,10);this._notifyChange(e);this._adjustDate(a)},_selectDay:function(a,b,c,e){var f=d(a);if(!(d(e).hasClass(this._unselectableClass)||this._isDisabledDatepicker(f[0]))){f=this._getInst(f[0]);f.selectedDay=f.currentDay=d("a",e).html();f.selectedMonth=f.currentMonth=b;f.selectedYear=f.currentYear=c;this._selectDate(a,this._formatDate(f,f.currentDay,f.currentMonth,f.currentYear))}},_clearDate:function(a){a=d(a);
+this._getInst(a[0]);this._selectDate(a,"")},_selectDate:function(a,b){a=this._getInst(d(a)[0]);b=b!=null?b:this._formatDate(a);a.input&&a.input.val(b);this._updateAlternate(a);var c=this._get(a,"onSelect");if(c)c.apply(a.input?a.input[0]:null,[b,a]);else a.input&&a.input.trigger("change");if(a.inline)this._updateDatepicker(a);else{this._hideDatepicker();this._lastInput=a.input[0];typeof a.input[0]!="object"&&a.input.focus();this._lastInput=null}},_updateAlternate:function(a){var b=this._get(a,"altField");
+if(b){var c=this._get(a,"altFormat")||this._get(a,"dateFormat"),e=this._getDate(a),f=this.formatDate(c,e,this._getFormatConfig(a));d(b).each(function(){d(this).val(f)})}},noWeekends:function(a){a=a.getDay();return[a>0&&a<6,""]},iso8601Week:function(a){a=new Date(a.getTime());a.setDate(a.getDate()+4-(a.getDay()||7));var b=a.getTime();a.setMonth(0);a.setDate(1);return Math.floor(Math.round((b-a)/864E5)/7)+1},parseDate:function(a,b,c){if(a==null||b==null)throw"Invalid arguments";b=typeof b=="object"?
+b.toString():b+"";if(b=="")return null;var e=(c?c.shortYearCutoff:null)||this._defaults.shortYearCutoff;e=typeof e!="string"?e:(new Date).getFullYear()%100+parseInt(e,10);for(var f=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,h=(c?c.dayNames:null)||this._defaults.dayNames,i=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,g=(c?c.monthNames:null)||this._defaults.monthNames,j=c=-1,l=-1,u=-1,k=false,o=function(p){(p=A+1<a.length&&a.charAt(A+1)==p)&&A++;return p},m=function(p){var D=
+o(p);p=new RegExp("^\\d{1,"+(p=="@"?14:p=="!"?20:p=="y"&&D?4:p=="o"?3:2)+"}");p=b.substring(q).match(p);if(!p)throw"Missing number at position "+q;q+=p[0].length;return parseInt(p[0],10)},n=function(p,D,K){p=d.map(o(p)?K:D,function(w,x){return[[x,w]]}).sort(function(w,x){return-(w[1].length-x[1].length)});var E=-1;d.each(p,function(w,x){w=x[1];if(b.substr(q,w.length).toLowerCase()==w.toLowerCase()){E=x[0];q+=w.length;return false}});if(E!=-1)return E+1;else throw"Unknown name at position "+q;},s=
+function(){if(b.charAt(q)!=a.charAt(A))throw"Unexpected literal at position "+q;q++},q=0,A=0;A<a.length;A++)if(k)if(a.charAt(A)=="'"&&!o("'"))k=false;else s();else switch(a.charAt(A)){case "d":l=m("d");break;case "D":n("D",f,h);break;case "o":u=m("o");break;case "m":j=m("m");break;case "M":j=n("M",i,g);break;case "y":c=m("y");break;case "@":var v=new Date(m("@"));c=v.getFullYear();j=v.getMonth()+1;l=v.getDate();break;case "!":v=new Date((m("!")-this._ticksTo1970)/1E4);c=v.getFullYear();j=v.getMonth()+
+1;l=v.getDate();break;case "'":if(o("'"))s();else k=true;break;default:s()}if(q<b.length)throw"Extra/unparsed characters found in date: "+b.substring(q);if(c==-1)c=(new Date).getFullYear();else if(c<100)c+=(new Date).getFullYear()-(new Date).getFullYear()%100+(c<=e?0:-100);if(u>-1){j=1;l=u;do{e=this._getDaysInMonth(c,j-1);if(l<=e)break;j++;l-=e}while(1)}v=this._daylightSavingAdjust(new Date(c,j-1,l));if(v.getFullYear()!=c||v.getMonth()+1!=j||v.getDate()!=l)throw"Invalid date";return v},ATOM:"yy-mm-dd",
+COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*24*60*60*1E7,formatDate:function(a,b,c){if(!b)return"";var e=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,f=(c?c.dayNames:null)||this._defaults.dayNames,h=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort;c=(c?c.monthNames:
+null)||this._defaults.monthNames;var i=function(o){(o=k+1<a.length&&a.charAt(k+1)==o)&&k++;return o},g=function(o,m,n){m=""+m;if(i(o))for(;m.length<n;)m="0"+m;return m},j=function(o,m,n,s){return i(o)?s[m]:n[m]},l="",u=false;if(b)for(var k=0;k<a.length;k++)if(u)if(a.charAt(k)=="'"&&!i("'"))u=false;else l+=a.charAt(k);else switch(a.charAt(k)){case "d":l+=g("d",b.getDate(),2);break;case "D":l+=j("D",b.getDay(),e,f);break;case "o":l+=g("o",Math.round(((new Date(b.getFullYear(),b.getMonth(),b.getDate())).getTime()-
+(new Date(b.getFullYear(),0,0)).getTime())/864E5),3);break;case "m":l+=g("m",b.getMonth()+1,2);break;case "M":l+=j("M",b.getMonth(),h,c);break;case "y":l+=i("y")?b.getFullYear():(b.getYear()%100<10?"0":"")+b.getYear()%100;break;case "@":l+=b.getTime();break;case "!":l+=b.getTime()*1E4+this._ticksTo1970;break;case "'":if(i("'"))l+="'";else u=true;break;default:l+=a.charAt(k)}return l},_possibleChars:function(a){for(var b="",c=false,e=function(h){(h=f+1<a.length&&a.charAt(f+1)==h)&&f++;return h},f=
+0;f<a.length;f++)if(c)if(a.charAt(f)=="'"&&!e("'"))c=false;else b+=a.charAt(f);else switch(a.charAt(f)){case "d":case "m":case "y":case "@":b+="0123456789";break;case "D":case "M":return null;case "'":if(e("'"))b+="'";else c=true;break;default:b+=a.charAt(f)}return b},_get:function(a,b){return a.settings[b]!==C?a.settings[b]:this._defaults[b]},_setDateFromField:function(a,b){if(a.input.val()!=a.lastVal){var c=this._get(a,"dateFormat"),e=a.lastVal=a.input?a.input.val():null,f,h;f=h=this._getDefaultDate(a);
+var i=this._getFormatConfig(a);try{f=this.parseDate(c,e,i)||h}catch(g){this.log(g);e=b?"":e}a.selectedDay=f.getDate();a.drawMonth=a.selectedMonth=f.getMonth();a.drawYear=a.selectedYear=f.getFullYear();a.currentDay=e?f.getDate():0;a.currentMonth=e?f.getMonth():0;a.currentYear=e?f.getFullYear():0;this._adjustInstDate(a)}},_getDefaultDate:function(a){return this._restrictMinMax(a,this._determineDate(a,this._get(a,"defaultDate"),new Date))},_determineDate:function(a,b,c){var e=function(h){var i=new Date;
+i.setDate(i.getDate()+h);return i},f=function(h){try{return d.datepicker.parseDate(d.datepicker._get(a,"dateFormat"),h,d.datepicker._getFormatConfig(a))}catch(i){}var g=(h.toLowerCase().match(/^c/)?d.datepicker._getDate(a):null)||new Date,j=g.getFullYear(),l=g.getMonth();g=g.getDate();for(var u=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,k=u.exec(h);k;){switch(k[2]||"d"){case "d":case "D":g+=parseInt(k[1],10);break;case "w":case "W":g+=parseInt(k[1],10)*7;break;case "m":case "M":l+=parseInt(k[1],10);g=
+Math.min(g,d.datepicker._getDaysInMonth(j,l));break;case "y":case "Y":j+=parseInt(k[1],10);g=Math.min(g,d.datepicker._getDaysInMonth(j,l));break}k=u.exec(h)}return new Date(j,l,g)};if(b=(b=b==null||b===""?c:typeof b=="string"?f(b):typeof b=="number"?isNaN(b)?c:e(b):new Date(b.getTime()))&&b.toString()=="Invalid Date"?c:b){b.setHours(0);b.setMinutes(0);b.setSeconds(0);b.setMilliseconds(0)}return this._daylightSavingAdjust(b)},_daylightSavingAdjust:function(a){if(!a)return null;a.setHours(a.getHours()>
+12?a.getHours()+2:0);return a},_setDate:function(a,b,c){var e=!b,f=a.selectedMonth,h=a.selectedYear;b=this._restrictMinMax(a,this._determineDate(a,b,new Date));a.selectedDay=a.currentDay=b.getDate();a.drawMonth=a.selectedMonth=a.currentMonth=b.getMonth();a.drawYear=a.selectedYear=a.currentYear=b.getFullYear();if((f!=a.selectedMonth||h!=a.selectedYear)&&!c)this._notifyChange(a);this._adjustInstDate(a);if(a.input)a.input.val(e?"":this._formatDate(a))},_getDate:function(a){return!a.currentYear||a.input&&
+a.input.val()==""?null:this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay))},_generateHTML:function(a){var b=new Date;b=this._daylightSavingAdjust(new Date(b.getFullYear(),b.getMonth(),b.getDate()));var c=this._get(a,"isRTL"),e=this._get(a,"showButtonPanel"),f=this._get(a,"hideIfNoPrevNext"),h=this._get(a,"navigationAsDateFormat"),i=this._getNumberOfMonths(a),g=this._get(a,"showCurrentAtPos"),j=this._get(a,"stepMonths"),l=i[0]!=1||i[1]!=1,u=this._daylightSavingAdjust(!a.currentDay?
+new Date(9999,9,9):new Date(a.currentYear,a.currentMonth,a.currentDay)),k=this._getMinMaxDate(a,"min"),o=this._getMinMaxDate(a,"max");g=a.drawMonth-g;var m=a.drawYear;if(g<0){g+=12;m--}if(o){var n=this._daylightSavingAdjust(new Date(o.getFullYear(),o.getMonth()-i[0]*i[1]+1,o.getDate()));for(n=k&&n<k?k:n;this._daylightSavingAdjust(new Date(m,g,1))>n;){g--;if(g<0){g=11;m--}}}a.drawMonth=g;a.drawYear=m;n=this._get(a,"prevText");n=!h?n:this.formatDate(n,this._daylightSavingAdjust(new Date(m,g-j,1)),this._getFormatConfig(a));
+n=this._canAdjustMonth(a,-1,m,g)?'<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery_'+B+".datepicker._adjustDate('#"+a.id+"', -"+j+", 'M');\" title=\""+n+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"e":"w")+'">'+n+"</span></a>":f?"":'<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+n+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"e":"w")+'">'+n+"</span></a>";var s=this._get(a,"nextText");s=!h?s:this.formatDate(s,this._daylightSavingAdjust(new Date(m,
+g+j,1)),this._getFormatConfig(a));f=this._canAdjustMonth(a,+1,m,g)?'<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery_'+B+".datepicker._adjustDate('#"+a.id+"', +"+j+", 'M');\" title=\""+s+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"w":"e")+'">'+s+"</span></a>":f?"":'<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+s+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"w":"e")+'">'+s+"</span></a>";j=this._get(a,"currentText");s=this._get(a,"gotoCurrent")&&
+a.currentDay?u:b;j=!h?j:this.formatDate(j,s,this._getFormatConfig(a));h=!a.inline?'<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery_'+B+'.datepicker._hideDatepicker();">'+this._get(a,"closeText")+"</button>":"";e=e?'<div class="ui-datepicker-buttonpane ui-widget-content">'+(c?h:"")+(this._isInRange(a,s)?'<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery_'+
+B+".datepicker._gotoToday('#"+a.id+"');\">"+j+"</button>":"")+(c?"":h)+"</div>":"";h=parseInt(this._get(a,"firstDay"),10);h=isNaN(h)?0:h;j=this._get(a,"showWeek");s=this._get(a,"dayNames");this._get(a,"dayNamesShort");var q=this._get(a,"dayNamesMin"),A=this._get(a,"monthNames"),v=this._get(a,"monthNamesShort"),p=this._get(a,"beforeShowDay"),D=this._get(a,"showOtherMonths"),K=this._get(a,"selectOtherMonths");this._get(a,"calculateWeek");for(var E=this._getDefaultDate(a),w="",x=0;x<i[0];x++){var O=
+"";this.maxRows=4;for(var G=0;G<i[1];G++){var P=this._daylightSavingAdjust(new Date(m,g,a.selectedDay)),t=" ui-corner-all",y="";if(l){y+='<div class="ui-datepicker-group';if(i[1]>1)switch(G){case 0:y+=" ui-datepicker-group-first";t=" ui-corner-"+(c?"right":"left");break;case i[1]-1:y+=" ui-datepicker-group-last";t=" ui-corner-"+(c?"left":"right");break;default:y+=" ui-datepicker-group-middle";t="";break}y+='">'}y+='<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix'+t+'">'+(/all|left/.test(t)&&
+x==0?c?f:n:"")+(/all|right/.test(t)&&x==0?c?n:f:"")+this._generateMonthYearHeader(a,g,m,k,o,x>0||G>0,A,v)+'</div><table class="ui-datepicker-calendar"><thead><tr>';var z=j?'<th class="ui-datepicker-week-col">'+this._get(a,"weekHeader")+"</th>":"";for(t=0;t<7;t++){var r=(t+h)%7;z+="<th"+((t+h+6)%7>=5?' class="ui-datepicker-week-end"':"")+'><span title="'+s[r]+'">'+q[r]+"</span></th>"}y+=z+"</tr></thead><tbody>";z=this._getDaysInMonth(m,g);if(m==a.selectedYear&&g==a.selectedMonth)a.selectedDay=Math.min(a.selectedDay,
+z);t=(this._getFirstDayOfMonth(m,g)-h+7)%7;z=Math.ceil((t+z)/7);this.maxRows=z=l?this.maxRows>z?this.maxRows:z:z;r=this._daylightSavingAdjust(new Date(m,g,1-t));for(var Q=0;Q<z;Q++){y+="<tr>";var R=!j?"":'<td class="ui-datepicker-week-col">'+this._get(a,"calculateWeek")(r)+"</td>";for(t=0;t<7;t++){var I=p?p.apply(a.input?a.input[0]:null,[r]):[true,""],F=r.getMonth()!=g,L=F&&!K||!I[0]||k&&r<k||o&&r>o;R+='<td class="'+((t+h+6)%7>=5?" ui-datepicker-week-end":"")+(F?" ui-datepicker-other-month":"")+(r.getTime()==
+P.getTime()&&g==a.selectedMonth&&a._keyEvent||E.getTime()==r.getTime()&&E.getTime()==P.getTime()?" "+this._dayOverClass:"")+(L?" "+this._unselectableClass+" ui-state-disabled":"")+(F&&!D?"":" "+I[1]+(r.getTime()==u.getTime()?" "+this._currentClass:"")+(r.getTime()==b.getTime()?" ui-datepicker-today":""))+'"'+((!F||D)&&I[2]?' title="'+I[2]+'"':"")+(L?"":' onclick="DP_jQuery_'+B+".datepicker._selectDay('#"+a.id+"',"+r.getMonth()+","+r.getFullYear()+', this);return false;"')+">"+(F&&!D?"&#xa0;":L?'<span class="ui-state-default">'+
+r.getDate()+"</span>":'<a class="ui-state-default'+(r.getTime()==b.getTime()?" ui-state-highlight":"")+(r.getTime()==u.getTime()?" ui-state-active":"")+(F?" ui-priority-secondary":"")+'" href="#">'+r.getDate()+"</a>")+"</td>";r.setDate(r.getDate()+1);r=this._daylightSavingAdjust(r)}y+=R+"</tr>"}g++;if(g>11){g=0;m++}y+="</tbody></table>"+(l?"</div>"+(i[0]>0&&G==i[1]-1?'<div class="ui-datepicker-row-break"></div>':""):"");O+=y}w+=O}w+=e+(d.browser.msie&&parseInt(d.browser.version,10)<7&&!a.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>':
+"");a._keyEvent=false;return w},_generateMonthYearHeader:function(a,b,c,e,f,h,i,g){var j=this._get(a,"changeMonth"),l=this._get(a,"changeYear"),u=this._get(a,"showMonthAfterYear"),k='<div class="ui-datepicker-title">',o="";if(h||!j)o+='<span class="ui-datepicker-month">'+i[b]+"</span>";else{i=e&&e.getFullYear()==c;var m=f&&f.getFullYear()==c;o+='<select class="ui-datepicker-month" onchange="DP_jQuery_'+B+".datepicker._selectMonthYear('#"+a.id+"', this, 'M');\" >";for(var n=0;n<12;n++)if((!i||n>=e.getMonth())&&
+(!m||n<=f.getMonth()))o+='<option value="'+n+'"'+(n==b?' selected="selected"':"")+">"+g[n]+"</option>";o+="</select>"}u||(k+=o+(h||!(j&&l)?"&#xa0;":""));if(!a.yearshtml){a.yearshtml="";if(h||!l)k+='<span class="ui-datepicker-year">'+c+"</span>";else{g=this._get(a,"yearRange").split(":");var s=(new Date).getFullYear();i=function(q){q=q.match(/c[+-].*/)?c+parseInt(q.substring(1),10):q.match(/[+-].*/)?s+parseInt(q,10):parseInt(q,10);return isNaN(q)?s:q};b=i(g[0]);g=Math.max(b,i(g[1]||""));b=e?Math.max(b,
+e.getFullYear()):b;g=f?Math.min(g,f.getFullYear()):g;for(a.yearshtml+='<select class="ui-datepicker-year" onchange="DP_jQuery_'+B+".datepicker._selectMonthYear('#"+a.id+"', this, 'Y');\" >";b<=g;b++)a.yearshtml+='<option value="'+b+'"'+(b==c?' selected="selected"':"")+">"+b+"</option>";a.yearshtml+="</select>";k+=a.yearshtml;a.yearshtml=null}}k+=this._get(a,"yearSuffix");if(u)k+=(h||!(j&&l)?"&#xa0;":"")+o;k+="</div>";return k},_adjustInstDate:function(a,b,c){var e=a.drawYear+(c=="Y"?b:0),f=a.drawMonth+
+(c=="M"?b:0);b=Math.min(a.selectedDay,this._getDaysInMonth(e,f))+(c=="D"?b:0);e=this._restrictMinMax(a,this._daylightSavingAdjust(new Date(e,f,b)));a.selectedDay=e.getDate();a.drawMonth=a.selectedMonth=e.getMonth();a.drawYear=a.selectedYear=e.getFullYear();if(c=="M"||c=="Y")this._notifyChange(a)},_restrictMinMax:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");b=c&&b<c?c:b;return b=a&&b>a?a:b},_notifyChange:function(a){var b=this._get(a,"onChangeMonthYear");if(b)b.apply(a.input?
+a.input[0]:null,[a.selectedYear,a.selectedMonth+1,a])},_getNumberOfMonths:function(a){a=this._get(a,"numberOfMonths");return a==null?[1,1]:typeof a=="number"?[1,a]:a},_getMinMaxDate:function(a,b){return this._determineDate(a,this._get(a,b+"Date"),null)},_getDaysInMonth:function(a,b){return 32-this._daylightSavingAdjust(new Date(a,b,32)).getDate()},_getFirstDayOfMonth:function(a,b){return(new Date(a,b,1)).getDay()},_canAdjustMonth:function(a,b,c,e){var f=this._getNumberOfMonths(a);c=this._daylightSavingAdjust(new Date(c,
+e+(b<0?b:f[0]*f[1]),1));b<0&&c.setDate(this._getDaysInMonth(c.getFullYear(),c.getMonth()));return this._isInRange(a,c)},_isInRange:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");return(!c||b.getTime()>=c.getTime())&&(!a||b.getTime()<=a.getTime())},_getFormatConfig:function(a){var b=this._get(a,"shortYearCutoff");b=typeof b!="string"?b:(new Date).getFullYear()%100+parseInt(b,10);return{shortYearCutoff:b,dayNamesShort:this._get(a,"dayNamesShort"),dayNames:this._get(a,
+"dayNames"),monthNamesShort:this._get(a,"monthNamesShort"),monthNames:this._get(a,"monthNames")}},_formatDate:function(a,b,c,e){if(!b){a.currentDay=a.selectedDay;a.currentMonth=a.selectedMonth;a.currentYear=a.selectedYear}b=b?typeof b=="object"?b:this._daylightSavingAdjust(new Date(e,c,b)):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return this.formatDate(this._get(a,"dateFormat"),b,this._getFormatConfig(a))}});d.fn.datepicker=function(a){if(!this.length)return this;
+if(!d.datepicker.initialized){d(document).mousedown(d.datepicker._checkExternalClick).find("body").append(d.datepicker.dpDiv);d.datepicker.initialized=true}var b=Array.prototype.slice.call(arguments,1);if(typeof a=="string"&&(a=="isDisabled"||a=="getDate"||a=="widget"))return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this[0]].concat(b));if(a=="option"&&arguments.length==2&&typeof arguments[1]=="string")return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this[0]].concat(b));return this.each(function(){typeof a==
+"string"?d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this].concat(b)):d.datepicker._attachDatepicker(this,a)})};d.datepicker=new M;d.datepicker.initialized=false;d.datepicker.uuid=(new Date).getTime();d.datepicker.version="1.8.16";window["DP_jQuery_"+B]=d})(jQuery);
+;/*
+ * jQuery UI Progressbar 1.8.16
+ *
+ * Copyright 2011, 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/Progressbar
+ *
+ * Depends:
+ *   jquery.ui.core.js
+ *   jquery.ui.widget.js
+ */
+(function(b,d){b.widget("ui.progressbar",{options:{value:0,max:100},min:0,_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min,"aria-valuemax":this.options.max,"aria-valuenow":this._value()});this.valueDiv=b("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>").appendTo(this.element);this.oldValue=this._value();this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow");
+this.valueDiv.remove();b.Widget.prototype.destroy.apply(this,arguments)},value:function(a){if(a===d)return this._value();this._setOption("value",a);return this},_setOption:function(a,c){if(a==="value"){this.options.value=c;this._refreshValue();this._value()===this.options.max&&this._trigger("complete")}b.Widget.prototype._setOption.apply(this,arguments)},_value:function(){var a=this.options.value;if(typeof a!=="number")a=0;return Math.min(this.options.max,Math.max(this.min,a))},_percentage:function(){return 100*
+this._value()/this.options.max},_refreshValue:function(){var a=this.value(),c=this._percentage();if(this.oldValue!==a){this.oldValue=a;this._trigger("change")}this.valueDiv.toggle(a>this.min).toggleClass("ui-corner-right",a===this.options.max).width(c.toFixed(0)+"%");this.element.attr("aria-valuenow",a)}});b.extend(b.ui.progressbar,{version:"1.8.16"})})(jQuery);
+;/*
+ * jQuery UI Effects 1.8.16
+ *
+ * Copyright 2011, 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/Effects/
+ */
+jQuery.effects||function(f,j){function m(c){var a;if(c&&c.constructor==Array&&c.length==3)return c;if(a=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(c))return[parseInt(a[1],10),parseInt(a[2],10),parseInt(a[3],10)];if(a=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(c))return[parseFloat(a[1])*2.55,parseFloat(a[2])*2.55,parseFloat(a[3])*2.55];if(a=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(c))return[parseInt(a[1],
+16),parseInt(a[2],16),parseInt(a[3],16)];if(a=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(c))return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)];if(/rgba\(0, 0, 0, 0\)/.exec(c))return n.transparent;return n[f.trim(c).toLowerCase()]}function s(c,a){var b;do{b=f.curCSS(c,a);if(b!=""&&b!="transparent"||f.nodeName(c,"body"))break;a="backgroundColor"}while(c=c.parentNode);return m(b)}function o(){var c=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle,
+a={},b,d;if(c&&c.length&&c[0]&&c[c[0]])for(var e=c.length;e--;){b=c[e];if(typeof c[b]=="string"){d=b.replace(/\-(\w)/g,function(g,h){return h.toUpperCase()});a[d]=c[b]}}else for(b in c)if(typeof c[b]==="string")a[b]=c[b];return a}function p(c){var a,b;for(a in c){b=c[a];if(b==null||f.isFunction(b)||a in t||/scrollbar/.test(a)||!/color/i.test(a)&&isNaN(parseFloat(b)))delete c[a]}return c}function u(c,a){var b={_:0},d;for(d in a)if(c[d]!=a[d])b[d]=a[d];return b}function k(c,a,b,d){if(typeof c=="object"){d=
+a;b=null;a=c;c=a.effect}if(f.isFunction(a)){d=a;b=null;a={}}if(typeof a=="number"||f.fx.speeds[a]){d=b;b=a;a={}}if(f.isFunction(b)){d=b;b=null}a=a||{};b=b||a.duration;b=f.fx.off?0:typeof b=="number"?b:b in f.fx.speeds?f.fx.speeds[b]:f.fx.speeds._default;d=d||a.complete;return[c,a,b,d]}function l(c){if(!c||typeof c==="number"||f.fx.speeds[c])return true;if(typeof c==="string"&&!f.effects[c])return true;return false}f.effects={};f.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor",
+"borderTopColor","borderColor","color","outlineColor"],function(c,a){f.fx.step[a]=function(b){if(!b.colorInit){b.start=s(b.elem,a);b.end=m(b.end);b.colorInit=true}b.elem.style[a]="rgb("+Math.max(Math.min(parseInt(b.pos*(b.end[0]-b.start[0])+b.start[0],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[1]-b.start[1])+b.start[1],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[2]-b.start[2])+b.start[2],10),255),0)+")"}});var n={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,
+0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,
+211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},q=["add","remove","toggle"],t={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};f.effects.animateClass=function(c,a,b,
+d){if(f.isFunction(b)){d=b;b=null}return this.queue(function(){var e=f(this),g=e.attr("style")||" ",h=p(o.call(this)),r,v=e.attr("class");f.each(q,function(w,i){c[i]&&e[i+"Class"](c[i])});r=p(o.call(this));e.attr("class",v);e.animate(u(h,r),{queue:false,duration:a,easing:b,complete:function(){f.each(q,function(w,i){c[i]&&e[i+"Class"](c[i])});if(typeof e.attr("style")=="object"){e.attr("style").cssText="";e.attr("style").cssText=g}else e.attr("style",g);d&&d.apply(this,arguments);f.dequeue(this)}})})};
+f.fn.extend({_addClass:f.fn.addClass,addClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{add:c},a,b,d]):this._addClass(c)},_removeClass:f.fn.removeClass,removeClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{remove:c},a,b,d]):this._removeClass(c)},_toggleClass:f.fn.toggleClass,toggleClass:function(c,a,b,d,e){return typeof a=="boolean"||a===j?b?f.effects.animateClass.apply(this,[a?{add:c}:{remove:c},b,d,e]):this._toggleClass(c,a):f.effects.animateClass.apply(this,
+[{toggle:c},a,b,d])},switchClass:function(c,a,b,d,e){return f.effects.animateClass.apply(this,[{add:a,remove:c},b,d,e])}});f.extend(f.effects,{version:"1.8.16",save:function(c,a){for(var b=0;b<a.length;b++)a[b]!==null&&c.data("ec.storage."+a[b],c[0].style[a[b]])},restore:function(c,a){for(var b=0;b<a.length;b++)a[b]!==null&&c.css(a[b],c.data("ec.storage."+a[b]))},setMode:function(c,a){if(a=="toggle")a=c.is(":hidden")?"show":"hide";return a},getBaseline:function(c,a){var b;switch(c[0]){case "top":b=
+0;break;case "middle":b=0.5;break;case "bottom":b=1;break;default:b=c[0]/a.height}switch(c[1]){case "left":c=0;break;case "center":c=0.5;break;case "right":c=1;break;default:c=c[1]/a.width}return{x:c,y:b}},createWrapper:function(c){if(c.parent().is(".ui-effects-wrapper"))return c.parent();var a={width:c.outerWidth(true),height:c.outerHeight(true),"float":c.css("float")},b=f("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),
+d=document.activeElement;c.wrap(b);if(c[0]===d||f.contains(c[0],d))f(d).focus();b=c.parent();if(c.css("position")=="static"){b.css({position:"relative"});c.css({position:"relative"})}else{f.extend(a,{position:c.css("position"),zIndex:c.css("z-index")});f.each(["top","left","bottom","right"],function(e,g){a[g]=c.css(g);if(isNaN(parseInt(a[g],10)))a[g]="auto"});c.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})}return b.css(a).show()},removeWrapper:function(c){var a,b=document.activeElement;
+if(c.parent().is(".ui-effects-wrapper")){a=c.parent().replaceWith(c);if(c[0]===b||f.contains(c[0],b))f(b).focus();return a}return c},setTransition:function(c,a,b,d){d=d||{};f.each(a,function(e,g){unit=c.cssUnit(g);if(unit[0]>0)d[g]=unit[0]*b+unit[1]});return d}});f.fn.extend({effect:function(c){var a=k.apply(this,arguments),b={options:a[1],duration:a[2],callback:a[3]};a=b.options.mode;var d=f.effects[c];if(f.fx.off||!d)return a?this[a](b.duration,b.callback):this.each(function(){b.callback&&b.callback.call(this)});
+return d.call(this,b)},_show:f.fn.show,show:function(c){if(l(c))return this._show.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="show";return this.effect.apply(this,a)}},_hide:f.fn.hide,hide:function(c){if(l(c))return this._hide.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="hide";return this.effect.apply(this,a)}},__toggle:f.fn.toggle,toggle:function(c){if(l(c)||typeof c==="boolean"||f.isFunction(c))return this.__toggle.apply(this,arguments);else{var a=k.apply(this,
+arguments);a[1].mode="toggle";return this.effect.apply(this,a)}},cssUnit:function(c){var a=this.css(c),b=[];f.each(["em","px","%","pt"],function(d,e){if(a.indexOf(e)>0)b=[parseFloat(a),e]});return b}});f.easing.jswing=f.easing.swing;f.extend(f.easing,{def:"easeOutQuad",swing:function(c,a,b,d,e){return f.easing[f.easing.def](c,a,b,d,e)},easeInQuad:function(c,a,b,d,e){return d*(a/=e)*a+b},easeOutQuad:function(c,a,b,d,e){return-d*(a/=e)*(a-2)+b},easeInOutQuad:function(c,a,b,d,e){if((a/=e/2)<1)return d/
+2*a*a+b;return-d/2*(--a*(a-2)-1)+b},easeInCubic:function(c,a,b,d,e){return d*(a/=e)*a*a+b},easeOutCubic:function(c,a,b,d,e){return d*((a=a/e-1)*a*a+1)+b},easeInOutCubic:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a+b;return d/2*((a-=2)*a*a+2)+b},easeInQuart:function(c,a,b,d,e){return d*(a/=e)*a*a*a+b},easeOutQuart:function(c,a,b,d,e){return-d*((a=a/e-1)*a*a*a-1)+b},easeInOutQuart:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a+b;return-d/2*((a-=2)*a*a*a-2)+b},easeInQuint:function(c,a,b,
+d,e){return d*(a/=e)*a*a*a*a+b},easeOutQuint:function(c,a,b,d,e){return d*((a=a/e-1)*a*a*a*a+1)+b},easeInOutQuint:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a*a+b;return d/2*((a-=2)*a*a*a*a+2)+b},easeInSine:function(c,a,b,d,e){return-d*Math.cos(a/e*(Math.PI/2))+d+b},easeOutSine:function(c,a,b,d,e){return d*Math.sin(a/e*(Math.PI/2))+b},easeInOutSine:function(c,a,b,d,e){return-d/2*(Math.cos(Math.PI*a/e)-1)+b},easeInExpo:function(c,a,b,d,e){return a==0?b:d*Math.pow(2,10*(a/e-1))+b},easeOutExpo:function(c,
+a,b,d,e){return a==e?b+d:d*(-Math.pow(2,-10*a/e)+1)+b},easeInOutExpo:function(c,a,b,d,e){if(a==0)return b;if(a==e)return b+d;if((a/=e/2)<1)return d/2*Math.pow(2,10*(a-1))+b;return d/2*(-Math.pow(2,-10*--a)+2)+b},easeInCirc:function(c,a,b,d,e){return-d*(Math.sqrt(1-(a/=e)*a)-1)+b},easeOutCirc:function(c,a,b,d,e){return d*Math.sqrt(1-(a=a/e-1)*a)+b},easeInOutCirc:function(c,a,b,d,e){if((a/=e/2)<1)return-d/2*(Math.sqrt(1-a*a)-1)+b;return d/2*(Math.sqrt(1-(a-=2)*a)+1)+b},easeInElastic:function(c,a,b,
+d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e)==1)return b+d;g||(g=e*0.3);if(h<Math.abs(d)){h=d;c=g/4}else c=g/(2*Math.PI)*Math.asin(d/h);return-(h*Math.pow(2,10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g))+b},easeOutElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e)==1)return b+d;g||(g=e*0.3);if(h<Math.abs(d)){h=d;c=g/4}else c=g/(2*Math.PI)*Math.asin(d/h);return h*Math.pow(2,-10*a)*Math.sin((a*e-c)*2*Math.PI/g)+d+b},easeInOutElastic:function(c,a,b,d,e){c=1.70158;var g=
+0,h=d;if(a==0)return b;if((a/=e/2)==2)return b+d;g||(g=e*0.3*1.5);if(h<Math.abs(d)){h=d;c=g/4}else c=g/(2*Math.PI)*Math.asin(d/h);if(a<1)return-0.5*h*Math.pow(2,10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g)+b;return h*Math.pow(2,-10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g)*0.5+d+b},easeInBack:function(c,a,b,d,e,g){if(g==j)g=1.70158;return d*(a/=e)*a*((g+1)*a-g)+b},easeOutBack:function(c,a,b,d,e,g){if(g==j)g=1.70158;return d*((a=a/e-1)*a*((g+1)*a+g)+1)+b},easeInOutBack:function(c,a,b,d,e,g){if(g==j)g=1.70158;
+if((a/=e/2)<1)return d/2*a*a*(((g*=1.525)+1)*a-g)+b;return d/2*((a-=2)*a*(((g*=1.525)+1)*a+g)+2)+b},easeInBounce:function(c,a,b,d,e){return d-f.easing.easeOutBounce(c,e-a,0,d,e)+b},easeOutBounce:function(c,a,b,d,e){return(a/=e)<1/2.75?d*7.5625*a*a+b:a<2/2.75?d*(7.5625*(a-=1.5/2.75)*a+0.75)+b:a<2.5/2.75?d*(7.5625*(a-=2.25/2.75)*a+0.9375)+b:d*(7.5625*(a-=2.625/2.75)*a+0.984375)+b},easeInOutBounce:function(c,a,b,d,e){if(a<e/2)return f.easing.easeInBounce(c,a*2,0,d,e)*0.5+b;return f.easing.easeOutBounce(c,
+a*2-e,0,d,e)*0.5+d*0.5+b}})}(jQuery);
+;/*
+ * jQuery UI Effects Blind 1.8.16
+ *
+ * Copyright 2011, 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/Effects/Blind
+ *
+ * Depends:
+ *	jquery.effects.core.js
+ */
+(function(b){b.effects.blind=function(c){return this.queue(function(){var a=b(this),g=["position","top","bottom","left","right"],f=b.effects.setMode(a,c.options.mode||"hide"),d=c.options.direction||"vertical";b.effects.save(a,g);a.show();var e=b.effects.createWrapper(a).css({overflow:"hidden"}),h=d=="vertical"?"height":"width";d=d=="vertical"?e.height():e.width();f=="show"&&e.css(h,0);var i={};i[h]=f=="show"?d:0;e.animate(i,c.duration,c.options.easing,function(){f=="hide"&&a.hide();b.effects.restore(a,
+g);b.effects.removeWrapper(a);c.callback&&c.callback.apply(a[0],arguments);a.dequeue()})})}})(jQuery);
+;/*
+ * jQuery UI Effects Bounce 1.8.16
+ *
+ * Copyright 2011, 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/Effects/Bounce
+ *
+ * Depends:
+ *	jquery.effects.core.js
+ */
+(function(e){e.effects.bounce=function(b){return this.queue(function(){var a=e(this),l=["position","top","bottom","left","right"],h=e.effects.setMode(a,b.options.mode||"effect"),d=b.options.direction||"up",c=b.options.distance||20,m=b.options.times||5,i=b.duration||250;/show|hide/.test(h)&&l.push("opacity");e.effects.save(a,l);a.show();e.effects.createWrapper(a);var f=d=="up"||d=="down"?"top":"left";d=d=="up"||d=="left"?"pos":"neg";c=b.options.distance||(f=="top"?a.outerHeight({margin:true})/3:a.outerWidth({margin:true})/
+3);if(h=="show")a.css("opacity",0).css(f,d=="pos"?-c:c);if(h=="hide")c/=m*2;h!="hide"&&m--;if(h=="show"){var g={opacity:1};g[f]=(d=="pos"?"+=":"-=")+c;a.animate(g,i/2,b.options.easing);c/=2;m--}for(g=0;g<m;g++){var j={},k={};j[f]=(d=="pos"?"-=":"+=")+c;k[f]=(d=="pos"?"+=":"-=")+c;a.animate(j,i/2,b.options.easing).animate(k,i/2,b.options.easing);c=h=="hide"?c*2:c/2}if(h=="hide"){g={opacity:0};g[f]=(d=="pos"?"-=":"+=")+c;a.animate(g,i/2,b.options.easing,function(){a.hide();e.effects.restore(a,l);e.effects.removeWrapper(a);
+b.callback&&b.callback.apply(this,arguments)})}else{j={};k={};j[f]=(d=="pos"?"-=":"+=")+c;k[f]=(d=="pos"?"+=":"-=")+c;a.animate(j,i/2,b.options.easing).animate(k,i/2,b.options.easing,function(){e.effects.restore(a,l);e.effects.removeWrapper(a);b.callback&&b.callback.apply(this,arguments)})}a.queue("fx",function(){a.dequeue()});a.dequeue()})}})(jQuery);
+;/*
+ * jQuery UI Effects Clip 1.8.16
+ *
+ * Copyright 2011, 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/Effects/Clip
+ *
+ * Depends:
+ *	jquery.effects.core.js
+ */
+(function(b){b.effects.clip=function(e){return this.queue(function(){var a=b(this),i=["position","top","bottom","left","right","height","width"],f=b.effects.setMode(a,e.options.mode||"hide"),c=e.options.direction||"vertical";b.effects.save(a,i);a.show();var d=b.effects.createWrapper(a).css({overflow:"hidden"});d=a[0].tagName=="IMG"?d:a;var g={size:c=="vertical"?"height":"width",position:c=="vertical"?"top":"left"};c=c=="vertical"?d.height():d.width();if(f=="show"){d.css(g.size,0);d.css(g.position,
+c/2)}var h={};h[g.size]=f=="show"?c:0;h[g.position]=f=="show"?0:c/2;d.animate(h,{queue:false,duration:e.duration,easing:e.options.easing,complete:function(){f=="hide"&&a.hide();b.effects.restore(a,i);b.effects.removeWrapper(a);e.callback&&e.callback.apply(a[0],arguments);a.dequeue()}})})}})(jQuery);
+;/*
+ * jQuery UI Effects Drop 1.8.16
+ *
+ * Copyright 2011, 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/Effects/Drop
+ *
+ * Depends:
+ *	jquery.effects.core.js
+ */
+(function(c){c.effects.drop=function(d){return this.queue(function(){var a=c(this),h=["position","top","bottom","left","right","opacity"],e=c.effects.setMode(a,d.options.mode||"hide"),b=d.options.direction||"left";c.effects.save(a,h);a.show();c.effects.createWrapper(a);var f=b=="up"||b=="down"?"top":"left";b=b=="up"||b=="left"?"pos":"neg";var g=d.options.distance||(f=="top"?a.outerHeight({margin:true})/2:a.outerWidth({margin:true})/2);if(e=="show")a.css("opacity",0).css(f,b=="pos"?-g:g);var i={opacity:e==
+"show"?1:0};i[f]=(e=="show"?b=="pos"?"+=":"-=":b=="pos"?"-=":"+=")+g;a.animate(i,{queue:false,duration:d.duration,easing:d.options.easing,complete:function(){e=="hide"&&a.hide();c.effects.restore(a,h);c.effects.removeWrapper(a);d.callback&&d.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery);
+;/*
+ * jQuery UI Effects Explode 1.8.16
+ *
+ * Copyright 2011, 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/Effects/Explode
+ *
+ * Depends:
+ *	jquery.effects.core.js
+ */
+(function(j){j.effects.explode=function(a){return this.queue(function(){var c=a.options.pieces?Math.round(Math.sqrt(a.options.pieces)):3,d=a.options.pieces?Math.round(Math.sqrt(a.options.pieces)):3;a.options.mode=a.options.mode=="toggle"?j(this).is(":visible")?"hide":"show":a.options.mode;var b=j(this).show().css("visibility","hidden"),g=b.offset();g.top-=parseInt(b.css("marginTop"),10)||0;g.left-=parseInt(b.css("marginLeft"),10)||0;for(var h=b.outerWidth(true),i=b.outerHeight(true),e=0;e<c;e++)for(var f=
+0;f<d;f++)b.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-f*(h/d),top:-e*(i/c)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:h/d,height:i/c,left:g.left+f*(h/d)+(a.options.mode=="show"?(f-Math.floor(d/2))*(h/d):0),top:g.top+e*(i/c)+(a.options.mode=="show"?(e-Math.floor(c/2))*(i/c):0),opacity:a.options.mode=="show"?0:1}).animate({left:g.left+f*(h/d)+(a.options.mode=="show"?0:(f-Math.floor(d/2))*(h/d)),top:g.top+
+e*(i/c)+(a.options.mode=="show"?0:(e-Math.floor(c/2))*(i/c)),opacity:a.options.mode=="show"?1:0},a.duration||500);setTimeout(function(){a.options.mode=="show"?b.css({visibility:"visible"}):b.css({visibility:"visible"}).hide();a.callback&&a.callback.apply(b[0]);b.dequeue();j("div.ui-effects-explode").remove()},a.duration||500)})}})(jQuery);
+;/*
+ * jQuery UI Effects Fade 1.8.16
+ *
+ * Copyright 2011, 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/Effects/Fade
+ *
+ * Depends:
+ *	jquery.effects.core.js
+ */
+(function(b){b.effects.fade=function(a){return this.queue(function(){var c=b(this),d=b.effects.setMode(c,a.options.mode||"hide");c.animate({opacity:d},{queue:false,duration:a.duration,easing:a.options.easing,complete:function(){a.callback&&a.callback.apply(this,arguments);c.dequeue()}})})}})(jQuery);
+;/*
+ * jQuery UI Effects Fold 1.8.16
+ *
+ * Copyright 2011, 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/Effects/Fold
+ *
+ * Depends:
+ *	jquery.effects.core.js
+ */
+(function(c){c.effects.fold=function(a){return this.queue(function(){var b=c(this),j=["position","top","bottom","left","right"],d=c.effects.setMode(b,a.options.mode||"hide"),g=a.options.size||15,h=!!a.options.horizFirst,k=a.duration?a.duration/2:c.fx.speeds._default/2;c.effects.save(b,j);b.show();var e=c.effects.createWrapper(b).css({overflow:"hidden"}),f=d=="show"!=h,l=f?["width","height"]:["height","width"];f=f?[e.width(),e.height()]:[e.height(),e.width()];var i=/([0-9]+)%/.exec(g);if(i)g=parseInt(i[1],
+10)/100*f[d=="hide"?0:1];if(d=="show")e.css(h?{height:0,width:g}:{height:g,width:0});h={};i={};h[l[0]]=d=="show"?f[0]:g;i[l[1]]=d=="show"?f[1]:0;e.animate(h,k,a.options.easing).animate(i,k,a.options.easing,function(){d=="hide"&&b.hide();c.effects.restore(b,j);c.effects.removeWrapper(b);a.callback&&a.callback.apply(b[0],arguments);b.dequeue()})})}})(jQuery);
+;/*
+ * jQuery UI Effects Highlight 1.8.16
+ *
+ * Copyright 2011, 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/Effects/Highlight
+ *
+ * Depends:
+ *	jquery.effects.core.js
+ */
+(function(b){b.effects.highlight=function(c){return this.queue(function(){var a=b(this),e=["backgroundImage","backgroundColor","opacity"],d=b.effects.setMode(a,c.options.mode||"show"),f={backgroundColor:a.css("backgroundColor")};if(d=="hide")f.opacity=0;b.effects.save(a,e);a.show().css({backgroundImage:"none",backgroundColor:c.options.color||"#ffff99"}).animate(f,{queue:false,duration:c.duration,easing:c.options.easing,complete:function(){d=="hide"&&a.hide();b.effects.restore(a,e);d=="show"&&!b.support.opacity&&
+this.style.removeAttribute("filter");c.callback&&c.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery);
+;/*
+ * jQuery UI Effects Pulsate 1.8.16
+ *
+ * Copyright 2011, 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/Effects/Pulsate
+ *
+ * Depends:
+ *	jquery.effects.core.js
+ */
+(function(d){d.effects.pulsate=function(a){return this.queue(function(){var b=d(this),c=d.effects.setMode(b,a.options.mode||"show");times=(a.options.times||5)*2-1;duration=a.duration?a.duration/2:d.fx.speeds._default/2;isVisible=b.is(":visible");animateTo=0;if(!isVisible){b.css("opacity",0).show();animateTo=1}if(c=="hide"&&isVisible||c=="show"&&!isVisible)times--;for(c=0;c<times;c++){b.animate({opacity:animateTo},duration,a.options.easing);animateTo=(animateTo+1)%2}b.animate({opacity:animateTo},duration,
+a.options.easing,function(){animateTo==0&&b.hide();a.callback&&a.callback.apply(this,arguments)});b.queue("fx",function(){b.dequeue()}).dequeue()})}})(jQuery);
+;/*
+ * jQuery UI Effects Scale 1.8.16
+ *
+ * Copyright 2011, 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/Effects/Scale
+ *
+ * Depends:
+ *	jquery.effects.core.js
+ */
+(function(c){c.effects.puff=function(b){return this.queue(function(){var a=c(this),e=c.effects.setMode(a,b.options.mode||"hide"),g=parseInt(b.options.percent,10)||150,h=g/100,i={height:a.height(),width:a.width()};c.extend(b.options,{fade:true,mode:e,percent:e=="hide"?g:100,from:e=="hide"?i:{height:i.height*h,width:i.width*h}});a.effect("scale",b.options,b.duration,b.callback);a.dequeue()})};c.effects.scale=function(b){return this.queue(function(){var a=c(this),e=c.extend(true,{},b.options),g=c.effects.setMode(a,
+b.options.mode||"effect"),h=parseInt(b.options.percent,10)||(parseInt(b.options.percent,10)==0?0:g=="hide"?0:100),i=b.options.direction||"both",f=b.options.origin;if(g!="effect"){e.origin=f||["middle","center"];e.restore=true}f={height:a.height(),width:a.width()};a.from=b.options.from||(g=="show"?{height:0,width:0}:f);h={y:i!="horizontal"?h/100:1,x:i!="vertical"?h/100:1};a.to={height:f.height*h.y,width:f.width*h.x};if(b.options.fade){if(g=="show"){a.from.opacity=0;a.to.opacity=1}if(g=="hide"){a.from.opacity=
+1;a.to.opacity=0}}e.from=a.from;e.to=a.to;e.mode=g;a.effect("size",e,b.duration,b.callback);a.dequeue()})};c.effects.size=function(b){return this.queue(function(){var a=c(this),e=["position","top","bottom","left","right","width","height","overflow","opacity"],g=["position","top","bottom","left","right","overflow","opacity"],h=["width","height","overflow"],i=["fontSize"],f=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],k=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],
+p=c.effects.setMode(a,b.options.mode||"effect"),n=b.options.restore||false,m=b.options.scale||"both",l=b.options.origin,j={height:a.height(),width:a.width()};a.from=b.options.from||j;a.to=b.options.to||j;if(l){l=c.effects.getBaseline(l,j);a.from.top=(j.height-a.from.height)*l.y;a.from.left=(j.width-a.from.width)*l.x;a.to.top=(j.height-a.to.height)*l.y;a.to.left=(j.width-a.to.width)*l.x}var d={from:{y:a.from.height/j.height,x:a.from.width/j.width},to:{y:a.to.height/j.height,x:a.to.width/j.width}};
+if(m=="box"||m=="both"){if(d.from.y!=d.to.y){e=e.concat(f);a.from=c.effects.setTransition(a,f,d.from.y,a.from);a.to=c.effects.setTransition(a,f,d.to.y,a.to)}if(d.from.x!=d.to.x){e=e.concat(k);a.from=c.effects.setTransition(a,k,d.from.x,a.from);a.to=c.effects.setTransition(a,k,d.to.x,a.to)}}if(m=="content"||m=="both")if(d.from.y!=d.to.y){e=e.concat(i);a.from=c.effects.setTransition(a,i,d.from.y,a.from);a.to=c.effects.setTransition(a,i,d.to.y,a.to)}c.effects.save(a,n?e:g);a.show();c.effects.createWrapper(a);
+a.css("overflow","hidden").css(a.from);if(m=="content"||m=="both"){f=f.concat(["marginTop","marginBottom"]).concat(i);k=k.concat(["marginLeft","marginRight"]);h=e.concat(f).concat(k);a.find("*[width]").each(function(){child=c(this);n&&c.effects.save(child,h);var o={height:child.height(),width:child.width()};child.from={height:o.height*d.from.y,width:o.width*d.from.x};child.to={height:o.height*d.to.y,width:o.width*d.to.x};if(d.from.y!=d.to.y){child.from=c.effects.setTransition(child,f,d.from.y,child.from);
+child.to=c.effects.setTransition(child,f,d.to.y,child.to)}if(d.from.x!=d.to.x){child.from=c.effects.setTransition(child,k,d.from.x,child.from);child.to=c.effects.setTransition(child,k,d.to.x,child.to)}child.css(child.from);child.animate(child.to,b.duration,b.options.easing,function(){n&&c.effects.restore(child,h)})})}a.animate(a.to,{queue:false,duration:b.duration,easing:b.options.easing,complete:function(){a.to.opacity===0&&a.css("opacity",a.from.opacity);p=="hide"&&a.hide();c.effects.restore(a,
+n?e:g);c.effects.removeWrapper(a);b.callback&&b.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery);
+;/*
+ * jQuery UI Effects Shake 1.8.16
+ *
+ * Copyright 2011, 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/Effects/Shake
+ *
+ * Depends:
+ *	jquery.effects.core.js
+ */
+(function(d){d.effects.shake=function(a){return this.queue(function(){var b=d(this),j=["position","top","bottom","left","right"];d.effects.setMode(b,a.options.mode||"effect");var c=a.options.direction||"left",e=a.options.distance||20,l=a.options.times||3,f=a.duration||a.options.duration||140;d.effects.save(b,j);b.show();d.effects.createWrapper(b);var g=c=="up"||c=="down"?"top":"left",h=c=="up"||c=="left"?"pos":"neg";c={};var i={},k={};c[g]=(h=="pos"?"-=":"+=")+e;i[g]=(h=="pos"?"+=":"-=")+e*2;k[g]=
+(h=="pos"?"-=":"+=")+e*2;b.animate(c,f,a.options.easing);for(e=1;e<l;e++)b.animate(i,f,a.options.easing).animate(k,f,a.options.easing);b.animate(i,f,a.options.easing).animate(c,f/2,a.options.easing,function(){d.effects.restore(b,j);d.effects.removeWrapper(b);a.callback&&a.callback.apply(this,arguments)});b.queue("fx",function(){b.dequeue()});b.dequeue()})}})(jQuery);
+;/*
+ * jQuery UI Effects Slide 1.8.16
+ *
+ * Copyright 2011, 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/Effects/Slide
+ *
+ * Depends:
+ *	jquery.effects.core.js
+ */
+(function(c){c.effects.slide=function(d){return this.queue(function(){var a=c(this),h=["position","top","bottom","left","right"],f=c.effects.setMode(a,d.options.mode||"show"),b=d.options.direction||"left";c.effects.save(a,h);a.show();c.effects.createWrapper(a).css({overflow:"hidden"});var g=b=="up"||b=="down"?"top":"left";b=b=="up"||b=="left"?"pos":"neg";var e=d.options.distance||(g=="top"?a.outerHeight({margin:true}):a.outerWidth({margin:true}));if(f=="show")a.css(g,b=="pos"?isNaN(e)?"-"+e:-e:e);
+var i={};i[g]=(f=="show"?b=="pos"?"+=":"-=":b=="pos"?"-=":"+=")+e;a.animate(i,{queue:false,duration:d.duration,easing:d.options.easing,complete:function(){f=="hide"&&a.hide();c.effects.restore(a,h);c.effects.removeWrapper(a);d.callback&&d.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery);
+;/*
+ * jQuery UI Effects Transfer 1.8.16
+ *
+ * Copyright 2011, 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/Effects/Transfer
+ *
+ * Depends:
+ *	jquery.effects.core.js
+ */
+(function(e){e.effects.transfer=function(a){return this.queue(function(){var b=e(this),c=e(a.options.to),d=c.offset();c={top:d.top,left:d.left,height:c.innerHeight(),width:c.innerWidth()};d=b.offset();var f=e('<div class="ui-effects-transfer"></div>').appendTo(document.body).addClass(a.options.className).css({top:d.top,left:d.left,height:b.innerHeight(),width:b.innerWidth(),position:"absolute"}).animate(c,a.duration,a.options.easing,function(){f.remove();a.callback&&a.callback.apply(b[0],arguments);
+b.dequeue()})})}})(jQuery);
+;
Index: trunk/prototype/plugins/jquery/jquery-ui.css
===================================================================
--- trunk/prototype/plugins/jquery/jquery-ui.css	(revision 5341)
+++ trunk/prototype/plugins/jquery/jquery-ui.css	(revision 5341)
@@ -0,0 +1,568 @@
+/*
+ * jQuery UI CSS Framework 1.8.16
+ *
+ * Copyright 2011, 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/Theming/API
+ */
+
+/* Layout helpers
+----------------------------------*/
+.ui-helper-hidden { display: none; }
+.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
+.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
+.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
+.ui-helper-clearfix { display: inline-block; }
+/* required comment for clearfix to work in Opera \*/
+* html .ui-helper-clearfix { height:1%; }
+.ui-helper-clearfix { display:block; }
+/* end clearfix */
+.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
+
+
+/* Interaction Cues
+----------------------------------*/
+.ui-state-disabled { cursor: default !important; }
+
+
+/* Icons
+----------------------------------*/
+
+/* states and images */
+.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
+
+
+/* Misc visuals
+----------------------------------*/
+
+/* Overlays */
+.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
+
+
+/*
+ * jQuery UI CSS Framework 1.8.16
+ *
+ * Copyright 2011, 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/Theming/API
+ *
+ * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Lucida%20Grande,%20Lucida%20Sans,%20Arial,%20sans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=5px&bgColorHeader=5c9ccc&bgTextureHeader=12_gloss_wave.png&bgImgOpacityHeader=55&borderColorHeader=4297d7&fcHeader=ffffff&iconColorHeader=d8e7f3&bgColorContent=fcfdfd&bgTextureContent=06_inset_hard.png&bgImgOpacityContent=100&borderColorContent=a6c9e2&fcContent=222222&iconColorContent=469bdd&bgColorDefault=dfeffc&bgTextureDefault=02_glass.png&bgImgOpacityDefault=85&borderColorDefault=c5dbec&fcDefault=2e6e9e&iconColorDefault=6da8d5&bgColorHover=d0e5f5&bgTextureHover=02_glass.png&bgImgOpacityHover=75&borderColorHover=79b7e7&fcHover=1d5987&iconColorHover=217bc0&bgColorActive=f5f8f9&bgTextureActive=06_inset_hard.png&bgImgOpacityActive=100&borderColorActive=79b7e7&fcActive=e17009&iconColorActive=f9bd01&bgColorHighlight=fbec88&bgTextureHighlight=01_flat.png&bgImgOpacityHighlight=55&borderColorHighlight=fad42e&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=02_glass.png&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
+ */
+
+
+/* Component containers
+----------------------------------*/
+.ui-widget { font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1.1em; }
+.ui-widget .ui-widget { font-size: 1em; }
+.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1em; }
+.ui-widget-content { border: 1px solid #a6c9e2; background: #fcfdfd url(images/ui-bg_inset-hard_100_fcfdfd_1x100.png) 50% bottom repeat-x; color: #222222; }
+.ui-widget-content a { color: #222222; }
+.ui-widget-header { border: 1px solid #4297d7; background: #5c9ccc url(images/ui-bg_gloss-wave_55_5c9ccc_500x100.png) 50% 50% repeat-x; color: #ffffff; font-weight: bold; }
+.ui-widget-header a { color: #ffffff; }
+
+/* Interaction states
+----------------------------------*/
+.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #c5dbec; background: #dfeffc url(images/ui-bg_glass_85_dfeffc_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #2e6e9e; }
+.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #2e6e9e; text-decoration: none; }
+.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #79b7e7; background: #d0e5f5 url(images/ui-bg_glass_75_d0e5f5_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #1d5987; }
+.ui-state-hover a, .ui-state-hover a:hover { color: #1d5987; text-decoration: none; }
+.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #79b7e7; background: #f5f8f9 url(images/ui-bg_inset-hard_100_f5f8f9_1x100.png) 50% 50% repeat-x; font-weight: bold; color: #e17009; }
+.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #e17009; text-decoration: none; }
+.ui-widget :active { outline: none; }
+
+/* Interaction Cues
+----------------------------------*/
+.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight  {border: 1px solid #fad42e; background: #fbec88 url(images/ui-bg_flat_55_fbec88_40x100.png) 50% 50% repeat-x; color: #363636; }
+.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
+.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; }
+.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; }
+.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; }
+.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
+.ui-priority-secondary, .ui-widget-content .ui-priority-secondary,  .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
+.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
+
+/* Icons
+----------------------------------*/
+
+/* states and images */
+.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_469bdd_256x240.png); }
+.ui-widget-content .ui-icon {background-image: url(images/ui-icons_469bdd_256x240.png); }
+.ui-widget-header .ui-icon {background-image: url(images/ui-icons_d8e7f3_256x240.png); }
+.ui-state-default .ui-icon { background-image: url(images/ui-icons_6da8d5_256x240.png); }
+.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_217bc0_256x240.png); }
+.ui-state-active .ui-icon {background-image: url(images/ui-icons_f9bd01_256x240.png); }
+.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); }
+.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); }
+
+/* positioning */
+.ui-icon-carat-1-n { background-position: 0 0; }
+.ui-icon-carat-1-ne { background-position: -16px 0; }
+.ui-icon-carat-1-e { background-position: -32px 0; }
+.ui-icon-carat-1-se { background-position: -48px 0; }
+.ui-icon-carat-1-s { background-position: -64px 0; }
+.ui-icon-carat-1-sw { background-position: -80px 0; }
+.ui-icon-carat-1-w { background-position: -96px 0; }
+.ui-icon-carat-1-nw { background-position: -112px 0; }
+.ui-icon-carat-2-n-s { background-position: -128px 0; }
+.ui-icon-carat-2-e-w { background-position: -144px 0; }
+.ui-icon-triangle-1-n { background-position: 0 -16px; }
+.ui-icon-triangle-1-ne { background-position: -16px -16px; }
+.ui-icon-triangle-1-e { background-position: -32px -16px; }
+.ui-icon-triangle-1-se { background-position: -48px -16px; }
+.ui-icon-triangle-1-s { background-position: -64px -16px; }
+.ui-icon-triangle-1-sw { background-position: -80px -16px; }
+.ui-icon-triangle-1-w { background-position: -96px -16px; }
+.ui-icon-triangle-1-nw { background-position: -112px -16px; }
+.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
+.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
+.ui-icon-arrow-1-n { background-position: 0 -32px; }
+.ui-icon-arrow-1-ne { background-position: -16px -32px; }
+.ui-icon-arrow-1-e { background-position: -32px -32px; }
+.ui-icon-arrow-1-se { background-position: -48px -32px; }
+.ui-icon-arrow-1-s { background-position: -64px -32px; }
+.ui-icon-arrow-1-sw { background-position: -80px -32px; }
+.ui-icon-arrow-1-w { background-position: -96px -32px; }
+.ui-icon-arrow-1-nw { background-position: -112px -32px; }
+.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
+.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
+.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
+.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
+.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
+.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
+.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
+.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
+.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
+.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
+.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
+.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
+.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
+.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
+.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
+.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
+.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
+.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
+.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
+.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
+.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
+.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
+.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
+.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
+.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
+.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
+.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
+.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
+.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
+.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
+.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
+.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
+.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
+.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
+.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
+.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
+.ui-icon-arrow-4 { background-position: 0 -80px; }
+.ui-icon-arrow-4-diag { background-position: -16px -80px; }
+.ui-icon-extlink { background-position: -32px -80px; }
+.ui-icon-newwin { background-position: -48px -80px; }
+.ui-icon-refresh { background-position: -64px -80px; }
+.ui-icon-shuffle { background-position: -80px -80px; }
+.ui-icon-transfer-e-w { background-position: -96px -80px; }
+.ui-icon-transferthick-e-w { background-position: -112px -80px; }
+.ui-icon-folder-collapsed { background-position: 0 -96px; }
+.ui-icon-folder-open { background-position: -16px -96px; }
+.ui-icon-document { background-position: -32px -96px; }
+.ui-icon-document-b { background-position: -48px -96px; }
+.ui-icon-note { background-position: -64px -96px; }
+.ui-icon-mail-closed { background-position: -80px -96px; }
+.ui-icon-mail-open { background-position: -96px -96px; }
+.ui-icon-suitcase { background-position: -112px -96px; }
+.ui-icon-comment { background-position: -128px -96px; }
+.ui-icon-person { background-position: -144px -96px; }
+.ui-icon-print { background-position: -160px -96px; }
+.ui-icon-trash { background-position: -176px -96px; }
+.ui-icon-locked { background-position: -192px -96px; }
+.ui-icon-unlocked { background-position: -208px -96px; }
+.ui-icon-bookmark { background-position: -224px -96px; }
+.ui-icon-tag { background-position: -240px -96px; }
+.ui-icon-home { background-position: 0 -112px; }
+.ui-icon-flag { background-position: -16px -112px; }
+.ui-icon-calendar { background-position: -32px -112px; }
+.ui-icon-cart { background-position: -48px -112px; }
+.ui-icon-pencil { background-position: -64px -112px; }
+.ui-icon-clock { background-position: -80px -112px; }
+.ui-icon-disk { background-position: -96px -112px; }
+.ui-icon-calculator { background-position: -112px -112px; }
+.ui-icon-zoomin { background-position: -128px -112px; }
+.ui-icon-zoomout { background-position: -144px -112px; }
+.ui-icon-search { background-position: -160px -112px; }
+.ui-icon-wrench { background-position: -176px -112px; }
+.ui-icon-gear { background-position: -192px -112px; }
+.ui-icon-heart { background-position: -208px -112px; }
+.ui-icon-star { background-position: -224px -112px; }
+.ui-icon-link { background-position: -240px -112px; }
+.ui-icon-cancel { background-position: 0 -128px; }
+.ui-icon-plus { background-position: -16px -128px; }
+.ui-icon-plusthick { background-position: -32px -128px; }
+.ui-icon-minus { background-position: -48px -128px; }
+.ui-icon-minusthick { background-position: -64px -128px; }
+.ui-icon-close { background-position: -80px -128px; }
+.ui-icon-closethick { background-position: -96px -128px; }
+.ui-icon-key { background-position: -112px -128px; }
+.ui-icon-lightbulb { background-position: -128px -128px; }
+.ui-icon-scissors { background-position: -144px -128px; }
+.ui-icon-clipboard { background-position: -160px -128px; }
+.ui-icon-copy { background-position: -176px -128px; }
+.ui-icon-contact { background-position: -192px -128px; }
+.ui-icon-image { background-position: -208px -128px; }
+.ui-icon-video { background-position: -224px -128px; }
+.ui-icon-script { background-position: -240px -128px; }
+.ui-icon-alert { background-position: 0 -144px; }
+.ui-icon-info { background-position: -16px -144px; }
+.ui-icon-notice { background-position: -32px -144px; }
+.ui-icon-help { background-position: -48px -144px; }
+.ui-icon-check { background-position: -64px -144px; }
+.ui-icon-bullet { background-position: -80px -144px; }
+.ui-icon-radio-off { background-position: -96px -144px; }
+.ui-icon-radio-on { background-position: -112px -144px; }
+.ui-icon-pin-w { background-position: -128px -144px; }
+.ui-icon-pin-s { background-position: -144px -144px; }
+.ui-icon-play { background-position: 0 -160px; }
+.ui-icon-pause { background-position: -16px -160px; }
+.ui-icon-seek-next { background-position: -32px -160px; }
+.ui-icon-seek-prev { background-position: -48px -160px; }
+.ui-icon-seek-end { background-position: -64px -160px; }
+.ui-icon-seek-start { background-position: -80px -160px; }
+/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
+.ui-icon-seek-first { background-position: -80px -160px; }
+.ui-icon-stop { background-position: -96px -160px; }
+.ui-icon-eject { background-position: -112px -160px; }
+.ui-icon-volume-off { background-position: -128px -160px; }
+.ui-icon-volume-on { background-position: -144px -160px; }
+.ui-icon-power { background-position: 0 -176px; }
+.ui-icon-signal-diag { background-position: -16px -176px; }
+.ui-icon-signal { background-position: -32px -176px; }
+.ui-icon-battery-0 { background-position: -48px -176px; }
+.ui-icon-battery-1 { background-position: -64px -176px; }
+.ui-icon-battery-2 { background-position: -80px -176px; }
+.ui-icon-battery-3 { background-position: -96px -176px; }
+.ui-icon-circle-plus { background-position: 0 -192px; }
+.ui-icon-circle-minus { background-position: -16px -192px; }
+.ui-icon-circle-close { background-position: -32px -192px; }
+.ui-icon-circle-triangle-e { background-position: -48px -192px; }
+.ui-icon-circle-triangle-s { background-position: -64px -192px; }
+.ui-icon-circle-triangle-w { background-position: -80px -192px; }
+.ui-icon-circle-triangle-n { background-position: -96px -192px; }
+.ui-icon-circle-arrow-e { background-position: -112px -192px; }
+.ui-icon-circle-arrow-s { background-position: -128px -192px; }
+.ui-icon-circle-arrow-w { background-position: -144px -192px; }
+.ui-icon-circle-arrow-n { background-position: -160px -192px; }
+.ui-icon-circle-zoomin { background-position: -176px -192px; }
+.ui-icon-circle-zoomout { background-position: -192px -192px; }
+.ui-icon-circle-check { background-position: -208px -192px; }
+.ui-icon-circlesmall-plus { background-position: 0 -208px; }
+.ui-icon-circlesmall-minus { background-position: -16px -208px; }
+.ui-icon-circlesmall-close { background-position: -32px -208px; }
+.ui-icon-squaresmall-plus { background-position: -48px -208px; }
+.ui-icon-squaresmall-minus { background-position: -64px -208px; }
+.ui-icon-squaresmall-close { background-position: -80px -208px; }
+.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
+.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
+.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
+.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
+.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
+.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
+
+
+/* Misc visuals
+----------------------------------*/
+
+/* Corner radius */
+.ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 5px; -webkit-border-top-left-radius: 5px; -khtml-border-top-left-radius: 5px; border-top-left-radius: 5px; }
+.ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 5px; -webkit-border-top-right-radius: 5px; -khtml-border-top-right-radius: 5px; border-top-right-radius: 5px; }
+.ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 5px; -webkit-border-bottom-left-radius: 5px; -khtml-border-bottom-left-radius: 5px; border-bottom-left-radius: 5px; }
+.ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 5px; -webkit-border-bottom-right-radius: 5px; -khtml-border-bottom-right-radius: 5px; border-bottom-right-radius: 5px; }
+
+/* Overlays */
+.ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); }
+.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -khtml-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }/*
+ * jQuery UI Resizable 1.8.16
+ *
+ * Copyright 2011, 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/Resizable#theming
+ */
+.ui-resizable { position: relative;}
+.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block; }
+.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
+.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
+.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
+.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }
+.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }
+.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
+.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
+.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
+.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/*
+ * jQuery UI Selectable 1.8.16
+ *
+ * Copyright 2011, 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/Selectable#theming
+ */
+.ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; }
+/*
+ * jQuery UI Accordion 1.8.16
+ *
+ * Copyright 2011, 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/Accordion#theming
+ */
+/* IE/Win - Fix animation bug - #4615 */
+.ui-accordion { width: 100%; }
+.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
+.ui-accordion .ui-accordion-li-fix { display: inline; }
+.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }
+.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; }
+.ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; }
+.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
+.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; }
+.ui-accordion .ui-accordion-content-active { display: block; }
+/*
+ * jQuery UI Autocomplete 1.8.16
+ *
+ * Copyright 2011, 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/Autocomplete#theming
+ */
+.ui-autocomplete { position: absolute; cursor: default; }	
+
+/* workarounds */
+* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
+
+/*
+ * jQuery UI Menu 1.8.16
+ *
+ * Copyright 2010, 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/Menu#theming
+ */
+.ui-menu {
+	list-style:none;
+	padding: 2px;
+	margin: 0;
+	display:block;
+	float: left;
+}
+.ui-menu .ui-menu {
+	margin-top: -3px;
+}
+.ui-menu .ui-menu-item {
+	margin:0;
+	padding: 0;
+	zoom: 1;
+	float: left;
+	clear: left;
+	width: 100%;
+}
+.ui-menu .ui-menu-item a {
+	text-decoration:none;
+	display:block;
+	padding:.2em .4em;
+	line-height:1.5;
+	zoom:1;
+}
+.ui-menu .ui-menu-item a.ui-state-hover,
+.ui-menu .ui-menu-item a.ui-state-active {
+	font-weight: normal;
+	margin: -1px;
+}
+/*
+ * jQuery UI Button 1.8.16
+ *
+ * Copyright 2011, 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#theming
+ */
+.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */
+.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
+button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
+.ui-button-icons-only { width: 3.4em; } 
+button.ui-button-icons-only { width: 3.7em; } 
+
+/*button text element */
+.ui-button .ui-button-text { display: block; line-height: 1.4;  }
+.ui-button-text-only .ui-button-text { padding: .4em 1em; }
+.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }
+.ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }
+.ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; }
+.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }
+/* no icon support for input elements, provide padding by default */
+input.ui-button { padding: .4em 1em; }
+
+/*button icon element(s) */
+.ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }
+.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }
+.ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }
+.ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
+.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
+
+/*button sets*/
+.ui-buttonset { margin-right: 7px; }
+.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; }
+
+/* workarounds */
+button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */
+/*
+ * jQuery UI Dialog 1.8.16
+ *
+ * Copyright 2011, 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#theming
+ */
+.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; }
+.ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative;  }
+.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; } 
+.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
+.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
+.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
+.ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
+.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
+.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; }
+.ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; }
+.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
+.ui-draggable .ui-dialog-titlebar { cursor: move; }
+/*
+ * jQuery UI Slider 1.8.16
+ *
+ * Copyright 2011, 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/Slider#theming
+ */
+.ui-slider { position: relative; text-align: left; }
+.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
+.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
+
+.ui-slider-horizontal { height: .8em; }
+.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
+.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
+.ui-slider-horizontal .ui-slider-range-min { left: 0; }
+.ui-slider-horizontal .ui-slider-range-max { right: 0; }
+
+.ui-slider-vertical { width: .8em; height: 100px; }
+.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
+.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
+.ui-slider-vertical .ui-slider-range-min { bottom: 0; }
+.ui-slider-vertical .ui-slider-range-max { top: 0; }/*
+ * jQuery UI Tabs 1.8.16
+ *
+ * Copyright 2011, 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/Tabs#theming
+ */
+.ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
+.ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; }
+.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; }
+.ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; }
+.ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; }
+.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; }
+.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
+.ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; }
+.ui-tabs .ui-tabs-hide { display: none !important; }
+/*
+ * jQuery UI Datepicker 1.8.16
+ *
+ * Copyright 2011, 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/Datepicker#theming
+ */
+.ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; }
+.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
+.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
+.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
+.ui-datepicker .ui-datepicker-prev { left:2px; }
+.ui-datepicker .ui-datepicker-next { right:2px; }
+.ui-datepicker .ui-datepicker-prev-hover { left:1px; }
+.ui-datepicker .ui-datepicker-next-hover { right:1px; }
+.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px;  }
+.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
+.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
+.ui-datepicker select.ui-datepicker-month-year {width: 100%;}
+.ui-datepicker select.ui-datepicker-month, 
+.ui-datepicker select.ui-datepicker-year { width: 49%;}
+.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
+.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0;  }
+.ui-datepicker td { border: 0; padding: 1px; }
+.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
+.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
+.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
+.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
+
+/* with multiple calendars */
+.ui-datepicker.ui-datepicker-multi { width:auto; }
+.ui-datepicker-multi .ui-datepicker-group { float:left; }
+.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
+.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
+.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
+.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
+.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
+.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
+.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
+.ui-datepicker-row-break { clear:both; width:100%; font-size:0em; }
+
+/* RTL support */
+.ui-datepicker-rtl { direction: rtl; }
+.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
+.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
+.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
+.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
+.ui-datepicker-rtl .ui-datepicker-group { float:right; }
+.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
+.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
+
+/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
+.ui-datepicker-cover {
+    display: none; /*sorry for IE5*/
+    display/**/: block; /*sorry for IE5*/
+    position: absolute; /*must have*/
+    z-index: -1; /*must have*/
+    filter: mask(); /*must have*/
+    top: -4px; /*must have*/
+    left: -4px; /*must have*/
+    width: 200px; /*must have*/
+    height: 200px; /*must have*/
+}/*
+ * jQuery UI Progressbar 1.8.16
+ *
+ * Copyright 2011, 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/Progressbar#theming
+ */
+.ui-progressbar { height:2em; text-align: left; }
+.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }
Index: trunk/prototype/plugins/jquery/jquery-ui.min.js
===================================================================
--- trunk/prototype/plugins/jquery/jquery-ui.min.js	(revision 5341)
+++ trunk/prototype/plugins/jquery/jquery-ui.min.js	(revision 5341)
@@ -0,0 +1,791 @@
+/*!
+ * jQuery UI 1.8.16
+ *
+ * Copyright 2011, 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(c,j){function k(a,b){var d=a.nodeName.toLowerCase();if("area"===d){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map")return false;a=c("img[usemap=#"+d+"]")[0];return!!a&&l(a)}return(/input|select|textarea|button|object/.test(d)?!a.disabled:"a"==d?a.href||b:b)&&l(a)}function l(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.16",
+keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,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}});c.fn.extend({propAttr:c.fn.prop||c.fn.attr,_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=
+this;setTimeout(function(){c(d).focus();b&&b.call(d)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this,"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,
+"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==j)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position");if(b==="absolute"||b==="relative"||b==="fixed"){b=parseInt(a.css("zIndex"),10);if(!isNaN(b)&&b!==0)return b}a=a.parent()}}return 0},disableSelection:function(){return this.bind((c.support.selectstart?"selectstart":
+"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});c.each(["Width","Height"],function(a,b){function d(f,g,m,n){c.each(e,function(){g-=parseFloat(c.curCSS(f,"padding"+this,true))||0;if(m)g-=parseFloat(c.curCSS(f,"border"+this+"Width",true))||0;if(n)g-=parseFloat(c.curCSS(f,"margin"+this,true))||0});return g}var e=b==="Width"?["Left","Right"]:["Top","Bottom"],h=b.toLowerCase(),i={innerWidth:c.fn.innerWidth,innerHeight:c.fn.innerHeight,
+outerWidth:c.fn.outerWidth,outerHeight:c.fn.outerHeight};c.fn["inner"+b]=function(f){if(f===j)return i["inner"+b].call(this);return this.each(function(){c(this).css(h,d(this,f)+"px")})};c.fn["outer"+b]=function(f,g){if(typeof f!=="number")return i["outer"+b].call(this,f);return this.each(function(){c(this).css(h,d(this,f,true,g)+"px")})}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){return k(a,!isNaN(c.attr(a,"tabindex")))},tabbable:function(a){var b=c.attr(a,
+"tabindex"),d=isNaN(b);return(d||b>=0)&&k(a,!d)}});c(function(){var a=document.body,b=a.appendChild(b=document.createElement("div"));c.extend(b.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});c.support.minHeight=b.offsetHeight===100;c.support.selectstart="onselectstart"in b;a.removeChild(b).style.display="none"});c.extend(c.ui,{plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&
+a.element[0].parentNode)for(var e=0;e<b.length;e++)a.options[b[e][0]]&&b[e][1].apply(a.element,d)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(a,b){if(c(a).css("overflow")==="hidden")return false;b=b&&b==="left"?"scrollLeft":"scrollTop";var d=false;if(a[b]>0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a<b+d},isOver:function(a,b,d,e,h,i){return c.ui.isOverAxis(a,d,h)&&
+c.ui.isOverAxis(b,e,i)}})}})(jQuery);
+;/*!
+ * jQuery UI Widget 1.8.16
+ *
+ * Copyright 2011, 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(b,j){if(b.cleanData){var k=b.cleanData;b.cleanData=function(a){for(var c=0,d;(d=a[c])!=null;c++)try{b(d).triggerHandler("remove")}catch(e){}k(a)}}else{var l=b.fn.remove;b.fn.remove=function(a,c){return this.each(function(){if(!c)if(!a||b.filter(a,[this]).length)b("*",this).add([this]).each(function(){try{b(this).triggerHandler("remove")}catch(d){}});return l.call(b(this),a,c)})}}b.widget=function(a,c,d){var e=a.split(".")[0],f;a=a.split(".")[1];f=e+"-"+a;if(!d){d=c;c=b.Widget}b.expr[":"][f]=
+function(h){return!!b.data(h,a)};b[e]=b[e]||{};b[e][a]=function(h,g){arguments.length&&this._createWidget(h,g)};c=new c;c.options=b.extend(true,{},c.options);b[e][a].prototype=b.extend(true,c,{namespace:e,widgetName:a,widgetEventPrefix:b[e][a].prototype.widgetEventPrefix||a,widgetBaseClass:f},d);b.widget.bridge(a,b[e][a])};b.widget.bridge=function(a,c){b.fn[a]=function(d){var e=typeof d==="string",f=Array.prototype.slice.call(arguments,1),h=this;d=!e&&f.length?b.extend.apply(null,[true,d].concat(f)):
+d;if(e&&d.charAt(0)==="_")return h;e?this.each(function(){var g=b.data(this,a),i=g&&b.isFunction(g[d])?g[d].apply(g,f):g;if(i!==g&&i!==j){h=i;return false}}):this.each(function(){var g=b.data(this,a);g?g.option(d||{})._init():b.data(this,a,new c(d,this))});return h}};b.Widget=function(a,c){arguments.length&&this._createWidget(a,c)};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(a,c){b.data(c,this.widgetName,this);this.element=b(c);this.options=
+b.extend(true,{},this.options,this._getCreateOptions(),a);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return b.metadata&&b.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(a,c){var d=a;if(arguments.length===0)return b.extend({},this.options);if(typeof a==="string"){if(c===j)return this.options[a];d={};d[a]=c}this._setOptions(d);return this},_setOptions:function(a){var c=this;b.each(a,function(d,e){c._setOption(d,e)});return this},_setOption:function(a,c){this.options[a]=c;if(a==="disabled")this.widget()[c?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",
+c);return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(a,c,d){var e=this.options[a];c=b.Event(c);c.type=(a===this.widgetEventPrefix?a:this.widgetEventPrefix+a).toLowerCase();d=d||{};if(c.originalEvent){a=b.event.props.length;for(var f;a;){f=b.event.props[--a];c[f]=c.originalEvent[f]}}this.element.trigger(c,d);return!(b.isFunction(e)&&e.call(this.element[0],c,d)===false||c.isDefaultPrevented())}}})(jQuery);
+;/*!
+ * jQuery UI Mouse 1.8.16
+ *
+ * Copyright 2011, 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(b){var d=false;b(document).mouseup(function(){d=false});b.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var a=this;this.element.bind("mousedown."+this.widgetName,function(c){return a._mouseDown(c)}).bind("click."+this.widgetName,function(c){if(true===b.data(c.target,a.widgetName+".preventClickEvent")){b.removeData(c.target,a.widgetName+".preventClickEvent");c.stopImmediatePropagation();return false}});this.started=false},_mouseDestroy:function(){this.element.unbind("."+
+this.widgetName)},_mouseDown:function(a){if(!d){this._mouseStarted&&this._mouseUp(a);this._mouseDownEvent=a;var c=this,f=a.which==1,g=typeof this.options.cancel=="string"&&a.target.nodeName?b(a.target).closest(this.options.cancel).length:false;if(!f||g||!this._mouseCapture(a))return true;this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet)this._mouseDelayTimer=setTimeout(function(){c.mouseDelayMet=true},this.options.delay);if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a)){this._mouseStarted=
+this._mouseStart(a)!==false;if(!this._mouseStarted){a.preventDefault();return true}}true===b.data(a.target,this.widgetName+".preventClickEvent")&&b.removeData(a.target,this.widgetName+".preventClickEvent");this._mouseMoveDelegate=function(e){return c._mouseMove(e)};this._mouseUpDelegate=function(e){return c._mouseUp(e)};b(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);a.preventDefault();return d=true}},_mouseMove:function(a){if(b.browser.msie&&
+!(document.documentMode>=9)&&!a.button)return this._mouseUp(a);if(this._mouseStarted){this._mouseDrag(a);return a.preventDefault()}if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a))(this._mouseStarted=this._mouseStart(this._mouseDownEvent,a)!==false)?this._mouseDrag(a):this._mouseUp(a);return!this._mouseStarted},_mouseUp:function(a){b(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=
+false;a.target==this._mouseDownEvent.target&&b.data(a.target,this.widgetName+".preventClickEvent",true);this._mouseStop(a)}return false},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}})})(jQuery);
+;/*
+ * jQuery UI Position 1.8.16
+ *
+ * Copyright 2011, 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(c){c.ui=c.ui||{};var n=/left|center|right/,o=/top|center|bottom/,t=c.fn.position,u=c.fn.offset;c.fn.position=function(b){if(!b||!b.of)return t.apply(this,arguments);b=c.extend({},b);var a=c(b.of),d=a[0],g=(b.collision||"flip").split(" "),e=b.offset?b.offset.split(" "):[0,0],h,k,j;if(d.nodeType===9){h=a.width();k=a.height();j={top:0,left:0}}else if(d.setTimeout){h=a.width();k=a.height();j={top:a.scrollTop(),left:a.scrollLeft()}}else if(d.preventDefault){b.at="left top";h=k=0;j={top:b.of.pageY,
+left:b.of.pageX}}else{h=a.outerWidth();k=a.outerHeight();j=a.offset()}c.each(["my","at"],function(){var f=(b[this]||"").split(" ");if(f.length===1)f=n.test(f[0])?f.concat(["center"]):o.test(f[0])?["center"].concat(f):["center","center"];f[0]=n.test(f[0])?f[0]:"center";f[1]=o.test(f[1])?f[1]:"center";b[this]=f});if(g.length===1)g[1]=g[0];e[0]=parseInt(e[0],10)||0;if(e.length===1)e[1]=e[0];e[1]=parseInt(e[1],10)||0;if(b.at[0]==="right")j.left+=h;else if(b.at[0]==="center")j.left+=h/2;if(b.at[1]==="bottom")j.top+=
+k;else if(b.at[1]==="center")j.top+=k/2;j.left+=e[0];j.top+=e[1];return this.each(function(){var f=c(this),l=f.outerWidth(),m=f.outerHeight(),p=parseInt(c.curCSS(this,"marginLeft",true))||0,q=parseInt(c.curCSS(this,"marginTop",true))||0,v=l+p+(parseInt(c.curCSS(this,"marginRight",true))||0),w=m+q+(parseInt(c.curCSS(this,"marginBottom",true))||0),i=c.extend({},j),r;if(b.my[0]==="right")i.left-=l;else if(b.my[0]==="center")i.left-=l/2;if(b.my[1]==="bottom")i.top-=m;else if(b.my[1]==="center")i.top-=
+m/2;i.left=Math.round(i.left);i.top=Math.round(i.top);r={left:i.left-p,top:i.top-q};c.each(["left","top"],function(s,x){c.ui.position[g[s]]&&c.ui.position[g[s]][x](i,{targetWidth:h,targetHeight:k,elemWidth:l,elemHeight:m,collisionPosition:r,collisionWidth:v,collisionHeight:w,offset:e,my:b.my,at:b.at})});c.fn.bgiframe&&f.bgiframe();f.offset(c.extend(i,{using:b.using}))})};c.ui.position={fit:{left:function(b,a){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();b.left=
+d>0?b.left-d:Math.max(b.left-a.collisionPosition.left,b.left)},top:function(b,a){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();b.top=d>0?b.top-d:Math.max(b.top-a.collisionPosition.top,b.top)}},flip:{left:function(b,a){if(a.at[0]!=="center"){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();var g=a.my[0]==="left"?-a.elemWidth:a.my[0]==="right"?a.elemWidth:0,e=a.at[0]==="left"?a.targetWidth:-a.targetWidth,h=-2*a.offset[0];b.left+=
+a.collisionPosition.left<0?g+e+h:d>0?g+e+h:0}},top:function(b,a){if(a.at[1]!=="center"){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();var g=a.my[1]==="top"?-a.elemHeight:a.my[1]==="bottom"?a.elemHeight:0,e=a.at[1]==="top"?a.targetHeight:-a.targetHeight,h=-2*a.offset[1];b.top+=a.collisionPosition.top<0?g+e+h:d>0?g+e+h:0}}}};if(!c.offset.setOffset){c.offset.setOffset=function(b,a){if(/static/.test(c.curCSS(b,"position")))b.style.position="relative";var d=c(b),
+g=d.offset(),e=parseInt(c.curCSS(b,"top",true),10)||0,h=parseInt(c.curCSS(b,"left",true),10)||0;g={top:a.top-g.top+e,left:a.left-g.left+h};"using"in a?a.using.call(b,g):d.css(g)};c.fn.offset=function(b){var a=this[0];if(!a||!a.ownerDocument)return null;if(b)return this.each(function(){c.offset.setOffset(this,b)});return u.call(this)}}})(jQuery);
+;/*
+ * jQuery UI Draggable 1.8.16
+ *
+ * Copyright 2011, 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(d){d.widget("ui.draggable",d.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:true,appendTo:"parent",axis:false,connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false},_create:function(){if(this.options.helper==
+"original"&&!/^(?: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(){if(this.element.data("draggable")){this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy();return this}},_mouseCapture:function(a){var b=
+this.options;if(this.helper||b.disabled||d(a.target).is(".ui-resizable-handle"))return false;this.handle=this._getHandle(a);if(!this.handle)return false;if(b.iframeFix)d(b.iframeFix===true?"iframe":b.iframeFix).each(function(){d('<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(d(this).offset()).appendTo("body")});return true},_mouseStart:function(a){var b=this.options;
+this.helper=this._createHelper(a);this._cacheHelperProportions();if(d.ui.ddmanager)d.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};d.extend(this.offset,{click:{left:a.pageX-this.offset.left,top:a.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});
+this.originalPosition=this.position=this._generatePosition(a);this.originalPageX=a.pageX;this.originalPageY=a.pageY;b.cursorAt&&this._adjustOffsetFromHelper(b.cursorAt);b.containment&&this._setContainment();if(this._trigger("start",a)===false){this._clear();return false}this._cacheHelperProportions();d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,a);this.helper.addClass("ui-draggable-dragging");this._mouseDrag(a,true);d.ui.ddmanager&&d.ui.ddmanager.dragStart(this,a);return true},
+_mouseDrag:function(a,b){this.position=this._generatePosition(a);this.positionAbs=this._convertPositionTo("absolute");if(!b){b=this._uiHash();if(this._trigger("drag",a,b)===false){this._mouseUp({});return false}this.position=b.position}if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";d.ui.ddmanager&&d.ui.ddmanager.drag(this,a);return false},_mouseStop:function(a){var b=
+false;if(d.ui.ddmanager&&!this.options.dropBehaviour)b=d.ui.ddmanager.drop(this,a);if(this.dropped){b=this.dropped;this.dropped=false}if((!this.element[0]||!this.element[0].parentNode)&&this.options.helper=="original")return false;if(this.options.revert=="invalid"&&!b||this.options.revert=="valid"&&b||this.options.revert===true||d.isFunction(this.options.revert)&&this.options.revert.call(this.element,b)){var c=this;d(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,
+10),function(){c._trigger("stop",a)!==false&&c._clear()})}else this._trigger("stop",a)!==false&&this._clear();return false},_mouseUp:function(a){this.options.iframeFix===true&&d("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)});d.ui.ddmanager&&d.ui.ddmanager.dragStop(this,a);return d.ui.mouse.prototype._mouseUp.call(this,a)},cancel:function(){this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear();return this},_getHandle:function(a){var b=!this.options.handle||
+!d(this.options.handle,this.element).length?true:false;d(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==a.target)b=true});return b},_createHelper:function(a){var b=this.options;a=d.isFunction(b.helper)?d(b.helper.apply(this.element[0],[a])):b.helper=="clone"?this.element.clone().removeAttr("id"):this.element;a.parents("body").length||a.appendTo(b.appendTo=="parent"?this.element[0].parentNode:b.appendTo);a[0]!=this.element[0]&&!/(fixed|absolute)/.test(a.css("position"))&&
+a.css("position","absolute");return a},_adjustOffsetFromHelper:function(a){if(typeof a=="string")a=a.split(" ");if(d.isArray(a))a={left:+a[0],top:+a[1]||0};if("left"in a)this.offset.click.left=a.left+this.margins.left;if("right"in a)this.offset.click.left=this.helperProportions.width-a.right+this.margins.left;if("top"in a)this.offset.click.top=a.top+this.margins.top;if("bottom"in a)this.offset.click.top=this.helperProportions.height-a.bottom+this.margins.top},_getParentOffset:function(){this.offsetParent=
+this.helper.offsetParent();var a=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0])){a.left+=this.scrollParent.scrollLeft();a.top+=this.scrollParent.scrollTop()}if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&d.browser.msie)a={top:0,left:0};return{top:a.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:a.left+(parseInt(this.offsetParent.css("borderLeftWidth"),
+10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.element.position();return{top:a.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else 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 a=this.options;if(a.containment=="parent")a.containment=this.helper[0].parentNode;if(a.containment=="document"||a.containment=="window")this.containment=[a.containment=="document"?0:d(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,a.containment=="document"?0:d(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,
+(a.containment=="document"?0:d(window).scrollLeft())+d(a.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(a.containment=="document"?0:d(window).scrollTop())+(d(a.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(a.containment)&&a.containment.constructor!=Array){a=d(a.containment);var b=a[0];if(b){a.offset();var c=d(b).css("overflow")!=
+"hidden";this.containment=[(parseInt(d(b).css("borderLeftWidth"),10)||0)+(parseInt(d(b).css("paddingLeft"),10)||0),(parseInt(d(b).css("borderTopWidth"),10)||0)+(parseInt(d(b).css("paddingTop"),10)||0),(c?Math.max(b.scrollWidth,b.offsetWidth):b.offsetWidth)-(parseInt(d(b).css("borderLeftWidth"),10)||0)-(parseInt(d(b).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(c?Math.max(b.scrollHeight,b.offsetHeight):b.offsetHeight)-(parseInt(d(b).css("borderTopWidth"),
+10)||0)-(parseInt(d(b).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom];this.relative_container=a}}else if(a.containment.constructor==Array)this.containment=a.containment},_convertPositionTo:function(a,b){if(!b)b=this.position;a=a=="absolute"?1:-1;var c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(c[0].tagName);return{top:b.top+
+this.offset.relative.top*a+this.offset.parent.top*a-(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():f?0:c.scrollTop())*a),left:b.left+this.offset.relative.left*a+this.offset.parent.left*a-(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():f?0:c.scrollLeft())*a)}},_generatePosition:function(a){var b=this.options,c=this.cssPosition=="absolute"&&
+!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(c[0].tagName),e=a.pageX,h=a.pageY;if(this.originalPosition){var g;if(this.containment){if(this.relative_container){g=this.relative_container.offset();g=[this.containment[0]+g.left,this.containment[1]+g.top,this.containment[2]+g.left,this.containment[3]+g.top]}else g=this.containment;if(a.pageX-this.offset.click.left<g[0])e=g[0]+this.offset.click.left;
+if(a.pageY-this.offset.click.top<g[1])h=g[1]+this.offset.click.top;if(a.pageX-this.offset.click.left>g[2])e=g[2]+this.offset.click.left;if(a.pageY-this.offset.click.top>g[3])h=g[3]+this.offset.click.top}if(b.grid){h=b.grid[1]?this.originalPageY+Math.round((h-this.originalPageY)/b.grid[1])*b.grid[1]:this.originalPageY;h=g?!(h-this.offset.click.top<g[1]||h-this.offset.click.top>g[3])?h:!(h-this.offset.click.top<g[1])?h-b.grid[1]:h+b.grid[1]:h;e=b.grid[0]?this.originalPageX+Math.round((e-this.originalPageX)/
+b.grid[0])*b.grid[0]:this.originalPageX;e=g?!(e-this.offset.click.left<g[0]||e-this.offset.click.left>g[2])?e:!(e-this.offset.click.left<g[0])?e-b.grid[0]:e+b.grid[0]:e}}return{top:h-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollTop():f?0:c.scrollTop()),left:e-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(d.browser.safari&&d.browser.version<
+526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():f?0:c.scrollLeft())}},_clear:function(){this.helper.removeClass("ui-draggable-dragging");this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval&&this.helper.remove();this.helper=null;this.cancelHelperRemoval=false},_trigger:function(a,b,c){c=c||this._uiHash();d.ui.plugin.call(this,a,[b,c]);if(a=="drag")this.positionAbs=this._convertPositionTo("absolute");return d.Widget.prototype._trigger.call(this,a,b,
+c)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}});d.extend(d.ui.draggable,{version:"1.8.16"});d.ui.plugin.add("draggable","connectToSortable",{start:function(a,b){var c=d(this).data("draggable"),f=c.options,e=d.extend({},b,{item:c.element});c.sortables=[];d(f.connectToSortable).each(function(){var h=d.data(this,"sortable");if(h&&!h.options.disabled){c.sortables.push({instance:h,shouldRevert:h.options.revert});
+h.refreshPositions();h._trigger("activate",a,e)}})},stop:function(a,b){var c=d(this).data("draggable"),f=d.extend({},b,{item:c.element});d.each(c.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;c.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=false;if(this.shouldRevert)this.instance.options.revert=true;this.instance._mouseStop(a);this.instance.options.helper=this.instance.options._helper;c.options.helper=="original"&&this.instance.currentItem.css({top:"auto",left:"auto"})}else{this.instance.cancelHelperRemoval=
+false;this.instance._trigger("deactivate",a,f)}})},drag:function(a,b){var c=d(this).data("draggable"),f=this;d.each(c.sortables,function(){this.instance.positionAbs=c.positionAbs;this.instance.helperProportions=c.helperProportions;this.instance.offset.click=c.offset.click;if(this.instance._intersectsWith(this.instance.containerCache)){if(!this.instance.isOver){this.instance.isOver=1;this.instance.currentItem=d(f).clone().removeAttr("id").appendTo(this.instance.element).data("sortable-item",true);
+this.instance.options._helper=this.instance.options.helper;this.instance.options.helper=function(){return b.helper[0]};a.target=this.instance.currentItem[0];this.instance._mouseCapture(a,true);this.instance._mouseStart(a,true,true);this.instance.offset.click.top=c.offset.click.top;this.instance.offset.click.left=c.offset.click.left;this.instance.offset.parent.left-=c.offset.parent.left-this.instance.offset.parent.left;this.instance.offset.parent.top-=c.offset.parent.top-this.instance.offset.parent.top;
+c._trigger("toSortable",a);c.dropped=this.instance.element;c.currentItem=c.element;this.instance.fromOutside=c}this.instance.currentItem&&this.instance._mouseDrag(a)}else if(this.instance.isOver){this.instance.isOver=0;this.instance.cancelHelperRemoval=true;this.instance.options.revert=false;this.instance._trigger("out",a,this.instance._uiHash(this.instance));this.instance._mouseStop(a,true);this.instance.options.helper=this.instance.options._helper;this.instance.currentItem.remove();this.instance.placeholder&&
+this.instance.placeholder.remove();c._trigger("fromSortable",a);c.dropped=false}})}});d.ui.plugin.add("draggable","cursor",{start:function(){var a=d("body"),b=d(this).data("draggable").options;if(a.css("cursor"))b._cursor=a.css("cursor");a.css("cursor",b.cursor)},stop:function(){var a=d(this).data("draggable").options;a._cursor&&d("body").css("cursor",a._cursor)}});d.ui.plugin.add("draggable","opacity",{start:function(a,b){a=d(b.helper);b=d(this).data("draggable").options;if(a.css("opacity"))b._opacity=
+a.css("opacity");a.css("opacity",b.opacity)},stop:function(a,b){a=d(this).data("draggable").options;a._opacity&&d(b.helper).css("opacity",a._opacity)}});d.ui.plugin.add("draggable","scroll",{start:function(){var a=d(this).data("draggable");if(a.scrollParent[0]!=document&&a.scrollParent[0].tagName!="HTML")a.overflowOffset=a.scrollParent.offset()},drag:function(a){var b=d(this).data("draggable"),c=b.options,f=false;if(b.scrollParent[0]!=document&&b.scrollParent[0].tagName!="HTML"){if(!c.axis||c.axis!=
+"x")if(b.overflowOffset.top+b.scrollParent[0].offsetHeight-a.pageY<c.scrollSensitivity)b.scrollParent[0].scrollTop=f=b.scrollParent[0].scrollTop+c.scrollSpeed;else if(a.pageY-b.overflowOffset.top<c.scrollSensitivity)b.scrollParent[0].scrollTop=f=b.scrollParent[0].scrollTop-c.scrollSpeed;if(!c.axis||c.axis!="y")if(b.overflowOffset.left+b.scrollParent[0].offsetWidth-a.pageX<c.scrollSensitivity)b.scrollParent[0].scrollLeft=f=b.scrollParent[0].scrollLeft+c.scrollSpeed;else if(a.pageX-b.overflowOffset.left<
+c.scrollSensitivity)b.scrollParent[0].scrollLeft=f=b.scrollParent[0].scrollLeft-c.scrollSpeed}else{if(!c.axis||c.axis!="x")if(a.pageY-d(document).scrollTop()<c.scrollSensitivity)f=d(document).scrollTop(d(document).scrollTop()-c.scrollSpeed);else if(d(window).height()-(a.pageY-d(document).scrollTop())<c.scrollSensitivity)f=d(document).scrollTop(d(document).scrollTop()+c.scrollSpeed);if(!c.axis||c.axis!="y")if(a.pageX-d(document).scrollLeft()<c.scrollSensitivity)f=d(document).scrollLeft(d(document).scrollLeft()-
+c.scrollSpeed);else if(d(window).width()-(a.pageX-d(document).scrollLeft())<c.scrollSensitivity)f=d(document).scrollLeft(d(document).scrollLeft()+c.scrollSpeed)}f!==false&&d.ui.ddmanager&&!c.dropBehaviour&&d.ui.ddmanager.prepareOffsets(b,a)}});d.ui.plugin.add("draggable","snap",{start:function(){var a=d(this).data("draggable"),b=a.options;a.snapElements=[];d(b.snap.constructor!=String?b.snap.items||":data(draggable)":b.snap).each(function(){var c=d(this),f=c.offset();this!=a.element[0]&&a.snapElements.push({item:this,
+width:c.outerWidth(),height:c.outerHeight(),top:f.top,left:f.left})})},drag:function(a,b){for(var c=d(this).data("draggable"),f=c.options,e=f.snapTolerance,h=b.offset.left,g=h+c.helperProportions.width,n=b.offset.top,o=n+c.helperProportions.height,i=c.snapElements.length-1;i>=0;i--){var j=c.snapElements[i].left,l=j+c.snapElements[i].width,k=c.snapElements[i].top,m=k+c.snapElements[i].height;if(j-e<h&&h<l+e&&k-e<n&&n<m+e||j-e<h&&h<l+e&&k-e<o&&o<m+e||j-e<g&&g<l+e&&k-e<n&&n<m+e||j-e<g&&g<l+e&&k-e<o&&
+o<m+e){if(f.snapMode!="inner"){var p=Math.abs(k-o)<=e,q=Math.abs(m-n)<=e,r=Math.abs(j-g)<=e,s=Math.abs(l-h)<=e;if(p)b.position.top=c._convertPositionTo("relative",{top:k-c.helperProportions.height,left:0}).top-c.margins.top;if(q)b.position.top=c._convertPositionTo("relative",{top:m,left:0}).top-c.margins.top;if(r)b.position.left=c._convertPositionTo("relative",{top:0,left:j-c.helperProportions.width}).left-c.margins.left;if(s)b.position.left=c._convertPositionTo("relative",{top:0,left:l}).left-c.margins.left}var t=
+p||q||r||s;if(f.snapMode!="outer"){p=Math.abs(k-n)<=e;q=Math.abs(m-o)<=e;r=Math.abs(j-h)<=e;s=Math.abs(l-g)<=e;if(p)b.position.top=c._convertPositionTo("relative",{top:k,left:0}).top-c.margins.top;if(q)b.position.top=c._convertPositionTo("relative",{top:m-c.helperProportions.height,left:0}).top-c.margins.top;if(r)b.position.left=c._convertPositionTo("relative",{top:0,left:j}).left-c.margins.left;if(s)b.position.left=c._convertPositionTo("relative",{top:0,left:l-c.helperProportions.width}).left-c.margins.left}if(!c.snapElements[i].snapping&&
+(p||q||r||s||t))c.options.snap.snap&&c.options.snap.snap.call(c.element,a,d.extend(c._uiHash(),{snapItem:c.snapElements[i].item}));c.snapElements[i].snapping=p||q||r||s||t}else{c.snapElements[i].snapping&&c.options.snap.release&&c.options.snap.release.call(c.element,a,d.extend(c._uiHash(),{snapItem:c.snapElements[i].item}));c.snapElements[i].snapping=false}}}});d.ui.plugin.add("draggable","stack",{start:function(){var a=d(this).data("draggable").options;a=d.makeArray(d(a.stack)).sort(function(c,f){return(parseInt(d(c).css("zIndex"),
+10)||0)-(parseInt(d(f).css("zIndex"),10)||0)});if(a.length){var b=parseInt(a[0].style.zIndex)||0;d(a).each(function(c){this.style.zIndex=b+c});this[0].style.zIndex=b+a.length}}});d.ui.plugin.add("draggable","zIndex",{start:function(a,b){a=d(b.helper);b=d(this).data("draggable").options;if(a.css("zIndex"))b._zIndex=a.css("zIndex");a.css("zIndex",b.zIndex)},stop:function(a,b){a=d(this).data("draggable").options;a._zIndex&&d(b.helper).css("zIndex",a._zIndex)}})})(jQuery);
+;/*
+ * jQuery UI Droppable 1.8.16
+ *
+ * Copyright 2011, 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/Droppables
+ *
+ * Depends:
+ *	jquery.ui.core.js
+ *	jquery.ui.widget.js
+ *	jquery.ui.mouse.js
+ *	jquery.ui.draggable.js
+ */
+(function(d){d.widget("ui.droppable",{widgetEventPrefix:"drop",options:{accept:"*",activeClass:false,addClasses:true,greedy:false,hoverClass:false,scope:"default",tolerance:"intersect"},_create:function(){var a=this.options,b=a.accept;this.isover=0;this.isout=1;this.accept=d.isFunction(b)?b:function(c){return c.is(b)};this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};d.ui.ddmanager.droppables[a.scope]=d.ui.ddmanager.droppables[a.scope]||[];d.ui.ddmanager.droppables[a.scope].push(this);
+a.addClasses&&this.element.addClass("ui-droppable")},destroy:function(){for(var a=d.ui.ddmanager.droppables[this.options.scope],b=0;b<a.length;b++)a[b]==this&&a.splice(b,1);this.element.removeClass("ui-droppable ui-droppable-disabled").removeData("droppable").unbind(".droppable");return this},_setOption:function(a,b){if(a=="accept")this.accept=d.isFunction(b)?b:function(c){return c.is(b)};d.Widget.prototype._setOption.apply(this,arguments)},_activate:function(a){var b=d.ui.ddmanager.current;this.options.activeClass&&
+this.element.addClass(this.options.activeClass);b&&this._trigger("activate",a,this.ui(b))},_deactivate:function(a){var b=d.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass);b&&this._trigger("deactivate",a,this.ui(b))},_over:function(a){var b=d.ui.ddmanager.current;if(!(!b||(b.currentItem||b.element)[0]==this.element[0]))if(this.accept.call(this.element[0],b.currentItem||b.element)){this.options.hoverClass&&this.element.addClass(this.options.hoverClass);
+this._trigger("over",a,this.ui(b))}},_out:function(a){var b=d.ui.ddmanager.current;if(!(!b||(b.currentItem||b.element)[0]==this.element[0]))if(this.accept.call(this.element[0],b.currentItem||b.element)){this.options.hoverClass&&this.element.removeClass(this.options.hoverClass);this._trigger("out",a,this.ui(b))}},_drop:function(a,b){var c=b||d.ui.ddmanager.current;if(!c||(c.currentItem||c.element)[0]==this.element[0])return false;var e=false;this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function(){var g=
+d.data(this,"droppable");if(g.options.greedy&&!g.options.disabled&&g.options.scope==c.options.scope&&g.accept.call(g.element[0],c.currentItem||c.element)&&d.ui.intersect(c,d.extend(g,{offset:g.element.offset()}),g.options.tolerance)){e=true;return false}});if(e)return false;if(this.accept.call(this.element[0],c.currentItem||c.element)){this.options.activeClass&&this.element.removeClass(this.options.activeClass);this.options.hoverClass&&this.element.removeClass(this.options.hoverClass);this._trigger("drop",
+a,this.ui(c));return this.element}return false},ui:function(a){return{draggable:a.currentItem||a.element,helper:a.helper,position:a.position,offset:a.positionAbs}}});d.extend(d.ui.droppable,{version:"1.8.16"});d.ui.intersect=function(a,b,c){if(!b.offset)return false;var e=(a.positionAbs||a.position.absolute).left,g=e+a.helperProportions.width,f=(a.positionAbs||a.position.absolute).top,h=f+a.helperProportions.height,i=b.offset.left,k=i+b.proportions.width,j=b.offset.top,l=j+b.proportions.height;
+switch(c){case "fit":return i<=e&&g<=k&&j<=f&&h<=l;case "intersect":return i<e+a.helperProportions.width/2&&g-a.helperProportions.width/2<k&&j<f+a.helperProportions.height/2&&h-a.helperProportions.height/2<l;case "pointer":return d.ui.isOver((a.positionAbs||a.position.absolute).top+(a.clickOffset||a.offset.click).top,(a.positionAbs||a.position.absolute).left+(a.clickOffset||a.offset.click).left,j,i,b.proportions.height,b.proportions.width);case "touch":return(f>=j&&f<=l||h>=j&&h<=l||f<j&&h>l)&&(e>=
+i&&e<=k||g>=i&&g<=k||e<i&&g>k);default:return false}};d.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(a,b){var c=d.ui.ddmanager.droppables[a.options.scope]||[],e=b?b.type:null,g=(a.currentItem||a.element).find(":data(droppable)").andSelf(),f=0;a:for(;f<c.length;f++)if(!(c[f].options.disabled||a&&!c[f].accept.call(c[f].element[0],a.currentItem||a.element))){for(var h=0;h<g.length;h++)if(g[h]==c[f].element[0]){c[f].proportions.height=0;continue a}c[f].visible=c[f].element.css("display")!=
+"none";if(c[f].visible){e=="mousedown"&&c[f]._activate.call(c[f],b);c[f].offset=c[f].element.offset();c[f].proportions={width:c[f].element[0].offsetWidth,height:c[f].element[0].offsetHeight}}}},drop:function(a,b){var c=false;d.each(d.ui.ddmanager.droppables[a.options.scope]||[],function(){if(this.options){if(!this.options.disabled&&this.visible&&d.ui.intersect(a,this,this.options.tolerance))c=c||this._drop.call(this,b);if(!this.options.disabled&&this.visible&&this.accept.call(this.element[0],a.currentItem||
+a.element)){this.isout=1;this.isover=0;this._deactivate.call(this,b)}}});return c},dragStart:function(a,b){a.element.parents(":not(body,html)").bind("scroll.droppable",function(){a.options.refreshPositions||d.ui.ddmanager.prepareOffsets(a,b)})},drag:function(a,b){a.options.refreshPositions&&d.ui.ddmanager.prepareOffsets(a,b);d.each(d.ui.ddmanager.droppables[a.options.scope]||[],function(){if(!(this.options.disabled||this.greedyChild||!this.visible)){var c=d.ui.intersect(a,this,this.options.tolerance);
+if(c=!c&&this.isover==1?"isout":c&&this.isover==0?"isover":null){var e;if(this.options.greedy){var g=this.element.parents(":data(droppable):eq(0)");if(g.length){e=d.data(g[0],"droppable");e.greedyChild=c=="isover"?1:0}}if(e&&c=="isover"){e.isover=0;e.isout=1;e._out.call(e,b)}this[c]=1;this[c=="isout"?"isover":"isout"]=0;this[c=="isover"?"_over":"_out"].call(this,b);if(e&&c=="isout"){e.isout=0;e.isover=1;e._over.call(e,b)}}}})},dragStop:function(a,b){a.element.parents(":not(body,html)").unbind("scroll.droppable");
+a.options.refreshPositions||d.ui.ddmanager.prepareOffsets(a,b)}}})(jQuery);
+;/*
+ * jQuery UI Resizable 1.8.16
+ *
+ * Copyright 2011, 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(e){e.widget("ui.resizable",e.ui.mouse,{widgetEventPrefix:"resize",options:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,containment:false,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1E3},_create:function(){var b=this,a=this.options;this.element.addClass("ui-resizable");e.extend(this,{_aspectRatio:!!a.aspectRatio,aspectRatio:a.aspectRatio,originalElement:this.element,
+_proportionallyResizeElements:[],_helper:a.helper||a.ghost||a.animate?a.helper||"ui-resizable-helper":null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){/relative/.test(this.element.css("position"))&&e.browser.opera&&this.element.css({position:"relative",top:"auto",left:"auto"});this.element.wrap(e('<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")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;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});this.originalResizeStyle=
+this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=a.handles||(!e(".ui-resizable-handle",this.element).length?"e,s,se":{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"});if(this.handles.constructor==String){if(this.handles=="all")this.handles="n,e,s,w,se,sw,ne,nw";var c=this.handles.split(",");this.handles={};for(var d=0;d<c.length;d++){var f=e.trim(c[d]),g=e('<div class="ui-resizable-handle '+("ui-resizable-"+f)+'"></div>');/sw|se|ne|nw/.test(f)&&g.css({zIndex:++a.zIndex});"se"==f&&g.addClass("ui-icon ui-icon-gripsmall-diagonal-se");this.handles[f]=".ui-resizable-"+f;this.element.append(g)}}this._renderAxis=function(h){h=h||this.element;for(var i in this.handles){if(this.handles[i].constructor==
+String)this.handles[i]=e(this.handles[i],this.element).show();if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var j=e(this.handles[i],this.element),l=0;l=/sw|ne|nw|se|n|s/.test(i)?j.outerHeight():j.outerWidth();j=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join("");h.css(j,l);this._proportionallyResize()}e(this.handles[i])}};this._renderAxis(this.element);this._handles=e(".ui-resizable-handle",this.element).disableSelection();
+this._handles.mouseover(function(){if(!b.resizing){if(this.className)var h=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);b.axis=h&&h[1]?h[1]:"se"}});if(a.autoHide){this._handles.hide();e(this.element).addClass("ui-resizable-autohide").hover(function(){if(!a.disabled){e(this).removeClass("ui-resizable-autohide");b._handles.show()}},function(){if(!a.disabled)if(!b.resizing){e(this).addClass("ui-resizable-autohide");b._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy();
+var b=function(c){e(c).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){b(this.element);var a=this.element;a.after(this.originalElement.css({position:a.css("position"),width:a.outerWidth(),height:a.outerHeight(),top:a.css("top"),left:a.css("left")})).remove()}this.originalElement.css("resize",this.originalResizeStyle);b(this.originalElement);return this},_mouseCapture:function(b){var a=
+false;for(var c in this.handles)if(e(this.handles[c])[0]==b.target)a=true;return!this.options.disabled&&a},_mouseStart:function(b){var a=this.options,c=this.element.position(),d=this.element;this.resizing=true;this.documentScroll={top:e(document).scrollTop(),left:e(document).scrollLeft()};if(d.is(".ui-draggable")||/absolute/.test(d.css("position")))d.css({position:"absolute",top:c.top,left:c.left});e.browser.opera&&/relative/.test(d.css("position"))&&d.css({position:"relative",top:"auto",left:"auto"});
+this._renderProxy();c=m(this.helper.css("left"));var f=m(this.helper.css("top"));if(a.containment){c+=e(a.containment).scrollLeft()||0;f+=e(a.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:c,top:f};this.size=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalSize=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalPosition={left:c,top:f};this.sizeDiff=
+{width:d.outerWidth()-d.width(),height:d.outerHeight()-d.height()};this.originalMousePosition={left:b.pageX,top:b.pageY};this.aspectRatio=typeof a.aspectRatio=="number"?a.aspectRatio:this.originalSize.width/this.originalSize.height||1;a=e(".ui-resizable-"+this.axis).css("cursor");e("body").css("cursor",a=="auto"?this.axis+"-resize":a);d.addClass("ui-resizable-resizing");this._propagate("start",b);return true},_mouseDrag:function(b){var a=this.helper,c=this.originalMousePosition,d=this._change[this.axis];
+if(!d)return false;c=d.apply(this,[b,b.pageX-c.left||0,b.pageY-c.top||0]);this._updateVirtualBoundaries(b.shiftKey);if(this._aspectRatio||b.shiftKey)c=this._updateRatio(c,b);c=this._respectSize(c,b);this._propagate("resize",b);a.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(c);this._trigger("resize",b,this.ui());return false},
+_mouseStop:function(b){this.resizing=false;var a=this.options,c=this;if(this._helper){var d=this._proportionallyResizeElements,f=d.length&&/textarea/i.test(d[0].nodeName);d=f&&e.ui.hasScroll(d[0],"left")?0:c.sizeDiff.height;f=f?0:c.sizeDiff.width;f={width:c.helper.width()-f,height:c.helper.height()-d};d=parseInt(c.element.css("left"),10)+(c.position.left-c.originalPosition.left)||null;var g=parseInt(c.element.css("top"),10)+(c.position.top-c.originalPosition.top)||null;a.animate||this.element.css(e.extend(f,
+{top:g,left:d}));c.helper.height(c.size.height);c.helper.width(c.size.width);this._helper&&!a.animate&&this._proportionallyResize()}e("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop",b);this._helper&&this.helper.remove();return false},_updateVirtualBoundaries:function(b){var a=this.options,c,d,f;a={minWidth:k(a.minWidth)?a.minWidth:0,maxWidth:k(a.maxWidth)?a.maxWidth:Infinity,minHeight:k(a.minHeight)?a.minHeight:0,maxHeight:k(a.maxHeight)?a.maxHeight:
+Infinity};if(this._aspectRatio||b){b=a.minHeight*this.aspectRatio;d=a.minWidth/this.aspectRatio;c=a.maxHeight*this.aspectRatio;f=a.maxWidth/this.aspectRatio;if(b>a.minWidth)a.minWidth=b;if(d>a.minHeight)a.minHeight=d;if(c<a.maxWidth)a.maxWidth=c;if(f<a.maxHeight)a.maxHeight=f}this._vBoundaries=a},_updateCache:function(b){this.offset=this.helper.offset();if(k(b.left))this.position.left=b.left;if(k(b.top))this.position.top=b.top;if(k(b.height))this.size.height=b.height;if(k(b.width))this.size.width=
+b.width},_updateRatio:function(b){var a=this.position,c=this.size,d=this.axis;if(k(b.height))b.width=b.height*this.aspectRatio;else if(k(b.width))b.height=b.width/this.aspectRatio;if(d=="sw"){b.left=a.left+(c.width-b.width);b.top=null}if(d=="nw"){b.top=a.top+(c.height-b.height);b.left=a.left+(c.width-b.width)}return b},_respectSize:function(b){var a=this._vBoundaries,c=this.axis,d=k(b.width)&&a.maxWidth&&a.maxWidth<b.width,f=k(b.height)&&a.maxHeight&&a.maxHeight<b.height,g=k(b.width)&&a.minWidth&&
+a.minWidth>b.width,h=k(b.height)&&a.minHeight&&a.minHeight>b.height;if(g)b.width=a.minWidth;if(h)b.height=a.minHeight;if(d)b.width=a.maxWidth;if(f)b.height=a.maxHeight;var i=this.originalPosition.left+this.originalSize.width,j=this.position.top+this.size.height,l=/sw|nw|w/.test(c);c=/nw|ne|n/.test(c);if(g&&l)b.left=i-a.minWidth;if(d&&l)b.left=i-a.maxWidth;if(h&&c)b.top=j-a.minHeight;if(f&&c)b.top=j-a.maxHeight;if((a=!b.width&&!b.height)&&!b.left&&b.top)b.top=null;else if(a&&!b.top&&b.left)b.left=
+null;return b},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var b=this.helper||this.element,a=0;a<this._proportionallyResizeElements.length;a++){var c=this._proportionallyResizeElements[a];if(!this.borderDif){var d=[c.css("borderTopWidth"),c.css("borderRightWidth"),c.css("borderBottomWidth"),c.css("borderLeftWidth")],f=[c.css("paddingTop"),c.css("paddingRight"),c.css("paddingBottom"),c.css("paddingLeft")];this.borderDif=e.map(d,function(g,h){g=parseInt(g,10)||
+0;h=parseInt(f[h],10)||0;return g+h})}e.browser.msie&&(e(b).is(":hidden")||e(b).parents(":hidden").length)||c.css({height:b.height()-this.borderDif[0]-this.borderDif[2]||0,width:b.width()-this.borderDif[1]-this.borderDif[3]||0})}},_renderProxy:function(){var b=this.options;this.elementOffset=this.element.offset();if(this._helper){this.helper=this.helper||e('<div style="overflow:hidden;"></div>');var a=e.browser.msie&&e.browser.version<7,c=a?1:0;a=a?2:-1;this.helper.addClass(this._helper).css({width:this.element.outerWidth()+
+a,height:this.element.outerHeight()+a,position:"absolute",left:this.elementOffset.left-c+"px",top:this.elementOffset.top-c+"px",zIndex:++b.zIndex});this.helper.appendTo("body").disableSelection()}else this.helper=this.element},_change:{e:function(b,a){return{width:this.originalSize.width+a}},w:function(b,a){return{left:this.originalPosition.left+a,width:this.originalSize.width-a}},n:function(b,a,c){return{top:this.originalPosition.top+c,height:this.originalSize.height-c}},s:function(b,a,c){return{height:this.originalSize.height+
+c}},se:function(b,a,c){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[b,a,c]))},sw:function(b,a,c){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[b,a,c]))},ne:function(b,a,c){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[b,a,c]))},nw:function(b,a,c){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[b,a,c]))}},_propagate:function(b,a){e.ui.plugin.call(this,b,[a,this.ui()]);
+b!="resize"&&this._trigger(b,a,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}}});e.extend(e.ui.resizable,{version:"1.8.16"});e.ui.plugin.add("resizable","alsoResize",{start:function(){var b=e(this).data("resizable").options,a=function(c){e(c).each(function(){var d=e(this);d.data("resizable-alsoresize",{width:parseInt(d.width(),
+10),height:parseInt(d.height(),10),left:parseInt(d.css("left"),10),top:parseInt(d.css("top"),10),position:d.css("position")})})};if(typeof b.alsoResize=="object"&&!b.alsoResize.parentNode)if(b.alsoResize.length){b.alsoResize=b.alsoResize[0];a(b.alsoResize)}else e.each(b.alsoResize,function(c){a(c)});else a(b.alsoResize)},resize:function(b,a){var c=e(this).data("resizable");b=c.options;var d=c.originalSize,f=c.originalPosition,g={height:c.size.height-d.height||0,width:c.size.width-d.width||0,top:c.position.top-
+f.top||0,left:c.position.left-f.left||0},h=function(i,j){e(i).each(function(){var l=e(this),q=e(this).data("resizable-alsoresize"),p={},r=j&&j.length?j:l.parents(a.originalElement[0]).length?["width","height"]:["width","height","top","left"];e.each(r,function(n,o){if((n=(q[o]||0)+(g[o]||0))&&n>=0)p[o]=n||null});if(e.browser.opera&&/relative/.test(l.css("position"))){c._revertToRelativePosition=true;l.css({position:"absolute",top:"auto",left:"auto"})}l.css(p)})};typeof b.alsoResize=="object"&&!b.alsoResize.nodeType?
+e.each(b.alsoResize,function(i,j){h(i,j)}):h(b.alsoResize)},stop:function(){var b=e(this).data("resizable"),a=b.options,c=function(d){e(d).each(function(){var f=e(this);f.css({position:f.data("resizable-alsoresize").position})})};if(b._revertToRelativePosition){b._revertToRelativePosition=false;typeof a.alsoResize=="object"&&!a.alsoResize.nodeType?e.each(a.alsoResize,function(d){c(d)}):c(a.alsoResize)}e(this).removeData("resizable-alsoresize")}});e.ui.plugin.add("resizable","animate",{stop:function(b){var a=
+e(this).data("resizable"),c=a.options,d=a._proportionallyResizeElements,f=d.length&&/textarea/i.test(d[0].nodeName),g=f&&e.ui.hasScroll(d[0],"left")?0:a.sizeDiff.height;f={width:a.size.width-(f?0:a.sizeDiff.width),height:a.size.height-g};g=parseInt(a.element.css("left"),10)+(a.position.left-a.originalPosition.left)||null;var h=parseInt(a.element.css("top"),10)+(a.position.top-a.originalPosition.top)||null;a.element.animate(e.extend(f,h&&g?{top:h,left:g}:{}),{duration:c.animateDuration,easing:c.animateEasing,
+step:function(){var i={width:parseInt(a.element.css("width"),10),height:parseInt(a.element.css("height"),10),top:parseInt(a.element.css("top"),10),left:parseInt(a.element.css("left"),10)};d&&d.length&&e(d[0]).css({width:i.width,height:i.height});a._updateCache(i);a._propagate("resize",b)}})}});e.ui.plugin.add("resizable","containment",{start:function(){var b=e(this).data("resizable"),a=b.element,c=b.options.containment;if(a=c instanceof e?c.get(0):/parent/.test(c)?a.parent().get(0):c){b.containerElement=
+e(a);if(/document/.test(c)||c==document){b.containerOffset={left:0,top:0};b.containerPosition={left:0,top:0};b.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}}else{var d=e(a),f=[];e(["Top","Right","Left","Bottom"]).each(function(i,j){f[i]=m(d.css("padding"+j))});b.containerOffset=d.offset();b.containerPosition=d.position();b.containerSize={height:d.innerHeight()-f[3],width:d.innerWidth()-f[1]};c=b.containerOffset;
+var g=b.containerSize.height,h=b.containerSize.width;h=e.ui.hasScroll(a,"left")?a.scrollWidth:h;g=e.ui.hasScroll(a)?a.scrollHeight:g;b.parentData={element:a,left:c.left,top:c.top,width:h,height:g}}}},resize:function(b){var a=e(this).data("resizable"),c=a.options,d=a.containerOffset,f=a.position;b=a._aspectRatio||b.shiftKey;var g={top:0,left:0},h=a.containerElement;if(h[0]!=document&&/static/.test(h.css("position")))g=d;if(f.left<(a._helper?d.left:0)){a.size.width+=a._helper?a.position.left-d.left:
+a.position.left-g.left;if(b)a.size.height=a.size.width/c.aspectRatio;a.position.left=c.helper?d.left:0}if(f.top<(a._helper?d.top:0)){a.size.height+=a._helper?a.position.top-d.top:a.position.top;if(b)a.size.width=a.size.height*c.aspectRatio;a.position.top=a._helper?d.top:0}a.offset.left=a.parentData.left+a.position.left;a.offset.top=a.parentData.top+a.position.top;c=Math.abs((a._helper?a.offset.left-g.left:a.offset.left-g.left)+a.sizeDiff.width);d=Math.abs((a._helper?a.offset.top-g.top:a.offset.top-
+d.top)+a.sizeDiff.height);f=a.containerElement.get(0)==a.element.parent().get(0);g=/relative|absolute/.test(a.containerElement.css("position"));if(f&&g)c-=a.parentData.left;if(c+a.size.width>=a.parentData.width){a.size.width=a.parentData.width-c;if(b)a.size.height=a.size.width/a.aspectRatio}if(d+a.size.height>=a.parentData.height){a.size.height=a.parentData.height-d;if(b)a.size.width=a.size.height*a.aspectRatio}},stop:function(){var b=e(this).data("resizable"),a=b.options,c=b.containerOffset,d=b.containerPosition,
+f=b.containerElement,g=e(b.helper),h=g.offset(),i=g.outerWidth()-b.sizeDiff.width;g=g.outerHeight()-b.sizeDiff.height;b._helper&&!a.animate&&/relative/.test(f.css("position"))&&e(this).css({left:h.left-d.left-c.left,width:i,height:g});b._helper&&!a.animate&&/static/.test(f.css("position"))&&e(this).css({left:h.left-d.left-c.left,width:i,height:g})}});e.ui.plugin.add("resizable","ghost",{start:function(){var b=e(this).data("resizable"),a=b.options,c=b.size;b.ghost=b.originalElement.clone();b.ghost.css({opacity:0.25,
+display:"block",position:"relative",height:c.height,width:c.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof a.ghost=="string"?a.ghost:"");b.ghost.appendTo(b.helper)},resize:function(){var b=e(this).data("resizable");b.ghost&&b.ghost.css({position:"relative",height:b.size.height,width:b.size.width})},stop:function(){var b=e(this).data("resizable");b.ghost&&b.helper&&b.helper.get(0).removeChild(b.ghost.get(0))}});e.ui.plugin.add("resizable","grid",{resize:function(){var b=
+e(this).data("resizable"),a=b.options,c=b.size,d=b.originalSize,f=b.originalPosition,g=b.axis;a.grid=typeof a.grid=="number"?[a.grid,a.grid]:a.grid;var h=Math.round((c.width-d.width)/(a.grid[0]||1))*(a.grid[0]||1);a=Math.round((c.height-d.height)/(a.grid[1]||1))*(a.grid[1]||1);if(/^(se|s|e)$/.test(g)){b.size.width=d.width+h;b.size.height=d.height+a}else if(/^(ne)$/.test(g)){b.size.width=d.width+h;b.size.height=d.height+a;b.position.top=f.top-a}else{if(/^(sw)$/.test(g)){b.size.width=d.width+h;b.size.height=
+d.height+a}else{b.size.width=d.width+h;b.size.height=d.height+a;b.position.top=f.top-a}b.position.left=f.left-h}}});var m=function(b){return parseInt(b,10)||0},k=function(b){return!isNaN(parseInt(b,10))}})(jQuery);
+;/*
+ * jQuery UI Selectable 1.8.16
+ *
+ * Copyright 2011, 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/Selectables
+ *
+ * Depends:
+ *	jquery.ui.core.js
+ *	jquery.ui.mouse.js
+ *	jquery.ui.widget.js
+ */
+(function(e){e.widget("ui.selectable",e.ui.mouse,{options:{appendTo:"body",autoRefresh:true,distance:0,filter:"*",tolerance:"touch"},_create:function(){var c=this;this.element.addClass("ui-selectable");this.dragged=false;var f;this.refresh=function(){f=e(c.options.filter,c.element[0]);f.each(function(){var d=e(this),b=d.offset();e.data(this,"selectable-item",{element:this,$element:d,left:b.left,top:b.top,right:b.left+d.outerWidth(),bottom:b.top+d.outerHeight(),startselected:false,selected:d.hasClass("ui-selected"),
+selecting:d.hasClass("ui-selecting"),unselecting:d.hasClass("ui-unselecting")})})};this.refresh();this.selectees=f.addClass("ui-selectee");this._mouseInit();this.helper=e("<div class='ui-selectable-helper'></div>")},destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item");this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable");this._mouseDestroy();return this},_mouseStart:function(c){var f=this;this.opos=[c.pageX,
+c.pageY];if(!this.options.disabled){var d=this.options;this.selectees=e(d.filter,this.element[0]);this._trigger("start",c);e(d.appendTo).append(this.helper);this.helper.css({left:c.clientX,top:c.clientY,width:0,height:0});d.autoRefresh&&this.refresh();this.selectees.filter(".ui-selected").each(function(){var b=e.data(this,"selectable-item");b.startselected=true;if(!c.metaKey){b.$element.removeClass("ui-selected");b.selected=false;b.$element.addClass("ui-unselecting");b.unselecting=true;f._trigger("unselecting",
+c,{unselecting:b.element})}});e(c.target).parents().andSelf().each(function(){var b=e.data(this,"selectable-item");if(b){var g=!c.metaKey||!b.$element.hasClass("ui-selected");b.$element.removeClass(g?"ui-unselecting":"ui-selected").addClass(g?"ui-selecting":"ui-unselecting");b.unselecting=!g;b.selecting=g;(b.selected=g)?f._trigger("selecting",c,{selecting:b.element}):f._trigger("unselecting",c,{unselecting:b.element});return false}})}},_mouseDrag:function(c){var f=this;this.dragged=true;if(!this.options.disabled){var d=
+this.options,b=this.opos[0],g=this.opos[1],h=c.pageX,i=c.pageY;if(b>h){var j=h;h=b;b=j}if(g>i){j=i;i=g;g=j}this.helper.css({left:b,top:g,width:h-b,height:i-g});this.selectees.each(function(){var a=e.data(this,"selectable-item");if(!(!a||a.element==f.element[0])){var k=false;if(d.tolerance=="touch")k=!(a.left>h||a.right<b||a.top>i||a.bottom<g);else if(d.tolerance=="fit")k=a.left>b&&a.right<h&&a.top>g&&a.bottom<i;if(k){if(a.selected){a.$element.removeClass("ui-selected");a.selected=false}if(a.unselecting){a.$element.removeClass("ui-unselecting");
+a.unselecting=false}if(!a.selecting){a.$element.addClass("ui-selecting");a.selecting=true;f._trigger("selecting",c,{selecting:a.element})}}else{if(a.selecting)if(c.metaKey&&a.startselected){a.$element.removeClass("ui-selecting");a.selecting=false;a.$element.addClass("ui-selected");a.selected=true}else{a.$element.removeClass("ui-selecting");a.selecting=false;if(a.startselected){a.$element.addClass("ui-unselecting");a.unselecting=true}f._trigger("unselecting",c,{unselecting:a.element})}if(a.selected)if(!c.metaKey&&
+!a.startselected){a.$element.removeClass("ui-selected");a.selected=false;a.$element.addClass("ui-unselecting");a.unselecting=true;f._trigger("unselecting",c,{unselecting:a.element})}}}});return false}},_mouseStop:function(c){var f=this;this.dragged=false;e(".ui-unselecting",this.element[0]).each(function(){var d=e.data(this,"selectable-item");d.$element.removeClass("ui-unselecting");d.unselecting=false;d.startselected=false;f._trigger("unselected",c,{unselected:d.element})});e(".ui-selecting",this.element[0]).each(function(){var d=
+e.data(this,"selectable-item");d.$element.removeClass("ui-selecting").addClass("ui-selected");d.selecting=false;d.selected=true;d.startselected=true;f._trigger("selected",c,{selected:d.element})});this._trigger("stop",c);this.helper.remove();return false}});e.extend(e.ui.selectable,{version:"1.8.16"})})(jQuery);
+;/*
+ * jQuery UI Sortable 1.8.16
+ *
+ * Copyright 2011, 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/Sortables
+ *
+ * Depends:
+ *	jquery.ui.core.js
+ *	jquery.ui.mouse.js
+ *	jquery.ui.widget.js
+ */
+(function(d){d.widget("ui.sortable",d.ui.mouse,{widgetEventPrefix:"sort",options:{appendTo:"parent",axis:false,connectWith:false,containment:false,cursor:"auto",cursorAt:false,dropOnEmpty:true,forcePlaceholderSize:false,forceHelperSize:false,grid:false,handle:false,helper:"original",items:"> *",opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1E3},_create:function(){var a=this.options;this.containerCache={};this.element.addClass("ui-sortable");
+this.refresh();this.floating=this.items.length?a.axis==="x"||/left|right/.test(this.items[0].item.css("float"))||/inline|table-cell/.test(this.items[0].item.css("display")):false;this.offset=this.element.offset();this._mouseInit()},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");this._mouseDestroy();for(var a=this.items.length-1;a>=0;a--)this.items[a].item.removeData("sortable-item");return this},_setOption:function(a,b){if(a===
+"disabled"){this.options[a]=b;this.widget()[b?"addClass":"removeClass"]("ui-sortable-disabled")}else d.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(a,b){if(this.reverting)return false;if(this.options.disabled||this.options.type=="static")return false;this._refreshItems(a);var c=null,e=this;d(a.target).parents().each(function(){if(d.data(this,"sortable-item")==e){c=d(this);return false}});if(d.data(a.target,"sortable-item")==e)c=d(a.target);if(!c)return false;if(this.options.handle&&
+!b){var f=false;d(this.options.handle,c).find("*").andSelf().each(function(){if(this==a.target)f=true});if(!f)return false}this.currentItem=c;this._removeCurrentsFromItems();return true},_mouseStart:function(a,b,c){b=this.options;var e=this;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(a);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,
+left:this.offset.left-this.margins.left};this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");d.extend(this.offset,{click:{left:a.pageX-this.offset.left,top:a.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(a);this.originalPageX=a.pageX;this.originalPageY=a.pageY;b.cursorAt&&this._adjustOffsetFromHelper(b.cursorAt);this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};
+this.helper[0]!=this.currentItem[0]&&this.currentItem.hide();this._createPlaceholder();b.containment&&this._setContainment();if(b.cursor){if(d("body").css("cursor"))this._storedCursor=d("body").css("cursor");d("body").css("cursor",b.cursor)}if(b.opacity){if(this.helper.css("opacity"))this._storedOpacity=this.helper.css("opacity");this.helper.css("opacity",b.opacity)}if(b.zIndex){if(this.helper.css("zIndex"))this._storedZIndex=this.helper.css("zIndex");this.helper.css("zIndex",b.zIndex)}if(this.scrollParent[0]!=
+document&&this.scrollParent[0].tagName!="HTML")this.overflowOffset=this.scrollParent.offset();this._trigger("start",a,this._uiHash());this._preserveHelperProportions||this._cacheHelperProportions();if(!c)for(c=this.containers.length-1;c>=0;c--)this.containers[c]._trigger("activate",a,e._uiHash(this));if(d.ui.ddmanager)d.ui.ddmanager.current=this;d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,a);this.dragging=true;this.helper.addClass("ui-sortable-helper");this._mouseDrag(a);
+return true},_mouseDrag:function(a){this.position=this._generatePosition(a);this.positionAbs=this._convertPositionTo("absolute");if(!this.lastPositionAbs)this.lastPositionAbs=this.positionAbs;if(this.options.scroll){var b=this.options,c=false;if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){if(this.overflowOffset.top+this.scrollParent[0].offsetHeight-a.pageY<b.scrollSensitivity)this.scrollParent[0].scrollTop=c=this.scrollParent[0].scrollTop+b.scrollSpeed;else if(a.pageY-this.overflowOffset.top<
+b.scrollSensitivity)this.scrollParent[0].scrollTop=c=this.scrollParent[0].scrollTop-b.scrollSpeed;if(this.overflowOffset.left+this.scrollParent[0].offsetWidth-a.pageX<b.scrollSensitivity)this.scrollParent[0].scrollLeft=c=this.scrollParent[0].scrollLeft+b.scrollSpeed;else if(a.pageX-this.overflowOffset.left<b.scrollSensitivity)this.scrollParent[0].scrollLeft=c=this.scrollParent[0].scrollLeft-b.scrollSpeed}else{if(a.pageY-d(document).scrollTop()<b.scrollSensitivity)c=d(document).scrollTop(d(document).scrollTop()-
+b.scrollSpeed);else if(d(window).height()-(a.pageY-d(document).scrollTop())<b.scrollSensitivity)c=d(document).scrollTop(d(document).scrollTop()+b.scrollSpeed);if(a.pageX-d(document).scrollLeft()<b.scrollSensitivity)c=d(document).scrollLeft(d(document).scrollLeft()-b.scrollSpeed);else if(d(window).width()-(a.pageX-d(document).scrollLeft())<b.scrollSensitivity)c=d(document).scrollLeft(d(document).scrollLeft()+b.scrollSpeed)}c!==false&&d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,
+a)}this.positionAbs=this._convertPositionTo("absolute");if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";for(b=this.items.length-1;b>=0;b--){c=this.items[b];var e=c.item[0],f=this._intersectsWithPointer(c);if(f)if(e!=this.currentItem[0]&&this.placeholder[f==1?"next":"prev"]()[0]!=e&&!d.ui.contains(this.placeholder[0],e)&&(this.options.type=="semi-dynamic"?!d.ui.contains(this.element[0],
+e):true)){this.direction=f==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(c))this._rearrange(a,c);else break;this._trigger("change",a,this._uiHash());break}}this._contactContainers(a);d.ui.ddmanager&&d.ui.ddmanager.drag(this,a);this._trigger("sort",a,this._uiHash());this.lastPositionAbs=this.positionAbs;return false},_mouseStop:function(a,b){if(a){d.ui.ddmanager&&!this.options.dropBehaviour&&d.ui.ddmanager.drop(this,a);if(this.options.revert){var c=this;b=c.placeholder.offset();
+c.reverting=true;d(this.helper).animate({left:b.left-this.offset.parent.left-c.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:b.top-this.offset.parent.top-c.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){c._clear(a)})}else this._clear(a,b);return false}},cancel:function(){var a=this;if(this.dragging){this._mouseUp({target:null});this.options.helper=="original"?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):
+this.currentItem.show();for(var b=this.containers.length-1;b>=0;b--){this.containers[b]._trigger("deactivate",null,a._uiHash(this));if(this.containers[b].containerCache.over){this.containers[b]._trigger("out",null,a._uiHash(this));this.containers[b].containerCache.over=0}}}if(this.placeholder){this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]);this.options.helper!="original"&&this.helper&&this.helper[0].parentNode&&this.helper.remove();d.extend(this,{helper:null,
+dragging:false,reverting:false,_noFinalSort:null});this.domPosition.prev?d(this.domPosition.prev).after(this.currentItem):d(this.domPosition.parent).prepend(this.currentItem)}return this},serialize:function(a){var b=this._getItemsAsjQuery(a&&a.connected),c=[];a=a||{};d(b).each(function(){var e=(d(a.item||this).attr(a.attribute||"id")||"").match(a.expression||/(.+)[-=_](.+)/);if(e)c.push((a.key||e[1]+"[]")+"="+(a.key&&a.expression?e[1]:e[2]))});!c.length&&a.key&&c.push(a.key+"=");return c.join("&")},
+toArray:function(a){var b=this._getItemsAsjQuery(a&&a.connected),c=[];a=a||{};b.each(function(){c.push(d(a.item||this).attr(a.attribute||"id")||"")});return c},_intersectsWith:function(a){var b=this.positionAbs.left,c=b+this.helperProportions.width,e=this.positionAbs.top,f=e+this.helperProportions.height,g=a.left,h=g+a.width,i=a.top,k=i+a.height,j=this.offset.click.top,l=this.offset.click.left;j=e+j>i&&e+j<k&&b+l>g&&b+l<h;return this.options.tolerance=="pointer"||this.options.forcePointerForContainers||
+this.options.tolerance!="pointer"&&this.helperProportions[this.floating?"width":"height"]>a[this.floating?"width":"height"]?j:g<b+this.helperProportions.width/2&&c-this.helperProportions.width/2<h&&i<e+this.helperProportions.height/2&&f-this.helperProportions.height/2<k},_intersectsWithPointer:function(a){var b=d.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,a.top,a.height);a=d.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,a.left,a.width);b=b&&a;a=this._getDragVerticalDirection();
+var c=this._getDragHorizontalDirection();if(!b)return false;return this.floating?c&&c=="right"||a=="down"?2:1:a&&(a=="down"?2:1)},_intersectsWithSides:function(a){var b=d.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,a.top+a.height/2,a.height);a=d.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,a.left+a.width/2,a.width);var c=this._getDragVerticalDirection(),e=this._getDragHorizontalDirection();return this.floating&&e?e=="right"&&a||e=="left"&&!a:c&&(c=="down"&&b||c=="up"&&!b)},
+_getDragVerticalDirection:function(){var a=this.positionAbs.top-this.lastPositionAbs.top;return a!=0&&(a>0?"down":"up")},_getDragHorizontalDirection:function(){var a=this.positionAbs.left-this.lastPositionAbs.left;return a!=0&&(a>0?"right":"left")},refresh:function(a){this._refreshItems(a);this.refreshPositions();return this},_connectWith:function(){var a=this.options;return a.connectWith.constructor==String?[a.connectWith]:a.connectWith},_getItemsAsjQuery:function(a){var b=[],c=[],e=this._connectWith();
+if(e&&a)for(a=e.length-1;a>=0;a--)for(var f=d(e[a]),g=f.length-1;g>=0;g--){var h=d.data(f[g],"sortable");if(h&&h!=this&&!h.options.disabled)c.push([d.isFunction(h.options.items)?h.options.items.call(h.element):d(h.options.items,h.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),h])}c.push([d.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):d(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),
+this]);for(a=c.length-1;a>=0;a--)c[a][0].each(function(){b.push(this)});return d(b)},_removeCurrentsFromItems:function(){for(var a=this.currentItem.find(":data(sortable-item)"),b=0;b<this.items.length;b++)for(var c=0;c<a.length;c++)a[c]==this.items[b].item[0]&&this.items.splice(b,1)},_refreshItems:function(a){this.items=[];this.containers=[this];var b=this.items,c=[[d.isFunction(this.options.items)?this.options.items.call(this.element[0],a,{item:this.currentItem}):d(this.options.items,this.element),
+this]],e=this._connectWith();if(e)for(var f=e.length-1;f>=0;f--)for(var g=d(e[f]),h=g.length-1;h>=0;h--){var i=d.data(g[h],"sortable");if(i&&i!=this&&!i.options.disabled){c.push([d.isFunction(i.options.items)?i.options.items.call(i.element[0],a,{item:this.currentItem}):d(i.options.items,i.element),i]);this.containers.push(i)}}for(f=c.length-1;f>=0;f--){a=c[f][1];e=c[f][0];h=0;for(g=e.length;h<g;h++){i=d(e[h]);i.data("sortable-item",a);b.push({item:i,instance:a,width:0,height:0,left:0,top:0})}}},refreshPositions:function(a){if(this.offsetParent&&
+this.helper)this.offset.parent=this._getParentOffset();for(var b=this.items.length-1;b>=0;b--){var c=this.items[b];if(!(c.instance!=this.currentContainer&&this.currentContainer&&c.item[0]!=this.currentItem[0])){var e=this.options.toleranceElement?d(this.options.toleranceElement,c.item):c.item;if(!a){c.width=e.outerWidth();c.height=e.outerHeight()}e=e.offset();c.left=e.left;c.top=e.top}}if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(b=
+this.containers.length-1;b>=0;b--){e=this.containers[b].element.offset();this.containers[b].containerCache.left=e.left;this.containers[b].containerCache.top=e.top;this.containers[b].containerCache.width=this.containers[b].element.outerWidth();this.containers[b].containerCache.height=this.containers[b].element.outerHeight()}return this},_createPlaceholder:function(a){var b=a||this,c=b.options;if(!c.placeholder||c.placeholder.constructor==String){var e=c.placeholder;c.placeholder={element:function(){var f=
+d(document.createElement(b.currentItem[0].nodeName)).addClass(e||b.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];if(!e)f.style.visibility="hidden";return f},update:function(f,g){if(!(e&&!c.forcePlaceholderSize)){g.height()||g.height(b.currentItem.innerHeight()-parseInt(b.currentItem.css("paddingTop")||0,10)-parseInt(b.currentItem.css("paddingBottom")||0,10));g.width()||g.width(b.currentItem.innerWidth()-parseInt(b.currentItem.css("paddingLeft")||0,10)-parseInt(b.currentItem.css("paddingRight")||
+0,10))}}}}b.placeholder=d(c.placeholder.element.call(b.element,b.currentItem));b.currentItem.after(b.placeholder);c.placeholder.update(b,b.placeholder)},_contactContainers:function(a){for(var b=null,c=null,e=this.containers.length-1;e>=0;e--)if(!d.ui.contains(this.currentItem[0],this.containers[e].element[0]))if(this._intersectsWith(this.containers[e].containerCache)){if(!(b&&d.ui.contains(this.containers[e].element[0],b.element[0]))){b=this.containers[e];c=e}}else if(this.containers[e].containerCache.over){this.containers[e]._trigger("out",
+a,this._uiHash(this));this.containers[e].containerCache.over=0}if(b)if(this.containers.length===1){this.containers[c]._trigger("over",a,this._uiHash(this));this.containers[c].containerCache.over=1}else if(this.currentContainer!=this.containers[c]){b=1E4;e=null;for(var f=this.positionAbs[this.containers[c].floating?"left":"top"],g=this.items.length-1;g>=0;g--)if(d.ui.contains(this.containers[c].element[0],this.items[g].item[0])){var h=this.items[g][this.containers[c].floating?"left":"top"];if(Math.abs(h-
+f)<b){b=Math.abs(h-f);e=this.items[g]}}if(e||this.options.dropOnEmpty){this.currentContainer=this.containers[c];e?this._rearrange(a,e,null,true):this._rearrange(a,null,this.containers[c].element,true);this._trigger("change",a,this._uiHash());this.containers[c]._trigger("change",a,this._uiHash(this));this.options.placeholder.update(this.currentContainer,this.placeholder);this.containers[c]._trigger("over",a,this._uiHash(this));this.containers[c].containerCache.over=1}}},_createHelper:function(a){var b=
+this.options;a=d.isFunction(b.helper)?d(b.helper.apply(this.element[0],[a,this.currentItem])):b.helper=="clone"?this.currentItem.clone():this.currentItem;a.parents("body").length||d(b.appendTo!="parent"?b.appendTo:this.currentItem[0].parentNode)[0].appendChild(a[0]);if(a[0]==this.currentItem[0])this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")};if(a[0].style.width==
+""||b.forceHelperSize)a.width(this.currentItem.width());if(a[0].style.height==""||b.forceHelperSize)a.height(this.currentItem.height());return a},_adjustOffsetFromHelper:function(a){if(typeof a=="string")a=a.split(" ");if(d.isArray(a))a={left:+a[0],top:+a[1]||0};if("left"in a)this.offset.click.left=a.left+this.margins.left;if("right"in a)this.offset.click.left=this.helperProportions.width-a.right+this.margins.left;if("top"in a)this.offset.click.top=a.top+this.margins.top;if("bottom"in a)this.offset.click.top=
+this.helperProportions.height-a.bottom+this.margins.top},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var a=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0])){a.left+=this.scrollParent.scrollLeft();a.top+=this.scrollParent.scrollTop()}if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&d.browser.msie)a=
+{top:0,left:0};return{top:a.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:a.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.currentItem.position();return{top:a.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),
+10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var a=this.options;if(a.containment=="parent")a.containment=this.helper[0].parentNode;if(a.containment=="document"||a.containment=="window")this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,d(a.containment=="document"?
+document:window).width()-this.helperProportions.width-this.margins.left,(d(a.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(a.containment)){var b=d(a.containment)[0];a=d(a.containment).offset();var c=d(b).css("overflow")!="hidden";this.containment=[a.left+(parseInt(d(b).css("borderLeftWidth"),10)||0)+(parseInt(d(b).css("paddingLeft"),10)||0)-this.margins.left,a.top+(parseInt(d(b).css("borderTopWidth"),
+10)||0)+(parseInt(d(b).css("paddingTop"),10)||0)-this.margins.top,a.left+(c?Math.max(b.scrollWidth,b.offsetWidth):b.offsetWidth)-(parseInt(d(b).css("borderLeftWidth"),10)||0)-(parseInt(d(b).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,a.top+(c?Math.max(b.scrollHeight,b.offsetHeight):b.offsetHeight)-(parseInt(d(b).css("borderTopWidth"),10)||0)-(parseInt(d(b).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}},_convertPositionTo:function(a,b){if(!b)b=
+this.position;a=a=="absolute"?1:-1;var c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,e=/(html|body)/i.test(c[0].tagName);return{top:b.top+this.offset.relative.top*a+this.offset.parent.top*a-(d.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():e?0:c.scrollTop())*a),left:b.left+this.offset.relative.left*a+this.offset.parent.left*a-(d.browser.safari&&
+this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():e?0:c.scrollLeft())*a)}},_generatePosition:function(a){var b=this.options,c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,e=/(html|body)/i.test(c[0].tagName);if(this.cssPosition=="relative"&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0]))this.offset.relative=this._getRelativeOffset();
+var f=a.pageX,g=a.pageY;if(this.originalPosition){if(this.containment){if(a.pageX-this.offset.click.left<this.containment[0])f=this.containment[0]+this.offset.click.left;if(a.pageY-this.offset.click.top<this.containment[1])g=this.containment[1]+this.offset.click.top;if(a.pageX-this.offset.click.left>this.containment[2])f=this.containment[2]+this.offset.click.left;if(a.pageY-this.offset.click.top>this.containment[3])g=this.containment[3]+this.offset.click.top}if(b.grid){g=this.originalPageY+Math.round((g-
+this.originalPageY)/b.grid[1])*b.grid[1];g=this.containment?!(g-this.offset.click.top<this.containment[1]||g-this.offset.click.top>this.containment[3])?g:!(g-this.offset.click.top<this.containment[1])?g-b.grid[1]:g+b.grid[1]:g;f=this.originalPageX+Math.round((f-this.originalPageX)/b.grid[0])*b.grid[0];f=this.containment?!(f-this.offset.click.left<this.containment[0]||f-this.offset.click.left>this.containment[2])?f:!(f-this.offset.click.left<this.containment[0])?f-b.grid[0]:f+b.grid[0]:f}}return{top:g-
+this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(d.browser.safari&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollTop():e?0:c.scrollTop()),left:f-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(d.browser.safari&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():e?0:c.scrollLeft())}},_rearrange:function(a,b,c,e){c?c[0].appendChild(this.placeholder[0]):b.item[0].parentNode.insertBefore(this.placeholder[0],
+this.direction=="down"?b.item[0]:b.item[0].nextSibling);this.counter=this.counter?++this.counter:1;var f=this,g=this.counter;window.setTimeout(function(){g==f.counter&&f.refreshPositions(!e)},0)},_clear:function(a,b){this.reverting=false;var c=[];!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem);this._noFinalSort=null;if(this.helper[0]==this.currentItem[0]){for(var e in this._storedCSS)if(this._storedCSS[e]=="auto"||this._storedCSS[e]=="static")this._storedCSS[e]=
+"";this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();this.fromOutside&&!b&&c.push(function(f){this._trigger("receive",f,this._uiHash(this.fromOutside))});if((this.fromOutside||this.domPosition.prev!=this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!=this.currentItem.parent()[0])&&!b)c.push(function(f){this._trigger("update",f,this._uiHash())});if(!d.ui.contains(this.element[0],this.currentItem[0])){b||c.push(function(f){this._trigger("remove",
+f,this._uiHash())});for(e=this.containers.length-1;e>=0;e--)if(d.ui.contains(this.containers[e].element[0],this.currentItem[0])&&!b){c.push(function(f){return function(g){f._trigger("receive",g,this._uiHash(this))}}.call(this,this.containers[e]));c.push(function(f){return function(g){f._trigger("update",g,this._uiHash(this))}}.call(this,this.containers[e]))}}for(e=this.containers.length-1;e>=0;e--){b||c.push(function(f){return function(g){f._trigger("deactivate",g,this._uiHash(this))}}.call(this,
+this.containers[e]));if(this.containers[e].containerCache.over){c.push(function(f){return function(g){f._trigger("out",g,this._uiHash(this))}}.call(this,this.containers[e]));this.containers[e].containerCache.over=0}}this._storedCursor&&d("body").css("cursor",this._storedCursor);this._storedOpacity&&this.helper.css("opacity",this._storedOpacity);if(this._storedZIndex)this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex);this.dragging=false;if(this.cancelHelperRemoval){if(!b){this._trigger("beforeStop",
+a,this._uiHash());for(e=0;e<c.length;e++)c[e].call(this,a);this._trigger("stop",a,this._uiHash())}return false}b||this._trigger("beforeStop",a,this._uiHash());this.placeholder[0].parentNode.removeChild(this.placeholder[0]);this.helper[0]!=this.currentItem[0]&&this.helper.remove();this.helper=null;if(!b){for(e=0;e<c.length;e++)c[e].call(this,a);this._trigger("stop",a,this._uiHash())}this.fromOutside=false;return true},_trigger:function(){d.Widget.prototype._trigger.apply(this,arguments)===false&&this.cancel()},
+_uiHash:function(a){var b=a||this;return{helper:b.helper,placeholder:b.placeholder||d([]),position:b.position,originalPosition:b.originalPosition,offset:b.positionAbs,item:b.currentItem,sender:a?a.element:null}}});d.extend(d.ui.sortable,{version:"1.8.16"})})(jQuery);
+;/*
+ * jQuery UI Accordion 1.8.16
+ *
+ * Copyright 2011, 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/Accordion
+ *
+ * Depends:
+ *	jquery.ui.core.js
+ *	jquery.ui.widget.js
+ */
+(function(c){c.widget("ui.accordion",{options:{active:0,animated:"slide",autoHeight:true,clearStyle:false,collapsible:false,event:"click",fillSpace:false,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:false,navigationFilter:function(){return this.href.toLowerCase()===location.href.toLowerCase()}},_create:function(){var a=this,b=a.options;a.running=0;a.element.addClass("ui-accordion ui-widget ui-helper-reset").children("li").addClass("ui-accordion-li-fix");
+a.headers=a.element.find(b.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){b.disabled||c(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){b.disabled||c(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){b.disabled||c(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){b.disabled||c(this).removeClass("ui-state-focus")});a.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");
+if(b.navigation){var d=a.element.find("a").filter(b.navigationFilter).eq(0);if(d.length){var h=d.closest(".ui-accordion-header");a.active=h.length?h:d.closest(".ui-accordion-content").prev()}}a.active=a._findActive(a.active||b.active).addClass("ui-state-default ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");a.active.next().addClass("ui-accordion-content-active");a._createIcons();a.resize();a.element.attr("role","tablist");a.headers.attr("role","tab").bind("keydown.accordion",
+function(f){return a._keydown(f)}).next().attr("role","tabpanel");a.headers.not(a.active||"").attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).next().hide();a.active.length?a.active.attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}):a.headers.eq(0).attr("tabIndex",0);c.browser.safari||a.headers.find("a").attr("tabIndex",-1);b.event&&a.headers.bind(b.event.split(" ").join(".accordion ")+".accordion",function(f){a._clickHandler.call(a,f,this);f.preventDefault()})},_createIcons:function(){var a=
+this.options;if(a.icons){c("<span></span>").addClass("ui-icon "+a.icons.header).prependTo(this.headers);this.active.children(".ui-icon").toggleClass(a.icons.header).toggleClass(a.icons.headerSelected);this.element.addClass("ui-accordion-icons")}},_destroyIcons:function(){this.headers.children(".ui-icon").remove();this.element.removeClass("ui-accordion-icons")},destroy:function(){var a=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role");this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("tabIndex");
+this.headers.find("a").removeAttr("tabIndex");this._destroyIcons();var b=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled");if(a.autoHeight||a.fillHeight)b.css("height","");return c.Widget.prototype.destroy.call(this)},_setOption:function(a,b){c.Widget.prototype._setOption.apply(this,arguments);a=="active"&&this.activate(b);if(a=="icons"){this._destroyIcons();
+b&&this._createIcons()}if(a=="disabled")this.headers.add(this.headers.next())[b?"addClass":"removeClass"]("ui-accordion-disabled ui-state-disabled")},_keydown:function(a){if(!(this.options.disabled||a.altKey||a.ctrlKey)){var b=c.ui.keyCode,d=this.headers.length,h=this.headers.index(a.target),f=false;switch(a.keyCode){case b.RIGHT:case b.DOWN:f=this.headers[(h+1)%d];break;case b.LEFT:case b.UP:f=this.headers[(h-1+d)%d];break;case b.SPACE:case b.ENTER:this._clickHandler({target:a.target},a.target);
+a.preventDefault()}if(f){c(a.target).attr("tabIndex",-1);c(f).attr("tabIndex",0);f.focus();return false}return true}},resize:function(){var a=this.options,b;if(a.fillSpace){if(c.browser.msie){var d=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}b=this.element.parent().height();c.browser.msie&&this.element.parent().css("overflow",d);this.headers.each(function(){b-=c(this).outerHeight(true)});this.headers.next().each(function(){c(this).height(Math.max(0,b-c(this).innerHeight()+
+c(this).height()))}).css("overflow","auto")}else if(a.autoHeight){b=0;this.headers.next().each(function(){b=Math.max(b,c(this).height("").height())}).height(b)}return this},activate:function(a){this.options.active=a;a=this._findActive(a)[0];this._clickHandler({target:a},a);return this},_findActive:function(a){return a?typeof a==="number"?this.headers.filter(":eq("+a+")"):this.headers.not(this.headers.not(a)):a===false?c([]):this.headers.filter(":eq(0)")},_clickHandler:function(a,b){var d=this.options;
+if(!d.disabled)if(a.target){a=c(a.currentTarget||b);b=a[0]===this.active[0];d.active=d.collapsible&&b?false:this.headers.index(a);if(!(this.running||!d.collapsible&&b)){var h=this.active;j=a.next();g=this.active.next();e={options:d,newHeader:b&&d.collapsible?c([]):a,oldHeader:this.active,newContent:b&&d.collapsible?c([]):j,oldContent:g};var f=this.headers.index(this.active[0])>this.headers.index(a[0]);this.active=b?c([]):a;this._toggle(j,g,e,b,f);h.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);
+if(!b){a.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").children(".ui-icon").removeClass(d.icons.header).addClass(d.icons.headerSelected);a.next().addClass("ui-accordion-content-active")}}}else if(d.collapsible){this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);this.active.next().addClass("ui-accordion-content-active");var g=this.active.next(),
+e={options:d,newHeader:c([]),oldHeader:d.active,newContent:c([]),oldContent:g},j=this.active=c([]);this._toggle(j,g,e)}},_toggle:function(a,b,d,h,f){var g=this,e=g.options;g.toShow=a;g.toHide=b;g.data=d;var j=function(){if(g)return g._completed.apply(g,arguments)};g._trigger("changestart",null,g.data);g.running=b.size()===0?a.size():b.size();if(e.animated){d={};d=e.collapsible&&h?{toShow:c([]),toHide:b,complete:j,down:f,autoHeight:e.autoHeight||e.fillSpace}:{toShow:a,toHide:b,complete:j,down:f,autoHeight:e.autoHeight||
+e.fillSpace};if(!e.proxied)e.proxied=e.animated;if(!e.proxiedDuration)e.proxiedDuration=e.duration;e.animated=c.isFunction(e.proxied)?e.proxied(d):e.proxied;e.duration=c.isFunction(e.proxiedDuration)?e.proxiedDuration(d):e.proxiedDuration;h=c.ui.accordion.animations;var i=e.duration,k=e.animated;if(k&&!h[k]&&!c.easing[k])k="slide";h[k]||(h[k]=function(l){this.slide(l,{easing:k,duration:i||700})});h[k](d)}else{if(e.collapsible&&h)a.toggle();else{b.hide();a.show()}j(true)}b.prev().attr({"aria-expanded":"false",
+"aria-selected":"false",tabIndex:-1}).blur();a.prev().attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}).focus()},_completed:function(a){this.running=a?0:--this.running;if(!this.running){this.options.clearStyle&&this.toShow.add(this.toHide).css({height:"",overflow:""});this.toHide.removeClass("ui-accordion-content-active");if(this.toHide.length)this.toHide.parent()[0].className=this.toHide.parent()[0].className;this._trigger("change",null,this.data)}}});c.extend(c.ui.accordion,{version:"1.8.16",
+animations:{slide:function(a,b){a=c.extend({easing:"swing",duration:300},a,b);if(a.toHide.size())if(a.toShow.size()){var d=a.toShow.css("overflow"),h=0,f={},g={},e;b=a.toShow;e=b[0].style.width;b.width(parseInt(b.parent().width(),10)-parseInt(b.css("paddingLeft"),10)-parseInt(b.css("paddingRight"),10)-(parseInt(b.css("borderLeftWidth"),10)||0)-(parseInt(b.css("borderRightWidth"),10)||0));c.each(["height","paddingTop","paddingBottom"],function(j,i){g[i]="hide";j=(""+c.css(a.toShow[0],i)).match(/^([\d+-.]+)(.*)$/);
+f[i]={value:j[1],unit:j[2]||"px"}});a.toShow.css({height:0,overflow:"hidden"}).show();a.toHide.filter(":hidden").each(a.complete).end().filter(":visible").animate(g,{step:function(j,i){if(i.prop=="height")h=i.end-i.start===0?0:(i.now-i.start)/(i.end-i.start);a.toShow[0].style[i.prop]=h*f[i.prop].value+f[i.prop].unit},duration:a.duration,easing:a.easing,complete:function(){a.autoHeight||a.toShow.css("height","");a.toShow.css({width:e,overflow:d});a.complete()}})}else a.toHide.animate({height:"hide",
+paddingTop:"hide",paddingBottom:"hide"},a);else a.toShow.animate({height:"show",paddingTop:"show",paddingBottom:"show"},a)},bounceslide:function(a){this.slide(a,{easing:a.down?"easeOutBounce":"swing",duration:a.down?1E3:200})}}})})(jQuery);
+;/*
+ * jQuery UI Autocomplete 1.8.16
+ *
+ * Copyright 2011, 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/Autocomplete
+ *
+ * Depends:
+ *	jquery.ui.core.js
+ *	jquery.ui.widget.js
+ *	jquery.ui.position.js
+ */
+(function(d){var e=0;d.widget("ui.autocomplete",{options:{appendTo:"body",autoFocus:false,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null},pending:0,_create:function(){var a=this,b=this.element[0].ownerDocument,g;this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(c){if(!(a.options.disabled||a.element.propAttr("readOnly"))){g=
+false;var f=d.ui.keyCode;switch(c.keyCode){case f.PAGE_UP:a._move("previousPage",c);break;case f.PAGE_DOWN:a._move("nextPage",c);break;case f.UP:a._move("previous",c);c.preventDefault();break;case f.DOWN:a._move("next",c);c.preventDefault();break;case f.ENTER:case f.NUMPAD_ENTER:if(a.menu.active){g=true;c.preventDefault()}case f.TAB:if(!a.menu.active)return;a.menu.select(c);break;case f.ESCAPE:a.element.val(a.term);a.close(c);break;default:clearTimeout(a.searching);a.searching=setTimeout(function(){if(a.term!=
+a.element.val()){a.selectedItem=null;a.search(null,c)}},a.options.delay);break}}}).bind("keypress.autocomplete",function(c){if(g){g=false;c.preventDefault()}}).bind("focus.autocomplete",function(){if(!a.options.disabled){a.selectedItem=null;a.previous=a.element.val()}}).bind("blur.autocomplete",function(c){if(!a.options.disabled){clearTimeout(a.searching);a.closing=setTimeout(function(){a.close(c);a._change(c)},150)}});this._initSource();this.response=function(){return a._response.apply(a,arguments)};
+this.menu=d("<ul></ul>").addClass("ui-autocomplete").appendTo(d(this.options.appendTo||"body",b)[0]).mousedown(function(c){var f=a.menu.element[0];d(c.target).closest(".ui-menu-item").length||setTimeout(function(){d(document).one("mousedown",function(h){h.target!==a.element[0]&&h.target!==f&&!d.ui.contains(f,h.target)&&a.close()})},1);setTimeout(function(){clearTimeout(a.closing)},13)}).menu({focus:function(c,f){f=f.item.data("item.autocomplete");false!==a._trigger("focus",c,{item:f})&&/^key/.test(c.originalEvent.type)&&
+a.element.val(f.value)},selected:function(c,f){var h=f.item.data("item.autocomplete"),i=a.previous;if(a.element[0]!==b.activeElement){a.element.focus();a.previous=i;setTimeout(function(){a.previous=i;a.selectedItem=h},1)}false!==a._trigger("select",c,{item:h})&&a.element.val(h.value);a.term=a.element.val();a.close(c);a.selectedItem=h},blur:function(){a.menu.element.is(":visible")&&a.element.val()!==a.term&&a.element.val(a.term)}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data("menu");
+d.fn.bgiframe&&this.menu.element.bgiframe()},destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup");this.menu.element.remove();d.Widget.prototype.destroy.call(this)},_setOption:function(a,b){d.Widget.prototype._setOption.apply(this,arguments);a==="source"&&this._initSource();if(a==="appendTo")this.menu.element.appendTo(d(b||"body",this.element[0].ownerDocument)[0]);a==="disabled"&&
+b&&this.xhr&&this.xhr.abort()},_initSource:function(){var a=this,b,g;if(d.isArray(this.options.source)){b=this.options.source;this.source=function(c,f){f(d.ui.autocomplete.filter(b,c.term))}}else if(typeof this.options.source==="string"){g=this.options.source;this.source=function(c,f){a.xhr&&a.xhr.abort();a.xhr=d.ajax({url:g,data:c,dataType:"json",autocompleteRequest:++e,success:function(h){this.autocompleteRequest===e&&f(h)},error:function(){this.autocompleteRequest===e&&f([])}})}}else this.source=
+this.options.source},search:function(a,b){a=a!=null?a:this.element.val();this.term=this.element.val();if(a.length<this.options.minLength)return this.close(b);clearTimeout(this.closing);if(this._trigger("search",b)!==false)return this._search(a)},_search:function(a){this.pending++;this.element.addClass("ui-autocomplete-loading");this.source({term:a},this.response)},_response:function(a){if(!this.options.disabled&&a&&a.length){a=this._normalize(a);this._suggest(a);this._trigger("open")}else this.close();
+this.pending--;this.pending||this.element.removeClass("ui-autocomplete-loading")},close:function(a){clearTimeout(this.closing);if(this.menu.element.is(":visible")){this.menu.element.hide();this.menu.deactivate();this._trigger("close",a)}},_change:function(a){this.previous!==this.element.val()&&this._trigger("change",a,{item:this.selectedItem})},_normalize:function(a){if(a.length&&a[0].label&&a[0].value)return a;return d.map(a,function(b){if(typeof b==="string")return{label:b,value:b};return d.extend({label:b.label||
+b.value,value:b.value||b.label},b)})},_suggest:function(a){var b=this.menu.element.empty().zIndex(this.element.zIndex()+1);this._renderMenu(b,a);this.menu.deactivate();this.menu.refresh();b.show();this._resizeMenu();b.position(d.extend({of:this.element},this.options.position));this.options.autoFocus&&this.menu.next(new d.Event("mouseover"))},_resizeMenu:function(){var a=this.menu.element;a.outerWidth(Math.max(a.width("").outerWidth(),this.element.outerWidth()))},_renderMenu:function(a,b){var g=this;
+d.each(b,function(c,f){g._renderItem(a,f)})},_renderItem:function(a,b){return d("<li></li>").data("item.autocomplete",b).append(d("<a></a>").text(b.label)).appendTo(a)},_move:function(a,b){if(this.menu.element.is(":visible"))if(this.menu.first()&&/^previous/.test(a)||this.menu.last()&&/^next/.test(a)){this.element.val(this.term);this.menu.deactivate()}else this.menu[a](b);else this.search(null,b)},widget:function(){return this.menu.element}});d.extend(d.ui.autocomplete,{escapeRegex:function(a){return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,
+"\\$&")},filter:function(a,b){var g=new RegExp(d.ui.autocomplete.escapeRegex(b),"i");return d.grep(a,function(c){return g.test(c.label||c.value||c)})}})})(jQuery);
+(function(d){d.widget("ui.menu",{_create:function(){var e=this;this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox","aria-activedescendant":"ui-active-menuitem"}).click(function(a){if(d(a.target).closest(".ui-menu-item a").length){a.preventDefault();e.select(a)}});this.refresh()},refresh:function(){var e=this;this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem").children("a").addClass("ui-corner-all").attr("tabindex",
+-1).mouseenter(function(a){e.activate(a,d(this).parent())}).mouseleave(function(){e.deactivate()})},activate:function(e,a){this.deactivate();if(this.hasScroll()){var b=a.offset().top-this.element.offset().top,g=this.element.scrollTop(),c=this.element.height();if(b<0)this.element.scrollTop(g+b);else b>=c&&this.element.scrollTop(g+b-c+a.height())}this.active=a.eq(0).children("a").addClass("ui-state-hover").attr("id","ui-active-menuitem").end();this._trigger("focus",e,{item:a})},deactivate:function(){if(this.active){this.active.children("a").removeClass("ui-state-hover").removeAttr("id");
+this._trigger("blur");this.active=null}},next:function(e){this.move("next",".ui-menu-item:first",e)},previous:function(e){this.move("prev",".ui-menu-item:last",e)},first:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},last:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},move:function(e,a,b){if(this.active){e=this.active[e+"All"](".ui-menu-item").eq(0);e.length?this.activate(b,e):this.activate(b,this.element.children(a))}else this.activate(b,
+this.element.children(a))},nextPage:function(e){if(this.hasScroll())if(!this.active||this.last())this.activate(e,this.element.children(".ui-menu-item:first"));else{var a=this.active.offset().top,b=this.element.height(),g=this.element.children(".ui-menu-item").filter(function(){var c=d(this).offset().top-a-b+d(this).height();return c<10&&c>-10});g.length||(g=this.element.children(".ui-menu-item:last"));this.activate(e,g)}else this.activate(e,this.element.children(".ui-menu-item").filter(!this.active||
+this.last()?":first":":last"))},previousPage:function(e){if(this.hasScroll())if(!this.active||this.first())this.activate(e,this.element.children(".ui-menu-item:last"));else{var a=this.active.offset().top,b=this.element.height();result=this.element.children(".ui-menu-item").filter(function(){var g=d(this).offset().top-a+b-d(this).height();return g<10&&g>-10});result.length||(result=this.element.children(".ui-menu-item:first"));this.activate(e,result)}else this.activate(e,this.element.children(".ui-menu-item").filter(!this.active||
+this.first()?":last":":first"))},hasScroll:function(){return this.element.height()<this.element[d.fn.prop?"prop":"attr"]("scrollHeight")},select:function(e){this._trigger("selected",e,{item:this.active})}})})(jQuery);
+;/*
+ * jQuery UI Button 1.8.16
+ *
+ * Copyright 2011, 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(b){var h,i,j,g,l=function(){var a=b(this).find(":ui-button");setTimeout(function(){a.button("refresh")},1)},k=function(a){var c=a.name,e=a.form,f=b([]);if(c)f=e?b(e).find("[name='"+c+"']"):b("[name='"+c+"']",a.ownerDocument).filter(function(){return!this.form});return f};b.widget("ui.button",{options:{disabled:null,text:true,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset.button").bind("reset.button",l);if(typeof this.options.disabled!==
+"boolean")this.options.disabled=this.element.propAttr("disabled");this._determineButtonType();this.hasTitle=!!this.buttonElement.attr("title");var a=this,c=this.options,e=this.type==="checkbox"||this.type==="radio",f="ui-state-hover"+(!e?" ui-state-active":"");if(c.label===null)c.label=this.buttonElement.html();if(this.element.is(":disabled"))c.disabled=true;this.buttonElement.addClass("ui-button ui-widget ui-state-default ui-corner-all").attr("role","button").bind("mouseenter.button",function(){if(!c.disabled){b(this).addClass("ui-state-hover");
+this===h&&b(this).addClass("ui-state-active")}}).bind("mouseleave.button",function(){c.disabled||b(this).removeClass(f)}).bind("click.button",function(d){if(c.disabled){d.preventDefault();d.stopImmediatePropagation()}});this.element.bind("focus.button",function(){a.buttonElement.addClass("ui-state-focus")}).bind("blur.button",function(){a.buttonElement.removeClass("ui-state-focus")});if(e){this.element.bind("change.button",function(){g||a.refresh()});this.buttonElement.bind("mousedown.button",function(d){if(!c.disabled){g=
+false;i=d.pageX;j=d.pageY}}).bind("mouseup.button",function(d){if(!c.disabled)if(i!==d.pageX||j!==d.pageY)g=true})}if(this.type==="checkbox")this.buttonElement.bind("click.button",function(){if(c.disabled||g)return false;b(this).toggleClass("ui-state-active");a.buttonElement.attr("aria-pressed",a.element[0].checked)});else if(this.type==="radio")this.buttonElement.bind("click.button",function(){if(c.disabled||g)return false;b(this).addClass("ui-state-active");a.buttonElement.attr("aria-pressed","true");
+var d=a.element[0];k(d).not(d).map(function(){return b(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed","false")});else{this.buttonElement.bind("mousedown.button",function(){if(c.disabled)return false;b(this).addClass("ui-state-active");h=this;b(document).one("mouseup",function(){h=null})}).bind("mouseup.button",function(){if(c.disabled)return false;b(this).removeClass("ui-state-active")}).bind("keydown.button",function(d){if(c.disabled)return false;if(d.keyCode==b.ui.keyCode.SPACE||
+d.keyCode==b.ui.keyCode.ENTER)b(this).addClass("ui-state-active")}).bind("keyup.button",function(){b(this).removeClass("ui-state-active")});this.buttonElement.is("a")&&this.buttonElement.keyup(function(d){d.keyCode===b.ui.keyCode.SPACE&&b(this).click()})}this._setOption("disabled",c.disabled);this._resetButton()},_determineButtonType:function(){this.type=this.element.is(":checkbox")?"checkbox":this.element.is(":radio")?"radio":this.element.is("input")?"input":"button";if(this.type==="checkbox"||this.type===
+"radio"){var a=this.element.parents().filter(":last"),c="label[for='"+this.element.attr("id")+"']";this.buttonElement=a.find(c);if(!this.buttonElement.length){a=a.length?a.siblings():this.element.siblings();this.buttonElement=a.filter(c);if(!this.buttonElement.length)this.buttonElement=a.find(c)}this.element.addClass("ui-helper-hidden-accessible");(a=this.element.is(":checked"))&&this.buttonElement.addClass("ui-state-active");this.buttonElement.attr("aria-pressed",a)}else this.buttonElement=this.element},
+widget:function(){return this.buttonElement},destroy:function(){this.element.removeClass("ui-helper-hidden-accessible");this.buttonElement.removeClass("ui-button ui-widget ui-state-default ui-corner-all ui-state-hover ui-state-active  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").removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html());this.hasTitle||this.buttonElement.removeAttr("title");
+b.Widget.prototype.destroy.call(this)},_setOption:function(a,c){b.Widget.prototype._setOption.apply(this,arguments);if(a==="disabled")c?this.element.propAttr("disabled",true):this.element.propAttr("disabled",false);else this._resetButton()},refresh:function(){var a=this.element.is(":disabled");a!==this.options.disabled&&this._setOption("disabled",a);if(this.type==="radio")k(this.element[0]).each(function(){b(this).is(":checked")?b(this).button("widget").addClass("ui-state-active").attr("aria-pressed",
+"true"):b(this).button("widget").removeClass("ui-state-active").attr("aria-pressed","false")});else if(this.type==="checkbox")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(this.type==="input")this.options.label&&this.element.val(this.options.label);else{var a=this.buttonElement.removeClass("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"),
+c=b("<span></span>").addClass("ui-button-text").html(this.options.label).appendTo(a.empty()).text(),e=this.options.icons,f=e.primary&&e.secondary,d=[];if(e.primary||e.secondary){if(this.options.text)d.push("ui-button-text-icon"+(f?"s":e.primary?"-primary":"-secondary"));e.primary&&a.prepend("<span class='ui-button-icon-primary ui-icon "+e.primary+"'></span>");e.secondary&&a.append("<span class='ui-button-icon-secondary ui-icon "+e.secondary+"'></span>");if(!this.options.text){d.push(f?"ui-button-icons-only":
+"ui-button-icon-only");this.hasTitle||a.attr("title",c)}}else d.push("ui-button-text-only");a.addClass(d.join(" "))}}});b.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(a,c){a==="disabled"&&this.buttons.button("option",a,c);b.Widget.prototype._setOption.apply(this,arguments)},refresh:function(){var a=this.element.css("direction")===
+"ltr";this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return b(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(a?"ui-corner-left":"ui-corner-right").end().filter(":last").addClass(a?"ui-corner-right":"ui-corner-left").end().end()},destroy:function(){this.element.removeClass("ui-buttonset");this.buttons.map(function(){return b(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy");
+b.Widget.prototype.destroy.call(this)}})})(jQuery);
+;/*
+ * jQuery UI Dialog 1.8.16
+ *
+ * Copyright 2011, 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(c,l){var m={buttons:true,height:true,maxHeight:true,maxWidth:true,minHeight:true,minWidth:true,width:true},n={maxHeight:true,maxWidth:true,minHeight:true,minWidth:true},o=c.attrFn||{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true,click:true};c.widget("ui.dialog",{options:{autoOpen:true,buttons:{},closeOnEscape:true,closeText:"close",dialogClass:"",draggable:true,hide:null,height:"auto",maxHeight:false,maxWidth:false,minHeight:150,minWidth:150,modal:false,
+position:{my:"center",at:"center",collision:"fit",using:function(a){var b=c(this).css(a).offset().top;b<0&&c(this).css("top",a.top-b)}},resizable:true,show:null,stack:true,title:"",width:300,zIndex:1E3},_create:function(){this.originalTitle=this.element.attr("title");if(typeof this.originalTitle!=="string")this.originalTitle="";this.options.title=this.options.title||this.originalTitle;var a=this,b=a.options,d=b.title||"&#160;",e=c.ui.dialog.getTitleId(a.element),g=(a.uiDialog=c("<div></div>")).appendTo(document.body).hide().addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+
+b.dialogClass).css({zIndex:b.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(i){if(b.closeOnEscape&&!i.isDefaultPrevented()&&i.keyCode&&i.keyCode===c.ui.keyCode.ESCAPE){a.close(i);i.preventDefault()}}).attr({role:"dialog","aria-labelledby":e}).mousedown(function(i){a.moveToTop(false,i)});a.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(g);var f=(a.uiDialogTitlebar=c("<div></div>")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(g),
+h=c('<a href="#"></a>').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){h.addClass("ui-state-hover")},function(){h.removeClass("ui-state-hover")}).focus(function(){h.addClass("ui-state-focus")}).blur(function(){h.removeClass("ui-state-focus")}).click(function(i){a.close(i);return false}).appendTo(f);(a.uiDialogTitlebarCloseText=c("<span></span>")).addClass("ui-icon ui-icon-closethick").text(b.closeText).appendTo(h);c("<span></span>").addClass("ui-dialog-title").attr("id",
+e).html(d).prependTo(f);if(c.isFunction(b.beforeclose)&&!c.isFunction(b.beforeClose))b.beforeClose=b.beforeclose;f.find("*").add(f).disableSelection();b.draggable&&c.fn.draggable&&a._makeDraggable();b.resizable&&c.fn.resizable&&a._makeResizable();a._createButtons(b.buttons);a._isOpen=false;c.fn.bgiframe&&g.bgiframe()},_init:function(){this.options.autoOpen&&this.open()},destroy:function(){var a=this;a.overlay&&a.overlay.destroy();a.uiDialog.hide();a.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body");
+a.uiDialog.remove();a.originalTitle&&a.element.attr("title",a.originalTitle);return a},widget:function(){return this.uiDialog},close:function(a){var b=this,d,e;if(false!==b._trigger("beforeClose",a)){b.overlay&&b.overlay.destroy();b.uiDialog.unbind("keypress.ui-dialog");b._isOpen=false;if(b.options.hide)b.uiDialog.hide(b.options.hide,function(){b._trigger("close",a)});else{b.uiDialog.hide();b._trigger("close",a)}c.ui.dialog.overlay.resize();if(b.options.modal){d=0;c(".ui-dialog").each(function(){if(this!==
+b.uiDialog[0]){e=c(this).css("z-index");isNaN(e)||(d=Math.max(d,e))}});c.ui.dialog.maxZ=d}return b}},isOpen:function(){return this._isOpen},moveToTop:function(a,b){var d=this,e=d.options;if(e.modal&&!a||!e.stack&&!e.modal)return d._trigger("focus",b);if(e.zIndex>c.ui.dialog.maxZ)c.ui.dialog.maxZ=e.zIndex;if(d.overlay){c.ui.dialog.maxZ+=1;d.overlay.$el.css("z-index",c.ui.dialog.overlay.maxZ=c.ui.dialog.maxZ)}a={scrollTop:d.element.scrollTop(),scrollLeft:d.element.scrollLeft()};c.ui.dialog.maxZ+=1;
+d.uiDialog.css("z-index",c.ui.dialog.maxZ);d.element.attr(a);d._trigger("focus",b);return d},open:function(){if(!this._isOpen){var a=this,b=a.options,d=a.uiDialog;a.overlay=b.modal?new c.ui.dialog.overlay(a):null;a._size();a._position(b.position);d.show(b.show);a.moveToTop(true);b.modal&&d.bind("keypress.ui-dialog",function(e){if(e.keyCode===c.ui.keyCode.TAB){var g=c(":tabbable",this),f=g.filter(":first");g=g.filter(":last");if(e.target===g[0]&&!e.shiftKey){f.focus(1);return false}else if(e.target===
+f[0]&&e.shiftKey){g.focus(1);return false}}});c(a.element.find(":tabbable").get().concat(d.find(".ui-dialog-buttonpane :tabbable").get().concat(d.get()))).eq(0).focus();a._isOpen=true;a._trigger("open");return a}},_createButtons:function(a){var b=this,d=false,e=c("<div></div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),g=c("<div></div>").addClass("ui-dialog-buttonset").appendTo(e);b.uiDialog.find(".ui-dialog-buttonpane").remove();typeof a==="object"&&a!==null&&c.each(a,
+function(){return!(d=true)});if(d){c.each(a,function(f,h){h=c.isFunction(h)?{click:h,text:f}:h;var i=c('<button type="button"></button>').click(function(){h.click.apply(b.element[0],arguments)}).appendTo(g);c.each(h,function(j,k){if(j!=="click")j in o?i[j](k):i.attr(j,k)});c.fn.button&&i.button()});e.appendTo(b.uiDialog)}},_makeDraggable:function(){function a(f){return{position:f.position,offset:f.offset}}var b=this,d=b.options,e=c(document),g;b.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",
+handle:".ui-dialog-titlebar",containment:"document",start:function(f,h){g=d.height==="auto"?"auto":c(this).height();c(this).height(c(this).height()).addClass("ui-dialog-dragging");b._trigger("dragStart",f,a(h))},drag:function(f,h){b._trigger("drag",f,a(h))},stop:function(f,h){d.position=[h.position.left-e.scrollLeft(),h.position.top-e.scrollTop()];c(this).removeClass("ui-dialog-dragging").height(g);b._trigger("dragStop",f,a(h));c.ui.dialog.overlay.resize()}})},_makeResizable:function(a){function b(f){return{originalPosition:f.originalPosition,
+originalSize:f.originalSize,position:f.position,size:f.size}}a=a===l?this.options.resizable:a;var d=this,e=d.options,g=d.uiDialog.css("position");a=typeof a==="string"?a:"n,e,s,w,se,sw,ne,nw";d.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:d.element,maxWidth:e.maxWidth,maxHeight:e.maxHeight,minWidth:e.minWidth,minHeight:d._minHeight(),handles:a,start:function(f,h){c(this).addClass("ui-dialog-resizing");d._trigger("resizeStart",f,b(h))},resize:function(f,h){d._trigger("resize",
+f,b(h))},stop:function(f,h){c(this).removeClass("ui-dialog-resizing");e.height=c(this).height();e.width=c(this).width();d._trigger("resizeStop",f,b(h));c.ui.dialog.overlay.resize()}}).css("position",g).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_minHeight:function(){var a=this.options;return a.height==="auto"?a.minHeight:Math.min(a.minHeight,a.height)},_position:function(a){var b=[],d=[0,0],e;if(a){if(typeof a==="string"||typeof a==="object"&&"0"in a){b=a.split?a.split(" "):
+[a[0],a[1]];if(b.length===1)b[1]=b[0];c.each(["left","top"],function(g,f){if(+b[g]===b[g]){d[g]=b[g];b[g]=f}});a={my:b.join(" "),at:b.join(" "),offset:d.join(" ")}}a=c.extend({},c.ui.dialog.prototype.options.position,a)}else a=c.ui.dialog.prototype.options.position;(e=this.uiDialog.is(":visible"))||this.uiDialog.show();this.uiDialog.css({top:0,left:0}).position(c.extend({of:window},a));e||this.uiDialog.hide()},_setOptions:function(a){var b=this,d={},e=false;c.each(a,function(g,f){b._setOption(g,f);
+if(g in m)e=true;if(g in n)d[g]=f});e&&this._size();this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option",d)},_setOption:function(a,b){var d=this,e=d.uiDialog;switch(a){case "beforeclose":a="beforeClose";break;case "buttons":d._createButtons(b);break;case "closeText":d.uiDialogTitlebarCloseText.text(""+b);break;case "dialogClass":e.removeClass(d.options.dialogClass).addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+b);break;case "disabled":b?e.addClass("ui-dialog-disabled"):
+e.removeClass("ui-dialog-disabled");break;case "draggable":var g=e.is(":data(draggable)");g&&!b&&e.draggable("destroy");!g&&b&&d._makeDraggable();break;case "position":d._position(b);break;case "resizable":(g=e.is(":data(resizable)"))&&!b&&e.resizable("destroy");g&&typeof b==="string"&&e.resizable("option","handles",b);!g&&b!==false&&d._makeResizable(b);break;case "title":c(".ui-dialog-title",d.uiDialogTitlebar).html(""+(b||"&#160;"));break}c.Widget.prototype._setOption.apply(d,arguments)},_size:function(){var a=
+this.options,b,d,e=this.uiDialog.is(":visible");this.element.show().css({width:"auto",minHeight:0,height:0});if(a.minWidth>a.width)a.width=a.minWidth;b=this.uiDialog.css({height:"auto",width:a.width}).height();d=Math.max(0,a.minHeight-b);if(a.height==="auto")if(c.support.minHeight)this.element.css({minHeight:d,height:"auto"});else{this.uiDialog.show();a=this.element.css("height","auto").height();e||this.uiDialog.hide();this.element.height(Math.max(a,d))}else this.element.height(Math.max(a.height-
+b,0));this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())}});c.extend(c.ui.dialog,{version:"1.8.16",uuid:0,maxZ:0,getTitleId:function(a){a=a.attr("id");if(!a){this.uuid+=1;a=this.uuid}return"ui-dialog-title-"+a},overlay:function(a){this.$el=c.ui.dialog.overlay.create(a)}});c.extend(c.ui.dialog.overlay,{instances:[],oldInstances:[],maxZ:0,events:c.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(a){return a+".dialog-overlay"}).join(" "),
+create:function(a){if(this.instances.length===0){setTimeout(function(){c.ui.dialog.overlay.instances.length&&c(document).bind(c.ui.dialog.overlay.events,function(d){if(c(d.target).zIndex()<c.ui.dialog.overlay.maxZ)return false})},1);c(document).bind("keydown.dialog-overlay",function(d){if(a.options.closeOnEscape&&!d.isDefaultPrevented()&&d.keyCode&&d.keyCode===c.ui.keyCode.ESCAPE){a.close(d);d.preventDefault()}});c(window).bind("resize.dialog-overlay",c.ui.dialog.overlay.resize)}var b=(this.oldInstances.pop()||
+c("<div></div>").addClass("ui-widget-overlay")).appendTo(document.body).css({width:this.width(),height:this.height()});c.fn.bgiframe&&b.bgiframe();this.instances.push(b);return b},destroy:function(a){var b=c.inArray(a,this.instances);b!=-1&&this.oldInstances.push(this.instances.splice(b,1)[0]);this.instances.length===0&&c([document,window]).unbind(".dialog-overlay");a.remove();var d=0;c.each(this.instances,function(){d=Math.max(d,this.css("z-index"))});this.maxZ=d},height:function(){var a,b;if(c.browser.msie&&
+c.browser.version<7){a=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);b=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);return a<b?c(window).height()+"px":a+"px"}else return c(document).height()+"px"},width:function(){var a,b;if(c.browser.msie){a=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth);b=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth);return a<b?c(window).width()+"px":a+"px"}else return c(document).width()+
+"px"},resize:function(){var a=c([]);c.each(c.ui.dialog.overlay.instances,function(){a=a.add(this)});a.css({width:0,height:0}).css({width:c.ui.dialog.overlay.width(),height:c.ui.dialog.overlay.height()})}});c.extend(c.ui.dialog.overlay.prototype,{destroy:function(){c.ui.dialog.overlay.destroy(this.$el)}})})(jQuery);
+;/*
+ * jQuery UI Slider 1.8.16
+ *
+ * Copyright 2011, 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/Slider
+ *
+ * Depends:
+ *	jquery.ui.core.js
+ *	jquery.ui.mouse.js
+ *	jquery.ui.widget.js
+ */
+(function(d){d.widget("ui.slider",d.ui.mouse,{widgetEventPrefix:"slide",options:{animate:false,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null},_create:function(){var a=this,b=this.options,c=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),f=b.values&&b.values.length||1,e=[];this._mouseSliding=this._keySliding=false;this._animateOff=true;this._handleIndex=null;this._detectOrientation();this._mouseInit();this.element.addClass("ui-slider ui-slider-"+
+this.orientation+" ui-widget ui-widget-content ui-corner-all"+(b.disabled?" ui-slider-disabled ui-disabled":""));this.range=d([]);if(b.range){if(b.range===true){if(!b.values)b.values=[this._valueMin(),this._valueMin()];if(b.values.length&&b.values.length!==2)b.values=[b.values[0],b.values[0]]}this.range=d("<div></div>").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+(b.range==="min"||b.range==="max"?" ui-slider-range-"+b.range:""))}for(var j=c.length;j<f;j+=1)e.push("<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>");
+this.handles=c.add(d(e.join("")).appendTo(a.element));this.handle=this.handles.eq(0);this.handles.add(this.range).filter("a").click(function(g){g.preventDefault()}).hover(function(){b.disabled||d(this).addClass("ui-state-hover")},function(){d(this).removeClass("ui-state-hover")}).focus(function(){if(b.disabled)d(this).blur();else{d(".ui-slider .ui-state-focus").removeClass("ui-state-focus");d(this).addClass("ui-state-focus")}}).blur(function(){d(this).removeClass("ui-state-focus")});this.handles.each(function(g){d(this).data("index.ui-slider-handle",
+g)});this.handles.keydown(function(g){var k=true,l=d(this).data("index.ui-slider-handle"),i,h,m;if(!a.options.disabled){switch(g.keyCode){case d.ui.keyCode.HOME:case d.ui.keyCode.END:case d.ui.keyCode.PAGE_UP:case d.ui.keyCode.PAGE_DOWN:case d.ui.keyCode.UP:case d.ui.keyCode.RIGHT:case d.ui.keyCode.DOWN:case d.ui.keyCode.LEFT:k=false;if(!a._keySliding){a._keySliding=true;d(this).addClass("ui-state-active");i=a._start(g,l);if(i===false)return}break}m=a.options.step;i=a.options.values&&a.options.values.length?
+(h=a.values(l)):(h=a.value());switch(g.keyCode){case d.ui.keyCode.HOME:h=a._valueMin();break;case d.ui.keyCode.END:h=a._valueMax();break;case d.ui.keyCode.PAGE_UP:h=a._trimAlignValue(i+(a._valueMax()-a._valueMin())/5);break;case d.ui.keyCode.PAGE_DOWN:h=a._trimAlignValue(i-(a._valueMax()-a._valueMin())/5);break;case d.ui.keyCode.UP:case d.ui.keyCode.RIGHT:if(i===a._valueMax())return;h=a._trimAlignValue(i+m);break;case d.ui.keyCode.DOWN:case d.ui.keyCode.LEFT:if(i===a._valueMin())return;h=a._trimAlignValue(i-
+m);break}a._slide(g,l,h);return k}}).keyup(function(g){var k=d(this).data("index.ui-slider-handle");if(a._keySliding){a._keySliding=false;a._stop(g,k);a._change(g,k);d(this).removeClass("ui-state-active")}});this._refreshValue();this._animateOff=false},destroy:function(){this.handles.remove();this.range.remove();this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider");this._mouseDestroy();
+return this},_mouseCapture:function(a){var b=this.options,c,f,e,j,g;if(b.disabled)return false;this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.elementOffset=this.element.offset();c=this._normValueFromMouse({x:a.pageX,y:a.pageY});f=this._valueMax()-this._valueMin()+1;j=this;this.handles.each(function(k){var l=Math.abs(c-j.values(k));if(f>l){f=l;e=d(this);g=k}});if(b.range===true&&this.values(1)===b.min){g+=1;e=d(this.handles[g])}if(this._start(a,g)===false)return false;
+this._mouseSliding=true;j._handleIndex=g;e.addClass("ui-state-active").focus();b=e.offset();this._clickOffset=!d(a.target).parents().andSelf().is(".ui-slider-handle")?{left:0,top:0}:{left:a.pageX-b.left-e.width()/2,top:a.pageY-b.top-e.height()/2-(parseInt(e.css("borderTopWidth"),10)||0)-(parseInt(e.css("borderBottomWidth"),10)||0)+(parseInt(e.css("marginTop"),10)||0)};this.handles.hasClass("ui-state-hover")||this._slide(a,g,c);return this._animateOff=true},_mouseStart:function(){return true},_mouseDrag:function(a){var b=
+this._normValueFromMouse({x:a.pageX,y:a.pageY});this._slide(a,this._handleIndex,b);return false},_mouseStop:function(a){this.handles.removeClass("ui-state-active");this._mouseSliding=false;this._stop(a,this._handleIndex);this._change(a,this._handleIndex);this._clickOffset=this._handleIndex=null;return this._animateOff=false},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(a){var b;if(this.orientation==="horizontal"){b=
+this.elementSize.width;a=a.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)}else{b=this.elementSize.height;a=a.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)}b=a/b;if(b>1)b=1;if(b<0)b=0;if(this.orientation==="vertical")b=1-b;a=this._valueMax()-this._valueMin();return this._trimAlignValue(this._valueMin()+b*a)},_start:function(a,b){var c={handle:this.handles[b],value:this.value()};if(this.options.values&&this.options.values.length){c.value=this.values(b);
+c.values=this.values()}return this._trigger("start",a,c)},_slide:function(a,b,c){var f;if(this.options.values&&this.options.values.length){f=this.values(b?0:1);if(this.options.values.length===2&&this.options.range===true&&(b===0&&c>f||b===1&&c<f))c=f;if(c!==this.values(b)){f=this.values();f[b]=c;a=this._trigger("slide",a,{handle:this.handles[b],value:c,values:f});this.values(b?0:1);a!==false&&this.values(b,c,true)}}else if(c!==this.value()){a=this._trigger("slide",a,{handle:this.handles[b],value:c});
+a!==false&&this.value(c)}},_stop:function(a,b){var c={handle:this.handles[b],value:this.value()};if(this.options.values&&this.options.values.length){c.value=this.values(b);c.values=this.values()}this._trigger("stop",a,c)},_change:function(a,b){if(!this._keySliding&&!this._mouseSliding){var c={handle:this.handles[b],value:this.value()};if(this.options.values&&this.options.values.length){c.value=this.values(b);c.values=this.values()}this._trigger("change",a,c)}},value:function(a){if(arguments.length){this.options.value=
+this._trimAlignValue(a);this._refreshValue();this._change(null,0)}else return this._value()},values:function(a,b){var c,f,e;if(arguments.length>1){this.options.values[a]=this._trimAlignValue(b);this._refreshValue();this._change(null,a)}else if(arguments.length)if(d.isArray(arguments[0])){c=this.options.values;f=arguments[0];for(e=0;e<c.length;e+=1){c[e]=this._trimAlignValue(f[e]);this._change(null,e)}this._refreshValue()}else return this.options.values&&this.options.values.length?this._values(a):
+this.value();else return this._values()},_setOption:function(a,b){var c,f=0;if(d.isArray(this.options.values))f=this.options.values.length;d.Widget.prototype._setOption.apply(this,arguments);switch(a){case "disabled":if(b){this.handles.filter(".ui-state-focus").blur();this.handles.removeClass("ui-state-hover");this.handles.propAttr("disabled",true);this.element.addClass("ui-disabled")}else{this.handles.propAttr("disabled",false);this.element.removeClass("ui-disabled")}break;case "orientation":this._detectOrientation();
+this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation);this._refreshValue();break;case "value":this._animateOff=true;this._refreshValue();this._change(null,0);this._animateOff=false;break;case "values":this._animateOff=true;this._refreshValue();for(c=0;c<f;c+=1)this._change(null,c);this._animateOff=false;break}},_value:function(){var a=this.options.value;return a=this._trimAlignValue(a)},_values:function(a){var b,c;if(arguments.length){b=this.options.values[a];
+return b=this._trimAlignValue(b)}else{b=this.options.values.slice();for(c=0;c<b.length;c+=1)b[c]=this._trimAlignValue(b[c]);return b}},_trimAlignValue:function(a){if(a<=this._valueMin())return this._valueMin();if(a>=this._valueMax())return this._valueMax();var b=this.options.step>0?this.options.step:1,c=(a-this._valueMin())%b;a=a-c;if(Math.abs(c)*2>=b)a+=c>0?b:-b;return parseFloat(a.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var a=
+this.options.range,b=this.options,c=this,f=!this._animateOff?b.animate:false,e,j={},g,k,l,i;if(this.options.values&&this.options.values.length)this.handles.each(function(h){e=(c.values(h)-c._valueMin())/(c._valueMax()-c._valueMin())*100;j[c.orientation==="horizontal"?"left":"bottom"]=e+"%";d(this).stop(1,1)[f?"animate":"css"](j,b.animate);if(c.options.range===true)if(c.orientation==="horizontal"){if(h===0)c.range.stop(1,1)[f?"animate":"css"]({left:e+"%"},b.animate);if(h===1)c.range[f?"animate":"css"]({width:e-
+g+"%"},{queue:false,duration:b.animate})}else{if(h===0)c.range.stop(1,1)[f?"animate":"css"]({bottom:e+"%"},b.animate);if(h===1)c.range[f?"animate":"css"]({height:e-g+"%"},{queue:false,duration:b.animate})}g=e});else{k=this.value();l=this._valueMin();i=this._valueMax();e=i!==l?(k-l)/(i-l)*100:0;j[c.orientation==="horizontal"?"left":"bottom"]=e+"%";this.handle.stop(1,1)[f?"animate":"css"](j,b.animate);if(a==="min"&&this.orientation==="horizontal")this.range.stop(1,1)[f?"animate":"css"]({width:e+"%"},
+b.animate);if(a==="max"&&this.orientation==="horizontal")this.range[f?"animate":"css"]({width:100-e+"%"},{queue:false,duration:b.animate});if(a==="min"&&this.orientation==="vertical")this.range.stop(1,1)[f?"animate":"css"]({height:e+"%"},b.animate);if(a==="max"&&this.orientation==="vertical")this.range[f?"animate":"css"]({height:100-e+"%"},{queue:false,duration:b.animate})}}});d.extend(d.ui.slider,{version:"1.8.16"})})(jQuery);
+;/*
+ * jQuery UI Tabs 1.8.16
+ *
+ * Copyright 2011, 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/Tabs
+ *
+ * Depends:
+ *	jquery.ui.core.js
+ *	jquery.ui.widget.js
+ */
+(function(d,p){function u(){return++v}function w(){return++x}var v=0,x=0;d.widget("ui.tabs",{options:{add:null,ajaxOptions:null,cache:false,cookie:null,collapsible:false,disable:null,disabled:[],enable:null,event:"click",fx:null,idPrefix:"ui-tabs-",load:null,panelTemplate:"<div></div>",remove:null,select:null,show:null,spinner:"<em>Loading&#8230;</em>",tabTemplate:"<li><a href='#{href}'><span>#{label}</span></a></li>"},_create:function(){this._tabify(true)},_setOption:function(b,e){if(b=="selected")this.options.collapsible&&
+e==this.options.selected||this.select(e);else{this.options[b]=e;this._tabify()}},_tabId:function(b){return b.title&&b.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF-]/g,"")||this.options.idPrefix+u()},_sanitizeSelector:function(b){return b.replace(/:/g,"\\:")},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+w());return d.cookie.apply(null,[b].concat(d.makeArray(arguments)))},_ui:function(b,e){return{tab:b,panel:e,index:this.anchors.index(b)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b=
+d(this);b.html(b.data("label.tabs")).removeData("label.tabs")})},_tabify:function(b){function e(g,f){g.css("display","");!d.support.opacity&&f.opacity&&g[0].style.removeAttribute("filter")}var a=this,c=this.options,h=/^#.+/;this.list=this.element.find("ol,ul").eq(0);this.lis=d(" > li:has(a[href])",this.list);this.anchors=this.lis.map(function(){return d("a",this)[0]});this.panels=d([]);this.anchors.each(function(g,f){var i=d(f).attr("href"),l=i.split("#")[0],q;if(l&&(l===location.toString().split("#")[0]||
+(q=d("base")[0])&&l===q.href)){i=f.hash;f.href=i}if(h.test(i))a.panels=a.panels.add(a.element.find(a._sanitizeSelector(i)));else if(i&&i!=="#"){d.data(f,"href.tabs",i);d.data(f,"load.tabs",i.replace(/#.*$/,""));i=a._tabId(f);f.href="#"+i;f=a.element.find("#"+i);if(!f.length){f=d(c.panelTemplate).attr("id",i).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(a.panels[g-1]||a.list);f.data("destroy.tabs",true)}a.panels=a.panels.add(f)}else c.disabled.push(g)});if(b){this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all");
+this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.lis.addClass("ui-state-default ui-corner-top");this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom");if(c.selected===p){location.hash&&this.anchors.each(function(g,f){if(f.hash==location.hash){c.selected=g;return false}});if(typeof c.selected!=="number"&&c.cookie)c.selected=parseInt(a._cookie(),10);if(typeof c.selected!=="number"&&this.lis.filter(".ui-tabs-selected").length)c.selected=
+this.lis.index(this.lis.filter(".ui-tabs-selected"));c.selected=c.selected||(this.lis.length?0:-1)}else if(c.selected===null)c.selected=-1;c.selected=c.selected>=0&&this.anchors[c.selected]||c.selected<0?c.selected:0;c.disabled=d.unique(c.disabled.concat(d.map(this.lis.filter(".ui-state-disabled"),function(g){return a.lis.index(g)}))).sort();d.inArray(c.selected,c.disabled)!=-1&&c.disabled.splice(d.inArray(c.selected,c.disabled),1);this.panels.addClass("ui-tabs-hide");this.lis.removeClass("ui-tabs-selected ui-state-active");
+if(c.selected>=0&&this.anchors.length){a.element.find(a._sanitizeSelector(a.anchors[c.selected].hash)).removeClass("ui-tabs-hide");this.lis.eq(c.selected).addClass("ui-tabs-selected ui-state-active");a.element.queue("tabs",function(){a._trigger("show",null,a._ui(a.anchors[c.selected],a.element.find(a._sanitizeSelector(a.anchors[c.selected].hash))[0]))});this.load(c.selected)}d(window).bind("unload",function(){a.lis.add(a.anchors).unbind(".tabs");a.lis=a.anchors=a.panels=null})}else c.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"));
+this.element[c.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible");c.cookie&&this._cookie(c.selected,c.cookie);b=0;for(var j;j=this.lis[b];b++)d(j)[d.inArray(b,c.disabled)!=-1&&!d(j).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled");c.cache===false&&this.anchors.removeData("cache.tabs");this.lis.add(this.anchors).unbind(".tabs");if(c.event!=="mouseover"){var k=function(g,f){f.is(":not(.ui-state-disabled)")&&f.addClass("ui-state-"+g)},n=function(g,f){f.removeClass("ui-state-"+
+g)};this.lis.bind("mouseover.tabs",function(){k("hover",d(this))});this.lis.bind("mouseout.tabs",function(){n("hover",d(this))});this.anchors.bind("focus.tabs",function(){k("focus",d(this).closest("li"))});this.anchors.bind("blur.tabs",function(){n("focus",d(this).closest("li"))})}var m,o;if(c.fx)if(d.isArray(c.fx)){m=c.fx[0];o=c.fx[1]}else m=o=c.fx;var r=o?function(g,f){d(g).closest("li").addClass("ui-tabs-selected ui-state-active");f.hide().removeClass("ui-tabs-hide").animate(o,o.duration||"normal",
+function(){e(f,o);a._trigger("show",null,a._ui(g,f[0]))})}:function(g,f){d(g).closest("li").addClass("ui-tabs-selected ui-state-active");f.removeClass("ui-tabs-hide");a._trigger("show",null,a._ui(g,f[0]))},s=m?function(g,f){f.animate(m,m.duration||"normal",function(){a.lis.removeClass("ui-tabs-selected ui-state-active");f.addClass("ui-tabs-hide");e(f,m);a.element.dequeue("tabs")})}:function(g,f){a.lis.removeClass("ui-tabs-selected ui-state-active");f.addClass("ui-tabs-hide");a.element.dequeue("tabs")};
+this.anchors.bind(c.event+".tabs",function(){var g=this,f=d(g).closest("li"),i=a.panels.filter(":not(.ui-tabs-hide)"),l=a.element.find(a._sanitizeSelector(g.hash));if(f.hasClass("ui-tabs-selected")&&!c.collapsible||f.hasClass("ui-state-disabled")||f.hasClass("ui-state-processing")||a.panels.filter(":animated").length||a._trigger("select",null,a._ui(this,l[0]))===false){this.blur();return false}c.selected=a.anchors.index(this);a.abort();if(c.collapsible)if(f.hasClass("ui-tabs-selected")){c.selected=
+-1;c.cookie&&a._cookie(c.selected,c.cookie);a.element.queue("tabs",function(){s(g,i)}).dequeue("tabs");this.blur();return false}else if(!i.length){c.cookie&&a._cookie(c.selected,c.cookie);a.element.queue("tabs",function(){r(g,l)});a.load(a.anchors.index(this));this.blur();return false}c.cookie&&a._cookie(c.selected,c.cookie);if(l.length){i.length&&a.element.queue("tabs",function(){s(g,i)});a.element.queue("tabs",function(){r(g,l)});a.load(a.anchors.index(this))}else throw"jQuery UI Tabs: Mismatching fragment identifier.";
+d.browser.msie&&this.blur()});this.anchors.bind("click.tabs",function(){return false})},_getIndex:function(b){if(typeof b=="string")b=this.anchors.index(this.anchors.filter("[href$="+b+"]"));return b},destroy:function(){var b=this.options;this.abort();this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs");this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.anchors.each(function(){var e=
+d.data(this,"href.tabs");if(e)this.href=e;var a=d(this).unbind(".tabs");d.each(["href","load","cache"],function(c,h){a.removeData(h+".tabs")})});this.lis.unbind(".tabs").add(this.panels).each(function(){d.data(this,"destroy.tabs")?d(this).remove():d(this).removeClass("ui-state-default ui-corner-top ui-tabs-selected ui-state-active ui-state-hover ui-state-focus ui-state-disabled ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide")});b.cookie&&this._cookie(null,b.cookie);return this},add:function(b,
+e,a){if(a===p)a=this.anchors.length;var c=this,h=this.options;e=d(h.tabTemplate.replace(/#\{href\}/g,b).replace(/#\{label\}/g,e));b=!b.indexOf("#")?b.replace("#",""):this._tabId(d("a",e)[0]);e.addClass("ui-state-default ui-corner-top").data("destroy.tabs",true);var j=c.element.find("#"+b);j.length||(j=d(h.panelTemplate).attr("id",b).data("destroy.tabs",true));j.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");if(a>=this.lis.length){e.appendTo(this.list);j.appendTo(this.list[0].parentNode)}else{e.insertBefore(this.lis[a]);
+j.insertBefore(this.panels[a])}h.disabled=d.map(h.disabled,function(k){return k>=a?++k:k});this._tabify();if(this.anchors.length==1){h.selected=0;e.addClass("ui-tabs-selected ui-state-active");j.removeClass("ui-tabs-hide");this.element.queue("tabs",function(){c._trigger("show",null,c._ui(c.anchors[0],c.panels[0]))});this.load(0)}this._trigger("add",null,this._ui(this.anchors[a],this.panels[a]));return this},remove:function(b){b=this._getIndex(b);var e=this.options,a=this.lis.eq(b).remove(),c=this.panels.eq(b).remove();
+if(a.hasClass("ui-tabs-selected")&&this.anchors.length>1)this.select(b+(b+1<this.anchors.length?1:-1));e.disabled=d.map(d.grep(e.disabled,function(h){return h!=b}),function(h){return h>=b?--h:h});this._tabify();this._trigger("remove",null,this._ui(a.find("a")[0],c[0]));return this},enable:function(b){b=this._getIndex(b);var e=this.options;if(d.inArray(b,e.disabled)!=-1){this.lis.eq(b).removeClass("ui-state-disabled");e.disabled=d.grep(e.disabled,function(a){return a!=b});this._trigger("enable",null,
+this._ui(this.anchors[b],this.panels[b]));return this}},disable:function(b){b=this._getIndex(b);var e=this.options;if(b!=e.selected){this.lis.eq(b).addClass("ui-state-disabled");e.disabled.push(b);e.disabled.sort();this._trigger("disable",null,this._ui(this.anchors[b],this.panels[b]))}return this},select:function(b){b=this._getIndex(b);if(b==-1)if(this.options.collapsible&&this.options.selected!=-1)b=this.options.selected;else return this;this.anchors.eq(b).trigger(this.options.event+".tabs");return this},
+load:function(b){b=this._getIndex(b);var e=this,a=this.options,c=this.anchors.eq(b)[0],h=d.data(c,"load.tabs");this.abort();if(!h||this.element.queue("tabs").length!==0&&d.data(c,"cache.tabs"))this.element.dequeue("tabs");else{this.lis.eq(b).addClass("ui-state-processing");if(a.spinner){var j=d("span",c);j.data("label.tabs",j.html()).html(a.spinner)}this.xhr=d.ajax(d.extend({},a.ajaxOptions,{url:h,success:function(k,n){e.element.find(e._sanitizeSelector(c.hash)).html(k);e._cleanup();a.cache&&d.data(c,
+"cache.tabs",true);e._trigger("load",null,e._ui(e.anchors[b],e.panels[b]));try{a.ajaxOptions.success(k,n)}catch(m){}},error:function(k,n){e._cleanup();e._trigger("load",null,e._ui(e.anchors[b],e.panels[b]));try{a.ajaxOptions.error(k,n,b,c)}catch(m){}}}));e.element.dequeue("tabs");return this}},abort:function(){this.element.queue([]);this.panels.stop(false,true);this.element.queue("tabs",this.element.queue("tabs").splice(-2,2));if(this.xhr){this.xhr.abort();delete this.xhr}this._cleanup();return this},
+url:function(b,e){this.anchors.eq(b).removeData("cache.tabs").data("load.tabs",e);return this},length:function(){return this.anchors.length}});d.extend(d.ui.tabs,{version:"1.8.16"});d.extend(d.ui.tabs.prototype,{rotation:null,rotate:function(b,e){var a=this,c=this.options,h=a._rotate||(a._rotate=function(j){clearTimeout(a.rotation);a.rotation=setTimeout(function(){var k=c.selected;a.select(++k<a.anchors.length?k:0)},b);j&&j.stopPropagation()});e=a._unrotate||(a._unrotate=!e?function(j){j.clientX&&
+a.rotate(null)}:function(){t=c.selected;h()});if(b){this.element.bind("tabsshow",h);this.anchors.bind(c.event+".tabs",e);h()}else{clearTimeout(a.rotation);this.element.unbind("tabsshow",h);this.anchors.unbind(c.event+".tabs",e);delete this._rotate;delete this._unrotate}return this}})})(jQuery);
+;/*
+ * jQuery UI Datepicker 1.8.16
+ *
+ * Copyright 2011, 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/Datepicker
+ *
+ * Depends:
+ *	jquery.ui.core.js
+ */
+(function(d,C){function M(){this.debug=false;this._curInst=null;this._keyEvent=false;this._disabledInputs=[];this._inDialog=this._datepickerShowing=false;this._mainDivId="ui-datepicker-div";this._inlineClass="ui-datepicker-inline";this._appendClass="ui-datepicker-append";this._triggerClass="ui-datepicker-trigger";this._dialogClass="ui-datepicker-dialog";this._disableClass="ui-datepicker-disabled";this._unselectableClass="ui-datepicker-unselectable";this._currentClass="ui-datepicker-current-day";this._dayOverClass=
+"ui-datepicker-days-cell-over";this.regional=[];this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su",
+"Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:false,showMonthAfterYear:false,yearSuffix:""};this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:false,hideIfNoPrevNext:false,navigationAsDateFormat:false,gotoCurrent:false,changeMonth:false,changeYear:false,yearRange:"c-10:c+10",showOtherMonths:false,selectOtherMonths:false,showWeek:false,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",
+minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:true,showButtonPanel:false,autoSize:false,disabled:false};d.extend(this._defaults,this.regional[""]);this.dpDiv=N(d('<div id="'+this._mainDivId+'" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))}function N(a){return a.bind("mouseout",
+function(b){b=d(b.target).closest("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a");b.length&&b.removeClass("ui-state-hover ui-datepicker-prev-hover ui-datepicker-next-hover")}).bind("mouseover",function(b){b=d(b.target).closest("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a");if(!(d.datepicker._isDisabledDatepicker(J.inline?a.parent()[0]:J.input[0])||!b.length)){b.parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");
+b.addClass("ui-state-hover");b.hasClass("ui-datepicker-prev")&&b.addClass("ui-datepicker-prev-hover");b.hasClass("ui-datepicker-next")&&b.addClass("ui-datepicker-next-hover")}})}function H(a,b){d.extend(a,b);for(var c in b)if(b[c]==null||b[c]==C)a[c]=b[c];return a}d.extend(d.ui,{datepicker:{version:"1.8.16"}});var B=(new Date).getTime(),J;d.extend(M.prototype,{markerClassName:"hasDatepicker",maxRows:4,log:function(){this.debug&&console.log.apply("",arguments)},_widgetDatepicker:function(){return this.dpDiv},
+setDefaults:function(a){H(this._defaults,a||{});return this},_attachDatepicker:function(a,b){var c=null;for(var e in this._defaults){var f=a.getAttribute("date:"+e);if(f){c=c||{};try{c[e]=eval(f)}catch(h){c[e]=f}}}e=a.nodeName.toLowerCase();f=e=="div"||e=="span";if(!a.id){this.uuid+=1;a.id="dp"+this.uuid}var i=this._newInst(d(a),f);i.settings=d.extend({},b||{},c||{});if(e=="input")this._connectDatepicker(a,i);else f&&this._inlineDatepicker(a,i)},_newInst:function(a,b){return{id:a[0].id.replace(/([^A-Za-z0-9_-])/g,
+"\\\\$1"),input:a,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:b,dpDiv:!b?this.dpDiv:N(d('<div class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))}},_connectDatepicker:function(a,b){var c=d(a);b.append=d([]);b.trigger=d([]);if(!c.hasClass(this.markerClassName)){this._attachments(c,b);c.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",
+function(e,f,h){b.settings[f]=h}).bind("getData.datepicker",function(e,f){return this._get(b,f)});this._autoSize(b);d.data(a,"datepicker",b);b.settings.disabled&&this._disableDatepicker(a)}},_attachments:function(a,b){var c=this._get(b,"appendText"),e=this._get(b,"isRTL");b.append&&b.append.remove();if(c){b.append=d('<span class="'+this._appendClass+'">'+c+"</span>");a[e?"before":"after"](b.append)}a.unbind("focus",this._showDatepicker);b.trigger&&b.trigger.remove();c=this._get(b,"showOn");if(c==
+"focus"||c=="both")a.focus(this._showDatepicker);if(c=="button"||c=="both"){c=this._get(b,"buttonText");var f=this._get(b,"buttonImage");b.trigger=d(this._get(b,"buttonImageOnly")?d("<img/>").addClass(this._triggerClass).attr({src:f,alt:c,title:c}):d('<button type="button"></button>').addClass(this._triggerClass).html(f==""?c:d("<img/>").attr({src:f,alt:c,title:c})));a[e?"before":"after"](b.trigger);b.trigger.click(function(){d.datepicker._datepickerShowing&&d.datepicker._lastInput==a[0]?d.datepicker._hideDatepicker():
+d.datepicker._showDatepicker(a[0]);return false})}},_autoSize:function(a){if(this._get(a,"autoSize")&&!a.inline){var b=new Date(2009,11,20),c=this._get(a,"dateFormat");if(c.match(/[DM]/)){var e=function(f){for(var h=0,i=0,g=0;g<f.length;g++)if(f[g].length>h){h=f[g].length;i=g}return i};b.setMonth(e(this._get(a,c.match(/MM/)?"monthNames":"monthNamesShort")));b.setDate(e(this._get(a,c.match(/DD/)?"dayNames":"dayNamesShort"))+20-b.getDay())}a.input.attr("size",this._formatDate(a,b).length)}},_inlineDatepicker:function(a,
+b){var c=d(a);if(!c.hasClass(this.markerClassName)){c.addClass(this.markerClassName).append(b.dpDiv).bind("setData.datepicker",function(e,f,h){b.settings[f]=h}).bind("getData.datepicker",function(e,f){return this._get(b,f)});d.data(a,"datepicker",b);this._setDate(b,this._getDefaultDate(b),true);this._updateDatepicker(b);this._updateAlternate(b);b.settings.disabled&&this._disableDatepicker(a);b.dpDiv.css("display","block")}},_dialogDatepicker:function(a,b,c,e,f){a=this._dialogInst;if(!a){this.uuid+=
+1;this._dialogInput=d('<input type="text" id="'+("dp"+this.uuid)+'" style="position: absolute; top: -100px; width: 0px; z-index: -10;"/>');this._dialogInput.keydown(this._doKeyDown);d("body").append(this._dialogInput);a=this._dialogInst=this._newInst(this._dialogInput,false);a.settings={};d.data(this._dialogInput[0],"datepicker",a)}H(a.settings,e||{});b=b&&b.constructor==Date?this._formatDate(a,b):b;this._dialogInput.val(b);this._pos=f?f.length?f:[f.pageX,f.pageY]:null;if(!this._pos)this._pos=[document.documentElement.clientWidth/
+2-100+(document.documentElement.scrollLeft||document.body.scrollLeft),document.documentElement.clientHeight/2-150+(document.documentElement.scrollTop||document.body.scrollTop)];this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px");a.settings.onSelect=c;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);d.blockUI&&d.blockUI(this.dpDiv);d.data(this._dialogInput[0],"datepicker",a);return this},_destroyDatepicker:function(a){var b=
+d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();d.removeData(a,"datepicker");if(e=="input"){c.append.remove();c.trigger.remove();b.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)}else if(e=="div"||e=="span")b.removeClass(this.markerClassName).empty()}},_enableDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=
+a.nodeName.toLowerCase();if(e=="input"){a.disabled=false;c.trigger.filter("button").each(function(){this.disabled=false}).end().filter("img").css({opacity:"1.0",cursor:""})}else if(e=="div"||e=="span"){b=b.children("."+this._inlineClass);b.children().removeClass("ui-state-disabled");b.find("select.ui-datepicker-month, select.ui-datepicker-year").removeAttr("disabled")}this._disabledInputs=d.map(this._disabledInputs,function(f){return f==a?null:f})}},_disableDatepicker:function(a){var b=d(a),c=d.data(a,
+"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();if(e=="input"){a.disabled=true;c.trigger.filter("button").each(function(){this.disabled=true}).end().filter("img").css({opacity:"0.5",cursor:"default"})}else if(e=="div"||e=="span"){b=b.children("."+this._inlineClass);b.children().addClass("ui-state-disabled");b.find("select.ui-datepicker-month, select.ui-datepicker-year").attr("disabled","disabled")}this._disabledInputs=d.map(this._disabledInputs,function(f){return f==
+a?null:f});this._disabledInputs[this._disabledInputs.length]=a}},_isDisabledDatepicker:function(a){if(!a)return false;for(var b=0;b<this._disabledInputs.length;b++)if(this._disabledInputs[b]==a)return true;return false},_getInst:function(a){try{return d.data(a,"datepicker")}catch(b){throw"Missing instance data for this datepicker";}},_optionDatepicker:function(a,b,c){var e=this._getInst(a);if(arguments.length==2&&typeof b=="string")return b=="defaults"?d.extend({},d.datepicker._defaults):e?b=="all"?
+d.extend({},e.settings):this._get(e,b):null;var f=b||{};if(typeof b=="string"){f={};f[b]=c}if(e){this._curInst==e&&this._hideDatepicker();var h=this._getDateDatepicker(a,true),i=this._getMinMaxDate(e,"min"),g=this._getMinMaxDate(e,"max");H(e.settings,f);if(i!==null&&f.dateFormat!==C&&f.minDate===C)e.settings.minDate=this._formatDate(e,i);if(g!==null&&f.dateFormat!==C&&f.maxDate===C)e.settings.maxDate=this._formatDate(e,g);this._attachments(d(a),e);this._autoSize(e);this._setDate(e,h);this._updateAlternate(e);
+this._updateDatepicker(e)}},_changeDatepicker:function(a,b,c){this._optionDatepicker(a,b,c)},_refreshDatepicker:function(a){(a=this._getInst(a))&&this._updateDatepicker(a)},_setDateDatepicker:function(a,b){if(a=this._getInst(a)){this._setDate(a,b);this._updateDatepicker(a);this._updateAlternate(a)}},_getDateDatepicker:function(a,b){(a=this._getInst(a))&&!a.inline&&this._setDateFromField(a,b);return a?this._getDate(a):null},_doKeyDown:function(a){var b=d.datepicker._getInst(a.target),c=true,e=b.dpDiv.is(".ui-datepicker-rtl");
+b._keyEvent=true;if(d.datepicker._datepickerShowing)switch(a.keyCode){case 9:d.datepicker._hideDatepicker();c=false;break;case 13:c=d("td."+d.datepicker._dayOverClass+":not(."+d.datepicker._currentClass+")",b.dpDiv);c[0]&&d.datepicker._selectDay(a.target,b.selectedMonth,b.selectedYear,c[0]);if(a=d.datepicker._get(b,"onSelect")){c=d.datepicker._formatDate(b);a.apply(b.input?b.input[0]:null,[c,b])}else d.datepicker._hideDatepicker();return false;case 27:d.datepicker._hideDatepicker();break;case 33:d.datepicker._adjustDate(a.target,
+a.ctrlKey?-d.datepicker._get(b,"stepBigMonths"):-d.datepicker._get(b,"stepMonths"),"M");break;case 34:d.datepicker._adjustDate(a.target,a.ctrlKey?+d.datepicker._get(b,"stepBigMonths"):+d.datepicker._get(b,"stepMonths"),"M");break;case 35:if(a.ctrlKey||a.metaKey)d.datepicker._clearDate(a.target);c=a.ctrlKey||a.metaKey;break;case 36:if(a.ctrlKey||a.metaKey)d.datepicker._gotoToday(a.target);c=a.ctrlKey||a.metaKey;break;case 37:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,e?+1:-1,"D");c=
+a.ctrlKey||a.metaKey;if(a.originalEvent.altKey)d.datepicker._adjustDate(a.target,a.ctrlKey?-d.datepicker._get(b,"stepBigMonths"):-d.datepicker._get(b,"stepMonths"),"M");break;case 38:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,-7,"D");c=a.ctrlKey||a.metaKey;break;case 39:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,e?-1:+1,"D");c=a.ctrlKey||a.metaKey;if(a.originalEvent.altKey)d.datepicker._adjustDate(a.target,a.ctrlKey?+d.datepicker._get(b,"stepBigMonths"):+d.datepicker._get(b,
+"stepMonths"),"M");break;case 40:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,+7,"D");c=a.ctrlKey||a.metaKey;break;default:c=false}else if(a.keyCode==36&&a.ctrlKey)d.datepicker._showDatepicker(this);else c=false;if(c){a.preventDefault();a.stopPropagation()}},_doKeyPress:function(a){var b=d.datepicker._getInst(a.target);if(d.datepicker._get(b,"constrainInput")){b=d.datepicker._possibleChars(d.datepicker._get(b,"dateFormat"));var c=String.fromCharCode(a.charCode==C?a.keyCode:a.charCode);
+return a.ctrlKey||a.metaKey||c<" "||!b||b.indexOf(c)>-1}},_doKeyUp:function(a){a=d.datepicker._getInst(a.target);if(a.input.val()!=a.lastVal)try{if(d.datepicker.parseDate(d.datepicker._get(a,"dateFormat"),a.input?a.input.val():null,d.datepicker._getFormatConfig(a))){d.datepicker._setDateFromField(a);d.datepicker._updateAlternate(a);d.datepicker._updateDatepicker(a)}}catch(b){d.datepicker.log(b)}return true},_showDatepicker:function(a){a=a.target||a;if(a.nodeName.toLowerCase()!="input")a=d("input",
+a.parentNode)[0];if(!(d.datepicker._isDisabledDatepicker(a)||d.datepicker._lastInput==a)){var b=d.datepicker._getInst(a);if(d.datepicker._curInst&&d.datepicker._curInst!=b){d.datepicker._datepickerShowing&&d.datepicker._triggerOnClose(d.datepicker._curInst);d.datepicker._curInst.dpDiv.stop(true,true)}var c=d.datepicker._get(b,"beforeShow");c=c?c.apply(a,[a,b]):{};if(c!==false){H(b.settings,c);b.lastVal=null;d.datepicker._lastInput=a;d.datepicker._setDateFromField(b);if(d.datepicker._inDialog)a.value=
+"";if(!d.datepicker._pos){d.datepicker._pos=d.datepicker._findPos(a);d.datepicker._pos[1]+=a.offsetHeight}var e=false;d(a).parents().each(function(){e|=d(this).css("position")=="fixed";return!e});if(e&&d.browser.opera){d.datepicker._pos[0]-=document.documentElement.scrollLeft;d.datepicker._pos[1]-=document.documentElement.scrollTop}c={left:d.datepicker._pos[0],top:d.datepicker._pos[1]};d.datepicker._pos=null;b.dpDiv.empty();b.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});d.datepicker._updateDatepicker(b);
+c=d.datepicker._checkOffset(b,c,e);b.dpDiv.css({position:d.datepicker._inDialog&&d.blockUI?"static":e?"fixed":"absolute",display:"none",left:c.left+"px",top:c.top+"px"});if(!b.inline){c=d.datepicker._get(b,"showAnim");var f=d.datepicker._get(b,"duration"),h=function(){var i=b.dpDiv.find("iframe.ui-datepicker-cover");if(i.length){var g=d.datepicker._getBorders(b.dpDiv);i.css({left:-g[0],top:-g[1],width:b.dpDiv.outerWidth(),height:b.dpDiv.outerHeight()})}};b.dpDiv.zIndex(d(a).zIndex()+1);d.datepicker._datepickerShowing=
+true;d.effects&&d.effects[c]?b.dpDiv.show(c,d.datepicker._get(b,"showOptions"),f,h):b.dpDiv[c||"show"](c?f:null,h);if(!c||!f)h();b.input.is(":visible")&&!b.input.is(":disabled")&&b.input.focus();d.datepicker._curInst=b}}}},_updateDatepicker:function(a){this.maxRows=4;var b=d.datepicker._getBorders(a.dpDiv);J=a;a.dpDiv.empty().append(this._generateHTML(a));var c=a.dpDiv.find("iframe.ui-datepicker-cover");c.length&&c.css({left:-b[0],top:-b[1],width:a.dpDiv.outerWidth(),height:a.dpDiv.outerHeight()});
+a.dpDiv.find("."+this._dayOverClass+" a").mouseover();b=this._getNumberOfMonths(a);c=b[1];a.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");c>1&&a.dpDiv.addClass("ui-datepicker-multi-"+c).css("width",17*c+"em");a.dpDiv[(b[0]!=1||b[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi");a.dpDiv[(this._get(a,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");a==d.datepicker._curInst&&d.datepicker._datepickerShowing&&a.input&&a.input.is(":visible")&&
+!a.input.is(":disabled")&&a.input[0]!=document.activeElement&&a.input.focus();if(a.yearshtml){var e=a.yearshtml;setTimeout(function(){e===a.yearshtml&&a.yearshtml&&a.dpDiv.find("select.ui-datepicker-year:first").replaceWith(a.yearshtml);e=a.yearshtml=null},0)}},_getBorders:function(a){var b=function(c){return{thin:1,medium:2,thick:3}[c]||c};return[parseFloat(b(a.css("border-left-width"))),parseFloat(b(a.css("border-top-width")))]},_checkOffset:function(a,b,c){var e=a.dpDiv.outerWidth(),f=a.dpDiv.outerHeight(),
+h=a.input?a.input.outerWidth():0,i=a.input?a.input.outerHeight():0,g=document.documentElement.clientWidth+d(document).scrollLeft(),j=document.documentElement.clientHeight+d(document).scrollTop();b.left-=this._get(a,"isRTL")?e-h:0;b.left-=c&&b.left==a.input.offset().left?d(document).scrollLeft():0;b.top-=c&&b.top==a.input.offset().top+i?d(document).scrollTop():0;b.left-=Math.min(b.left,b.left+e>g&&g>e?Math.abs(b.left+e-g):0);b.top-=Math.min(b.top,b.top+f>j&&j>f?Math.abs(f+i):0);return b},_findPos:function(a){for(var b=
+this._get(this._getInst(a),"isRTL");a&&(a.type=="hidden"||a.nodeType!=1||d.expr.filters.hidden(a));)a=a[b?"previousSibling":"nextSibling"];a=d(a).offset();return[a.left,a.top]},_triggerOnClose:function(a){var b=this._get(a,"onClose");if(b)b.apply(a.input?a.input[0]:null,[a.input?a.input.val():"",a])},_hideDatepicker:function(a){var b=this._curInst;if(!(!b||a&&b!=d.data(a,"datepicker")))if(this._datepickerShowing){a=this._get(b,"showAnim");var c=this._get(b,"duration"),e=function(){d.datepicker._tidyDialog(b);
+this._curInst=null};d.effects&&d.effects[a]?b.dpDiv.hide(a,d.datepicker._get(b,"showOptions"),c,e):b.dpDiv[a=="slideDown"?"slideUp":a=="fadeIn"?"fadeOut":"hide"](a?c:null,e);a||e();d.datepicker._triggerOnClose(b);this._datepickerShowing=false;this._lastInput=null;if(this._inDialog){this._dialogInput.css({position:"absolute",left:"0",top:"-100px"});if(d.blockUI){d.unblockUI();d("body").append(this.dpDiv)}}this._inDialog=false}},_tidyDialog:function(a){a.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},
+_checkExternalClick:function(a){if(d.datepicker._curInst){a=d(a.target);a[0].id!=d.datepicker._mainDivId&&a.parents("#"+d.datepicker._mainDivId).length==0&&!a.hasClass(d.datepicker.markerClassName)&&!a.hasClass(d.datepicker._triggerClass)&&d.datepicker._datepickerShowing&&!(d.datepicker._inDialog&&d.blockUI)&&d.datepicker._hideDatepicker()}},_adjustDate:function(a,b,c){a=d(a);var e=this._getInst(a[0]);if(!this._isDisabledDatepicker(a[0])){this._adjustInstDate(e,b+(c=="M"?this._get(e,"showCurrentAtPos"):
+0),c);this._updateDatepicker(e)}},_gotoToday:function(a){a=d(a);var b=this._getInst(a[0]);if(this._get(b,"gotoCurrent")&&b.currentDay){b.selectedDay=b.currentDay;b.drawMonth=b.selectedMonth=b.currentMonth;b.drawYear=b.selectedYear=b.currentYear}else{var c=new Date;b.selectedDay=c.getDate();b.drawMonth=b.selectedMonth=c.getMonth();b.drawYear=b.selectedYear=c.getFullYear()}this._notifyChange(b);this._adjustDate(a)},_selectMonthYear:function(a,b,c){a=d(a);var e=this._getInst(a[0]);e["selected"+(c=="M"?
+"Month":"Year")]=e["draw"+(c=="M"?"Month":"Year")]=parseInt(b.options[b.selectedIndex].value,10);this._notifyChange(e);this._adjustDate(a)},_selectDay:function(a,b,c,e){var f=d(a);if(!(d(e).hasClass(this._unselectableClass)||this._isDisabledDatepicker(f[0]))){f=this._getInst(f[0]);f.selectedDay=f.currentDay=d("a",e).html();f.selectedMonth=f.currentMonth=b;f.selectedYear=f.currentYear=c;this._selectDate(a,this._formatDate(f,f.currentDay,f.currentMonth,f.currentYear))}},_clearDate:function(a){a=d(a);
+this._getInst(a[0]);this._selectDate(a,"")},_selectDate:function(a,b){a=this._getInst(d(a)[0]);b=b!=null?b:this._formatDate(a);a.input&&a.input.val(b);this._updateAlternate(a);var c=this._get(a,"onSelect");if(c)c.apply(a.input?a.input[0]:null,[b,a]);else a.input&&a.input.trigger("change");if(a.inline)this._updateDatepicker(a);else{this._hideDatepicker();this._lastInput=a.input[0];typeof a.input[0]!="object"&&a.input.focus();this._lastInput=null}},_updateAlternate:function(a){var b=this._get(a,"altField");
+if(b){var c=this._get(a,"altFormat")||this._get(a,"dateFormat"),e=this._getDate(a),f=this.formatDate(c,e,this._getFormatConfig(a));d(b).each(function(){d(this).val(f)})}},noWeekends:function(a){a=a.getDay();return[a>0&&a<6,""]},iso8601Week:function(a){a=new Date(a.getTime());a.setDate(a.getDate()+4-(a.getDay()||7));var b=a.getTime();a.setMonth(0);a.setDate(1);return Math.floor(Math.round((b-a)/864E5)/7)+1},parseDate:function(a,b,c){if(a==null||b==null)throw"Invalid arguments";b=typeof b=="object"?
+b.toString():b+"";if(b=="")return null;var e=(c?c.shortYearCutoff:null)||this._defaults.shortYearCutoff;e=typeof e!="string"?e:(new Date).getFullYear()%100+parseInt(e,10);for(var f=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,h=(c?c.dayNames:null)||this._defaults.dayNames,i=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,g=(c?c.monthNames:null)||this._defaults.monthNames,j=c=-1,l=-1,u=-1,k=false,o=function(p){(p=A+1<a.length&&a.charAt(A+1)==p)&&A++;return p},m=function(p){var D=
+o(p);p=new RegExp("^\\d{1,"+(p=="@"?14:p=="!"?20:p=="y"&&D?4:p=="o"?3:2)+"}");p=b.substring(q).match(p);if(!p)throw"Missing number at position "+q;q+=p[0].length;return parseInt(p[0],10)},n=function(p,D,K){p=d.map(o(p)?K:D,function(w,x){return[[x,w]]}).sort(function(w,x){return-(w[1].length-x[1].length)});var E=-1;d.each(p,function(w,x){w=x[1];if(b.substr(q,w.length).toLowerCase()==w.toLowerCase()){E=x[0];q+=w.length;return false}});if(E!=-1)return E+1;else throw"Unknown name at position "+q;},s=
+function(){if(b.charAt(q)!=a.charAt(A))throw"Unexpected literal at position "+q;q++},q=0,A=0;A<a.length;A++)if(k)if(a.charAt(A)=="'"&&!o("'"))k=false;else s();else switch(a.charAt(A)){case "d":l=m("d");break;case "D":n("D",f,h);break;case "o":u=m("o");break;case "m":j=m("m");break;case "M":j=n("M",i,g);break;case "y":c=m("y");break;case "@":var v=new Date(m("@"));c=v.getFullYear();j=v.getMonth()+1;l=v.getDate();break;case "!":v=new Date((m("!")-this._ticksTo1970)/1E4);c=v.getFullYear();j=v.getMonth()+
+1;l=v.getDate();break;case "'":if(o("'"))s();else k=true;break;default:s()}if(q<b.length)throw"Extra/unparsed characters found in date: "+b.substring(q);if(c==-1)c=(new Date).getFullYear();else if(c<100)c+=(new Date).getFullYear()-(new Date).getFullYear()%100+(c<=e?0:-100);if(u>-1){j=1;l=u;do{e=this._getDaysInMonth(c,j-1);if(l<=e)break;j++;l-=e}while(1)}v=this._daylightSavingAdjust(new Date(c,j-1,l));if(v.getFullYear()!=c||v.getMonth()+1!=j||v.getDate()!=l)throw"Invalid date";return v},ATOM:"yy-mm-dd",
+COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*24*60*60*1E7,formatDate:function(a,b,c){if(!b)return"";var e=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,f=(c?c.dayNames:null)||this._defaults.dayNames,h=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort;c=(c?c.monthNames:
+null)||this._defaults.monthNames;var i=function(o){(o=k+1<a.length&&a.charAt(k+1)==o)&&k++;return o},g=function(o,m,n){m=""+m;if(i(o))for(;m.length<n;)m="0"+m;return m},j=function(o,m,n,s){return i(o)?s[m]:n[m]},l="",u=false;if(b)for(var k=0;k<a.length;k++)if(u)if(a.charAt(k)=="'"&&!i("'"))u=false;else l+=a.charAt(k);else switch(a.charAt(k)){case "d":l+=g("d",b.getDate(),2);break;case "D":l+=j("D",b.getDay(),e,f);break;case "o":l+=g("o",Math.round(((new Date(b.getFullYear(),b.getMonth(),b.getDate())).getTime()-
+(new Date(b.getFullYear(),0,0)).getTime())/864E5),3);break;case "m":l+=g("m",b.getMonth()+1,2);break;case "M":l+=j("M",b.getMonth(),h,c);break;case "y":l+=i("y")?b.getFullYear():(b.getYear()%100<10?"0":"")+b.getYear()%100;break;case "@":l+=b.getTime();break;case "!":l+=b.getTime()*1E4+this._ticksTo1970;break;case "'":if(i("'"))l+="'";else u=true;break;default:l+=a.charAt(k)}return l},_possibleChars:function(a){for(var b="",c=false,e=function(h){(h=f+1<a.length&&a.charAt(f+1)==h)&&f++;return h},f=
+0;f<a.length;f++)if(c)if(a.charAt(f)=="'"&&!e("'"))c=false;else b+=a.charAt(f);else switch(a.charAt(f)){case "d":case "m":case "y":case "@":b+="0123456789";break;case "D":case "M":return null;case "'":if(e("'"))b+="'";else c=true;break;default:b+=a.charAt(f)}return b},_get:function(a,b){return a.settings[b]!==C?a.settings[b]:this._defaults[b]},_setDateFromField:function(a,b){if(a.input.val()!=a.lastVal){var c=this._get(a,"dateFormat"),e=a.lastVal=a.input?a.input.val():null,f,h;f=h=this._getDefaultDate(a);
+var i=this._getFormatConfig(a);try{f=this.parseDate(c,e,i)||h}catch(g){this.log(g);e=b?"":e}a.selectedDay=f.getDate();a.drawMonth=a.selectedMonth=f.getMonth();a.drawYear=a.selectedYear=f.getFullYear();a.currentDay=e?f.getDate():0;a.currentMonth=e?f.getMonth():0;a.currentYear=e?f.getFullYear():0;this._adjustInstDate(a)}},_getDefaultDate:function(a){return this._restrictMinMax(a,this._determineDate(a,this._get(a,"defaultDate"),new Date))},_determineDate:function(a,b,c){var e=function(h){var i=new Date;
+i.setDate(i.getDate()+h);return i},f=function(h){try{return d.datepicker.parseDate(d.datepicker._get(a,"dateFormat"),h,d.datepicker._getFormatConfig(a))}catch(i){}var g=(h.toLowerCase().match(/^c/)?d.datepicker._getDate(a):null)||new Date,j=g.getFullYear(),l=g.getMonth();g=g.getDate();for(var u=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,k=u.exec(h);k;){switch(k[2]||"d"){case "d":case "D":g+=parseInt(k[1],10);break;case "w":case "W":g+=parseInt(k[1],10)*7;break;case "m":case "M":l+=parseInt(k[1],10);g=
+Math.min(g,d.datepicker._getDaysInMonth(j,l));break;case "y":case "Y":j+=parseInt(k[1],10);g=Math.min(g,d.datepicker._getDaysInMonth(j,l));break}k=u.exec(h)}return new Date(j,l,g)};if(b=(b=b==null||b===""?c:typeof b=="string"?f(b):typeof b=="number"?isNaN(b)?c:e(b):new Date(b.getTime()))&&b.toString()=="Invalid Date"?c:b){b.setHours(0);b.setMinutes(0);b.setSeconds(0);b.setMilliseconds(0)}return this._daylightSavingAdjust(b)},_daylightSavingAdjust:function(a){if(!a)return null;a.setHours(a.getHours()>
+12?a.getHours()+2:0);return a},_setDate:function(a,b,c){var e=!b,f=a.selectedMonth,h=a.selectedYear;b=this._restrictMinMax(a,this._determineDate(a,b,new Date));a.selectedDay=a.currentDay=b.getDate();a.drawMonth=a.selectedMonth=a.currentMonth=b.getMonth();a.drawYear=a.selectedYear=a.currentYear=b.getFullYear();if((f!=a.selectedMonth||h!=a.selectedYear)&&!c)this._notifyChange(a);this._adjustInstDate(a);if(a.input)a.input.val(e?"":this._formatDate(a))},_getDate:function(a){return!a.currentYear||a.input&&
+a.input.val()==""?null:this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay))},_generateHTML:function(a){var b=new Date;b=this._daylightSavingAdjust(new Date(b.getFullYear(),b.getMonth(),b.getDate()));var c=this._get(a,"isRTL"),e=this._get(a,"showButtonPanel"),f=this._get(a,"hideIfNoPrevNext"),h=this._get(a,"navigationAsDateFormat"),i=this._getNumberOfMonths(a),g=this._get(a,"showCurrentAtPos"),j=this._get(a,"stepMonths"),l=i[0]!=1||i[1]!=1,u=this._daylightSavingAdjust(!a.currentDay?
+new Date(9999,9,9):new Date(a.currentYear,a.currentMonth,a.currentDay)),k=this._getMinMaxDate(a,"min"),o=this._getMinMaxDate(a,"max");g=a.drawMonth-g;var m=a.drawYear;if(g<0){g+=12;m--}if(o){var n=this._daylightSavingAdjust(new Date(o.getFullYear(),o.getMonth()-i[0]*i[1]+1,o.getDate()));for(n=k&&n<k?k:n;this._daylightSavingAdjust(new Date(m,g,1))>n;){g--;if(g<0){g=11;m--}}}a.drawMonth=g;a.drawYear=m;n=this._get(a,"prevText");n=!h?n:this.formatDate(n,this._daylightSavingAdjust(new Date(m,g-j,1)),this._getFormatConfig(a));
+n=this._canAdjustMonth(a,-1,m,g)?'<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery_'+B+".datepicker._adjustDate('#"+a.id+"', -"+j+", 'M');\" title=\""+n+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"e":"w")+'">'+n+"</span></a>":f?"":'<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+n+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"e":"w")+'">'+n+"</span></a>";var s=this._get(a,"nextText");s=!h?s:this.formatDate(s,this._daylightSavingAdjust(new Date(m,
+g+j,1)),this._getFormatConfig(a));f=this._canAdjustMonth(a,+1,m,g)?'<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery_'+B+".datepicker._adjustDate('#"+a.id+"', +"+j+", 'M');\" title=\""+s+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"w":"e")+'">'+s+"</span></a>":f?"":'<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+s+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"w":"e")+'">'+s+"</span></a>";j=this._get(a,"currentText");s=this._get(a,"gotoCurrent")&&
+a.currentDay?u:b;j=!h?j:this.formatDate(j,s,this._getFormatConfig(a));h=!a.inline?'<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery_'+B+'.datepicker._hideDatepicker();">'+this._get(a,"closeText")+"</button>":"";e=e?'<div class="ui-datepicker-buttonpane ui-widget-content">'+(c?h:"")+(this._isInRange(a,s)?'<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery_'+
+B+".datepicker._gotoToday('#"+a.id+"');\">"+j+"</button>":"")+(c?"":h)+"</div>":"";h=parseInt(this._get(a,"firstDay"),10);h=isNaN(h)?0:h;j=this._get(a,"showWeek");s=this._get(a,"dayNames");this._get(a,"dayNamesShort");var q=this._get(a,"dayNamesMin"),A=this._get(a,"monthNames"),v=this._get(a,"monthNamesShort"),p=this._get(a,"beforeShowDay"),D=this._get(a,"showOtherMonths"),K=this._get(a,"selectOtherMonths");this._get(a,"calculateWeek");for(var E=this._getDefaultDate(a),w="",x=0;x<i[0];x++){var O=
+"";this.maxRows=4;for(var G=0;G<i[1];G++){var P=this._daylightSavingAdjust(new Date(m,g,a.selectedDay)),t=" ui-corner-all",y="";if(l){y+='<div class="ui-datepicker-group';if(i[1]>1)switch(G){case 0:y+=" ui-datepicker-group-first";t=" ui-corner-"+(c?"right":"left");break;case i[1]-1:y+=" ui-datepicker-group-last";t=" ui-corner-"+(c?"left":"right");break;default:y+=" ui-datepicker-group-middle";t="";break}y+='">'}y+='<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix'+t+'">'+(/all|left/.test(t)&&
+x==0?c?f:n:"")+(/all|right/.test(t)&&x==0?c?n:f:"")+this._generateMonthYearHeader(a,g,m,k,o,x>0||G>0,A,v)+'</div><table class="ui-datepicker-calendar"><thead><tr>';var z=j?'<th class="ui-datepicker-week-col">'+this._get(a,"weekHeader")+"</th>":"";for(t=0;t<7;t++){var r=(t+h)%7;z+="<th"+((t+h+6)%7>=5?' class="ui-datepicker-week-end"':"")+'><span title="'+s[r]+'">'+q[r]+"</span></th>"}y+=z+"</tr></thead><tbody>";z=this._getDaysInMonth(m,g);if(m==a.selectedYear&&g==a.selectedMonth)a.selectedDay=Math.min(a.selectedDay,
+z);t=(this._getFirstDayOfMonth(m,g)-h+7)%7;z=Math.ceil((t+z)/7);this.maxRows=z=l?this.maxRows>z?this.maxRows:z:z;r=this._daylightSavingAdjust(new Date(m,g,1-t));for(var Q=0;Q<z;Q++){y+="<tr>";var R=!j?"":'<td class="ui-datepicker-week-col">'+this._get(a,"calculateWeek")(r)+"</td>";for(t=0;t<7;t++){var I=p?p.apply(a.input?a.input[0]:null,[r]):[true,""],F=r.getMonth()!=g,L=F&&!K||!I[0]||k&&r<k||o&&r>o;R+='<td class="'+((t+h+6)%7>=5?" ui-datepicker-week-end":"")+(F?" ui-datepicker-other-month":"")+(r.getTime()==
+P.getTime()&&g==a.selectedMonth&&a._keyEvent||E.getTime()==r.getTime()&&E.getTime()==P.getTime()?" "+this._dayOverClass:"")+(L?" "+this._unselectableClass+" ui-state-disabled":"")+(F&&!D?"":" "+I[1]+(r.getTime()==u.getTime()?" "+this._currentClass:"")+(r.getTime()==b.getTime()?" ui-datepicker-today":""))+'"'+((!F||D)&&I[2]?' title="'+I[2]+'"':"")+(L?"":' onclick="DP_jQuery_'+B+".datepicker._selectDay('#"+a.id+"',"+r.getMonth()+","+r.getFullYear()+', this);return false;"')+">"+(F&&!D?"&#xa0;":L?'<span class="ui-state-default">'+
+r.getDate()+"</span>":'<a class="ui-state-default'+(r.getTime()==b.getTime()?" ui-state-highlight":"")+(r.getTime()==u.getTime()?" ui-state-active":"")+(F?" ui-priority-secondary":"")+'" href="#">'+r.getDate()+"</a>")+"</td>";r.setDate(r.getDate()+1);r=this._daylightSavingAdjust(r)}y+=R+"</tr>"}g++;if(g>11){g=0;m++}y+="</tbody></table>"+(l?"</div>"+(i[0]>0&&G==i[1]-1?'<div class="ui-datepicker-row-break"></div>':""):"");O+=y}w+=O}w+=e+(d.browser.msie&&parseInt(d.browser.version,10)<7&&!a.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>':
+"");a._keyEvent=false;return w},_generateMonthYearHeader:function(a,b,c,e,f,h,i,g){var j=this._get(a,"changeMonth"),l=this._get(a,"changeYear"),u=this._get(a,"showMonthAfterYear"),k='<div class="ui-datepicker-title">',o="";if(h||!j)o+='<span class="ui-datepicker-month">'+i[b]+"</span>";else{i=e&&e.getFullYear()==c;var m=f&&f.getFullYear()==c;o+='<select class="ui-datepicker-month" onchange="DP_jQuery_'+B+".datepicker._selectMonthYear('#"+a.id+"', this, 'M');\" >";for(var n=0;n<12;n++)if((!i||n>=e.getMonth())&&
+(!m||n<=f.getMonth()))o+='<option value="'+n+'"'+(n==b?' selected="selected"':"")+">"+g[n]+"</option>";o+="</select>"}u||(k+=o+(h||!(j&&l)?"&#xa0;":""));if(!a.yearshtml){a.yearshtml="";if(h||!l)k+='<span class="ui-datepicker-year">'+c+"</span>";else{g=this._get(a,"yearRange").split(":");var s=(new Date).getFullYear();i=function(q){q=q.match(/c[+-].*/)?c+parseInt(q.substring(1),10):q.match(/[+-].*/)?s+parseInt(q,10):parseInt(q,10);return isNaN(q)?s:q};b=i(g[0]);g=Math.max(b,i(g[1]||""));b=e?Math.max(b,
+e.getFullYear()):b;g=f?Math.min(g,f.getFullYear()):g;for(a.yearshtml+='<select class="ui-datepicker-year" onchange="DP_jQuery_'+B+".datepicker._selectMonthYear('#"+a.id+"', this, 'Y');\" >";b<=g;b++)a.yearshtml+='<option value="'+b+'"'+(b==c?' selected="selected"':"")+">"+b+"</option>";a.yearshtml+="</select>";k+=a.yearshtml;a.yearshtml=null}}k+=this._get(a,"yearSuffix");if(u)k+=(h||!(j&&l)?"&#xa0;":"")+o;k+="</div>";return k},_adjustInstDate:function(a,b,c){var e=a.drawYear+(c=="Y"?b:0),f=a.drawMonth+
+(c=="M"?b:0);b=Math.min(a.selectedDay,this._getDaysInMonth(e,f))+(c=="D"?b:0);e=this._restrictMinMax(a,this._daylightSavingAdjust(new Date(e,f,b)));a.selectedDay=e.getDate();a.drawMonth=a.selectedMonth=e.getMonth();a.drawYear=a.selectedYear=e.getFullYear();if(c=="M"||c=="Y")this._notifyChange(a)},_restrictMinMax:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");b=c&&b<c?c:b;return b=a&&b>a?a:b},_notifyChange:function(a){var b=this._get(a,"onChangeMonthYear");if(b)b.apply(a.input?
+a.input[0]:null,[a.selectedYear,a.selectedMonth+1,a])},_getNumberOfMonths:function(a){a=this._get(a,"numberOfMonths");return a==null?[1,1]:typeof a=="number"?[1,a]:a},_getMinMaxDate:function(a,b){return this._determineDate(a,this._get(a,b+"Date"),null)},_getDaysInMonth:function(a,b){return 32-this._daylightSavingAdjust(new Date(a,b,32)).getDate()},_getFirstDayOfMonth:function(a,b){return(new Date(a,b,1)).getDay()},_canAdjustMonth:function(a,b,c,e){var f=this._getNumberOfMonths(a);c=this._daylightSavingAdjust(new Date(c,
+e+(b<0?b:f[0]*f[1]),1));b<0&&c.setDate(this._getDaysInMonth(c.getFullYear(),c.getMonth()));return this._isInRange(a,c)},_isInRange:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");return(!c||b.getTime()>=c.getTime())&&(!a||b.getTime()<=a.getTime())},_getFormatConfig:function(a){var b=this._get(a,"shortYearCutoff");b=typeof b!="string"?b:(new Date).getFullYear()%100+parseInt(b,10);return{shortYearCutoff:b,dayNamesShort:this._get(a,"dayNamesShort"),dayNames:this._get(a,
+"dayNames"),monthNamesShort:this._get(a,"monthNamesShort"),monthNames:this._get(a,"monthNames")}},_formatDate:function(a,b,c,e){if(!b){a.currentDay=a.selectedDay;a.currentMonth=a.selectedMonth;a.currentYear=a.selectedYear}b=b?typeof b=="object"?b:this._daylightSavingAdjust(new Date(e,c,b)):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return this.formatDate(this._get(a,"dateFormat"),b,this._getFormatConfig(a))}});d.fn.datepicker=function(a){if(!this.length)return this;
+if(!d.datepicker.initialized){d(document).mousedown(d.datepicker._checkExternalClick).find("body").append(d.datepicker.dpDiv);d.datepicker.initialized=true}var b=Array.prototype.slice.call(arguments,1);if(typeof a=="string"&&(a=="isDisabled"||a=="getDate"||a=="widget"))return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this[0]].concat(b));if(a=="option"&&arguments.length==2&&typeof arguments[1]=="string")return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this[0]].concat(b));return this.each(function(){typeof a==
+"string"?d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this].concat(b)):d.datepicker._attachDatepicker(this,a)})};d.datepicker=new M;d.datepicker.initialized=false;d.datepicker.uuid=(new Date).getTime();d.datepicker.version="1.8.16";window["DP_jQuery_"+B]=d})(jQuery);
+;/*
+ * jQuery UI Progressbar 1.8.16
+ *
+ * Copyright 2011, 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/Progressbar
+ *
+ * Depends:
+ *   jquery.ui.core.js
+ *   jquery.ui.widget.js
+ */
+(function(b,d){b.widget("ui.progressbar",{options:{value:0,max:100},min:0,_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min,"aria-valuemax":this.options.max,"aria-valuenow":this._value()});this.valueDiv=b("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>").appendTo(this.element);this.oldValue=this._value();this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow");
+this.valueDiv.remove();b.Widget.prototype.destroy.apply(this,arguments)},value:function(a){if(a===d)return this._value();this._setOption("value",a);return this},_setOption:function(a,c){if(a==="value"){this.options.value=c;this._refreshValue();this._value()===this.options.max&&this._trigger("complete")}b.Widget.prototype._setOption.apply(this,arguments)},_value:function(){var a=this.options.value;if(typeof a!=="number")a=0;return Math.min(this.options.max,Math.max(this.min,a))},_percentage:function(){return 100*
+this._value()/this.options.max},_refreshValue:function(){var a=this.value(),c=this._percentage();if(this.oldValue!==a){this.oldValue=a;this._trigger("change")}this.valueDiv.toggle(a>this.min).toggleClass("ui-corner-right",a===this.options.max).width(c.toFixed(0)+"%");this.element.attr("aria-valuenow",a)}});b.extend(b.ui.progressbar,{version:"1.8.16"})})(jQuery);
+;/*
+ * jQuery UI Effects 1.8.16
+ *
+ * Copyright 2011, 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/Effects/
+ */
+jQuery.effects||function(f,j){function m(c){var a;if(c&&c.constructor==Array&&c.length==3)return c;if(a=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(c))return[parseInt(a[1],10),parseInt(a[2],10),parseInt(a[3],10)];if(a=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(c))return[parseFloat(a[1])*2.55,parseFloat(a[2])*2.55,parseFloat(a[3])*2.55];if(a=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(c))return[parseInt(a[1],
+16),parseInt(a[2],16),parseInt(a[3],16)];if(a=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(c))return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)];if(/rgba\(0, 0, 0, 0\)/.exec(c))return n.transparent;return n[f.trim(c).toLowerCase()]}function s(c,a){var b;do{b=f.curCSS(c,a);if(b!=""&&b!="transparent"||f.nodeName(c,"body"))break;a="backgroundColor"}while(c=c.parentNode);return m(b)}function o(){var c=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle,
+a={},b,d;if(c&&c.length&&c[0]&&c[c[0]])for(var e=c.length;e--;){b=c[e];if(typeof c[b]=="string"){d=b.replace(/\-(\w)/g,function(g,h){return h.toUpperCase()});a[d]=c[b]}}else for(b in c)if(typeof c[b]==="string")a[b]=c[b];return a}function p(c){var a,b;for(a in c){b=c[a];if(b==null||f.isFunction(b)||a in t||/scrollbar/.test(a)||!/color/i.test(a)&&isNaN(parseFloat(b)))delete c[a]}return c}function u(c,a){var b={_:0},d;for(d in a)if(c[d]!=a[d])b[d]=a[d];return b}function k(c,a,b,d){if(typeof c=="object"){d=
+a;b=null;a=c;c=a.effect}if(f.isFunction(a)){d=a;b=null;a={}}if(typeof a=="number"||f.fx.speeds[a]){d=b;b=a;a={}}if(f.isFunction(b)){d=b;b=null}a=a||{};b=b||a.duration;b=f.fx.off?0:typeof b=="number"?b:b in f.fx.speeds?f.fx.speeds[b]:f.fx.speeds._default;d=d||a.complete;return[c,a,b,d]}function l(c){if(!c||typeof c==="number"||f.fx.speeds[c])return true;if(typeof c==="string"&&!f.effects[c])return true;return false}f.effects={};f.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor",
+"borderTopColor","borderColor","color","outlineColor"],function(c,a){f.fx.step[a]=function(b){if(!b.colorInit){b.start=s(b.elem,a);b.end=m(b.end);b.colorInit=true}b.elem.style[a]="rgb("+Math.max(Math.min(parseInt(b.pos*(b.end[0]-b.start[0])+b.start[0],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[1]-b.start[1])+b.start[1],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[2]-b.start[2])+b.start[2],10),255),0)+")"}});var n={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,
+0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,
+211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},q=["add","remove","toggle"],t={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};f.effects.animateClass=function(c,a,b,
+d){if(f.isFunction(b)){d=b;b=null}return this.queue(function(){var e=f(this),g=e.attr("style")||" ",h=p(o.call(this)),r,v=e.attr("class");f.each(q,function(w,i){c[i]&&e[i+"Class"](c[i])});r=p(o.call(this));e.attr("class",v);e.animate(u(h,r),{queue:false,duration:a,easing:b,complete:function(){f.each(q,function(w,i){c[i]&&e[i+"Class"](c[i])});if(typeof e.attr("style")=="object"){e.attr("style").cssText="";e.attr("style").cssText=g}else e.attr("style",g);d&&d.apply(this,arguments);f.dequeue(this)}})})};
+f.fn.extend({_addClass:f.fn.addClass,addClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{add:c},a,b,d]):this._addClass(c)},_removeClass:f.fn.removeClass,removeClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{remove:c},a,b,d]):this._removeClass(c)},_toggleClass:f.fn.toggleClass,toggleClass:function(c,a,b,d,e){return typeof a=="boolean"||a===j?b?f.effects.animateClass.apply(this,[a?{add:c}:{remove:c},b,d,e]):this._toggleClass(c,a):f.effects.animateClass.apply(this,
+[{toggle:c},a,b,d])},switchClass:function(c,a,b,d,e){return f.effects.animateClass.apply(this,[{add:a,remove:c},b,d,e])}});f.extend(f.effects,{version:"1.8.16",save:function(c,a){for(var b=0;b<a.length;b++)a[b]!==null&&c.data("ec.storage."+a[b],c[0].style[a[b]])},restore:function(c,a){for(var b=0;b<a.length;b++)a[b]!==null&&c.css(a[b],c.data("ec.storage."+a[b]))},setMode:function(c,a){if(a=="toggle")a=c.is(":hidden")?"show":"hide";return a},getBaseline:function(c,a){var b;switch(c[0]){case "top":b=
+0;break;case "middle":b=0.5;break;case "bottom":b=1;break;default:b=c[0]/a.height}switch(c[1]){case "left":c=0;break;case "center":c=0.5;break;case "right":c=1;break;default:c=c[1]/a.width}return{x:c,y:b}},createWrapper:function(c){if(c.parent().is(".ui-effects-wrapper"))return c.parent();var a={width:c.outerWidth(true),height:c.outerHeight(true),"float":c.css("float")},b=f("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),
+d=document.activeElement;c.wrap(b);if(c[0]===d||f.contains(c[0],d))f(d).focus();b=c.parent();if(c.css("position")=="static"){b.css({position:"relative"});c.css({position:"relative"})}else{f.extend(a,{position:c.css("position"),zIndex:c.css("z-index")});f.each(["top","left","bottom","right"],function(e,g){a[g]=c.css(g);if(isNaN(parseInt(a[g],10)))a[g]="auto"});c.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})}return b.css(a).show()},removeWrapper:function(c){var a,b=document.activeElement;
+if(c.parent().is(".ui-effects-wrapper")){a=c.parent().replaceWith(c);if(c[0]===b||f.contains(c[0],b))f(b).focus();return a}return c},setTransition:function(c,a,b,d){d=d||{};f.each(a,function(e,g){unit=c.cssUnit(g);if(unit[0]>0)d[g]=unit[0]*b+unit[1]});return d}});f.fn.extend({effect:function(c){var a=k.apply(this,arguments),b={options:a[1],duration:a[2],callback:a[3]};a=b.options.mode;var d=f.effects[c];if(f.fx.off||!d)return a?this[a](b.duration,b.callback):this.each(function(){b.callback&&b.callback.call(this)});
+return d.call(this,b)},_show:f.fn.show,show:function(c){if(l(c))return this._show.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="show";return this.effect.apply(this,a)}},_hide:f.fn.hide,hide:function(c){if(l(c))return this._hide.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="hide";return this.effect.apply(this,a)}},__toggle:f.fn.toggle,toggle:function(c){if(l(c)||typeof c==="boolean"||f.isFunction(c))return this.__toggle.apply(this,arguments);else{var a=k.apply(this,
+arguments);a[1].mode="toggle";return this.effect.apply(this,a)}},cssUnit:function(c){var a=this.css(c),b=[];f.each(["em","px","%","pt"],function(d,e){if(a.indexOf(e)>0)b=[parseFloat(a),e]});return b}});f.easing.jswing=f.easing.swing;f.extend(f.easing,{def:"easeOutQuad",swing:function(c,a,b,d,e){return f.easing[f.easing.def](c,a,b,d,e)},easeInQuad:function(c,a,b,d,e){return d*(a/=e)*a+b},easeOutQuad:function(c,a,b,d,e){return-d*(a/=e)*(a-2)+b},easeInOutQuad:function(c,a,b,d,e){if((a/=e/2)<1)return d/
+2*a*a+b;return-d/2*(--a*(a-2)-1)+b},easeInCubic:function(c,a,b,d,e){return d*(a/=e)*a*a+b},easeOutCubic:function(c,a,b,d,e){return d*((a=a/e-1)*a*a+1)+b},easeInOutCubic:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a+b;return d/2*((a-=2)*a*a+2)+b},easeInQuart:function(c,a,b,d,e){return d*(a/=e)*a*a*a+b},easeOutQuart:function(c,a,b,d,e){return-d*((a=a/e-1)*a*a*a-1)+b},easeInOutQuart:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a+b;return-d/2*((a-=2)*a*a*a-2)+b},easeInQuint:function(c,a,b,
+d,e){return d*(a/=e)*a*a*a*a+b},easeOutQuint:function(c,a,b,d,e){return d*((a=a/e-1)*a*a*a*a+1)+b},easeInOutQuint:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a*a+b;return d/2*((a-=2)*a*a*a*a+2)+b},easeInSine:function(c,a,b,d,e){return-d*Math.cos(a/e*(Math.PI/2))+d+b},easeOutSine:function(c,a,b,d,e){return d*Math.sin(a/e*(Math.PI/2))+b},easeInOutSine:function(c,a,b,d,e){return-d/2*(Math.cos(Math.PI*a/e)-1)+b},easeInExpo:function(c,a,b,d,e){return a==0?b:d*Math.pow(2,10*(a/e-1))+b},easeOutExpo:function(c,
+a,b,d,e){return a==e?b+d:d*(-Math.pow(2,-10*a/e)+1)+b},easeInOutExpo:function(c,a,b,d,e){if(a==0)return b;if(a==e)return b+d;if((a/=e/2)<1)return d/2*Math.pow(2,10*(a-1))+b;return d/2*(-Math.pow(2,-10*--a)+2)+b},easeInCirc:function(c,a,b,d,e){return-d*(Math.sqrt(1-(a/=e)*a)-1)+b},easeOutCirc:function(c,a,b,d,e){return d*Math.sqrt(1-(a=a/e-1)*a)+b},easeInOutCirc:function(c,a,b,d,e){if((a/=e/2)<1)return-d/2*(Math.sqrt(1-a*a)-1)+b;return d/2*(Math.sqrt(1-(a-=2)*a)+1)+b},easeInElastic:function(c,a,b,
+d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e)==1)return b+d;g||(g=e*0.3);if(h<Math.abs(d)){h=d;c=g/4}else c=g/(2*Math.PI)*Math.asin(d/h);return-(h*Math.pow(2,10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g))+b},easeOutElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e)==1)return b+d;g||(g=e*0.3);if(h<Math.abs(d)){h=d;c=g/4}else c=g/(2*Math.PI)*Math.asin(d/h);return h*Math.pow(2,-10*a)*Math.sin((a*e-c)*2*Math.PI/g)+d+b},easeInOutElastic:function(c,a,b,d,e){c=1.70158;var g=
+0,h=d;if(a==0)return b;if((a/=e/2)==2)return b+d;g||(g=e*0.3*1.5);if(h<Math.abs(d)){h=d;c=g/4}else c=g/(2*Math.PI)*Math.asin(d/h);if(a<1)return-0.5*h*Math.pow(2,10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g)+b;return h*Math.pow(2,-10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g)*0.5+d+b},easeInBack:function(c,a,b,d,e,g){if(g==j)g=1.70158;return d*(a/=e)*a*((g+1)*a-g)+b},easeOutBack:function(c,a,b,d,e,g){if(g==j)g=1.70158;return d*((a=a/e-1)*a*((g+1)*a+g)+1)+b},easeInOutBack:function(c,a,b,d,e,g){if(g==j)g=1.70158;
+if((a/=e/2)<1)return d/2*a*a*(((g*=1.525)+1)*a-g)+b;return d/2*((a-=2)*a*(((g*=1.525)+1)*a+g)+2)+b},easeInBounce:function(c,a,b,d,e){return d-f.easing.easeOutBounce(c,e-a,0,d,e)+b},easeOutBounce:function(c,a,b,d,e){return(a/=e)<1/2.75?d*7.5625*a*a+b:a<2/2.75?d*(7.5625*(a-=1.5/2.75)*a+0.75)+b:a<2.5/2.75?d*(7.5625*(a-=2.25/2.75)*a+0.9375)+b:d*(7.5625*(a-=2.625/2.75)*a+0.984375)+b},easeInOutBounce:function(c,a,b,d,e){if(a<e/2)return f.easing.easeInBounce(c,a*2,0,d,e)*0.5+b;return f.easing.easeOutBounce(c,
+a*2-e,0,d,e)*0.5+d*0.5+b}})}(jQuery);
+;/*
+ * jQuery UI Effects Blind 1.8.16
+ *
+ * Copyright 2011, 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/Effects/Blind
+ *
+ * Depends:
+ *	jquery.effects.core.js
+ */
+(function(b){b.effects.blind=function(c){return this.queue(function(){var a=b(this),g=["position","top","bottom","left","right"],f=b.effects.setMode(a,c.options.mode||"hide"),d=c.options.direction||"vertical";b.effects.save(a,g);a.show();var e=b.effects.createWrapper(a).css({overflow:"hidden"}),h=d=="vertical"?"height":"width";d=d=="vertical"?e.height():e.width();f=="show"&&e.css(h,0);var i={};i[h]=f=="show"?d:0;e.animate(i,c.duration,c.options.easing,function(){f=="hide"&&a.hide();b.effects.restore(a,
+g);b.effects.removeWrapper(a);c.callback&&c.callback.apply(a[0],arguments);a.dequeue()})})}})(jQuery);
+;/*
+ * jQuery UI Effects Bounce 1.8.16
+ *
+ * Copyright 2011, 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/Effects/Bounce
+ *
+ * Depends:
+ *	jquery.effects.core.js
+ */
+(function(e){e.effects.bounce=function(b){return this.queue(function(){var a=e(this),l=["position","top","bottom","left","right"],h=e.effects.setMode(a,b.options.mode||"effect"),d=b.options.direction||"up",c=b.options.distance||20,m=b.options.times||5,i=b.duration||250;/show|hide/.test(h)&&l.push("opacity");e.effects.save(a,l);a.show();e.effects.createWrapper(a);var f=d=="up"||d=="down"?"top":"left";d=d=="up"||d=="left"?"pos":"neg";c=b.options.distance||(f=="top"?a.outerHeight({margin:true})/3:a.outerWidth({margin:true})/
+3);if(h=="show")a.css("opacity",0).css(f,d=="pos"?-c:c);if(h=="hide")c/=m*2;h!="hide"&&m--;if(h=="show"){var g={opacity:1};g[f]=(d=="pos"?"+=":"-=")+c;a.animate(g,i/2,b.options.easing);c/=2;m--}for(g=0;g<m;g++){var j={},k={};j[f]=(d=="pos"?"-=":"+=")+c;k[f]=(d=="pos"?"+=":"-=")+c;a.animate(j,i/2,b.options.easing).animate(k,i/2,b.options.easing);c=h=="hide"?c*2:c/2}if(h=="hide"){g={opacity:0};g[f]=(d=="pos"?"-=":"+=")+c;a.animate(g,i/2,b.options.easing,function(){a.hide();e.effects.restore(a,l);e.effects.removeWrapper(a);
+b.callback&&b.callback.apply(this,arguments)})}else{j={};k={};j[f]=(d=="pos"?"-=":"+=")+c;k[f]=(d=="pos"?"+=":"-=")+c;a.animate(j,i/2,b.options.easing).animate(k,i/2,b.options.easing,function(){e.effects.restore(a,l);e.effects.removeWrapper(a);b.callback&&b.callback.apply(this,arguments)})}a.queue("fx",function(){a.dequeue()});a.dequeue()})}})(jQuery);
+;/*
+ * jQuery UI Effects Clip 1.8.16
+ *
+ * Copyright 2011, 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/Effects/Clip
+ *
+ * Depends:
+ *	jquery.effects.core.js
+ */
+(function(b){b.effects.clip=function(e){return this.queue(function(){var a=b(this),i=["position","top","bottom","left","right","height","width"],f=b.effects.setMode(a,e.options.mode||"hide"),c=e.options.direction||"vertical";b.effects.save(a,i);a.show();var d=b.effects.createWrapper(a).css({overflow:"hidden"});d=a[0].tagName=="IMG"?d:a;var g={size:c=="vertical"?"height":"width",position:c=="vertical"?"top":"left"};c=c=="vertical"?d.height():d.width();if(f=="show"){d.css(g.size,0);d.css(g.position,
+c/2)}var h={};h[g.size]=f=="show"?c:0;h[g.position]=f=="show"?0:c/2;d.animate(h,{queue:false,duration:e.duration,easing:e.options.easing,complete:function(){f=="hide"&&a.hide();b.effects.restore(a,i);b.effects.removeWrapper(a);e.callback&&e.callback.apply(a[0],arguments);a.dequeue()}})})}})(jQuery);
+;/*
+ * jQuery UI Effects Drop 1.8.16
+ *
+ * Copyright 2011, 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/Effects/Drop
+ *
+ * Depends:
+ *	jquery.effects.core.js
+ */
+(function(c){c.effects.drop=function(d){return this.queue(function(){var a=c(this),h=["position","top","bottom","left","right","opacity"],e=c.effects.setMode(a,d.options.mode||"hide"),b=d.options.direction||"left";c.effects.save(a,h);a.show();c.effects.createWrapper(a);var f=b=="up"||b=="down"?"top":"left";b=b=="up"||b=="left"?"pos":"neg";var g=d.options.distance||(f=="top"?a.outerHeight({margin:true})/2:a.outerWidth({margin:true})/2);if(e=="show")a.css("opacity",0).css(f,b=="pos"?-g:g);var i={opacity:e==
+"show"?1:0};i[f]=(e=="show"?b=="pos"?"+=":"-=":b=="pos"?"-=":"+=")+g;a.animate(i,{queue:false,duration:d.duration,easing:d.options.easing,complete:function(){e=="hide"&&a.hide();c.effects.restore(a,h);c.effects.removeWrapper(a);d.callback&&d.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery);
+;/*
+ * jQuery UI Effects Explode 1.8.16
+ *
+ * Copyright 2011, 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/Effects/Explode
+ *
+ * Depends:
+ *	jquery.effects.core.js
+ */
+(function(j){j.effects.explode=function(a){return this.queue(function(){var c=a.options.pieces?Math.round(Math.sqrt(a.options.pieces)):3,d=a.options.pieces?Math.round(Math.sqrt(a.options.pieces)):3;a.options.mode=a.options.mode=="toggle"?j(this).is(":visible")?"hide":"show":a.options.mode;var b=j(this).show().css("visibility","hidden"),g=b.offset();g.top-=parseInt(b.css("marginTop"),10)||0;g.left-=parseInt(b.css("marginLeft"),10)||0;for(var h=b.outerWidth(true),i=b.outerHeight(true),e=0;e<c;e++)for(var f=
+0;f<d;f++)b.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-f*(h/d),top:-e*(i/c)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:h/d,height:i/c,left:g.left+f*(h/d)+(a.options.mode=="show"?(f-Math.floor(d/2))*(h/d):0),top:g.top+e*(i/c)+(a.options.mode=="show"?(e-Math.floor(c/2))*(i/c):0),opacity:a.options.mode=="show"?0:1}).animate({left:g.left+f*(h/d)+(a.options.mode=="show"?0:(f-Math.floor(d/2))*(h/d)),top:g.top+
+e*(i/c)+(a.options.mode=="show"?0:(e-Math.floor(c/2))*(i/c)),opacity:a.options.mode=="show"?1:0},a.duration||500);setTimeout(function(){a.options.mode=="show"?b.css({visibility:"visible"}):b.css({visibility:"visible"}).hide();a.callback&&a.callback.apply(b[0]);b.dequeue();j("div.ui-effects-explode").remove()},a.duration||500)})}})(jQuery);
+;/*
+ * jQuery UI Effects Fade 1.8.16
+ *
+ * Copyright 2011, 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/Effects/Fade
+ *
+ * Depends:
+ *	jquery.effects.core.js
+ */
+(function(b){b.effects.fade=function(a){return this.queue(function(){var c=b(this),d=b.effects.setMode(c,a.options.mode||"hide");c.animate({opacity:d},{queue:false,duration:a.duration,easing:a.options.easing,complete:function(){a.callback&&a.callback.apply(this,arguments);c.dequeue()}})})}})(jQuery);
+;/*
+ * jQuery UI Effects Fold 1.8.16
+ *
+ * Copyright 2011, 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/Effects/Fold
+ *
+ * Depends:
+ *	jquery.effects.core.js
+ */
+(function(c){c.effects.fold=function(a){return this.queue(function(){var b=c(this),j=["position","top","bottom","left","right"],d=c.effects.setMode(b,a.options.mode||"hide"),g=a.options.size||15,h=!!a.options.horizFirst,k=a.duration?a.duration/2:c.fx.speeds._default/2;c.effects.save(b,j);b.show();var e=c.effects.createWrapper(b).css({overflow:"hidden"}),f=d=="show"!=h,l=f?["width","height"]:["height","width"];f=f?[e.width(),e.height()]:[e.height(),e.width()];var i=/([0-9]+)%/.exec(g);if(i)g=parseInt(i[1],
+10)/100*f[d=="hide"?0:1];if(d=="show")e.css(h?{height:0,width:g}:{height:g,width:0});h={};i={};h[l[0]]=d=="show"?f[0]:g;i[l[1]]=d=="show"?f[1]:0;e.animate(h,k,a.options.easing).animate(i,k,a.options.easing,function(){d=="hide"&&b.hide();c.effects.restore(b,j);c.effects.removeWrapper(b);a.callback&&a.callback.apply(b[0],arguments);b.dequeue()})})}})(jQuery);
+;/*
+ * jQuery UI Effects Highlight 1.8.16
+ *
+ * Copyright 2011, 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/Effects/Highlight
+ *
+ * Depends:
+ *	jquery.effects.core.js
+ */
+(function(b){b.effects.highlight=function(c){return this.queue(function(){var a=b(this),e=["backgroundImage","backgroundColor","opacity"],d=b.effects.setMode(a,c.options.mode||"show"),f={backgroundColor:a.css("backgroundColor")};if(d=="hide")f.opacity=0;b.effects.save(a,e);a.show().css({backgroundImage:"none",backgroundColor:c.options.color||"#ffff99"}).animate(f,{queue:false,duration:c.duration,easing:c.options.easing,complete:function(){d=="hide"&&a.hide();b.effects.restore(a,e);d=="show"&&!b.support.opacity&&
+this.style.removeAttribute("filter");c.callback&&c.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery);
+;/*
+ * jQuery UI Effects Pulsate 1.8.16
+ *
+ * Copyright 2011, 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/Effects/Pulsate
+ *
+ * Depends:
+ *	jquery.effects.core.js
+ */
+(function(d){d.effects.pulsate=function(a){return this.queue(function(){var b=d(this),c=d.effects.setMode(b,a.options.mode||"show");times=(a.options.times||5)*2-1;duration=a.duration?a.duration/2:d.fx.speeds._default/2;isVisible=b.is(":visible");animateTo=0;if(!isVisible){b.css("opacity",0).show();animateTo=1}if(c=="hide"&&isVisible||c=="show"&&!isVisible)times--;for(c=0;c<times;c++){b.animate({opacity:animateTo},duration,a.options.easing);animateTo=(animateTo+1)%2}b.animate({opacity:animateTo},duration,
+a.options.easing,function(){animateTo==0&&b.hide();a.callback&&a.callback.apply(this,arguments)});b.queue("fx",function(){b.dequeue()}).dequeue()})}})(jQuery);
+;/*
+ * jQuery UI Effects Scale 1.8.16
+ *
+ * Copyright 2011, 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/Effects/Scale
+ *
+ * Depends:
+ *	jquery.effects.core.js
+ */
+(function(c){c.effects.puff=function(b){return this.queue(function(){var a=c(this),e=c.effects.setMode(a,b.options.mode||"hide"),g=parseInt(b.options.percent,10)||150,h=g/100,i={height:a.height(),width:a.width()};c.extend(b.options,{fade:true,mode:e,percent:e=="hide"?g:100,from:e=="hide"?i:{height:i.height*h,width:i.width*h}});a.effect("scale",b.options,b.duration,b.callback);a.dequeue()})};c.effects.scale=function(b){return this.queue(function(){var a=c(this),e=c.extend(true,{},b.options),g=c.effects.setMode(a,
+b.options.mode||"effect"),h=parseInt(b.options.percent,10)||(parseInt(b.options.percent,10)==0?0:g=="hide"?0:100),i=b.options.direction||"both",f=b.options.origin;if(g!="effect"){e.origin=f||["middle","center"];e.restore=true}f={height:a.height(),width:a.width()};a.from=b.options.from||(g=="show"?{height:0,width:0}:f);h={y:i!="horizontal"?h/100:1,x:i!="vertical"?h/100:1};a.to={height:f.height*h.y,width:f.width*h.x};if(b.options.fade){if(g=="show"){a.from.opacity=0;a.to.opacity=1}if(g=="hide"){a.from.opacity=
+1;a.to.opacity=0}}e.from=a.from;e.to=a.to;e.mode=g;a.effect("size",e,b.duration,b.callback);a.dequeue()})};c.effects.size=function(b){return this.queue(function(){var a=c(this),e=["position","top","bottom","left","right","width","height","overflow","opacity"],g=["position","top","bottom","left","right","overflow","opacity"],h=["width","height","overflow"],i=["fontSize"],f=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],k=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],
+p=c.effects.setMode(a,b.options.mode||"effect"),n=b.options.restore||false,m=b.options.scale||"both",l=b.options.origin,j={height:a.height(),width:a.width()};a.from=b.options.from||j;a.to=b.options.to||j;if(l){l=c.effects.getBaseline(l,j);a.from.top=(j.height-a.from.height)*l.y;a.from.left=(j.width-a.from.width)*l.x;a.to.top=(j.height-a.to.height)*l.y;a.to.left=(j.width-a.to.width)*l.x}var d={from:{y:a.from.height/j.height,x:a.from.width/j.width},to:{y:a.to.height/j.height,x:a.to.width/j.width}};
+if(m=="box"||m=="both"){if(d.from.y!=d.to.y){e=e.concat(f);a.from=c.effects.setTransition(a,f,d.from.y,a.from);a.to=c.effects.setTransition(a,f,d.to.y,a.to)}if(d.from.x!=d.to.x){e=e.concat(k);a.from=c.effects.setTransition(a,k,d.from.x,a.from);a.to=c.effects.setTransition(a,k,d.to.x,a.to)}}if(m=="content"||m=="both")if(d.from.y!=d.to.y){e=e.concat(i);a.from=c.effects.setTransition(a,i,d.from.y,a.from);a.to=c.effects.setTransition(a,i,d.to.y,a.to)}c.effects.save(a,n?e:g);a.show();c.effects.createWrapper(a);
+a.css("overflow","hidden").css(a.from);if(m=="content"||m=="both"){f=f.concat(["marginTop","marginBottom"]).concat(i);k=k.concat(["marginLeft","marginRight"]);h=e.concat(f).concat(k);a.find("*[width]").each(function(){child=c(this);n&&c.effects.save(child,h);var o={height:child.height(),width:child.width()};child.from={height:o.height*d.from.y,width:o.width*d.from.x};child.to={height:o.height*d.to.y,width:o.width*d.to.x};if(d.from.y!=d.to.y){child.from=c.effects.setTransition(child,f,d.from.y,child.from);
+child.to=c.effects.setTransition(child,f,d.to.y,child.to)}if(d.from.x!=d.to.x){child.from=c.effects.setTransition(child,k,d.from.x,child.from);child.to=c.effects.setTransition(child,k,d.to.x,child.to)}child.css(child.from);child.animate(child.to,b.duration,b.options.easing,function(){n&&c.effects.restore(child,h)})})}a.animate(a.to,{queue:false,duration:b.duration,easing:b.options.easing,complete:function(){a.to.opacity===0&&a.css("opacity",a.from.opacity);p=="hide"&&a.hide();c.effects.restore(a,
+n?e:g);c.effects.removeWrapper(a);b.callback&&b.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery);
+;/*
+ * jQuery UI Effects Shake 1.8.16
+ *
+ * Copyright 2011, 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/Effects/Shake
+ *
+ * Depends:
+ *	jquery.effects.core.js
+ */
+(function(d){d.effects.shake=function(a){return this.queue(function(){var b=d(this),j=["position","top","bottom","left","right"];d.effects.setMode(b,a.options.mode||"effect");var c=a.options.direction||"left",e=a.options.distance||20,l=a.options.times||3,f=a.duration||a.options.duration||140;d.effects.save(b,j);b.show();d.effects.createWrapper(b);var g=c=="up"||c=="down"?"top":"left",h=c=="up"||c=="left"?"pos":"neg";c={};var i={},k={};c[g]=(h=="pos"?"-=":"+=")+e;i[g]=(h=="pos"?"+=":"-=")+e*2;k[g]=
+(h=="pos"?"-=":"+=")+e*2;b.animate(c,f,a.options.easing);for(e=1;e<l;e++)b.animate(i,f,a.options.easing).animate(k,f,a.options.easing);b.animate(i,f,a.options.easing).animate(c,f/2,a.options.easing,function(){d.effects.restore(b,j);d.effects.removeWrapper(b);a.callback&&a.callback.apply(this,arguments)});b.queue("fx",function(){b.dequeue()});b.dequeue()})}})(jQuery);
+;/*
+ * jQuery UI Effects Slide 1.8.16
+ *
+ * Copyright 2011, 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/Effects/Slide
+ *
+ * Depends:
+ *	jquery.effects.core.js
+ */
+(function(c){c.effects.slide=function(d){return this.queue(function(){var a=c(this),h=["position","top","bottom","left","right"],f=c.effects.setMode(a,d.options.mode||"show"),b=d.options.direction||"left";c.effects.save(a,h);a.show();c.effects.createWrapper(a).css({overflow:"hidden"});var g=b=="up"||b=="down"?"top":"left";b=b=="up"||b=="left"?"pos":"neg";var e=d.options.distance||(g=="top"?a.outerHeight({margin:true}):a.outerWidth({margin:true}));if(f=="show")a.css(g,b=="pos"?isNaN(e)?"-"+e:-e:e);
+var i={};i[g]=(f=="show"?b=="pos"?"+=":"-=":b=="pos"?"-=":"+=")+e;a.animate(i,{queue:false,duration:d.duration,easing:d.options.easing,complete:function(){f=="hide"&&a.hide();c.effects.restore(a,h);c.effects.removeWrapper(a);d.callback&&d.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery);
+;/*
+ * jQuery UI Effects Transfer 1.8.16
+ *
+ * Copyright 2011, 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/Effects/Transfer
+ *
+ * Depends:
+ *	jquery.effects.core.js
+ */
+(function(e){e.effects.transfer=function(a){return this.queue(function(){var b=e(this),c=e(a.options.to),d=c.offset();c={top:d.top,left:d.left,height:c.innerHeight(),width:c.innerWidth()};d=b.offset();var f=e('<div class="ui-effects-transfer"></div>').appendTo(document.body).addClass(a.options.className).css({top:d.top,left:d.left,height:b.innerHeight(),width:b.innerWidth(),position:"absolute"}).animate(c,a.duration,a.options.easing,function(){f.remove();a.callback&&a.callback.apply(b[0],arguments);
+b.dequeue()})})}})(jQuery);
+;
Index: trunk/prototype/plugins/jquery/jquery-ui.custom.css
===================================================================
--- trunk/prototype/plugins/jquery/jquery-ui.custom.css	(revision 5341)
+++ trunk/prototype/plugins/jquery/jquery-ui.custom.css	(revision 5341)
@@ -0,0 +1,568 @@
+/*
+ * jQuery UI CSS Framework 1.8.16
+ *
+ * Copyright 2011, 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/Theming/API
+ */
+
+/* Layout helpers
+----------------------------------*/
+.ui-helper-hidden { display: none; }
+.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
+.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
+.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
+.ui-helper-clearfix { display: inline-block; }
+/* required comment for clearfix to work in Opera \*/
+* html .ui-helper-clearfix { height:1%; }
+.ui-helper-clearfix { display:block; }
+/* end clearfix */
+.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
+
+
+/* Interaction Cues
+----------------------------------*/
+.ui-state-disabled { cursor: default !important; }
+
+
+/* Icons
+----------------------------------*/
+
+/* states and images */
+.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
+
+
+/* Misc visuals
+----------------------------------*/
+
+/* Overlays */
+.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
+
+
+/*
+ * jQuery UI CSS Framework 1.8.16
+ *
+ * Copyright 2011, 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/Theming/API
+ *
+ * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Lucida%20Grande,%20Lucida%20Sans,%20Arial,%20sans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=5px&bgColorHeader=5c9ccc&bgTextureHeader=12_gloss_wave.png&bgImgOpacityHeader=55&borderColorHeader=4297d7&fcHeader=ffffff&iconColorHeader=d8e7f3&bgColorContent=fcfdfd&bgTextureContent=06_inset_hard.png&bgImgOpacityContent=100&borderColorContent=a6c9e2&fcContent=222222&iconColorContent=469bdd&bgColorDefault=dfeffc&bgTextureDefault=02_glass.png&bgImgOpacityDefault=85&borderColorDefault=c5dbec&fcDefault=2e6e9e&iconColorDefault=6da8d5&bgColorHover=d0e5f5&bgTextureHover=02_glass.png&bgImgOpacityHover=75&borderColorHover=79b7e7&fcHover=1d5987&iconColorHover=217bc0&bgColorActive=f5f8f9&bgTextureActive=06_inset_hard.png&bgImgOpacityActive=100&borderColorActive=79b7e7&fcActive=e17009&iconColorActive=f9bd01&bgColorHighlight=fbec88&bgTextureHighlight=01_flat.png&bgImgOpacityHighlight=55&borderColorHighlight=fad42e&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=02_glass.png&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
+ */
+
+
+/* Component containers
+----------------------------------*/
+.ui-widget { font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1.1em; }
+.ui-widget .ui-widget { font-size: 1em; }
+.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1em; }
+.ui-widget-content { border: 1px solid #a6c9e2; background: #fcfdfd url(images/ui-bg_inset-hard_100_fcfdfd_1x100.png) 50% bottom repeat-x; color: #222222; }
+.ui-widget-content a { color: #222222; }
+.ui-widget-header { border: 1px solid #4297d7; background: #5c9ccc url(images/ui-bg_gloss-wave_55_5c9ccc_500x100.png) 50% 50% repeat-x; color: #ffffff; font-weight: bold; }
+.ui-widget-header a { color: #ffffff; }
+
+/* Interaction states
+----------------------------------*/
+.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #c5dbec; background: #dfeffc url(images/ui-bg_glass_85_dfeffc_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #2e6e9e; }
+.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #2e6e9e; text-decoration: none; }
+.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #79b7e7; background: #d0e5f5 url(images/ui-bg_glass_75_d0e5f5_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #1d5987; }
+.ui-state-hover a, .ui-state-hover a:hover { color: #1d5987; text-decoration: none; }
+.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #79b7e7; background: #f5f8f9 url(images/ui-bg_inset-hard_100_f5f8f9_1x100.png) 50% 50% repeat-x; font-weight: bold; color: #e17009; }
+.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #e17009; text-decoration: none; }
+.ui-widget :active { outline: none; }
+
+/* Interaction Cues
+----------------------------------*/
+.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight  {border: 1px solid #fad42e; background: #fbec88 url(images/ui-bg_flat_55_fbec88_40x100.png) 50% 50% repeat-x; color: #363636; }
+.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
+.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; }
+.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; }
+.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; }
+.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
+.ui-priority-secondary, .ui-widget-content .ui-priority-secondary,  .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
+.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
+
+/* Icons
+----------------------------------*/
+
+/* states and images */
+.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_469bdd_256x240.png); }
+.ui-widget-content .ui-icon {background-image: url(images/ui-icons_469bdd_256x240.png); }
+.ui-widget-header .ui-icon {background-image: url(images/ui-icons_d8e7f3_256x240.png); }
+.ui-state-default .ui-icon { background-image: url(images/ui-icons_6da8d5_256x240.png); }
+.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_217bc0_256x240.png); }
+.ui-state-active .ui-icon {background-image: url(images/ui-icons_f9bd01_256x240.png); }
+.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); }
+.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); }
+
+/* positioning */
+.ui-icon-carat-1-n { background-position: 0 0; }
+.ui-icon-carat-1-ne { background-position: -16px 0; }
+.ui-icon-carat-1-e { background-position: -32px 0; }
+.ui-icon-carat-1-se { background-position: -48px 0; }
+.ui-icon-carat-1-s { background-position: -64px 0; }
+.ui-icon-carat-1-sw { background-position: -80px 0; }
+.ui-icon-carat-1-w { background-position: -96px 0; }
+.ui-icon-carat-1-nw { background-position: -112px 0; }
+.ui-icon-carat-2-n-s { background-position: -128px 0; }
+.ui-icon-carat-2-e-w { background-position: -144px 0; }
+.ui-icon-triangle-1-n { background-position: 0 -16px; }
+.ui-icon-triangle-1-ne { background-position: -16px -16px; }
+.ui-icon-triangle-1-e { background-position: -32px -16px; }
+.ui-icon-triangle-1-se { background-position: -48px -16px; }
+.ui-icon-triangle-1-s { background-position: -64px -16px; }
+.ui-icon-triangle-1-sw { background-position: -80px -16px; }
+.ui-icon-triangle-1-w { background-position: -96px -16px; }
+.ui-icon-triangle-1-nw { background-position: -112px -16px; }
+.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
+.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
+.ui-icon-arrow-1-n { background-position: 0 -32px; }
+.ui-icon-arrow-1-ne { background-position: -16px -32px; }
+.ui-icon-arrow-1-e { background-position: -32px -32px; }
+.ui-icon-arrow-1-se { background-position: -48px -32px; }
+.ui-icon-arrow-1-s { background-position: -64px -32px; }
+.ui-icon-arrow-1-sw { background-position: -80px -32px; }
+.ui-icon-arrow-1-w { background-position: -96px -32px; }
+.ui-icon-arrow-1-nw { background-position: -112px -32px; }
+.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
+.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
+.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
+.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
+.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
+.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
+.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
+.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
+.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
+.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
+.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
+.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
+.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
+.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
+.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
+.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
+.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
+.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
+.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
+.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
+.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
+.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
+.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
+.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
+.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
+.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
+.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
+.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
+.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
+.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
+.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
+.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
+.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
+.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
+.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
+.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
+.ui-icon-arrow-4 { background-position: 0 -80px; }
+.ui-icon-arrow-4-diag { background-position: -16px -80px; }
+.ui-icon-extlink { background-position: -32px -80px; }
+.ui-icon-newwin { background-position: -48px -80px; }
+.ui-icon-refresh { background-position: -64px -80px; }
+.ui-icon-shuffle { background-position: -80px -80px; }
+.ui-icon-transfer-e-w { background-position: -96px -80px; }
+.ui-icon-transferthick-e-w { background-position: -112px -80px; }
+.ui-icon-folder-collapsed { background-position: 0 -96px; }
+.ui-icon-folder-open { background-position: -16px -96px; }
+.ui-icon-document { background-position: -32px -96px; }
+.ui-icon-document-b { background-position: -48px -96px; }
+.ui-icon-note { background-position: -64px -96px; }
+.ui-icon-mail-closed { background-position: -80px -96px; }
+.ui-icon-mail-open { background-position: -96px -96px; }
+.ui-icon-suitcase { background-position: -112px -96px; }
+.ui-icon-comment { background-position: -128px -96px; }
+.ui-icon-person { background-position: -144px -96px; }
+.ui-icon-print { background-position: -160px -96px; }
+.ui-icon-trash { background-position: -176px -96px; }
+.ui-icon-locked { background-position: -192px -96px; }
+.ui-icon-unlocked { background-position: -208px -96px; }
+.ui-icon-bookmark { background-position: -224px -96px; }
+.ui-icon-tag { background-position: -240px -96px; }
+.ui-icon-home { background-position: 0 -112px; }
+.ui-icon-flag { background-position: -16px -112px; }
+.ui-icon-calendar { background-position: -32px -112px; }
+.ui-icon-cart { background-position: -48px -112px; }
+.ui-icon-pencil { background-position: -64px -112px; }
+.ui-icon-clock { background-position: -80px -112px; }
+.ui-icon-disk { background-position: -96px -112px; }
+.ui-icon-calculator { background-position: -112px -112px; }
+.ui-icon-zoomin { background-position: -128px -112px; }
+.ui-icon-zoomout { background-position: -144px -112px; }
+.ui-icon-search { background-position: -160px -112px; }
+.ui-icon-wrench { background-position: -176px -112px; }
+.ui-icon-gear { background-position: -192px -112px; }
+.ui-icon-heart { background-position: -208px -112px; }
+.ui-icon-star { background-position: -224px -112px; }
+.ui-icon-link { background-position: -240px -112px; }
+.ui-icon-cancel { background-position: 0 -128px; }
+.ui-icon-plus { background-position: -16px -128px; }
+.ui-icon-plusthick { background-position: -32px -128px; }
+.ui-icon-minus { background-position: -48px -128px; }
+.ui-icon-minusthick { background-position: -64px -128px; }
+.ui-icon-close { background-position: -80px -128px; }
+.ui-icon-closethick { background-position: -96px -128px; }
+.ui-icon-key { background-position: -112px -128px; }
+.ui-icon-lightbulb { background-position: -128px -128px; }
+.ui-icon-scissors { background-position: -144px -128px; }
+.ui-icon-clipboard { background-position: -160px -128px; }
+.ui-icon-copy { background-position: -176px -128px; }
+.ui-icon-contact { background-position: -192px -128px; }
+.ui-icon-image { background-position: -208px -128px; }
+.ui-icon-video { background-position: -224px -128px; }
+.ui-icon-script { background-position: -240px -128px; }
+.ui-icon-alert { background-position: 0 -144px; }
+.ui-icon-info { background-position: -16px -144px; }
+.ui-icon-notice { background-position: -32px -144px; }
+.ui-icon-help { background-position: -48px -144px; }
+.ui-icon-check { background-position: -64px -144px; }
+.ui-icon-bullet { background-position: -80px -144px; }
+.ui-icon-radio-off { background-position: -96px -144px; }
+.ui-icon-radio-on { background-position: -112px -144px; }
+.ui-icon-pin-w { background-position: -128px -144px; }
+.ui-icon-pin-s { background-position: -144px -144px; }
+.ui-icon-play { background-position: 0 -160px; }
+.ui-icon-pause { background-position: -16px -160px; }
+.ui-icon-seek-next { background-position: -32px -160px; }
+.ui-icon-seek-prev { background-position: -48px -160px; }
+.ui-icon-seek-end { background-position: -64px -160px; }
+.ui-icon-seek-start { background-position: -80px -160px; }
+/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
+.ui-icon-seek-first { background-position: -80px -160px; }
+.ui-icon-stop { background-position: -96px -160px; }
+.ui-icon-eject { background-position: -112px -160px; }
+.ui-icon-volume-off { background-position: -128px -160px; }
+.ui-icon-volume-on { background-position: -144px -160px; }
+.ui-icon-power { background-position: 0 -176px; }
+.ui-icon-signal-diag { background-position: -16px -176px; }
+.ui-icon-signal { background-position: -32px -176px; }
+.ui-icon-battery-0 { background-position: -48px -176px; }
+.ui-icon-battery-1 { background-position: -64px -176px; }
+.ui-icon-battery-2 { background-position: -80px -176px; }
+.ui-icon-battery-3 { background-position: -96px -176px; }
+.ui-icon-circle-plus { background-position: 0 -192px; }
+.ui-icon-circle-minus { background-position: -16px -192px; }
+.ui-icon-circle-close { background-position: -32px -192px; }
+.ui-icon-circle-triangle-e { background-position: -48px -192px; }
+.ui-icon-circle-triangle-s { background-position: -64px -192px; }
+.ui-icon-circle-triangle-w { background-position: -80px -192px; }
+.ui-icon-circle-triangle-n { background-position: -96px -192px; }
+.ui-icon-circle-arrow-e { background-position: -112px -192px; }
+.ui-icon-circle-arrow-s { background-position: -128px -192px; }
+.ui-icon-circle-arrow-w { background-position: -144px -192px; }
+.ui-icon-circle-arrow-n { background-position: -160px -192px; }
+.ui-icon-circle-zoomin { background-position: -176px -192px; }
+.ui-icon-circle-zoomout { background-position: -192px -192px; }
+.ui-icon-circle-check { background-position: -208px -192px; }
+.ui-icon-circlesmall-plus { background-position: 0 -208px; }
+.ui-icon-circlesmall-minus { background-position: -16px -208px; }
+.ui-icon-circlesmall-close { background-position: -32px -208px; }
+.ui-icon-squaresmall-plus { background-position: -48px -208px; }
+.ui-icon-squaresmall-minus { background-position: -64px -208px; }
+.ui-icon-squaresmall-close { background-position: -80px -208px; }
+.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
+.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
+.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
+.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
+.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
+.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
+
+
+/* Misc visuals
+----------------------------------*/
+
+/* Corner radius */
+.ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 5px; -webkit-border-top-left-radius: 5px; -khtml-border-top-left-radius: 5px; border-top-left-radius: 5px; }
+.ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 5px; -webkit-border-top-right-radius: 5px; -khtml-border-top-right-radius: 5px; border-top-right-radius: 5px; }
+.ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 5px; -webkit-border-bottom-left-radius: 5px; -khtml-border-bottom-left-radius: 5px; border-bottom-left-radius: 5px; }
+.ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 5px; -webkit-border-bottom-right-radius: 5px; -khtml-border-bottom-right-radius: 5px; border-bottom-right-radius: 5px; }
+
+/* Overlays */
+.ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); }
+.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -khtml-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }/*
+ * jQuery UI Resizable 1.8.16
+ *
+ * Copyright 2011, 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/Resizable#theming
+ */
+.ui-resizable { position: relative;}
+.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block; }
+.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
+.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
+.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
+.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }
+.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }
+.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
+.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
+.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
+.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/*
+ * jQuery UI Selectable 1.8.16
+ *
+ * Copyright 2011, 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/Selectable#theming
+ */
+.ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; }
+/*
+ * jQuery UI Accordion 1.8.16
+ *
+ * Copyright 2011, 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/Accordion#theming
+ */
+/* IE/Win - Fix animation bug - #4615 */
+.ui-accordion { width: 100%; }
+.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
+.ui-accordion .ui-accordion-li-fix { display: inline; }
+.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }
+.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; }
+.ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; }
+.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
+.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; }
+.ui-accordion .ui-accordion-content-active { display: block; }
+/*
+ * jQuery UI Autocomplete 1.8.16
+ *
+ * Copyright 2011, 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/Autocomplete#theming
+ */
+.ui-autocomplete { position: absolute; cursor: default; }	
+
+/* workarounds */
+* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
+
+/*
+ * jQuery UI Menu 1.8.16
+ *
+ * Copyright 2010, 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/Menu#theming
+ */
+.ui-menu {
+	list-style:none;
+	padding: 2px;
+	margin: 0;
+	display:block;
+	float: left;
+}
+.ui-menu .ui-menu {
+	margin-top: -3px;
+}
+.ui-menu .ui-menu-item {
+	margin:0;
+	padding: 0;
+	zoom: 1;
+	float: left;
+	clear: left;
+	width: 100%;
+}
+.ui-menu .ui-menu-item a {
+	text-decoration:none;
+	display:block;
+	padding:.2em .4em;
+	line-height:1.5;
+	zoom:1;
+}
+.ui-menu .ui-menu-item a.ui-state-hover,
+.ui-menu .ui-menu-item a.ui-state-active {
+	font-weight: normal;
+	margin: -1px;
+}
+/*
+ * jQuery UI Button 1.8.16
+ *
+ * Copyright 2011, 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#theming
+ */
+.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */
+.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
+button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
+.ui-button-icons-only { width: 3.4em; } 
+button.ui-button-icons-only { width: 3.7em; } 
+
+/*button text element */
+.ui-button .ui-button-text { display: block; line-height: 1.4;  }
+.ui-button-text-only .ui-button-text { padding: .4em 1em; }
+.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }
+.ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }
+.ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; }
+.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }
+/* no icon support for input elements, provide padding by default */
+input.ui-button { padding: .4em 1em; }
+
+/*button icon element(s) */
+.ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }
+.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }
+.ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }
+.ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
+.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
+
+/*button sets*/
+.ui-buttonset { margin-right: 7px; }
+.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; }
+
+/* workarounds */
+button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */
+/*
+ * jQuery UI Dialog 1.8.16
+ *
+ * Copyright 2011, 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#theming
+ */
+.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; }
+.ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative;  }
+.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; } 
+.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
+.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
+.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
+.ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
+.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
+.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; }
+.ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; }
+.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
+.ui-draggable .ui-dialog-titlebar { cursor: move; }
+/*
+ * jQuery UI Slider 1.8.16
+ *
+ * Copyright 2011, 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/Slider#theming
+ */
+.ui-slider { position: relative; text-align: left; }
+.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
+.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
+
+.ui-slider-horizontal { height: .8em; }
+.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
+.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
+.ui-slider-horizontal .ui-slider-range-min { left: 0; }
+.ui-slider-horizontal .ui-slider-range-max { right: 0; }
+
+.ui-slider-vertical { width: .8em; height: 100px; }
+.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
+.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
+.ui-slider-vertical .ui-slider-range-min { bottom: 0; }
+.ui-slider-vertical .ui-slider-range-max { top: 0; }/*
+ * jQuery UI Tabs 1.8.16
+ *
+ * Copyright 2011, 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/Tabs#theming
+ */
+.ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
+.ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; }
+.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; }
+.ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; }
+.ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; }
+.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; }
+.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
+.ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; }
+.ui-tabs .ui-tabs-hide { display: none !important; }
+/*
+ * jQuery UI Datepicker 1.8.16
+ *
+ * Copyright 2011, 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/Datepicker#theming
+ */
+.ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; }
+.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
+.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
+.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
+.ui-datepicker .ui-datepicker-prev { left:2px; }
+.ui-datepicker .ui-datepicker-next { right:2px; }
+.ui-datepicker .ui-datepicker-prev-hover { left:1px; }
+.ui-datepicker .ui-datepicker-next-hover { right:1px; }
+.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px;  }
+.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
+.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
+.ui-datepicker select.ui-datepicker-month-year {width: 100%;}
+.ui-datepicker select.ui-datepicker-month, 
+.ui-datepicker select.ui-datepicker-year { width: 49%;}
+.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
+.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0;  }
+.ui-datepicker td { border: 0; padding: 1px; }
+.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
+.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
+.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
+.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
+
+/* with multiple calendars */
+.ui-datepicker.ui-datepicker-multi { width:auto; }
+.ui-datepicker-multi .ui-datepicker-group { float:left; }
+.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
+.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
+.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
+.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
+.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
+.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
+.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
+.ui-datepicker-row-break { clear:both; width:100%; font-size:0em; }
+
+/* RTL support */
+.ui-datepicker-rtl { direction: rtl; }
+.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
+.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
+.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
+.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
+.ui-datepicker-rtl .ui-datepicker-group { float:right; }
+.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
+.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
+
+/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
+.ui-datepicker-cover {
+    display: none; /*sorry for IE5*/
+    display/**/: block; /*sorry for IE5*/
+    position: absolute; /*must have*/
+    z-index: -1; /*must have*/
+    filter: mask(); /*must have*/
+    top: -4px; /*must have*/
+    left: -4px; /*must have*/
+    width: 200px; /*must have*/
+    height: 200px; /*must have*/
+}/*
+ * jQuery UI Progressbar 1.8.16
+ *
+ * Copyright 2011, 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/Progressbar#theming
+ */
+.ui-progressbar { height:2em; text-align: left; }
+.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }
Index: trunk/prototype/plugins/jquery/jquery.min.js
===================================================================
--- trunk/prototype/plugins/jquery/jquery.min.js	(revision 5341)
+++ trunk/prototype/plugins/jquery/jquery.min.js	(revision 5341)
@@ -0,0 +1,18 @@
+/*!
+ * jQuery JavaScript Library v1.6.2
+ * http://jquery.com/
+ *
+ * Copyright 2011, John Resig
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * Includes Sizzle.js
+ * http://sizzlejs.com/
+ * Copyright 2011, The Dojo Foundation
+ * Released under the MIT, BSD, and GPL Licenses.
+ *
+ * Date: Thu Jun 30 14:16:56 2011 -0400
+ */
+(function(a,b){function cv(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cs(a){if(!cg[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ch||(ch=c.createElement("iframe"),ch.frameBorder=ch.width=ch.height=0),b.appendChild(ch);if(!ci||!ch.createElement)ci=(ch.contentWindow||ch.contentDocument).document,ci.write((c.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>"),ci.close();d=ci.createElement(a),ci.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ch)}cg[a]=e}return cg[a]}function cr(a,b){var c={};f.each(cm.concat.apply([],cm.slice(0,b)),function(){c[this]=a});return c}function cq(){cn=b}function cp(){setTimeout(cq,0);return cn=f.now()}function cf(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ce(){try{return new a.XMLHttpRequest}catch(b){}}function b$(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function bZ(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function bY(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bC.test(a)?d(a,e):bY(a+"["+(typeof e=="object"||f.isArray(e)?b:"")+"]",e,c,d)});else if(!c&&b!=null&&typeof b=="object")for(var e in b)bY(a+"["+e+"]",b[e],c,d);else d(a,b)}function bX(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bR,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=bX(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=bX(a,c,d,e,"*",g));return l}function bW(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bN),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bA(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?bv:bw;if(d>0){c!=="border"&&f.each(e,function(){c||(d-=parseFloat(f.css(a,"padding"+this))||0),c==="margin"?d+=parseFloat(f.css(a,c+this))||0:d-=parseFloat(f.css(a,"border"+this+"Width"))||0});return d+"px"}d=bx(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0,c&&f.each(e,function(){d+=parseFloat(f.css(a,"padding"+this))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+this+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+this))||0)});return d+"px"}function bm(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(be,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bl(a){f.nodeName(a,"input")?bk(a):"getElementsByTagName"in a&&f.grep(a.getElementsByTagName("input"),bk)}function bk(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bj(a){return"getElementsByTagName"in a?a.getElementsByTagName("*"):"querySelectorAll"in a?a.querySelectorAll("*"):[]}function bi(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bh(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c=f.expando,d=f.data(a),e=f.data(b,d);if(d=d[c]){var g=d.events;e=e[c]=f.extend({},d);if(g){delete e.handle,e.events={};for(var h in g)for(var i=0,j=g[h].length;i<j;i++)f.event.add(b,h+(g[h][i].namespace?".":"")+g[h][i].namespace,g[h][i],g[h][i].data)}}}}function bg(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function W(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(R.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function V(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function N(a,b){return(a&&a!=="*"?a+".":"")+b.replace(z,"`").replace(A,"&")}function M(a){var b,c,d,e,g,h,i,j,k,l,m,n,o,p=[],q=[],r=f._data(this,"events");if(!(a.liveFired===this||!r||!r.live||a.target.disabled||a.button&&a.type==="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var s=r.live.slice(0);for(i=0;i<s.length;i++)g=s[i],g.origType.replace(x,"")===a.type?q.push(g.selector):s.splice(i--,1);e=f(a.target).closest(q,a.currentTarget);for(j=0,k=e.length;j<k;j++){m=e[j];for(i=0;i<s.length;i++){g=s[i];if(m.selector===g.selector&&(!n||n.test(g.namespace))&&!m.elem.disabled){h=m.elem,d=null;if(g.preType==="mouseenter"||g.preType==="mouseleave")a.type=g.preType,d=f(a.relatedTarget).closest(g.selector)[0],d&&f.contains(h,d)&&(d=h);(!d||d!==h)&&p.push({elem:h,handleObj:g,level:m.level})}}}for(j=0,k=p.length;j<k;j++){e=p[j];if(c&&e.level>c)break;a.currentTarget=e.elem,a.data=e.handleObj.data,a.handleObj=e.handleObj,o=e.handleObj.origHandler.apply(e.elem,arguments);if(o===!1||a.isPropagationStopped()){c=e.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function K(a,c,d){var e=f.extend({},d[0]);e.type=a,e.originalEvent={},e.liveFired=b,f.event.handle.call(c,e),e.isDefaultPrevented()&&d[0].preventDefault()}function E(){return!0}function D(){return!1}function m(a,c,d){var e=c+"defer",g=c+"queue",h=c+"mark",i=f.data(a,e,b,!0);i&&(d==="queue"||!f.data(a,g,b,!0))&&(d==="mark"||!f.data(a,h,b,!0))&&setTimeout(function(){!f.data(a,g,b,!0)&&!f.data(a,h,b,!0)&&(f.removeData(a,e,!0),i.resolve())},0)}function l(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function k(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(j,"$1-$2").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNaN(d)?i.test(d)?f.parseJSON(d):d:parseFloat(d)}catch(g){}f.data(a,c,d)}else d=b}return d}var c=a.document,d=a.navigator,e=a.location,f=function(){function J(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(J,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/\d/,n=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,o=/^[\],:{}\s]*$/,p=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,q=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,r=/(?:^|:|,)(?:\s*\[)+/g,s=/(webkit)[ \/]([\w.]+)/,t=/(opera)(?:.*version)?[ \/]([\w.]+)/,u=/(msie) ([\w.]+)/,v=/(mozilla)(?:.*? rv:([\w.]+))?/,w=/-([a-z])/ig,x=function(a,b){return b.toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=n.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.6.2",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;A.resolveWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!A){A=e._Deferred();if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNaN:function(a){return a==null||!m.test(a)||isNaN(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1;var c;for(c in a);return c===b||D.call(a,c)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(o.test(b.replace(p,"@").replace(q,"]").replace(r,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(b,c,d){a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b)),d=c.documentElement,(!d||!d.nodeName||d.nodeName==="parsererror")&&e.error("Invalid XML: "+b);return c},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:G?function(a){return a==null?"":G.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?E.call(c,a):e.merge(c,a)}return c},inArray:function(a,b){if(H)return H.call(b,a);for(var c=0,d=b.length;c<d;c++)if(b[c]===a)return c;return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=F.call(arguments,2),g=function(){return a.apply(c,f.concat(F.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h){var i=a.length;if(typeof c=="object"){for(var j in c)e.access(a,j,c[j],f,g,d);return a}if(d!==b){f=!h&&f&&e.isFunction(d);for(var k=0;k<i;k++)g(a[k],c,f?d.call(a[k],k,g(a[k],c)):d,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=s.exec(a)||t.exec(a)||u.exec(a)||a.indexOf("compatible")<0&&v.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){I["[object "+b+"]"]=b.toLowerCase()}),z=e.uaMatch(y),z.browser&&(e.browser[z.browser]=!0,e.browser.version=z.version),e.browser.webkit&&(e.browser.safari=!0),j.test("Â ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?B=function(){c.removeEventListener("DOMContentLoaded",B,!1),e.ready()}:c.attachEvent&&(B=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",B),e.ready())});return e}(),g="done fail isResolved isRejected promise then always pipe".split(" "),h=[].slice;f.extend({_Deferred:function(){var a=[],b,c,d,e={done:function(){if(!d){var c=arguments,g,h,i,j,k;b&&(k=b,b=0);for(g=0,h=c.length;g<h;g++)i=c[g],j=f.type(i),j==="array"?e.done.apply(e,i):j==="function"&&a.push(i);k&&e.resolveWith(k[0],k[1])}return this},resolveWith:function(e,f){if(!d&&!b&&!c){f=f||[],c=1;try{while(a[0])a.shift().apply(e,f)}finally{b=[e,f],c=0}}return this},resolve:function(){e.resolveWith(this,arguments);return this},isResolved:function(){return!!c||!!b},cancel:function(){d=1,a=[];return this}};return e},Deferred:function(a){var b=f._Deferred(),c=f._Deferred(),d;f.extend(b,{then:function(a,c){b.done(a).fail(c);return this},always:function(){return b.done.apply(b,arguments).fail.apply(this,arguments)},fail:c.done,rejectWith:c.resolveWith,reject:c.resolve,isRejected:c.isResolved,pipe:function(a,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[c,"reject"]},function(a,c){var e=c[0],g=c[1],h;f.isFunction(e)?b[a](function(){h=e.apply(this,arguments),h&&f.isFunction(h.promise)?h.promise().then(d.resolve,d.reject):d[g](h)}):b[a](d[g])})}).promise()},promise:function(a){if(a==null){if(d)return d;d=a={}}var c=g.length;while(c--)a[g[c]]=b[g[c]];return a}}),b.done(c.cancel).fail(b.cancel),delete b.cancel,a&&a.call(b,b);return b},when:function(a){function i(a){return function(c){b[a]=arguments.length>1?h.call(arguments,0):c,--e||g.resolveWith(g,h.call(b,0))}}var b=arguments,c=0,d=b.length,e=d,g=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred();if(d>1){for(;c<d;c++)b[c]&&f.isFunction(b[c].promise)?b[c].promise().then(i(c),g.reject):--e;e||g.resolveWith(g,b)}else g!==a&&g.resolveWith(g,d?[a]:[]);return g.promise()}}),f.support=function(){var a=c.createElement("div"),b=c.documentElement,d,e,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;a.setAttribute("className","t"),a.innerHTML="   <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",d=a.getElementsByTagName("*"),e=a.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=a.getElementsByTagName("input")[0],k={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55$/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:a.className!=="t",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,k.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,k.optDisabled=!h.disabled;try{delete a.test}catch(v){k.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function(){k.noCloneEvent=!1}),a.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),k.radioValue=i.value==="t",i.setAttribute("checked","checked"),a.appendChild(i),l=c.createDocumentFragment(),l.appendChild(a.firstChild),k.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,a.innerHTML="",a.style.width=a.style.paddingLeft="1px",m=c.getElementsByTagName("body")[0],o=c.createElement(m?"div":"body"),p={visibility:"hidden",width:0,height:0,border:0,margin:0},m&&f.extend(p,{position:"absolute",left:-1e3,top:-1e3});for(t in p)o.style[t]=p[t];o.appendChild(a),n=m||b,n.insertBefore(o,n.firstChild),k.appendChecked=i.checked,k.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,k.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="<div style='width:4px;'></div>",k.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>",q=a.getElementsByTagName("td"),u=q[0].offsetHeight===0,q[0].style.display="",q[1].style.display="none",k.reliableHiddenOffsets=u&&q[0].offsetHeight===0,a.innerHTML="",c.defaultView&&c.defaultView.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",a.appendChild(j),k.reliableMarginRight=(parseInt((c.defaultView.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0),o.innerHTML="",n.removeChild(o);if(a.attachEvent)for(t in{submit:1,change:1,focusin:1})s="on"+t,u=s in a,u||(a.setAttribute(s,"return;"),u=typeof a[s]=="function"),k[t+"Bubbles"]=u;o=l=g=h=m=j=a=i=null;return k}(),f.boxModel=f.support.boxModel;var i=/^(?:\{.*\}|\[.*\])$/,j=/([a-z])([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!l(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g=f.expando,h=typeof c=="string",i,j=a.nodeType,k=j?f.cache:a,l=j?a[f.expando]:a[f.expando]&&f.expando;if((!l||e&&l&&!k[l][g])&&h&&d===b)return;l||(j?a[f.expando]=l=++f.uuid:l=f.expando),k[l]||(k[l]={},j||(k[l].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?k[l][g]=f.extend(k[l][g],c):k[l]=f.extend(k[l],c);i=k[l],e&&(i[g]||(i[g]={}),i=i[g]),d!==b&&(i[f.camelCase(c)]=d);if(c==="events"&&!i[c])return i[g]&&i[g].events;return h?i[f.camelCase(c)]||i[c]:i}},removeData:function(b,c,d){if(!!f.acceptData(b)){var e=f.expando,g=b.nodeType,h=g?f.cache:b,i=g?b[f.expando]:f.expando;if(!h[i])return;if(c){var j=d?h[i][e]:h[i];if(j){delete j[c];if(!l(j))return}}if(d){delete h[i][e];if(!l(h[i]))return}var k=h[i][e];f.support.deleteExpando||h!=a?delete h[i]:h[i]=null,k?(h[i]={},g||(h[i].toJSON=f.noop),h[i][e]=k):g&&(f.support.deleteExpando?delete b[f.expando]:b.removeAttribute?b.removeAttribute(f.expando):b[f.expando]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d=null;if(typeof a=="undefined"){if(this.length){d=f.data(this[0]);if(this[0].nodeType===1){var e=this[0].attributes,g;for(var h=0,i=e.length;h<i;h++)g=e[h].name,g.indexOf("data-")===0&&(g=f.camelCase(g.substring(5)),k(this[0],g,d[g]))}}return d}if(typeof a=="object")return this.each(function(){f.data(this,a)});var j=a.split(".");j[1]=j[1]?"."+j[1]:"";if(c===b){d=this.triggerHandler("getData"+j[1]+"!",[j[0]]),d===b&&this.length&&(d=f.data(this[0],a),d=k(this[0],a,d));return d===b&&j[1]?this.data(j[0]):d}return this.each(function(){var b=f(this),d=[j[0],c];b.triggerHandler("setData"+j[1]+"!",d),f.data(this,a,c),b.triggerHandler("changeData"+j[1]+"!",d)})},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,c){a&&(c=(c||"fx")+"mark",f.data(a,c,(f.data(a,c,b,!0)||0)+1,!0))},_unmark:function(a,c,d){a!==!0&&(d=c,c=a,a=!1);if(c){d=d||"fx";var e=d+"mark",g=a?0:(f.data(c,e,b,!0)||1)-1;g?f.data(c,e,g,!0):(f.removeData(c,e,!0),m(c,d,"mark"))}},queue:function(a,c,d){if(a){c=(c||"fx")+"queue";var e=f.data(a,c,b,!0);d&&(!e||f.isArray(d)?e=f.data(a,c,f.makeArray(d),!0):e.push(d));return e||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e;d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),d.call(a,function(){f.dequeue(a,b)})),c.length||(f.removeData(a,b+"queue",!0),m(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){typeof a!="string"&&(c=a,a="fx");if(c===b)return f.queue(this[0],a);return this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(){var c=this;setTimeout(function(){f.dequeue(c,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f._Deferred(),!0))h++,l.done(m);m();return d.promise()}});var n=/[\n\t\r]/g,o=/\s+/,p=/\r/g,q=/^(?:button|input)$/i,r=/^(?:button|input|object|select|textarea)$/i,s=/^a(?:rea)?$/i,t=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,u=/\:|^on/,v,w;f.fn.extend({attr:function(a,b){return f.access(this,a,b,!0,f.attr)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,a,b,!0,f.prop)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(o);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{g=" "+e.className+" ";for(h=0,i=b.length;h<i;h++)~g.indexOf(" "+b[h]+" ")||(g+=b[h]+" ");e.className=f.trim(g)}}}return this},removeClass:function(a){var c,d,e,g,h,i,j;if(f.isFunction(a))return this.each(function(b){f(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(o);for(d=0,e=this.length;d<e;d++){g=this[d];if(g.nodeType===1&&g.className)if(a){h=(" "+g.className+" ").replace(n," ");for(i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){f(this).toggleClass(a.call(this,c,this.className,b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(o);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ";for(var c=0,d=this.length;c<d;c++)if((" "+this[c].className+" ").replace(n," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e=this[0];if(!arguments.length){if(e){c=f.valHooks[e.nodeName.toLowerCase()]||f.valHooks[e.type];if(c&&"get"in c&&(d=c.get(e,"value"))!==b)return d;d=e.value;return typeof d=="string"?d.replace(p,""):d==null?"":d}return b}var g=f.isFunction(a);return this.each(function(d){var e=f(this),h;if(this.nodeType===1){g?h=a.call(this,d,e.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c=a.selectedIndex,d=[],e=a.options,g=a.type==="select-one";if(c<0)return null;for(var h=g?c:0,i=g?c+1:e.length;h<i;h++){var j=e[h];if(j.selected&&(f.support.optDisabled?!j.disabled:j.getAttribute("disabled")===null)&&(!j.parentNode.disabled||!f.nodeName(j.parentNode,"optgroup"))){b=f(j).val();if(g)return b;d.push(b)}}if(g&&!d.length&&e.length)return f(e[c]).val();return d},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attrFix:{tabindex:"tabIndex"},attr:function(a,c,d,e){var g=a.nodeType;if(!a||g===3||g===8||g===2)return b;if(e&&c in f.attrFn)return f(a)[c](d);if(!("getAttribute"in a))return f.prop(a,c,d);var h,i,j=g!==1||!f.isXMLDoc(a);j&&(c=f.attrFix[c]||c,i=f.attrHooks[c],i||(t.test(c)?i=w:v&&c!=="className"&&(f.nodeName(a,"form")||u.test(c))&&(i=v)));if(d!==b){if(d===null){f.removeAttr(a,c);return b}if(i&&"set"in i&&j&&(h=i.set(a,d,c))!==b)return h;a.setAttribute(c,""+d);return d}if(i&&"get"in i&&j&&(h=i.get(a,c))!==null)return h;h=a.getAttribute(c);return h===null?b:h},removeAttr:function(a,b){var c;a.nodeType===1&&(b=f.attrFix[b]||b,f.support.getSetAttribute?a.removeAttribute(b):(f.attr(a,b,""),a.removeAttributeNode(a.getAttributeNode(b))),t.test(b)&&(c=f.propFix[b]||b)in a&&(a[c]=!1))},attrHooks:{type:{set:function(a,b){if(q.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},tabIndex:{get:function(a){var c=a.getAttributeNode("tabIndex");return c&&c.specified?parseInt(c.value,10):r.test(a.nodeName)||s.test(a.nodeName)&&a.href?0:b}},value:{get:function(a,b){if(v&&f.nodeName(a,"button"))return v.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(v&&f.nodeName(a,"button"))return v.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e=a.nodeType;if(!a||e===3||e===8||e===2)return b;var g,h,i=e!==1||!f.isXMLDoc(a);i&&(c=f.propFix[c]||c,h=f.propHooks[c]);return d!==b?h&&"set"in h&&(g=h.set(a,d,c))!==b?g:a[c]=d:h&&"get"in h&&(g=h.get(a,c))!==b?g:a[c]},propHooks:{}}),w={get:function(a,c){return f.prop(a,c)?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},f.support.getSetAttribute||(f.attrFix=f.propFix,v=f.attrHooks.name=f.attrHooks.title=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&d.nodeValue!==""?d.nodeValue:b},set:function(a,b,c){var d=a.getAttributeNode(c);if(d){d.nodeValue=b;return b}}},f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})})),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}})),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var x=/\.(.*)$/,y=/^(?:textarea|input|select)$/i,z=/\./g,A=/ /g,B=/[^\w\s.|`]/g,C=function(a){return a.replace(B,"\\$&")};f.event={add:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){if(d===!1)d=D;else if(!d)return;var g,h;d.handler&&(g=d,d=g.handler),d.guid||(d.guid=f.guid++);var i=f._data(a);if(!i)return;var j=i.events,k=i.handle;j||(i.events=j={}),k||(i.handle=k=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.handle.apply(k.elem,arguments):b}),k.elem=a,c=c.split(" ");var l,m=0,n;while(l=c[m++]){h=g?f.extend({},g):{handler:d,data:e},l.indexOf(".")>-1?(n=l.split("."),l=n.shift(),h.namespace=n.slice(0).sort().join(".")):(n=[],h.namespace=""),h.type=l,h.guid||(h.guid=d.guid);var o=j[l],p=f.event.special[l]||{};if(!o){o=j[l]=[];if(!p.setup||p.setup.call(a,e,n,k)===!1)a.addEventListener?a.addEventListener(l,k,!1):a.attachEvent&&a.attachEvent("on"+l,k)}p.add&&(p.add.call(a,h),h.handler.guid||(h.handler.guid=d.guid)),o.push(h),f.event.global[l]=!0}a=null}},global:{},remove:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){d===!1&&(d=D);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=f.hasData(a)&&f._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(d=c.handler,c=c.type);if(!c||typeof c=="string"&&c.charAt(0)==="."){c=c||"";for(h in t)f.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+f.map(m.slice(0).sort(),C).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!d){for(j=0;j<p.length;j++){q=p[j];if(l||n.test(q.namespace))f.event.remove(a,r,q.handler,j),p.splice(j--,1)}continue}o=f.event.special[h]||{};for(j=e||0;j<p.length;j++){q=p[j];if(d.guid===q.guid){if(l||n.test(q.namespace))e==null&&p.splice(j--,1),o.remove&&o.remove.call(a,q);if(e!=null)break}}if(p.length===0||e!=null&&p.length===1)(!o.teardown||o.teardown.call(a,m)===!1)&&f.removeEvent(a,h,s.handle),g=null,delete t[h]}if(f.isEmptyObject(t)){var u=s.handle;u&&(u.elem=null),delete s.events,delete s.handle,f.isEmptyObject(s)&&f.removeData(a,b,!0)}}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){var h=c.type||c,i=[],j;h.indexOf("!")>=0&&(h=h.slice(0,-1),j=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.
+shift(),i.sort());if(!!e&&!f.event.customEvent[h]||!!f.event.global[h]){c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.exclusive=j,c.namespace=i.join("."),c.namespace_re=new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)");if(g||!e)c.preventDefault(),c.stopPropagation();if(!e){f.each(f.cache,function(){var a=f.expando,b=this[a];b&&b.events&&b.events[h]&&f.event.trigger(c,d,b.handle.elem)});return}if(e.nodeType===3||e.nodeType===8)return;c.result=b,c.target=e,d=d!=null?f.makeArray(d):[],d.unshift(c);var k=e,l=h.indexOf(":")<0?"on"+h:"";do{var m=f._data(k,"handle");c.currentTarget=k,m&&m.apply(k,d),l&&f.acceptData(k)&&k[l]&&k[l].apply(k,d)===!1&&(c.result=!1,c.preventDefault()),k=k.parentNode||k.ownerDocument||k===c.target.ownerDocument&&a}while(k&&!c.isPropagationStopped());if(!c.isDefaultPrevented()){var n,o=f.event.special[h]||{};if((!o._default||o._default.call(e.ownerDocument,c)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)){try{l&&e[h]&&(n=e[l],n&&(e[l]=null),f.event.triggered=h,e[h]())}catch(p){}n&&(e[l]=n),f.event.triggered=b}}return c.result}},handle:function(c){c=f.event.fix(c||a.event);var d=((f._data(this,"events")||{})[c.type]||[]).slice(0),e=!c.exclusive&&!c.namespace,g=Array.prototype.slice.call(arguments,0);g[0]=c,c.currentTarget=this;for(var h=0,i=d.length;h<i;h++){var j=d[h];if(e||c.namespace_re.test(j.namespace)){c.handler=j.handler,c.data=j.data,c.handleObj=j;var k=j.handler.apply(this,g);k!==b&&(c.result=k,k===!1&&(c.preventDefault(),c.stopPropagation()));if(c.isImmediatePropagationStopped())break}}return c.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(a){if(a[f.expando])return a;var d=a;a=f.Event(d);for(var e=this.props.length,g;e;)g=this.props[--e],a[g]=d[g];a.target||(a.target=a.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),!a.relatedTarget&&a.fromElement&&(a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement);if(a.pageX==null&&a.clientX!=null){var h=a.target.ownerDocument||c,i=h.documentElement,j=h.body;a.pageX=a.clientX+(i&&i.scrollLeft||j&&j.scrollLeft||0)-(i&&i.clientLeft||j&&j.clientLeft||0),a.pageY=a.clientY+(i&&i.scrollTop||j&&j.scrollTop||0)-(i&&i.clientTop||j&&j.clientTop||0)}a.which==null&&(a.charCode!=null||a.keyCode!=null)&&(a.which=a.charCode!=null?a.charCode:a.keyCode),!a.metaKey&&a.ctrlKey&&(a.metaKey=a.ctrlKey),!a.which&&a.button!==b&&(a.which=a.button&1?1:a.button&2?3:a.button&4?2:0);return a},guid:1e8,proxy:f.proxy,special:{ready:{setup:f.bindReady,teardown:f.noop},live:{add:function(a){f.event.add(this,N(a.origType,a.selector),f.extend({},a,{handler:M,guid:a.handler.guid}))},remove:function(a){f.event.remove(this,N(a.origType,a.selector),a)}},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}}},f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!this.preventDefault)return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?E:D):this.type=a,b&&f.extend(this,b),this.timeStamp=f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=E;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=E;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=E,this.stopPropagation()},isDefaultPrevented:D,isPropagationStopped:D,isImmediatePropagationStopped:D};var F=function(a){var b=a.relatedTarget,c=!1,d=a.type;a.type=a.data,b!==this&&(b&&(c=f.contains(this,b)),c||(f.event.handle.apply(this,arguments),a.type=d))},G=function(a){a.type=a.data,f.event.handle.apply(this,arguments)};f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]={setup:function(c){f.event.add(this,b,c&&c.selector?G:F,a)},teardown:function(a){f.event.remove(this,b,a&&a.selector?G:F)}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(a,b){if(!f.nodeName(this,"form"))f.event.add(this,"click.specialSubmit",function(a){var b=a.target,c=b.type;(c==="submit"||c==="image")&&f(b).closest("form").length&&K("submit",this,arguments)}),f.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,c=b.type;(c==="text"||c==="password")&&f(b).closest("form").length&&a.keyCode===13&&K("submit",this,arguments)});else return!1},teardown:function(a){f.event.remove(this,".specialSubmit")}});if(!f.support.changeBubbles){var H,I=function(a){var b=a.type,c=a.value;b==="radio"||b==="checkbox"?c=a.checked:b==="select-multiple"?c=a.selectedIndex>-1?f.map(a.options,function(a){return a.selected}).join("-"):"":f.nodeName(a,"select")&&(c=a.selectedIndex);return c},J=function(c){var d=c.target,e,g;if(!!y.test(d.nodeName)&&!d.readOnly){e=f._data(d,"_change_data"),g=I(d),(c.type!=="focusout"||d.type!=="radio")&&f._data(d,"_change_data",g);if(e===b||g===e)return;if(e!=null||g)c.type="change",c.liveFired=b,f.event.trigger(c,arguments[1],d)}};f.event.special.change={filters:{focusout:J,beforedeactivate:J,click:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(c==="radio"||c==="checkbox"||f.nodeName(b,"select"))&&J.call(this,a)},keydown:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(a.keyCode===13&&!f.nodeName(b,"textarea")||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&J.call(this,a)},beforeactivate:function(a){var b=a.target;f._data(b,"_change_data",I(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in H)f.event.add(this,c+".specialChange",H[c]);return y.test(this.nodeName)},teardown:function(a){f.event.remove(this,".specialChange");return y.test(this.nodeName)}},H=f.event.special.change.filters,H.focus=H.beforeactivate}f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){function e(a){var c=f.event.fix(a);c.type=b,c.originalEvent={},f.event.trigger(c,null,c.target),c.isDefaultPrevented()&&a.preventDefault()}var d=0;f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.each(["bind","one"],function(a,c){f.fn[c]=function(a,d,e){var g;if(typeof a=="object"){for(var h in a)this[c](h,d,a[h],e);return this}if(arguments.length===2||d===!1)e=d,d=b;c==="one"?(g=function(a){f(this).unbind(a,g);return e.apply(this,arguments)},g.guid=e.guid||f.guid++):g=e;if(a==="unload"&&c!=="one")this.one(a,d,e);else for(var i=0,j=this.length;i<j;i++)f.event.add(this[i],a,g,d);return this}}),f.fn.extend({unbind:function(a,b){if(typeof a=="object"&&!a.preventDefault)for(var c in a)this.unbind(c,a[c]);else for(var d=0,e=this.length;d<e;d++)f.event.remove(this[d],a,b);return this},delegate:function(a,b,c,d){return this.live(b,c,d,a)},undelegate:function(a,b,c){return arguments.length===0?this.unbind("live"):this.die(b,null,c,a)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f.data(this,"lastToggle"+a.guid)||0)%d;f.data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var L={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};f.each(["live","die"],function(a,c){f.fn[c]=function(a,d,e,g){var h,i=0,j,k,l,m=g||this.selector,n=g?this:f(this.context);if(typeof a=="object"&&!a.preventDefault){for(var o in a)n[c](o,d,a[o],m);return this}if(c==="die"&&!a&&g&&g.charAt(0)==="."){n.unbind(g);return this}if(d===!1||f.isFunction(d))e=d||D,d=b;a=(a||"").split(" ");while((h=a[i++])!=null){j=x.exec(h),k="",j&&(k=j[0],h=h.replace(x,""));if(h==="hover"){a.push("mouseenter"+k,"mouseleave"+k);continue}l=h,L[h]?(a.push(L[h]+k),h=h+k):h=(L[h]||h)+k;if(c==="live")for(var p=0,q=n.length;p<q;p++)f.event.add(n[p],"live."+N(h,m),{data:d,selector:m,handler:e,origType:h,origHandler:e,preType:l});else n.unbind("live."+N(h,m),e)}return this}}),f.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.bind(b,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}if(i.nodeType===1){f||(i.sizcache=c,i.sizset=g);if(typeof b!="string"){if(i===b){j=!0;break}}else if(k.filter(b,[i]).length>0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}i.nodeType===1&&!f&&(i.sizcache=c,i.sizset=g);if(i.nodeName.toLowerCase()===b){j=i;break}i=i[a]}d[g]=j}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d=0,e=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,f,g){f=f||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return f;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(e.call(n)==="[object Array]")if(!u)f.push.apply(f,n);else if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&f.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&f.push(j[t]);else p(n,f);o&&(k(o,h,f,g),k.uniqueSort(f));return f};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},k.matches=function(a,b){return k(a,null,null,b)},k.matchesSelector=function(a,b){return k(b,null,null,[a]).length>0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e<f;e++){var g,h=l.order[e];if(g=l.leftMatch[h].exec(a)){var j=g[1];g.splice(1,1);if(j.substr(j.length-1)!=="\\"){g[1]=(g[1]||"").replace(i,""),d=l.find[h](g,b,c);if(d!=null){a=a.replace(l.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},k.filter=function(a,c,d,e){var f,g,h=a,i=[],j=c,m=c&&c[0]&&k.isXML(c[0]);while(a&&c.length){for(var n in l.filter)if((f=l.leftMatch[n].exec(a))!=null&&f[2]){var o,p,q=l.filter[n],r=f[1];g=!1,f.splice(1,1);if(r.substr(r.length-1)==="\\")continue;j===i&&(i=[]);if(l.preFilter[n]){f=l.preFilter[n](f,j,d,i,e,m);if(!f)g=o=!0;else if(f===!0)continue}if(f)for(var s=0;(p=j[s])!=null;s++)if(p){o=q(p,f,s,j);var t=e^!!o;d&&o!=null?t?g=!0:j[s]=!1:t&&(i.push(p),g=!0)}if(o!==b){d||(j=i),a=a.replace(l.match[n],"");if(!g)return[];break}}if(a===h)if(g==null)k.error(a);else break;h=a}return j},k.error=function(a){throw"Syntax error, unrecognized expression: "+a};var l=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!j.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&k.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&k.filter(b,a,!0)}},"":function(a,b,c){var e,f=d++,g=u;typeof b=="string"&&!j.test(b)&&(b=b.toLowerCase(),e=b,g=t),g("parentNode",b,f,a,e,c)},"~":function(a,b,c){var e,f=d++,g=u;typeof b=="string"&&!j.test(b)&&(b=b.toLowerCase(),e=b,g=t),g("previousSibling",b,f,a,e,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(i,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=d++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}k.error(e)},CHILD:function(a,b){var c=b[1],d=a;switch(c){case"only":case"first":while(d=d.previousSibling)if(d.nodeType===1)return!1;if(c==="first")return!0;d=a;case"last":while(d=d.nextSibling)if(d.nodeType===1)return!1;return!0;case"nth":var e=b[2],f=b[3];if(e===1&&f===0)return!0;var g=b[0],h=a.parentNode;if(h&&(h.sizcache!==g||!a.nodeIndex)){var i=0;for(d=h.firstChild;d;d=d.nextSibling)d.nodeType===1&&(d.nodeIndex=++i);h.sizcache=g}var j=a.nodeIndex-f;return e===0?j===0:j%e===0&&j/e>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(e.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var f=a.length;c<f;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var r,s;c.documentElement.compareDocumentPosition?r=function(a,b){if(a===b){g=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(r=function(a,b){if(a===b){g=!0;return 0}if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],h=a.parentNode,i=b.parentNode,j=h;if(h===i)return s(a,b);if(!h)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return s(e[k],f[k]);return k===c?s(a,f[k],-1):s(e[k],b,1)},s=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),k.getText=function(a){var b="",c;for(var d=0;a[d];d++)c=a[d],c.nodeType===3||c.nodeType===4?b+=c.nodeValue:c.nodeType!==8&&(b+=k.getText(c.childNodes));return b},function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(e||!l.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return k(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g<h;g++)k(a,f[g],d);return k.filter(e,d)};f.find=k,f.expr=k.selectors,f.expr[":"]=f.expr.filters,f.unique=k.uniqueSort,f.text=k.getText,f.isXMLDoc=k.isXML,f.contains=k.contains}();var O=/Until$/,P=/^(?:parents|prevUntil|prevAll)/,Q=/,/,R=/^.[^:#\[\.,]*$/,S=Array.prototype.slice,T=f.expr.match.POS,U={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack("","find",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(W(this,a,!1),"not",a)},filter:function(a){return this.pushStack(W(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(d=0,e=a.length;d<e;d++)i=a[d],j[i]||(j[i]=T.test(i)?f(i,b||this.context):i);while(g&&g.ownerDocument&&g!==b){for(i in j)h=j[i],(h.jquery?h.index(g)>-1:f(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=T.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(l?l.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a||typeof a=="string")return f.inArray(this[0],a?f(a):this.parent().children());return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(V(c[0])||V(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c),g=S.call(arguments);O.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!U[a]?f.unique(e):e,(this.length>1||Q.test(d))&&P.test(a)&&(e=e.reverse());return this.pushStack(e,a,g.join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var X=/ jQuery\d+="(?:\d+|null)"/g,Y=/^\s+/,Z=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,$=/<([\w:]+)/,_=/<tbody/i,ba=/<|&#?\w+;/,bb=/<(?:script|object|embed|option|style)/i,bc=/checked\s*(?:[^=]|=\s*.checked.)/i,bd=/\/(java|ecma)script/i,be=/^\s*<!(?:\[CDATA\[|\-\-)/,bf={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};bf.optgroup=bf.option,bf.tbody=bf.tfoot=bf.colgroup=bf.caption=bf.thead,bf.th=bf.td,f.support.htmlSerialize||(bf._default=[1,"div<div>","</div>"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){f(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(X,""):null;if(typeof a=="string"&&!bb.test(a)&&(f.support.leadingWhitespace||!Y.test(a))&&!bf[($.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Z,"<$1></$2>");try{for(var c=0,d=this.length;c<d;c++)this[c].nodeType===1&&(f.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(e){this.empty().append(a)}}else f.isFunction(a)?this.each(function(b){var c=f(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bc.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(function(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bg(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,bm)}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i;b&&b[0]&&(i=b[0].ownerDocument||b[0]),i.createDocumentFragment||(i=c),a.length===1&&typeof a[0]=="string"&&a[0].length<512&&i===c&&a[0].charAt(0)==="<"&&!bb.test(a[0])&&(f.support.checkClone||!bc.test(a[0]))&&(g=!0,h=f.fragments[a[0]],h&&h!==1&&(e=h)),e||(e=i.createDocumentFragment(),f.clean(a,i,e,d)),g&&(f.fragments[a[0]]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j
+)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d=a.cloneNode(!0),e,g,h;if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bi(a,d),e=bj(a),g=bj(d);for(h=0;e[h];++h)bi(e[h],g[h])}if(b){bh(a,d);if(c){e=bj(a),g=bj(d);for(h=0;e[h];++h)bh(e[h],g[h])}}e=g=null;return d},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!ba.test(k))k=b.createTextNode(k);else{k=k.replace(Z,"<$1></$2>");var l=($.exec(k)||["",""])[1].toLowerCase(),m=bf[l]||bf._default,n=m[0],o=b.createElement("div");o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=_.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]==="<table>"&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&Y.test(k)&&o.insertBefore(b.createTextNode(Y.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i<r;i++)bl(k[i]);else bl(k);k.nodeType?h.push(k):h=f.merge(h,k)}if(d){g=function(a){return!a.type||bd.test(a.type)};for(j=0;h[j];j++)if(e&&f.nodeName(h[j],"script")&&(!h[j].type||h[j].type.toLowerCase()==="text/javascript"))e.push(h[j].parentNode?h[j].parentNode.removeChild(h[j]):h[j]);else{if(h[j].nodeType===1){var s=f.grep(h[j].getElementsByTagName("script"),g);h.splice.apply(h,[j+1,0].concat(s))}d.appendChild(h[j])}}return h},cleanData:function(a){var b,c,d=f.cache,e=f.expando,g=f.event.special,h=f.support.deleteExpando;for(var i=0,j;(j=a[i])!=null;i++){if(j.nodeName&&f.noData[j.nodeName.toLowerCase()])continue;c=j[f.expando];if(c){b=d[c]&&d[c][e];if(b&&b.events){for(var k in b.events)g[k]?f.event.remove(j,k):f.removeEvent(j,k,b.handle);b.handle&&(b.handle.elem=null)}h?delete j[f.expando]:j.removeAttribute&&j.removeAttribute(f.expando),delete d[c]}}}});var bn=/alpha\([^)]*\)/i,bo=/opacity=([^)]*)/,bp=/([A-Z]|^ms)/g,bq=/^-?\d+(?:px)?$/i,br=/^-?\d/,bs=/^[+\-]=/,bt=/[^+\-\.\de]+/g,bu={position:"absolute",visibility:"hidden",display:"block"},bv=["Left","Right"],bw=["Top","Bottom"],bx,by,bz;f.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return f.access(this,a,c,!0,function(a,c,d){return d!==b?f.style(a,c,d):f.css(a,c)})},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bx(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d;if(h==="number"&&isNaN(d)||d==null)return;h==="string"&&bs.test(d)&&(d=+d.replace(bt,"")+parseFloat(f.css(a,c)),h="number"),h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(bx)return bx(a,c)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]}}),f.curCSS=f.css,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){var e;if(c){if(a.offsetWidth!==0)return bA(a,b,d);f.swap(a,bu,function(){e=bA(a,b,d)});return e}},set:function(a,b){if(!bq.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bo.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle;c.zoom=1;var e=f.isNaN(b)?"":"alpha(opacity="+b*100+")",g=d&&d.filter||c.filter||"";c.filter=bn.test(g)?g.replace(bn,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bx(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(by=function(a,c){var d,e,g;c=c.replace(bp,"-$1").toLowerCase();if(!(e=a.ownerDocument.defaultView))return b;if(g=e.getComputedStyle(a,null))d=g.getPropertyValue(c),d===""&&!f.contains(a.ownerDocument.documentElement,a)&&(d=f.style(a,c));return d}),c.documentElement.currentStyle&&(bz=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bq.test(d)&&br.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bx=by||bz,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bB=/%20/g,bC=/\[\]$/,bD=/\r?\n/g,bE=/#.*$/,bF=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bG=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bH=/^(?:about|app|app\-storage|.+\-extension|file|widget):$/,bI=/^(?:GET|HEAD)$/,bJ=/^\/\//,bK=/\?/,bL=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bM=/^(?:select|textarea)/i,bN=/\s+/,bO=/([?&])_=[^&]*/,bP=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bQ=f.fn.load,bR={},bS={},bT,bU;try{bT=e.href}catch(bV){bT=c.createElement("a"),bT.href="",bT=bT.href}bU=bP.exec(bT.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bQ)return bQ.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("<div>").append(c.replace(bL,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bM.test(this.nodeName)||bG.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bD,"\r\n")}}):{name:b.name,value:c.replace(bD,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.bind(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?f.extend(!0,a,f.ajaxSettings,b):(b=a,a=f.extend(!0,f.ajaxSettings,b));for(var c in{context:1,url:1})c in b?a[c]=b[c]:c in f.ajaxSettings&&(a[c]=f.ajaxSettings[c]);return a},ajaxSettings:{url:bT,isLocal:bH.test(bU[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML}},ajaxPrefilter:bW(bR),ajaxTransport:bW(bS),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a?4:0;var o,r,u,w=l?bZ(d,v,l):b,x,y;if(a>=200&&a<300||a===304){if(d.ifModified){if(x=v.getResponseHeader("Last-Modified"))f.lastModified[k]=x;if(y=v.getResponseHeader("Etag"))f.etag[k]=y}if(a===304)c="notmodified",o=!0;else try{r=b$(d,w),c="success",o=!0}catch(z){c="parsererror",u=z}}else{u=c;if(!c||a)c="error",a<0&&(a=0)}v.status=a,v.statusText=c,o?h.resolveWith(e,[r,c,v]):h.rejectWith(e,[v,c,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.resolveWith(e,[v,c]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f._Deferred(),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bF.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.done,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bE,"").replace(bJ,bU[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bN),d.crossDomain==null&&(r=bP.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bU[1]&&r[2]==bU[2]&&(r[3]||(r[1]==="http:"?80:443))==(bU[3]||(bU[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),bX(bR,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bI.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bK.test(d.url)?"&":"?")+d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bO,"$1_="+x);d.url=y+(y===d.url?(bK.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", */*; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=bX(bS,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){status<2?w(-1,z):f.error(z)}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)bY(g,a[g],c,e);return d.join("&").replace(bB,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var b_=f.now(),ca=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+b_++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ca.test(b.url)||e&&ca.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ca,l),b.url===j&&(e&&(k=k.replace(ca,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cb=a.ActiveXObject?function(){for(var a in cd)cd[a](0,1)}:!1,cc=0,cd;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ce()||cf()}:ce,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cb&&delete cd[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cc,cb&&(cd||(cd={},f(a).unload(cb)),cd[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cg={},ch,ci,cj=/^(?:toggle|show|hide)$/,ck=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cl,cm=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cn,co=a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||a.oRequestAnimationFrame;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cr("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)d=this[g],d.style&&(e=d.style.display,!f._data(d,"olddisplay")&&e==="none"&&(e=d.style.display=""),e===""&&f.css(d,"display")==="none"&&f._data(d,"olddisplay",cs(d.nodeName)));for(g=0;g<h;g++){d=this[g];if(d.style){e=d.style.display;if(e===""||e==="none")d.style.display=f._data(d,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(cr("hide",3),a,b,c);for(var d=0,e=this.length;d<e;d++)if(this[d].style){var g=f.css(this[d],"display");g!=="none"&&!f._data(this[d],"olddisplay")&&f._data(this[d],"olddisplay",g)}for(d=0;d<e;d++)this[d].style&&(this[d].style.display="none");return this},_toggle:f.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";f.isFunction(a)&&f.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:f(this).is(":hidden");f(this)[b?"show":"hide"]()}):this.animate(cr("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=f.speed(b,c,d);if(f.isEmptyObject(a))return this.each(e.complete,[!1]);a=f.extend({},a);return this[e.queue===!1?"each":"queue"](function(){e.queue===!1&&f._mark(this);var b=f.extend({},e),c=this.nodeType===1,d=c&&f(this).is(":hidden"),g,h,i,j,k,l,m,n,o;b.animatedProperties={};for(i in a){g=f.camelCase(i),i!==g&&(a[g]=a[i],delete a[i]),h=a[g],f.isArray(h)?(b.animatedProperties[g]=h[1],h=a[g]=h[0]):b.animatedProperties[g]=b.specialEasing&&b.specialEasing[g]||b.easing||"swing";if(h==="hide"&&d||h==="show"&&!d)return b.complete.call(this);c&&(g==="height"||g==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],f.css(this,"display")==="inline"&&f.css(this,"float")==="none"&&(f.support.inlineBlockNeedsLayout?(j=cs(this.nodeName),j==="inline"?this.style.display="inline-block":(this.style.display="inline",this.style.zoom=1)):this.style.display="inline-block"))}b.overflow!=null&&(this.style.overflow="hidden");for(i in a)k=new f.fx(this,b,i),h=a[i],cj.test(h)?k[h==="toggle"?d?"show":"hide":h]():(l=ck.exec(h),m=k.cur(),l?(n=parseFloat(l[2]),o=l[3]||(f.cssNumber[i]?"":"px"),o!=="px"&&(f.style(this,i,(n||1)+o),m=(n||1)/k.cur()*m,f.style(this,i,m+o)),l[1]&&(n=(l[1]==="-="?-1:1)*n+m),k.custom(m,n,o)):k.custom(m,h,""));return!0})},stop:function(a,b){a&&this.queue([]),this.each(function(){var a=f.timers,c=a.length;b||f._unmark(!0,this);while(c--)a[c].elem===this&&(b&&a[c](!0),a.splice(c,1))}),b||this.dequeue();return this}}),f.each({slideDown:cr("show",1),slideUp:cr("hide",1),slideToggle:cr("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){f.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),f.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?f.extend({},a):{complete:c||!c&&b||f.isFunction(a)&&a,duration:a,easing:c&&b||b&&!f.isFunction(b)&&b};d.duration=f.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in f.fx.speeds?f.fx.speeds[d.duration]:f.fx.speeds._default,d.old=d.complete,d.complete=function(a){f.isFunction(d.old)&&d.old.call(this),d.queue!==!1?f.dequeue(this):a!==!1&&f._unmark(this)};return d},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),f.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(f.fx.step[this.prop]||f.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=f.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,b,c){function h(a){return d.step(a)}var d=this,e=f.fx,g;this.startTime=cn||cp(),this.start=a,this.end=b,this.unit=c||this.unit||(f.cssNumber[this.prop]?"":"px"),this.now=this.start,this.pos=this.state=0,h.elem=this.elem,h()&&f.timers.push(h)&&!cl&&(co?(cl=!0,g=function(){cl&&(co(g),e.tick())},co(g)):cl=setInterval(e.tick,e.interval))},show:function(){this.options.orig[this.prop]=f.style(this.elem,this.prop),this.options.show=!0,this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),f(this.elem).show()},hide:function(){this.options.orig[this.prop]=f.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b=cn||cp(),c=!0,d=this.elem,e=this.options,g,h;if(a||b>=e.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),e.animatedProperties[this.prop]=!0;for(g in e.animatedProperties)e.animatedProperties[g]!==!0&&(c=!1);if(c){e.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){d.style["overflow"+b]=e.overflow[a]}),e.hide&&f(d).hide();if(e.hide||e.show)for(var i in e.animatedProperties)f.style(d,i,e.orig[i]);e.complete.call(d)}return!1}e.duration==Infinity?this.now=b:(h=b-this.startTime,this.state=h/e.duration,this.pos=f.easing[e.animatedProperties[this.prop]](this.state,h,0,1,e.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){for(var a=f.timers,b=0;b<a.length;++b)a[b]()||a.splice(b--,1);a.length||f.fx.stop()},interval:13,stop:function(){clearInterval(cl),cl=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){f.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit:a.elem[a.prop]=a.now}}}),f.expr&&f.expr.filters&&(f.expr.filters.animated=function(a){return f.grep(f.timers,function(b){return a===b.elem}).length});var ct=/^t(?:able|d|h)$/i,cu=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?f.fn.offset=function(a){var b=this[0],c;if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(d){}var e=b.ownerDocument,g=e.documentElement;if(!c||!f.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};var h=e.body,i=cv(e),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||f.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||f.support.boxModel&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:f.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);f.offset.initialize();var c,d=b.offsetParent,e=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(f.offset.supportsFixedPosition&&k.position==="fixed")break;c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===d&&(l+=b.offsetTop,m+=b.offsetLeft,f.offset.doesNotAddBorder&&(!f.offset.doesAddBorderForTableAndCells||!ct.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),e=d,d=b.offsetParent),f.offset.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),k=c}if(k.position==="relative"||k.position==="static")l+=i.offsetTop,m+=i.offsetLeft;f.offset.supportsFixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},f.offset={initialize:function(){var a=c.body,b=c.createElement("div"),d,e,g,h,i=parseFloat(f.css(a,"marginTop"))||0,j="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";f.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),d=b.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,this.doesNotAddBorder=e.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,e.style.position="fixed",e.style.top="20px",this.supportsFixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",this.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),f.offset.initialize=f.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.offset.initialize(),f.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cu.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cu.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cv(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cv(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a&&a.style?parseFloat(f.css(a,d,"padding")):null},f.fn["outer"+c]=function(a){var b=this[0];return b&&b.style?parseFloat(f.css(b,d,a?"margin":"border")):null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c];return e.document.compatMode==="CSS1Compat"&&g||e.document.body["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var h=f.css(e,d),i=parseFloat(h);return f.isNaN(i)?h:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f})(window);
Index: trunk/prototype/plugins/encoder/encoder.js
===================================================================
--- trunk/prototype/plugins/encoder/encoder.js	(revision 5341)
+++ trunk/prototype/plugins/encoder/encoder.js	(revision 5341)
@@ -0,0 +1,236 @@
+/**
+ * A Javascript object to encode and/or decode html characters using HTML or Numeric entities that handles double or partial encoding
+ * Author: R Reid
+ * source: http://www.strictly-software.com/htmlencode
+ * Licences: GPL, The MIT License (MIT)
+ * Copyright: (c) 2011 Robert Reid - Strictly-Software.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.
+ * 
+ * Revision:
+ *  2011-07-14, Jacques-Yves Bleau: 
+ *       - fixed conversion error with capitalized accentuated characters
+ *       + converted arr1 and arr2 to object property to remove redundancy
+ *
+ * Revision:
+ *  2011-11-10, Ce-Yi Hio: 
+ *       - fixed conversion error with a number of capitalized entity characters
+ *
+ * Revision:
+ *  2011-11-10, Rob Reid: 
+ *		 - changed array format
+ */
+
+Encoder = {
+
+	// When encoding do we convert characters into html or numerical entities
+	EncodeType : "entity",  // entity OR numerical
+
+	isEmpty : function(val){
+		if(val){
+			return ((val===null) || val.length==0 || /^\s+$/.test(val));
+		}else{
+			return true;
+		}
+	},
+	
+	// arrays for conversion from HTML Entities to Numerical values
+	arr1: ['&nbsp;','&iexcl;','&cent;','&pound;','&curren;','&yen;','&brvbar;','&sect;','&uml;','&copy;','&ordf;','&laquo;','&not;','&shy;','&reg;','&macr;','&deg;','&plusmn;','&sup2;','&sup3;','&acute;','&micro;','&para;','&middot;','&cedil;','&sup1;','&ordm;','&raquo;','&frac14;','&frac12;','&frac34;','&iquest;','&Agrave;','&Aacute;','&Acirc;','&Atilde;','&Auml;','&Aring;','&AElig;','&Ccedil;','&Egrave;','&Eacute;','&Ecirc;','&Euml;','&Igrave;','&Iacute;','&Icirc;','&Iuml;','&ETH;','&Ntilde;','&Ograve;','&Oacute;','&Ocirc;','&Otilde;','&Ouml;','&times;','&Oslash;','&Ugrave;','&Uacute;','&Ucirc;','&Uuml;','&Yacute;','&THORN;','&szlig;','&agrave;','&aacute;','&acirc;','&atilde;','&auml;','&aring;','&aelig;','&ccedil;','&egrave;','&eacute;','&ecirc;','&euml;','&igrave;','&iacute;','&icirc;','&iuml;','&eth;','&ntilde;','&ograve;','&oacute;','&ocirc;','&otilde;','&ouml;','&divide;','&oslash;','&ugrave;','&uacute;','&ucirc;','&uuml;','&yacute;','&thorn;','&yuml;','&quot;','&amp;','&lt;','&gt;','&OElig;','&oelig;','&Scaron;','&scaron;','&Yuml;','&circ;','&tilde;','&ensp;','&emsp;','&thinsp;','&zwnj;','&zwj;','&lrm;','&rlm;','&ndash;','&mdash;','&lsquo;','&rsquo;','&sbquo;','&ldquo;','&rdquo;','&bdquo;','&dagger;','&Dagger;','&permil;','&lsaquo;','&rsaquo;','&euro;','&fnof;','&Alpha;','&Beta;','&Gamma;','&Delta;','&Epsilon;','&Zeta;','&Eta;','&Theta;','&Iota;','&Kappa;','&Lambda;','&Mu;','&Nu;','&Xi;','&Omicron;','&Pi;','&Rho;','&Sigma;','&Tau;','&Upsilon;','&Phi;','&Chi;','&Psi;','&Omega;','&alpha;','&beta;','&gamma;','&delta;','&epsilon;','&zeta;','&eta;','&theta;','&iota;','&kappa;','&lambda;','&mu;','&nu;','&xi;','&omicron;','&pi;','&rho;','&sigmaf;','&sigma;','&tau;','&upsilon;','&phi;','&chi;','&psi;','&omega;','&thetasym;','&upsih;','&piv;','&bull;','&hellip;','&prime;','&Prime;','&oline;','&frasl;','&weierp;','&image;','&real;','&trade;','&alefsym;','&larr;','&uarr;','&rarr;','&darr;','&harr;','&crarr;','&lArr;','&uArr;','&rArr;','&dArr;','&hArr;','&forall;','&part;','&exist;','&empty;','&nabla;','&isin;','&notin;','&ni;','&prod;','&sum;','&minus;','&lowast;','&radic;','&prop;','&infin;','&ang;','&and;','&or;','&cap;','&cup;','&int;','&there4;','&sim;','&cong;','&asymp;','&ne;','&equiv;','&le;','&ge;','&sub;','&sup;','&nsub;','&sube;','&supe;','&oplus;','&otimes;','&perp;','&sdot;','&lceil;','&rceil;','&lfloor;','&rfloor;','&lang;','&rang;','&loz;','&spades;','&clubs;','&hearts;','&diams;'],
+	arr2: ['&#160;','&#161;','&#162;','&#163;','&#164;','&#165;','&#166;','&#167;','&#168;','&#169;','&#170;','&#171;','&#172;','&#173;','&#174;','&#175;','&#176;','&#177;','&#178;','&#179;','&#180;','&#181;','&#182;','&#183;','&#184;','&#185;','&#186;','&#187;','&#188;','&#189;','&#190;','&#191;','&#192;','&#193;','&#194;','&#195;','&#196;','&#197;','&#198;','&#199;','&#200;','&#201;','&#202;','&#203;','&#204;','&#205;','&#206;','&#207;','&#208;','&#209;','&#210;','&#211;','&#212;','&#213;','&#214;','&#215;','&#216;','&#217;','&#218;','&#219;','&#220;','&#221;','&#222;','&#223;','&#224;','&#225;','&#226;','&#227;','&#228;','&#229;','&#230;','&#231;','&#232;','&#233;','&#234;','&#235;','&#236;','&#237;','&#238;','&#239;','&#240;','&#241;','&#242;','&#243;','&#244;','&#245;','&#246;','&#247;','&#248;','&#249;','&#250;','&#251;','&#252;','&#253;','&#254;','&#255;','&#34;','&#38;','&#60;','&#62;','&#338;','&#339;','&#352;','&#353;','&#376;','&#710;','&#732;','&#8194;','&#8195;','&#8201;','&#8204;','&#8205;','&#8206;','&#8207;','&#8211;','&#8212;','&#8216;','&#8217;','&#8218;','&#8220;','&#8221;','&#8222;','&#8224;','&#8225;','&#8240;','&#8249;','&#8250;','&#8364;','&#402;','&#913;','&#914;','&#915;','&#916;','&#917;','&#918;','&#919;','&#920;','&#921;','&#922;','&#923;','&#924;','&#925;','&#926;','&#927;','&#928;','&#929;','&#931;','&#932;','&#933;','&#934;','&#935;','&#936;','&#937;','&#945;','&#946;','&#947;','&#948;','&#949;','&#950;','&#951;','&#952;','&#953;','&#954;','&#955;','&#956;','&#957;','&#958;','&#959;','&#960;','&#961;','&#962;','&#963;','&#964;','&#965;','&#966;','&#967;','&#968;','&#969;','&#977;','&#978;','&#982;','&#8226;','&#8230;','&#8242;','&#8243;','&#8254;','&#8260;','&#8472;','&#8465;','&#8476;','&#8482;','&#8501;','&#8592;','&#8593;','&#8594;','&#8595;','&#8596;','&#8629;','&#8656;','&#8657;','&#8658;','&#8659;','&#8660;','&#8704;','&#8706;','&#8707;','&#8709;','&#8711;','&#8712;','&#8713;','&#8715;','&#8719;','&#8721;','&#8722;','&#8727;','&#8730;','&#8733;','&#8734;','&#8736;','&#8743;','&#8744;','&#8745;','&#8746;','&#8747;','&#8756;','&#8764;','&#8773;','&#8776;','&#8800;','&#8801;','&#8804;','&#8805;','&#8834;','&#8835;','&#8836;','&#8838;','&#8839;','&#8853;','&#8855;','&#8869;','&#8901;','&#8968;','&#8969;','&#8970;','&#8971;','&#9001;','&#9002;','&#9674;','&#9824;','&#9827;','&#9829;','&#9830;'],
+		
+	// Convert HTML entities into numerical entities
+	HTML2Numerical : function(s){
+		return this.swapArrayVals(s,this.arr1,this.arr2);
+	},	
+
+	// Convert Numerical entities into HTML entities
+	NumericalToHTML : function(s){
+		return this.swapArrayVals(s,this.arr2,this.arr1);
+	},
+
+
+	// Numerically encodes all unicode characters
+	numEncode : function(s){
+		
+		if(this.isEmpty(s)) return "";
+
+		var e = "";
+		for (var i = 0; i < s.length; i++)
+		{
+			var c = s.charAt(i);
+			if (c < " " || c > "~")
+			{
+				c = "&#" + c.charCodeAt() + ";";
+			}
+			e += c;
+		}
+		return e;
+	},
+	
+	// HTML Decode numerical and HTML entities back to original values
+	htmlDecode : function(s){
+
+		var c,m,d = s;
+		
+		if(this.isEmpty(d)) return "";
+
+		// convert HTML entites back to numerical entites first
+		d = this.HTML2Numerical(d);
+		
+		// look for numerical entities &#34;
+		arr=d.match(/&#[0-9]{1,5};/g);
+		
+		// if no matches found in string then skip
+		if(arr!=null){
+			for(var x=0;x<arr.length;x++){
+				m = arr[x];
+				c = m.substring(2,m.length-1); //get numeric part which is refernce to unicode character
+				// if its a valid number we can decode
+				if(c >= -32768 && c <= 65535){
+					// decode every single match within string
+					d = d.replace(m, String.fromCharCode(c));
+				}else{
+					d = d.replace(m, ""); //invalid so replace with nada
+				}
+			}			
+		}
+
+		return d;
+	},		
+
+	// encode an input string into either numerical or HTML entities
+	htmlEncode : function(s,dbl){
+			
+		if(this.isEmpty(s)) return "";
+
+		// do we allow double encoding? E.g will &amp; be turned into &amp;amp;
+		dbl = dbl || false; //default to prevent double encoding
+		
+		// if allowing double encoding we do ampersands first
+		if(dbl){
+			if(this.EncodeType=="numerical"){
+				s = s.replace(/&/g, "&#38;");
+			}else{
+				s = s.replace(/&/g, "&amp;");
+			}
+		}
+
+		// convert the xss chars to numerical entities ' " < >
+		s = this.XSSEncode(s,false);
+		
+		if(this.EncodeType=="numerical" || !dbl){
+			// Now call function that will convert any HTML entities to numerical codes
+			s = this.HTML2Numerical(s);
+		}
+
+		// Now encode all chars above 127 e.g unicode
+		s = this.numEncode(s);
+
+		// now we know anything that needs to be encoded has been converted to numerical entities we
+		// can encode any ampersands & that are not part of encoded entities
+		// to handle the fact that I need to do a negative check and handle multiple ampersands &&&
+		// I am going to use a placeholder
+
+		// if we don't want double encoded entities we ignore the & in existing entities
+		if(!dbl){
+			s = s.replace(/&#/g,"##AMPHASH##");
+		
+			if(this.EncodeType=="numerical"){
+				s = s.replace(/&/g, "&#38;");
+			}else{
+				s = s.replace(/&/g, "&amp;");
+			}
+
+			s = s.replace(/##AMPHASH##/g,"&#");
+		}
+		
+		// replace any malformed entities
+		s = s.replace(/&#\d*([^\d;]|$)/g, "$1");
+
+		if(!dbl){
+			// safety check to correct any double encoded &amp;
+			s = this.correctEncoding(s);
+		}
+
+		// now do we need to convert our numerical encoded string into entities
+		if(this.EncodeType=="entity"){
+			s = this.NumericalToHTML(s);
+		}
+
+		return s;					
+	},
+
+	// Encodes the basic 4 characters used to malform HTML in XSS hacks
+	XSSEncode : function(s,en){
+		if(!this.isEmpty(s)){
+			en = en || true;
+			// do we convert to numerical or html entity?
+			if(en){
+				s = s.replace(/\'/g,"&#39;"); //no HTML equivalent as &apos is not cross browser supported
+				s = s.replace(/\"/g,"&quot;");
+				s = s.replace(/</g,"&lt;");
+				s = s.replace(/>/g,"&gt;");
+			}else{
+				s = s.replace(/\'/g,"&#39;"); //no HTML equivalent as &apos is not cross browser supported
+				s = s.replace(/\"/g,"&#34;");
+				s = s.replace(/</g,"&#60;");
+				s = s.replace(/>/g,"&#62;");
+			}
+			return s;
+		}else{
+			return "";
+		}
+	},
+
+	// returns true if a string contains html or numerical encoded entities
+	hasEncoded : function(s){
+		if(/&#[0-9]{1,5};/g.test(s)){
+			return true;
+		}else if(/&[A-Z]{2,6};/gi.test(s)){
+			return true;
+		}else{
+			return false;
+		}
+	},
+
+	// will remove any unicode characters
+	stripUnicode : function(s){
+		return s.replace(/[^\x20-\x7E]/g,"");
+		
+	},
+
+	// corrects any double encoded &amp; entities e.g &amp;amp;
+	correctEncoding : function(s){
+		return s.replace(/(&amp;)(amp;)+/,"$1");
+	},
+
+
+	// Function to loop through an array swaping each item with the value from another array e.g swap HTML entities with Numericals
+	swapArrayVals : function(s,arr1,arr2){
+		if(this.isEmpty(s)) return "";
+		var re;
+		if(arr1 && arr2){
+			//ShowDebug("in swapArrayVals arr1.length = " + arr1.length + " arr2.length = " + arr2.length)
+			// array lengths must match
+			if(arr1.length == arr2.length){
+				for(var x=0,i=arr1.length;x<i;x++){
+					re = new RegExp(arr1[x], 'g');
+					s = s.replace(re,arr2[x]); //swap arr1 item with matching item from arr2	
+				}
+			}
+		}
+		return s;
+	},
+
+	inArray : function( item, arr ) {
+		for ( var i = 0, x = arr.length; i < x; i++ ){
+			if ( arr[i] === item ){
+				return i;
+			}
+		}
+		return -1;
+	}
+
+}
Index: trunk/prototype/plugins/countdown/jquery.countdown.css
===================================================================
--- trunk/prototype/plugins/countdown/jquery.countdown.css	(revision 5136)
+++ trunk/prototype/plugins/countdown/jquery.countdown.css	(revision 5136)
@@ -0,0 +1,51 @@
+/* jQuery Countdown styles 1.5.9. */
+.hasCountdown {
+	border: 1px solid #ccc;
+	background-color: #eee;
+}
+.countdown_rtl {
+	direction: rtl;
+}
+.countdown_holding span {
+	background-color: #ccc;
+}
+.countdown_row {
+	clear: both;
+	width: 100%;
+	padding: 0px 2px;
+	text-align: center;
+}
+.countdown_show1 .countdown_section {
+	width: 98%;
+}
+.countdown_show2 .countdown_section {
+	width: 48%;
+}
+.countdown_show3 .countdown_section {
+	width: 32.5%;
+}
+.countdown_show4 .countdown_section {
+	width: 24.5%;
+}
+.countdown_show5 .countdown_section {
+	width: 19.5%;
+}
+.countdown_show6 .countdown_section {
+	width: 16.25%;
+}
+.countdown_show7 .countdown_section {
+	width: 14%;
+}
+.countdown_section {
+	display: block;
+	float: left;
+	font-size: 75%;
+	text-align: center;
+}
+.countdown_amount {
+	font-size: 200%;
+}
+.countdown_descr {
+	display: block;
+	width: 100%;
+}
Index: trunk/prototype/plugins/countdown/jquery.countdown-pt-BR.js
===================================================================
--- trunk/prototype/plugins/countdown/jquery.countdown-pt-BR.js	(revision 5136)
+++ trunk/prototype/plugins/countdown/jquery.countdown-pt-BR.js	(revision 5136)
@@ -0,0 +1,12 @@
+/* http://keith-wood.name/countdown.html
+   Brazilian initialisation for the jQuery countdown extension
+   Translated by Marcelo Pellicano de Oliveira (pellicano@gmail.com) Feb 2008. */
+(function($) {
+	$.countdown.regional['pt-BR'] = {
+		labels: ['anos', 'meses', 'semanas', 'dias', 'horas', 'minutos', 'segundos'],
+		labels1: ['ano', 'mês', 'semana', 'dia', 'hora', 'minuto', 'segundo'],
+		compactLabels: ['a', 'm', 's', 'd'],
+		whichLabels: null,
+		timeSeparator: ':', isRTL: false};
+	$.countdown.setDefaults($.countdown.regional['pt-BR']);
+})(jQuery);
Index: trunk/prototype/plugins/countdown/jquery.countdown.min.js
===================================================================
--- trunk/prototype/plugins/countdown/jquery.countdown.min.js	(revision 5136)
+++ trunk/prototype/plugins/countdown/jquery.countdown.min.js	(revision 5136)
@@ -0,0 +1,7 @@
+/* http://keith-wood.name/countdown.html
+   Countdown for jQuery v1.5.9.
+   Written by Keith Wood (kbwood{at}iinet.com.au) January 2008.
+   Dual licensed under the GPL (http://dev.jquery.com/browser/trunk/jquery/GPL-LICENSE.txt) and 
+   MIT (http://dev.jquery.com/browser/trunk/jquery/MIT-LICENSE.txt) licenses. 
+   Please attribute the author if you use it. */
+(function($){function Countdown(){this.regional=[];this.regional['']={labels:['Years','Months','Weeks','Days','Hours','Minutes','Seconds'],labels1:['Year','Month','Week','Day','Hour','Minute','Second'],compactLabels:['y','m','w','d'],whichLabels:null,timeSeparator:':',isRTL:false};this._defaults={until:null,since:null,timezone:null,serverSync:null,format:'dHMS',layout:'',compact:false,significant:0,description:'',expiryUrl:'',expiryText:'',alwaysExpire:false,onExpiry:null,onTick:null,tickInterval:1};$.extend(this._defaults,this.regional['']);this._serverSyncs=[]}var w='countdown';var Y=0;var O=1;var W=2;var D=3;var H=4;var M=5;var S=6;$.extend(Countdown.prototype,{markerClassName:'hasCountdown',_timer:setInterval(function(){$.countdown._updateTargets()},980),_timerTargets:[],setDefaults:function(a){this._resetExtraLabels(this._defaults,a);extendRemove(this._defaults,a||{})},UTCDate:function(a,b,c,e,f,g,h,i){if(typeof b=='object'&&b.constructor==Date){i=b.getMilliseconds();h=b.getSeconds();g=b.getMinutes();f=b.getHours();e=b.getDate();c=b.getMonth();b=b.getFullYear()}var d=new Date();d.setUTCFullYear(b);d.setUTCDate(1);d.setUTCMonth(c||0);d.setUTCDate(e||1);d.setUTCHours(f||0);d.setUTCMinutes((g||0)-(Math.abs(a)<30?a*60:a));d.setUTCSeconds(h||0);d.setUTCMilliseconds(i||0);return d},periodsToSeconds:function(a){return a[0]*31557600+a[1]*2629800+a[2]*604800+a[3]*86400+a[4]*3600+a[5]*60+a[6]},_settingsCountdown:function(a,b){if(!b){return $.countdown._defaults}var c=$.data(a,w);return(b=='all'?c.options:c.options[b])},_attachCountdown:function(a,b){var c=$(a);if(c.hasClass(this.markerClassName)){return}c.addClass(this.markerClassName);var d={options:$.extend({},b),_periods:[0,0,0,0,0,0,0]};$.data(a,w,d);this._changeCountdown(a)},_addTarget:function(a){if(!this._hasTarget(a)){this._timerTargets.push(a)}},_hasTarget:function(a){return($.inArray(a,this._timerTargets)>-1)},_removeTarget:function(b){this._timerTargets=$.map(this._timerTargets,function(a){return(a==b?null:a)})},_updateTargets:function(){for(var i=this._timerTargets.length-1;i>=0;i--){this._updateCountdown(this._timerTargets[i])}},_updateCountdown:function(a,b){var c=$(a);b=b||$.data(a,w);if(!b){return}c.html(this._generateHTML(b));c[(this._get(b,'isRTL')?'add':'remove')+'Class']('countdown_rtl');var d=this._get(b,'onTick');if(d){var e=b._hold!='lap'?b._periods:this._calculatePeriods(b,b._show,this._get(b,'significant'),new Date());var f=this._get(b,'tickInterval');if(f==1||this.periodsToSeconds(e)%f==0){d.apply(a,[e])}}var g=b._hold!='pause'&&(b._since?b._now.getTime()<b._since.getTime():b._now.getTime()>=b._until.getTime());if(g&&!b._expiring){b._expiring=true;if(this._hasTarget(a)||this._get(b,'alwaysExpire')){this._removeTarget(a);var h=this._get(b,'onExpiry');if(h){h.apply(a,[])}var i=this._get(b,'expiryText');if(i){var j=this._get(b,'layout');b.options.layout=i;this._updateCountdown(a,b);b.options.layout=j}var k=this._get(b,'expiryUrl');if(k){window.location=k}}b._expiring=false}else if(b._hold=='pause'){this._removeTarget(a)}$.data(a,w,b)},_changeCountdown:function(a,b,c){b=b||{};if(typeof b=='string'){var d=b;b={};b[d]=c}var e=$.data(a,w);if(e){this._resetExtraLabels(e.options,b);extendRemove(e.options,b);this._adjustSettings(a,e);$.data(a,w,e);var f=new Date();if((e._since&&e._since<f)||(e._until&&e._until>f)){this._addTarget(a)}this._updateCountdown(a,e)}},_resetExtraLabels:function(a,b){var c=false;for(var n in b){if(n!='whichLabels'&&n.match(/[Ll]abels/)){c=true;break}}if(c){for(var n in a){if(n.match(/[Ll]abels[0-9]/)){a[n]=null}}}},_adjustSettings:function(a,b){var c;var d=this._get(b,'serverSync');var e=0;var f=null;for(var i=0;i<this._serverSyncs.length;i++){if(this._serverSyncs[i][0]==d){f=this._serverSyncs[i][1];break}}if(f!=null){e=(d?f:0);c=new Date()}else{var g=(d?d.apply(a,[]):null);c=new Date();e=(g?c.getTime()-g.getTime():0);this._serverSyncs.push([d,e])}var h=this._get(b,'timezone');h=(h==null?-c.getTimezoneOffset():h);b._since=this._get(b,'since');if(b._since!=null){b._since=this.UTCDate(h,this._determineTime(b._since,null));if(b._since&&e){b._since.setMilliseconds(b._since.getMilliseconds()+e)}}b._until=this.UTCDate(h,this._determineTime(this._get(b,'until'),c));if(e){b._until.setMilliseconds(b._until.getMilliseconds()+e)}b._show=this._determineShow(b)},_destroyCountdown:function(a){var b=$(a);if(!b.hasClass(this.markerClassName)){return}this._removeTarget(a);b.removeClass(this.markerClassName).empty();$.removeData(a,w)},_pauseCountdown:function(a){this._hold(a,'pause')},_lapCountdown:function(a){this._hold(a,'lap')},_resumeCountdown:function(a){this._hold(a,null)},_hold:function(a,b){var c=$.data(a,w);if(c){if(c._hold=='pause'&&!b){c._periods=c._savePeriods;var d=(c._since?'-':'+');c[c._since?'_since':'_until']=this._determineTime(d+c._periods[0]+'y'+d+c._periods[1]+'o'+d+c._periods[2]+'w'+d+c._periods[3]+'d'+d+c._periods[4]+'h'+d+c._periods[5]+'m'+d+c._periods[6]+'s');this._addTarget(a)}c._hold=b;c._savePeriods=(b=='pause'?c._periods:null);$.data(a,w,c);this._updateCountdown(a,c)}},_getTimesCountdown:function(a){var b=$.data(a,w);return(!b?null:(!b._hold?b._periods:this._calculatePeriods(b,b._show,this._get(b,'significant'),new Date())))},_get:function(a,b){return(a.options[b]!=null?a.options[b]:$.countdown._defaults[b])},_determineTime:function(k,l){var m=function(a){var b=new Date();b.setTime(b.getTime()+a*1000);return b};var n=function(a){a=a.toLowerCase();var b=new Date();var c=b.getFullYear();var d=b.getMonth();var e=b.getDate();var f=b.getHours();var g=b.getMinutes();var h=b.getSeconds();var i=/([+-]?[0-9]+)\s*(s|m|h|d|w|o|y)?/g;var j=i.exec(a);while(j){switch(j[2]||'s'){case's':h+=parseInt(j[1],10);break;case'm':g+=parseInt(j[1],10);break;case'h':f+=parseInt(j[1],10);break;case'd':e+=parseInt(j[1],10);break;case'w':e+=parseInt(j[1],10)*7;break;case'o':d+=parseInt(j[1],10);e=Math.min(e,$.countdown._getDaysInMonth(c,d));break;case'y':c+=parseInt(j[1],10);e=Math.min(e,$.countdown._getDaysInMonth(c,d));break}j=i.exec(a)}return new Date(c,d,e,f,g,h,0)};var o=(k==null?l:(typeof k=='string'?n(k):(typeof k=='number'?m(k):k)));if(o)o.setMilliseconds(0);return o},_getDaysInMonth:function(a,b){return 32-new Date(a,b,32).getDate()},_normalLabels:function(a){return a},_generateHTML:function(c){var d=this._get(c,'significant');c._periods=(c._hold?c._periods:this._calculatePeriods(c,c._show,d,new Date()));var e=false;var f=0;var g=d;var h=$.extend({},c._show);for(var i=Y;i<=S;i++){e|=(c._show[i]=='?'&&c._periods[i]>0);h[i]=(c._show[i]=='?'&&!e?null:c._show[i]);f+=(h[i]?1:0);g-=(c._periods[i]>0?1:0)}var j=[false,false,false,false,false,false,false];for(var i=S;i>=Y;i--){if(c._show[i]){if(c._periods[i]){j[i]=true}else{j[i]=g>0;g--}}}var k=this._get(c,'compact');var l=this._get(c,'layout');var m=(k?this._get(c,'compactLabels'):this._get(c,'labels'));var n=this._get(c,'whichLabels')||this._normalLabels;var o=this._get(c,'timeSeparator');var p=this._get(c,'description')||'';var q=function(a){var b=$.countdown._get(c,'compactLabels'+n(c._periods[a]));return(h[a]?c._periods[a]+(b?b[a]:m[a])+' ':'')};var r=function(a){var b=$.countdown._get(c,'labels'+n(c._periods[a]));return((!d&&h[a])||(d&&j[a])?'<span class="countdown_section"><span class="countdown_amount">'+c._periods[a]+'</span><br/>'+(b?b[a]:m[a])+'</span>':'')};return(l?this._buildLayout(c,h,l,k,d,j):((k?'<span class="countdown_row countdown_amount'+(c._hold?' countdown_holding':'')+'">'+q(Y)+q(O)+q(W)+q(D)+(h[H]?this._minDigits(c._periods[H],2):'')+(h[M]?(h[H]?o:'')+this._minDigits(c._periods[M],2):'')+(h[S]?(h[H]||h[M]?o:'')+this._minDigits(c._periods[S],2):''):'<span class="countdown_row countdown_show'+(d||f)+(c._hold?' countdown_holding':'')+'">'+r(Y)+r(O)+r(W)+r(D)+r(H)+r(M)+r(S))+'</span>'+(p?'<span class="countdown_row countdown_descr">'+p+'</span>':'')))},_buildLayout:function(c,d,e,f,g,h){var j=this._get(c,(f?'compactLabels':'labels'));var k=this._get(c,'whichLabels')||this._normalLabels;var l=function(a){return($.countdown._get(c,(f?'compactLabels':'labels')+k(c._periods[a]))||j)[a]};var m=function(a,b){return Math.floor(a/b)%10};var o={desc:this._get(c,'description'),sep:this._get(c,'timeSeparator'),yl:l(Y),yn:c._periods[Y],ynn:this._minDigits(c._periods[Y],2),ynnn:this._minDigits(c._periods[Y],3),y1:m(c._periods[Y],1),y10:m(c._periods[Y],10),y100:m(c._periods[Y],100),y1000:m(c._periods[Y],1000),ol:l(O),on:c._periods[O],onn:this._minDigits(c._periods[O],2),onnn:this._minDigits(c._periods[O],3),o1:m(c._periods[O],1),o10:m(c._periods[O],10),o100:m(c._periods[O],100),o1000:m(c._periods[O],1000),wl:l(W),wn:c._periods[W],wnn:this._minDigits(c._periods[W],2),wnnn:this._minDigits(c._periods[W],3),w1:m(c._periods[W],1),w10:m(c._periods[W],10),w100:m(c._periods[W],100),w1000:m(c._periods[W],1000),dl:l(D),dn:c._periods[D],dnn:this._minDigits(c._periods[D],2),dnnn:this._minDigits(c._periods[D],3),d1:m(c._periods[D],1),d10:m(c._periods[D],10),d100:m(c._periods[D],100),d1000:m(c._periods[D],1000),hl:l(H),hn:c._periods[H],hnn:this._minDigits(c._periods[H],2),hnnn:this._minDigits(c._periods[H],3),h1:m(c._periods[H],1),h10:m(c._periods[H],10),h100:m(c._periods[H],100),h1000:m(c._periods[H],1000),ml:l(M),mn:c._periods[M],mnn:this._minDigits(c._periods[M],2),mnnn:this._minDigits(c._periods[M],3),m1:m(c._periods[M],1),m10:m(c._periods[M],10),m100:m(c._periods[M],100),m1000:m(c._periods[M],1000),sl:l(S),sn:c._periods[S],snn:this._minDigits(c._periods[S],2),snnn:this._minDigits(c._periods[S],3),s1:m(c._periods[S],1),s10:m(c._periods[S],10),s100:m(c._periods[S],100),s1000:m(c._periods[S],1000)};var p=e;for(var i=Y;i<=S;i++){var q='yowdhms'.charAt(i);var r=new RegExp('\\{'+q+'<\\}(.*)\\{'+q+'>\\}','g');p=p.replace(r,((!g&&d[i])||(g&&h[i])?'$1':''))}$.each(o,function(n,v){var a=new RegExp('\\{'+n+'\\}','g');p=p.replace(a,v)});return p},_minDigits:function(a,b){a=''+a;if(a.length>=b){return a}a='0000000000'+a;return a.substr(a.length-b)},_determineShow:function(a){var b=this._get(a,'format');var c=[];c[Y]=(b.match('y')?'?':(b.match('Y')?'!':null));c[O]=(b.match('o')?'?':(b.match('O')?'!':null));c[W]=(b.match('w')?'?':(b.match('W')?'!':null));c[D]=(b.match('d')?'?':(b.match('D')?'!':null));c[H]=(b.match('h')?'?':(b.match('H')?'!':null));c[M]=(b.match('m')?'?':(b.match('M')?'!':null));c[S]=(b.match('s')?'?':(b.match('S')?'!':null));return c},_calculatePeriods:function(c,d,e,f){c._now=f;c._now.setMilliseconds(0);var g=new Date(c._now.getTime());if(c._since){if(f.getTime()<c._since.getTime()){c._now=f=g}else{f=c._since}}else{g.setTime(c._until.getTime());if(f.getTime()>c._until.getTime()){c._now=f=g}}var h=[0,0,0,0,0,0,0];if(d[Y]||d[O]){var i=$.countdown._getDaysInMonth(f.getFullYear(),f.getMonth());var j=$.countdown._getDaysInMonth(g.getFullYear(),g.getMonth());var k=(g.getDate()==f.getDate()||(g.getDate()>=Math.min(i,j)&&f.getDate()>=Math.min(i,j)));var l=function(a){return(a.getHours()*60+a.getMinutes())*60+a.getSeconds()};var m=Math.max(0,(g.getFullYear()-f.getFullYear())*12+g.getMonth()-f.getMonth()+((g.getDate()<f.getDate()&&!k)||(k&&l(g)<l(f))?-1:0));h[Y]=(d[Y]?Math.floor(m/12):0);h[O]=(d[O]?m-h[Y]*12:0);f=new Date(f.getTime());var n=(f.getDate()==i);var o=$.countdown._getDaysInMonth(f.getFullYear()+h[Y],f.getMonth()+h[O]);if(f.getDate()>o){f.setDate(o)}f.setFullYear(f.getFullYear()+h[Y]);f.setMonth(f.getMonth()+h[O]);if(n){f.setDate(o)}}var p=Math.floor((g.getTime()-f.getTime())/1000);var q=function(a,b){h[a]=(d[a]?Math.floor(p/b):0);p-=h[a]*b};q(W,604800);q(D,86400);q(H,3600);q(M,60);q(S,1);if(p>0&&!c._since){var r=[1,12,4.3482,7,24,60,60];var s=S;var t=1;for(var u=S;u>=Y;u--){if(d[u]){if(h[s]>=t){h[s]=0;p=1}if(p>0){h[u]++;p=0;s=u;t=1}}t*=r[u]}}if(e){for(var u=Y;u<=S;u++){if(e&&h[u]){e--}else if(!e){h[u]=0}}}return h}});function extendRemove(a,b){$.extend(a,b);for(var c in b){if(b[c]==null){a[c]=null}}return a}$.fn.countdown=function(a){var b=Array.prototype.slice.call(arguments,1);if(a=='getTimes'||a=='settings'){return $.countdown['_'+a+'Countdown'].apply($.countdown,[this[0]].concat(b))}return this.each(function(){if(typeof a=='string'){$.countdown['_'+a+'Countdown'].apply($.countdown,[this].concat(b))}else{$.countdown._attachCountdown(this,a)}})};$.countdown=new Countdown()})(jQuery);
Index: trunk/prototype/plugins/jqgrid/themes/prognusone/jquery-ui-1.8.2.custom.css
===================================================================
--- trunk/prototype/plugins/jqgrid/themes/prognusone/jquery-ui-1.8.2.custom.css	(revision 5136)
+++ trunk/prototype/plugins/jqgrid/themes/prognusone/jquery-ui-1.8.2.custom.css	(revision 5136)
@@ -0,0 +1,488 @@
+/*
+* jQuery UI CSS Framework
+* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
+* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
+*/
+/* Layout helpers
+----------------------------------*/
+.ui-helper-hidden { display: none; }
+.ui-helper-hidden-accessible { position: absolute; left: -99999999px; }
+.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
+.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
+.ui-helper-clearfix { display: inline-block; }
+/* required comment for clearfix to work in Opera \*/
+* html .ui-helper-clearfix { height:1%; }
+.ui-helper-clearfix { display:block; }
+/* end clearfix */
+.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
+
+
+/* Interaction Cues
+----------------------------------*/
+.ui-state-disabled { cursor: default !important; }
+
+
+/* Icons
+----------------------------------*/
+
+/* states and images */
+.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
+
+
+/* Misc visuals
+----------------------------------*/
+
+/* Overlays */
+.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
+
+
+/*
+* jQuery UI CSS Framework
+* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
+* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
+* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Lucida%20Grande,%20Lucida%20Sans,%20Arial,%20sans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=5px&bgColorHeader=5c9ccc&bgTextureHeader=12_gloss_wave.png&bgImgOpacityHeader=55&borderColorHeader=4297d7&fcHeader=ffffff&iconColorHeader=d8e7f3&bgColorContent=fcfdfd&bgTextureContent=06_inset_hard.png&bgImgOpacityContent=100&borderColorContent=a6c9e2&fcContent=222222&iconColorContent=469bdd&bgColorDefault=dfeffc&bgTextureDefault=02_glass.png&bgImgOpacityDefault=85&borderColorDefault=c5dbec&fcDefault=2e6e9e&iconColorDefault=6da8d5&bgColorHover=d0e5f5&bgTextureHover=02_glass.png&bgImgOpacityHover=75&borderColorHover=79b7e7&fcHover=1d5987&iconColorHover=217bc0&bgColorActive=f5f8f9&bgTextureActive=06_inset_hard.png&bgImgOpacityActive=100&borderColorActive=79b7e7&fcActive=e17009&iconColorActive=f9bd01&bgColorHighlight=fbec88&bgTextureHighlight=01_flat.png&bgImgOpacityHighlight=55&borderColorHighlight=fad42e&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=02_glass.png&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
+*/
+
+
+/* Component containers
+----------------------------------*/
+.ui-widget { font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1em; }
+.ui-widget .ui-widget { font-size: 1em; }
+.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1em; }
+.ui-widget-content { border: 1px solid #a6c9e2; background: #fcfdfd url(images/ui-bg_inset-hard_100_fcfdfd_1x100.png) 50% bottom repeat-x; color: #222222; }
+.ui-widget-content a { color: #222222; }
+.ui-widget-header { border: 1px solid #4297d7; background: #5c9ccc url(images/ui-bg_gloss-wave_55_5c9ccc_500x100.png) 50% 50% repeat-x; color: #ffffff; font-weight: bold; }
+.ui-widget-header a { color: #ffffff; }
+
+/* Interaction states
+----------------------------------*/
+.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #c5dbec; background: #dfeffc url(images/ui-bg_glass_85_dfeffc_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #2e6e9e; }
+.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #2e6e9e; text-decoration: none; }
+.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #79b7e7; background: #d0e5f5 url(images/ui-bg_glass_75_d0e5f5_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #1d5987; }
+.ui-state-hover a, .ui-state-hover a:hover { color: #1d5987; text-decoration: none; }
+.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #79b7e7; background: #f5f8f9 url(images/ui-bg_inset-hard_100_f5f8f9_1x100.png) 50% 50% repeat-x; font-weight: bold; color: #e17009; }
+.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #e17009; text-decoration: none; }
+.ui-widget :active { outline: none; }
+
+/* Interaction Cues
+----------------------------------*/
+.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight  {border: 1px solid #fad42e; background: #fbec88 url(images/ui-bg_flat_55_fbec88_40x100.png) 50% 50% repeat-x; color: #363636; }
+.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
+.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; }
+.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; }
+.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; }
+.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
+.ui-priority-secondary, .ui-widget-content .ui-priority-secondary,  .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
+.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
+
+/* Icons
+----------------------------------*/
+
+/* states and images */
+.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_469bdd_256x240.png); }
+.ui-widget-content .ui-icon {background-image: url(images/ui-icons_469bdd_256x240.png); }
+.ui-widget-header .ui-icon {background-image: url(images/ui-icons_d8e7f3_256x240.png); }
+.ui-state-default .ui-icon { background-image: url(images/ui-icons_6da8d5_256x240.png); }
+.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_217bc0_256x240.png); }
+.ui-state-active .ui-icon {background-image: url(images/ui-icons_f9bd01_256x240.png); }
+.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); }
+.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); }
+
+/* positioning */
+.ui-icon-carat-1-n { background-position: 0 0; }
+.ui-icon-carat-1-ne { background-position: -16px 0; }
+.ui-icon-carat-1-e { background-position: -32px 0; }
+.ui-icon-carat-1-se { background-position: -48px 0; }
+.ui-icon-carat-1-s { background-position: -64px 0; }
+.ui-icon-carat-1-sw { background-position: -80px 0; }
+.ui-icon-carat-1-w { background-position: -96px 0; }
+.ui-icon-carat-1-nw { background-position: -112px 0; }
+.ui-icon-carat-2-n-s { background-position: -128px 0; }
+.ui-icon-carat-2-e-w { background-position: -144px 0; }
+.ui-icon-triangle-1-n { background-position: 0 -16px; }
+.ui-icon-triangle-1-ne { background-position: -16px -16px; }
+.ui-icon-triangle-1-e { background-position: -32px -16px; }
+.ui-icon-triangle-1-se { background-position: -48px -16px; }
+.ui-icon-triangle-1-s { background-position: -64px -16px; }
+.ui-icon-triangle-1-sw { background-position: -80px -16px; }
+.ui-icon-triangle-1-w { background-position: -96px -16px; }
+.ui-icon-triangle-1-nw { background-position: -112px -16px; }
+.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
+.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
+.ui-icon-arrow-1-n { background-position: 0 -32px; }
+.ui-icon-arrow-1-ne { background-position: -16px -32px; }
+.ui-icon-arrow-1-e { background-position: -32px -32px; }
+.ui-icon-arrow-1-se { background-position: -48px -32px; }
+.ui-icon-arrow-1-s { background-position: -64px -32px; }
+.ui-icon-arrow-1-sw { background-position: -80px -32px; }
+.ui-icon-arrow-1-w { background-position: -96px -32px; }
+.ui-icon-arrow-1-nw { background-position: -112px -32px; }
+.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
+.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
+.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
+.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
+.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
+.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
+.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
+.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
+.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
+.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
+.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
+.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
+.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
+.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
+.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
+.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
+.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
+.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
+.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
+.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
+.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
+.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
+.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
+.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
+.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
+.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
+.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
+.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
+.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
+.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
+.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
+.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
+.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
+.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
+.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
+.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
+.ui-icon-arrow-4 { background-position: 0 -80px; }
+.ui-icon-arrow-4-diag { background-position: -16px -80px; }
+.ui-icon-extlink { background-position: -32px -80px; }
+.ui-icon-newwin { background-position: -48px -80px; }
+.ui-icon-refresh { background-position: -64px -80px; }
+.ui-icon-shuffle { background-position: -80px -80px; }
+.ui-icon-transfer-e-w { background-position: -96px -80px; }
+.ui-icon-transferthick-e-w { background-position: -112px -80px; }
+.ui-icon-folder-collapsed { background-position: 0 -96px; }
+.ui-icon-folder-open { background-position: -16px -96px; }
+.ui-icon-document { background-position: -32px -96px; }
+.ui-icon-document-b { background-position: -48px -96px; }
+.ui-icon-note { background-position: -64px -96px; }
+.ui-icon-mail-closed { background-position: -80px -96px; }
+.ui-icon-mail-open { background-position: -96px -96px; }
+.ui-icon-suitcase { background-position: -112px -96px; }
+.ui-icon-comment { background-position: -128px -96px; }
+.ui-icon-person { background-position: -144px -96px; }
+.ui-icon-print { background-position: -160px -96px; }
+.ui-icon-trash { background-position: -176px -96px; }
+.ui-icon-locked { background-position: -192px -96px; }
+.ui-icon-unlocked { background-position: -208px -96px; }
+.ui-icon-bookmark { background-position: -224px -96px; }
+.ui-icon-tag { background-position: -240px -96px; }
+.ui-icon-home { background-position: 0 -112px; }
+.ui-icon-flag { background-position: -16px -112px; }
+.ui-icon-calendar { background-position: -32px -112px; }
+.ui-icon-cart { background-position: -48px -112px; }
+.ui-icon-pencil { background-position: -64px -112px; }
+.ui-icon-clock { background-position: -80px -112px; }
+.ui-icon-disk { background-position: -96px -112px; }
+.ui-icon-calculator { background-position: -112px -112px; }
+.ui-icon-zoomin { background-position: -128px -112px; }
+.ui-icon-zoomout { background-position: -144px -112px; }
+.ui-icon-search { background-position: -160px -112px; }
+.ui-icon-wrench { background-position: -176px -112px; }
+.ui-icon-gear { background-position: -192px -112px; }
+.ui-icon-heart { background-position: -208px -112px; }
+.ui-icon-star { background-position: -224px -112px; }
+.ui-icon-link { background-position: -240px -112px; }
+.ui-icon-cancel { background-position: 0 -128px; }
+.ui-icon-plus { background-position: -16px -128px; }
+.ui-icon-plusthick { background-position: -32px -128px; }
+.ui-icon-minus { background-position: -48px -128px; }
+.ui-icon-minusthick { background-position: -64px -128px; }
+.ui-icon-close { background-position: -80px -128px; }
+.ui-icon-closethick { background-position: -96px -128px; }
+.ui-icon-key { background-position: -112px -128px; }
+.ui-icon-lightbulb { background-position: -128px -128px; }
+.ui-icon-scissors { background-position: -144px -128px; }
+.ui-icon-clipboard { background-position: -160px -128px; }
+.ui-icon-copy { background-position: -176px -128px; }
+.ui-icon-contact { background-position: -192px -128px; }
+.ui-icon-image { background-position: -208px -128px; }
+.ui-icon-video { background-position: -224px -128px; }
+.ui-icon-script { background-position: -240px -128px; }
+.ui-icon-alert { background-position: 0 -144px; }
+.ui-icon-info { background-position: -16px -144px; }
+.ui-icon-notice { background-position: -32px -144px; }
+.ui-icon-help { background-position: -48px -144px; }
+.ui-icon-check { background-position: -64px -144px; }
+.ui-icon-bullet { background-position: -80px -144px; }
+.ui-icon-radio-off { background-position: -96px -144px; }
+.ui-icon-radio-on { background-position: -112px -144px; }
+.ui-icon-pin-w { background-position: -128px -144px; }
+.ui-icon-pin-s { background-position: -144px -144px; }
+.ui-icon-play { background-position: 0 -160px; }
+.ui-icon-pause { background-position: -16px -160px; }
+.ui-icon-seek-next { background-position: -32px -160px; }
+.ui-icon-seek-prev { background-position: -48px -160px; }
+.ui-icon-seek-end { background-position: -64px -160px; }
+.ui-icon-seek-start { background-position: -80px -160px; }
+/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
+.ui-icon-seek-first { background-position: -80px -160px; }
+.ui-icon-stop { background-position: -96px -160px; }
+.ui-icon-eject { background-position: -112px -160px; }
+.ui-icon-volume-off { background-position: -128px -160px; }
+.ui-icon-volume-on { background-position: -144px -160px; }
+.ui-icon-power { background-position: 0 -176px; }
+.ui-icon-signal-diag { background-position: -16px -176px; }
+.ui-icon-signal { background-position: -32px -176px; }
+.ui-icon-battery-0 { background-position: -48px -176px; }
+.ui-icon-battery-1 { background-position: -64px -176px; }
+.ui-icon-battery-2 { background-position: -80px -176px; }
+.ui-icon-battery-3 { background-position: -96px -176px; }
+.ui-icon-circle-plus { background-position: 0 -192px; }
+.ui-icon-circle-minus { background-position: -16px -192px; }
+.ui-icon-circle-close { background-position: -32px -192px; }
+.ui-icon-circle-triangle-e { background-position: -48px -192px; }
+.ui-icon-circle-triangle-s { background-position: -64px -192px; }
+.ui-icon-circle-triangle-w { background-position: -80px -192px; }
+.ui-icon-circle-triangle-n { background-position: -96px -192px; }
+.ui-icon-circle-arrow-e { background-position: -112px -192px; }
+.ui-icon-circle-arrow-s { background-position: -128px -192px; }
+.ui-icon-circle-arrow-w { background-position: -144px -192px; }
+.ui-icon-circle-arrow-n { background-position: -160px -192px; }
+.ui-icon-circle-zoomin { background-position: -176px -192px; }
+.ui-icon-circle-zoomout { background-position: -192px -192px; }
+.ui-icon-circle-check { background-position: -208px -192px; }
+.ui-icon-circlesmall-plus { background-position: 0 -208px; }
+.ui-icon-circlesmall-minus { background-position: -16px -208px; }
+.ui-icon-circlesmall-close { background-position: -32px -208px; }
+.ui-icon-squaresmall-plus { background-position: -48px -208px; }
+.ui-icon-squaresmall-minus { background-position: -64px -208px; }
+.ui-icon-squaresmall-close { background-position: -80px -208px; }
+.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
+.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
+.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
+.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
+.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
+.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
+
+
+/* Misc visuals
+----------------------------------*/
+
+/* Corner radius */
+.ui-corner-tl { -moz-border-radius-topleft: 5px; -webkit-border-top-left-radius: 5px; border-top-left-radius: 5px; }
+.ui-corner-tr { -moz-border-radius-topright: 5px; -webkit-border-top-right-radius: 5px; border-top-right-radius: 5px; }
+.ui-corner-bl { -moz-border-radius-bottomleft: 5px; -webkit-border-bottom-left-radius: 5px; border-bottom-left-radius: 5px; }
+.ui-corner-br { -moz-border-radius-bottomright: 5px; -webkit-border-bottom-right-radius: 5px; border-bottom-right-radius: 5px; }
+.ui-corner-top { -moz-border-radius-topleft: 5px; -webkit-border-top-left-radius: 5px; border-top-left-radius: 5px; -moz-border-radius-topright: 5px; -webkit-border-top-right-radius: 5px; border-top-right-radius: 5px; }
+.ui-corner-bottom { -moz-border-radius-bottomleft: 5px; -webkit-border-bottom-left-radius: 5px; border-bottom-left-radius: 5px; -moz-border-radius-bottomright: 5px; -webkit-border-bottom-right-radius: 5px; border-bottom-right-radius: 5px; }
+.ui-corner-right {  -moz-border-radius-topright: 5px; -webkit-border-top-right-radius: 5px; border-top-right-radius: 5px; -moz-border-radius-bottomright: 5px; -webkit-border-bottom-right-radius: 5px; border-bottom-right-radius: 5px; }
+.ui-corner-left { -moz-border-radius-topleft: 5px; -webkit-border-top-left-radius: 5px; border-top-left-radius: 5px; -moz-border-radius-bottomleft: 5px; -webkit-border-bottom-left-radius: 5px; border-bottom-left-radius: 5px; }
+.ui-corner-all { -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; }
+
+/* Overlays */
+.ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); }
+.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }/* Resizable
+----------------------------------*/
+.ui-resizable { position: relative;}
+.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;}
+.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
+.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
+.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
+.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }
+.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }
+.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
+.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
+.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
+.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/* Selectable
+----------------------------------*/
+.ui-selectable-helper { border:1px dotted black }
+/* Accordion
+----------------------------------*/
+.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
+.ui-accordion .ui-accordion-li-fix { display: inline; }
+.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }
+.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; }
+/* IE7-/Win - Fix extra vertical space in lists */
+.ui-accordion a { zoom: 1; }
+.ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; }
+.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
+.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; }
+.ui-accordion .ui-accordion-content-active { display: block; }/* Autocomplete
+----------------------------------*/
+.ui-autocomplete { position: absolute; cursor: default; }	
+.ui-autocomplete-loading { background: white url('images/ui-anim_basic_16x16.gif') right center no-repeat; }
+
+/* workarounds */
+* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
+
+/* Menu
+----------------------------------*/
+.ui-menu {
+	list-style:none;
+	padding: 2px;
+	margin: 0;
+	display:block;
+}
+.ui-menu .ui-menu {
+	margin-top: -3px;
+}
+.ui-menu .ui-menu-item {
+	margin:0;
+	padding: 0;
+	zoom: 1;
+	float: left;
+	clear: left;
+	width: 100%;
+}
+.ui-menu .ui-menu-item a {
+	text-decoration:none;
+	display:block;
+	padding:.2em .4em;
+	line-height:1.5;
+	zoom:1;
+}
+.ui-menu .ui-menu-item a.ui-state-hover,
+.ui-menu .ui-menu-item a.ui-state-active {
+	font-weight: normal;
+	margin: -1px;
+}
+/* Button
+----------------------------------*/
+
+.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */
+.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
+button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
+.ui-button-icons-only { width: 3.4em; } 
+button.ui-button-icons-only { width: 3.7em; } 
+
+/*button text element */
+.ui-button .ui-button-text { display: block; line-height: 1.4;  }
+.ui-button-text-only .ui-button-text { padding: .4em 1em; }
+.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }
+.ui-button-text-icon .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }
+.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }
+/* no icon support for input elements, provide padding by default */
+input.ui-button { padding: .4em 1em; }
+
+/*button icon element(s) */
+.ui-button-icon-only .ui-icon, .ui-button-text-icon .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }
+.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }
+.ui-button-text-icon .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }
+.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
+
+/*button sets*/
+.ui-buttonset { margin-right: 7px; }
+.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; }
+
+/* workarounds */
+button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */
+
+
+
+
+
+/* Dialog
+----------------------------------*/
+.ui-dialog { position: absolute; padding:0; width: 300px; overflow: hidden; }
+.ui-dialog .ui-dialog-titlebar { padding: .3em 1em .2em; position: relative;  }
+.ui-dialog .ui-dialog-title { float: left; margin: 0em 16px .1em 0; font-size:0.9em;} 
+.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
+.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
+.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
+.ui-dialog .ui-dialog-content { border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
+.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
+.ui-dialog .ui-dialog-buttonpane button { float: right; margin: .5em .4em .5em 0; cursor: pointer; padding: .2em .6em .3em .6em; line-height: 1.4em; width:auto; overflow:visible; }
+.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
+.ui-draggable .ui-dialog-titlebar { cursor: move; }
+/* Slider
+----------------------------------*/
+.ui-slider { position: relative; text-align: left; }
+.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
+.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
+
+.ui-slider-horizontal { height: .8em; }
+.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
+.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
+.ui-slider-horizontal .ui-slider-range-min { left: 0; }
+.ui-slider-horizontal .ui-slider-range-max { right: 0; }
+
+.ui-slider-vertical { width: .8em; height: 100px; }
+.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
+.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
+.ui-slider-vertical .ui-slider-range-min { bottom: 0; }
+.ui-slider-vertical .ui-slider-range-max { top: 0; }/* Tabs
+----------------------------------*/
+.ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
+.ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; }
+.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; }
+.ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; }
+.ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; }
+.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; }
+.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
+.ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; }
+.ui-tabs .ui-tabs-hide { display: none !important; }
+/* Datepicker
+----------------------------------*/
+.ui-datepicker { width: 17em; padding: .2em .2em 0; }
+.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
+.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
+.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
+.ui-datepicker .ui-datepicker-prev { left:2px; }
+.ui-datepicker .ui-datepicker-next { right:2px; }
+.ui-datepicker .ui-datepicker-prev-hover { left:1px; }
+.ui-datepicker .ui-datepicker-next-hover { right:1px; }
+.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px;  }
+.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
+.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
+.ui-datepicker select.ui-datepicker-month-year {width: 100%;}
+.ui-datepicker select.ui-datepicker-month, 
+.ui-datepicker select.ui-datepicker-year { width: 49%;}
+.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
+.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0;  }
+.ui-datepicker td { border: 0; padding: 1px; }
+.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
+.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
+.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
+.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
+
+/* with multiple calendars */
+.ui-datepicker.ui-datepicker-multi { width:auto; }
+.ui-datepicker-multi .ui-datepicker-group { float:left; }
+.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
+.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
+.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
+.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
+.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
+.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
+.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
+.ui-datepicker-row-break { clear:both; width:100%; }
+
+/* RTL support */
+.ui-datepicker-rtl { direction: rtl; }
+.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
+.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
+.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
+.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
+.ui-datepicker-rtl .ui-datepicker-group { float:right; }
+.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
+.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
+
+/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
+.ui-datepicker-cover {
+    display: none; /*sorry for IE5*/
+    display/**/: block; /*sorry for IE5*/
+    position: absolute; /*must have*/
+    z-index: -1; /*must have*/
+    filter: mask(); /*must have*/
+    top: -4px; /*must have*/
+    left: -4px; /*must have*/
+    width: 200px; /*must have*/
+    height: 200px; /*must have*/
+}/* Progressbar
+----------------------------------*/
+.ui-progressbar { height:2em; text-align: left; }
+.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }
Index: trunk/prototype/plugins/jqgrid/css/ui.jqgrid.css
===================================================================
--- trunk/prototype/plugins/jqgrid/css/ui.jqgrid.css	(revision 5136)
+++ trunk/prototype/plugins/jqgrid/css/ui.jqgrid.css	(revision 5136)
@@ -0,0 +1,134 @@
+/*Grid*/
+.ui-jqgrid {position: relative; font-size:11px;}
+.ui-jqgrid .ui-jqgrid-view {position: relative;left:0px; top: 0px; padding: .0em;}
+/* caption*/
+.ui-jqgrid .ui-jqgrid-titlebar {padding: .3em .2em .2em .3em; position: relative; border-left: 0px none;border-right: 0px none; border-top: 0px none;}
+.ui-jqgrid .ui-jqgrid-title { float: left; margin: .1em 0 .2em; }
+.ui-jqgrid .ui-jqgrid-titlebar-close { position: absolute;top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height:18px;}.ui-jqgrid .ui-jqgrid-titlebar-close span { display: block; margin: 1px; }
+.ui-jqgrid .ui-jqgrid-titlebar-close:hover { padding: 0; }
+/* header*/
+.ui-jqgrid .ui-jqgrid-hdiv {position: relative; margin: 0em;padding: 0em; overflow-x: hidden; overflow-y: auto; border-left: 0px none !important; border-top : 0px none !important; border-right : 0px none !important;}
+.ui-jqgrid .ui-jqgrid-hbox {float: left; padding-right: 20px;}
+.ui-jqgrid .ui-jqgrid-htable {table-layout:fixed;margin:0em;}
+.ui-jqgrid .ui-jqgrid-htable th {height:22px;padding: 0 2px 0 2px;}
+.ui-jqgrid .ui-jqgrid-htable th div {overflow: hidden; position:relative; height:17px;}
+.ui-th-column, .ui-jqgrid .ui-jqgrid-htable th.ui-th-column {overflow: hidden;white-space: nowrap;text-align:center;border-top : 0px none;border-bottom : 0px none;}
+.ui-th-ltr, .ui-jqgrid .ui-jqgrid-htable th.ui-th-ltr {border-left : 0px none;}
+.ui-th-rtl, .ui-jqgrid .ui-jqgrid-htable th.ui-th-rtl {border-right : 0px none;}
+.ui-jqgrid .ui-th-div-ie {white-space: nowrap; zoom :1; height:17px;}
+.ui-jqgrid .ui-jqgrid-resize {height:20px !important;position: relative; cursor :e-resize;display: inline;overflow: hidden;}
+.ui-jqgrid .ui-grid-ico-sort {overflow:hidden;position:absolute;display:inline; cursor: pointer !important;}
+.ui-jqgrid .ui-icon-asc {margin-top:-3px; height:12px;}
+.ui-jqgrid .ui-icon-desc {margin-top:3px;height:12px;}
+.ui-jqgrid .ui-i-asc {margin-top:0px;height:16px;}
+.ui-jqgrid .ui-i-desc {margin-top:0px;margin-left:13px;height:16px;}
+.ui-jqgrid .ui-jqgrid-sortable {cursor:pointer;}
+.ui-jqgrid tr.ui-search-toolbar th { border-top-width: 1px !important; border-top-color: inherit !important; border-top-style: ridge !important }
+tr.ui-search-toolbar input {margin: 1px 0px 0px 0px}
+tr.ui-search-toolbar select {margin: 1px 0px 0px 0px}
+/* body */ 
+.ui-jqgrid .ui-jqgrid-bdiv {position: relative; margin: 0em; padding:0; overflow: auto; text-align:left;}
+.ui-jqgrid .ui-jqgrid-btable {table-layout:fixed; margin:0em; outline-style: none; }
+.ui-jqgrid tr.jqgrow { outline-style: none; }
+.ui-jqgrid tr.jqgroup { outline-style: none; }
+.ui-jqgrid tr.jqgrow td {font-weight: normal; overflow: hidden; white-space: pre; height: 22px;padding: 0 2px 0 2px;border-bottom-width: 1px; border-bottom-color: inherit; border-bottom-style: solid;}
+.ui-jqgrid tr.jqgfirstrow td {padding: 0 2px 0 2px;border-right-width: 1px; border-right-style: solid;}
+.ui-jqgrid tr.jqgroup td {font-weight: normal; overflow: hidden; white-space: pre; height: 22px;padding: 0 2px 0 2px;border-bottom-width: 1px; border-bottom-color: inherit; border-bottom-style: solid;}
+.ui-jqgrid tr.jqfoot td {font-weight: bold; overflow: hidden; white-space: pre; height: 22px;padding: 0 2px 0 2px;border-bottom-width: 1px; border-bottom-color: inherit; border-bottom-style: solid;}
+.ui-jqgrid tr.ui-row-ltr td {text-align:left;border-right-width: 1px; border-right-color: inherit; border-right-style: solid;}
+.ui-jqgrid tr.ui-row-rtl td {text-align:right;border-left-width: 1px; border-left-color: inherit; border-left-style: solid;}
+.ui-jqgrid td.jqgrid-rownum { padding: 0 2px 0 2px; margin: 0px; border: 0px none;}
+.ui-jqgrid .ui-jqgrid-resize-mark { width:2px; left:0; background-color:#777; cursor: e-resize; cursor: col-resize; position:absolute; top:0; height:100px; overflow:hidden; display:none;	border:0 none;}
+/* footer */
+.ui-jqgrid .ui-jqgrid-sdiv {position: relative; margin: 0em;padding: 0em; overflow: hidden; border-left: 0px none !important; border-top : 0px none !important; border-right : 0px none !important;}
+.ui-jqgrid .ui-jqgrid-ftable {table-layout:fixed; margin-bottom:0em;}
+.ui-jqgrid tr.footrow td {font-weight: bold; overflow: hidden; white-space:nowrap; height: 21px;padding: 0 2px 0 2px;border-top-width: 1px; border-top-color: inherit; border-top-style: solid;}
+.ui-jqgrid tr.footrow-ltr td {text-align:left;border-right-width: 1px; border-right-color: inherit; border-right-style: solid;}
+.ui-jqgrid tr.footrow-rtl td {text-align:right;border-left-width: 1px; border-left-color: inherit; border-left-style: solid;}
+/* Pager*/
+.ui-jqgrid .ui-jqgrid-pager { border-left: 0px none !important;border-right: 0px none !important; border-bottom: 0px none !important; margin: 0px !important; padding: 0px !important; position: relative; height: 25px;white-space: nowrap;overflow: hidden;}
+.ui-jqgrid .ui-pager-control {position: relative;}
+.ui-jqgrid .ui-pg-table {position: relative; padding-bottom:2px; width:auto; margin: 0em;}
+.ui-jqgrid .ui-pg-table td {font-weight:normal; vertical-align:middle; padding:1px;}
+.ui-jqgrid .ui-pg-button  { height:19px !important;}
+.ui-jqgrid .ui-pg-button span { display: block; margin: 1px; float:left;}
+.ui-jqgrid .ui-pg-button:hover { padding: 0px; }
+.ui-jqgrid .ui-state-disabled:hover {padding:1px;}
+.ui-jqgrid .ui-pg-input { height:13px;font-size:.8em; margin: 0em;}
+.ui-jqgrid .ui-pg-selbox {font-size:.8em; line-height:18px; display:block; height:18px; margin: 0em;}
+.ui-jqgrid .ui-separator {height: 18px; border-left: 1px solid #ccc ; border-right: 1px solid #ccc ; margin: 1px; float: right;}
+.ui-jqgrid .ui-paging-info {font-weight: normal;height:19px; margin-top:3px;margin-right:4px;}
+.ui-jqgrid .ui-jqgrid-pager .ui-pg-div {padding:1px 0;float:left;list-style-image:none;list-style-position:outside;list-style-type:none;position:relative;}
+.ui-jqgrid .ui-jqgrid-pager .ui-pg-button { cursor:pointer; }
+.ui-jqgrid .ui-jqgrid-pager .ui-pg-div  span.ui-icon {float:left;margin:0 2px;}
+.ui-jqgrid td input, .ui-jqgrid td select .ui-jqgrid td textarea { margin: 0em;}
+.ui-jqgrid td textarea {width:auto;height:auto;}
+.ui-jqgrid .ui-jqgrid-toppager {border-left: 0px none !important;border-right: 0px none !important; border-top: 0px none !important; margin: 0px !important; padding: 0px !important; position: relative; height: 25px !important;white-space: nowrap;overflow: hidden;}
+/*subgrid*/
+.ui-jqgrid .ui-jqgrid-btable .ui-sgcollapsed span {display: block;}
+.ui-jqgrid .ui-subgrid {margin:0em;padding:0em; width:100%;}
+.ui-jqgrid .ui-subgrid table {table-layout: fixed;}
+.ui-jqgrid .ui-subgrid tr.ui-subtblcell td {height:18px;border-right-width: 1px; border-right-color: inherit; border-right-style: solid;border-bottom-width: 1px; border-bottom-color: inherit; border-bottom-style: solid;}
+.ui-jqgrid .ui-subgrid td.subgrid-data {border-top:  0px none !important;}
+.ui-jqgrid .ui-subgrid td.subgrid-cell {border-width: 0px 0px 1px 0px;}
+.ui-jqgrid .ui-th-subgrid {height:20px;}
+/* loading */
+.ui-jqgrid .loading {position: absolute; top: 45%;left: 45%;width: auto;z-index:101;padding: 6px; margin: 5px;text-align: center;font-weight: bold;display: none;border-width: 2px !important;}
+.ui-jqgrid .jqgrid-overlay {display:none;z-index:100;}
+* html .jqgrid-overlay {width: expression(this.parentNode.offsetWidth+'px');height: expression(this.parentNode.offsetHeight+'px');}
+* .jqgrid-overlay iframe {position:absolute;top:0;left:0;z-index:-1;width: expression(this.parentNode.offsetWidth+'px');height: expression(this.parentNode.offsetHeight+'px');}
+/* end loading div */
+/* toolbar */
+.ui-jqgrid .ui-userdata {border-left: 0px none;	border-right: 0px none;	height : 21px;overflow: hidden;	}
+/*Modal Window */
+.ui-jqdialog { display: none; width: 300px; position: absolute; padding: .2em; font-size:11px; overflow:visible;}
+.ui-jqdialog .ui-jqdialog-titlebar { padding: .3em .2em; position: relative;  }
+.ui-jqdialog .ui-jqdialog-title { margin: .1em 0 .2em; } 
+.ui-jqdialog .ui-jqdialog-titlebar-close { position: absolute;  top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
+
+.ui-jqdialog .ui-jqdialog-titlebar-close span { display: block; margin: 1px; }
+.ui-jqdialog .ui-jqdialog-titlebar-close:hover, .ui-jqdialog .ui-jqdialog-titlebar-close:focus { padding: 0; }
+.ui-jqdialog-content, .ui-jqdialog .ui-jqdialog-content { border: 0; padding: .3em .2em; background: none; height:auto;}
+.ui-jqdialog .ui-jqconfirm {padding: .4em 1em; border-width:3px;position:absolute;bottom:10px;right:10px;overflow:visible;display:none;height:80px;width:220px;text-align:center;}
+/* end Modal window*/
+/* Form edit */
+.ui-jqdialog-content .FormGrid {margin: 0px;}
+.ui-jqdialog-content .EditTable { width: 100%; margin-bottom:0em;}
+.ui-jqdialog-content .DelTable { width: 100%; margin-bottom:0em;}
+.EditTable td input, .EditTable td select, .EditTable td textarea {margin: 0em;}
+.EditTable td textarea { width:auto; height:auto;}
+.ui-jqdialog-content td.EditButton {text-align: right;border-top: 0px none;border-left: 0px none;border-right: 0px none; padding-bottom:5px; padding-top:5px;}
+.ui-jqdialog-content td.navButton {text-align: center; border-left: 0px none;border-top: 0px none;border-right: 0px none; padding-bottom:5px; padding-top:5px;}
+.ui-jqdialog-content input.FormElement {padding:.3em}
+.ui-jqdialog-content .data-line {padding-top:.1em;border: 0px none;}
+
+.ui-jqdialog-content .CaptionTD {text-align: left; vertical-align: middle;border: 0px none; padding: 2px;white-space: nowrap;}
+.ui-jqdialog-content .DataTD {padding: 2px; border: 0px none; vertical-align: top;}
+.ui-jqdialog-content .form-view-data {white-space:pre}
+.fm-button { display: inline-block; margin:0 4px 0 0; padding: .4em .5em; text-decoration:none !important; cursor:pointer; position: relative; text-align: center; zoom: 1; }
+.fm-button-icon-left { padding-left: 1.9em; }
+.fm-button-icon-right { padding-right: 1.9em; }
+.fm-button-icon-left .ui-icon { right: auto; left: .2em; margin-left: 0; position: absolute; top: 50%; margin-top: -8px; }
+.fm-button-icon-right .ui-icon { left: auto; right: .2em; margin-left: 0; position: absolute; top: 50%; margin-top: -8px;}
+#nData, #pData { float: left; margin:3px;padding: 0; width: 15px; }
+/* End Eorm edit */
+/*.ui-jqgrid .edit-cell {}*/
+.ui-jqgrid .selected-row, div.ui-jqgrid .selected-row td {font-style : normal;border-left: 0px none;}
+/* Tree Grid */
+.ui-jqgrid .tree-wrap {float: left; position: relative;height: 18px;white-space: nowrap;overflow: hidden;}
+.ui-jqgrid .tree-minus {position: absolute; height: 18px; width: 18px; overflow: hidden;}
+.ui-jqgrid .tree-plus {position: absolute;	height: 18px; width: 18px;	overflow: hidden;}
+.ui-jqgrid .tree-leaf {position: absolute;	height: 18px; width: 18px;overflow: hidden;}
+.ui-jqgrid .treeclick {cursor: pointer;}
+/* moda dialog */
+* iframe.jqm {position:absolute;top:0;left:0;z-index:-1;width: expression(this.parentNode.offsetWidth+'px');height: expression(this.parentNode.offsetHeight+'px');}
+.ui-jqgrid-dnd tr td {border-right-width: 1px; border-right-color: inherit; border-right-style: solid; height:20px}
+/* RTL Support */
+.ui-jqgrid .ui-jqgrid-title-rtl {float:right;margin: .1em 0 .2em; }
+.ui-jqgrid .ui-jqgrid-hbox-rtl {float: right; padding-left: 20px;}
+.ui-jqgrid .ui-jqgrid-resize-ltr {float: right;margin: -2px -2px -2px 0px;}
+.ui-jqgrid .ui-jqgrid-resize-rtl {float: left;margin: -2px 0px -1px -3px;}
+.ui-jqgrid .ui-sort-rtl {left:0px;}
+.ui-jqgrid .tree-wrap-ltr {float: left;}
+.ui-jqgrid .tree-wrap-rtl {float: right;}
+.ui-jqgrid .ui-ellipsis {text-overflow:ellipsis; -moz-binding:url('ellipsis-xbl.xml#ellipsis');}
Index: trunk/prototype/plugins/jqgrid/css/ellipsis-xbl.xml
===================================================================
--- trunk/prototype/plugins/jqgrid/css/ellipsis-xbl.xml	(revision 5136)
+++ trunk/prototype/plugins/jqgrid/css/ellipsis-xbl.xml	(revision 5136)
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<bindings
+    xmlns="http://www.mozilla.org/xbl"
+    xmlns:xbl="http://www.mozilla.org/xbl"
+    xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+    <binding id="ellipsis">
+        <content>
+            <xul:window><!-- xul:window tag required for FF2 -->
+                <xul:description crop="end" xbl:inherits="value=xbl:text"><children/></xul:description>
+            </xul:window>
+        </content>
+    </binding>
+</bindings>
Index: trunk/prototype/plugins/jqgrid/css/jquery-ui-1.8.1.custom.css
===================================================================
--- trunk/prototype/plugins/jqgrid/css/jquery-ui-1.8.1.custom.css	(revision 5136)
+++ trunk/prototype/plugins/jqgrid/css/jquery-ui-1.8.1.custom.css	(revision 5136)
@@ -0,0 +1,486 @@
+/*
+* jQuery UI CSS Framework
+* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
+* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
+*/
+
+/* Layout helpers
+----------------------------------*/
+.ui-helper-hidden { display: none; }
+.ui-helper-hidden-accessible { position: absolute; left: -99999999px; }
+.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
+.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
+.ui-helper-clearfix { display: inline-block; }
+/* required comment for clearfix to work in Opera \*/
+* html .ui-helper-clearfix { height:1%; }
+.ui-helper-clearfix { display:block; }
+/* end clearfix */
+.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
+
+
+/* Interaction Cues
+----------------------------------*/
+.ui-state-disabled { cursor: default !important; }
+
+
+/* Icons
+----------------------------------*/
+
+/* states and images */
+.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
+
+
+/* Misc visuals
+----------------------------------*/
+
+/* Overlays */
+.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
+
+
+/*
+* jQuery UI CSS Framework
+* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
+* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
+* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Lucida%20Grande,%20Lucida%20Sans,%20Arial,%20sans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=5px&bgColorHeader=5c9ccc&bgTextureHeader=12_gloss_wave.png&bgImgOpacityHeader=55&borderColorHeader=4297d7&fcHeader=ffffff&iconColorHeader=d8e7f3&bgColorContent=fcfdfd&bgTextureContent=06_inset_hard.png&bgImgOpacityContent=100&borderColorContent=a6c9e2&fcContent=222222&iconColorContent=469bdd&bgColorDefault=dfeffc&bgTextureDefault=02_glass.png&bgImgOpacityDefault=85&borderColorDefault=c5dbec&fcDefault=2e6e9e&iconColorDefault=6da8d5&bgColorHover=d0e5f5&bgTextureHover=02_glass.png&bgImgOpacityHover=75&borderColorHover=79b7e7&fcHover=1d5987&iconColorHover=217bc0&bgColorActive=f5f8f9&bgTextureActive=06_inset_hard.png&bgImgOpacityActive=100&borderColorActive=79b7e7&fcActive=e17009&iconColorActive=f9bd01&bgColorHighlight=fbec88&bgTextureHighlight=01_flat.png&bgImgOpacityHighlight=55&borderColorHighlight=fad42e&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=02_glass.png&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
+*/
+
+
+/* Component containers
+----------------------------------*/
+.ui-widget { font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; /*font-size: 1.1em;*/font-size: 0.9em; }
+.ui-widget .ui-widget { /*font-size: 1em;*/ }
+.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1em; }
+.ui-widget-content { border: 1px solid #a6c9e2; background: #fcfdfd url(images/ui-bg_inset-hard_100_fcfdfd_1x100.png) 50% bottom repeat-x; color: #222222; }
+.ui-widget-content a { color: #222222; }
+.ui-widget-header { border: 1px solid #4297d7; background: #5c9ccc url(images/ui-bg_gloss-wave_55_5c9ccc_500x100.png) 50% 50% repeat-x; color: #ffffff; font-weight: bold; }
+.ui-widget-header a { color: #ffffff; }
+
+/* Interaction states
+----------------------------------*/
+.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #c5dbec; background: #dfeffc url(images/ui-bg_glass_85_dfeffc_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #2e6e9e; }
+.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #2e6e9e; text-decoration: none; }
+.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #79b7e7; background: #d0e5f5 url(images/ui-bg_glass_75_d0e5f5_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #1d5987; }
+.ui-state-hover a, .ui-state-hover a:hover { color: #1d5987; text-decoration: none; }
+.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #79b7e7; background: #f5f8f9 url(images/ui-bg_inset-hard_100_f5f8f9_1x100.png) 50% 50% repeat-x; font-weight: bold; color: #e17009; }
+.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #e17009; text-decoration: none; }
+.ui-widget :active { outline: none; }
+
+/* Interaction Cues
+----------------------------------*/
+.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight  {border: 1px solid #fad42e; background: #fbec88 url(images/ui-bg_flat_55_fbec88_40x100.png) 50% 50% repeat-x; color: #363636; }
+.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
+.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; }
+.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; }
+.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; }
+.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
+.ui-priority-secondary, .ui-widget-content .ui-priority-secondary,  .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
+.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
+
+/* Icons
+----------------------------------*/
+
+/* states and images */
+.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_469bdd_256x240.png); }
+.ui-widget-content .ui-icon {background-image: url(images/ui-icons_469bdd_256x240.png); }
+.ui-widget-header .ui-icon {background-image: url(images/ui-icons_d8e7f3_256x240.png); }
+.ui-state-default .ui-icon { background-image: url(images/ui-icons_6da8d5_256x240.png); }
+.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_217bc0_256x240.png); }
+.ui-state-active .ui-icon {background-image: url(images/ui-icons_f9bd01_256x240.png); }
+.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); }
+.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); }
+
+/* positioning */
+.ui-icon-carat-1-n { background-position: 0 0; }
+.ui-icon-carat-1-ne { background-position: -16px 0; }
+.ui-icon-carat-1-e { background-position: -32px 0; }
+.ui-icon-carat-1-se { background-position: -48px 0; }
+.ui-icon-carat-1-s { background-position: -64px 0; }
+.ui-icon-carat-1-sw { background-position: -80px 0; }
+.ui-icon-carat-1-w { background-position: -96px 0; }
+.ui-icon-carat-1-nw { background-position: -112px 0; }
+.ui-icon-carat-2-n-s { background-position: -128px 0; }
+.ui-icon-carat-2-e-w { background-position: -144px 0; }
+.ui-icon-triangle-1-n { background-position: 0 -16px; }
+.ui-icon-triangle-1-ne { background-position: -16px -16px; }
+.ui-icon-triangle-1-e { background-position: -32px -16px; }
+.ui-icon-triangle-1-se { background-position: -48px -16px; }
+.ui-icon-triangle-1-s { background-position: -64px -16px; }
+.ui-icon-triangle-1-sw { background-position: -80px -16px; }
+.ui-icon-triangle-1-w { background-position: -96px -16px; }
+.ui-icon-triangle-1-nw { background-position: -112px -16px; }
+.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
+.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
+.ui-icon-arrow-1-n { background-position: 0 -32px; }
+.ui-icon-arrow-1-ne { background-position: -16px -32px; }
+.ui-icon-arrow-1-e { background-position: -32px -32px; }
+.ui-icon-arrow-1-se { background-position: -48px -32px; }
+.ui-icon-arrow-1-s { background-position: -64px -32px; }
+.ui-icon-arrow-1-sw { background-position: -80px -32px; }
+.ui-icon-arrow-1-w { background-position: -96px -32px; }
+.ui-icon-arrow-1-nw { background-position: -112px -32px; }
+.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
+.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
+.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
+.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
+.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
+.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
+.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
+.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
+.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
+.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
+.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
+.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
+.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
+.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
+.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
+.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
+.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
+.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
+.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
+.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
+.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
+.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
+.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
+.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
+.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
+.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
+.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
+.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
+.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
+.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
+.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
+.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
+.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
+.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
+.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
+.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
+.ui-icon-arrow-4 { background-position: 0 -80px; }
+.ui-icon-arrow-4-diag { background-position: -16px -80px; }
+.ui-icon-extlink { background-position: -32px -80px; }
+.ui-icon-newwin { background-position: -48px -80px; }
+.ui-icon-refresh { background-position: -64px -80px; }
+.ui-icon-shuffle { background-position: -80px -80px; }
+.ui-icon-transfer-e-w { background-position: -96px -80px; }
+.ui-icon-transferthick-e-w { background-position: -112px -80px; }
+.ui-icon-folder-collapsed { background-position: 0 -96px; }
+.ui-icon-folder-open { background-position: -16px -96px; }
+.ui-icon-document { background-position: -32px -96px; }
+.ui-icon-document-b { background-position: -48px -96px; }
+.ui-icon-note { background-position: -64px -96px; }
+.ui-icon-mail-closed { background-position: -80px -96px; }
+.ui-icon-mail-open { background-position: -96px -96px; }
+.ui-icon-suitcase { background-position: -112px -96px; }
+.ui-icon-comment { background-position: -128px -96px; }
+.ui-icon-person { background-position: -144px -96px; }
+.ui-icon-print { background-position: -160px -96px; }
+.ui-icon-trash { background-position: -176px -96px; }
+.ui-icon-locked { background-position: -192px -96px; }
+.ui-icon-unlocked { background-position: -208px -96px; }
+.ui-icon-bookmark { background-position: -224px -96px; }
+.ui-icon-tag { background-position: -240px -96px; }
+.ui-icon-home { background-position: 0 -112px; }
+.ui-icon-flag { background-position: -16px -112px; }
+.ui-icon-calendar { background-position: -32px -112px; }
+.ui-icon-cart { background-position: -48px -112px; }
+.ui-icon-pencil { background-position: -64px -112px; }
+.ui-icon-clock { background-position: -80px -112px; }
+.ui-icon-disk { background-position: -96px -112px; }
+.ui-icon-calculator { background-position: -112px -112px; }
+.ui-icon-zoomin { background-position: -128px -112px; }
+.ui-icon-zoomout { background-position: -144px -112px; }
+.ui-icon-search { background-position: -160px -112px; }
+.ui-icon-wrench { background-position: -176px -112px; }
+.ui-icon-gear { background-position: -192px -112px; }
+.ui-icon-heart { background-position: -208px -112px; }
+.ui-icon-star { background-position: -224px -112px; }
+.ui-icon-link { background-position: -240px -112px; }
+.ui-icon-cancel { background-position: 0 -128px; }
+.ui-icon-plus { background-position: -16px -128px; }
+.ui-icon-plusthick { background-position: -32px -128px; }
+.ui-icon-minus { background-position: -48px -128px; }
+.ui-icon-minusthick { background-position: -64px -128px; }
+.ui-icon-close { background-position: -80px -128px; }
+.ui-icon-closethick { background-position: -96px -128px; }
+.ui-icon-key { background-position: -112px -128px; }
+.ui-icon-lightbulb { background-position: -128px -128px; }
+.ui-icon-scissors { background-position: -144px -128px; }
+.ui-icon-clipboard { background-position: -160px -128px; }
+.ui-icon-copy { background-position: -176px -128px; }
+.ui-icon-contact { background-position: -192px -128px; }
+.ui-icon-image { background-position: -208px -128px; }
+.ui-icon-video { background-position: -224px -128px; }
+.ui-icon-script { background-position: -240px -128px; }
+.ui-icon-alert { background-position: 0 -144px; }
+.ui-icon-info { background-position: -16px -144px; }
+.ui-icon-notice { background-position: -32px -144px; }
+.ui-icon-help { background-position: -48px -144px; }
+.ui-icon-check { background-position: -64px -144px; }
+.ui-icon-bullet { background-position: -80px -144px; }
+.ui-icon-radio-off { background-position: -96px -144px; }
+.ui-icon-radio-on { background-position: -112px -144px; }
+.ui-icon-pin-w { background-position: -128px -144px; }
+.ui-icon-pin-s { background-position: -144px -144px; }
+.ui-icon-play { background-position: 0 -160px; }
+.ui-icon-pause { background-position: -16px -160px; }
+.ui-icon-seek-next { background-position: -32px -160px; }
+.ui-icon-seek-prev { background-position: -48px -160px; }
+.ui-icon-seek-end { background-position: -64px -160px; }
+.ui-icon-seek-start { background-position: -80px -160px; }
+/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
+.ui-icon-seek-first { background-position: -80px -160px; }
+.ui-icon-stop { background-position: -96px -160px; }
+.ui-icon-eject { background-position: -112px -160px; }
+.ui-icon-volume-off { background-position: -128px -160px; }
+.ui-icon-volume-on { background-position: -144px -160px; }
+.ui-icon-power { background-position: 0 -176px; }
+.ui-icon-signal-diag { background-position: -16px -176px; }
+.ui-icon-signal { background-position: -32px -176px; }
+.ui-icon-battery-0 { background-position: -48px -176px; }
+.ui-icon-battery-1 { background-position: -64px -176px; }
+.ui-icon-battery-2 { background-position: -80px -176px; }
+.ui-icon-battery-3 { background-position: -96px -176px; }
+.ui-icon-circle-plus { background-position: 0 -192px; }
+.ui-icon-circle-minus { background-position: -16px -192px; }
+.ui-icon-circle-close { background-position: -32px -192px; }
+.ui-icon-circle-triangle-e { background-position: -48px -192px; }
+.ui-icon-circle-triangle-s { background-position: -64px -192px; }
+.ui-icon-circle-triangle-w { background-position: -80px -192px; }
+.ui-icon-circle-triangle-n { background-position: -96px -192px; }
+.ui-icon-circle-arrow-e { background-position: -112px -192px; }
+.ui-icon-circle-arrow-s { background-position: -128px -192px; }
+.ui-icon-circle-arrow-w { background-position: -144px -192px; }
+.ui-icon-circle-arrow-n { background-position: -160px -192px; }
+.ui-icon-circle-zoomin { background-position: -176px -192px; }
+.ui-icon-circle-zoomout { background-position: -192px -192px; }
+.ui-icon-circle-check { background-position: -208px -192px; }
+.ui-icon-circlesmall-plus { background-position: 0 -208px; }
+.ui-icon-circlesmall-minus { background-position: -16px -208px; }
+.ui-icon-circlesmall-close { background-position: -32px -208px; }
+.ui-icon-squaresmall-plus { background-position: -48px -208px; }
+.ui-icon-squaresmall-minus { background-position: -64px -208px; }
+.ui-icon-squaresmall-close { background-position: -80px -208px; }
+.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
+.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
+.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
+.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
+.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
+.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
+
+
+/* Misc visuals
+----------------------------------*/
+
+/* Corner radius */
+.ui-corner-tl { -moz-border-radius-topleft: 5px; -webkit-border-top-left-radius: 5px; border-top-left-radius: 5px; }
+.ui-corner-tr { -moz-border-radius-topright: 5px; -webkit-border-top-right-radius: 5px; border-top-right-radius: 5px; }
+.ui-corner-bl { -moz-border-radius-bottomleft: 5px; -webkit-border-bottom-left-radius: 5px; border-bottom-left-radius: 5px; }
+.ui-corner-br { -moz-border-radius-bottomright: 5px; -webkit-border-bottom-right-radius: 5px; border-bottom-right-radius: 5px; }
+.ui-corner-top { -moz-border-radius-topleft: 5px; -webkit-border-top-left-radius: 5px; border-top-left-radius: 5px; -moz-border-radius-topright: 5px; -webkit-border-top-right-radius: 5px; border-top-right-radius: 5px; }
+.ui-corner-bottom { -moz-border-radius-bottomleft: 5px; -webkit-border-bottom-left-radius: 5px; border-bottom-left-radius: 5px; -moz-border-radius-bottomright: 5px; -webkit-border-bottom-right-radius: 5px; border-bottom-right-radius: 5px; }
+.ui-corner-right {  -moz-border-radius-topright: 5px; -webkit-border-top-right-radius: 5px; border-top-right-radius: 5px; -moz-border-radius-bottomright: 5px; -webkit-border-bottom-right-radius: 5px; border-bottom-right-radius: 5px; }
+.ui-corner-left { -moz-border-radius-topleft: 5px; -webkit-border-top-left-radius: 5px; border-top-left-radius: 5px; -moz-border-radius-bottomleft: 5px; -webkit-border-bottom-left-radius: 5px; border-bottom-left-radius: 5px; }
+.ui-corner-all { -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; }
+
+/* Overlays */
+.ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); }
+.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }/* Resizable
+----------------------------------*/
+.ui-resizable { position: relative;}
+.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;}
+.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
+.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
+.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
+.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }
+.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }
+.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
+.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
+.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
+.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/* Accordion
+----------------------------------*/
+.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
+.ui-accordion .ui-accordion-li-fix { display: inline; }
+.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }
+.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; }
+/* IE7-/Win - Fix extra vertical space in lists */
+.ui-accordion a { zoom: 1; }
+.ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; }
+.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
+.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; }
+.ui-accordion .ui-accordion-content-active { display: block; }/* Autocomplete
+----------------------------------*/
+.ui-autocomplete { position: absolute; cursor: default; }	
+.ui-autocomplete-loading { background: white url('images/ui-anim_basic_16x16.gif') right center no-repeat; }
+
+/* workarounds */
+* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
+
+/* Menu
+----------------------------------*/
+.ui-menu {
+	list-style:none;
+	padding: 2px;
+	margin: 0;
+	display:block;
+}
+.ui-menu .ui-menu {
+	margin-top: -3px;
+}
+.ui-menu .ui-menu-item {
+	margin:0;
+	padding: 0;
+	zoom: 1;
+	float: left;
+	clear: left;
+	width: 100%;
+}
+.ui-menu .ui-menu-item a {
+	text-decoration:none;
+	display:block;
+	padding:.2em .4em;
+	line-height:1.5;
+	zoom:1;
+}
+.ui-menu .ui-menu-item a.ui-state-hover,
+.ui-menu .ui-menu-item a.ui-state-active {
+	font-weight: normal;
+	margin: -1px;
+}
+/* Button
+----------------------------------*/
+
+.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */
+.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
+button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
+.ui-button-icons-only { width: 3.4em; } 
+button.ui-button-icons-only { width: 3.7em; } 
+
+/*button text element */
+.ui-button .ui-button-text { display: block; line-height: 1.4;  }
+.ui-button-text-only .ui-button-text { padding: .4em 1em; }
+.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }
+.ui-button-text-icon .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }
+.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }
+/* no icon support for input elements, provide padding by default */
+input.ui-button { padding: .4em 1em; }
+
+/*button icon element(s) */
+.ui-button-icon-only .ui-icon, .ui-button-text-icon .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }
+.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }
+.ui-button-text-icon .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }
+.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
+
+/*button sets*/
+.ui-buttonset { margin-right: 7px; }
+.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; }
+
+/* workarounds */
+button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */
+
+
+
+
+
+/* Dialog
+----------------------------------*/
+.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; }
+.ui-dialog .ui-dialog-titlebar { padding: .5em 1em .3em; position: relative;  }
+.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .2em 0; } 
+.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
+.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
+.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
+.ui-dialog .ui-dialog-content { border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
+.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
+.ui-dialog .ui-dialog-buttonpane button { float: right; margin: .5em .4em .5em 0; cursor: pointer; padding: .2em .6em .3em .6em; line-height: 1.4em; width:auto; overflow:visible; }
+.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
+.ui-draggable .ui-dialog-titlebar { cursor: move; }
+/* Slider
+----------------------------------*/
+.ui-slider { position: relative; text-align: left; }
+.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
+.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
+
+.ui-slider-horizontal { height: .8em; }
+.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
+.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
+.ui-slider-horizontal .ui-slider-range-min { left: 0; }
+.ui-slider-horizontal .ui-slider-range-max { right: 0; }
+
+.ui-slider-vertical { width: .8em; height: 100px; }
+.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
+.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
+.ui-slider-vertical .ui-slider-range-min { bottom: 0; }
+.ui-slider-vertical .ui-slider-range-max { top: 0; }/* Tabs
+----------------------------------*/
+.ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
+.ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; }
+.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; }
+.ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; }
+.ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; }
+.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; }
+.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
+.ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; }
+.ui-tabs .ui-tabs-hide { display: none !important; }
+/* Datepicker
+----------------------------------*/
+.ui-datepicker { width: 17em; padding: .2em .2em 0; }
+.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
+.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
+.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
+.ui-datepicker .ui-datepicker-prev { left:2px; }
+.ui-datepicker .ui-datepicker-next { right:2px; }
+.ui-datepicker .ui-datepicker-prev-hover { left:1px; }
+.ui-datepicker .ui-datepicker-next-hover { right:1px; }
+.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px;  }
+.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
+.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
+.ui-datepicker select.ui-datepicker-month-year {width: 100%;}
+.ui-datepicker select.ui-datepicker-month, 
+.ui-datepicker select.ui-datepicker-year { width: 49%;}
+.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
+.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0;  }
+.ui-datepicker td { border: 0; padding: 1px; }
+.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
+.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
+.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
+.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
+
+/* with multiple calendars */
+.ui-datepicker.ui-datepicker-multi { width:auto; }
+.ui-datepicker-multi .ui-datepicker-group { float:left; }
+.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
+.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
+.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
+.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
+.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
+.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
+.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
+.ui-datepicker-row-break { clear:both; width:100%; }
+
+/* RTL support */
+.ui-datepicker-rtl { direction: rtl; }
+.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
+.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
+.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
+.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
+.ui-datepicker-rtl .ui-datepicker-group { float:right; }
+.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
+.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
+
+/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
+.ui-datepicker-cover {
+    display: none; /*sorry for IE5*/
+    display/**/: block; /*sorry for IE5*/
+    position: absolute; /*must have*/
+    z-index: -1; /*must have*/
+    filter: mask(); /*must have*/
+    top: -4px; /*must have*/
+    left: -4px; /*must have*/
+    width: 200px; /*must have*/
+    height: 200px; /*must have*/
+}/* Progressbar
+----------------------------------*/
+.ui-progressbar { height:2em; text-align: left; }
+.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }
Index: trunk/prototype/plugins/jqgrid/css/ui.multiselect.css
===================================================================
--- trunk/prototype/plugins/jqgrid/css/ui.multiselect.css	(revision 5136)
+++ trunk/prototype/plugins/jqgrid/css/ui.multiselect.css	(revision 5136)
@@ -0,0 +1,30 @@
+/* Multiselect
+----------------------------------*/
+
+.ui-multiselect { border: solid 1px; font-size: 0.8em; }
+.ui-multiselect ul { -moz-user-select: none; }
+.ui-multiselect li { margin: 0; padding: 0; cursor: default; line-height: 20px; height: 20px; font-size: 11px; list-style: none; }
+.ui-multiselect li a { color: #999; text-decoration: none; padding: 0; display: block; float: left; cursor: pointer;}
+.ui-multiselect li.ui-draggable-dragging { padding-left: 10px; }
+
+.ui-multiselect div.selected { position: relative; padding: 0; margin: 0; border: 0; float:left; }
+.ui-multiselect ul.selected { position: relative; padding: 0; overflow: auto; overflow-x: hidden; background: #fff; margin: 0; list-style: none; border: 0; position: relative; width: 100%; }
+.ui-multiselect ul.selected li { }
+
+.ui-multiselect div.available { position: relative; padding: 0; margin: 0; border: 0; float:left; border-left: 1px solid; }
+.ui-multiselect ul.available { position: relative; padding: 0; overflow: auto; overflow-x: hidden; background: #fff; margin: 0; list-style: none; border: 0; width: 100%; }
+.ui-multiselect ul.available li { padding-left: 10px; }
+ 
+.ui-multiselect .ui-state-default { border: none; margin-bottom: 1px; position: relative; padding-left: 20px;}
+.ui-multiselect .ui-state-hover { border: none; }
+.ui-multiselect .ui-widget-header {border: none; font-size: 11px; margin-bottom: 1px;}
+ 
+.ui-multiselect .add-all { float: right; padding: 7px;}
+.ui-multiselect .remove-all { float: right; padding: 7px;}
+.ui-multiselect .search { float: left; padding: 4px;}
+.ui-multiselect .count { float: left; padding: 7px;}
+
+.ui-multiselect li span.ui-icon-arrowthick-2-n-s { position: absolute; left: 2px; }
+.ui-multiselect li a.action { position: absolute; right: 2px; top: 2px; }
+ 
+.ui-multiselect input.search { height: 14px; padding: 1px; opacity: 0.5; margin: 4px; width: 100px; }
Index: trunk/prototype/plugins/jqgrid/js/i18n/grid.locale-pt.js
===================================================================
--- trunk/prototype/plugins/jqgrid/js/i18n/grid.locale-pt.js	(revision 5136)
+++ trunk/prototype/plugins/jqgrid/js/i18n/grid.locale-pt.js	(revision 5136)
@@ -0,0 +1,125 @@
+;(function($){
+/**
+ * jqGrid Portuguese Translation
+* Tradução da jqGrid em Portugues por Frederico Carvalho, http://www.eyeviewdesign.pt
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+**/
+$.jgrid = {
+	defaults : {
+		recordtext: "View {0} - {1} of {2}",
+	    emptyrecords: "No records to view",
+		loadtext: "A carregar...",
+		pgtext : "Page {0} of {1}"
+	},
+	search : {
+	    caption: "Busca...",
+	    Find: "Procurar",
+	    Reset: "Limpar",
+	    odata : ['equal', 'not equal', 'less', 'less or equal','greater','greater or equal', 'begins with','does not begin with','is in','is not in','ends with','does not end with','contains','does not contain'],
+	    groupOps: [	{ op: "AND", text: "all" },	{ op: "OR",  text: "any" }	],
+		matchText: " match",
+		rulesText: " rules"
+	},
+	edit : {
+	    addCaption: "Adicionar Registo",
+	    editCaption: "Modificar Registo",
+	    bSubmit: "Submeter",
+	    bCancel: "Cancelar",
+		bClose: "Fechar",
+		saveData: "Data has been changed! Save changes?",
+		bYes : "Yes",
+		bNo : "No",
+		bExit : "Cancel",
+	    msg: {
+	        required:"Campo obrigatório",
+	        number:"Por favor, introduza um numero",
+	        minValue:"O valor deve ser maior ou igual que",
+	        maxValue:"O valor deve ser menor ou igual a",
+	        email: "Não é um endereço de email válido",
+	        integer: "Por favor, introduza um numero inteiro",
+			url: "is not a valid URL. Prefix required ('http://' or 'https://')",
+			nodefined : " is not defined!",
+			novalue : " return value is required!",
+			customarray : "Custom function should return array!",
+			customfcheck : "Custom function should be present in case of custom checking!"
+		}
+	},
+	view : {
+	    caption: "View Record",
+	    bClose: "Close"
+	},
+	del : {
+	    caption: "Eliminar",
+	    msg: "Deseja eliminar o(s) registo(s) seleccionado(s)?",
+	    bSubmit: "Eliminar",
+	    bCancel: "Cancelar"
+	},
+	nav : {
+		edittext: " ",
+	    edittitle: "Modificar registo seleccionado",
+		addtext:" ",
+	    addtitle: "Adicionar novo registo",
+	    deltext: " ",
+	    deltitle: "Eliminar registo seleccionado",
+	    searchtext: " ",
+	    searchtitle: "Procurar",
+	    refreshtext: "",
+	    refreshtitle: "Actualizar",
+	    alertcap: "Aviso",
+	    alerttext: "Por favor, seleccione um registo",
+		viewtext: "",
+		viewtitle: "View selected row"
+	},
+	col : {
+	    caption: "Mostrar/Ocultar Colunas",
+	    bSubmit: "Enviar",
+	    bCancel: "Cancelar"	
+	},
+	errors : {
+		errcap : "Erro",
+		nourl : "Não especificou um url",
+		norecords: "Não existem dados para processar",
+	    model : "Tamanho do colNames <> colModel!"
+	},
+	formatter : {
+		integer : {thousandsSeparator: " ", defaultValue: '0'},
+		number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'},
+		currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'},
+		date : {
+			dayNames:   [
+				"Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sab",
+				"Domingo", "Segunda-Feira", "Terça-Feira", "Quarta-Feira", "Quinta-Feira", "Sexta-Feira", "Sábado"
+			],
+			monthNames: [
+				"Jan", "Fev", "Mar", "Abr", "Mai", "Jun", "Jul", "Ago", "Set", "Out", "Nov", "Dez",
+				"Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"
+			],
+			AmPm : ["am","pm","AM","PM"],
+			S: function (j) {return j < 11 || j > 13 ? ['º', 'º', 'º', 'º'][Math.min((j - 1) % 10, 3)] : 'º'},
+			srcformat: 'Y-m-d',
+			newformat: 'd/m/Y',
+			masks : {
+	            ISO8601Long:"Y-m-d H:i:s",
+	            ISO8601Short:"Y-m-d",
+	            ShortDate: "n/j/Y",
+	            LongDate: "l, F d, Y",
+	            FullDateTime: "l, F d, Y g:i:s A",
+	            MonthDay: "F d",
+	            ShortTime: "g:i A",
+	            LongTime: "g:i:s A",
+	            SortableDateTime: "Y-m-d\\TH:i:s",
+	            UniversalSortableDateTime: "Y-m-d H:i:sO",
+	            YearMonth: "F, Y"
+	        },
+	        reformatAfterEdit : false
+		},
+		baseLinkUrl: '',
+		showAction: '',
+	    target: '',
+	    checkbox : {disabled:true},
+		idName : 'id'
+	}
+};
+})(jQuery);
Index: trunk/prototype/plugins/jqgrid/js/i18n/grid.locale-pt-br.js
===================================================================
--- trunk/prototype/plugins/jqgrid/js/i18n/grid.locale-pt-br.js	(revision 5136)
+++ trunk/prototype/plugins/jqgrid/js/i18n/grid.locale-pt-br.js	(revision 5136)
@@ -0,0 +1,127 @@
+;(function($){
+/**
+ * jqGrid Brazilian-Portuguese Translation
+ * Sergio Righi sergio.righi@gmail.com
+ * http://curve.com.br
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+**/
+$.jgrid = {
+	defaults : {
+		recordtext: "Ver {0} - {1} of {2}",
+	    emptyrecords: "Nenhum registro para visualizar",
+		loadtext: "Carregando...",
+		pgtext : "Página {0} de {1}"
+	},
+	search : {
+	    caption: "Procurar...",
+	    Find: "Procurar",
+	    Reset: "Resetar",
+	    odata : ['equal', 'not equal', 'less', 'less or equal','greater','greater or equal', 'begins with','does not begin with','is in','is not in','ends with','does not end with','contains','does not contain'],
+	    groupOps: [	{ op: "AND", text: "all" },	{ op: "OR",  text: "any" }	],
+		matchText: " iguala",
+		rulesText: " regras"
+	},
+	edit : {
+	    addCaption: "Incluir",
+	    editCaption: "Alterar",
+	    bSubmit: "Enviar",
+	    bCancel: "Cancelar",
+		bClose: "Fechar",
+		saveData: "Os dados foram alterados! Salvar alterações?",
+		bYes : "Sim",
+		bNo : "Não",
+		bExit : "Cancelar",
+	    msg: {
+	        required:"Campo obrigatório",
+	        number:"Por favor, informe um número válido",
+	        minValue:"valor deve ser igual ou maior que ",
+	        maxValue:"valor deve ser menor ou igual a",
+	        email: "este e-mail não é válido",
+	        integer: "Por favor, informe um valor inteiro",
+			date: "Por favor, informe uma data válida",
+			url: "não é uma URL válida. Prefixo obrigatório ('http://' ou 'https://')",
+			nodefined : " não está definido!",
+			novalue : " um valor de retorno é obrigatório!",
+			customarray : "Função customizada deve retornar um array!",
+			customfcheck : "Função customizada deve estar presente em caso de validação customizada!"
+		}
+	},
+	view : {
+	    caption: "Ver Registro",
+	    bClose: "Fechar"
+	},
+	del : {
+    caption: "Apagar",
+	    msg: "Apagar registros selecionado(s)?",
+	    bSubmit: "Apagar",
+	    bCancel: "Cancelar"
+	},
+	nav : {
+		edittext: " ",
+	    edittitle: "Alterar registro selecionado",
+		addtext:" ",
+	    addtitle: "Incluir novo registro",
+	    deltext: " ",
+	    deltitle: "Apagar registro selecionado",
+	    searchtext: " ",
+	    searchtitle: "Procurar registros",
+	    refreshtext: "",
+	    refreshtitle: "Recarrgando Tabela",
+	    alertcap: "Aviso",
+	    alerttext: "Por favor, selecione um registro",
+		viewtext: "",
+		viewtitle: "Ver linha selecionada"
+	},
+	col : {
+	    caption: "Mostrar/Esconder Colunas",
+	    bSubmit: "Enviar",
+	    bCancel: "Cancelar"
+	},
+	errors : {
+		errcap : "Erro",
+		nourl : "Nenhuma URL defenida",
+		norecords: "Sem registros para exibir",
+	    model : "Comprimento de colNames <> colModel!"
+	},
+	formatter : {
+		integer : {thousandsSeparator: " ", defaultValue: '0'},
+		number : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0,00'},
+		currency : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, prefix: "R$ ", suffix:"", defaultValue: '0,00'},
+		date : {
+			dayNames:   [
+				"Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb",
+				"Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado"
+			],
+			monthNames: [
+				"Jan", "Fev", "Mar", "Abr", "Mai", "Jun", "Jul", "Ago", "Set", "Out", "Nov", "Dez",
+				"Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"
+			],
+			AmPm : ["am","pm","AM","PM"],
+			S: function (j) {return j < 11 || j > 13 ? ['º', 'º', 'º', 'º'][Math.min((j - 1) % 10, 3)] : 'º'},
+			srcformat: 'Y-m-d',
+			newformat: 'd/m/Y',
+			masks : {
+	            ISO8601Long:"Y-m-d H:i:s",
+	            ISO8601Short:"Y-m-d",
+	            ShortDate: "n/j/Y",
+	            LongDate: "l, F d, Y",
+	            FullDateTime: "l, F d, Y g:i:s A",
+	            MonthDay: "F d",
+	            ShortTime: "g:i A",
+	            LongTime: "g:i:s A",
+	            SortableDateTime: "Y-m-d\\TH:i:s",
+	            UniversalSortableDateTime: "Y-m-d H:i:sO",
+	            YearMonth: "F, Y"
+	        },
+	        reformatAfterEdit : false
+		},
+		baseLinkUrl: '',
+		showAction: '',
+	    target: '',
+	    checkbox : {disabled:true},
+		idName : 'id'
+	}
+};
+})(jQuery);
Index: trunk/prototype/plugins/jqgrid/js/i18n/grid.locale-es.js
===================================================================
--- trunk/prototype/plugins/jqgrid/js/i18n/grid.locale-es.js	(revision 5136)
+++ trunk/prototype/plugins/jqgrid/js/i18n/grid.locale-es.js	(revision 5136)
@@ -0,0 +1,128 @@
+;(function($){
+/**
+ * jqGrid Spanish Translation
+ * Traduccion jqGrid en EspaÃ±ol por Yamil Bracho
+ * Traduccion corregida y ampliada por Faserline, S.L. 
+ * http://www.faserline.com
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+**/
+$.jgrid = {
+	defaults : {
+		recordtext: "Mostrando {0} - {1} de {2}",
+	    emptyrecords: "Sin registros que mostrar",
+		loadtext: "Cargando...",
+		pgtext : "PÃ¡gina {0} de {1}"
+	},
+	search : {
+	    caption: "BÃºsqueda...",
+	    Find: "Buscar",
+	    Reset: "Limpiar",
+	    odata : ['igual ', 'no igual a', 'menor que', 'menor o igual que','mayor que','mayor o igual a', 'empiece por','no empiece por','estÃ¡ en','no estÃ¡ en','termina por','no termina por','contiene','no contiene'],
+	    groupOps: [	{ op: "AND", text: "todo" },	{ op: "OR",  text: "cualquier" }	],
+		matchText: " match",
+		rulesText: " reglas"
+	},
+	edit : {
+	    addCaption: "Agregar registro",
+	    editCaption: "Modificar registro",
+	    bSubmit: "Guardar",
+	    bCancel: "Cancelar",
+		bClose: "Cerrar",
+		saveData: "Se han modificado los datos, Â¿guardar cambios?",
+		bYes : "Si",
+		bNo : "No",
+		bExit : "Cancelar",
+	    msg: {
+	        required:"Campo obligatorio",
+	        number:"Introduzca un nÃºmero",
+	        minValue:"El valor debe ser mayor o igual a ",
+	        maxValue:"El valor debe ser menor o igual a ",
+	        email: "no es una direcciÃ³n de correo vÃ¡lida",
+	        integer: "Introduzca un valor entero",
+			date: "Introduza una fecha correcta ",
+			url: "no es una URL vÃ¡lida. Prefijo requerido ('http://' or 'https://')",
+			nodefined : " no estÃ¡ definido.",
+			novalue : " valor de retorno es requerido.",
+			customarray : "La funciÃ³n personalizada debe devolver un array.",
+			customfcheck : "La funciÃ³n personalizada debe estar presente en el caso de validaciÃ³n personalizada."
+		}
+	},
+	view : {
+	    caption: "Consultar registro",
+	    bClose: "Cerrar"
+	},
+	del : {
+	    caption: "Eliminar",
+	    msg: "Â¿Desea eliminar los registros seleccionados?",
+	    bSubmit: "Eliminar",
+	    bCancel: "Cancelar"
+	},
+	nav : {
+		edittext: " ",
+	    edittitle: "Modificar fila seleccionada",
+		addtext:" ",
+	    addtitle: "Agregar nueva fila",
+	    deltext: " ",
+	    deltitle: "Eliminar fila seleccionada",
+	    searchtext: " ",
+	    searchtitle: "Buscar informaciÃ³n",
+	    refreshtext: "",
+	    refreshtitle: "Recargar datos",
+	    alertcap: "Aviso",
+	    alerttext: "Seleccione una fila",
+		viewtext: "",
+		viewtitle: "Ver fila seleccionada"
+	},
+	col : {
+	    caption: "Mostrar/ocultar columnas",
+	    bSubmit: "Enviar",
+	    bCancel: "Cancelar"	
+	},
+	errors : {
+		errcap : "Error",
+		nourl : "No se ha especificado una URL",
+		norecords: "No hay datos para procesar",
+	    model : "Las columnas de nombres son diferentes de las columnas de modelo"
+	},
+	formatter : {
+		integer : {thousandsSeparator: ".", defaultValue: '0'},
+		number : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, defaultValue: '0,00'},
+		currency : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'},
+		date : {
+			dayNames:   [
+				"Do", "Lu", "Ma", "Mi", "Ju", "Vi", "Sa",
+				"Domingo", "Lunes", "Martes", "Miercoles", "Jueves", "Viernes", "Sabado"
+			],
+			monthNames: [
+				"Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic",
+				"Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"
+			],
+			AmPm : ["am","pm","AM","PM"],
+			S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
+			srcformat: 'Y-m-d',
+			newformat: 'd-m-Y',
+			masks : {
+	            ISO8601Long:"Y-m-d H:i:s",
+	            ISO8601Short:"Y-m-d",
+	            ShortDate: "n/j/Y",
+	            LongDate: "l, F d, Y",
+	            FullDateTime: "l, F d, Y g:i:s A",
+	            MonthDay: "F d",
+	            ShortTime: "g:i A",
+	            LongTime: "g:i:s A",
+	            SortableDateTime: "Y-m-d\\TH:i:s",
+	            UniversalSortableDateTime: "Y-m-d H:i:sO",
+	            YearMonth: "F, Y"
+	        },
+	        reformatAfterEdit : false
+		},
+		baseLinkUrl: '',
+		showAction: '',
+	    target: '',
+	    checkbox : {disabled:true},
+		idName : 'id'
+	}
+};
+})(jQuery);
Index: trunk/prototype/plugins/jqgrid/js/i18n/grid.locale-en.js
===================================================================
--- trunk/prototype/plugins/jqgrid/js/i18n/grid.locale-en.js	(revision 5136)
+++ trunk/prototype/plugins/jqgrid/js/i18n/grid.locale-en.js	(revision 5136)
@@ -0,0 +1,128 @@
+;(function($){
+/**
+ * jqGrid English Translation
+ * Tony Tomov tony@trirand.com
+ * http://trirand.com/blog/ 
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+**/
+$.jgrid = {
+	defaults : {
+		recordtext: "View {0} - {1} of {2}",
+		emptyrecords: "No records to view",
+		loadtext: "Loading...",
+		pgtext : "Page {0} of {1}"
+	},
+	search : {
+		caption: "Search...",
+		Find: "Find",
+		Reset: "Reset",
+		odata : ['equal', 'not equal', 'less', 'less or equal','greater','greater or equal', 'begins with','does not begin with','is in','is not in','ends with','does not end with','contains','does not contain'],
+		groupOps: [	{ op: "AND", text: "all" },	{ op: "OR",  text: "any" }	],
+		matchText: " match",
+		rulesText: " rules"
+	},
+	edit : {
+		addCaption: "Add Record",
+		editCaption: "Edit Record",
+		bSubmit: "Submit",
+		bCancel: "Cancel",
+		bClose: "Close",
+		saveData: "Data has been changed! Save changes?",
+		bYes : "Yes",
+		bNo : "No",
+		bExit : "Cancel",
+		msg: {
+			required:"Field is required",
+			number:"Please, enter valid number",
+			minValue:"value must be greater than or equal to ",
+			maxValue:"value must be less than or equal to",
+			email: "is not a valid e-mail",
+			integer: "Please, enter valid integer value",
+			date: "Please, enter valid date value",
+			url: "is not a valid URL. Prefix required ('http://' or 'https://')",
+			nodefined : " is not defined!",
+			novalue : " return value is required!",
+			customarray : "Custom function should return array!",
+			customfcheck : "Custom function should be present in case of custom checking!"
+			
+		}
+	},
+	view : {
+		caption: "View Record",
+		bClose: "Close"
+	},
+	del : {
+		caption: "Delete",
+		msg: "Delete selected record(s)?",
+		bSubmit: "Delete",
+		bCancel: "Cancel"
+	},
+	nav : {
+		edittext: "",
+		edittitle: "Edit selected row",
+		addtext:"",
+		addtitle: "Add new row",
+		deltext: "",
+		deltitle: "Delete selected row",
+		searchtext: "",
+		searchtitle: "Find records",
+		refreshtext: "",
+		refreshtitle: "Reload Grid",
+		alertcap: "Warning",
+		alerttext: "Please, select row",
+		viewtext: "",
+		viewtitle: "View selected row"
+	},
+	col : {
+		caption: "Select columns",
+		bSubmit: "Ok",
+		bCancel: "Cancel"
+	},
+	errors : {
+		errcap : "Error",
+		nourl : "No url is set",
+		norecords: "No records to process",
+		model : "Length of colNames <> colModel!"
+	},
+	formatter : {
+		integer : {thousandsSeparator: " ", defaultValue: '0'},
+		number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'},
+		currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'},
+		date : {
+			dayNames:   [
+				"Sun", "Mon", "Tue", "Wed", "Thr", "Fri", "Sat",
+				"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
+			],
+			monthNames: [
+				"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
+				"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
+			],
+			AmPm : ["am","pm","AM","PM"],
+			S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
+			srcformat: 'Y-m-d',
+			newformat: 'd/m/Y',
+			masks : {
+				ISO8601Long:"Y-m-d H:i:s",
+				ISO8601Short:"Y-m-d",
+				ShortDate: "n/j/Y",
+				LongDate: "l, F d, Y",
+				FullDateTime: "l, F d, Y g:i:s A",
+				MonthDay: "F d",
+				ShortTime: "g:i A",
+				LongTime: "g:i:s A",
+				SortableDateTime: "Y-m-d\\TH:i:s",
+				UniversalSortableDateTime: "Y-m-d H:i:sO",
+				YearMonth: "F, Y"
+			},
+			reformatAfterEdit : false
+		},
+		baseLinkUrl: '',
+		showAction: '',
+		target: '',
+		checkbox : {disabled:true},
+		idName : 'id'
+	}
+};
+})(jQuery);
Index: trunk/prototype/plugins/jqgrid/js/jquery.jqGrid.min.js
===================================================================
--- trunk/prototype/plugins/jqgrid/js/jquery.jqGrid.min.js	(revision 5136)
+++ trunk/prototype/plugins/jqgrid/js/jquery.jqGrid.min.js	(revision 5136)
@@ -0,0 +1,467 @@
+/* 
+* jqGrid  4.1.2 - jQuery Grid 
+* Copyright (c) 2008, Tony Tomov, tony@trirand.com 
+* Dual licensed under the MIT and GPL licenses 
+* http://www.opensource.org/licenses/mit-license.php 
+* http://www.gnu.org/licenses/gpl-2.0.html 
+* Date:2011-07-20 
+* Modules: grid.base.js; jquery.fmatter.js; grid.custom.js; grid.common.js; grid.formedit.js; grid.filter.js; grid.inlinedit.js; grid.celledit.js; jqModal.js; jqDnR.js; grid.subgrid.js; grid.grouping.js; grid.treegrid.js; grid.import.js; JsonXml.js; grid.tbltogrid.js; grid.jqueryui.js; 
+*/
+(function(b){b.jgrid=b.jgrid||{};b.extend(b.jgrid,{htmlDecode:function(f){if(f&&(f=="&nbsp;"||f=="&#160;"||f.length==1&&f.charCodeAt(0)==160))return"";return!f?f:String(f).replace(/&amp;/g,"&").replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&quot;/g,'"')},htmlEncode:function(f){return!f?f:String(f).replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/\"/g,"&quot;")},format:function(f){var j=b.makeArray(arguments).slice(1);if(f===undefined)f="";return f.replace(/\{(\d+)\}/g,
+function(h,c){return j[c]})},getCellIndex:function(f){f=b(f);if(f.is("tr"))return-1;f=(!f.is("td")&&!f.is("th")?f.closest("td,th"):f)[0];if(b.browser.msie)return b.inArray(f,f.parentNode.cells);return f.cellIndex},stripHtml:function(f){f+="";var j=/<("[^"]*"|'[^']*'|[^'">])*>/gi;if(f)return(f=f.replace(j,""))&&f!=="&nbsp;"&&f!=="&#160;"?f.replace(/\"/g,"'"):"";else return f},stringToDoc:function(f){var j;if(typeof f!=="string")return f;try{j=(new DOMParser).parseFromString(f,"text/xml")}catch(h){j=
+new ActiveXObject("Microsoft.XMLDOM");j.async=false;j.loadXML(f)}return j&&j.documentElement&&j.documentElement.tagName!="parsererror"?j:null},parse:function(f){if(f.substr(0,9)=="while(1);")f=f.substr(9);if(f.substr(0,2)=="/*")f=f.substr(2,f.length-4);f||(f="{}");return b.jgrid.useJSON===true&&typeof JSON==="object"&&typeof JSON.parse==="function"?JSON.parse(f):eval("("+f+")")},parseDate:function(f,j){var h={m:1,d:1,y:1970,h:0,i:0,s:0},c,g,k;c=/[\\\/:_;.,\t\T\s-]/;if(j&&j!==null&&j!==undefined){j=
+b.trim(j);j=j.split(c);f=f.split(c);var l=b.jgrid.formatter.date.monthNames,a=b.jgrid.formatter.date.AmPm,q=function(x,y){if(x===0){if(y==12)y=0}else if(y!=12)y+=12;return y};c=0;for(g=f.length;c<g;c++){if(f[c]=="M"){k=b.inArray(j[c],l);if(k!==-1&&k<12)j[c]=k+1}if(f[c]=="F"){k=b.inArray(j[c],l);if(k!==-1&&k>11)j[c]=k+1-12}if(f[c]=="a"){k=b.inArray(j[c],a);if(k!==-1&&k<2&&j[c]==a[k]){j[c]=k;h.h=q(j[c],h.h)}}if(f[c]=="A"){k=b.inArray(j[c],a);if(k!==-1&&k>1&&j[c]==a[k]){j[c]=k-2;h.h=q(j[c],h.h)}}if(j[c]!==
+undefined)h[f[c].toLowerCase()]=parseInt(j[c],10)}h.m=parseInt(h.m,10)-1;c=h.y;if(c>=70&&c<=99)h.y=1900+h.y;else if(c>=0&&c<=69)h.y=2E3+h.y}return new Date(h.y,h.m,h.d,h.h,h.i,h.s,0)},jqID:function(f){return String(f).replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~]/g,"\\$&")},guid:1,uidPref:"jqg",randId:function(f){return(f?f:b.jgrid.uidPref)+b.jgrid.guid++},getAccessor:function(f,j){var h,c,g=[],k;if(typeof j==="function")return j(f);h=f[j];if(h===undefined)try{if(typeof j==="string")g=j.split(".");
+if(k=g.length)for(h=f;h&&k--;){c=g.shift();h=h[c]}}catch(l){}return h},ajaxOptions:{},from:function(f){return new function(j,h){if(typeof j=="string")j=b.data(j);var c=this,g=j,k=true,l=false,a=h,q=/[\$,%]/g,x=null,y=null,H=0,L=false,M="",P=[],U=true;if(typeof j=="object"&&j.push){if(j.length>0)U=typeof j[0]!="object"?false:true}else throw"data provides is not an array";this._hasData=function(){return g===null?false:g.length===0?false:true};this._getStr=function(o){var m=[];l&&m.push("jQuery.trim(");
+m.push("String("+o+")");l&&m.push(")");k||m.push(".toLowerCase()");return m.join("")};this._strComp=function(o){return typeof o=="string"?".toString()":""};this._group=function(o,m){return{field:o.toString(),unique:m,items:[]}};this._toStr=function(o){if(l)o=b.trim(o);k||(o=o.toLowerCase());return o=o.toString().replace(/\\/g,"\\\\").replace(/\"/g,'\\"')};this._funcLoop=function(o){var m=[];b.each(g,function(r,D){m.push(o(D))});return m};this._append=function(o){var m;if(a===null)a="";else a+=M===
+""?" && ":M;for(m=0;m<H;m++)a+="(";if(L)a+="!";a+="("+o+")";L=false;M="";H=0};this._setCommand=function(o,m){x=o;y=m};this._resetNegate=function(){L=false};this._repeatCommand=function(o,m){if(x===null)return c;if(o!==null&&m!==null)return x(o,m);if(y===null)return x(o);if(!U)return x(o);return x(y,o)};this._equals=function(o,m){return c._compare(o,m,1)===0};this._compare=function(o,m,r){if(r===undefined)r=1;if(o===undefined)o=null;if(m===undefined)m=null;if(o===null&&m===null)return 0;if(o===null&&
+m!==null)return 1;if(o!==null&&m===null)return-1;if(!k&&typeof o!=="number"&&typeof m!=="number"){o=String(o).toLowerCase();m=String(m).toLowerCase()}if(o<m)return-r;if(o>m)return r;return 0};this._performSort=function(){if(P.length!==0)g=c._doSort(g,0)};this._doSort=function(o,m){var r=P[m].by,D=P[m].dir,T=P[m].type,I=P[m].datefmt;if(m==P.length-1)return c._getOrder(o,r,D,T,I);m++;r=c._getGroup(o,r,D,T,I);D=[];for(T=0;T<r.length;T++){I=c._doSort(r[T].items,m);for(var C=0;C<I.length;C++)D.push(I[C])}return D};
+this._getOrder=function(o,m,r,D,T){var I=[],C=[],ca=r=="a"?1:-1,V,fa;if(D===undefined)D="text";fa=D=="float"||D=="number"||D=="currency"||D=="numeric"?function(R){R=parseFloat(String(R).replace(q,""));return isNaN(R)?0:R}:D=="int"||D=="integer"?function(R){return R?parseFloat(String(R).replace(q,"")):0}:D=="date"||D=="datetime"?function(R){return b.jgrid.parseDate(T,R).getTime()}:b.isFunction(D)?D:function(R){R||(R="");return b.trim(String(R).toUpperCase())};b.each(o,function(R,$){V=m!==""?b.jgrid.getAccessor($,
+m):$;if(V===undefined)V="";V=fa(V,$);C.push({vSort:V,index:R})});C.sort(function(R,$){R=R.vSort;$=$.vSort;return c._compare(R,$,ca)});D=0;for(var oa=o.length;D<oa;){r=C[D].index;I.push(o[r]);D++}return I};this._getGroup=function(o,m,r,D,T){var I=[],C=null,ca=null,V;b.each(c._getOrder(o,m,r,D,T),function(fa,oa){V=b.jgrid.getAccessor(oa,m);if(V===undefined)V="";if(!c._equals(ca,V)){ca=V;C!==null&&I.push(C);C=c._group(m,V)}C.items.push(oa)});C!==null&&I.push(C);return I};this.ignoreCase=function(){k=
+false;return c};this.useCase=function(){k=true;return c};this.trim=function(){l=true;return c};this.noTrim=function(){l=false;return c};this.execute=function(){var o=a,m=[];if(o===null)return c;b.each(g,function(){eval(o)&&m.push(this)});g=m;return c};this.data=function(){return g};this.select=function(o){c._performSort();if(!c._hasData())return[];c.execute();if(b.isFunction(o)){var m=[];b.each(g,function(r,D){m.push(o(D))});return m}return g};this.hasMatch=function(){if(!c._hasData())return false;
+c.execute();return g.length>0};this.andNot=function(o,m,r){L=!L;return c.and(o,m,r)};this.orNot=function(o,m,r){L=!L;return c.or(o,m,r)};this.not=function(o,m,r){return c.andNot(o,m,r)};this.and=function(o,m,r){M=" && ";if(o===undefined)return c;return c._repeatCommand(o,m,r)};this.or=function(o,m,r){M=" || ";if(o===undefined)return c;return c._repeatCommand(o,m,r)};this.orBegin=function(){H++;return c};this.orEnd=function(){if(a!==null)a+=")";return c};this.isNot=function(o){L=!L;return c.is(o)};
+this.is=function(o){c._append("this."+o);c._resetNegate();return c};this._compareValues=function(o,m,r,D,T){var I;I=U?"jQuery.jgrid.getAccessor(this,'"+m+"')":"this";if(r===undefined)r=null;var C=r,ca=T.stype===undefined?"text":T.stype;if(r!==null)switch(ca){case "int":case "integer":C=isNaN(Number(C))||C===""?"0":C;I="parseInt("+I+",10)";C="parseInt("+C+",10)";break;case "float":case "number":case "numeric":C=String(C).replace(q,"");C=isNaN(Number(C))||C===""?"0":C;I="parseFloat("+I+")";C="parseFloat("+
+C+")";break;case "date":case "datetime":C=String(b.jgrid.parseDate(T.newfmt||"Y-m-d",C).getTime());I='jQuery.jgrid.parseDate("'+T.srcfmt+'",'+I+").getTime()";break;default:I=c._getStr(I);C=c._getStr('"'+c._toStr(C)+'"')}c._append(I+" "+D+" "+C);c._setCommand(o,m);c._resetNegate();return c};this.equals=function(o,m,r){return c._compareValues(c.equals,o,m,"==",r)};this.notEquals=function(o,m,r){return c._compareValues(c.equals,o,m,"!==",r)};this.isNull=function(o,m,r){return c._compareValues(c.equals,
+o,null,"===",r)};this.greater=function(o,m,r){return c._compareValues(c.greater,o,m,">",r)};this.less=function(o,m,r){return c._compareValues(c.less,o,m,"<",r)};this.greaterOrEquals=function(o,m,r){return c._compareValues(c.greaterOrEquals,o,m,">=",r)};this.lessOrEquals=function(o,m,r){return c._compareValues(c.lessOrEquals,o,m,"<=",r)};this.startsWith=function(o,m){var r=m===undefined||m===null?o:m;r=l?b.trim(r.toString()).length:r.toString().length;if(U)c._append(c._getStr("jQuery.jgrid.getAccessor(this,'"+
+o+"')")+".substr(0,"+r+") == "+c._getStr('"'+c._toStr(m)+'"'));else{r=l?b.trim(m.toString()).length:m.toString().length;c._append(c._getStr("this")+".substr(0,"+r+") == "+c._getStr('"'+c._toStr(o)+'"'))}c._setCommand(c.startsWith,o);c._resetNegate();return c};this.endsWith=function(o,m){var r=m===undefined||m===null?o:m;r=l?b.trim(r.toString()).length:r.toString().length;U?c._append(c._getStr("jQuery.jgrid.getAccessor(this,'"+o+"')")+".substr("+c._getStr("jQuery.jgrid.getAccessor(this,'"+o+"')")+
+".length-"+r+","+r+') == "'+c._toStr(m)+'"'):c._append(c._getStr("this")+".substr("+c._getStr("this")+'.length-"'+c._toStr(o)+'".length,"'+c._toStr(o)+'".length) == "'+c._toStr(o)+'"');c._setCommand(c.endsWith,o);c._resetNegate();return c};this.contains=function(o,m){U?c._append(c._getStr("jQuery.jgrid.getAccessor(this,'"+o+"')")+'.indexOf("'+c._toStr(m)+'",0) > -1'):c._append(c._getStr("this")+'.indexOf("'+c._toStr(o)+'",0) > -1');c._setCommand(c.contains,o);c._resetNegate();return c};this.groupBy=
+function(o,m,r,D){if(!c._hasData())return null;return c._getGroup(g,o,m,r,D)};this.orderBy=function(o,m,r,D){m=m===undefined||m===null?"a":b.trim(m.toString().toLowerCase());if(r===null||r===undefined)r="text";if(D===null||D===undefined)D="Y-m-d";if(m=="desc"||m=="descending")m="d";if(m=="asc"||m=="ascending")m="a";P.push({by:o,dir:m,type:r,datefmt:D});return c};return c}(f,null)},extend:function(f){b.extend(b.fn.jqGrid,f);this.no_legacy_api||b.fn.extend(f)}});b.fn.jqGrid=function(f){if(typeof f==
+"string"){var j=b.jgrid.getAccessor(b.fn.jqGrid,f);if(!j)throw"jqGrid - No such method: "+f;var h=b.makeArray(arguments).slice(1);return j.apply(this,h)}return this.each(function(){if(!this.grid){var c=b.extend(true,{url:"",height:150,page:1,rowNum:20,rowTotal:null,records:0,pager:"",pgbuttons:true,pginput:true,colModel:[],rowList:[],colNames:[],sortorder:"asc",sortname:"",datatype:"xml",mtype:"GET",altRows:false,selarrrow:[],savedRow:[],shrinkToFit:true,xmlReader:{},jsonReader:{},subGrid:false,subGridModel:[],
+reccount:0,lastpage:0,lastsort:0,selrow:null,beforeSelectRow:null,onSelectRow:null,onSortCol:null,ondblClickRow:null,onRightClickRow:null,onPaging:null,onSelectAll:null,loadComplete:null,gridComplete:null,loadError:null,loadBeforeSend:null,afterInsertRow:null,beforeRequest:null,onHeaderClick:null,viewrecords:false,loadonce:false,multiselect:false,multikey:false,editurl:null,search:false,caption:"",hidegrid:true,hiddengrid:false,postData:{},userData:{},treeGrid:false,treeGridModel:"nested",treeReader:{},
+treeANode:-1,ExpandColumn:null,tree_root_level:0,prmNames:{page:"page",rows:"rows",sort:"sidx",order:"sord",search:"_search",nd:"nd",id:"id",oper:"oper",editoper:"edit",addoper:"add",deloper:"del",subgridid:"id",npage:null,totalrows:"totalrows"},forceFit:false,gridstate:"visible",cellEdit:false,cellsubmit:"remote",nv:0,loadui:"enable",toolbar:[false,""],scroll:false,multiboxonly:false,deselectAfterSort:true,scrollrows:false,autowidth:false,scrollOffset:18,cellLayout:5,subGridWidth:20,multiselectWidth:20,
+gridview:false,rownumWidth:25,rownumbers:false,pagerpos:"center",recordpos:"right",footerrow:false,userDataOnFooter:false,hoverrows:true,altclass:"ui-priority-secondary",viewsortcols:[false,"vertical",true],resizeclass:"",autoencode:false,remapColumns:[],ajaxGridOptions:{},direction:"ltr",toppager:false,headertitles:false,scrollTimeout:40,data:[],_index:{},grouping:false,groupingView:{groupField:[],groupOrder:[],groupText:[],groupColumnShow:[],groupSummary:[],showSummaryOnHide:false,sortitems:[],
+sortnames:[],groupDataSorted:false,summary:[],summaryval:[],plusicon:"ui-icon-circlesmall-plus",minusicon:"ui-icon-circlesmall-minus"},ignoreCase:false,cmTemplate:{}},b.jgrid.defaults,f||{}),g={headers:[],cols:[],footers:[],dragStart:function(e,d,i){this.resizing={idx:e,startX:d.clientX,sOL:i[0]};this.hDiv.style.cursor="col-resize";this.curGbox=b("#rs_m"+b.jgrid.jqID(c.id),"#gbox_"+b.jgrid.jqID(c.id));this.curGbox.css({display:"block",left:i[0],top:i[1],height:i[2]});b.isFunction(c.resizeStart)&&
+c.resizeStart.call(this,d,e);document.onselectstart=function(){return false}},dragMove:function(e){if(this.resizing){var d=e.clientX-this.resizing.startX;e=this.headers[this.resizing.idx];var i=c.direction==="ltr"?e.width+d:e.width-d,n;if(i>33){this.curGbox.css({left:this.resizing.sOL+d});if(c.forceFit===true){n=this.headers[this.resizing.idx+c.nv];d=c.direction==="ltr"?n.width-d:n.width+d;if(d>33){e.newWidth=i;n.newWidth=d}}else{this.newWidth=c.direction==="ltr"?c.tblwidth+d:c.tblwidth-d;e.newWidth=
+i}}}},dragEnd:function(){this.hDiv.style.cursor="default";if(this.resizing){var e=this.resizing.idx,d=this.headers[e].newWidth||this.headers[e].width;d=parseInt(d,10);this.resizing=false;b("#rs_m"+b.jgrid.jqID(c.id)).css("display","none");c.colModel[e].width=d;this.headers[e].width=d;this.headers[e].el.style.width=d+"px";this.cols[e].style.width=d+"px";if(this.footers.length>0)this.footers[e].style.width=d+"px";if(c.forceFit===true){d=this.headers[e+c.nv].newWidth||this.headers[e+c.nv].width;this.headers[e+
+c.nv].width=d;this.headers[e+c.nv].el.style.width=d+"px";this.cols[e+c.nv].style.width=d+"px";if(this.footers.length>0)this.footers[e+c.nv].style.width=d+"px";c.colModel[e+c.nv].width=d}else{c.tblwidth=this.newWidth||c.tblwidth;b("table:first",this.bDiv).css("width",c.tblwidth+"px");b("table:first",this.hDiv).css("width",c.tblwidth+"px");this.hDiv.scrollLeft=this.bDiv.scrollLeft;if(c.footerrow){b("table:first",this.sDiv).css("width",c.tblwidth+"px");this.sDiv.scrollLeft=this.bDiv.scrollLeft}}b.isFunction(c.resizeStop)&&
+c.resizeStop.call(this,d,e)}this.curGbox=null;document.onselectstart=function(){return true}},populateVisible:function(){g.timer&&clearTimeout(g.timer);g.timer=null;var e=b(g.bDiv).height();if(e){var d=b("table:first",g.bDiv),i,n;if(d[0].rows.length)try{n=(i=d[0].rows[1])?b(i).outerHeight()||g.prevRowHeight:g.prevRowHeight}catch(p){n=g.prevRowHeight}if(n){g.prevRowHeight=n;var A=c.rowNum;i=g.scrollTop=g.bDiv.scrollTop;var s=Math.round(d.position().top)-i,E=s+d.height();n*=A;var u,z,w;if(E<e&&s<=0&&
+(c.lastpage===undefined||parseInt((E+i+n-1)/n,10)<=c.lastpage)){z=parseInt((e-E+n-1)/n,10);if(E>=0||z<2||c.scroll===true){u=Math.round((E+i)/n)+1;s=-1}else s=1}if(s>0){u=parseInt(i/n,10)+1;z=parseInt((i+e)/n,10)+2-u;w=true}if(z)if(!(c.lastpage&&u>c.lastpage||c.lastpage==1||u===c.page&&u===c.lastpage))if(g.hDiv.loading)g.timer=setTimeout(g.populateVisible,c.scrollTimeout);else{c.page=u;if(w){g.selectionPreserver(d[0]);g.emptyRows(g.bDiv,false,false)}g.populate(z)}}}},scrollGrid:function(e){if(c.scroll){var d=
+g.bDiv.scrollTop;if(g.scrollTop===undefined)g.scrollTop=0;if(d!=g.scrollTop){g.scrollTop=d;g.timer&&clearTimeout(g.timer);g.timer=setTimeout(g.populateVisible,c.scrollTimeout)}}g.hDiv.scrollLeft=g.bDiv.scrollLeft;if(c.footerrow)g.sDiv.scrollLeft=g.bDiv.scrollLeft;e&&e.stopPropagation()},selectionPreserver:function(e){var d=e.p,i=d.selrow,n=d.selarrrow?b.makeArray(d.selarrrow):null,p=e.grid.bDiv.scrollLeft,A=d.gridComplete;d.gridComplete=function(){d.selrow=null;d.selarrrow=[];if(d.multiselect&&n&&
+n.length>0)for(var s=0;s<n.length;s++)n[s]!=i&&b(e).jqGrid("setSelection",n[s],false);i&&b(e).jqGrid("setSelection",i,false);e.grid.bDiv.scrollLeft=p;d.gridComplete=A;d.gridComplete&&A()}}};if(this.tagName.toUpperCase()!="TABLE")alert("Element is not a table");else{b(this).empty().attr("tabindex","1");this.p=c;var k,l,a;if(this.p.colNames.length===0)for(k=0;k<this.p.colModel.length;k++)this.p.colNames[k]=this.p.colModel[k].label||this.p.colModel[k].name;if(this.p.colNames.length!==this.p.colModel.length)alert(b.jgrid.errors.model);
+else{var q=b("<div class='ui-jqgrid-view'></div>"),x,y=b.browser.msie?true:false,H=b.browser.webkit||b.browser.safari?true:false;a=this;a.p.direction=b.trim(a.p.direction.toLowerCase());if(b.inArray(a.p.direction,["ltr","rtl"])==-1)a.p.direction="ltr";l=a.p.direction;b(q).insertBefore(this);b(this).appendTo(q).removeClass("scroll");var L=b("<div class='ui-jqgrid ui-widget ui-widget-content ui-corner-all'></div>");b(L).insertBefore(q).attr({id:"gbox_"+this.id,dir:l});b(q).appendTo(L).attr("id","gview_"+
+this.id);x=y&&b.browser.version<=6?'<iframe style="display:block;position:absolute;z-index:-1;filter:Alpha(Opacity=\'0\');" src="javascript:false;"></iframe>':"";b("<div class='ui-widget-overlay jqgrid-overlay' id='lui_"+this.id+"'></div>").append(x).insertBefore(q);b("<div class='loading ui-state-default ui-state-active' id='load_"+this.id+"'>"+this.p.loadtext+"</div>").insertBefore(q);b(this).attr({cellspacing:"0",cellpadding:"0",border:"0",role:"grid","aria-multiselectable":!!this.p.multiselect,
+"aria-labelledby":"gbox_"+this.id});var M=function(e,d){e=parseInt(e,10);return isNaN(e)?d?d:0:e},P=function(e,d,i,n,p,A){var s=a.p.colModel[e],E=s.align,u='style="',z=s.classes,w=s.name,t=[];if(E)u+="text-align:"+E+";";if(s.hidden===true)u+="display:none;";if(d===0)u+="width: "+g.headers[e].width+"px;";else if(s.cellattr&&b.isFunction(s.cellattr))if((e=s.cellattr.call(a,p,i,n,s,A))&&typeof e==="string"){e=e.replace(/style/i,"style").replace(/title/i,"title");if(e.indexOf("title")>-1)s.title=false;
+if(e.indexOf("class")>-1)z=undefined;t=e.split("style");if(t.length===2){t[1]=b.trim(t[1].replace("=",""));if(t[1].indexOf("'")===0||t[1].indexOf('"')===0)t[1]=t[1].substring(1);u+=t[1].replace(/'/gi,'"')}else u+='"'}if(!t.length){t[0]="";u+='"'}u+=(z!==undefined?' class="'+z+'"':"")+(s.title&&i?' title="'+b.jgrid.stripHtml(i)+'"':"");u+=' aria-describedby="'+a.p.id+"_"+w+'"';return u+t[0]},U=function(e){return e===undefined||e===null||e===""?"&#160;":a.p.autoencode?b.jgrid.htmlEncode(e):e+""},o=
+function(e,d,i,n,p){var A=a.p.colModel[i];if(typeof A.formatter!=="undefined"){e={rowId:e,colModel:A,gid:a.p.id,pos:i};d=b.isFunction(A.formatter)?A.formatter.call(a,d,e,n,p):b.fmatter?b.fn.fmatter(A.formatter,d,e,n,p):U(d)}else d=U(d);return d},m=function(e,d,i,n,p){d=o(e,d,i,p,"add");return'<td role="gridcell" '+P(i,n,d,p,e,true)+">"+d+"</td>"},r=function(e,d,i){var n='<input role="checkbox" type="checkbox" id="jqg_'+a.p.id+"_"+e+'" class="cbox" name="jqg_'+a.p.id+"_"+e+'"/>';return'<td role="gridcell" '+
+P(d,i,"",null,e,true)+">"+n+"</td>"},D=function(e,d,i,n){i=(parseInt(i,10)-1)*parseInt(n,10)+1+d;return'<td role="gridcell" class="ui-state-default jqgrid-rownum" '+P(e,d,i,null,d,true)+">"+i+"</td>"},T=function(e){var d,i=[],n=0,p;for(p=0;p<a.p.colModel.length;p++){d=a.p.colModel[p];if(d.name!=="cb"&&d.name!=="subgrid"&&d.name!=="rn"){i[n]=e=="local"?d.name:e=="xml"?d.xmlmap||d.name:d.jsonmap||d.name;n++}}return i},I=function(e){var d=a.p.remapColumns;if(!d||!d.length)d=b.map(a.p.colModel,function(i,
+n){return n});if(e)d=b.map(d,function(i){return i<e?null:i-e});return d},C=function(e,d,i){if(a.p.deepempty)b("#"+b.jgrid.jqID(a.p.id)+" tbody:first tr:gt(0)").remove();else{var n=b("#"+b.jgrid.jqID(a.p.id)+" tbody:first tr:first")[0];b("#"+b.jgrid.jqID(a.p.id)+" tbody:first").empty().append(n)}if(d&&a.p.scroll){b(">div:first",e).css({height:"auto"}).children("div:first").css({height:0,display:"none"});e.scrollTop=0}if(i===true)if(a.p.treeGrid===true){a.p.data=[];a.p._index={}}},ca=function(){var e=
+a.p.data.length,d,i,n;d=a.p.rownumbers===true?1:0;i=a.p.multiselect===true?1:0;n=a.p.subGrid===true?1:0;d=a.p.keyIndex===false||a.p.loadonce===true?a.p.localReader.id:a.p.colModel[a.p.keyIndex+i+n+d].name;for(i=0;i<e;i++){n=b.jgrid.getAccessor(a.p.data[i],d);a.p._index[n]=i}},V=function(e,d,i,n,p){var A=new Date,s=a.p.datatype!="local"&&a.p.loadonce||a.p.datatype=="xmlstring",E=a.p.datatype=="local"?"local":"xml";if(s){a.p.data=[];a.p._index={};a.p.localReader.id="_id_"}a.p.reccount=0;if(b.isXMLDoc(e)){if(a.p.treeANode===
+-1&&!a.p.scroll){C(d,false,true);i=1}else i=i>1?i:1;var u,z,w=0,t,F=0,S=0,N=0,K,O=[],Y,J={},v,B,G=[],ia=a.p.altRows===true?" "+a.p.altclass:"";a.p.xmlReader.repeatitems||(O=T(E));K=a.p.keyIndex===false?a.p.xmlReader.id:a.p.keyIndex;if(O.length>0&&!isNaN(K)){if(a.p.remapColumns&&a.p.remapColumns.length)K=b.inArray(K,a.p.remapColumns);K=O[K]}E=(K+"").indexOf("[")===-1?O.length?function(ga,aa){return b(K,ga).text()||aa}:function(ga,aa){return b(a.p.xmlReader.cell,ga).eq(K).text()||aa}:function(ga,aa){return ga.getAttribute(K.replace(/[\[\]]/g,
+""))||aa};a.p.userData={};b(a.p.xmlReader.page,e).each(function(){a.p.page=this.textContent||this.text||0});b(a.p.xmlReader.total,e).each(function(){a.p.lastpage=this.textContent||this.text;if(a.p.lastpage===undefined)a.p.lastpage=1});b(a.p.xmlReader.records,e).each(function(){a.p.records=this.textContent||this.text||0});b(a.p.xmlReader.userdata,e).each(function(){a.p.userData[this.getAttribute("name")]=this.textContent||this.text});(e=b(a.p.xmlReader.root+" "+a.p.xmlReader.row,e))||(e=[]);var ba=
+e.length,W=0,Z={},ha;if(e&&ba){ha=parseInt(a.p.rowNum,10);var pa=a.p.scroll?b.jgrid.randId():1;if(p)ha*=p+1;p=b.isFunction(a.p.afterInsertRow);var qa="";if(a.p.grouping&&a.p.groupingView.groupCollapse===true)qa=' style="display:none;"';for(;W<ba;){v=e[W];B=E(v,pa+W);u=i===0?0:i+1;u=(u+W)%2==1?ia:"";G.push("<tr"+qa+' id="'+B+'" tabindex="-1" role="row" class ="ui-widget-content jqgrow ui-row-'+a.p.direction+""+u+'">');if(a.p.rownumbers===true){G.push(D(0,W,a.p.page,a.p.rowNum));N=1}if(a.p.multiselect===
+true){G.push(r(B,N,W));F=1}if(a.p.subGrid===true){G.push(b(a).jqGrid("addSubGridCell",F+N,W+i));S=1}if(a.p.xmlReader.repeatitems){Y||(Y=I(F+S+N));var Ba=b(a.p.xmlReader.cell,v);b.each(Y,function(ga){var aa=Ba[this];if(!aa)return false;t=aa.textContent||aa.text;J[a.p.colModel[ga+F+S+N].name]=t;G.push(m(B,t,ga+F+S+N,W+i,v))})}else for(u=0;u<O.length;u++){t=b(O[u],v).text();J[a.p.colModel[u+F+S+N].name]=t;G.push(m(B,t,u+F+S+N,W+i,v))}G.push("</tr>");if(a.p.grouping){u=a.p.groupingView.groupField.length;
+for(var xa=[],ya=0;ya<u;ya++)xa.push(J[a.p.groupingView.groupField[ya]]);Z=b(a).jqGrid("groupingPrepare",G,xa,Z,J);G=[]}if(s||a.p.treeGrid===true){J._id_=B;a.p.data.push(J);a.p._index[B]=a.p.data.length-1}if(a.p.gridview===false){b("tbody:first",d).append(G.join(""));p&&a.p.afterInsertRow.call(a,B,J,v);G=[]}J={};w++;W++;if(w==ha)break}}if(a.p.gridview===true){z=a.p.treeANode>-1?a.p.treeANode:0;if(a.p.grouping){b(a).jqGrid("groupingRender",Z,a.p.colModel.length);Z=null}else a.p.treeGrid===true&&z>
+0?b(a.rows[z]).after(G.join("")):b("tbody:first",d).append(G.join(""))}if(a.p.subGrid===true)try{b(a).jqGrid("addSubGrid",F+N)}catch(Ha){}a.p.totaltime=new Date-A;if(w>0)if(a.p.records===0)a.p.records=ba;G=null;if(a.p.treeGrid===true)try{b(a).jqGrid("setTreeNode",z+1,w+z+1)}catch(Ia){}if(!a.p.treeGrid&&!a.p.scroll)a.grid.bDiv.scrollTop=0;a.p.reccount=w;a.p.treeANode=-1;a.p.userDataOnFooter&&b(a).jqGrid("footerData","set",a.p.userData,true);if(s){a.p.records=ba;a.p.lastpage=Math.ceil(ba/ha)}n||a.updatepager(false,
+true);if(s)for(;w<ba;){v=e[w];B=E(v,w);if(a.p.xmlReader.repeatitems){Y||(Y=I(F+S+N));var Ea=b(a.p.xmlReader.cell,v);b.each(Y,function(ga){var aa=Ea[this];if(!aa)return false;t=aa.textContent||aa.text;J[a.p.colModel[ga+F+S+N].name]=t})}else for(u=0;u<O.length;u++){t=b(O[u],v).text();J[a.p.colModel[u+F+S+N].name]=t}J._id_=B;a.p.data.push(J);a.p._index[B]=a.p.data.length-1;J={};w++}}},fa=function(e,d,i,n,p){var A=new Date;if(e){if(a.p.treeANode===-1&&!a.p.scroll){C(d,false,true);i=1}else i=i>1?i:1;var s,
+E=a.p.datatype!="local"&&a.p.loadonce||a.p.datatype=="jsonstring";if(E){a.p.data=[];a.p._index={};a.p.localReader.id="_id_"}a.p.reccount=0;if(a.p.datatype=="local"){d=a.p.localReader;s="local"}else{d=a.p.jsonReader;s="json"}var u=0,z,w,t=[],F,S=0,N=0,K=0,O,Y,J={},v,B,G=[],ia=a.p.altRows===true?" "+a.p.altclass:"";a.p.page=b.jgrid.getAccessor(e,d.page)||0;O=b.jgrid.getAccessor(e,d.total);a.p.lastpage=O===undefined?1:O;a.p.records=b.jgrid.getAccessor(e,d.records)||0;a.p.userData=b.jgrid.getAccessor(e,
+d.userdata)||{};d.repeatitems||(F=t=T(s));s=a.p.keyIndex===false?d.id:a.p.keyIndex;if(t.length>0&&!isNaN(s)){if(a.p.remapColumns&&a.p.remapColumns.length)s=b.inArray(s,a.p.remapColumns);s=t[s]}(Y=b.jgrid.getAccessor(e,d.root))||(Y=[]);O=Y.length;e=0;var ba=parseInt(a.p.rowNum,10),W=a.p.scroll?b.jgrid.randId():1;if(p)ba*=p+1;var Z=b.isFunction(a.p.afterInsertRow),ha={},pa="";if(a.p.grouping&&a.p.groupingView.groupCollapse===true)pa=' style="display:none;"';for(;e<O;){p=Y[e];B=b.jgrid.getAccessor(p,
+s);if(B===undefined){B=W+e;if(t.length===0)if(d.cell)B=b.jgrid.getAccessor(p,d.cell)[s]||B}z=i===1?0:i;z=(z+e)%2==1?ia:"";G.push("<tr"+pa+' id="'+B+'" tabindex="-1" role="row" class= "ui-widget-content jqgrow ui-row-'+a.p.direction+""+z+'">');if(a.p.rownumbers===true){G.push(D(0,e,a.p.page,a.p.rowNum));K=1}if(a.p.multiselect){G.push(r(B,K,e));S=1}if(a.p.subGrid){G.push(b(a).jqGrid("addSubGridCell",S+K,e+i));N=1}if(d.repeatitems){if(d.cell)p=b.jgrid.getAccessor(p,d.cell);F||(F=I(S+N+K))}for(w=0;w<
+F.length;w++){z=b.jgrid.getAccessor(p,F[w]);G.push(m(B,z,w+S+N+K,e+i,p));J[a.p.colModel[w+S+N+K].name]=z}G.push("</tr>");if(a.p.grouping){z=a.p.groupingView.groupField.length;w=[];for(var qa=0;qa<z;qa++)w.push(J[a.p.groupingView.groupField[qa]]);ha=b(a).jqGrid("groupingPrepare",G,w,ha,J);G=[]}if(E||a.p.treeGrid===true){J._id_=B;a.p.data.push(J);a.p._index[B]=a.p.data.length-1}if(a.p.gridview===false){b("#"+b.jgrid.jqID(a.p.id)+" tbody:first").append(G.join(""));Z&&a.p.afterInsertRow.call(a,B,J,p);
+G=[]}J={};u++;e++;if(u==ba)break}if(a.p.gridview===true){v=a.p.treeANode>-1?a.p.treeANode:0;if(a.p.grouping)b(a).jqGrid("groupingRender",ha,a.p.colModel.length);else a.p.treeGrid===true&&v>0?b(a.rows[v]).after(G.join("")):b("#"+b.jgrid.jqID(a.p.id)+" tbody:first").append(G.join(""))}if(a.p.subGrid===true)try{b(a).jqGrid("addSubGrid",S+K)}catch(Ba){}a.p.totaltime=new Date-A;if(u>0)if(a.p.records===0)a.p.records=O;if(a.p.treeGrid===true)try{b(a).jqGrid("setTreeNode",v+1,u+v+1)}catch(xa){}if(!a.p.treeGrid&&
+!a.p.scroll)a.grid.bDiv.scrollTop=0;a.p.reccount=u;a.p.treeANode=-1;a.p.userDataOnFooter&&b(a).jqGrid("footerData","set",a.p.userData,true);if(E){a.p.records=O;a.p.lastpage=Math.ceil(O/ba)}n||a.updatepager(false,true);if(E)for(;u<O&&Y[u];){p=Y[u];B=b.jgrid.getAccessor(p,s);if(B===undefined){B=W+u;if(t.length===0)if(d.cell)B=b.jgrid.getAccessor(p,d.cell)[s]||B}if(p){if(d.repeatitems){if(d.cell)p=b.jgrid.getAccessor(p,d.cell);F||(F=I(S+N+K))}for(w=0;w<F.length;w++){z=b.jgrid.getAccessor(p,F[w]);J[a.p.colModel[w+
+S+N+K].name]=z}J._id_=B;a.p.data.push(J);a.p._index[B]=a.p.data.length-1;J={}}u++}}},oa=function(){function e(v){var B=0,G,ia,ba,W,Z;if(v.groups!==undefined){(ia=v.groups.length&&v.groupOp.toString().toUpperCase()==="OR")&&t.orBegin();for(G=0;G<v.groups.length;G++){B>0&&ia&&t.or();try{e(v.groups[G])}catch(ha){alert(ha)}B++}ia&&t.orEnd()}if(v.rules!==undefined){if(B>0){ia=t.select();t=b.jgrid.from(ia)}try{(ba=v.rules.length&&v.groupOp.toString().toUpperCase()==="OR")&&t.orBegin();for(G=0;G<v.rules.length;G++){Z=
+v.rules[G];W=v.groupOp.toString().toUpperCase();if(w[Z.op]&&Z.field){if(B>0&&W&&W==="OR")t=t.or();t=w[Z.op](t,W)(Z.field,Z.data,n[Z.field])}B++}ba&&t.orEnd()}catch(pa){alert(pa)}}}var d,i=false,n={},p=[],A=[],s,E,u;if(b.isArray(a.p.data)){var z=a.p.grouping?a.p.groupingView:false;b.each(a.p.colModel,function(){E=this.sorttype||"text";if(E=="date"||E=="datetime"){if(this.formatter&&typeof this.formatter==="string"&&this.formatter=="date"){s=this.formatoptions&&this.formatoptions.srcformat?this.formatoptions.srcformat:
+b.jgrid.formatter.date.srcformat;u=this.formatoptions&&this.formatoptions.newformat?this.formatoptions.newformat:b.jgrid.formatter.date.newformat}else s=u=this.datefmt||"Y-m-d";n[this.name]={stype:E,srcfmt:s,newfmt:u}}else n[this.name]={stype:E,srcfmt:"",newfmt:""};if(a.p.grouping&&this.name==z.groupField[0]){var v=this.name;if(typeof this.index!="undefined")v=this.index;p[0]=n[v];A.push(v)}if(!i&&(this.index==a.p.sortname||this.name==a.p.sortname)){d=this.name;i=true}});if(a.p.treeGrid)b(a).jqGrid("SortTree",
+d,a.p.sortorder,n[d].stype,n[d].srcfmt);else{var w={eq:function(v){return v.equals},ne:function(v){return v.notEquals},lt:function(v){return v.less},le:function(v){return v.lessOrEquals},gt:function(v){return v.greater},ge:function(v){return v.greaterOrEquals},cn:function(v){return v.contains},nc:function(v,B){return B==="OR"?v.orNot().contains:v.andNot().contains},bw:function(v){return v.startsWith},bn:function(v,B){return B==="OR"?v.orNot().startsWith:v.andNot().startsWith},en:function(v,B){return B===
+"OR"?v.orNot().endsWith:v.andNot().endsWith},ew:function(v){return v.endsWith},ni:function(v,B){return B==="OR"?v.orNot().equals:v.andNot().equals},"in":function(v){return v.equals},nu:function(v){return v.isNull},nn:function(v,B){return B==="OR"?v.orNot().isNull:v.andNot().isNull}},t=b.jgrid.from(a.p.data);if(a.p.ignoreCase)t=t.ignoreCase();if(a.p.search===true){var F=a.p.postData.filters;if(F){if(typeof F=="string")F=b.jgrid.parse(F);e(F)}else try{t=w[a.p.postData.searchOper](t)(a.p.postData.searchField,
+a.p.postData.searchString,n[a.p.postData.searchField])}catch(S){}}if(a.p.grouping){t.orderBy(A,z.groupOrder[0],p[0].stype,p[0].srcfmt);z.groupDataSorted=true}if(d&&a.p.sortorder&&i)a.p.sortorder.toUpperCase()=="DESC"?t.orderBy(a.p.sortname,"d",n[d].stype,n[d].srcfmt):t.orderBy(a.p.sortname,"a",n[d].stype,n[d].srcfmt);F=t.select();var N=parseInt(a.p.rowNum,10),K=F.length,O=parseInt(a.p.page,10),Y=Math.ceil(K/N),J={};F=F.slice((O-1)*N,O*N);n=t=null;J[a.p.localReader.total]=Y;J[a.p.localReader.page]=
+O;J[a.p.localReader.records]=K;J[a.p.localReader.root]=F;F=null;return J}}},R=function(){a.grid.hDiv.loading=true;if(!a.p.hiddengrid)switch(a.p.loadui){case "enable":b("#load_"+b.jgrid.jqID(a.p.id)).show();break;case "block":b("#lui_"+b.jgrid.jqID(a.p.id)).show();b("#load_"+b.jgrid.jqID(a.p.id)).show()}},$=function(){a.grid.hDiv.loading=false;switch(a.p.loadui){case "enable":b("#load_"+b.jgrid.jqID(a.p.id)).hide();break;case "block":b("#lui_"+b.jgrid.jqID(a.p.id)).hide();b("#load_"+b.jgrid.jqID(a.p.id)).hide()}},
+ja=function(e){if(!a.grid.hDiv.loading){var d=a.p.scroll&&e===false,i={},n,p=a.p.prmNames;if(a.p.page<=0)a.p.page=1;if(p.search!==null)i[p.search]=a.p.search;if(p.nd!==null)i[p.nd]=(new Date).getTime();if(p.rows!==null)i[p.rows]=a.p.rowNum;if(p.page!==null)i[p.page]=a.p.page;if(p.sort!==null)i[p.sort]=a.p.sortname;if(p.order!==null)i[p.order]=a.p.sortorder;if(a.p.rowTotal!==null&&p.totalrows!==null)i[p.totalrows]=a.p.rowTotal;var A=a.p.loadComplete,s=b.isFunction(A);s||(A=null);var E=0;e=e||1;if(e>
+1)if(p.npage!==null){i[p.npage]=e;E=e-1;e=1}else A=function(z){a.p.page++;a.grid.hDiv.loading=false;s&&a.p.loadComplete.call(a,z);ja(e-1)};else p.npage!==null&&delete a.p.postData[p.npage];if(a.p.grouping){b(a).jqGrid("groupingSetup");if(a.p.groupingView.groupDataSorted===true)i[p.sort]=a.p.groupingView.groupField[0]+" "+a.p.groupingView.groupOrder[0]+", "+i[p.sort]}b.extend(a.p.postData,i);var u=!a.p.scroll?1:a.rows.length-1;if(b.isFunction(a.p.datatype))a.p.datatype.call(a,a.p.postData,"load_"+
+a.p.id);else{b.isFunction(a.p.beforeRequest)&&a.p.beforeRequest.call(a);n=a.p.datatype.toLowerCase();switch(n){case "json":case "jsonp":case "xml":case "script":b.ajax(b.extend({url:a.p.url,type:a.p.mtype,dataType:n,data:b.isFunction(a.p.serializeGridData)?a.p.serializeGridData.call(a,a.p.postData):a.p.postData,success:function(z){n==="xml"?V(z,a.grid.bDiv,u,e>1,E):fa(z,a.grid.bDiv,u,e>1,E);A&&A.call(a,z);d&&a.grid.populateVisible();if(a.p.loadonce||a.p.treeGrid)a.p.datatype="local";$()},error:function(z,
+w,t){b.isFunction(a.p.loadError)&&a.p.loadError.call(a,z,w,t);$()},beforeSend:function(z){R();b.isFunction(a.p.loadBeforeSend)&&a.p.loadBeforeSend.call(a,z)}},b.jgrid.ajaxOptions,a.p.ajaxGridOptions));break;case "xmlstring":R();i=b.jgrid.stringToDoc(a.p.datastr);V(i,a.grid.bDiv);s&&a.p.loadComplete.call(a,i);a.p.datatype="local";a.p.datastr=null;$();break;case "jsonstring":R();i=typeof a.p.datastr=="string"?b.jgrid.parse(a.p.datastr):a.p.datastr;fa(i,a.grid.bDiv);s&&a.p.loadComplete.call(a,i);a.p.datatype=
+"local";a.p.datastr=null;$();break;case "local":case "clientside":R();a.p.datatype="local";i=oa();fa(i,a.grid.bDiv,u,e>1,E);A&&A.call(a,i);d&&a.grid.populateVisible();$()}}}};x=function(e,d){var i="",n="<table cellspacing='0' cellpadding='0' border='0' style='table-layout:auto;' class='ui-pg-table'><tbody><tr>",p="",A,s,E,u,z=function(w){var t;if(b.isFunction(a.p.onPaging))t=a.p.onPaging.call(a,w);a.p.selrow=null;if(a.p.multiselect){a.p.selarrrow=[];b("#cb_"+b.jgrid.jqID(a.p.id),a.grid.hDiv).attr("checked",
+false)}a.p.savedRow=[];if(t=="stop")return false;return true};e=e.substr(1);d+="_"+e;A="pg_"+e;s=e+"_left";E=e+"_center";u=e+"_right";b("#"+b.jgrid.jqID(e)).append("<div id='"+A+"' class='ui-pager-control' role='group'><table cellspacing='0' cellpadding='0' border='0' class='ui-pg-table' style='width:100%;table-layout:fixed;height:100%;' role='row'><tbody><tr><td id='"+s+"' align='left'></td><td id='"+E+"' align='center' style='white-space:pre;'></td><td id='"+u+"' align='right'></td></tr></tbody></table></div>").attr("dir",
+"ltr");if(a.p.rowList.length>0){p="<td dir='"+l+"'>";p+="<select class='ui-pg-selbox' role='listbox'>";for(s=0;s<a.p.rowList.length;s++)p+='<option role="option" value="'+a.p.rowList[s]+'"'+(a.p.rowNum==a.p.rowList[s]?' selected="selected"':"")+">"+a.p.rowList[s]+"</option>";p+="</select></td>"}if(l=="rtl")n+=p;if(a.p.pginput===true)i="<td dir='"+l+"'>"+b.jgrid.format(a.p.pgtext||"","<input class='ui-pg-input' type='text' size='2' maxlength='7' value='0' role='textbox'/>","<span id='sp_1_"+b.jgrid.jqID(e)+
+"'></span>")+"</td>";if(a.p.pgbuttons===true){s=["first"+d,"prev"+d,"next"+d,"last"+d];l=="rtl"&&s.reverse();n+="<td id='"+s[0]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-first'></span></td>";n+="<td id='"+s[1]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-prev'></span></td>";n+=i!==""?"<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>"+i+"<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>":
+"";n+="<td id='"+s[2]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-next'></span></td>";n+="<td id='"+s[3]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-end'></span></td>"}else if(i!=="")n+=i;if(l=="ltr")n+=p;n+="</tr></tbody></table>";a.p.viewrecords===true&&b("td#"+e+"_"+a.p.recordpos,"#"+A).append("<div dir='"+l+"' style='text-align:"+a.p.recordpos+"' class='ui-paging-info'></div>");b("td#"+e+"_"+a.p.pagerpos,"#"+A).append(n);p=b(".ui-jqgrid").css("font-size")||
+"11px";b(document.body).append("<div id='testpg' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:"+p+";visibility:hidden;' ></div>");n=b(n).clone().appendTo("#testpg").width();b("#testpg").remove();if(n>0){if(i!=="")n+=50;b("td#"+e+"_"+a.p.pagerpos,"#"+A).width(n)}a.p._nvtd=[];a.p._nvtd[0]=n?Math.floor((a.p.width-n)/2):Math.floor(a.p.width/3);a.p._nvtd[1]=0;n=null;b(".ui-pg-selbox","#"+A).bind("change",function(){a.p.page=Math.round(a.p.rowNum*(a.p.page-1)/this.value-0.5)+1;a.p.rowNum=
+this.value;if(d)b(".ui-pg-selbox",a.p.pager).val(this.value);else a.p.toppager&&b(".ui-pg-selbox",a.p.toppager).val(this.value);if(!z("records"))return false;ja();return false});if(a.p.pgbuttons===true){b(".ui-pg-button","#"+A).hover(function(){if(b(this).hasClass("ui-state-disabled"))this.style.cursor="default";else{b(this).addClass("ui-state-hover");this.style.cursor="pointer"}},function(){if(!b(this).hasClass("ui-state-disabled")){b(this).removeClass("ui-state-hover");this.style.cursor="default"}});
+b("#first"+b.jgrid.jqID(d)+", #prev"+b.jgrid.jqID(d)+", #next"+b.jgrid.jqID(d)+", #last"+b.jgrid.jqID(d)).click(function(){var w=M(a.p.page,1),t=M(a.p.lastpage,1),F=false,S=true,N=true,K=true,O=true;if(t===0||t===1)O=K=N=S=false;else if(t>1&&w>=1)if(w===1)N=S=false;else{if(!(w>1&&w<t))if(w===t)O=K=false}else if(t>1&&w===0){O=K=false;w=t-1}if(this.id==="first"+d&&S){a.p.page=1;F=true}if(this.id==="prev"+d&&N){a.p.page=w-1;F=true}if(this.id==="next"+d&&K){a.p.page=w+1;F=true}if(this.id==="last"+d&&
+O){a.p.page=t;F=true}if(F){if(!z(this.id))return false;ja()}return false})}a.p.pginput===true&&b("input.ui-pg-input","#"+A).keypress(function(w){if((w.charCode?w.charCode:w.keyCode?w.keyCode:0)==13){a.p.page=b(this).val()>0?b(this).val():a.p.page;if(!z("user"))return false;ja();return false}return this})};var Ca=function(e,d,i,n){if(a.p.colModel[d].sortable)if(!(a.p.savedRow.length>0)){if(!i){if(a.p.lastsort==d)if(a.p.sortorder=="asc")a.p.sortorder="desc";else{if(a.p.sortorder=="desc")a.p.sortorder=
+"asc"}else a.p.sortorder=a.p.colModel[d].firstsortorder||"asc";a.p.page=1}if(n)if(a.p.lastsort==d&&a.p.sortorder==n&&!i)return;else a.p.sortorder=n;i=b("thead:first",a.grid.hDiv).get(0);b("tr th:eq("+a.p.lastsort+") span.ui-grid-ico-sort",i).addClass("ui-state-disabled");b("tr th:eq("+a.p.lastsort+")",i).attr("aria-selected","false");b("tr th:eq("+d+") span.ui-icon-"+a.p.sortorder,i).removeClass("ui-state-disabled");b("tr th:eq("+d+")",i).attr("aria-selected","true");if(!a.p.viewsortcols[0])if(a.p.lastsort!=
+d){b("tr th:eq("+a.p.lastsort+") span.s-ico",i).hide();b("tr th:eq("+d+") span.s-ico",i).show()}e=e.substring(5+a.p.id.length+1);a.p.sortname=a.p.colModel[d].index||e;i=a.p.sortorder;if(b.isFunction(a.p.onSortCol))if(a.p.onSortCol.call(a,e,d,i)=="stop"){a.p.lastsort=d;return}if(a.p.datatype=="local")a.p.deselectAfterSort&&b(a).jqGrid("resetSelection");else{a.p.selrow=null;a.p.multiselect&&b("#cb_"+b.jgrid.jqID(a.p.id),a.grid.hDiv).attr("checked",false);a.p.selarrrow=[];a.p.savedRow=[]}if(a.p.scroll){i=
+a.grid.bDiv.scrollLeft;C(a.grid.bDiv,true,false);a.grid.hDiv.scrollLeft=i}a.p.subGrid&&a.p.datatype=="local"&&b("td.sgexpanded","#"+b.jgrid.jqID(a.p.id)).each(function(){b(this).trigger("click")});ja();a.p.lastsort=d;if(a.p.sortname!=e&&d)a.p.lastsort=d}},Fa=function(e){var d,i={},n=H?0:a.p.cellLayout;for(d=i[0]=i[1]=i[2]=0;d<=e;d++)if(a.p.colModel[d].hidden===false)i[0]+=a.p.colModel[d].width+n;if(a.p.direction=="rtl")i[0]=a.p.width-i[0];i[0]-=a.grid.bDiv.scrollLeft;if(b(a.grid.cDiv).is(":visible"))i[1]+=
+b(a.grid.cDiv).height()+parseInt(b(a.grid.cDiv).css("padding-top"),10)+parseInt(b(a.grid.cDiv).css("padding-bottom"),10);if(a.p.toolbar[0]===true&&(a.p.toolbar[1]=="top"||a.p.toolbar[1]=="both"))i[1]+=b(a.grid.uDiv).height()+parseInt(b(a.grid.uDiv).css("border-top-width"),10)+parseInt(b(a.grid.uDiv).css("border-bottom-width"),10);if(a.p.toppager)i[1]+=b(a.grid.topDiv).height()+parseInt(b(a.grid.topDiv).css("border-bottom-width"),10);i[2]+=b(a.grid.bDiv).height()+b(a.grid.hDiv).height();return i};
+this.p.id=this.id;if(b.inArray(a.p.multikey,["shiftKey","altKey","ctrlKey"])==-1)a.p.multikey=false;a.p.keyIndex=false;for(k=0;k<a.p.colModel.length;k++){a.p.colModel[k]=b.extend(true,{},a.p.cmTemplate,a.p.colModel[k].template||{},a.p.colModel[k]);if(a.p.keyIndex===false&&a.p.colModel[k].key===true)a.p.keyIndex=k}a.p.sortorder=a.p.sortorder.toLowerCase();if(a.p.grouping===true){a.p.scroll=false;a.p.rownumbers=false;a.p.subGrid=false;a.p.treeGrid=false;a.p.gridview=true}if(this.p.treeGrid===true){try{b(this).jqGrid("setTreeGrid")}catch(Ja){}if(a.p.datatype!=
+"local")a.p.localReader={id:"_id_"}}if(this.p.subGrid)try{b(a).jqGrid("setSubGrid")}catch(Ka){}if(this.p.multiselect){this.p.colNames.unshift("<input role='checkbox' id='cb_"+this.p.id+"' class='cbox' type='checkbox'/>");this.p.colModel.unshift({name:"cb",width:H?a.p.multiselectWidth+a.p.cellLayout:a.p.multiselectWidth,sortable:false,resizable:false,hidedlg:true,search:false,align:"center",fixed:true})}if(this.p.rownumbers){this.p.colNames.unshift("");this.p.colModel.unshift({name:"rn",width:a.p.rownumWidth,
+sortable:false,resizable:false,hidedlg:true,search:false,align:"center",fixed:true})}a.p.xmlReader=b.extend(true,{root:"rows",row:"row",page:"rows>page",total:"rows>total",records:"rows>records",repeatitems:true,cell:"cell",id:"[id]",userdata:"userdata",subgrid:{root:"rows",row:"row",repeatitems:true,cell:"cell"}},a.p.xmlReader);a.p.jsonReader=b.extend(true,{root:"rows",page:"page",total:"total",records:"records",repeatitems:true,cell:"cell",id:"id",userdata:"userdata",subgrid:{root:"rows",repeatitems:true,
+cell:"cell"}},a.p.jsonReader);a.p.localReader=b.extend(true,{root:"rows",page:"page",total:"total",records:"records",repeatitems:false,cell:"cell",id:"id",userdata:"userdata",subgrid:{root:"rows",repeatitems:true,cell:"cell"}},a.p.localReader);if(a.p.scroll){a.p.pgbuttons=false;a.p.pginput=false;a.p.rowList=[]}a.p.data.length&&ca();var da="<thead><tr class='ui-jqgrid-labels' role='rowheader'>",Da,ma,sa,ra,ta,X,Q,na;ma=na="";if(a.p.shrinkToFit===true&&a.p.forceFit===true)for(k=a.p.colModel.length-
+1;k>=0;k--)if(!a.p.colModel[k].hidden){a.p.colModel[k].resizable=false;break}if(a.p.viewsortcols[1]=="horizontal"){na=" ui-i-asc";ma=" ui-i-desc"}Da=y?"class='ui-th-div-ie'":"";na="<span class='s-ico' style='display:none'><span sort='asc' class='ui-grid-ico-sort ui-icon-asc"+na+" ui-state-disabled ui-icon ui-icon-triangle-1-n ui-sort-"+l+"'></span>";na+="<span sort='desc' class='ui-grid-ico-sort ui-icon-desc"+ma+" ui-state-disabled ui-icon ui-icon-triangle-1-s ui-sort-"+l+"'></span></span>";for(k=
+0;k<this.p.colNames.length;k++){ma=a.p.headertitles?' title="'+b.jgrid.stripHtml(a.p.colNames[k])+'"':"";da+="<th id='"+a.p.id+"_"+a.p.colModel[k].name+"' role='columnheader' class='ui-state-default ui-th-column ui-th-"+l+"'"+ma+">";ma=a.p.colModel[k].index||a.p.colModel[k].name;da+="<div id='jqgh_"+a.p.id+"_"+a.p.colModel[k].name+"' "+Da+">"+a.p.colNames[k];a.p.colModel[k].width=a.p.colModel[k].width?parseInt(a.p.colModel[k].width,10):150;if(typeof a.p.colModel[k].title!=="boolean")a.p.colModel[k].title=
+true;if(ma==a.p.sortname)a.p.lastsort=k;da+=na+"</div></th>"}da+="</tr></thead>";na=null;b(this).append(da);b("thead tr:first th",this).hover(function(){b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")});if(this.p.multiselect){var za=[],ua;b("#cb_"+b.jgrid.jqID(a.p.id),this).bind("click",function(){a.p.selarrrow=[];if(this.checked){b(a.rows).each(function(e){if(e>0)if(!b(this).hasClass("subgrid")&&!b(this).hasClass("jqgroup")&&!b(this).hasClass("ui-state-disabled")){b("#jqg_"+
+b.jgrid.jqID(a.p.id)+"_"+b.jgrid.jqID(this.id)).attr("checked","checked");b(this).addClass("ui-state-highlight").attr("aria-selected","true");a.p.selarrrow.push(this.id);a.p.selrow=this.id}});ua=true;za=[]}else{b(a.rows).each(function(e){if(e>0)if(!b(this).hasClass("subgrid")&&!b(this).hasClass("ui-state-disabled")){b("#jqg_"+b.jgrid.jqID(a.p.id)+"_"+b.jgrid.jqID(this.id)).removeAttr("checked");b(this).removeClass("ui-state-highlight").attr("aria-selected","false");za.push(this.id)}});a.p.selrow=
+null;ua=false}if(b.isFunction(a.p.onSelectAll))a.p.onSelectAll.call(a,ua?a.p.selarrrow:za,ua)})}if(a.p.autowidth===true){da=b(L).innerWidth();a.p.width=da>0?da:"nw"}(function(){var e=0,d=H?0:a.p.cellLayout,i=0,n,p=a.p.scrollOffset,A,s=false,E,u=0,z=0,w;b.each(a.p.colModel,function(){if(typeof this.hidden==="undefined")this.hidden=false;this.widthOrg=A=M(this.width,0);if(this.hidden===false){e+=A+d;if(this.fixed)u+=A+d;else i++;z++}});if(isNaN(a.p.width))a.p.width=g.width=e;else g.width=a.p.width;
+a.p.tblwidth=e;if(a.p.shrinkToFit===false&&a.p.forceFit===true)a.p.forceFit=false;if(a.p.shrinkToFit===true&&i>0){E=g.width-d*i-u;if(!isNaN(a.p.height)){E-=p;s=true}e=0;b.each(a.p.colModel,function(t){if(this.hidden===false&&!this.fixed){this.width=A=Math.round(E*this.width/(a.p.tblwidth-d*i-u));e+=A;n=t}});w=0;if(s){if(g.width-u-(e+d*i)!==p)w=g.width-u-(e+d*i)-p}else if(!s&&Math.abs(g.width-u-(e+d*i))!==1)w=g.width-u-(e+d*i);a.p.colModel[n].width+=w;a.p.tblwidth=e+w+d*i+u;if(a.p.tblwidth>a.p.width){a.p.colModel[n].width-=
+a.p.tblwidth-parseInt(a.p.width,10);a.p.tblwidth=a.p.width}}})();b(L).css("width",g.width+"px").append("<div class='ui-jqgrid-resize-mark' id='rs_m"+a.p.id+"'>&#160;</div>");b(q).css("width",g.width+"px");da=b("thead:first",a).get(0);var va="";if(a.p.footerrow)va+="<table role='grid' style='width:"+a.p.tblwidth+"px' class='ui-jqgrid-ftable' cellspacing='0' cellpadding='0' border='0'><tbody><tr role='row' class='ui-widget-content footrow footrow-"+l+"'>";q=b("tr:first",da);var wa="<tr class='jqgfirstrow' role='row' style='height:auto'>";
+a.p.disableClick=false;b("th",q).each(function(e){sa=a.p.colModel[e].width;if(typeof a.p.colModel[e].resizable==="undefined")a.p.colModel[e].resizable=true;if(a.p.colModel[e].resizable){ra=document.createElement("span");b(ra).html("&#160;").addClass("ui-jqgrid-resize ui-jqgrid-resize-"+l);b.browser.opera||b(ra).css("cursor","col-resize");b(this).addClass(a.p.resizeclass)}else ra="";b(this).css("width",sa+"px").prepend(ra);var d="";if(a.p.colModel[e].hidden){b(this).css("display","none");d="display:none;"}wa+=
+"<td role='gridcell' style='height:0px;width:"+sa+"px;"+d+"'></td>";g.headers[e]={width:sa,el:this};ta=a.p.colModel[e].sortable;if(typeof ta!=="boolean")ta=a.p.colModel[e].sortable=true;d=a.p.colModel[e].name;d=="cb"||d=="subgrid"||d=="rn"||a.p.viewsortcols[2]&&b("div",this).addClass("ui-jqgrid-sortable");if(ta)if(a.p.viewsortcols[0]){b("div span.s-ico",this).show();e==a.p.lastsort&&b("div span.ui-icon-"+a.p.sortorder,this).removeClass("ui-state-disabled")}else if(e==a.p.lastsort){b("div span.s-ico",
+this).show();b("div span.ui-icon-"+a.p.sortorder,this).removeClass("ui-state-disabled")}if(a.p.footerrow)va+="<td role='gridcell' "+P(e,0,"",null,"",false)+">&#160;</td>"}).mousedown(function(e){if(b(e.target).closest("th>span.ui-jqgrid-resize").length==1){var d=b.jgrid.getCellIndex(this);if(a.p.forceFit===true){var i=a.p,n=d,p;for(p=d+1;p<a.p.colModel.length;p++)if(a.p.colModel[p].hidden!==true){n=p;break}i.nv=n-d}g.dragStart(d,e,Fa(d));return false}}).click(function(e){if(a.p.disableClick)return a.p.disableClick=
+false;var d="th>div.ui-jqgrid-sortable",i,n;a.p.viewsortcols[2]||(d="th>div>span>span.ui-grid-ico-sort");e=b(e.target).closest(d);if(e.length==1){d=b.jgrid.getCellIndex(this);if(!a.p.viewsortcols[2]){i=true;n=e.attr("sort")}Ca(b("div",this)[0].id,d,i,n);return false}});if(a.p.sortable&&b.fn.sortable)try{b(a).jqGrid("sortableColumns",q)}catch(La){}if(a.p.footerrow)va+="</tr></tbody></table>";wa+="</tr>";this.appendChild(document.createElement("tbody"));b(this).addClass("ui-jqgrid-btable").append(wa);
+wa=null;q=b("<table class='ui-jqgrid-htable' style='width:"+a.p.tblwidth+"px' role='grid' aria-labelledby='gbox_"+this.id+"' cellspacing='0' cellpadding='0' border='0'></table>").append(da);var ea=a.p.caption&&a.p.hiddengrid===true?true:false;k=b("<div class='ui-jqgrid-hbox"+(l=="rtl"?"-rtl":"")+"'></div>");da=null;g.hDiv=document.createElement("div");b(g.hDiv).css({width:g.width+"px"}).addClass("ui-state-default ui-jqgrid-hdiv").append(k);b(k).append(q);q=null;ea&&b(g.hDiv).hide();if(a.p.pager){if(typeof a.p.pager==
+"string"){if(a.p.pager.substr(0,1)!="#")a.p.pager="#"+a.p.pager}else a.p.pager="#"+b(a.p.pager).attr("id");b(a.p.pager).css({width:g.width+"px"}).appendTo(L).addClass("ui-state-default ui-jqgrid-pager ui-corner-bottom");ea&&b(a.p.pager).hide();x(a.p.pager,"")}a.p.cellEdit===false&&a.p.hoverrows===true&&b(a).bind("mouseover",function(e){Q=b(e.target).closest("tr.jqgrow");b(Q).attr("class")!=="subgrid"&&b(Q).addClass("ui-state-hover")}).bind("mouseout",function(e){Q=b(e.target).closest("tr.jqgrow");
+b(Q).removeClass("ui-state-hover")});var ka,la;b(a).before(g.hDiv).click(function(e){X=e.target;Q=b(X,a.rows).closest("tr.jqgrow");if(b(Q).length===0||Q[0].className.indexOf("ui-state-disabled")>-1)return this;var d=b(X).hasClass("cbox"),i=true;if(b.isFunction(a.p.beforeSelectRow))i=a.p.beforeSelectRow.call(a,Q[0].id,e);if(X.tagName=="A"||(X.tagName=="INPUT"||X.tagName=="TEXTAREA"||X.tagName=="OPTION"||X.tagName=="SELECT")&&!d)return this;if(i===true){if(a.p.cellEdit===true)if(a.p.multiselect&&d)b(a).jqGrid("setSelection",
+Q[0].id,true);else{ka=Q[0].rowIndex;la=b.jgrid.getCellIndex(X);try{b(a).jqGrid("editCell",ka,la,true)}catch(n){}}else if(a.p.multikey)if(e[a.p.multikey])b(a).jqGrid("setSelection",Q[0].id,true);else{if(a.p.multiselect&&d){d=b("#jqg_"+b.jgrid.jqID(a.p.id)+"_"+Q[0].id).attr("checked");b("#jqg_"+b.jgrid.jqID(a.p.id)+"_"+Q[0].id).attr("checked",!d)}}else{if(a.p.multiselect&&a.p.multiboxonly)if(!d){b(a.p.selarrrow).each(function(p,A){var s=a.rows.namedItem(A);b(s).removeClass("ui-state-highlight");b("#jqg_"+
+b.jgrid.jqID(a.p.id)+"_"+b.jgrid.jqID(A)).attr("checked",false)});a.p.selarrrow=[];b("#cb_"+b.jgrid.jqID(a.p.id),a.grid.hDiv).attr("checked",false)}b(a).jqGrid("setSelection",Q[0].id,true)}if(b.isFunction(a.p.onCellSelect)){ka=Q[0].id;la=b.jgrid.getCellIndex(X);a.p.onCellSelect.call(a,ka,la,b(X).html(),e)}}return this}).bind("reloadGrid",function(e,d){if(a.p.treeGrid===true)a.p.datatype=a.p.treedatatype;d&&d.current&&a.grid.selectionPreserver(a);if(a.p.datatype=="local"){b(a).jqGrid("resetSelection");
+a.p.data.length&&ca()}else if(!a.p.treeGrid){a.p.selrow=null;if(a.p.multiselect){a.p.selarrrow=[];b("#cb_"+b.jgrid.jqID(a.p.id),a.grid.hDiv).attr("checked",false)}a.p.savedRow=[]}a.p.scroll&&C(a.grid.bDiv,true,false);if(d&&d.page){var i=d.page;if(i>a.p.lastpage)i=a.p.lastpage;if(i<1)i=1;a.p.page=i;a.grid.bDiv.scrollTop=a.grid.prevRowHeight?(i-1)*a.grid.prevRowHeight*a.p.rowNum:0}if(a.grid.prevRowHeight&&a.p.scroll){delete a.p.lastpage;a.grid.populateVisible()}else a.grid.populate();return false});
+b.isFunction(this.p.ondblClickRow)&&b(this).dblclick(function(e){X=e.target;Q=b(X,a.rows).closest("tr.jqgrow");if(b(Q).length===0)return false;ka=Q[0].rowIndex;la=b.jgrid.getCellIndex(X);a.p.ondblClickRow.call(a,b(Q).attr("id"),ka,la,e);return false});b.isFunction(this.p.onRightClickRow)&&b(this).bind("contextmenu",function(e){X=e.target;Q=b(X,a.rows).closest("tr.jqgrow");if(b(Q).length===0)return false;a.p.multiselect||b(a).jqGrid("setSelection",Q[0].id,true);ka=Q[0].rowIndex;la=b.jgrid.getCellIndex(X);
+a.p.onRightClickRow.call(a,b(Q).attr("id"),ka,la,e);return false});g.bDiv=document.createElement("div");if(y)if(String(a.p.height).toLowerCase()==="auto")a.p.height="100%";b(g.bDiv).append(b('<div style="position:relative;'+(y&&b.browser.version<8?"height:0.01%;":"")+'"></div>').append("<div></div>").append(this)).addClass("ui-jqgrid-bdiv").css({height:a.p.height+(isNaN(a.p.height)?"":"px"),width:g.width+"px"}).scroll(g.scrollGrid);b("table:first",g.bDiv).css({width:a.p.tblwidth+"px"});if(y){b("tbody",
+this).size()==2&&b("tbody:gt(0)",this).remove();a.p.multikey&&b(g.bDiv).bind("selectstart",function(){return false})}else a.p.multikey&&b(g.bDiv).bind("mousedown",function(){return false});ea&&b(g.bDiv).hide();g.cDiv=document.createElement("div");var Aa=a.p.hidegrid===true?b("<a role='link' href='javascript:void(0)'/>").addClass("ui-jqgrid-titlebar-close HeaderButton").hover(function(){Aa.addClass("ui-state-hover")},function(){Aa.removeClass("ui-state-hover")}).append("<span class='ui-icon ui-icon-circle-triangle-n'></span>").css(l==
+"rtl"?"left":"right","0px"):"";b(g.cDiv).append(Aa).append("<span class='ui-jqgrid-title"+(l=="rtl"?"-rtl":"")+"'>"+a.p.caption+"</span>").addClass("ui-jqgrid-titlebar ui-widget-header ui-corner-top ui-helper-clearfix");b(g.cDiv).insertBefore(g.hDiv);if(a.p.toolbar[0]){g.uDiv=document.createElement("div");if(a.p.toolbar[1]=="top")b(g.uDiv).insertBefore(g.hDiv);else a.p.toolbar[1]=="bottom"&&b(g.uDiv).insertAfter(g.hDiv);if(a.p.toolbar[1]=="both"){g.ubDiv=document.createElement("div");b(g.uDiv).insertBefore(g.hDiv).addClass("ui-userdata ui-state-default").attr("id",
+"t_"+this.id);b(g.ubDiv).insertAfter(g.hDiv).addClass("ui-userdata ui-state-default").attr("id","tb_"+this.id);ea&&b(g.ubDiv).hide()}else b(g.uDiv).width(g.width).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id);ea&&b(g.uDiv).hide()}if(a.p.toppager){a.p.toppager=b.jgrid.jqID(a.p.id)+"_toppager";g.topDiv=b("<div id='"+a.p.toppager+"'></div>")[0];a.p.toppager="#"+a.p.toppager;b(g.topDiv).insertBefore(g.hDiv).addClass("ui-state-default ui-jqgrid-toppager").width(g.width);x(a.p.toppager,
+"_t")}if(a.p.footerrow){g.sDiv=b("<div class='ui-jqgrid-sdiv'></div>")[0];k=b("<div class='ui-jqgrid-hbox"+(l=="rtl"?"-rtl":"")+"'></div>");b(g.sDiv).append(k).insertAfter(g.hDiv).width(g.width);b(k).append(va);g.footers=b(".ui-jqgrid-ftable",g.sDiv)[0].rows[0].cells;if(a.p.rownumbers)g.footers[0].className="ui-state-default jqgrid-rownum";ea&&b(g.sDiv).hide()}k=null;if(a.p.caption){var Ga=a.p.datatype;if(a.p.hidegrid===true){b(".ui-jqgrid-titlebar-close",g.cDiv).click(function(e){var d=b.isFunction(a.p.onHeaderClick),
+i=".ui-jqgrid-bdiv, .ui-jqgrid-hdiv, .ui-jqgrid-pager, .ui-jqgrid-sdiv",n,p=this;if(a.p.toolbar[0]===true){if(a.p.toolbar[1]=="both")i+=", #"+b(g.ubDiv).attr("id");i+=", #"+b(g.uDiv).attr("id")}n=b(i,"#gview_"+b.jgrid.jqID(a.p.id)).length;if(a.p.gridstate=="visible")b(i,"#gbox_"+b.jgrid.jqID(a.p.id)).slideUp("fast",function(){n--;if(n===0){b("span",p).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s");a.p.gridstate="hidden";b("#gbox_"+b.jgrid.jqID(a.p.id)).hasClass("ui-resizable")&&
+b(".ui-resizable-handle","#gbox_"+b.jgrid.jqID(a.p.id)).hide();if(d)ea||a.p.onHeaderClick.call(a,a.p.gridstate,e)}});else a.p.gridstate=="hidden"&&b(i,"#gbox_"+b.jgrid.jqID(a.p.id)).slideDown("fast",function(){n--;if(n===0){b("span",p).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n");if(ea){a.p.datatype=Ga;ja();ea=false}a.p.gridstate="visible";b("#gbox_"+b.jgrid.jqID(a.p.id)).hasClass("ui-resizable")&&b(".ui-resizable-handle","#gbox_"+b.jgrid.jqID(a.p.id)).show();if(d)ea||
+a.p.onHeaderClick.call(a,a.p.gridstate,e)}});return false});if(ea){a.p.datatype="local";b(".ui-jqgrid-titlebar-close",g.cDiv).trigger("click")}}}else b(g.cDiv).hide();b(g.hDiv).after(g.bDiv).mousemove(function(e){if(g.resizing){g.dragMove(e);return false}});b(".ui-jqgrid-labels",g.hDiv).bind("selectstart",function(){return false});b(document).mouseup(function(){if(g.resizing){g.dragEnd();return false}return true});a.formatCol=P;a.sortData=Ca;a.updatepager=function(e,d){var i,n,p,A,s,E,u,z="",w=a.p.pager?
+"_"+b.jgrid.jqID(a.p.pager.substr(1)):"",t=a.p.toppager?"_"+a.p.toppager.substr(1):"";p=parseInt(a.p.page,10)-1;if(p<0)p=0;p*=parseInt(a.p.rowNum,10);s=p+a.p.reccount;if(a.p.scroll){i=b("tbody:first > tr:gt(0)",a.grid.bDiv);p=s-i.length;a.p.reccount=i.length;if(n=i.outerHeight()||a.grid.prevRowHeight){i=p*n;n*=parseInt(a.p.records,10);b(">div:first",a.grid.bDiv).css({height:n}).children("div:first").css({height:i,display:i?"":"none"})}a.grid.bDiv.scrollLeft=a.grid.hDiv.scrollLeft}z=a.p.pager?a.p.pager:
+"";z+=a.p.toppager?z?","+a.p.toppager:a.p.toppager:"";if(z){u=b.jgrid.formatter.integer||{};i=M(a.p.page);n=M(a.p.lastpage);b(".selbox",z).attr("disabled",false);if(a.p.pginput===true){b(".ui-pg-input",z).val(a.p.page);A=a.p.toppager?"#sp_1"+w+",#sp_1"+t:"#sp_1"+w;b(A).html(b.fmatter?b.fmatter.util.NumberFormat(a.p.lastpage,u):a.p.lastpage)}if(a.p.viewrecords)if(a.p.reccount===0)b(".ui-paging-info",z).html(a.p.emptyrecords);else{A=p+1;E=a.p.records;if(b.fmatter){A=b.fmatter.util.NumberFormat(A,u);
+s=b.fmatter.util.NumberFormat(s,u);E=b.fmatter.util.NumberFormat(E,u)}b(".ui-paging-info",z).html(b.jgrid.format(a.p.recordtext,A,s,E))}if(a.p.pgbuttons===true){if(i<=0)i=n=0;if(i==1||i===0){b("#first"+w+", #prev"+w).addClass("ui-state-disabled").removeClass("ui-state-hover");a.p.toppager&&b("#first_t"+t+", #prev_t"+t).addClass("ui-state-disabled").removeClass("ui-state-hover")}else{b("#first"+w+", #prev"+w).removeClass("ui-state-disabled");a.p.toppager&&b("#first_t"+t+", #prev_t"+t).removeClass("ui-state-disabled")}if(i==
+n||i===0){b("#next"+w+", #last"+w).addClass("ui-state-disabled").removeClass("ui-state-hover");a.p.toppager&&b("#next_t"+t+", #last_t"+t).addClass("ui-state-disabled").removeClass("ui-state-hover")}else{b("#next"+w+", #last"+w).removeClass("ui-state-disabled");a.p.toppager&&b("#next_t"+t+", #last_t"+t).removeClass("ui-state-disabled")}}}e===true&&a.p.rownumbers===true&&b("td.jqgrid-rownum",a.rows).each(function(F){b(this).html(p+1+F)});d&&a.p.jqgdnd&&b(a).jqGrid("gridDnD","updateDnD");b.isFunction(a.p.gridComplete)&&
+a.p.gridComplete.call(a)};a.refreshIndex=ca;a.formatter=function(e,d,i,n,p){return o(e,d,i,n,p)};b.extend(g,{populate:ja,emptyRows:C});this.grid=g;a.addXmlData=function(e){V(e,a.grid.bDiv)};a.addJSONData=function(e){fa(e,a.grid.bDiv)};this.grid.cols=this.rows[0].cells;ja();a.p.hiddengrid=false;b(window).unload(function(){a=null})}}}})};b.jgrid.extend({getGridParam:function(f){var j=this[0];if(j&&j.grid)return f?typeof j.p[f]!="undefined"?j.p[f]:null:j.p},setGridParam:function(f){return this.each(function(){this.grid&&
+typeof f==="object"&&b.extend(true,this.p,f)})},getDataIDs:function(){var f=[],j=0,h,c=0;this.each(function(){if((h=this.rows.length)&&h>0)for(;j<h;){if(b(this.rows[j]).hasClass("jqgrow")){f[c]=this.rows[j].id;c++}j++}});return f},setSelection:function(f,j){return this.each(function(){function h(a){var q=b(c.grid.bDiv)[0].clientHeight,x=b(c.grid.bDiv)[0].scrollTop,y=c.rows[a].offsetTop;a=c.rows[a].clientHeight;if(y+a>=q+x)b(c.grid.bDiv)[0].scrollTop=y-(q+x)+a+x;else if(y<q+x)if(y<x)b(c.grid.bDiv)[0].scrollTop=
+y}var c=this,g,k,l;if(f!==undefined){j=j===false?false:true;k=c.rows.namedItem(f+"");if(!(!k||k.className.indexOf("ui-state-disabled")>-1)){if(c.p.scrollrows===true){g=c.rows.namedItem(f).rowIndex;g>=0&&h(g)}if(c.p.multiselect){c.p.selrow=k.id;l=b.inArray(c.p.selrow,c.p.selarrrow);if(l===-1){k.className!=="ui-subgrid"&&b(k).addClass("ui-state-highlight").attr("aria-selected","true");g=true;b("#jqg_"+b.jgrid.jqID(c.p.id)+"_"+b.jgrid.jqID(c.p.selrow)).attr("checked",g);c.p.selarrrow.push(c.p.selrow)}else{k.className!==
+"ui-subgrid"&&b(k).removeClass("ui-state-highlight").attr("aria-selected","false");g=false;b("#jqg_"+b.jgrid.jqID(c.p.id)+"_"+b.jgrid.jqID(c.p.selrow)).attr("checked",g);c.p.selarrrow.splice(l,1);l=c.p.selarrrow[0];c.p.selrow=l===undefined?null:l}c.p.onSelectRow&&j&&c.p.onSelectRow.call(c,k.id,g)}else if(k.className!=="ui-subgrid"){if(c.p.selrow!=k.id){b(c.rows.namedItem(c.p.selrow)).removeClass("ui-state-highlight").attr({"aria-selected":"false",tabindex:"-1"});b(k).addClass("ui-state-highlight").attr({"aria-selected":true,
+tabindex:"0"});g=true}else g=false;c.p.selrow=k.id;c.p.onSelectRow&&j&&c.p.onSelectRow.call(c,k.id,g)}}}})},resetSelection:function(f){return this.each(function(){var j=this,h,c;if(typeof f!=="undefined"){c=f===j.p.selrow?j.p.selrow:f;b("#"+b.jgrid.jqID(j.p.id)+" tbody:first tr#"+b.jgrid.jqID(c)).removeClass("ui-state-highlight").attr("aria-selected","false");if(j.p.multiselect){b("#jqg_"+b.jgrid.jqID(j.p.id)+"_"+b.jgrid.jqID(c)).attr("checked",false);b("#cb_"+b.jgrid.jqID(j.p.id)).attr("checked",
+false)}c=null}else if(j.p.multiselect){b(j.p.selarrrow).each(function(g,k){h=j.rows.namedItem(k);b(h).removeClass("ui-state-highlight").attr("aria-selected","false");b("#jqg_"+b.jgrid.jqID(j.p.id)+"_"+b.jgrid.jqID(k)).attr("checked",false)});b("#cb_"+b.jgrid.jqID(j.p.id)).attr("checked",false);j.p.selarrrow=[]}else if(j.p.selrow){b("#"+b.jgrid.jqID(j.p.id)+" tbody:first tr#"+b.jgrid.jqID(j.p.selrow)).removeClass("ui-state-highlight").attr("aria-selected","false");j.p.selrow=null}j.p.savedRow=[]})},
+getRowData:function(f){var j={},h,c=false,g,k=0;this.each(function(){var l=this,a,q;if(typeof f=="undefined"){c=true;h=[];g=l.rows.length}else{q=l.rows.namedItem(f);if(!q)return j;g=2}for(;k<g;){if(c)q=l.rows[k];if(b(q).hasClass("jqgrow")){b("td",q).each(function(x){a=l.p.colModel[x].name;if(a!=="cb"&&a!=="subgrid"&&a!=="rn")if(l.p.treeGrid===true&&a==l.p.ExpandColumn)j[a]=b.jgrid.htmlDecode(b("span:first",this).html());else try{j[a]=b.unformat(this,{rowId:q.id,colModel:l.p.colModel[x]},x)}catch(y){j[a]=
+b.jgrid.htmlDecode(b(this).html())}});if(c){h.push(j);j={}}}k++}});return h?h:j},delRowData:function(f){var j=false,h,c;this.each(function(){if(h=this.rows.namedItem(f)){b(h).remove();this.p.records--;this.p.reccount--;this.updatepager(true,false);j=true;if(this.p.multiselect){c=b.inArray(f,this.p.selarrrow);c!=-1&&this.p.selarrrow.splice(c,1)}if(f==this.p.selrow)this.p.selrow=null}else return false;if(this.p.datatype=="local"){var g=this.p._index[f];if(typeof g!="undefined"){this.p.data.splice(g,
+1);this.refreshIndex()}}if(this.p.altRows===true&&j){var k=this.p.altclass;b(this.rows).each(function(l){l%2==1?b(this).addClass(k):b(this).removeClass(k)})}});return j},setRowData:function(f,j,h){var c,g=true,k;this.each(function(){if(!this.grid)return false;var l=this,a,q,x=typeof h,y={};q=l.rows.namedItem(f);if(!q)return false;if(j)try{b(this.p.colModel).each(function(P){c=this.name;if(j[c]!==undefined){y[c]=this.formatter&&typeof this.formatter==="string"&&this.formatter=="date"?b.unformat.date(j[c],
+this):j[c];a=l.formatter(f,j[c],P,j,"edit");k=this.title?{title:b.jgrid.stripHtml(a)}:{};l.p.treeGrid===true&&c==l.p.ExpandColumn?b("td:eq("+P+") > span:first",q).html(a).attr(k):b("td:eq("+P+")",q).html(a).attr(k)}});if(l.p.datatype=="local"){var H=l.p._index[f];if(l.p.treeGrid)for(var L in l.p.treeReader)y.hasOwnProperty(l.p.treeReader[L])&&delete y[l.p.treeReader[L]];if(typeof H!="undefined")l.p.data[H]=b.extend(true,l.p.data[H],y);y=null}}catch(M){g=false}if(g)if(x==="string")b(q).addClass(h);
+else x==="object"&&b(q).css(h)});return g},addRowData:function(f,j,h,c){h||(h="last");var g=false,k,l,a,q,x,y,H,L,M="",P,U,o,m,r;if(j){if(b.isArray(j)){P=true;h="last";U=f}else{j=[j];P=false}this.each(function(){var D=j.length;x=this.p.rownumbers===true?1:0;a=this.p.multiselect===true?1:0;q=this.p.subGrid===true?1:0;if(!P)if(typeof f!="undefined")f+="";else{f=b.jgrid.randId();if(this.p.keyIndex!==false){U=this.p.colModel[this.p.keyIndex+a+q+x].name;if(typeof j[0][U]!="undefined")f=j[0][U]}}o=this.p.altclass;
+for(var T=0,I="",C={},ca=b.isFunction(this.p.afterInsertRow)?true:false;T<D;){m=j[T];l="";if(P){try{f=m[U]}catch(V){f=b.jgrid.randId()}I=this.p.altRows===true?(this.rows.length-1)%2===0?o:"":""}if(x){M=this.formatCol(0,1,"",null,f,true);l+='<td role="gridcell" aria-describedby="'+this.p.id+'_rn" class="ui-state-default jqgrid-rownum" '+M+">0</td>"}if(a){L='<input role="checkbox" type="checkbox" id="jqg_'+this.p.id+"_"+f+'" class="cbox"/>';M=this.formatCol(x,1,"",null,f,true);l+='<td role="gridcell" aria-describedby="'+
+this.p.id+'_cb" '+M+">"+L+"</td>"}if(q)l+=b(this).jqGrid("addSubGridCell",a+x,1);for(H=a+q+x;H<this.p.colModel.length;H++){r=this.p.colModel[H];k=r.name;C[k]=r.formatter&&typeof r.formatter==="string"&&r.formatter=="date"?b.unformat.date(m[k],r):m[k];L=this.formatter(f,b.jgrid.getAccessor(m,k),H,m,"edit");M=this.formatCol(H,1,L,f,m,true);l+='<td role="gridcell" aria-describedby="'+this.p.id+"_"+k+'" '+M+">"+L+"</td>"}l='<tr id="'+f+'" role="row" tabindex="-1" class="ui-widget-content jqgrow ui-row-'+
+this.p.direction+" "+I+'">'+l+"</tr>";if(this.rows.length===0)b("table:first",this.grid.bDiv).append(l);else switch(h){case "last":b(this.rows[this.rows.length-1]).after(l);y=this.rows.length-1;break;case "first":b(this.rows[0]).after(l);y=1;break;case "after":if(y=this.rows.namedItem(c))b(this.rows[y.rowIndex+1]).hasClass("ui-subgrid")?b(this.rows[y.rowIndex+1]).after(l):b(y).after(l);y++;break;case "before":if(y=this.rows.namedItem(c)){b(y).before(l);y=y.rowIndex}y--}this.p.subGrid===true&&b(this).jqGrid("addSubGrid",
+a+x,y);this.p.records++;this.p.reccount++;ca&&this.p.afterInsertRow.call(this,f,m,m);T++;if(this.p.datatype=="local"){C[this.p.localReader.id]=f;this.p._index[f]=this.p.data.length;this.p.data.push(C);C={}}}if(this.p.altRows===true&&!P)if(h=="last")(this.rows.length-1)%2==1&&b(this.rows[this.rows.length-1]).addClass(o);else b(this.rows).each(function(fa){fa%2==1?b(this).addClass(o):b(this).removeClass(o)});this.updatepager(true,true);g=true})}return g},footerData:function(f,j,h){function c(q){for(var x in q)if(q.hasOwnProperty(x))return false;
+return true}var g,k=false,l={},a;if(typeof f=="undefined")f="get";if(typeof h!="boolean")h=true;f=f.toLowerCase();this.each(function(){var q=this,x;if(!q.grid||!q.p.footerrow)return false;if(f=="set")if(c(j))return false;k=true;b(this.p.colModel).each(function(y){g=this.name;if(f=="set"){if(j[g]!==undefined){x=h?q.formatter("",j[g],y,j,"edit"):j[g];a=this.title?{title:b.jgrid.stripHtml(x)}:{};b("tr.footrow td:eq("+y+")",q.grid.sDiv).html(x).attr(a);k=true}}else if(f=="get")l[g]=b("tr.footrow td:eq("+
+y+")",q.grid.sDiv).html()})});return f=="get"?l:k},showHideCol:function(f,j){return this.each(function(){var h=this,c=false,g=b.browser.webkit||b.browser.safari?0:h.p.cellLayout,k;if(h.grid){if(typeof f==="string")f=[f];j=j!="none"?"":"none";var l=j===""?true:false;b(this.p.colModel).each(function(a){if(b.inArray(this.name,f)!==-1&&this.hidden===l){b("tr",h.grid.hDiv).each(function(){b(this).children("th:eq("+a+")").css("display",j)});b(h.rows).each(function(){b(this).children("td:eq("+a+")").css("display",
+j)});h.p.footerrow&&b("tr.footrow td:eq("+a+")",h.grid.sDiv).css("display",j);k=this.widthOrg?this.widthOrg:parseInt(this.width,10);if(j==="none")h.p.tblwidth-=k+g;else h.p.tblwidth+=k+g;this.hidden=!l;c=true}});if(c===true)if(h.p.shrinkToFit===false)b(h).jqGrid("setGridWidth",h.grid.width);else h.grid.width!==h.p.tblwidth&&b(h).jqGrid("setGridWidth",h.p.tblwidth)}})},hideCol:function(f){return this.each(function(){b(this).jqGrid("showHideCol",f,"none")})},showCol:function(f){return this.each(function(){b(this).jqGrid("showHideCol",
+f,"")})},remapColumns:function(f,j,h){function c(l){var a;a=l.length?b.makeArray(l):b.extend({},l);b.each(f,function(q){l[q]=a[this]})}function g(l,a){b(">tr"+(a||""),l).each(function(){var q=this,x=b.makeArray(q.cells);b.each(f,function(){var y=x[this];y&&q.appendChild(y)})})}var k=this.get(0);c(k.p.colModel);c(k.p.colNames);c(k.grid.headers);g(b("thead:first",k.grid.hDiv),h&&":not(.ui-jqgrid-labels)");j&&g(b("#"+b.jgrid.jqID(k.p.id)+" tbody:first"),".jqgfirstrow, tr.jqgrow, tr.jqfoot");k.p.footerrow&&
+g(b("tbody:first",k.grid.sDiv));if(k.p.remapColumns)if(k.p.remapColumns.length)c(k.p.remapColumns);else k.p.remapColumns=b.makeArray(f);k.p.lastsort=b.inArray(k.p.lastsort,f);if(k.p.treeGrid)k.p.expColInd=b.inArray(k.p.expColInd,f)},setGridWidth:function(f,j){return this.each(function(){if(this.grid){var h=this,c,g=0,k=b.browser.webkit||b.browser.safari?0:h.p.cellLayout,l,a=0,q=false,x=h.p.scrollOffset,y,H=0,L=0,M;if(typeof j!="boolean")j=h.p.shrinkToFit;if(!isNaN(f)){f=parseInt(f,10);h.grid.width=
+h.p.width=f;b("#gbox_"+b.jgrid.jqID(h.p.id)).css("width",f+"px");b("#gview_"+b.jgrid.jqID(h.p.id)).css("width",f+"px");b(h.grid.bDiv).css("width",f+"px");b(h.grid.hDiv).css("width",f+"px");h.p.pager&&b(h.p.pager).css("width",f+"px");h.p.toppager&&b(h.p.toppager).css("width",f+"px");if(h.p.toolbar[0]===true){b(h.grid.uDiv).css("width",f+"px");h.p.toolbar[1]=="both"&&b(h.grid.ubDiv).css("width",f+"px")}h.p.footerrow&&b(h.grid.sDiv).css("width",f+"px");if(j===false&&h.p.forceFit===true)h.p.forceFit=
+false;if(j===true){b.each(h.p.colModel,function(){if(this.hidden===false){c=this.widthOrg?this.widthOrg:parseInt(this.width,10);g+=c+k;if(this.fixed)H+=c+k;else a++;L++}});if(a===0)return;h.p.tblwidth=g;y=f-k*a-H;if(!isNaN(h.p.height))if(b(h.grid.bDiv)[0].clientHeight<b(h.grid.bDiv)[0].scrollHeight||h.rows.length===1){q=true;y-=x}g=0;var P=h.grid.cols.length>0;b.each(h.p.colModel,function(U){if(this.hidden===false&&!this.fixed){c=this.widthOrg?this.widthOrg:parseInt(this.width,10);c=Math.round(y*
+c/(h.p.tblwidth-k*a-H));if(!(c<0)){this.width=c;g+=c;h.grid.headers[U].width=c;h.grid.headers[U].el.style.width=c+"px";if(h.p.footerrow)h.grid.footers[U].style.width=c+"px";if(P)h.grid.cols[U].style.width=c+"px";l=U}}});M=0;if(q){if(f-H-(g+k*a)!==x)M=f-H-(g+k*a)-x}else if(Math.abs(f-H-(g+k*a))!==1)M=f-H-(g+k*a);h.p.colModel[l].width+=M;h.p.tblwidth=g+M+k*a+H;if(h.p.tblwidth>f){q=h.p.tblwidth-parseInt(f,10);h.p.tblwidth=f;c=h.p.colModel[l].width-=q}else c=h.p.colModel[l].width;h.grid.headers[l].width=
+c;h.grid.headers[l].el.style.width=c+"px";if(P)h.grid.cols[l].style.width=c+"px";if(h.p.footerrow)h.grid.footers[l].style.width=c+"px"}if(h.p.tblwidth){b("table:first",h.grid.bDiv).css("width",h.p.tblwidth+"px");b("table:first",h.grid.hDiv).css("width",h.p.tblwidth+"px");h.grid.hDiv.scrollLeft=h.grid.bDiv.scrollLeft;h.p.footerrow&&b("table:first",h.grid.sDiv).css("width",h.p.tblwidth+"px")}}}})},setGridHeight:function(f){return this.each(function(){if(this.grid){b(this.grid.bDiv).css({height:f+(isNaN(f)?
+"":"px")});this.p.height=f;this.p.scroll&&this.grid.populateVisible()}})},setCaption:function(f){return this.each(function(){this.p.caption=f;b("span.ui-jqgrid-title",this.grid.cDiv).html(f);b(this.grid.cDiv).show()})},setLabel:function(f,j,h,c){return this.each(function(){var g=-1;if(this.grid)if(typeof f!="undefined"){b(this.p.colModel).each(function(a){if(this.name==f){g=a;return false}});if(g>=0){var k=b("tr.ui-jqgrid-labels th:eq("+g+")",this.grid.hDiv);if(j){var l=b(".s-ico",k);b("[id^=jqgh_]",
+k).empty().html(j).append(l);this.p.colNames[g]=j}if(h)typeof h==="string"?b(k).addClass(h):b(k).css(h);typeof c==="object"&&b(k).attr(c)}}})},setCell:function(f,j,h,c,g,k){return this.each(function(){var l=-1,a,q;if(this.grid){if(isNaN(j))b(this.p.colModel).each(function(y){if(this.name==j){l=y;return false}});else l=parseInt(j,10);if(l>=0)if(a=this.rows.namedItem(f)){var x=b("td:eq("+l+")",a);if(h!==""||k===true){a=this.formatter(f,h,l,a,"edit");q=this.p.colModel[l].title?{title:b.jgrid.stripHtml(a)}:
+{};this.p.treeGrid&&b(".tree-wrap",b(x)).length>0?b("span",b(x)).html(a).attr(q):b(x).html(a).attr(q);if(this.p.datatype=="local"){a=this.p.colModel[l];h=a.formatter&&typeof a.formatter==="string"&&a.formatter=="date"?b.unformat.date(h,a):h;q=this.p._index[f];if(typeof q!="undefined")this.p.data[q][a.name]=h}}if(typeof c==="string")b(x).addClass(c);else c&&b(x).css(c);typeof g==="object"&&b(x).attr(g)}}})},getCell:function(f,j){var h=false;this.each(function(){var c=-1;if(this.grid){if(isNaN(j))b(this.p.colModel).each(function(l){if(this.name===
+j){c=l;return false}});else c=parseInt(j,10);if(c>=0){var g=this.rows.namedItem(f);if(g)try{h=b.unformat(b("td:eq("+c+")",g),{rowId:g.id,colModel:this.p.colModel[c]},c)}catch(k){h=b.jgrid.htmlDecode(b("td:eq("+c+")",g).html())}}}});return h},getCol:function(f,j,h){var c=[],g,k=0,l=0,a=0,q;j=typeof j!="boolean"?false:j;if(typeof h=="undefined")h=false;this.each(function(){var x=-1;if(this.grid){if(isNaN(f))b(this.p.colModel).each(function(M){if(this.name===f){x=M;return false}});else x=parseInt(f,
+10);if(x>=0){var y=this.rows.length,H=0;if(y&&y>0){for(;H<y;){if(b(this.rows[H]).hasClass("jqgrow")){try{g=b.unformat(b(this.rows[H].cells[x]),{rowId:this.rows[H].id,colModel:this.p.colModel[x]},x)}catch(L){g=b.jgrid.htmlDecode(this.rows[H].cells[x].innerHTML)}if(h){q=parseFloat(g);k+=q;l=Math.min(l,q);a=Math.max(l,q)}else j?c.push({id:this.rows[H].id,value:g}):c.push(g)}H++}if(h)switch(h.toLowerCase()){case "sum":c=k;break;case "avg":c=k/y;break;case "count":c=y;break;case "min":c=l;break;case "max":c=
+a}}}}});return c},clearGridData:function(f){return this.each(function(){if(this.grid){if(typeof f!="boolean")f=false;if(this.p.deepempty)b("#"+b.jgrid.jqID(this.p.id)+" tbody:first tr:gt(0)").remove();else{var j=b("#"+b.jgrid.jqID(this.p.id)+" tbody:first tr:first")[0];b("#"+b.jgrid.jqID(this.p.id)+" tbody:first").empty().append(j)}this.p.footerrow&&f&&b(".ui-jqgrid-ftable td",this.grid.sDiv).html("&#160;");this.p.selrow=null;this.p.selarrrow=[];this.p.savedRow=[];this.p.records=0;this.p.page=1;this.p.lastpage=
+0;this.p.reccount=0;this.p.data=[];this.p._index={};this.updatepager(true,false)}})},getInd:function(f,j){var h=false,c;this.each(function(){if(c=this.rows.namedItem(f))h=j===true?c:c.rowIndex});return h},bindKeys:function(f){var j=b.extend({onEnter:null,onSpace:null,onLeftKey:null,onRightKey:null,scrollingRows:true},f||{});return this.each(function(){var h=this;b("body").is("[role]")||b("body").attr("role","application");h.p.scrollrows=j.scrollingRows;b(h).keydown(function(c){var g=b(h).find("tr[tabindex=0]")[0],
+k,l,a,q=h.p.treeReader.expanded_field;if(g){a=h.p._index[g.id];if(c.keyCode===37||c.keyCode===38||c.keyCode===39||c.keyCode===40){if(c.keyCode===38){l=g.previousSibling;k="";if(l)if(b(l).is(":hidden"))for(;l;){l=l.previousSibling;if(!b(l).is(":hidden")&&b(l).hasClass("jqgrow")){k=l.id;break}}else k=l.id;b(h).jqGrid("setSelection",k)}if(c.keyCode===40){l=g.nextSibling;k="";if(l)if(b(l).is(":hidden"))for(;l;){l=l.nextSibling;if(!b(l).is(":hidden")&&b(l).hasClass("jqgrow")){k=l.id;break}}else k=l.id;
+b(h).jqGrid("setSelection",k)}if(c.keyCode===37){h.p.treeGrid&&h.p.data[a][q]&&b(g).find("div.treeclick").trigger("click");b.isFunction(j.onLeftKey)&&j.onLeftKey.call(h,h.p.selrow)}if(c.keyCode===39){h.p.treeGrid&&!h.p.data[a][q]&&b(g).find("div.treeclick").trigger("click");b.isFunction(j.onRightKey)&&j.onRightKey.call(h,h.p.selrow)}}else if(c.keyCode===13)b.isFunction(j.onEnter)&&j.onEnter.call(h,h.p.selrow);else c.keyCode===32&&b.isFunction(j.onSpace)&&j.onSpace.call(h,h.p.selrow)}})})},unbindKeys:function(){return this.each(function(){b(this).unbind("keydown")})},
+getLocalRow:function(f){var j=false,h;this.each(function(){if(typeof f!=="undefined"){h=this.p._index[f];if(h>=0)j=this.p.data[h]}});return j}})})(jQuery);
+(function(b){b.fmatter={};b.extend(b.fmatter,{isBoolean:function(a){return typeof a==="boolean"},isObject:function(a){return a&&(typeof a==="object"||b.isFunction(a))||false},isString:function(a){return typeof a==="string"},isNumber:function(a){return typeof a==="number"&&isFinite(a)},isNull:function(a){return a===null},isUndefined:function(a){return typeof a==="undefined"},isValue:function(a){return this.isObject(a)||this.isString(a)||this.isNumber(a)||this.isBoolean(a)},isEmpty:function(a){if(!this.isString(a)&&
+this.isValue(a))return false;else if(!this.isValue(a))return true;a=b.trim(a).replace(/\&nbsp\;/ig,"").replace(/\&#160\;/ig,"");return a===""}});b.fn.fmatter=function(a,c,d,e,f){var g=c;d=b.extend({},b.jgrid.formatter,d);if(b.fn.fmatter[a])g=b.fn.fmatter[a](c,d,e,f);return g};b.fmatter.util={NumberFormat:function(a,c){b.fmatter.isNumber(a)||(a*=1);if(b.fmatter.isNumber(a)){var d=a<0,e=a+"",f=c.decimalSeparator?c.decimalSeparator:".",g;if(b.fmatter.isNumber(c.decimalPlaces)){var h=c.decimalPlaces;
+e=Math.pow(10,h);e=Math.round(a*e)/e+"";g=e.lastIndexOf(".");if(h>0){if(g<0){e+=f;g=e.length-1}else if(f!==".")e=e.replace(".",f);for(;e.length-1-g<h;)e+="0"}}if(c.thousandsSeparator){h=c.thousandsSeparator;g=e.lastIndexOf(f);g=g>-1?g:e.length;f=e.substring(g);for(var i=-1,j=g;j>0;j--){i++;if(i%3===0&&j!==g&&(!d||j>1))f=h+f;f=e.charAt(j-1)+f}e=f}e=c.prefix?c.prefix+e:e;return e=c.suffix?e+c.suffix:e}else return a},DateFormat:function(a,c,d,e){var f=/^\/Date\((([-+])?[0-9]+)(([-+])([0-9]{2})([0-9]{2}))?\)\/$/,
+g=typeof c==="string"?c.match(f):null;f=function(m,r){m=String(m);for(r=parseInt(r,10)||2;m.length<r;)m="0"+m;return m};var h={m:1,d:1,y:1970,h:0,i:0,s:0,u:0},i=0,j,k=["i18n"];k.i18n={dayNames:e.dayNames,monthNames:e.monthNames};if(a in e.masks)a=e.masks[a];if(c.constructor===Number){if(String(a).toLowerCase()=="u")c*=1E3;i=new Date(c)}else if(c.constructor===Date)i=c;else if(g!==null){i=new Date(parseInt(g[1],10));if(g[3]){a=Number(g[5])*60+Number(g[6]);a*=g[4]=="-"?1:-1;a-=i.getTimezoneOffset();
+i.setTime(Number(Number(i)+a*6E4))}}else{c=String(c).split(/[\\\/:_;.,\t\T\s-]/);a=a.split(/[\\\/:_;.,\t\T\s-]/);g=0;for(j=a.length;g<j;g++){if(a[g]=="M"){i=b.inArray(c[g],k.i18n.monthNames);if(i!==-1&&i<12)c[g]=i+1}if(a[g]=="F"){i=b.inArray(c[g],k.i18n.monthNames);if(i!==-1&&i>11)c[g]=i+1-12}if(c[g])h[a[g].toLowerCase()]=parseInt(c[g],10)}if(h.f)h.m=h.f;if(h.m===0&&h.y===0&&h.d===0)return"&#160;";h.m=parseInt(h.m,10)-1;i=h.y;if(i>=70&&i<=99)h.y=1900+h.y;else if(i>=0&&i<=69)h.y=2E3+h.y;i=new Date(h.y,
+h.m,h.d,h.h,h.i,h.s,h.u)}if(d in e.masks)d=e.masks[d];else d||(d="Y-m-d");a=i.getHours();c=i.getMinutes();h=i.getDate();g=i.getMonth()+1;j=i.getTimezoneOffset();var l=i.getSeconds(),o=i.getMilliseconds(),n=i.getDay(),p=i.getFullYear(),q=(n+6)%7+1,s=(new Date(p,g-1,h)-new Date(p,0,1))/864E5,t={d:f(h),D:k.i18n.dayNames[n],j:h,l:k.i18n.dayNames[n+7],N:q,S:e.S(h),w:n,z:s,W:q<5?Math.floor((s+q-1)/7)+1:Math.floor((s+q-1)/7)||(((new Date(p-1,0,1)).getDay()+6)%7<4?53:52),F:k.i18n.monthNames[g-1+12],m:f(g),
+M:k.i18n.monthNames[g-1],n:g,t:"?",L:"?",o:"?",Y:p,y:String(p).substring(2),a:a<12?e.AmPm[0]:e.AmPm[1],A:a<12?e.AmPm[2]:e.AmPm[3],B:"?",g:a%12||12,G:a,h:f(a%12||12),H:f(a),i:f(c),s:f(l),u:o,e:"?",I:"?",O:(j>0?"-":"+")+f(Math.floor(Math.abs(j)/60)*100+Math.abs(j)%60,4),P:"?",T:(String(i).match(/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g)||[""]).pop().replace(/[^-+\dA-Z]/g,""),Z:"?",c:"?",r:"?",U:Math.floor(i/
+1E3)};return d.replace(/\\.|[dDjlNSwzWFmMntLoYyaABgGhHisueIOPTZcrU]/g,function(m){return m in t?t[m]:m.substring(1)})}};b.fn.fmatter.defaultFormat=function(a,c){return b.fmatter.isValue(a)&&a!==""?a:c.defaultValue?c.defaultValue:"&#160;"};b.fn.fmatter.email=function(a,c){return b.fmatter.isEmpty(a)?b.fn.fmatter.defaultFormat(a,c):'<a href="mailto:'+a+'">'+a+"</a>"};b.fn.fmatter.checkbox=function(a,c){var d=b.extend({},c.checkbox),e;b.fmatter.isUndefined(c.colModel.formatoptions)||(d=b.extend({},d,
+c.colModel.formatoptions));e=d.disabled===true?'disabled="disabled"':"";if(b.fmatter.isEmpty(a)||b.fmatter.isUndefined(a))a=b.fn.fmatter.defaultFormat(a,d);a+="";a=a.toLowerCase();return'<input type="checkbox" '+(a.search(/(false|0|no|off)/i)<0?" checked='checked' ":"")+' value="'+a+'" offval="no" '+e+"/>"};b.fn.fmatter.link=function(a,c){var d={target:c.target},e="";b.fmatter.isUndefined(c.colModel.formatoptions)||(d=b.extend({},d,c.colModel.formatoptions));if(d.target)e="target="+d.target;return b.fmatter.isEmpty(a)?
+b.fn.fmatter.defaultFormat(a,c):"<a "+e+' href="'+a+'">'+a+"</a>"};b.fn.fmatter.showlink=function(a,c){var d={baseLinkUrl:c.baseLinkUrl,showAction:c.showAction,addParam:c.addParam||"",target:c.target,idName:c.idName},e="";b.fmatter.isUndefined(c.colModel.formatoptions)||(d=b.extend({},d,c.colModel.formatoptions));if(d.target)e="target="+d.target;d=d.baseLinkUrl+d.showAction+"?"+d.idName+"="+c.rowId+d.addParam;return b.fmatter.isString(a)||b.fmatter.isNumber(a)?"<a "+e+' href="'+d+'">'+a+"</a>":b.fn.fmatter.defaultFormat(a,
+c)};b.fn.fmatter.integer=function(a,c){var d=b.extend({},c.integer);b.fmatter.isUndefined(c.colModel.formatoptions)||(d=b.extend({},d,c.colModel.formatoptions));if(b.fmatter.isEmpty(a))return d.defaultValue;return b.fmatter.util.NumberFormat(a,d)};b.fn.fmatter.number=function(a,c){var d=b.extend({},c.number);b.fmatter.isUndefined(c.colModel.formatoptions)||(d=b.extend({},d,c.colModel.formatoptions));if(b.fmatter.isEmpty(a))return d.defaultValue;return b.fmatter.util.NumberFormat(a,d)};b.fn.fmatter.currency=
+function(a,c){var d=b.extend({},c.currency);b.fmatter.isUndefined(c.colModel.formatoptions)||(d=b.extend({},d,c.colModel.formatoptions));if(b.fmatter.isEmpty(a))return d.defaultValue;return b.fmatter.util.NumberFormat(a,d)};b.fn.fmatter.date=function(a,c,d,e){d=b.extend({},c.date);b.fmatter.isUndefined(c.colModel.formatoptions)||(d=b.extend({},d,c.colModel.formatoptions));return!d.reformatAfterEdit&&e=="edit"?b.fn.fmatter.defaultFormat(a,c):b.fmatter.isEmpty(a)?b.fn.fmatter.defaultFormat(a,c):b.fmatter.util.DateFormat(d.srcformat,
+a,d.newformat,d)};b.fn.fmatter.select=function(a,c){a+="";var d=false,e=[];if(b.fmatter.isUndefined(c.colModel.formatoptions)){if(!b.fmatter.isUndefined(c.colModel.editoptions))d=c.colModel.editoptions.value}else d=c.colModel.formatoptions.value;if(d){var f=c.colModel.editoptions.multiple===true?true:false,g=[],h;if(f){g=a.split(",");g=b.map(g,function(l){return b.trim(l)})}if(b.fmatter.isString(d))for(var i=d.split(";"),j=0,k=0;k<i.length;k++){h=i[k].split(":");if(h.length>2)h[1]=jQuery.map(h,function(l,
+o){if(o>0)return l}).join(":");if(f){if(jQuery.inArray(h[0],g)>-1){e[j]=h[1];j++}}else if(b.trim(h[0])==b.trim(a)){e[0]=h[1];break}}else if(b.fmatter.isObject(d))if(f)e=jQuery.map(g,function(l){return d[l]});else e[0]=d[a]||""}a=e.join(", ");return a===""?b.fn.fmatter.defaultFormat(a,c):a};b.fn.fmatter.rowactions=function(a,c,d,e){var f={keys:false,onEdit:null,onSuccess:null,afterSave:null,onError:null,afterRestore:null,extraparam:{oper:"edit"},url:null,delOptions:{},editOptions:{}};a=b.jgrid.jqID(a);
+c=b.jgrid.jqID(c);e=b("#"+c)[0].p.colModel[e];b.fmatter.isUndefined(e.formatoptions)||(f=b.extend(f,e.formatoptions));if(!b.fmatter.isUndefined(b("#"+c)[0].p.editOptions))f.editOptions=b("#"+c)[0].p.editOptions;if(!b.fmatter.isUndefined(b("#"+c)[0].p.delOptions))f.delOptions=b("#"+c)[0].p.delOptions;e=function(h){f.afterSave&&f.afterSave(h);b("tr#"+a+" div.ui-inline-edit, tr#"+a+" div.ui-inline-del","#"+c+".ui-jqgrid-btable:first").show();b("tr#"+a+" div.ui-inline-save, tr#"+a+" div.ui-inline-cancel",
+"#"+c+".ui-jqgrid-btable:first").hide()};var g=function(h){f.afterRestore&&f.afterRestore(h);b("tr#"+a+" div.ui-inline-edit, tr#"+a+" div.ui-inline-del","#"+c+".ui-jqgrid-btable:first").show();b("tr#"+a+" div.ui-inline-save, tr#"+a+" div.ui-inline-cancel","#"+c+".ui-jqgrid-btable:first").hide()};switch(d){case "edit":b("#"+c).jqGrid("editRow",a,f.keys,f.onEdit,f.onSuccess,f.url,f.extraparam,e,f.onError,g);b("tr#"+a+" div.ui-inline-edit, tr#"+a+" div.ui-inline-del","#"+c+".ui-jqgrid-btable:first").hide();
+b("tr#"+a+" div.ui-inline-save, tr#"+a+" div.ui-inline-cancel","#"+c+".ui-jqgrid-btable:first").show();break;case "save":if(b("#"+c).jqGrid("saveRow",a,f.onSuccess,f.url,f.extraparam,e,f.onError,g)){b("tr#"+a+" div.ui-inline-edit, tr#"+a+" div.ui-inline-del","#"+c+".ui-jqgrid-btable:first").show();b("tr#"+a+" div.ui-inline-save, tr#"+a+" div.ui-inline-cancel","#"+c+".ui-jqgrid-btable:first").hide()}break;case "cancel":b("#"+c).jqGrid("restoreRow",a,g);b("tr#"+a+" div.ui-inline-edit, tr#"+a+" div.ui-inline-del",
+"#"+c+".ui-jqgrid-btable:first").show();b("tr#"+a+" div.ui-inline-save, tr#"+a+" div.ui-inline-cancel","#"+c+".ui-jqgrid-btable:first").hide();break;case "del":b("#"+c).jqGrid("delGridRow",a,f.delOptions);break;case "formedit":b("#"+c).jqGrid("setSelection",a);b("#"+c).jqGrid("editGridRow",a,f.editOptions)}};b.fn.fmatter.actions=function(a,c){var d={keys:false,editbutton:true,delbutton:true,editformbutton:false};b.fmatter.isUndefined(c.colModel.formatoptions)||(d=b.extend(d,c.colModel.formatoptions));
+var e=c.rowId,f="",g;if(typeof e=="undefined"||b.fmatter.isEmpty(e))return"";if(d.editformbutton){g="onclick=$.fn.fmatter.rowactions('"+e+"','"+c.gid+"','formedit',"+c.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ";f=f+"<div title='"+b.jgrid.nav.edittitle+"' style='float:left;cursor:pointer;' class='ui-pg-div ui-inline-edit' "+g+"><span class='ui-icon ui-icon-pencil'></span></div>"}else if(d.editbutton){g="onclick=$.fn.fmatter.rowactions('"+
+e+"','"+c.gid+"','edit',"+c.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover') ";f=f+"<div title='"+b.jgrid.nav.edittitle+"' style='float:left;cursor:pointer;' class='ui-pg-div ui-inline-edit' "+g+"><span class='ui-icon ui-icon-pencil'></span></div>"}if(d.delbutton){g="onclick=$.fn.fmatter.rowactions('"+e+"','"+c.gid+"','del',"+c.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ";
+f=f+"<div title='"+b.jgrid.nav.deltitle+"' style='float:left;margin-left:5px;' class='ui-pg-div ui-inline-del' "+g+"><span class='ui-icon ui-icon-trash'></span></div>"}g="onclick=$.fn.fmatter.rowactions('"+e+"','"+c.gid+"','save',"+c.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ";f=f+"<div title='"+b.jgrid.edit.bSubmit+"' style='float:left;display:none' class='ui-pg-div ui-inline-save' "+g+"><span class='ui-icon ui-icon-disk'></span></div>";
+g="onclick=$.fn.fmatter.rowactions('"+e+"','"+c.gid+"','cancel',"+c.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ";f=f+"<div title='"+b.jgrid.edit.bCancel+"' style='float:left;display:none;margin-left:5px;' class='ui-pg-div ui-inline-cancel' "+g+"><span class='ui-icon ui-icon-cancel'></span></div>";return"<div style='margin-left:8px;'>"+f+"</div>"};b.unformat=function(a,c,d,e){var f,g=c.colModel.formatter,h=c.colModel.formatoptions||
+{},i=/([\.\*\_\'\(\)\{\}\+\?\\])/g,j=c.colModel.unformat||b.fn.fmatter[g]&&b.fn.fmatter[g].unformat;if(typeof j!=="undefined"&&b.isFunction(j))f=j(b(a).text(),c,a);else if(!b.fmatter.isUndefined(g)&&b.fmatter.isString(g)){f=b.jgrid.formatter||{};switch(g){case "integer":h=b.extend({},f.integer,h);c=h.thousandsSeparator.replace(i,"\\$1");f=b(a).text().replace(RegExp(c,"g"),"");break;case "number":h=b.extend({},f.number,h);c=h.thousandsSeparator.replace(i,"\\$1");f=b(a).text().replace(RegExp(c,"g"),
+"").replace(h.decimalSeparator,".");break;case "currency":h=b.extend({},f.currency,h);c=h.thousandsSeparator.replace(i,"\\$1");f=b(a).text().replace(RegExp(c,"g"),"").replace(h.decimalSeparator,".").replace(h.prefix,"").replace(h.suffix,"");break;case "checkbox":h=c.colModel.editoptions?c.colModel.editoptions.value.split(":"):["Yes","No"];f=b("input",a).attr("checked")?h[0]:h[1];break;case "select":f=b.unformat.select(a,c,d,e);break;case "actions":return"";default:f=b(a).text()}}return f!==undefined?
+f:e===true?b(a).text():b.jgrid.htmlDecode(b(a).html())};b.unformat.select=function(a,c,d,e){d=[];a=b(a).text();if(e===true)return a;c=b.extend({},c.colModel.editoptions);if(c.value){var f=c.value;c=c.multiple===true?true:false;e=[];var g;if(c){e=a.split(",");e=b.map(e,function(k){return b.trim(k)})}if(b.fmatter.isString(f))for(var h=f.split(";"),i=0,j=0;j<h.length;j++){g=h[j].split(":");if(g.length>2)g[1]=jQuery.map(g,function(k,l){if(l>0)return k}).join(":");if(c){if(jQuery.inArray(g[1],e)>-1){d[i]=
+g[0];i++}}else if(b.trim(g[1])==b.trim(a)){d[0]=g[0];break}}else if(b.fmatter.isObject(f)||b.isArray(f)){c||(e[0]=a);d=jQuery.map(e,function(k){var l;b.each(f,function(o,n){if(n==k){l=o;return false}});if(typeof l!="undefined")return l})}return d.join(", ")}else return a||""};b.unformat.date=function(a,c){var d=b.jgrid.formatter.date||{};b.fmatter.isUndefined(c.formatoptions)||(d=b.extend({},d,c.formatoptions));return b.fmatter.isEmpty(a)?b.fn.fmatter.defaultFormat(a,c):b.fmatter.util.DateFormat(d.newformat,
+a,d.srcformat,d)}})(jQuery);
+(function(a){a.jgrid.extend({getColProp:function(c){var h={},b=this[0];if(!b.grid)return false;b=b.p.colModel;for(var i=0;i<b.length;i++)if(b[i].name==c){h=b[i];break}return h},setColProp:function(c,h){return this.each(function(){if(this.grid)if(h)for(var b=this.p.colModel,i=0;i<b.length;i++)if(b[i].name==c){a.extend(this.p.colModel[i],h);break}})},sortGrid:function(c,h,b){return this.each(function(){var i=-1;if(this.grid){if(!c)c=this.p.sortname;for(var o=0;o<this.p.colModel.length;o++)if(this.p.colModel[o].index==
+c||this.p.colModel[o].name==c){i=o;break}if(i!=-1){o=this.p.colModel[i].sortable;if(typeof o!=="boolean")o=true;if(typeof h!=="boolean")h=false;o&&this.sortData("jqgh_"+this.p.id+"_"+c,i,h,b)}}})},GridDestroy:function(){return this.each(function(){if(this.grid){this.p.pager&&a(this.p.pager).remove();var c=this.id;try{a("#gbox_"+c).remove()}catch(h){}}})},GridUnload:function(){return this.each(function(){if(this.grid){var c={id:a(this).attr("id"),cl:a(this).attr("class")};this.p.pager&&a(this.p.pager).empty().removeClass("ui-state-default ui-jqgrid-pager corner-bottom");
+var h=document.createElement("table");a(h).attr({id:c.id});h.className=c.cl;c=this.id;a(h).removeClass("ui-jqgrid-btable");if(a(this.p.pager).parents("#gbox_"+c).length===1){a(h).insertBefore("#gbox_"+c).show();a(this.p.pager).insertBefore("#gbox_"+c)}else a(h).insertBefore("#gbox_"+c).show();a("#gbox_"+c).remove()}})},setGridState:function(c){return this.each(function(){if(this.grid)if(c=="hidden"){a(".ui-jqgrid-bdiv, .ui-jqgrid-hdiv","#gview_"+this.p.id).slideUp("fast");this.p.pager&&a(this.p.pager).slideUp("fast");
+this.p.toppager&&a(this.p.toppager).slideUp("fast");if(this.p.toolbar[0]===true){this.p.toolbar[1]=="both"&&a(this.grid.ubDiv).slideUp("fast");a(this.grid.uDiv).slideUp("fast")}this.p.footerrow&&a(".ui-jqgrid-sdiv","#gbox_"+this.p.id).slideUp("fast");a(".ui-jqgrid-titlebar-close span",this.grid.cDiv).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s");this.p.gridstate="hidden"}else if(c=="visible"){a(".ui-jqgrid-hdiv, .ui-jqgrid-bdiv","#gview_"+this.p.id).slideDown("fast");
+this.p.pager&&a(this.p.pager).slideDown("fast");this.p.toppager&&a(this.p.toppager).slideDown("fast");if(this.p.toolbar[0]===true){this.p.toolbar[1]=="both"&&a(this.grid.ubDiv).slideDown("fast");a(this.grid.uDiv).slideDown("fast")}this.p.footerrow&&a(".ui-jqgrid-sdiv","#gbox_"+this.p.id).slideDown("fast");a(".ui-jqgrid-titlebar-close span",this.grid.cDiv).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n");this.p.gridstate="visible"}})},filterToolbar:function(c){c=a.extend({autosearch:true,
+searchOnEnter:true,beforeSearch:null,afterSearch:null,beforeClear:null,afterClear:null,searchurl:"",stringResult:false,groupOp:"AND",defaultSearch:"bw"},c||{});return this.each(function(){function h(e,f){var j=a(e);j[0]&&jQuery.each(f,function(){this.data!==undefined?j.bind(this.type,this.data,this.fn):j.bind(this.type,this.fn)})}var b=this;if(!this.ftoolbar){var i=function(){var e={},f=0,j,d,g={},k;a.each(b.p.colModel,function(){d=this.index||this.name;switch(this.stype){case "select":k=this.searchoptions&&
+this.searchoptions.sopt?this.searchoptions.sopt[0]:"eq";if(j=a("#gs_"+a.jgrid.jqID(this.name),b.grid.hDiv).val()){e[d]=j;g[d]=k;f++}else try{delete b.p.postData[d]}catch(p){}break;case "text":k=this.searchoptions&&this.searchoptions.sopt?this.searchoptions.sopt[0]:c.defaultSearch;if(j=a("#gs_"+a.jgrid.jqID(this.name),b.grid.hDiv).val()){e[d]=j;g[d]=k;f++}else try{delete b.p.postData[d]}catch(s){}}});var n=f>0?true:false;if(c.stringResult===true||b.p.datatype=="local"){var m='{"groupOp":"'+c.groupOp+
+'","rules":[',q=0;a.each(e,function(p,s){if(q>0)m+=",";m+='{"field":"'+p+'",';m+='"op":"'+g[p]+'",';s+="";m+='"data":"'+s.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"}';q++});m+="]}";a.extend(b.p.postData,{filters:m});a.each(["searchField","searchString","searchOper"],function(p,s){b.p.postData.hasOwnProperty(s)&&delete b.p.postData[s]})}else a.extend(b.p.postData,e);var l;if(b.p.searchurl){l=b.p.url;a(b).jqGrid("setGridParam",{url:b.p.searchurl})}var r=false;if(a.isFunction(c.beforeSearch))r=c.beforeSearch.call(b);
+r||a(b).jqGrid("setGridParam",{search:n}).trigger("reloadGrid",[{page:1}]);l&&a(b).jqGrid("setGridParam",{url:l});a.isFunction(c.afterSearch)&&c.afterSearch()},o=a("<tr class='ui-search-toolbar' role='rowheader'></tr>"),t;a.each(b.p.colModel,function(){var e=this,f,j,d,g;j=a("<th role='columnheader' class='ui-state-default ui-th-column ui-th-"+b.p.direction+"'></th>");f=a("<div style='width:100%;position:relative;height:100%;padding-right:0.3em;'></div>");this.hidden===true&&a(j).css("display","none");
+this.search=this.search===false?false:true;if(typeof this.stype=="undefined")this.stype="text";d=a.extend({},this.searchoptions||{});if(this.search)switch(this.stype){case "select":if(g=this.surl||d.dataUrl)a.ajax(a.extend({url:g,dataType:"html",complete:function(l){if(d.buildSelect!==undefined)(l=d.buildSelect(l))&&a(f).append(l);else a(f).append(l.responseText);d.defaultValue&&a("select",f).val(d.defaultValue);a("select",f).attr({name:e.index||e.name,id:"gs_"+e.name});d.attr&&a("select",f).attr(d.attr);
+a("select",f).css({width:"100%"});d.dataInit!==undefined&&d.dataInit(a("select",f)[0]);d.dataEvents!==undefined&&h(a("select",f)[0],d.dataEvents);c.autosearch===true&&a("select",f).change(function(){i();return false});l=null}},a.jgrid.ajaxOptions,b.p.ajaxSelectOptions||{}));else{var k;if(e.searchoptions&&e.searchoptions.value)k=e.searchoptions.value;else if(e.editoptions&&e.editoptions.value)k=e.editoptions.value;if(k){g=document.createElement("select");g.style.width="100%";a(g).attr({name:e.index||
+e.name,id:"gs_"+e.name});var n,m;if(typeof k==="string"){k=k.split(";");for(var q=0;q<k.length;q++){n=k[q].split(":");m=document.createElement("option");m.value=n[0];m.innerHTML=n[1];g.appendChild(m)}}else if(typeof k==="object")for(n in k)if(k.hasOwnProperty(n)){m=document.createElement("option");m.value=n;m.innerHTML=k[n];g.appendChild(m)}d.defaultValue&&a(g).val(d.defaultValue);d.attr&&a(g).attr(d.attr);d.dataInit!==undefined&&d.dataInit(g);d.dataEvents!==undefined&&h(g,d.dataEvents);a(f).append(g);
+c.autosearch===true&&a(g).change(function(){i();return false})}}break;case "text":g=d.defaultValue?d.defaultValue:"";a(f).append("<input type='text' style='width:95%;padding:0px;' name='"+(e.index||e.name)+"' id='gs_"+e.name+"' value='"+g+"'/>");d.attr&&a("input",f).attr(d.attr);d.dataInit!==undefined&&d.dataInit(a("input",f)[0]);d.dataEvents!==undefined&&h(a("input",f)[0],d.dataEvents);if(c.autosearch===true)c.searchOnEnter?a("input",f).keypress(function(l){if((l.charCode?l.charCode:l.keyCode?l.keyCode:
+0)==13){i();return false}return this}):a("input",f).keydown(function(l){switch(l.which){case 13:return false;case 9:case 16:case 37:case 38:case 39:case 40:case 27:break;default:t&&clearTimeout(t);t=setTimeout(function(){i()},500)}})}a(j).append(f);a(o).append(j)});a("table thead",b.grid.hDiv).append(o);this.ftoolbar=true;this.triggerToolbar=i;this.clearToolbar=function(e){var f={},j,d=0,g;e=typeof e!="boolean"?true:e;a.each(b.p.colModel,function(){j=this.searchoptions&&this.searchoptions.defaultValue?
+this.searchoptions.defaultValue:"";g=this.index||this.name;switch(this.stype){case "select":var r;a("#gs_"+a.jgrid.jqID(g)+" option",b.grid.hDiv).each(function(u){if(u===0)this.selected=true;if(a(this).text()==j){this.selected=true;r=a(this).val();return false}});if(r){f[g]=r;d++}else try{delete b.p.postData[g]}catch(p){}break;case "text":a("#gs_"+a.jgrid.jqID(g),b.grid.hDiv).val(j);if(j){f[g]=j;d++}else try{delete b.p.postData[g]}catch(s){}}});var k=d>0?true:false;if(c.stringResult===true||b.p.datatype==
+"local"){var n='{"groupOp":"'+c.groupOp+'","rules":[',m=0;a.each(f,function(r,p){if(m>0)n+=",";n+='{"field":"'+r+'",';n+='"op":"eq",';p+="";n+='"data":"'+p.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"}';m++});n+="]}";a.extend(b.p.postData,{filters:n});a.each(["searchField","searchString","searchOper"],function(r,p){b.p.postData.hasOwnProperty(p)&&delete b.p.postData[p]})}else a.extend(b.p.postData,f);var q;if(b.p.searchurl){q=b.p.url;a(b).jqGrid("setGridParam",{url:b.p.searchurl})}var l=false;if(a.isFunction(c.beforeClear))l=
+c.beforeClear.call(b);l||e&&a(b).jqGrid("setGridParam",{search:k}).trigger("reloadGrid",[{page:1}]);q&&a(b).jqGrid("setGridParam",{url:q});a.isFunction(c.afterClear)&&c.afterClear()};this.toggleToolbar=function(){var e=a("tr.ui-search-toolbar",b.grid.hDiv);e.css("display")=="none"?e.show():e.hide()}}})}})})(jQuery);
+(function(a){a.extend(a.jgrid,{showModal:function(b){b.w.show()},closeModal:function(b){b.w.hide().attr("aria-hidden","true");b.o&&b.o.remove()},hideModal:function(b,c){c=a.extend({jqm:true,gb:""},c||{});if(c.onClose){var d=c.onClose(b);if(typeof d=="boolean"&&!d)return}if(a.fn.jqm&&c.jqm===true)a(b).attr("aria-hidden","true").jqmHide();else{if(c.gb!=="")try{a(".jqgrid-overlay:first",c.gb).hide()}catch(f){}a(b).hide().attr("aria-hidden","true")}},findPos:function(b){var c=0,d=0;if(b.offsetParent){do{c+=
+b.offsetLeft;d+=b.offsetTop}while(b=b.offsetParent)}return[c,d]},createModal:function(b,c,d,f,g,h,j){var e=document.createElement("div"),k,m=this;j=a.extend({},j||{});k=a(d.gbox).attr("dir")=="rtl"?true:false;e.className="ui-widget ui-widget-content ui-corner-all ui-jqdialog";e.id=b.themodal;var i=document.createElement("div");i.className="ui-jqdialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix";i.id=b.modalhead;a(i).append("<span class='ui-jqdialog-title'>"+d.caption+"</span>");var q=
+a("<a href='javascript:void(0)' class='ui-jqdialog-titlebar-close ui-corner-all'></a>").hover(function(){q.addClass("ui-state-hover")},function(){q.removeClass("ui-state-hover")}).append("<span class='ui-icon ui-icon-closethick'></span>");a(i).append(q);if(k){e.dir="rtl";a(".ui-jqdialog-title",i).css("float","right");a(".ui-jqdialog-titlebar-close",i).css("left","0.3em")}else{e.dir="ltr";a(".ui-jqdialog-title",i).css("float","left");a(".ui-jqdialog-titlebar-close",i).css("right","0.3em")}var l=document.createElement("div");
+a(l).addClass("ui-jqdialog-content ui-widget-content").attr("id",b.modalcontent);a(l).append(c);e.appendChild(l);a(e).prepend(i);if(h===true)a("body").append(e);else typeof h=="string"?a(h).append(e):a(e).insertBefore(f);a(e).css(j);if(typeof d.jqModal==="undefined")d.jqModal=true;c={};if(a.fn.jqm&&d.jqModal===true){if(d.left===0&&d.top===0&&d.overlay){j=[];j=this.findPos(g);d.left=j[0]+4;d.top=j[1]+4}c.top=d.top+"px";c.left=d.left}else if(d.left!==0||d.top!==0){c.left=d.left;c.top=d.top+"px"}a("a.ui-jqdialog-titlebar-close",
+i).click(function(){var p=a("#"+b.themodal).data("onClose")||d.onClose,o=a("#"+b.themodal).data("gbox")||d.gbox;m.hideModal("#"+b.themodal,{gb:o,jqm:d.jqModal,onClose:p});return false});if(d.width===0||!d.width)d.width=300;if(d.height===0||!d.height)d.height=200;if(!d.zIndex){f=a(f).parents("*[role=dialog]").filter(":first").css("z-index");d.zIndex=f?parseInt(f,10)+1:950}f=0;if(k&&c.left&&!h){f=a(d.gbox).width()-(!isNaN(d.width)?parseInt(d.width,10):0)-8;c.left=parseInt(c.left,10)+parseInt(f,10)}if(c.left)c.left+=
+"px";a(e).css(a.extend({width:isNaN(d.width)?"auto":d.width+"px",height:isNaN(d.height)?"auto":d.height+"px",zIndex:d.zIndex,overflow:"hidden"},c)).attr({tabIndex:"-1",role:"dialog","aria-labelledby":b.modalhead,"aria-hidden":"true"});if(typeof d.drag=="undefined")d.drag=true;if(typeof d.resize=="undefined")d.resize=true;if(d.drag){a(i).css("cursor","move");if(a.fn.jqDrag)a(e).jqDrag(i);else try{a(e).draggable({handle:a("#"+i.id)})}catch(n){}}if(d.resize)if(a.fn.jqResize){a(e).append("<div class='jqResize ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se ui-icon-grip-diagonal-se'></div>");
+a("#"+b.themodal).jqResize(".jqResize",b.scrollelm?"#"+b.scrollelm:false)}else try{a(e).resizable({handles:"se, sw",alsoResize:b.scrollelm?"#"+b.scrollelm:false})}catch(r){}d.closeOnEscape===true&&a(e).keydown(function(p){if(p.which==27){p=a("#"+b.themodal).data("onClose")||d.onClose;m.hideModal(this,{gb:d.gbox,jqm:d.jqModal,onClose:p})}})},viewModal:function(b,c){c=a.extend({toTop:true,overlay:10,modal:false,overlayClass:"ui-widget-overlay",onShow:this.showModal,onHide:this.closeModal,gbox:"",jqm:true,
+jqM:true},c||{});if(a.fn.jqm&&c.jqm===true)c.jqM?a(b).attr("aria-hidden","false").jqm(c).jqmShow():a(b).attr("aria-hidden","false").jqmShow();else{if(c.gbox!==""){a(".jqgrid-overlay:first",c.gbox).show();a(b).data("gbox",c.gbox)}a(b).show().attr("aria-hidden","false");try{a(":input:visible",b)[0].focus()}catch(d){}}},info_dialog:function(b,c,d,f){var g={width:290,height:"auto",dataheight:"auto",drag:true,resize:false,caption:"<b>"+b+"</b>",left:250,top:170,zIndex:1E3,jqModal:true,modal:false,closeOnEscape:true,
+align:"center",buttonalign:"center",buttons:[]};a.extend(g,f||{});var h=g.jqModal,j=this;if(a.fn.jqm&&!h)h=false;b="";if(g.buttons.length>0)for(f=0;f<g.buttons.length;f++){if(typeof g.buttons[f].id=="undefined")g.buttons[f].id="info_button_"+f;b+="<a href='javascript:void(0)' id='"+g.buttons[f].id+"' class='fm-button ui-state-default ui-corner-all'>"+g.buttons[f].text+"</a>"}f=isNaN(g.dataheight)?g.dataheight:g.dataheight+"px";var e="<div id='info_id'>";e+="<div id='infocnt' style='margin:0px;padding-bottom:1em;width:100%;overflow:auto;position:relative;height:"+
+f+";"+("text-align:"+g.align+";")+"'>"+c+"</div>";e+=d?"<div class='ui-widget-content ui-helper-clearfix' style='text-align:"+g.buttonalign+";padding-bottom:0.8em;padding-top:0.5em;background-image: none;border-width: 1px 0 0 0;'><a href='javascript:void(0)' id='closedialog' class='fm-button ui-state-default ui-corner-all'>"+d+"</a>"+b+"</div>":b!==""?"<div class='ui-widget-content ui-helper-clearfix' style='text-align:"+g.buttonalign+";padding-bottom:0.8em;padding-top:0.5em;background-image: none;border-width: 1px 0 0 0;'>"+
+b+"</div>":"";e+="</div>";try{a("#info_dialog").attr("aria-hidden")=="false"&&this.hideModal("#info_dialog",{jqm:h});a("#info_dialog").remove()}catch(k){}this.createModal({themodal:"info_dialog",modalhead:"info_head",modalcontent:"info_content",scrollelm:"infocnt"},e,g,"","",true);b&&a.each(g.buttons,function(i){a("#"+this.id,"#info_id").bind("click",function(){g.buttons[i].onClick.call(a("#info_dialog"));return false})});a("#closedialog","#info_id").click(function(){j.hideModal("#info_dialog",{jqm:h});
+return false});a(".fm-button","#info_dialog").hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});a.isFunction(g.beforeOpen)&&g.beforeOpen();this.viewModal("#info_dialog",{onHide:function(i){i.w.hide().remove();i.o&&i.o.remove()},modal:g.modal,jqm:h});a.isFunction(g.afterOpen)&&g.afterOpen();try{a("#info_dialog").focus()}catch(m){}},createEl:function(b,c,d,f,g){function h(l,n){a.isFunction(n.dataInit)&&n.dataInit(l);n.dataEvents&&a.each(n.dataEvents,
+function(){this.data!==undefined?a(l).bind(this.type,this.data,this.fn):a(l).bind(this.type,this.fn)});return n}function j(l,n,r){var p=["dataInit","dataEvents","dataUrl","buildSelect","sopt","searchhidden","defaultValue","attr"];if(typeof r!="undefined"&&a.isArray(r))p=a.extend(p,r);a.each(n,function(o,s){a.inArray(o,p)===-1&&a(l).attr(o,s)});n.hasOwnProperty("id")||a(l).attr("id",a.jgrid.randId())}var e="";switch(b){case "textarea":e=document.createElement("textarea");if(f)c.cols||a(e).css({width:"98%"});
+else if(!c.cols)c.cols=20;if(!c.rows)c.rows=2;if(d=="&nbsp;"||d=="&#160;"||d.length==1&&d.charCodeAt(0)==160)d="";e.value=d;j(e,c);c=h(e,c);a(e).attr({role:"textbox",multiline:"true"});break;case "checkbox":e=document.createElement("input");e.type="checkbox";if(c.value){b=c.value.split(":");if(d===b[0]){e.checked=true;e.defaultChecked=true}e.value=b[0];a(e).attr("offval",b[1])}else{b=d.toLowerCase();if(b.search(/(false|0|no|off|undefined)/i)<0&&b!==""){e.checked=true;e.defaultChecked=true;e.value=
+d}else e.value="on";a(e).attr("offval","off")}j(e,c,["value"]);c=h(e,c);a(e).attr("role","checkbox");break;case "select":e=document.createElement("select");e.setAttribute("role","select");f=[];if(c.multiple===true){b=true;e.multiple="multiple";a(e).attr("aria-multiselectable","true")}else b=false;if(typeof c.dataUrl!="undefined")a.ajax(a.extend({url:c.dataUrl,type:"GET",dataType:"html",context:{elem:e,options:c,vl:d},success:function(l){var n=[],r=this.elem,p=this.vl,o=a.extend({},this.options),s=
+o.multiple===true;if(typeof o.buildSelect!="undefined")l=o.buildSelect(l);if(l=a(l).html()){a(r).append(l);j(r,o);o=h(r,o);if(typeof o.size==="undefined")o.size=s?3:1;if(s){n=p.split(",");n=a.map(n,function(t){return a.trim(t)})}else n[0]=a.trim(p);setTimeout(function(){a("option",r).each(function(){a(this).attr("role","option");if(a.inArray(a.trim(a(this).text()),n)>-1||a.inArray(a.trim(a(this).val()),n)>-1)this.selected="selected"})},0)}}},g||{}));else if(c.value){var k;if(b){f=d.split(",");f=a.map(f,
+function(l){return a.trim(l)});if(typeof c.size==="undefined")c.size=3}else c.size=1;if(typeof c.value==="function")c.value=c.value();var m,i;if(typeof c.value==="string"){m=c.value.split(";");for(k=0;k<m.length;k++){i=m[k].split(":");if(i.length>2)i[1]=a.map(i,function(l,n){if(n>0)return l}).join(":");g=document.createElement("option");g.setAttribute("role","option");g.value=i[0];g.innerHTML=i[1];if(!b&&(a.trim(i[0])==a.trim(d)||a.trim(i[1])==a.trim(d)))g.selected="selected";if(b&&(a.inArray(a.trim(i[1]),
+f)>-1||a.inArray(a.trim(i[0]),f)>-1))g.selected="selected";e.appendChild(g)}}else if(typeof c.value==="object"){m=c.value;for(k in m)if(m.hasOwnProperty(k)){g=document.createElement("option");g.setAttribute("role","option");g.value=k;g.innerHTML=m[k];if(!b&&(a.trim(k)==a.trim(d)||a.trim(m[k])==a.trim(d)))g.selected="selected";if(b&&(a.inArray(a.trim(m[k]),f)>-1||a.inArray(a.trim(k),f)>-1))g.selected="selected";e.appendChild(g)}}j(e,c,["value"]);c=h(e,c)}break;case "text":case "password":case "button":k=
+b=="button"?"button":"textbox";e=document.createElement("input");e.type=b;e.value=d;j(e,c);c=h(e,c);if(b!="button")if(f)c.size||a(e).css({width:"98%"});else if(!c.size)c.size=20;a(e).attr("role",k);break;case "image":case "file":e=document.createElement("input");e.type=b;j(e,c);c=h(e,c);break;case "custom":e=document.createElement("span");try{if(a.isFunction(c.custom_element))if(m=c.custom_element.call(this,d,c)){m=a(m).addClass("customelement").attr({id:c.id,name:c.name});a(e).empty().append(m)}else throw"e2";
+else throw"e1";}catch(q){q=="e1"&&this.info_dialog(a.jgrid.errors.errcap,"function 'custom_element' "+a.jgrid.edit.msg.nodefined,a.jgrid.edit.bClose);q=="e2"?this.info_dialog(a.jgrid.errors.errcap,"function 'custom_element' "+a.jgrid.edit.msg.novalue,a.jgrid.edit.bClose):this.info_dialog(a.jgrid.errors.errcap,typeof q==="string"?q:q.message,a.jgrid.edit.bClose)}}return e},checkDate:function(b,c){var d={},f;b=b.toLowerCase();f=b.indexOf("/")!=-1?"/":b.indexOf("-")!=-1?"-":b.indexOf(".")!=-1?".":"/";
+b=b.split(f);c=c.split(f);if(c.length!=3)return false;f=-1;for(var g,h=-1,j=-1,e=0;e<b.length;e++){g=isNaN(c[e])?0:parseInt(c[e],10);d[b[e]]=g;g=b[e];if(g.indexOf("y")!=-1)f=e;if(g.indexOf("m")!=-1)j=e;if(g.indexOf("d")!=-1)h=e}g=b[f]=="y"||b[f]=="yyyy"?4:b[f]=="yy"?2:-1;e=function(m){for(var i=1;i<=m;i++){this[i]=31;if(i==4||i==6||i==9||i==11)this[i]=30;if(i==2)this[i]=29}return this}(12);var k;if(f===-1)return false;else{k=d[b[f]].toString();if(g==2&&k.length==1)g=1;if(k.length!=g||d[b[f]]===0&&
+c[f]!="00")return false}if(j===-1)return false;else{k=d[b[j]].toString();if(k.length<1||d[b[j]]<1||d[b[j]]>12)return false}if(h===-1)return false;else{k=d[b[h]].toString();if(k.length<1||d[b[h]]<1||d[b[h]]>31||d[b[j]]==2&&d[b[h]]>(d[b[f]]%4===0&&(d[b[f]]%100!==0||d[b[f]]%400===0)?29:28)||d[b[h]]>e[d[b[j]]])return false}return true},isEmpty:function(b){return b.match(/^\s+$/)||b===""?true:false},checkTime:function(b){var c=/^(\d{1,2}):(\d{2})([ap]m)?$/;if(!this.isEmpty(b))if(b=b.match(c)){if(b[3]){if(b[1]<
+1||b[1]>12)return false}else if(b[1]>23)return false;if(b[2]>59)return false}else return false;return true},checkValues:function(b,c,d,f,g){var h,j;if(typeof f==="undefined")if(typeof c=="string"){f=0;for(g=d.p.colModel.length;f<g;f++)if(d.p.colModel[f].name==c){h=d.p.colModel[f].editrules;c=f;try{j=d.p.colModel[f].formoptions.label}catch(e){}break}}else{if(c>=0)h=d.p.colModel[c].editrules}else{h=f;j=g===undefined?"_":g}if(h){j||(j=d.p.colNames[c]);if(h.required===true)if(this.isEmpty(b))return[false,
+j+": "+a.jgrid.edit.msg.required,""];f=h.required===false?false:true;if(h.number===true)if(!(f===false&&this.isEmpty(b)))if(isNaN(b))return[false,j+": "+a.jgrid.edit.msg.number,""];if(typeof h.minValue!="undefined"&&!isNaN(h.minValue))if(parseFloat(b)<parseFloat(h.minValue))return[false,j+": "+a.jgrid.edit.msg.minValue+" "+h.minValue,""];if(typeof h.maxValue!="undefined"&&!isNaN(h.maxValue))if(parseFloat(b)>parseFloat(h.maxValue))return[false,j+": "+a.jgrid.edit.msg.maxValue+" "+h.maxValue,""];if(h.email===
+true)if(!(f===false&&this.isEmpty(b))){g=/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i;
+if(!g.test(b))return[false,j+": "+a.jgrid.edit.msg.email,""]}if(h.integer===true)if(!(f===false&&this.isEmpty(b))){if(isNaN(b))return[false,j+": "+a.jgrid.edit.msg.integer,""];if(b%1!==0||b.indexOf(".")!=-1)return[false,j+": "+a.jgrid.edit.msg.integer,""]}if(h.date===true)if(!(f===false&&this.isEmpty(b))){c=d.p.colModel[c].formatoptions&&d.p.colModel[c].formatoptions.newformat?d.p.colModel[c].formatoptions.newformat:d.p.colModel[c].datefmt||"Y-m-d";if(!this.checkDate(c,b))return[false,j+": "+a.jgrid.edit.msg.date+
+" - "+c,""]}if(h.time===true)if(!(f===false&&this.isEmpty(b)))if(!this.checkTime(b))return[false,j+": "+a.jgrid.edit.msg.date+" - hh:mm (am/pm)",""];if(h.url===true)if(!(f===false&&this.isEmpty(b))){g=/^(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i;if(!g.test(b))return[false,j+": "+a.jgrid.edit.msg.url,""]}if(h.custom===true)if(!(f===false&&this.isEmpty(b)))if(a.isFunction(h.custom_func)){b=h.custom_func.call(d,b,j);return a.isArray(b)?
+b:[false,a.jgrid.edit.msg.customarray,""]}else return[false,a.jgrid.edit.msg.customfcheck,""]}return[true,"",""]}})})(jQuery);
+(function(a){var d={};a.jgrid.extend({searchGrid:function(f){f=a.extend({recreateFilter:false,drag:true,sField:"searchField",sValue:"searchString",sOper:"searchOper",sFilter:"filters",loadDefaults:true,beforeShowSearch:null,afterShowSearch:null,onInitializeSearch:null,afterRedraw:null,closeAfterSearch:false,closeAfterReset:false,closeOnEscape:false,multipleSearch:false,multipleGroup:false,top:0,left:0,jqModal:true,modal:false,resize:true,width:450,height:"auto",dataheight:"auto",showQuery:false,errorcheck:true,
+sopt:null,stringResult:undefined,onClose:null,onSearch:null,onReset:null,toTop:true,overlay:30,columns:[],tmplNames:null,tmplFilters:null,tmplLabel:" Template: ",showOnLoad:false,layer:null},a.jgrid.search,f||{});return this.each(function(){function b(){if(a.isFunction(f.beforeShowSearch)){E=f.beforeShowSearch(a("#"+r));if(typeof E==="undefined")E=true}if(E){a.jgrid.viewModal("#"+C.themodal,{gbox:"#gbox_"+r,jqm:f.jqModal,modal:f.modal,overlay:f.overlay,toTop:f.toTop});a.isFunction(f.afterShowSearch)&&
+f.afterShowSearch(a("#"+r))}}var e=this;if(e.grid){var r="fbox_"+e.p.id,E=true,C={themodal:"searchmod"+r,modalhead:"searchhd"+r,modalcontent:"searchcnt"+r,scrollelm:r},F=e.p.postData[f.sFilter];if(typeof F==="string")F=a.jgrid.parse(F);f.recreateFilter===true&&a("#"+C.themodal).remove();if(a("#"+C.themodal).html()!==null)b();else{var y=a("<span><div id='"+r+"' class='searchFilter' style='overflow:auto'></div></span>").insertBefore("#gview_"+e.p.id);if(a.isFunction(f.onInitializeSearch))f.onInitializeSearch(a("#"+
+r));var m=a.extend([],e.p.colModel),s="<a href='javascript:void(0)' id='"+r+"_search' class='fm-button ui-state-default ui-corner-all fm-button-icon-right ui-reset'><span class='ui-icon ui-icon-search'></span>"+f.Find+"</a>",t="<a href='javascript:void(0)' id='"+r+"_reset' class='fm-button ui-state-default ui-corner-all fm-button-icon-left ui-search'><span class='ui-icon ui-icon-arrowreturnthick-1-w'></span>"+f.Reset+"</a>",o="",c="",u,n=false,h=-1;if(f.showQuery)o="<a href='javascript:void(0)' id='"+
+r+"_query' class='fm-button ui-state-default ui-corner-all fm-button-icon-left'><span class='ui-icon ui-icon-comment'></span>Query</a>";if(f.columns.length)m=f.columns;else a.each(m,function(x,A){if(!A.label)A.label=e.p.colNames[x];if(!n){var G=typeof A.search==="undefined"?true:A.search,N=A.hidden===true;if(A.searchoptions&&A.searchoptions.searchhidden===true&&G||G&&!N){n=true;u=A.index||A.name;h=x}}});if(!F&&u||f.multipleSearch===false){var p="eq";if(h>=0&&m[h].searchoptions&&m[h].searchoptions.sopt)p=
+m[h].searchoptions.sopt[0];else if(f.sopt&&f.sopt.length)p=f.sopt[0];F={groupOp:"AND",rules:[{field:u,op:p,data:""}]}}n=false;if(f.tmplNames&&f.tmplNames.length){n=true;c=f.tmplLabel;c+="<select class='ui-template'>";c+="<option value='default'>Default</option>";a.each(f.tmplNames,function(x,A){c+="<option value='"+x+"'>"+A+"</option>"});c+="</select>"}s="<table class='EditTable' style='border:0px none;margin-top:5px' id='"+r+"_2'><tbody><tr><td colspan='2'><hr class='ui-widget-content' style='margin:1px'/></td></tr><tr><td class='EditButton' style='text-align:left'>"+
+t+c+"</td><td class='EditButton'>"+o+s+"</td></tr></tbody></table>";a("#"+r).jqFilter({columns:m,filter:f.loadDefaults?F:null,showQuery:f.showQuery,errorcheck:f.errorcheck,sopt:f.sopt,groupButton:f.multipleGroup,ruleButtons:f.multipleSearch,afterRedraw:f.afterRedraw,_gridsopt:a.jgrid.search.odata,onChange:function(){this.p.showQuery&&a(".query",this).html(this.toUserFriendlyString())}});y.append(s);n&&f.tmplFilters&&f.tmplFilters.length&&a(".ui-template",y).bind("change",function(){var x=a(this).val();
+x=="default"?a("#"+r).jqFilter("addFilter",F):a("#"+r).jqFilter("addFilter",f.tmplFilters[parseInt(x,10)]);return false});if(f.multipleGroup===true)f.multipleSearch=true;if(a.isFunction(f.onInitializeSearch))f.onInitializeSearch(a("#"+r));f.layer?a.jgrid.createModal(C,y,f,"#gview_"+e.p.id,a("#gbox_"+e.p.id)[0],"#"+f.layer,{position:"relative"}):a.jgrid.createModal(C,y,f,"#gview_"+e.p.id,a("#gbox_"+e.p.id)[0]);o&&a("#"+r+"_query").bind("click",function(){a(".queryresult",y).toggle();return false});
+if(f.stringResult===undefined)f.stringResult=f.multipleSearch;a("#"+r+"_search").bind("click",function(){var x=a("#"+r),A={},G,N=x.jqFilter("filterData");if(f.errorcheck){x[0].hideError();f.showQuery||x.jqFilter("toSQLString");if(x[0].p.error){x[0].showError();return false}}if(f.stringResult){try{G=xmlJsonClass.toJson(N,"","",false)}catch(I){try{G=JSON.stringify(N)}catch(l){}}if(typeof G==="string"){A[f.sFilter]=G;a.each([f.sField,f.sValue,f.sOper],function(){A[this]=""})}}else if(f.multipleSearch){A[f.sFilter]=
+N;a.each([f.sField,f.sValue,f.sOper],function(){A[this]=""})}else{A[f.sField]=N.rules[0].field;A[f.sValue]=N.rules[0].data;A[f.sOper]=N.rules[0].op;A[f.sFilter]=""}e.p.search=true;a.extend(e.p.postData,A);if(a.isFunction(f.onSearch))f.onSearch();a(e).trigger("reloadGrid",[{page:1}]);f.closeAfterSearch&&a.jgrid.hideModal("#"+C.themodal,{gb:"#gbox_"+e.p.id,jqm:f.jqModal,onClose:f.onClose});return false});a("#"+r+"_reset").bind("click",function(){var x={},A=a("#"+r);e.p.search=false;if(f.multipleSearch===
+false)x[f.sField]=x[f.sValue]=x[f.sOper]="";else x[f.sFilter]="";A[0].resetFilter();n&&a(".ui-template",y).val("default");a.extend(e.p.postData,x);if(a.isFunction(f.onReset))f.onReset();a(e).trigger("reloadGrid",[{page:1}]);return false});b();a(".fm-button:not(.ui-state-disabled)",y).hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")})}}})},editGridRow:function(f,b){b=a.extend({top:0,left:0,width:300,height:"auto",dataheight:"auto",modal:false,overlay:30,
+drag:true,resize:true,url:null,mtype:"POST",clearAfterAdd:true,closeAfterEdit:false,reloadAfterSubmit:true,onInitializeForm:null,beforeInitData:null,beforeShowForm:null,afterShowForm:null,beforeSubmit:null,afterSubmit:null,onclickSubmit:null,afterComplete:null,onclickPgButtons:null,afterclickPgButtons:null,editData:{},recreateForm:false,jqModal:true,closeOnEscape:false,addedrow:"first",topinfo:"",bottominfo:"",saveicon:[],closeicon:[],savekey:[false,13],navkeys:[false,38,40],checkOnSubmit:false,checkOnUpdate:false,
+_savedData:{},processing:false,onClose:null,ajaxEditOptions:{},serializeEditData:null,viewPagerButtons:true},a.jgrid.edit,b||{});d[a(this)[0].p.id]=b;return this.each(function(){function e(){a("#"+h+" > tbody > tr > td > .FormElement").each(function(){var g=a(".customelement",this);if(g.length){var k=a(g[0]).attr("name");a.each(c.p.colModel,function(){if(this.name===k&&this.editoptions&&a.isFunction(this.editoptions.custom_value)){try{j[k]=this.editoptions.custom_value(a("#"+a.jgrid.jqID(k),"#"+h),
+"get");if(j[k]===undefined)throw"e1";}catch(q){q==="e1"?a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose):a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,q.message,jQuery.jgrid.edit.bClose)}return true}})}else{switch(a(this).get(0).type){case "checkbox":if(a(this).attr("checked"))j[this.name]=a(this).val();else{g=a(this).attr("offval");j[this.name]=g}break;case "select-one":j[this.name]=a("option:selected",this).val();Q[this.name]=
+a("option:selected",this).text();break;case "select-multiple":j[this.name]=a(this).val();j[this.name]=j[this.name]?j[this.name].join(","):"";var v=[];a("option:selected",this).each(function(q,J){v[q]=a(J).text()});Q[this.name]=v.join(",");break;case "password":case "text":case "textarea":case "button":j[this.name]=a(this).val()}if(c.p.autoencode)j[this.name]=a.jgrid.htmlEncode(j[this.name])}});return true}function r(g,k,v,q){var J,D,B,L=0,w,O,H,T=[],M=false,aa="",S;for(S=1;S<=q;S++)aa+="<td class='CaptionTD'>&#160;</td><td class='DataTD'>&#160;</td>";
+if(g!="_empty")M=a(k).jqGrid("getInd",g);a(k.p.colModel).each(function(U){J=this.name;O=(D=this.editrules&&this.editrules.edithidden===true?false:this.hidden===true?true:false)?"style='display:none'":"";if(J!=="cb"&&J!=="subgrid"&&this.editable===true&&J!=="rn"){if(M===false)w="";else if(J==k.p.ExpandColumn&&k.p.treeGrid===true)w=a("td:eq("+U+")",k.rows[M]).text();else{try{w=a.unformat(a("td:eq("+U+")",k.rows[M]),{rowId:g,colModel:this},U)}catch(fa){w=this.edittype&&this.edittype=="textarea"?a("td:eq("+
+U+")",k.rows[M]).text():a("td:eq("+U+")",k.rows[M]).html()}if(!w||w=="&nbsp;"||w=="&#160;"||w.length==1&&w.charCodeAt(0)==160)w=""}var Y=a.extend({},this.editoptions||{},{id:J,name:J}),Z=a.extend({},{elmprefix:"",elmsuffix:"",rowabove:false,rowcontent:""},this.formoptions||{}),ea=parseInt(Z.rowpos,10)||L+1,ga=parseInt((parseInt(Z.colpos,10)||1)*2,10);if(g=="_empty"&&Y.defaultValue)w=a.isFunction(Y.defaultValue)?Y.defaultValue():Y.defaultValue;if(!this.edittype)this.edittype="text";if(c.p.autoencode)w=
+a.jgrid.htmlDecode(w);H=a.jgrid.createEl(this.edittype,Y,w,false,a.extend({},a.jgrid.ajaxOptions,k.p.ajaxSelectOptions||{}));if(w===""&&this.edittype=="checkbox")w=a(H).attr("offval");if(w===""&&this.edittype=="select")w=a("option:eq(0)",H).text();if(d[c.p.id].checkOnSubmit||d[c.p.id].checkOnUpdate)d[c.p.id]._savedData[J]=w;a(H).addClass("FormElement");if(this.edittype=="text"||this.edittype=="textarea")a(H).addClass("ui-widget-content ui-corner-all");B=a(v).find("tr[rowpos="+ea+"]");if(Z.rowabove){Y=
+a("<tr><td class='contentinfo' colspan='"+q*2+"'>"+Z.rowcontent+"</td></tr>");a(v).append(Y);Y[0].rp=ea}if(B.length===0){B=a("<tr "+O+" rowpos='"+ea+"'></tr>").addClass("FormData").attr("id","tr_"+J);a(B).append(aa);a(v).append(B);B[0].rp=ea}a("td:eq("+(ga-2)+")",B[0]).html(typeof Z.label==="undefined"?k.p.colNames[U]:Z.label);a("td:eq("+(ga-1)+")",B[0]).append(Z.elmprefix).append(H).append(Z.elmsuffix);T[L]=U;L++}});if(L>0){S=a("<tr class='FormData' style='display:none'><td class='CaptionTD'></td><td colspan='"+
+(q*2-1)+"' class='DataTD'><input class='FormElement' id='id_g' type='text' name='"+k.p.id+"_id' value='"+g+"'/></td></tr>");S[0].rp=L+999;a(v).append(S);if(d[c.p.id].checkOnSubmit||d[c.p.id].checkOnUpdate)d[c.p.id]._savedData[k.p.id+"_id"]=g}return T}function E(g,k,v){var q,J=0,D,B,L,w,O;if(d[c.p.id].checkOnSubmit||d[c.p.id].checkOnUpdate){d[c.p.id]._savedData={};d[c.p.id]._savedData[k.p.id+"_id"]=g}var H=k.p.colModel;if(g=="_empty"){a(H).each(function(){q=this.name;L=a.extend({},this.editoptions||
+{});if((B=a("#"+a.jgrid.jqID(q),"#"+v))&&B.length&&B[0]!==null){w="";if(L.defaultValue){w=a.isFunction(L.defaultValue)?L.defaultValue():L.defaultValue;if(B[0].type=="checkbox"){O=w.toLowerCase();if(O.search(/(false|0|no|off|undefined)/i)<0&&O!==""){B[0].checked=true;B[0].defaultChecked=true;B[0].value=w}else B.attr({checked:"",defaultChecked:""})}else B.val(w)}else if(B[0].type=="checkbox"){B[0].checked=false;B[0].defaultChecked=false;w=a(B).attr("offval")}else if(B[0].type&&B[0].type.substr(0,6)==
+"select")B[0].selectedIndex=0;else B.val(w);if(d[c.p.id].checkOnSubmit===true||d[c.p.id].checkOnUpdate)d[c.p.id]._savedData[q]=w}});a("#id_g","#"+v).val(g)}else{var T=a(k).jqGrid("getInd",g,true);if(T){a("td",T).each(function(M){q=H[M].name;if(q!=="cb"&&q!=="subgrid"&&q!=="rn"&&H[M].editable===true){if(q==k.p.ExpandColumn&&k.p.treeGrid===true)D=a(this).text();else try{D=a.unformat(a(this),{rowId:g,colModel:H[M]},M)}catch(aa){D=H[M].edittype=="textarea"?a(this).text():a(this).html()}if(c.p.autoencode)D=
+a.jgrid.htmlDecode(D);if(d[c.p.id].checkOnSubmit===true||d[c.p.id].checkOnUpdate)d[c.p.id]._savedData[q]=D;q=a.jgrid.jqID(q);switch(H[M].edittype){case "password":case "text":case "button":case "image":case "textarea":if(D=="&nbsp;"||D=="&#160;"||D.length==1&&D.charCodeAt(0)==160)D="";a("#"+q,"#"+v).val(D);break;case "select":var S=D.split(",");S=a.map(S,function(fa){return a.trim(fa)});a("#"+q+" option","#"+v).each(function(){this.selected=!H[M].editoptions.multiple&&(S[0]==a.trim(a(this).text())||
+S[0]==a.trim(a(this).val()))?true:H[M].editoptions.multiple?a.inArray(a.trim(a(this).text()),S)>-1||a.inArray(a.trim(a(this).val()),S)>-1?true:false:false});break;case "checkbox":D+="";if(H[M].editoptions&&H[M].editoptions.value)if(H[M].editoptions.value.split(":")[0]==D){a("#"+q,"#"+v).attr("checked",true);a("#"+q,"#"+v).attr("defaultChecked",true)}else{a("#"+q,"#"+v).attr("checked",false);a("#"+q,"#"+v).attr("defaultChecked","")}else{D=D.toLowerCase();if(D.search(/(false|0|no|off|undefined)/i)<
+0&&D!==""){a("#"+q,"#"+v).attr("checked",true);a("#"+q,"#"+v).attr("defaultChecked",true)}else{a("#"+q,"#"+v).attr("checked",false);a("#"+q,"#"+v).attr("defaultChecked","")}}break;case "custom":try{if(H[M].editoptions&&a.isFunction(H[M].editoptions.custom_value))H[M].editoptions.custom_value(a("#"+q,"#"+v),"set",D);else throw"e1";}catch(U){U=="e1"?a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose):a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,
+U.message,jQuery.jgrid.edit.bClose)}}J++}});J>0&&a("#id_g","#"+h).val(g)}}}function C(){var g,k=[true,"",""],v={},q=c.p.prmNames,J,D,B,L;if(a.isFunction(d[c.p.id].beforeCheckValues)){var w=d[c.p.id].beforeCheckValues(j,a("#"+n),j[c.p.id+"_id"]=="_empty"?q.addoper:q.editoper);if(w&&typeof w==="object")j=w}for(B in j)if(j.hasOwnProperty(B)){k=a.jgrid.checkValues(j[B],B,c);if(k[0]===false)break}y();if(k[0]){if(a.isFunction(d[c.p.id].onclickSubmit))v=d[c.p.id].onclickSubmit(d[c.p.id],j)||{};if(a.isFunction(d[c.p.id].beforeSubmit))k=
+d[c.p.id].beforeSubmit(j,a("#"+n))}if(k[0]&&!d[c.p.id].processing){d[c.p.id].processing=true;a("#sData","#"+h+"_2").addClass("ui-state-active");D=q.oper;J=q.id;j[D]=a.trim(j[c.p.id+"_id"])=="_empty"?q.addoper:q.editoper;if(j[D]!=q.addoper)j[J]=j[c.p.id+"_id"];else if(j[J]===undefined)j[J]=j[c.p.id+"_id"];delete j[c.p.id+"_id"];j=a.extend(j,d.editData,v);if(c.p.treeGrid===true){if(j[D]==q.addoper){L=a(c).jqGrid("getGridParam","selrow");j[c.p.treeGridModel=="adjacency"?c.p.treeReader.parent_id_field:
+"parent_id"]=L}for(i in c.p.treeReader){v=c.p.treeReader[i];if(j.hasOwnProperty(v))j[D]==q.addoper&&i==="parent_id_field"||delete j[v]}}v=a.extend({url:d[c.p.id].url?d[c.p.id].url:a(c).jqGrid("getGridParam","editurl"),type:d[c.p.id].mtype,data:a.isFunction(d[c.p.id].serializeEditData)?d[c.p.id].serializeEditData(j):j,complete:function(O,H){if(H!="success"){k[0]=false;k[1]=a.isFunction(d[c.p.id].errorTextFormat)?d[c.p.id].errorTextFormat(O):H+" Status: '"+O.statusText+"'. Error code: "+O.status}else if(a.isFunction(d[c.p.id].afterSubmit))k=
+d[c.p.id].afterSubmit(O,j);if(k[0]===false){a("#FormError>td","#"+h).html(k[1]);a("#FormError","#"+h).show()}else{a.each(c.p.colModel,function(){if(Q[this.name]&&this.formatter&&this.formatter=="select")try{delete Q[this.name]}catch(aa){}});j=a.extend(j,Q);c.p.autoencode&&a.each(j,function(aa,S){j[aa]=a.jgrid.htmlDecode(S)});if(j[D]==q.addoper){k[2]||(k[2]=a.jgrid.randId());j[J]=k[2];if(d[c.p.id].closeAfterAdd){if(d[c.p.id].reloadAfterSubmit)a(c).trigger("reloadGrid");else if(c.p.treeGrid===true)a(c).jqGrid("addChildNode",
+k[2],L,j);else{a(c).jqGrid("addRowData",k[2],j,b.addedrow);a(c).jqGrid("setSelection",k[2])}a.jgrid.hideModal("#"+p.themodal,{gb:"#gbox_"+u,jqm:b.jqModal,onClose:d[c.p.id].onClose})}else if(d[c.p.id].clearAfterAdd){if(d[c.p.id].reloadAfterSubmit)a(c).trigger("reloadGrid");else c.p.treeGrid===true?a(c).jqGrid("addChildNode",k[2],L,j):a(c).jqGrid("addRowData",k[2],j,b.addedrow);E("_empty",c,n)}else if(d[c.p.id].reloadAfterSubmit)a(c).trigger("reloadGrid");else c.p.treeGrid===true?a(c).jqGrid("addChildNode",
+k[2],L,j):a(c).jqGrid("addRowData",k[2],j,b.addedrow)}else{if(d[c.p.id].reloadAfterSubmit){a(c).trigger("reloadGrid");d[c.p.id].closeAfterEdit||setTimeout(function(){a(c).jqGrid("setSelection",j[J])},1E3)}else c.p.treeGrid===true?a(c).jqGrid("setTreeRow",j[J],j):a(c).jqGrid("setRowData",j[J],j);d[c.p.id].closeAfterEdit&&a.jgrid.hideModal("#"+p.themodal,{gb:"#gbox_"+u,jqm:b.jqModal,onClose:d[c.p.id].onClose})}if(a.isFunction(d[c.p.id].afterComplete)){g=O;setTimeout(function(){d[c.p.id].afterComplete(g,
+j,a("#"+n));g=null},500)}if(d[c.p.id].checkOnSubmit||d[c.p.id].checkOnUpdate){a("#"+n).data("disabled",false);if(d[c.p.id]._savedData[c.p.id+"_id"]!="_empty")for(var T in d[c.p.id]._savedData)if(j[T])d[c.p.id]._savedData[T]=j[T]}}d[c.p.id].processing=false;a("#sData","#"+h+"_2").removeClass("ui-state-active");try{a(":input:visible","#"+n)[0].focus()}catch(M){}}},a.jgrid.ajaxOptions,d[c.p.id].ajaxEditOptions);if(!v.url&&!d[c.p.id].useDataProxy)if(a.isFunction(c.p.dataProxy))d[c.p.id].useDataProxy=
+true;else{k[0]=false;k[1]+=" "+a.jgrid.errors.nourl}if(k[0])d[c.p.id].useDataProxy?c.p.dataProxy.call(c,v,"set_"+c.p.id):a.ajax(v)}if(k[0]===false){a("#FormError>td","#"+h).html(k[1]);a("#FormError","#"+h).show()}}function F(g,k){var v=false,q;for(q in g)if(g[q]!=k[q]){v=true;break}return v}function y(){a.each(c.p.colModel,function(g,k){if(k.editoptions&&k.editoptions.NullIfEmpty===true)if(j.hasOwnProperty(k.name)&&j[k.name]=="")j[k.name]="null"})}function m(){var g=true;a("#FormError","#"+h).hide();
+if(d[c.p.id].checkOnUpdate){j={};Q={};e();P=a.extend({},j,Q);if(V=F(P,d[c.p.id]._savedData)){a("#"+n).data("disabled",true);a(".confirm","#"+p.themodal).show();g=false}}return g}function s(){if(f!=="_empty"&&typeof c.p.savedRow!=="undefined"&&c.p.savedRow.length>0&&a.isFunction(a.fn.jqGrid.restoreRow))for(var g=0;g<c.p.savedRow.length;g++)if(c.p.savedRow[g].id==f){a(c).jqGrid("restoreRow",f);break}}function t(g,k){g===0?a("#pData","#"+h+"_2").addClass("ui-state-disabled"):a("#pData","#"+h+"_2").removeClass("ui-state-disabled");
+g==k?a("#nData","#"+h+"_2").addClass("ui-state-disabled"):a("#nData","#"+h+"_2").removeClass("ui-state-disabled")}function o(){var g=a(c).jqGrid("getDataIDs"),k=a("#id_g","#"+h).val();return[a.inArray(k,g),g]}var c=this;if(c.grid&&f){var u=c.p.id,n="FrmGrid_"+u,h="TblGrid_"+u,p={themodal:"editmod"+u,modalhead:"edithd"+u,modalcontent:"editcnt"+u,scrollelm:n},x=a.isFunction(d[c.p.id].beforeShowForm)?d[c.p.id].beforeShowForm:false,A=a.isFunction(d[c.p.id].afterShowForm)?d[c.p.id].afterShowForm:false,
+G=a.isFunction(d[c.p.id].beforeInitData)?d[c.p.id].beforeInitData:false,N=a.isFunction(d[c.p.id].onInitializeForm)?d[c.p.id].onInitializeForm:false,I=true,l=1,z=0,j,Q,P,V;if(f==="new"){f="_empty";b.caption=d[c.p.id].addCaption}else b.caption=d[c.p.id].editCaption;b.recreateForm===true&&a("#"+p.themodal).html()!==null&&a("#"+p.themodal).remove();var R=true;if(b.checkOnUpdate&&b.jqModal&&!b.modal)R=false;if(a("#"+p.themodal).html()!==null){if(G){I=G(a("#"+n));if(typeof I=="undefined")I=true}if(I===
+false)return;s();a(".ui-jqdialog-title","#"+p.modalhead).html(b.caption);a("#FormError","#"+h).hide();if(d[c.p.id].topinfo){a(".topinfo","#"+h+"_2").html(d[c.p.id].topinfo);a(".tinfo","#"+h+"_2").show()}else a(".tinfo","#"+h+"_2").hide();if(d[c.p.id].bottominfo){a(".bottominfo","#"+h+"_2").html(d[c.p.id].bottominfo);a(".binfo","#"+h+"_2").show()}else a(".binfo","#"+h+"_2").hide();E(f,c,n);f=="_empty"||!d[c.p.id].viewPagerButtons?a("#pData, #nData","#"+h+"_2").hide():a("#pData, #nData","#"+h+"_2").show();
+if(d[c.p.id].processing===true){d[c.p.id].processing=false;a("#sData","#"+h+"_2").removeClass("ui-state-active")}if(a("#"+n).data("disabled")===true){a(".confirm","#"+p.themodal).hide();a("#"+n).data("disabled",false)}x&&x(a("#"+n));a("#"+p.themodal).data("onClose",d[c.p.id].onClose);a.jgrid.viewModal("#"+p.themodal,{gbox:"#gbox_"+u,jqm:b.jqModal,jqM:false,overlay:b.overlay,modal:b.modal});R||a(".jqmOverlay").click(function(){if(!m())return false;a.jgrid.hideModal("#"+p.themodal,{gb:"#gbox_"+u,jqm:b.jqModal,
+onClose:d[c.p.id].onClose});return false});A&&A(a("#"+n))}else{var K=isNaN(b.dataheight)?b.dataheight:b.dataheight+"px";K=a("<form name='FormPost' id='"+n+"' class='FormGrid' onSubmit='return false;' style='width:100%;overflow:auto;position:relative;height:"+K+";'></form>").data("disabled",false);var W=a("<table id='"+h+"' class='EditTable' cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>");if(G){I=G(a("#"+n));if(typeof I=="undefined")I=true}if(I===false)return;s();a(c.p.colModel).each(function(){var g=
+this.formoptions;l=Math.max(l,g?g.colpos||0:0);z=Math.max(z,g?g.rowpos||0:0)});a(K).append(W);G=a("<tr id='FormError' style='display:none'><td class='ui-state-error' colspan='"+l*2+"'></td></tr>");G[0].rp=0;a(W).append(G);G=a("<tr style='display:none' class='tinfo'><td class='topinfo' colspan='"+l*2+"'>"+d[c.p.id].topinfo+"</td></tr>");G[0].rp=0;a(W).append(G);I=(G=c.p.direction=="rtl"?true:false)?"nData":"pData";var X=G?"pData":"nData";r(f,c,W,l);I="<a href='javascript:void(0)' id='"+I+"' class='fm-button ui-state-default ui-corner-left'><span class='ui-icon ui-icon-triangle-1-w'></span></a>";
+X="<a href='javascript:void(0)' id='"+X+"' class='fm-button ui-state-default ui-corner-right'><span class='ui-icon ui-icon-triangle-1-e'></span></a>";var ba="<a href='javascript:void(0)' id='sData' class='fm-button ui-state-default ui-corner-all'>"+b.bSubmit+"</a>",$="<a href='javascript:void(0)' id='cData' class='fm-button ui-state-default ui-corner-all'>"+b.bCancel+"</a>";I="<table border='0' cellspacing='0' cellpadding='0' class='EditTable' id='"+h+"_2'><tbody><tr><td colspan='2'><hr class='ui-widget-content' style='margin:1px'/></td></tr><tr id='Act_Buttons'><td class='navButton'>"+
+(G?X+I:I+X)+"</td><td class='EditButton'>"+ba+$+"</td></tr>";I+="<tr style='display:none' class='binfo'><td class='bottominfo' colspan='2'>"+d[c.p.id].bottominfo+"</td></tr>";I+="</tbody></table>";if(z>0){var ca=[];a.each(a(W)[0].rows,function(g,k){ca[g]=k});ca.sort(function(g,k){if(g.rp>k.rp)return 1;if(g.rp<k.rp)return-1;return 0});a.each(ca,function(g,k){a("tbody",W).append(k)})}b.gbox="#gbox_"+u;var da=false;if(b.closeOnEscape===true){b.closeOnEscape=false;da=true}K=a("<span></span>").append(K).append(I);
+a.jgrid.createModal(p,K,b,"#gview_"+c.p.id,a("#gbox_"+c.p.id)[0]);if(G){a("#pData, #nData","#"+h+"_2").css("float","right");a(".EditButton","#"+h+"_2").css("text-align","left")}d[c.p.id].topinfo&&a(".tinfo","#"+h+"_2").show();d[c.p.id].bottominfo&&a(".binfo","#"+h+"_2").show();I=K=null;a("#"+p.themodal).keydown(function(g){var k=g.target;if(a("#"+n).data("disabled")===true)return false;if(d[c.p.id].savekey[0]===true&&g.which==d[c.p.id].savekey[1])if(k.tagName!="TEXTAREA"){a("#sData","#"+h+"_2").trigger("click");
+return false}if(g.which===27){if(!m())return false;da&&a.jgrid.hideModal(this,{gb:b.gbox,jqm:b.jqModal,onClose:d[c.p.id].onClose});return false}if(d[c.p.id].navkeys[0]===true){if(a("#id_g","#"+h).val()=="_empty")return true;if(g.which==d[c.p.id].navkeys[1]){a("#pData","#"+h+"_2").trigger("click");return false}if(g.which==d[c.p.id].navkeys[2]){a("#nData","#"+h+"_2").trigger("click");return false}}});if(b.checkOnUpdate){a("a.ui-jqdialog-titlebar-close span","#"+p.themodal).removeClass("jqmClose");a("a.ui-jqdialog-titlebar-close",
+"#"+p.themodal).unbind("click").click(function(){if(!m())return false;a.jgrid.hideModal("#"+p.themodal,{gb:"#gbox_"+u,jqm:b.jqModal,onClose:d[c.p.id].onClose});return false})}b.saveicon=a.extend([true,"left","ui-icon-disk"],b.saveicon);b.closeicon=a.extend([true,"left","ui-icon-close"],b.closeicon);if(b.saveicon[0]===true)a("#sData","#"+h+"_2").addClass(b.saveicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+b.saveicon[2]+"'></span>");if(b.closeicon[0]===
+true)a("#cData","#"+h+"_2").addClass(b.closeicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+b.closeicon[2]+"'></span>");if(d[c.p.id].checkOnSubmit||d[c.p.id].checkOnUpdate){ba="<a href='javascript:void(0)' id='sNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+b.bYes+"</a>";X="<a href='javascript:void(0)' id='nNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+b.bNo+"</a>";$="<a href='javascript:void(0)' id='cNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+
+b.bExit+"</a>";K=b.zIndex||999;K++;a("<div class='ui-widget-overlay jqgrid-overlay confirm' style='z-index:"+K+";display:none;'>&#160;"+(a.browser.msie&&a.browser.version==6?'<iframe style="display:block;position:absolute;z-index:-1;filter:Alpha(Opacity=\'0\');" src="javascript:false;"></iframe>':"")+"</div><div class='confirm ui-widget-content ui-jqconfirm' style='z-index:"+(K+1)+"'>"+b.saveData+"<br/><br/>"+ba+X+$+"</div>").insertAfter("#"+n);a("#sNew","#"+p.themodal).click(function(){C();a("#"+
+n).data("disabled",false);a(".confirm","#"+p.themodal).hide();return false});a("#nNew","#"+p.themodal).click(function(){a(".confirm","#"+p.themodal).hide();a("#"+n).data("disabled",false);setTimeout(function(){a(":input","#"+n)[0].focus()},0);return false});a("#cNew","#"+p.themodal).click(function(){a(".confirm","#"+p.themodal).hide();a("#"+n).data("disabled",false);a.jgrid.hideModal("#"+p.themodal,{gb:"#gbox_"+u,jqm:b.jqModal,onClose:d[c.p.id].onClose});return false})}N&&N(a("#"+n));f=="_empty"||
+!d[c.p.id].viewPagerButtons?a("#pData,#nData","#"+h+"_2").hide():a("#pData,#nData","#"+h+"_2").show();x&&x(a("#"+n));a("#"+p.themodal).data("onClose",d[c.p.id].onClose);a.jgrid.viewModal("#"+p.themodal,{gbox:"#gbox_"+u,jqm:b.jqModal,overlay:b.overlay,modal:b.modal});R||a(".jqmOverlay").click(function(){if(!m())return false;a.jgrid.hideModal("#"+p.themodal,{gb:"#gbox_"+u,jqm:b.jqModal,onClose:d[c.p.id].onClose});return false});A&&A(a("#"+n));a(".fm-button","#"+p.themodal).hover(function(){a(this).addClass("ui-state-hover")},
+function(){a(this).removeClass("ui-state-hover")});a("#sData","#"+h+"_2").click(function(){j={};Q={};a("#FormError","#"+h).hide();e();if(j[c.p.id+"_id"]=="_empty")C();else if(b.checkOnSubmit===true){P=a.extend({},j,Q);if(V=F(P,d[c.p.id]._savedData)){a("#"+n).data("disabled",true);a(".confirm","#"+p.themodal).show()}else C()}else C();return false});a("#cData","#"+h+"_2").click(function(){if(!m())return false;a.jgrid.hideModal("#"+p.themodal,{gb:"#gbox_"+u,jqm:b.jqModal,onClose:d[c.p.id].onClose});
+return false});a("#nData","#"+h+"_2").click(function(){if(!m())return false;a("#FormError","#"+h).hide();var g=o();g[0]=parseInt(g[0],10);if(g[0]!=-1&&g[1][g[0]+1]){if(a.isFunction(b.onclickPgButtons))b.onclickPgButtons("next",a("#"+n),g[1][g[0]]);E(g[1][g[0]+1],c,n);a(c).jqGrid("setSelection",g[1][g[0]+1]);a.isFunction(b.afterclickPgButtons)&&b.afterclickPgButtons("next",a("#"+n),g[1][g[0]+1]);t(g[0]+1,g[1].length-1)}return false});a("#pData","#"+h+"_2").click(function(){if(!m())return false;a("#FormError",
+"#"+h).hide();var g=o();if(g[0]!=-1&&g[1][g[0]-1]){if(a.isFunction(b.onclickPgButtons))b.onclickPgButtons("prev",a("#"+n),g[1][g[0]]);E(g[1][g[0]-1],c,n);a(c).jqGrid("setSelection",g[1][g[0]-1]);a.isFunction(b.afterclickPgButtons)&&b.afterclickPgButtons("prev",a("#"+n),g[1][g[0]-1]);t(g[0]-1,g[1].length-1)}return false})}x=o();t(x[0],x[1].length-1)}})},viewGridRow:function(f,b){b=a.extend({top:0,left:0,width:0,height:"auto",dataheight:"auto",modal:false,overlay:30,drag:true,resize:true,jqModal:true,
+closeOnEscape:false,labelswidth:"30%",closeicon:[],navkeys:[false,38,40],onClose:null,beforeShowForm:null,beforeInitData:null,viewPagerButtons:true},a.jgrid.view,b||{});return this.each(function(){function e(){if(b.closeOnEscape===true||b.navkeys[0]===true)setTimeout(function(){a(".ui-jqdialog-titlebar-close","#"+o.modalhead).focus()},0)}function r(l,z,j,Q){for(var P,V,R,K=0,W,X,ba=[],$=false,ca="<td class='CaptionTD form-view-label ui-widget-content' width='"+b.labelswidth+"'>&#160;</td><td class='DataTD form-view-data ui-helper-reset ui-widget-content'>&#160;</td>",
+da="",g=["integer","number","currency"],k=0,v=0,q,J,D,B=1;B<=Q;B++)da+=B==1?ca:"<td class='CaptionTD form-view-label ui-widget-content'>&#160;</td><td class='DataTD form-view-data ui-widget-content'>&#160;</td>";a(z.p.colModel).each(function(){V=this.editrules&&this.editrules.edithidden===true?false:this.hidden===true?true:false;if(!V&&this.align==="right")if(this.formatter&&a.inArray(this.formatter,g)!==-1)k=Math.max(k,parseInt(this.width,10));else v=Math.max(v,parseInt(this.width,10))});q=k!==0?
+k:v!==0?v:0;$=a(z).jqGrid("getInd",l);a(z.p.colModel).each(function(L){P=this.name;J=false;X=(V=this.editrules&&this.editrules.edithidden===true?false:this.hidden===true?true:false)?"style='display:none'":"";D=typeof this.viewable!="boolean"?true:this.viewable;if(P!=="cb"&&P!=="subgrid"&&P!=="rn"&&D){W=$===false?"":P==z.p.ExpandColumn&&z.p.treeGrid===true?a("td:eq("+L+")",z.rows[$]).text():a("td:eq("+L+")",z.rows[$]).html();J=this.align==="right"&&q!==0?true:false;a.extend({},this.editoptions||{},
+{id:P,name:P});var w=a.extend({},{rowabove:false,rowcontent:""},this.formoptions||{}),O=parseInt(w.rowpos,10)||K+1,H=parseInt((parseInt(w.colpos,10)||1)*2,10);if(w.rowabove){var T=a("<tr><td class='contentinfo' colspan='"+Q*2+"'>"+w.rowcontent+"</td></tr>");a(j).append(T);T[0].rp=O}R=a(j).find("tr[rowpos="+O+"]");if(R.length===0){R=a("<tr "+X+" rowpos='"+O+"'></tr>").addClass("FormData").attr("id","trv_"+P);a(R).append(da);a(j).append(R);R[0].rp=O}a("td:eq("+(H-2)+")",R[0]).html("<b>"+(typeof w.label===
+"undefined"?z.p.colNames[L]:w.label)+"</b>");a("td:eq("+(H-1)+")",R[0]).append("<span>"+W+"</span>").attr("id","v_"+P);J&&a("td:eq("+(H-1)+") span",R[0]).css({"text-align":"right",width:q+"px"});ba[K]=L;K++}});if(K>0){l=a("<tr class='FormData' style='display:none'><td class='CaptionTD'></td><td colspan='"+(Q*2-1)+"' class='DataTD'><input class='FormElement' id='id_g' type='text' name='id' value='"+l+"'/></td></tr>");l[0].rp=K+99;a(j).append(l)}return ba}function E(l,z){var j,Q,P=0,V,R;if(R=a(z).jqGrid("getInd",
+l,true)){a("td",R).each(function(K){j=z.p.colModel[K].name;Q=z.p.colModel[K].editrules&&z.p.colModel[K].editrules.edithidden===true?false:z.p.colModel[K].hidden===true?true:false;if(j!=="cb"&&j!=="subgrid"&&j!=="rn"){V=j==z.p.ExpandColumn&&z.p.treeGrid===true?a(this).text():a(this).html();a.extend({},z.p.colModel[K].editoptions||{});j=a.jgrid.jqID("v_"+j);a("#"+j+" span","#"+t).html(V);Q&&a("#"+j,"#"+t).parents("tr:first").hide();P++}});P>0&&a("#id_g","#"+t).val(l)}}function C(l,z){l===0?a("#pData",
+"#"+t+"_2").addClass("ui-state-disabled"):a("#pData","#"+t+"_2").removeClass("ui-state-disabled");l==z?a("#nData","#"+t+"_2").addClass("ui-state-disabled"):a("#nData","#"+t+"_2").removeClass("ui-state-disabled")}function F(){var l=a(y).jqGrid("getDataIDs"),z=a("#id_g","#"+t).val();return[a.inArray(z,l),l]}var y=this;if(y.grid&&f){if(!b.imgpath)b.imgpath=y.p.imgpath;var m=y.p.id,s="ViewGrid_"+m,t="ViewTbl_"+m,o={themodal:"viewmod"+m,modalhead:"viewhd"+m,modalcontent:"viewcnt"+m,scrollelm:s},c=a.isFunction(b.beforeInitData)?
+b.beforeInitData:false,u=true,n=1,h=0;if(a("#"+o.themodal).html()!==null){if(c){u=c(a("#"+s));if(typeof u=="undefined")u=true}if(u===false)return;a(".ui-jqdialog-title","#"+o.modalhead).html(b.caption);a("#FormError","#"+t).hide();E(f,y);a.isFunction(b.beforeShowForm)&&b.beforeShowForm(a("#"+s));a.jgrid.viewModal("#"+o.themodal,{gbox:"#gbox_"+m,jqm:b.jqModal,jqM:false,overlay:b.overlay,modal:b.modal});e()}else{var p=isNaN(b.dataheight)?b.dataheight:b.dataheight+"px";p=a("<form name='FormPost' id='"+
+s+"' class='FormGrid' style='width:100%;overflow:auto;position:relative;height:"+p+";'></form>");var x=a("<table id='"+t+"' class='EditTable' cellspacing='1' cellpadding='2' border='0' style='table-layout:fixed'><tbody></tbody></table>");if(c){u=c(a("#"+s));if(typeof u=="undefined")u=true}if(u===false)return;a(y.p.colModel).each(function(){var l=this.formoptions;n=Math.max(n,l?l.colpos||0:0);h=Math.max(h,l?l.rowpos||0:0)});a(p).append(x);r(f,y,x,n);c=y.p.direction=="rtl"?true:false;u="<a href='javascript:void(0)' id='"+
+(c?"nData":"pData")+"' class='fm-button ui-state-default ui-corner-left'><span class='ui-icon ui-icon-triangle-1-w'></span></a>";var A="<a href='javascript:void(0)' id='"+(c?"pData":"nData")+"' class='fm-button ui-state-default ui-corner-right'><span class='ui-icon ui-icon-triangle-1-e'></span></a>",G="<a href='javascript:void(0)' id='cData' class='fm-button ui-state-default ui-corner-all'>"+b.bClose+"</a>";if(h>0){var N=[];a.each(a(x)[0].rows,function(l,z){N[l]=z});N.sort(function(l,z){if(l.rp>z.rp)return 1;
+if(l.rp<z.rp)return-1;return 0});a.each(N,function(l,z){a("tbody",x).append(z)})}b.gbox="#gbox_"+m;var I=false;if(b.closeOnEscape===true){b.closeOnEscape=false;I=true}p=a("<span></span>").append(p).append("<table border='0' class='EditTable' id='"+t+"_2'><tbody><tr id='Act_Buttons'><td class='navButton' width='"+b.labelswidth+"'>"+(c?A+u:u+A)+"</td><td class='EditButton'>"+G+"</td></tr></tbody></table>");a.jgrid.createModal(o,p,b,"#gview_"+y.p.id,a("#gview_"+y.p.id)[0]);if(c){a("#pData, #nData","#"+
+t+"_2").css("float","right");a(".EditButton","#"+t+"_2").css("text-align","left")}b.viewPagerButtons||a("#pData, #nData","#"+t+"_2").hide();p=null;a("#"+o.themodal).keydown(function(l){if(l.which===27){I&&a.jgrid.hideModal(this,{gb:b.gbox,jqm:b.jqModal,onClose:b.onClose});return false}if(b.navkeys[0]===true){if(l.which===b.navkeys[1]){a("#pData","#"+t+"_2").trigger("click");return false}if(l.which===b.navkeys[2]){a("#nData","#"+t+"_2").trigger("click");return false}}});b.closeicon=a.extend([true,
+"left","ui-icon-close"],b.closeicon);if(b.closeicon[0]===true)a("#cData","#"+t+"_2").addClass(b.closeicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+b.closeicon[2]+"'></span>");a.isFunction(b.beforeShowForm)&&b.beforeShowForm(a("#"+s));a.jgrid.viewModal("#"+o.themodal,{gbox:"#gbox_"+m,jqm:b.jqModal,modal:b.modal});a(".fm-button:not(.ui-state-disabled)","#"+t+"_2").hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});
+e();a("#cData","#"+t+"_2").click(function(){a.jgrid.hideModal("#"+o.themodal,{gb:"#gbox_"+m,jqm:b.jqModal,onClose:b.onClose});return false});a("#nData","#"+t+"_2").click(function(){a("#FormError","#"+t).hide();var l=F();l[0]=parseInt(l[0],10);if(l[0]!=-1&&l[1][l[0]+1]){if(a.isFunction(b.onclickPgButtons))b.onclickPgButtons("next",a("#"+s),l[1][l[0]]);E(l[1][l[0]+1],y);a(y).jqGrid("setSelection",l[1][l[0]+1]);a.isFunction(b.afterclickPgButtons)&&b.afterclickPgButtons("next",a("#"+s),l[1][l[0]+1]);
+C(l[0]+1,l[1].length-1)}e();return false});a("#pData","#"+t+"_2").click(function(){a("#FormError","#"+t).hide();var l=F();if(l[0]!=-1&&l[1][l[0]-1]){if(a.isFunction(b.onclickPgButtons))b.onclickPgButtons("prev",a("#"+s),l[1][l[0]]);E(l[1][l[0]-1],y);a(y).jqGrid("setSelection",l[1][l[0]-1]);a.isFunction(b.afterclickPgButtons)&&b.afterclickPgButtons("prev",a("#"+s),l[1][l[0]-1]);C(l[0]-1,l[1].length-1)}e();return false})}p=F();C(p[0],p[1].length-1)}})},delGridRow:function(f,b){b=a.extend({top:0,left:0,
+width:240,height:"auto",dataheight:"auto",modal:false,overlay:30,drag:true,resize:true,url:"",mtype:"POST",reloadAfterSubmit:true,beforeShowForm:null,beforeInitData:null,afterShowForm:null,beforeSubmit:null,onclickSubmit:null,afterSubmit:null,jqModal:true,closeOnEscape:false,delData:{},delicon:[],cancelicon:[],onClose:null,ajaxDelOptions:{},processing:false,serializeDelData:null,useDataProxy:false},a.jgrid.del,b||{});d[a(this)[0].p.id]=b;return this.each(function(){var e=this;if(e.grid)if(f){var r=
+a.isFunction(d[e.p.id].beforeShowForm),E=a.isFunction(d[e.p.id].afterShowForm),C=a.isFunction(d[e.p.id].beforeInitData)?d[e.p.id].beforeInitData:false,F=e.p.id,y={},m=true,s="DelTbl_"+F,t,o,c,u,n={themodal:"delmod"+F,modalhead:"delhd"+F,modalcontent:"delcnt"+F,scrollelm:s};if(jQuery.isArray(f))f=f.join();if(a("#"+n.themodal).html()!==null){if(C){m=C(a("#"+s));if(typeof m=="undefined")m=true}if(m===false)return;a("#DelData>td","#"+s).text(f);a("#DelError","#"+s).hide();if(d[e.p.id].processing===true){d[e.p.id].processing=
+false;a("#dData","#"+s).removeClass("ui-state-active")}r&&d[e.p.id].beforeShowForm(a("#"+s));a.jgrid.viewModal("#"+n.themodal,{gbox:"#gbox_"+F,jqm:d[e.p.id].jqModal,jqM:false,overlay:d[e.p.id].overlay,modal:d[e.p.id].modal})}else{var h=isNaN(d[e.p.id].dataheight)?d[e.p.id].dataheight:d[e.p.id].dataheight+"px";h="<div id='"+s+"' class='formdata' style='width:100%;overflow:auto;position:relative;height:"+h+";'>";h+="<table class='DelTable'><tbody>";h+="<tr id='DelError' style='display:none'><td class='ui-state-error'></td></tr>";
+h+="<tr id='DelData' style='display:none'><td >"+f+"</td></tr>";h+='<tr><td class="delmsg" style="white-space:pre;">'+d[e.p.id].msg+"</td></tr><tr><td >&#160;</td></tr>";h+="</tbody></table></div>";h+="<table cellspacing='0' cellpadding='0' border='0' class='EditTable' id='"+s+"_2'><tbody><tr><td><hr class='ui-widget-content' style='margin:1px'/></td></tr><tr><td class='DelButton EditButton'>"+("<a href='javascript:void(0)' id='dData' class='fm-button ui-state-default ui-corner-all'>"+b.bSubmit+"</a>")+
+"&#160;"+("<a href='javascript:void(0)' id='eData' class='fm-button ui-state-default ui-corner-all'>"+b.bCancel+"</a>")+"</td></tr></tbody></table>";b.gbox="#gbox_"+F;a.jgrid.createModal(n,h,b,"#gview_"+e.p.id,a("#gview_"+e.p.id)[0]);if(C){m=C(a("#"+s));if(typeof m=="undefined")m=true}if(m===false)return;a(".fm-button","#"+s+"_2").hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});b.delicon=a.extend([true,"left","ui-icon-scissors"],d[e.p.id].delicon);
+b.cancelicon=a.extend([true,"left","ui-icon-cancel"],d[e.p.id].cancelicon);if(b.delicon[0]===true)a("#dData","#"+s+"_2").addClass(b.delicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+b.delicon[2]+"'></span>");if(b.cancelicon[0]===true)a("#eData","#"+s+"_2").addClass(b.cancelicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+b.cancelicon[2]+"'></span>");a("#dData","#"+s+"_2").click(function(){var p=[true,""];y=
+{};var x=a("#DelData>td","#"+s).text();if(a.isFunction(d[e.p.id].onclickSubmit))y=d[e.p.id].onclickSubmit(d[e.p.id],x)||{};if(a.isFunction(d[e.p.id].beforeSubmit))p=d[e.p.id].beforeSubmit(x);if(p[0]&&!d[e.p.id].processing){d[e.p.id].processing=true;a(this).addClass("ui-state-active");c=e.p.prmNames;t=a.extend({},d[e.p.id].delData,y);u=c.oper;t[u]=c.deloper;o=c.id;t[o]=x;var A=a.extend({url:d[e.p.id].url?d[e.p.id].url:a(e).jqGrid("getGridParam","editurl"),type:d[e.p.id].mtype,data:a.isFunction(d[e.p.id].serializeDelData)?
+d[e.p.id].serializeDelData(t):t,complete:function(G,N){if(N!="success"){p[0]=false;p[1]=a.isFunction(d[e.p.id].errorTextFormat)?d[e.p.id].errorTextFormat(G):N+" Status: '"+G.statusText+"'. Error code: "+G.status}else if(a.isFunction(d[e.p.id].afterSubmit))p=d[e.p.id].afterSubmit(G,t);if(p[0]===false){a("#DelError>td","#"+s).html(p[1]);a("#DelError","#"+s).show()}else{if(d[e.p.id].reloadAfterSubmit&&e.p.datatype!="local")a(e).trigger("reloadGrid");else{var I=[];I=x.split(",");if(e.p.treeGrid===true)try{a(e).jqGrid("delTreeNode",
+I[0])}catch(l){}else for(var z=0;z<I.length;z++)a(e).jqGrid("delRowData",I[z]);e.p.selrow=null;e.p.selarrrow=[]}a.isFunction(d[e.p.id].afterComplete)&&setTimeout(function(){d[e.p.id].afterComplete(G,x)},500)}d[e.p.id].processing=false;a("#dData","#"+s+"_2").removeClass("ui-state-active");p[0]&&a.jgrid.hideModal("#"+n.themodal,{gb:"#gbox_"+F,jqm:b.jqModal,onClose:d[e.p.id].onClose})}},a.jgrid.ajaxOptions,d[e.p.id].ajaxDelOptions);if(!A.url&&!d[e.p.id].useDataProxy)if(a.isFunction(e.p.dataProxy))d[e.p.id].useDataProxy=
+true;else{p[0]=false;p[1]+=" "+a.jgrid.errors.nourl}if(p[0])d[e.p.id].useDataProxy?e.p.dataProxy.call(e,A,"del_"+e.p.id):a.ajax(A)}if(p[0]===false){a("#DelError>td","#"+s).html(p[1]);a("#DelError","#"+s).show()}return false});a("#eData","#"+s+"_2").click(function(){a.jgrid.hideModal("#"+n.themodal,{gb:"#gbox_"+F,jqm:d[e.p.id].jqModal,onClose:d[e.p.id].onClose});return false});r&&d[e.p.id].beforeShowForm(a("#"+s));a.jgrid.viewModal("#"+n.themodal,{gbox:"#gbox_"+F,jqm:d[e.p.id].jqModal,overlay:d[e.p.id].overlay,
+modal:d[e.p.id].modal})}E&&d[e.p.id].afterShowForm(a("#"+s));d[e.p.id].closeOnEscape===true&&setTimeout(function(){a(".ui-jqdialog-titlebar-close","#"+n.modalhead).focus()},0)}})},navGrid:function(f,b,e,r,E,C,F){b=a.extend({edit:true,editicon:"ui-icon-pencil",add:true,addicon:"ui-icon-plus",del:true,delicon:"ui-icon-trash",search:true,searchicon:"ui-icon-search",refresh:true,refreshicon:"ui-icon-refresh",refreshstate:"firstpage",view:false,viewicon:"ui-icon-document",position:"left",closeOnEscape:true,
+beforeRefresh:null,afterRefresh:null,cloneToTop:false},a.jgrid.nav,b||{});return this.each(function(){if(!this.nav){var y={themodal:"alertmod",modalhead:"alerthd",modalcontent:"alertcnt"},m=this,s,t,o;if(!(!m.grid||typeof f!="string")){if(a("#"+y.themodal).html()===null){if(typeof window.innerWidth!="undefined"){s=window.innerWidth;t=window.innerHeight}else if(typeof document.documentElement!="undefined"&&typeof document.documentElement.clientWidth!="undefined"&&document.documentElement.clientWidth!==
+0){s=document.documentElement.clientWidth;t=document.documentElement.clientHeight}else{s=1024;t=768}a.jgrid.createModal(y,"<div>"+b.alerttext+"</div><span tabindex='0'><span tabindex='-1' id='jqg_alrt'></span></span>",{gbox:"#gbox_"+m.p.id,jqModal:true,drag:true,resize:true,caption:b.alertcap,top:t/2-25,left:s/2-100,width:200,height:"auto",closeOnEscape:b.closeOnEscape},"","",true)}s=1;if(b.cloneToTop&&m.p.toppager)s=2;for(t=0;t<s;t++){var c=a("<table cellspacing='0' cellpadding='0' border='0' class='ui-pg-table navtable' style='float:left;table-layout:auto;'><tbody><tr></tr></tbody></table>"),
+u,n;if(t===0){u=f;n=m.p.id;if(u==m.p.toppager){n+="_top";s=1}}else{u=m.p.toppager;n=m.p.id+"_top"}m.p.direction=="rtl"&&a(c).attr("dir","rtl").css("float","right");if(b.add){r=r||{};o=a("<td class='ui-pg-button ui-corner-all'></td>");a(o).append("<div class='ui-pg-div'><span class='ui-icon "+b.addicon+"'></span>"+b.addtext+"</div>");a("tr",c).append(o);a(o,c).attr({title:b.addtitle||"",id:r.id||"add_"+n}).click(function(){a(this).hasClass("ui-state-disabled")||(a.isFunction(b.addfunc)?b.addfunc():
+a(m).jqGrid("editGridRow","new",r));return false}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});o=null}if(b.edit){o=a("<td class='ui-pg-button ui-corner-all'></td>");e=e||{};a(o).append("<div class='ui-pg-div'><span class='ui-icon "+b.editicon+"'></span>"+b.edittext+"</div>");a("tr",c).append(o);a(o,c).attr({title:b.edittitle||"",id:e.id||"edit_"+n}).click(function(){if(!a(this).hasClass("ui-state-disabled")){var h=
+m.p.selrow;if(h)a.isFunction(b.editfunc)?b.editfunc(h):a(m).jqGrid("editGridRow",h,e);else{a.jgrid.viewModal("#"+y.themodal,{gbox:"#gbox_"+m.p.id,jqm:true});a("#jqg_alrt").focus()}}return false}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});o=null}if(b.view){o=a("<td class='ui-pg-button ui-corner-all'></td>");F=F||{};a(o).append("<div class='ui-pg-div'><span class='ui-icon "+b.viewicon+"'></span>"+b.viewtext+
+"</div>");a("tr",c).append(o);a(o,c).attr({title:b.viewtitle||"",id:F.id||"view_"+n}).click(function(){if(!a(this).hasClass("ui-state-disabled")){var h=m.p.selrow;if(h)a.isFunction(b.viewfunc)?b.viewfunc(h):a(m).jqGrid("viewGridRow",h,F);else{a.jgrid.viewModal("#"+y.themodal,{gbox:"#gbox_"+m.p.id,jqm:true});a("#jqg_alrt").focus()}}return false}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});o=null}if(b.del){o=
+a("<td class='ui-pg-button ui-corner-all'></td>");E=E||{};a(o).append("<div class='ui-pg-div'><span class='ui-icon "+b.delicon+"'></span>"+b.deltext+"</div>");a("tr",c).append(o);a(o,c).attr({title:b.deltitle||"",id:E.id||"del_"+n}).click(function(){if(!a(this).hasClass("ui-state-disabled")){var h;if(m.p.multiselect){h=m.p.selarrrow;if(h.length===0)h=null}else h=m.p.selrow;if(h)"function"==typeof b.delfunc?b.delfunc(h):a(m).jqGrid("delGridRow",h,E);else{a.jgrid.viewModal("#"+y.themodal,{gbox:"#gbox_"+
+m.p.id,jqm:true});a("#jqg_alrt").focus()}}return false}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});o=null}if(b.add||b.edit||b.del||b.view)a("tr",c).append("<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>");if(b.search){o=a("<td class='ui-pg-button ui-corner-all'></td>");C=C||{};a(o).append("<div class='ui-pg-div'><span class='ui-icon "+b.searchicon+
+"'></span>"+b.searchtext+"</div>");a("tr",c).append(o);a(o,c).attr({title:b.searchtitle||"",id:C.id||"search_"+n}).click(function(){a(this).hasClass("ui-state-disabled")||a(m).jqGrid("searchGrid",C);return false}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});C.showOnLoad&&C.showOnLoad===true&&a(o,c).click();o=null}if(b.refresh){o=a("<td class='ui-pg-button ui-corner-all'></td>");a(o).append("<div class='ui-pg-div'><span class='ui-icon "+
+b.refreshicon+"'></span>"+b.refreshtext+"</div>");a("tr",c).append(o);a(o,c).attr({title:b.refreshtitle||"",id:"refresh_"+n}).click(function(){if(!a(this).hasClass("ui-state-disabled")){a.isFunction(b.beforeRefresh)&&b.beforeRefresh();m.p.search=false;try{var h=m.p.id;m.p.postData.filters="";a("#fbox_"+h).jqFilter("resetFilter");a.isFunction(m.clearToolbar)&&m.clearToolbar(false)}catch(p){}switch(b.refreshstate){case "firstpage":a(m).trigger("reloadGrid",[{page:1}]);break;case "current":a(m).trigger("reloadGrid",
+[{current:true}])}a.isFunction(b.afterRefresh)&&b.afterRefresh()}return false}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});o=null}o=a(".ui-jqgrid").css("font-size")||"11px";a("body").append("<div id='testpg2' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:"+o+";visibility:hidden;' ></div>");o=a(c).clone().appendTo("#testpg2").width();a("#testpg2").remove();a(u+"_"+b.position,u).append(c);
+if(m.p._nvtd){if(o>m.p._nvtd[0]){a(u+"_"+b.position,u).width(o);m.p._nvtd[0]=o}m.p._nvtd[1]=o}c=o=o=null;this.nav=true}}}})},navButtonAdd:function(f,b){b=a.extend({caption:"newButton",title:"",buttonicon:"ui-icon-newwin",onClickButton:null,position:"last",cursor:"pointer"},b||{});return this.each(function(){if(this.grid){if(f.indexOf("#")!==0)f="#"+f;var e=a(".navtable",f)[0],r=this;if(e)if(!(b.id&&a("#"+b.id,e).html()!==null)){var E=a("<td></td>");b.buttonicon.toString().toUpperCase()=="NONE"?a(E).addClass("ui-pg-button ui-corner-all").append("<div class='ui-pg-div'>"+
+b.caption+"</div>"):a(E).addClass("ui-pg-button ui-corner-all").append("<div class='ui-pg-div'><span class='ui-icon "+b.buttonicon+"'></span>"+b.caption+"</div>");b.id&&a(E).attr("id",b.id);if(b.position=="first")e.rows[0].cells.length===0?a("tr",e).append(E):a("tr td:eq(0)",e).before(E);else a("tr",e).append(E);a(E,e).attr("title",b.title||"").click(function(C){a(this).hasClass("ui-state-disabled")||a.isFunction(b.onClickButton)&&b.onClickButton.call(r,C);return false}).hover(function(){a(this).hasClass("ui-state-disabled")||
+a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")})}}})},navSeparatorAdd:function(f,b){b=a.extend({sepclass:"ui-separator",sepcontent:""},b||{});return this.each(function(){if(this.grid){if(f.indexOf("#")!==0)f="#"+f;var e=a(".navtable",f)[0];if(e){var r="<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='"+b.sepclass+"'></span>"+b.sepcontent+"</td>";a("tr",e).append(r)}}})},GridToForm:function(f,b){return this.each(function(){if(this.grid){var e=
+a(this).jqGrid("getRowData",f);if(e)for(var r in e)a("[name="+a.jgrid.jqID(r)+"]",b).is("input:radio")||a("[name="+a.jgrid.jqID(r)+"]",b).is("input:checkbox")?a("[name="+a.jgrid.jqID(r)+"]",b).each(function(){a(this).val()==e[r]?a(this).attr("checked","checked"):a(this).attr("checked","")}):a("[name="+a.jgrid.jqID(r)+"]",b).val(e[r])}})},FormToGrid:function(f,b,e,r){return this.each(function(){if(this.grid){e||(e="set");r||(r="first");var E=a(b).serializeArray(),C={};a.each(E,function(F,y){C[y.name]=
+y.value});if(e=="add")a(this).jqGrid("addRowData",f,C,r);else e=="set"&&a(this).jqGrid("setRowData",f,C)}})}})})(jQuery);
+(function(c){c.fn.jqFilter=function(k){if(typeof k==="string"){var w=c.fn.jqFilter[k];if(!w)throw"jqFilter - No such method: "+k;var B=c.makeArray(arguments).slice(1);return w.apply(this,B)}var o=c.extend(true,{filter:null,columns:[],onChange:null,afterRedraw:null,checkValues:null,error:false,errmsg:"",errorcheck:true,showQuery:true,sopt:null,ops:[{name:"eq",description:"equal",operator:"="},{name:"ne",description:"not equal",operator:"<>"},{name:"lt",description:"less",operator:"<"},{name:"le",description:"less or equal",
+operator:"<="},{name:"gt",description:"greater",operator:">"},{name:"ge",description:"greater or equal",operator:">="},{name:"bw",description:"begins with",operator:"LIKE"},{name:"bn",description:"does not begin with",operator:"NOT LIKE"},{name:"in",description:"in",operator:"IN"},{name:"ni",description:"not in",operator:"NOT IN"},{name:"ew",description:"ends with",operator:"LIKE"},{name:"en",description:"does not end with",operator:"NOT LIKE"},{name:"cn",description:"contains",operator:"LIKE"},{name:"nc",
+description:"does not contain",operator:"NOT LIKE"},{name:"nu",description:"is null",operator:"IS NULL"},{name:"nn",description:"is not null",operator:"IS NOT NULL"}],numopts:["eq","ne","lt","le","gt","ge","nu","nn","in","ni"],stropts:["eq","ne","bw","bn","ew","en","cn","nc","nu","nn","in","ni"],_gridsopt:[],groupOps:["AND","OR"],groupButton:true,ruleButtons:true},k||{});return this.each(function(){if(!this.filter){this.p=o;if(this.p.filter===null||this.p.filter===undefined)this.p.filter={groupOp:this.p.groupOps[0],
+rules:[],groups:[]};var q,x=this.p.columns.length,i,y=/msie/i.test(navigator.userAgent)&&!window.opera;if(this.p._gridsopt.length)for(q=0;q<this.p._gridsopt.length;q++)this.p.ops[q].description=this.p._gridsopt[q];this.p.initFilter=c.extend(true,{},this.p.filter);if(x){for(q=0;q<x;q++){i=this.p.columns[q];if(i.stype)i.inputtype=i.stype;else if(!i.inputtype)i.inputtype="text";if(i.sorttype)i.searchtype=i.sorttype;else if(!i.searchtype)i.searchtype="string";if(i.hidden===undefined)i.hidden=false;if(!i.label)i.label=
+i.name;if(i.index)i.name=i.index;if(!i.hasOwnProperty("searchoptions"))i.searchoptions={};if(!i.hasOwnProperty("searchrules"))i.searchrules={}}this.p.showQuery&&c(this).append("<table class='queryresult ui-widget ui-widget-content' style='display:block;max-width:440px;border:0px none;'><tbody><tr><td class='query'></td></tr></tbody></table>");var z=function(d,f){var a=[true,""];if(c.isFunction(f.searchrules))a=f.searchrules(d,f);else if(c.jgrid&&c.jgrid.checkValues)try{a=c.jgrid.checkValues(d,-1,
+null,f.searchrules,f.label)}catch(b){}if(a&&a.length&&a[0]===false){o.error=!a[0];o.errmsg=a[1]}};this.onchange=function(){this.p.error=false;this.p.errmsg="";return c.isFunction(this.p.onChange)?this.p.onChange.call(this,this.p):false};this.reDraw=function(){c("table.group:first",this).remove();var d=this.createTableForGroup(o.filter,null);c(this).append(d);c.isFunction(this.p.afterRedraw)&&this.p.afterRedraw.call(this,this.p)};this.createTableForGroup=function(d,f){var a=this,b,e=c("<table class='group ui-widget ui-widget-content' style='border:0px none;'><tbody></tbody></table>");
+f===null&&c(e).append("<tr class='error' style='display:none;'><th colspan='5' class='ui-state-error' align='left'></th></tr>");var g=c("<tr></tr>");c(e).append(g);var j=c("<th colspan='5' align='left'></th>");g.append(j);if(this.p.ruleButtons===true){var h=c("<select class='opsel'></select>");j.append(h);g="";var l;for(b=0;b<o.groupOps.length;b++){l=d.groupOp===a.p.groupOps[b]?" selected='selected'":"";g+="<option value='"+a.p.groupOps[b]+"'"+l+">"+a.p.groupOps[b]+"</option>"}h.append(g).bind("change",
+function(){d.groupOp=c(h).val();a.onchange()})}g="<span></span>";if(this.p.groupButton){g=c("<input type='button' value='+ {}' title='Add subgroup' class='add-group'/>");g.bind("click",function(){if(d.groups===undefined)d.groups=[];d.groups.push({groupOp:o.groupOps[0],rules:[],groups:[]});a.reDraw();a.onchange();return false})}j.append(g);if(this.p.ruleButtons===true){g=c("<input type='button' value='+' title='Add rule' class='add-rule ui-add'/>");var m;g.bind("click",function(){if(d.rules===undefined)d.rules=
+[];for(b=0;b<a.p.columns.length;b++){var n=typeof a.p.columns[b].search==="undefined"?true:a.p.columns[b].search,s=a.p.columns[b].hidden===true;if(a.p.columns[b].searchoptions.searchhidden===true&&n||n&&!s){m=a.p.columns[b];break}}d.rules.push({field:m.name,op:(m.searchoptions.sopt?m.searchoptions.sopt:a.p.sopt?a.p.sopt:m.searchtype==="string"?a.p.stropts:a.p.numopts)[0],data:""});a.reDraw();return false});j.append(g)}if(f!==null){g=c("<input type='button' value='-' title='Delete group' class='delete-group'/>");
+j.append(g);g.bind("click",function(){for(b=0;b<f.groups.length;b++)if(f.groups[b]===d){f.groups.splice(b,1);break}a.reDraw();a.onchange();return false})}if(d.groups!==undefined)for(b=0;b<d.groups.length;b++){j=c("<tr></tr>");e.append(j);g=c("<td class='first'></td>");j.append(g);g=c("<td colspan='4'></td>");g.append(this.createTableForGroup(d.groups[b],d));j.append(g)}if(d.groupOp===undefined)d.groupOp=a.p.groupOps[0];if(d.rules!==undefined)for(b=0;b<d.rules.length;b++)e.append(this.createTableRowForRule(d.rules[b],
+d));return e};this.createTableRowForRule=function(d,f){var a=this,b=c("<tr></tr>"),e,g,j,h,l="",m;b.append("<td class='first'></td>");var n=c("<td class='columns'></td>");b.append(n);var s=c("<select></select>"),p,t=[];n.append(s);s.bind("change",function(){d.field=c(s).val();j=c(this).parents("tr:first");for(e=0;e<a.p.columns.length;e++)if(a.p.columns[e].name===d.field){h=a.p.columns[e];break}if(h){h.searchoptions.id=c.jgrid.randId();if(y&&h.inputtype==="text")if(!h.searchoptions.size)h.searchoptions.size=
+10;var r=c.jgrid.createEl(h.inputtype,h.searchoptions,"",true,a.p.ajaxSelectOptions,true);c(r).addClass("input-elm");g=h.searchoptions.sopt?h.searchoptions.sopt:a.p.sopt?a.p.sopt:h.searchtype==="string"?a.p.stropts:a.p.numopts;var A="",v="";t=[];c.each(a.p.ops,function(){t.push(this.name)});for(e=0;e<g.length;e++){p=c.inArray(g[e],t);if(p!==-1){v="";if(e===0){d.op=a.p.ops[p].name;v=" selected='selected'"}A+="<option value='"+a.p.ops[p].name+"'"+v+">"+a.p.ops[p].description+"</option>"}}c(".selectopts",
+j).empty().append(A);c(".data",j).empty().append(r);c(".input-elm",j).bind("change",function(){d.data=c(this).val();a.onchange()});setTimeout(function(){d.data=c(r).val();a.onchange()},0)}});for(e=n=0;e<a.p.columns.length;e++){m=typeof a.p.columns[e].search==="undefined"?true:a.p.columns[e].search;var C=a.p.columns[e].hidden===true;if(a.p.columns[e].searchoptions.searchhidden===true&&m||m&&!C){m="";if(d.field===a.p.columns[e].name){m=" selected='selected'";n=e}l+="<option value='"+a.p.columns[e].name+
+"'"+m+">"+a.p.columns[e].label+"</option>"}}s.append(l);l=c("<td class='operators'></td>");b.append(l);h=o.columns[n];h.searchoptions.id=c.jgrid.randId();if(y&&h.inputtype==="text")if(!h.searchoptions.size)h.searchoptions.size=10;n=c.jgrid.createEl(h.inputtype,h.searchoptions,d.data,true,a.p.ajaxSelectOptions,true);var u=c("<select class='selectopts'></select>");l.append(u);u.bind("change",function(){d.op=c(u).val();j=c(this).parents("tr:first");var r=c(".input-elm",j)[0];if(d.op==="nu"||d.op==="nn"){d.data=
+"";r.value="";r.setAttribute("readonly","true");r.setAttribute("disabled","true")}else{r.removeAttribute("readonly");r.removeAttribute("disabled")}a.onchange()});g=h.searchoptions.sopt?h.searchoptions.sopt:a.p.sopt?a.p.sopt:h.searchtype==="string"?o.stropts:a.p.numopts;l="";c.each(a.p.ops,function(){t.push(this.name)});for(e=0;e<g.length;e++){p=c.inArray(g[e],t);if(p!==-1){m=d.op===a.p.ops[p].name?" selected='selected'":"";l+="<option value='"+a.p.ops[p].name+"'"+m+">"+a.p.ops[p].description+"</option>"}}u.append(l);
+l=c("<td class='data'></td>");b.append(l);l.append(n);c(n).addClass("input-elm").bind("change",function(){d.data=c(this).val();a.onchange()});l=c("<td></td>");b.append(l);if(this.p.ruleButtons===true){n=c("<input type='button' value='-' title='Delete rule' class='delete-rule ui-del'/>");l.append(n);n.bind("click",function(){for(e=0;e<f.rules.length;e++)if(f.rules[e]===d){f.rules.splice(e,1);break}a.reDraw();a.onchange();return false})}return b};this.getStringForGroup=function(d){var f="(",a;if(d.groups!==
+undefined)for(a=0;a<d.groups.length;a++){if(f.length>1)f+=" "+d.groupOp+" ";try{f+=this.getStringForGroup(d.groups[a])}catch(b){alert(b)}}if(d.rules!==undefined)try{for(a=0;a<d.rules.length;a++){if(f.length>1)f+=" "+d.groupOp+" ";f+=this.getStringForRule(d.rules[a])}}catch(e){alert(e)}f+=")";return f==="()"?"":f};this.getStringForRule=function(d){var f="",a="",b,e;for(b=0;b<this.p.ops.length;b++)if(this.p.ops[b].name===d.op){f=this.p.ops[b].operator;a=this.p.ops[b].name;break}for(b=0;b<this.p.columns.length;b++)if(this.p.columns[b].name===
+d.field){e=this.p.columns[b];break}b=d.data;if(a==="bw"||a==="bn")b+="%";if(a==="ew"||a==="en")b="%"+b;if(a==="cn"||a==="nc")b="%"+b+"%";if(a==="in"||a==="ni")b=" ("+b+")";o.errorcheck&&z(d.data,e);return c.inArray(e.searchtype,["int","integer","float","number","currency"])!==-1||a==="nn"||a==="nu"?d.field+" "+f+" "+b:d.field+" "+f+' "'+b+'"'};this.resetFilter=function(){this.p.filter=c.extend(true,{},this.p.initFilter);this.reDraw();this.onchange()};this.hideError=function(){c("th.ui-state-error",
+this).html("");c("tr.error",this).hide()};this.showError=function(){c("th.ui-state-error",this).html(this.p.errmsg);c("tr.error",this).show()};this.toUserFriendlyString=function(){return this.getStringForGroup(o.filter)};this.toString=function(){function d(a){var b="(",e;if(a.groups!==undefined)for(e=0;e<a.groups.length;e++){if(b.length>1)b+=a.groupOp==="OR"?" || ":" && ";b+=d(a.groups[e])}if(a.rules!==undefined)for(e=0;e<a.rules.length;e++){if(b.length>1)b+=a.groupOp==="OR"?" || ":" && ";var g=a.rules[e];
+if(f.p.errorcheck){var j=void 0,h=void 0;for(j=0;j<f.p.columns.length;j++)if(f.p.columns[j].name===g.field){h=f.p.columns[j];break}h&&z(g.data,h)}b+=g.op+"(item."+g.field+",'"+g.data+"')"}b+=")";return b==="()"?"":b}var f=this;return d(this.p.filter)};this.reDraw();if(this.p.showQuery)this.onchange();this.filter=true}}})};c.extend(c.fn.jqFilter,{toSQLString:function(){var k="";this.each(function(){k=this.toUserFriendlyString()});return k},filterData:function(){var k;this.each(function(){k=this.p.filter});
+return k},getParameter:function(k){if(k!==undefined)if(this.p.hasOwnProperty(k))return this.p[k];return this.p},resetFilter:function(){return this.each(function(){this.resetFilter()})},addFilter:function(k){if(typeof k==="string")k=jQuery.jgrid.parse(k);this.each(function(){this.p.filter=k;this.reDraw();this.onchange()})}})})(jQuery);
+(function(a){a.jgrid.extend({editRow:function(f,x,m,r,t,y,u,l,s){var g={keys:x||false,oneditfunc:m||null,successfunc:r||null,url:t||null,extraparam:y||{},aftersavefunc:u||null,errorfunc:l||null,afterrestorefunc:s||null,restoreAfterErorr:true},o=a.makeArray(arguments).slice(1),b;b=o[0]&&typeof o[0]=="object"&&!a.isFunction(o[0])?a.extend(g,o[0]):g;return this.each(function(){var d=this,c,j,v=0,q=null,p={},k,e;if(d.grid){k=a(d).jqGrid("getInd",f,true);if(k!==false)if((a(k).attr("editable")||"0")=="0"&&
+!a(k).hasClass("not-editable-row")){e=d.p.colModel;a("td",k).each(function(h){c=e[h].name;var A=d.p.treeGrid===true&&c==d.p.ExpandColumn;if(A)j=a("span:first",this).html();else try{j=a.unformat(this,{rowId:f,colModel:e[h]},h)}catch(n){j=e[h].edittype&&e[h].edittype=="textarea"?a(this).text():a(this).html()}if(c!="cb"&&c!="subgrid"&&c!="rn"){if(d.p.autoencode)j=a.jgrid.htmlDecode(j);p[c]=j;if(e[h].editable===true){if(q===null)q=h;A?a("span:first",this).html(""):a(this).html("");var i=a.extend({},e[h].editoptions||
+{},{id:f+"_"+c,name:c});if(!e[h].edittype)e[h].edittype="text";if(j=="&nbsp;"||j=="&#160;"||j.length==1&&j.charCodeAt(0)==160)j="";i=a.jgrid.createEl(e[h].edittype,i,j,true,a.extend({},a.jgrid.ajaxOptions,d.p.ajaxSelectOptions||{}));a(i).addClass("editable");A?a("span:first",this).append(i):a(this).append(i);e[h].edittype=="select"&&e[h].editoptions.multiple===true&&a.browser.msie&&a(i).width(a(i).width());v++}}});if(v>0){p.id=f;d.p.savedRow.push(p);a(k).attr("editable","1");a("td:eq("+q+") input",
+k).focus();b.keys===true&&a(k).bind("keydown",function(h){h.keyCode===27&&a(d).jqGrid("restoreRow",f,s);if(h.keyCode===13){if(h.target.tagName=="TEXTAREA")return true;a(d).jqGrid("saveRow",f,b);return false}h.stopPropagation()});a.isFunction(b.oneditfunc)&&b.oneditfunc.call(d,f)}}}})},saveRow:function(f,x,m,r,t,y,u){var l={successfunc:x||null,url:m||null,extraparam:r||{},aftersavefunc:t||null,errorfunc:y||null,afterrestorefunc:u||null,restoreAfterErorr:true},s=a.makeArray(arguments).slice(1),g;g=
+s[0]&&typeof s[0]=="object"&&!a.isFunction(s[0])?a.extend(l,s[0]):l;var o=false,b=this[0],d,c={},j={},v={},q,p,k;if(!b.grid)return o;k=a(b).jqGrid("getInd",f,true);if(k===false)return o;l=a(k).attr("editable");g.url=g.url?g.url:b.p.editurl;if(l==="1"){var e;a("td",k).each(function(n){e=b.p.colModel[n];d=e.name;if(d!="cb"&&d!="subgrid"&&e.editable===true&&d!="rn"&&!a(this).hasClass("not-editable-cell")){switch(e.edittype){case "checkbox":var i=["Yes","No"];if(e.editoptions)i=e.editoptions.value.split(":");
+c[d]=a("input",this).attr("checked")?i[0]:i[1];break;case "text":case "password":case "textarea":case "button":c[d]=a("input, textarea",this).val();break;case "select":if(e.editoptions.multiple){i=a("select",this);var w=[];c[d]=a(i).val();c[d]=c[d]?c[d].join(","):"";a("select > option:selected",this).each(function(B,C){w[B]=a(C).text()});j[d]=w.join(",")}else{c[d]=a("select>option:selected",this).val();j[d]=a("select>option:selected",this).text()}if(e.formatter&&e.formatter=="select")j={};break;case "custom":try{if(e.editoptions&&
+a.isFunction(e.editoptions.custom_value)){c[d]=e.editoptions.custom_value.call(b,a(".customelement",this),"get");if(c[d]===undefined)throw"e2";}else throw"e1";}catch(z){z=="e1"&&a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose);z=="e2"?a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose):a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,z.message,jQuery.jgrid.edit.bClose)}}p=
+a.jgrid.checkValues(c[d],n,b);if(p[0]===false){p[1]=c[d]+" "+p[1];return false}if(b.p.autoencode)c[d]=a.jgrid.htmlEncode(c[d]);if(g.url!=="clientArray"&&e.editoptions&&e.editoptions.NullIfEmpty===true)if(c[d]=="")v[d]="null"}});if(p[0]===false){try{var h=a.jgrid.findPos(a("#"+a.jgrid.jqID(f),b.grid.bDiv)[0]);a.jgrid.info_dialog(a.jgrid.errors.errcap,p[1],a.jgrid.edit.bClose,{left:h[0],top:h[1]})}catch(A){alert(p[1])}return o}if(c){l=b.p.prmNames;s=l.oper;h=l.id;c[s]=l.editoper;c[h]=f;if(typeof b.p.inlineData==
+"undefined")b.p.inlineData={};c=a.extend({},c,b.p.inlineData,g.extraparam)}if(g.url=="clientArray"){c=a.extend({},c,j);b.p.autoencode&&a.each(c,function(n,i){c[n]=a.jgrid.htmlDecode(i)});h=a(b).jqGrid("setRowData",f,c);a(k).attr("editable","0");for(l=0;l<b.p.savedRow.length;l++)if(b.p.savedRow[l].id==f){q=l;break}q>=0&&b.p.savedRow.splice(q,1);a.isFunction(g.aftersavefunc)&&g.aftersavefunc.call(b,f,h);o=true;a(k).unbind("keydown")}else{a("#lui_"+b.p.id).show();v=a.extend({},c,v);a.ajax(a.extend({url:g.url,
+data:a.isFunction(b.p.serializeRowData)?b.p.serializeRowData.call(b,v):v,type:"POST",async:false,complete:function(n,i){a("#lui_"+b.p.id).hide();if(i==="success")if((a.isFunction(g.successfunc)?g.successfunc.call(b,n):true)===true){b.p.autoencode&&a.each(c,function(z,B){c[z]=a.jgrid.htmlDecode(B)});c=a.extend({},c,j);a(b).jqGrid("setRowData",f,c);a(k).attr("editable","0");for(var w=0;w<b.p.savedRow.length;w++)if(b.p.savedRow[w].id==f){q=w;break}q>=0&&b.p.savedRow.splice(q,1);a.isFunction(g.aftersavefunc)&&
+g.aftersavefunc.call(b,f,n);o=true;a(k).unbind("keydown")}else{a.isFunction(g.errorfunc)&&g.errorfunc.call(b,f,n,i);g.restoreAfterError===true&&a(b).jqGrid("restoreRow",f,g.afterrestorefunc)}},error:function(n,i){a("#lui_"+b.p.id).hide();if(a.isFunction(g.errorfunc))g.errorfunc.call(b,f,n,i);else try{jQuery.jgrid.info_dialog(jQuery.jgrid.errors.errcap,'<div class="ui-state-error">'+n.responseText+"</div>",jQuery.jgrid.edit.bClose,{buttonalign:"right"})}catch(w){alert(n.responseText)}g.restoreAfterError===
+true&&a(b).jqGrid("restoreRow",f,g.afterrestorefunc)}},a.jgrid.ajaxOptions,b.p.ajaxRowOptions||{}))}}return o},restoreRow:function(f,x){return this.each(function(){var m=this,r,t,y={};if(m.grid){t=a(m).jqGrid("getInd",f,true);if(t!==false){for(var u=0;u<m.p.savedRow.length;u++)if(m.p.savedRow[u].id==f){r=u;break}if(r>=0){if(a.isFunction(a.fn.datepicker))try{a("input.hasDatepicker","#"+a.jgrid.jqID(t.id)).datepicker("hide")}catch(l){}a.each(m.p.colModel,function(){if(this.editable===true&&this.name in
+m.p.savedRow[r]&&!a(this).hasClass("not-editable-cell"))y[this.name]=m.p.savedRow[r][this.name]});a(m).jqGrid("setRowData",f,y);a(t).attr("editable","0").unbind("keydown");m.p.savedRow.splice(r,1)}a.isFunction(x)&&x.call(m,f)}}})}})})(jQuery);
+(function(b){b.jgrid.extend({editCell:function(d,f,a){return this.each(function(){var c=this,h,e,g,i;if(!(!c.grid||c.p.cellEdit!==true)){f=parseInt(f,10);c.p.selrow=c.rows[d].id;c.p.knv||b(c).jqGrid("GridNav");if(c.p.savedRow.length>0){if(a===true)if(d==c.p.iRow&&f==c.p.iCol)return;b(c).jqGrid("saveCell",c.p.savedRow[0].id,c.p.savedRow[0].ic)}else window.setTimeout(function(){b("#"+c.p.knv).attr("tabindex","-1").focus()},0);i=c.p.colModel[f];h=i.name;if(!(h=="subgrid"||h=="cb"||h=="rn")){g=b("td:eq("+
+f+")",c.rows[d]);if(i.editable===true&&a===true&&!g.hasClass("not-editable-cell")){if(parseInt(c.p.iCol,10)>=0&&parseInt(c.p.iRow,10)>=0){b("td:eq("+c.p.iCol+")",c.rows[c.p.iRow]).removeClass("edit-cell ui-state-highlight");b(c.rows[c.p.iRow]).removeClass("selected-row ui-state-hover")}b(g).addClass("edit-cell ui-state-highlight");b(c.rows[d]).addClass("selected-row ui-state-hover");try{e=b.unformat(g,{rowId:c.rows[d].id,colModel:i},f)}catch(k){e=i.edittype&&i.edittype=="textarea"?b(g).text():b(g).html()}if(c.p.autoencode)e=
+b.jgrid.htmlDecode(e);if(!i.edittype)i.edittype="text";c.p.savedRow.push({id:d,ic:f,name:h,v:e});if(e=="&nbsp;"||e=="&#160;"||e.length==1&&e.charCodeAt(0)==160)e="";if(b.isFunction(c.p.formatCell)){var j=c.p.formatCell.call(c,c.rows[d].id,h,e,d,f);if(j!==undefined)e=j}j=b.extend({},i.editoptions||{},{id:d+"_"+h,name:h});var m=b.jgrid.createEl(i.edittype,j,e,true,b.extend({},b.jgrid.ajaxOptions,c.p.ajaxSelectOptions||{}));b.isFunction(c.p.beforeEditCell)&&c.p.beforeEditCell.call(c,c.rows[d].id,h,e,
+d,f);b(g).html("").append(m).attr("tabindex","0");window.setTimeout(function(){b(m).focus()},0);b("input, select, textarea",g).bind("keydown",function(l){if(l.keyCode===27)if(b("input.hasDatepicker",g).length>0)b(".ui-datepicker").is(":hidden")?b(c).jqGrid("restoreCell",d,f):b("input.hasDatepicker",g).datepicker("hide");else b(c).jqGrid("restoreCell",d,f);l.keyCode===13&&b(c).jqGrid("saveCell",d,f);if(l.keyCode==9)if(c.grid.hDiv.loading)return false;else l.shiftKey?b(c).jqGrid("prevCell",d,f):b(c).jqGrid("nextCell",
+d,f);l.stopPropagation()});b.isFunction(c.p.afterEditCell)&&c.p.afterEditCell.call(c,c.rows[d].id,h,e,d,f)}else{if(parseInt(c.p.iCol,10)>=0&&parseInt(c.p.iRow,10)>=0){b("td:eq("+c.p.iCol+")",c.rows[c.p.iRow]).removeClass("edit-cell ui-state-highlight");b(c.rows[c.p.iRow]).removeClass("selected-row ui-state-hover")}g.addClass("edit-cell ui-state-highlight");b(c.rows[d]).addClass("selected-row ui-state-hover");if(b.isFunction(c.p.onSelectCell)){e=g.html().replace(/\&#160\;/ig,"");c.p.onSelectCell.call(c,
+c.rows[d].id,h,e,d,f)}}c.p.iCol=f;c.p.iRow=d}}})},saveCell:function(d,f){return this.each(function(){var a=this,c;if(!(!a.grid||a.p.cellEdit!==true)){c=a.p.savedRow.length>=1?0:null;if(c!==null){var h=b("td:eq("+f+")",a.rows[d]),e,g,i=a.p.colModel[f],k=i.name,j=b.jgrid.jqID(k);switch(i.edittype){case "select":if(i.editoptions.multiple){j=b("#"+d+"_"+j,a.rows[d]);var m=[];if(e=b(j).val())e.join(",");else e="";b("option:selected",j).each(function(o,p){m[o]=b(p).text()});g=m.join(",")}else{e=b("#"+d+
+"_"+j+">option:selected",a.rows[d]).val();g=b("#"+d+"_"+j+">option:selected",a.rows[d]).text()}if(i.formatter)g=e;break;case "checkbox":var l=["Yes","No"];if(i.editoptions)l=i.editoptions.value.split(":");g=e=b("#"+d+"_"+j,a.rows[d]).attr("checked")?l[0]:l[1];break;case "password":case "text":case "textarea":case "button":g=e=b("#"+d+"_"+j,a.rows[d]).val();break;case "custom":try{if(i.editoptions&&b.isFunction(i.editoptions.custom_value)){e=i.editoptions.custom_value.call(a,b(".customelement",h),
+"get");if(e===undefined)throw"e2";else g=e}else throw"e1";}catch(q){q=="e1"&&b.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+b.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose);q=="e2"?b.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+b.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose):b.jgrid.info_dialog(jQuery.jgrid.errors.errcap,q.message,jQuery.jgrid.edit.bClose)}}if(g!==a.p.savedRow[c].v){if(b.isFunction(a.p.beforeSaveCell))if(c=a.p.beforeSaveCell.call(a,
+a.rows[d].id,k,e,d,f))g=e=c;var r=b.jgrid.checkValues(e,f,a);if(r[0]===true){c={};if(b.isFunction(a.p.beforeSubmitCell))(c=a.p.beforeSubmitCell.call(a,a.rows[d].id,k,e,d,f))||(c={});b("input.hasDatepicker",h).length>0&&b("input.hasDatepicker",h).datepicker("hide");if(a.p.cellsubmit=="remote")if(a.p.cellurl){var n={};if(a.p.autoencode)e=b.jgrid.htmlEncode(e);n[k]=e;l=a.p.prmNames;i=l.id;j=l.oper;n[i]=a.rows[d].id;n[j]=l.editoper;n=b.extend(c,n);b("#lui_"+a.p.id).show();a.grid.hDiv.loading=true;b.ajax(b.extend({url:a.p.cellurl,
+data:b.isFunction(a.p.serializeCellData)?a.p.serializeCellData.call(a,n):n,type:"POST",complete:function(o,p){b("#lui_"+a.p.id).hide();a.grid.hDiv.loading=false;if(p=="success")if(b.isFunction(a.p.afterSubmitCell)){var s=a.p.afterSubmitCell.call(a,o,n.id,k,e,d,f);if(s[0]===true){b(h).empty();b(a).jqGrid("setCell",a.rows[d].id,f,g,false,false,true);b(h).addClass("dirty-cell");b(a.rows[d]).addClass("edited");b.isFunction(a.p.afterSaveCell)&&a.p.afterSaveCell.call(a,a.rows[d].id,k,e,d,f);a.p.savedRow.splice(0,
+1)}else{b.jgrid.info_dialog(b.jgrid.errors.errcap,s[1],b.jgrid.edit.bClose);b(a).jqGrid("restoreCell",d,f)}}else{b(h).empty();b(a).jqGrid("setCell",a.rows[d].id,f,g,false,false,true);b(h).addClass("dirty-cell");b(a.rows[d]).addClass("edited");b.isFunction(a.p.afterSaveCell)&&a.p.afterSaveCell.call(a,a.rows[d].id,k,e,d,f);a.p.savedRow.splice(0,1)}},error:function(o,p){b("#lui_"+a.p.id).hide();a.grid.hDiv.loading=false;b.isFunction(a.p.errorCell)?a.p.errorCell.call(a,o,p):b.jgrid.info_dialog(b.jgrid.errors.errcap,
+o.status+" : "+o.statusText+"<br/>"+p,b.jgrid.edit.bClose);b(a).jqGrid("restoreCell",d,f)}},b.jgrid.ajaxOptions,a.p.ajaxCellOptions||{}))}else try{b.jgrid.info_dialog(b.jgrid.errors.errcap,b.jgrid.errors.nourl,b.jgrid.edit.bClose);b(a).jqGrid("restoreCell",d,f)}catch(t){}if(a.p.cellsubmit=="clientArray"){b(h).empty();b(a).jqGrid("setCell",a.rows[d].id,f,g,false,false,true);b(h).addClass("dirty-cell");b(a.rows[d]).addClass("edited");b.isFunction(a.p.afterSaveCell)&&a.p.afterSaveCell.call(a,a.rows[d].id,
+k,e,d,f);a.p.savedRow.splice(0,1)}}else try{window.setTimeout(function(){b.jgrid.info_dialog(b.jgrid.errors.errcap,e+" "+r[1],b.jgrid.edit.bClose)},100);b(a).jqGrid("restoreCell",d,f)}catch(u){}}else b(a).jqGrid("restoreCell",d,f)}b.browser.opera?b("#"+a.p.knv).attr("tabindex","-1").focus():window.setTimeout(function(){b("#"+a.p.knv).attr("tabindex","-1").focus()},0)}})},restoreCell:function(d,f){return this.each(function(){var a=this,c;if(!(!a.grid||a.p.cellEdit!==true)){c=a.p.savedRow.length>=1?
+0:null;if(c!==null){var h=b("td:eq("+f+")",a.rows[d]);if(b.isFunction(b.fn.datepicker))try{b("input.hasDatepicker",h).datepicker("hide")}catch(e){}b(h).empty().attr("tabindex","-1");b(a).jqGrid("setCell",a.rows[d].id,f,a.p.savedRow[c].v,false,false,true);b.isFunction(a.p.afterRestoreCell)&&a.p.afterRestoreCell.call(a,a.rows[d].id,a.p.savedRow[c].v,d,f);a.p.savedRow.splice(0,1)}window.setTimeout(function(){b("#"+a.p.knv).attr("tabindex","-1").focus()},0)}})},nextCell:function(d,f){return this.each(function(){var a=
+false;if(!(!this.grid||this.p.cellEdit!==true)){for(var c=f+1;c<this.p.colModel.length;c++)if(this.p.colModel[c].editable===true){a=c;break}if(a!==false)b(this).jqGrid("editCell",d,a,true);else this.p.savedRow.length>0&&b(this).jqGrid("saveCell",d,f)}})},prevCell:function(d,f){return this.each(function(){var a=false;if(!(!this.grid||this.p.cellEdit!==true)){for(var c=f-1;c>=0;c--)if(this.p.colModel[c].editable===true){a=c;break}if(a!==false)b(this).jqGrid("editCell",d,a,true);else this.p.savedRow.length>
+0&&b(this).jqGrid("saveCell",d,f)}})},GridNav:function(){return this.each(function(){function d(g,i,k){if(k.substr(0,1)=="v"){var j=b(a.grid.bDiv)[0].clientHeight,m=b(a.grid.bDiv)[0].scrollTop,l=a.rows[g].offsetTop+a.rows[g].clientHeight,q=a.rows[g].offsetTop;if(k=="vd")if(l>=j)b(a.grid.bDiv)[0].scrollTop=b(a.grid.bDiv)[0].scrollTop+a.rows[g].clientHeight;if(k=="vu")if(q<m)b(a.grid.bDiv)[0].scrollTop=b(a.grid.bDiv)[0].scrollTop-a.rows[g].clientHeight}if(k=="h"){k=b(a.grid.bDiv)[0].clientWidth;j=b(a.grid.bDiv)[0].scrollLeft;
+m=a.rows[g].cells[i].offsetLeft;if(a.rows[g].cells[i].offsetLeft+a.rows[g].cells[i].clientWidth>=k+parseInt(j,10))b(a.grid.bDiv)[0].scrollLeft=b(a.grid.bDiv)[0].scrollLeft+a.rows[g].cells[i].clientWidth;else if(m<j)b(a.grid.bDiv)[0].scrollLeft=b(a.grid.bDiv)[0].scrollLeft-a.rows[g].cells[i].clientWidth}}function f(g,i){var k,j;if(i=="lft"){k=g+1;for(j=g;j>=0;j--)if(a.p.colModel[j].hidden!==true){k=j;break}}if(i=="rgt"){k=g-1;for(j=g;j<a.p.colModel.length;j++)if(a.p.colModel[j].hidden!==true){k=j;
+break}}return k}var a=this;if(!(!a.grid||a.p.cellEdit!==true)){a.p.knv=a.p.id+"_kn";var c=b("<span style='width:0px;height:0px;background-color:black;' tabindex='0'><span tabindex='-1' style='width:0px;height:0px;background-color:grey' id='"+a.p.knv+"'></span></span>"),h,e;b(c).insertBefore(a.grid.cDiv);b("#"+a.p.knv).focus().keydown(function(g){e=g.keyCode;if(a.p.direction=="rtl")if(e==37)e=39;else if(e==39)e=37;switch(e){case 38:if(a.p.iRow-1>0){d(a.p.iRow-1,a.p.iCol,"vu");b(a).jqGrid("editCell",
+a.p.iRow-1,a.p.iCol,false)}break;case 40:if(a.p.iRow+1<=a.rows.length-1){d(a.p.iRow+1,a.p.iCol,"vd");b(a).jqGrid("editCell",a.p.iRow+1,a.p.iCol,false)}break;case 37:if(a.p.iCol-1>=0){h=f(a.p.iCol-1,"lft");d(a.p.iRow,h,"h");b(a).jqGrid("editCell",a.p.iRow,h,false)}break;case 39:if(a.p.iCol+1<=a.p.colModel.length-1){h=f(a.p.iCol+1,"rgt");d(a.p.iRow,h,"h");b(a).jqGrid("editCell",a.p.iRow,h,false)}break;case 13:parseInt(a.p.iCol,10)>=0&&parseInt(a.p.iRow,10)>=0&&b(a).jqGrid("editCell",a.p.iRow,a.p.iCol,
+true)}return false})}})},getChangedCells:function(d){var f=[];d||(d="all");this.each(function(){var a=this,c;!a.grid||a.p.cellEdit!==true||b(a.rows).each(function(h){var e={};if(b(this).hasClass("edited")){b("td",this).each(function(g){c=a.p.colModel[g].name;if(c!=="cb"&&c!=="subgrid")if(d=="dirty"){if(b(this).hasClass("dirty-cell"))try{e[c]=b.unformat(this,{rowId:a.rows[h].id,colModel:a.p.colModel[g]},g)}catch(i){e[c]=b.jgrid.htmlDecode(b(this).html())}}else try{e[c]=b.unformat(this,{rowId:a.rows[h].id,
+colModel:a.p.colModel[g]},g)}catch(k){e[c]=b.jgrid.htmlDecode(b(this).html())}});e.id=this.id;f.push(e)}})});return f}})})(jQuery);
+(function(b){b.fn.jqm=function(a){var f={overlay:50,closeoverlay:true,overlayClass:"jqmOverlay",closeClass:"jqmClose",trigger:".jqModal",ajax:e,ajaxText:"",target:e,modal:e,toTop:e,onShow:e,onHide:e,onLoad:e};return this.each(function(){if(this._jqm)return j[this._jqm].c=b.extend({},j[this._jqm].c,a);l++;this._jqm=l;j[l]={c:b.extend(f,b.jqm.params,a),a:e,w:b(this).addClass("jqmID"+l),s:l};f.trigger&&b(this).jqmAddTrigger(f.trigger)})};b.fn.jqmAddClose=function(a){return o(this,a,"jqmHide")};b.fn.jqmAddTrigger=
+function(a){return o(this,a,"jqmShow")};b.fn.jqmShow=function(a){return this.each(function(){b.jqm.open(this._jqm,a)})};b.fn.jqmHide=function(a){return this.each(function(){b.jqm.close(this._jqm,a)})};b.jqm={hash:{},open:function(a,f){var c=j[a],d=c.c,i="."+d.closeClass,g=parseInt(c.w.css("z-index"));g=g>0?g:3E3;var h=b("<div></div>").css({height:"100%",width:"100%",position:"fixed",left:0,top:0,"z-index":g-1,opacity:d.overlay/100});if(c.a)return e;c.t=f;c.a=true;c.w.css("z-index",g);if(d.modal){k[0]||
+setTimeout(function(){p("bind")},1);k.push(a)}else if(d.overlay>0)d.closeoverlay&&c.w.jqmAddClose(h);else h=e;c.o=h?h.addClass(d.overlayClass).prependTo("body"):e;if(q){b("html,body").css({height:"100%",width:"100%"});if(h){h=h.css({position:"absolute"})[0];for(var m in{Top:1,Left:1})h.style.setExpression(m.toLowerCase(),"(_=(document.documentElement.scroll"+m+" || document.body.scroll"+m+"))+'px'")}}if(d.ajax){g=d.target||c.w;h=d.ajax;g=typeof g=="string"?b(g,c.w):b(g);h=h.substr(0,1)=="@"?b(f).attr(h.substring(1)):
+h;g.html(d.ajaxText).load(h,function(){d.onLoad&&d.onLoad.call(this,c);i&&c.w.jqmAddClose(b(i,c.w));r(c)})}else i&&c.w.jqmAddClose(b(i,c.w));d.toTop&&c.o&&c.w.before('<span id="jqmP'+c.w[0]._jqm+'"></span>').insertAfter(c.o);d.onShow?d.onShow(c):c.w.show();r(c);return e},close:function(a){a=j[a];if(!a.a)return e;a.a=e;if(k[0]){k.pop();k[0]||p("unbind")}a.c.toTop&&a.o&&b("#jqmP"+a.w[0]._jqm).after(a.w).remove();if(a.c.onHide)a.c.onHide(a);else{a.w.hide();a.o&&a.o.remove()}return e},params:{}};var l=
+0,j=b.jqm.hash,k=[],q=b.browser.msie&&b.browser.version=="6.0",e=false,r=function(a){var f=b('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0});if(q)if(a.o)a.o.html('<p style="width:100%;height:100%"/>').prepend(f);else b("iframe.jqm",a.w)[0]||a.w.prepend(f);s(a)},s=function(a){try{b(":input:visible",a.w)[0].focus()}catch(f){}},p=function(a){b(document)[a]("keypress",n)[a]("keydown",n)[a]("mousedown",n)},n=function(a){var f=j[k[k.length-1]];(a=!b(a.target).parents(".jqmID"+
+f.s)[0])&&s(f);return!a},o=function(a,f,c){return a.each(function(){var d=this._jqm;b(f).each(function(){if(!this[c]){this[c]=[];b(this).click(function(){for(var i in{jqmShow:1,jqmHide:1})for(var g in this[i])if(j[this[i][g]])j[this[i][g]].w[i](this);return e})}this[c].push(d)})})}})(jQuery);
+(function(b){b.fn.jqDrag=function(a){return l(this,a,"d")};b.fn.jqResize=function(a,e){return l(this,a,"r",e)};b.jqDnR={dnr:{},e:0,drag:function(a){if(c.k=="d")d.css({left:c.X+a.pageX-c.pX,top:c.Y+a.pageY-c.pY});else{d.css({width:Math.max(a.pageX-c.pX+c.W,0),height:Math.max(a.pageY-c.pY+c.H,0)});M1&&f.css({width:Math.max(a.pageX-M1.pX+M1.W,0),height:Math.max(a.pageY-M1.pY+M1.H,0)})}return false},stop:function(){b(document).unbind("mousemove",i.drag).unbind("mouseup",i.stop)}};var i=b.jqDnR,c=i.dnr,
+d=i.e,f,l=function(a,e,n,m){return a.each(function(){e=e?b(e,a):a;e.bind("mousedown",{e:a,k:n},function(g){var j=g.data,h={};d=j.e;f=m?b(m):false;if(d.css("position")!="relative")try{d.position(h)}catch(o){}c={X:h.left||k("left")||0,Y:h.top||k("top")||0,W:k("width")||d[0].scrollWidth||0,H:k("height")||d[0].scrollHeight||0,pX:g.pageX,pY:g.pageY,k:j.k};M1=f&&j.k!="d"?{X:h.left||f1("left")||0,Y:h.top||f1("top")||0,W:f[0].offsetWidth||f1("width")||0,H:f[0].offsetHeight||f1("height")||0,pX:g.pageX,pY:g.pageY,
+k:j.k}:false;if(b("input.hasDatepicker",d[0])[0])try{b("input.hasDatepicker",d[0]).datepicker("hide")}catch(p){}b(document).mousemove(b.jqDnR.drag).mouseup(b.jqDnR.stop);return false})})},k=function(a){return parseInt(d.css(a))||false};f1=function(a){return parseInt(f.css(a))||false}})(jQuery);
+(function(b){b.jgrid.extend({setSubGrid:function(){return this.each(function(){var f;this.p.subGridOptions=b.extend({plusicon:"ui-icon-plus",minusicon:"ui-icon-minus",openicon:"ui-icon-carat-1-sw",expandOnLoad:false,delayOnLoad:50,selectOnExpand:false,reloadOnExpand:true},this.p.subGridOptions||{});this.p.colNames.unshift("");this.p.colModel.unshift({name:"subgrid",width:b.browser.safari?this.p.subGridWidth+this.p.cellLayout:this.p.subGridWidth,sortable:false,resizable:false,hidedlg:true,search:false,
+fixed:true});f=this.p.subGridModel;if(f[0]){f[0].align=b.extend([],f[0].align||[]);for(var d=0;d<f[0].name.length;d++)f[0].align[d]=f[0].align[d]||"left"}})},addSubGridCell:function(f,d){var a="",n,s;this.each(function(){a=this.formatCol(f,d);s=this.p.id;n=this.p.subGridOptions.plusicon});return'<td role="grid" aria-describedby="'+s+'_subgrid" class="ui-sgcollapsed sgcollapsed" '+a+"><a href='javascript:void(0);'><span class='ui-icon "+n+"'></span></a></td>"},addSubGrid:function(f,d){return this.each(function(){var a=
+this;if(a.grid){var n=function(g,j,e){j=b("<td align='"+a.p.subGridModel[0].align[e]+"'></td>").html(j);b(g).append(j)},s=function(g,j){var e,c,h,k=b("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),i=b("<tr></tr>");for(c=0;c<a.p.subGridModel[0].name.length;c++){e=b("<th class='ui-state-default ui-th-subgrid ui-th-column ui-th-"+a.p.direction+"'></th>");b(e).html(a.p.subGridModel[0].name[c]);b(e).width(a.p.subGridModel[0].width[c]);b(i).append(e)}b(k).append(i);if(g){h=
+a.p.xmlReader.subgrid;b(h.root+" "+h.row,g).each(function(){i=b("<tr class='ui-widget-content ui-subtblcell'></tr>");if(h.repeatitems===true)b(h.cell,this).each(function(m){n(i,b(this).text()||"&#160;",m)});else{var o=a.p.subGridModel[0].mapping||a.p.subGridModel[0].name;if(o)for(c=0;c<o.length;c++)n(i,b(o[c],this).text()||"&#160;",c)}b(k).append(i)})}e=b("table:first",a.grid.bDiv).attr("id")+"_";b("#"+e+j).append(k);a.grid.hDiv.loading=false;b("#load_"+a.p.id).hide();return false},v=function(g,j){var e,
+c,h,k,i,o=b("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),m=b("<tr></tr>");for(c=0;c<a.p.subGridModel[0].name.length;c++){e=b("<th class='ui-state-default ui-th-subgrid ui-th-column ui-th-"+a.p.direction+"'></th>");b(e).html(a.p.subGridModel[0].name[c]);b(e).width(a.p.subGridModel[0].width[c]);b(m).append(e)}b(o).append(m);if(g){k=a.p.jsonReader.subgrid;e=g[k.root];if(typeof e!=="undefined")for(c=0;c<e.length;c++){h=e[c];m=b("<tr class='ui-widget-content ui-subtblcell'></tr>");
+if(k.repeatitems===true){if(k.cell)h=h[k.cell];for(i=0;i<h.length;i++)n(m,h[i]||"&#160;",i)}else{var u=a.p.subGridModel[0].mapping||a.p.subGridModel[0].name;if(u.length)for(i=0;i<u.length;i++)n(m,h[u[i]]||"&#160;",i)}b(o).append(m)}}c=b("table:first",a.grid.bDiv).attr("id")+"_";b("#"+c+j).append(o);a.grid.hDiv.loading=false;b("#load_"+a.p.id).hide();return false},z=function(g){var j,e,c,h;j=b(g).attr("id");e={nd_:(new Date).getTime()};e[a.p.prmNames.subgridid]=j;if(!a.p.subGridModel[0])return false;
+if(a.p.subGridModel[0].params)for(h=0;h<a.p.subGridModel[0].params.length;h++)for(c=0;c<a.p.colModel.length;c++)if(a.p.colModel[c].name==a.p.subGridModel[0].params[h])e[a.p.colModel[c].name]=b("td:eq("+c+")",g).text().replace(/\&#160\;/ig,"");if(!a.grid.hDiv.loading){a.grid.hDiv.loading=true;b("#load_"+a.p.id).show();if(!a.p.subgridtype)a.p.subgridtype=a.p.datatype;if(b.isFunction(a.p.subgridtype))a.p.subgridtype.call(a,e);else a.p.subgridtype=a.p.subgridtype.toLowerCase();switch(a.p.subgridtype){case "xml":case "json":b.ajax(b.extend({type:a.p.mtype,
+url:a.p.subGridUrl,dataType:a.p.subgridtype,data:b.isFunction(a.p.serializeSubGridData)?a.p.serializeSubGridData.call(a,e):e,complete:function(k){a.p.subgridtype=="xml"?s(k.responseXML,j):v(b.jgrid.parse(k.responseText),j)}},b.jgrid.ajaxOptions,a.p.ajaxSubgridOptions||{}))}}return false},l,t,w,x=0,p,q;b.each(a.p.colModel,function(){if(this.hidden===true||this.name=="rn"||this.name=="cb")x++});var y=a.rows.length,r=1;if(d!==undefined&&d>0){r=d;y=d+1}for(;r<y;){b(a.rows[r]).hasClass("jqgrow")&&b(a.rows[r].cells[f]).bind("click",
+function(){var g=b(this).parent("tr")[0];q=g.nextSibling;if(b(this).hasClass("sgcollapsed")){t=a.p.id;l=g.id;if(a.p.subGridOptions.reloadOnExpand===true||a.p.subGridOptions.reloadOnExpand===false&&!b(q).hasClass("ui-subgrid")){w=f>=1?"<td colspan='"+f+"'>&#160;</td>":"";p=true;if(b.isFunction(a.p.subGridBeforeExpand))p=a.p.subGridBeforeExpand.call(a,t+"_"+l,l);if(p===false)return false;b(g).after("<tr role='row' class='ui-subgrid'>"+w+"<td class='ui-widget-content subgrid-cell'><span class='ui-icon "+
+a.p.subGridOptions.openicon+"'></span></td><td colspan='"+parseInt(a.p.colNames.length-1-x,10)+"' class='ui-widget-content subgrid-data'><div id="+t+"_"+l+" class='tablediv'></div></td></tr>");b.isFunction(a.p.subGridRowExpanded)?a.p.subGridRowExpanded.call(a,t+"_"+l,l):z(g)}else b(q).show();b(this).html("<a href='javascript:void(0);'><span class='ui-icon "+a.p.subGridOptions.minusicon+"'></span></a>").removeClass("sgcollapsed").addClass("sgexpanded");a.p.subGridOptions.selectOnExpand&&b(a).jqGrid("setSelection",
+l)}else if(b(this).hasClass("sgexpanded")){p=true;if(b.isFunction(a.p.subGridRowColapsed)){l=g.id;p=a.p.subGridRowColapsed.call(a,t+"_"+l,l)}if(p===false)return false;if(a.p.subGridOptions.reloadOnExpand===true)b(q).remove(".ui-subgrid");else b(q).hasClass("ui-subgrid")&&b(q).hide();b(this).html("<a href='javascript:void(0);'><span class='ui-icon "+a.p.subGridOptions.plusicon+"'></span></a>").removeClass("sgexpanded").addClass("sgcollapsed")}return false});a.p.subGridOptions.expandOnLoad===true&&
+b(a.rows[r].cells[f]).trigger("click");r++}a.subGridXml=function(g,j){s(g,j)};a.subGridJson=function(g,j){v(g,j)}}})},expandSubGridRow:function(f){return this.each(function(){if(this.grid||f)if(this.p.subGrid===true){var d=b(this).jqGrid("getInd",f,true);if(d)(d=b("td.sgcollapsed",d)[0])&&b(d).trigger("click")}})},collapseSubGridRow:function(f){return this.each(function(){if(this.grid||f)if(this.p.subGrid===true){var d=b(this).jqGrid("getInd",f,true);if(d)(d=b("td.sgexpanded",d)[0])&&b(d).trigger("click")}})},
+toggleSubGridRow:function(f){return this.each(function(){if(this.grid||f)if(this.p.subGrid===true){var d=b(this).jqGrid("getInd",f,true);if(d){var a=b("td.sgcollapsed",d)[0];if(a)b(a).trigger("click");else(a=b("td.sgexpanded",d)[0])&&b(a).trigger("click")}}})}})})(jQuery);
+(function(e){e.jgrid.extend({groupingSetup:function(){return this.each(function(){var a=this.p.groupingView;if(a!==null&&(typeof a==="object"||e.isFunction(a)))if(a.groupField.length){if(typeof a.visibiltyOnNextGrouping=="undefined")a.visibiltyOnNextGrouping=[];for(var b=0;b<a.groupField.length;b++){a.groupOrder[b]||(a.groupOrder[b]="asc");a.groupText[b]||(a.groupText[b]="{0}");if(typeof a.groupColumnShow[b]!="boolean")a.groupColumnShow[b]=true;if(typeof a.groupSummary[b]!="boolean")a.groupSummary[b]=
+false;if(a.groupColumnShow[b]===true){a.visibiltyOnNextGrouping[b]=true;e(this).jqGrid("showCol",a.groupField[b])}else{a.visibiltyOnNextGrouping[b]=e("#"+this.p.id+"_"+a.groupField[b]).is(":visible");e(this).jqGrid("hideCol",a.groupField[b])}a.sortitems[b]=[];a.sortnames[b]=[];a.summaryval[b]=[];if(a.groupSummary[b]){a.summary[b]=[];for(var c=this.p.colModel,d=0,g=c.length;d<g;d++)c[d].summaryType&&a.summary[b].push({nm:c[d].name,st:c[d].summaryType,v:""})}}this.p.scroll=false;this.p.rownumbers=false;
+this.p.subGrid=false;this.p.treeGrid=false;this.p.gridview=true}else this.p.grouping=false;else this.p.grouping=false})},groupingPrepare:function(a,b,c,d){this.each(function(){b[0]+="";var g=b[0].toString().split(" ").join(""),h=this.p.groupingView,f=this;if(c.hasOwnProperty(g))c[g].push(a);else{c[g]=[];c[g].push(a);h.sortitems[0].push(g);h.sortnames[0].push(e.trim(b[0].toString()));h.summaryval[0][g]=e.extend(true,[],h.summary[0])}h.groupSummary[0]&&e.each(h.summaryval[0][g],function(){this.v=e.isFunction(this.st)?
+this.st.call(f,this.v,this.nm,d):e(f).jqGrid("groupingCalculations."+this.st,this.v,this.nm,d)})});return c},groupingToggle:function(a){this.each(function(){var b=this.p.groupingView,c=a.lastIndexOf("_"),d=a.substring(0,c+1);c=parseInt(a.substring(c+1),10)+1;var g=b.minusicon,h=b.plusicon,f=e("#"+a);f=f.length?f[0].nextSibling:null;var k=e("#"+a+" span.tree-wrap-"+this.p.direction),l=false;if(k.hasClass(g)){if(b.showSummaryOnHide&&b.groupSummary[0]){if(f)for(;f;){if(e(f).hasClass("jqfoot"))break;
+e(f).hide();f=f.nextSibling}}else if(f)for(;f;){if(e(f).attr("id")==d+String(c))break;e(f).hide();f=f.nextSibling}k.removeClass(g).addClass(h);l=true}else{if(f)for(;f;){if(e(f).attr("id")==d+String(c))break;e(f).show();f=f.nextSibling}k.removeClass(h).addClass(g);l=false}e.isFunction(this.p.onClickGroup)&&this.p.onClickGroup.call(this,a,l)});return false},groupingRender:function(a,b){return this.each(function(){var c=this,d=c.p.groupingView,g="",h="",f,k="",l,r,m;if(!d.groupDataSorted){d.sortitems[0].sort();
+d.sortnames[0].sort();if(d.groupOrder[0].toLowerCase()=="desc"){d.sortitems[0].reverse();d.sortnames[0].reverse()}}k=d.groupCollapse?d.plusicon:d.minusicon;k+=" tree-wrap-"+c.p.direction;for(m=0;m<b;){if(c.p.colModel[m].name==d.groupField[0]){r=m;break}m++}e.each(d.sortitems[0],function(o,n){f=c.p.id+"ghead_"+o;h="<span style='cursor:pointer;' class='ui-icon "+k+"' onclick=\"jQuery('#"+c.p.id+"').jqGrid('groupingToggle','"+f+"');return false;\"></span>";try{l=c.formatter(f,d.sortnames[0][o],r,d.sortitems[0])}catch(v){l=
+d.sortnames[0][o]}g+='<tr id="'+f+'" role="row" class= "ui-widget-content jqgroup ui-row-'+c.p.direction+'"><td colspan="'+b+'">'+h+e.jgrid.format(d.groupText[0],l,a[n].length)+"</td></tr>";for(var i=0;i<a[n].length;i++)g+=a[n][i].join("");if(d.groupSummary[0]){i="";if(d.groupCollapse&&!d.showSummaryOnHide)i=' style="display:none;"';g+="<tr"+i+' role="row" class="ui-widget-content jqfoot ui-row-'+c.p.direction+'">';i=d.summaryval[0][n];for(var p=c.p.colModel,q,s=a[n].length,j=0;j<b;j++){var t="<td "+
+c.formatCol(j,1,"")+">&#160;</td>",u="{0}";e.each(i,function(){if(this.nm==p[j].name){if(p[j].summaryTpl)u=p[j].summaryTpl;if(this.st=="avg")if(this.v&&s>0)this.v/=s;try{q=c.formatter("",this.v,j,this)}catch(w){q=this.v}t="<td "+c.formatCol(j,1,"")+">"+e.jgrid.format(u,q)+"</td>";return false}});g+=t}g+="</tr>"}});e("#"+c.p.id+" tbody:first").append(g);g=null})},groupingGroupBy:function(a,b){return this.each(function(){if(typeof a=="string")a=[a];var c=this.p.groupingView;this.p.grouping=true;for(var d=
+0;d<c.groupField.length;d++)!c.groupColumnShow[d]&&c.visibiltyOnNextGrouping[d]&&e(this).jqGrid("showCol",c.groupField[d]);for(d=0;d<a.length;d++)c.visibiltyOnNextGrouping[d]=e("#"+this.p.id+"_"+a[d]).is(":visible");this.p.groupingView=e.extend(this.p.groupingView,b||{});c.groupField=a;e(this).trigger("reloadGrid")})},groupingRemove:function(a){return this.each(function(){if(typeof a=="undefined")a=true;this.p.grouping=false;if(a===true){for(var b=this.p.groupingView,c=0;c<b.groupField.length;c++)!b.groupColumnShow[c]&&
+b.visibiltyOnNextGrouping[c]&&e(this).jqGrid("showCol",b.groupField);e("tr.jqgroup, tr.jqfoot","#"+this.p.id+" tbody:first").remove();e("tr.jqgrow:hidden","#"+this.p.id+" tbody:first").show()}else e(this).trigger("reloadGrid")})},groupingCalculations:{sum:function(a,b,c){return parseFloat(a||0)+parseFloat(c[b]||0)},min:function(a,b,c){if(a==="")return parseFloat(c[b]||0);return Math.min(parseFloat(a),parseFloat(c[b]||0))},max:function(a,b,c){if(a==="")return parseFloat(c[b]||0);return Math.max(parseFloat(a),
+parseFloat(c[b]||0))},count:function(a,b,c){if(a==="")a=0;return c.hasOwnProperty(b)?a+1:0},avg:function(a,b,c){return parseFloat(a||0)+parseFloat(c[b]||0)}}})})(jQuery);
+(function(d){d.jgrid.extend({setTreeNode:function(a,c){return this.each(function(){var b=this;if(b.grid&&b.p.treeGrid)for(var e=b.p.expColInd,g=b.p.treeReader.expanded_field,h=b.p.treeReader.leaf_field,f=b.p.treeReader.level_field,l=b.p.treeReader.icon_field,i=b.p.treeReader.loaded,j,o,n,k;a<c;){k=b.p.data[b.p._index[b.rows[a].id]];if(b.p.treeGridModel=="nested")if(!k[h]){j=parseInt(k[b.p.treeReader.left_field],10);o=parseInt(k[b.p.treeReader.right_field],10);k[h]=o===j+1?"true":"false";b.rows[a].cells[b.p._treeleafpos].innerHTML=
+k[h]}j=parseInt(k[f],10);if(b.p.tree_root_level===0){n=j+1;o=j}else{n=j;o=j-1}n="<div class='tree-wrap tree-wrap-"+b.p.direction+"' style='width:"+n*18+"px;'>";n+="<div style='"+(b.p.direction=="rtl"?"right:":"left:")+o*18+"px;' class='ui-icon ";if(k[i]!==undefined)k[i]=k[i]=="true"||k[i]===true?true:false;if(k[h]=="true"||k[h]===true){n+=(k[l]!==undefined&&k[l]!==""?k[l]:b.p.treeIcons.leaf)+" tree-leaf treeclick'";k[h]=true;o="leaf"}else{k[h]=false;o=""}k[g]=(k[g]=="true"||k[g]===true?true:false)&&
+k[i];n+=k[g]===false?k[h]===true?"'":b.p.treeIcons.plus+" tree-plus treeclick'":k[h]===true?"'":b.p.treeIcons.minus+" tree-minus treeclick'";n+="></div></div>";d(b.rows[a].cells[e]).wrapInner("<span class='cell-wrapper"+o+"'></span>").prepend(n);if(j!==parseInt(b.p.tree_root_level,10))(k=(k=d(b).jqGrid("getNodeParent",k))&&k.hasOwnProperty(g)?k[g]:true)||d(b.rows[a]).css("display","none");d(b.rows[a].cells[e]).find("div.treeclick").bind("click",function(m){m=d(m.target||m.srcElement,b.rows).closest("tr.jqgrow")[0].id;
+m=b.p._index[m];if(!b.p.data[m][h])if(b.p.data[m][g]){d(b).jqGrid("collapseRow",b.p.data[m]);d(b).jqGrid("collapseNode",b.p.data[m])}else{d(b).jqGrid("expandRow",b.p.data[m]);d(b).jqGrid("expandNode",b.p.data[m])}return false});b.p.ExpandColClick===true&&d(b.rows[a].cells[e]).find("span.cell-wrapper").css("cursor","pointer").bind("click",function(m){m=d(m.target||m.srcElement,b.rows).closest("tr.jqgrow")[0].id;var r=b.p._index[m];if(!b.p.data[r][h])if(b.p.data[r][g]){d(b).jqGrid("collapseRow",b.p.data[r]);
+d(b).jqGrid("collapseNode",b.p.data[r])}else{d(b).jqGrid("expandRow",b.p.data[r]);d(b).jqGrid("expandNode",b.p.data[r])}d(b).jqGrid("setSelection",m);return false});a++}})},setTreeGrid:function(){return this.each(function(){var a=this,c=0,b=false,e,g,h=[];if(a.p.treeGrid){a.p.treedatatype||d.extend(a.p,{treedatatype:a.p.datatype});a.p.subGrid=false;a.p.altRows=false;a.p.pgbuttons=false;a.p.pginput=false;a.p.gridview=true;if(a.p.rowTotal===null)a.p.rowNum=1E4;a.p.multiselect=false;a.p.rowList=[];a.p.expColInd=
+0;a.p.treeIcons=d.extend({plus:"ui-icon-triangle-1-"+(a.p.direction=="rtl"?"w":"e"),minus:"ui-icon-triangle-1-s",leaf:"ui-icon-radio-off"},a.p.treeIcons||{});if(a.p.treeGridModel=="nested")a.p.treeReader=d.extend({level_field:"level",left_field:"lft",right_field:"rgt",leaf_field:"isLeaf",expanded_field:"expanded",loaded:"loaded",icon_field:"icon"},a.p.treeReader);else if(a.p.treeGridModel=="adjacency")a.p.treeReader=d.extend({level_field:"level",parent_id_field:"parent",leaf_field:"isLeaf",expanded_field:"expanded",
+loaded:"loaded",icon_field:"icon"},a.p.treeReader);for(g in a.p.colModel)if(a.p.colModel.hasOwnProperty(g)){e=a.p.colModel[g].name;if(e==a.p.ExpandColumn&&!b){b=true;a.p.expColInd=c}c++;for(var f in a.p.treeReader)a.p.treeReader[f]==e&&h.push(e)}d.each(a.p.treeReader,function(l,i){if(i&&d.inArray(i,h)===-1){if(l==="leaf_field")a.p._treeleafpos=c;c++;a.p.colNames.push(i);a.p.colModel.push({name:i,width:1,hidden:true,sortable:false,resizable:false,hidedlg:true,editable:true,search:false})}})}})},expandRow:function(a){this.each(function(){var c=
+this;if(c.grid&&c.p.treeGrid){var b=d(c).jqGrid("getNodeChildren",a),e=c.p.treeReader.expanded_field;d(b).each(function(){var g=d.jgrid.getAccessor(this,c.p.localReader.id);d("#"+g,c.grid.bDiv).css("display","");this[e]&&d(c).jqGrid("expandRow",this)})}})},collapseRow:function(a){this.each(function(){var c=this;if(c.grid&&c.p.treeGrid){var b=d(c).jqGrid("getNodeChildren",a),e=c.p.treeReader.expanded_field;d(b).each(function(){var g=d.jgrid.getAccessor(this,c.p.localReader.id);d("#"+g,c.grid.bDiv).css("display",
+"none");this[e]&&d(c).jqGrid("collapseRow",this)})}})},getRootNodes:function(){var a=[];this.each(function(){var c=this;if(c.grid&&c.p.treeGrid)switch(c.p.treeGridModel){case "nested":var b=c.p.treeReader.level_field;d(c.p.data).each(function(){parseInt(this[b],10)===parseInt(c.p.tree_root_level,10)&&a.push(this)});break;case "adjacency":var e=c.p.treeReader.parent_id_field;d(c.p.data).each(function(){if(this[e]===null||String(this[e]).toLowerCase()=="null")a.push(this)})}});return a},getNodeDepth:function(a){var c=
+null;this.each(function(){if(this.grid&&this.p.treeGrid)switch(this.p.treeGridModel){case "nested":c=parseInt(a[this.p.treeReader.level_field],10)-parseInt(this.p.tree_root_level,10);break;case "adjacency":c=d(this).jqGrid("getNodeAncestors",a).length}});return c},getNodeParent:function(a){var c=null;this.each(function(){if(this.grid&&this.p.treeGrid)switch(this.p.treeGridModel){case "nested":var b=this.p.treeReader.left_field,e=this.p.treeReader.right_field,g=this.p.treeReader.level_field,h=parseInt(a[b],
+10),f=parseInt(a[e],10),l=parseInt(a[g],10);d(this.p.data).each(function(){if(parseInt(this[g],10)===l-1&&parseInt(this[b],10)<h&&parseInt(this[e],10)>f){c=this;return false}});break;case "adjacency":var i=this.p.treeReader.parent_id_field,j=this.p.localReader.id;d(this.p.data).each(function(){if(this[j]==a[i]){c=this;return false}})}});return c},getNodeChildren:function(a){var c=[];this.each(function(){if(this.grid&&this.p.treeGrid)switch(this.p.treeGridModel){case "nested":var b=this.p.treeReader.left_field,
+e=this.p.treeReader.right_field,g=this.p.treeReader.level_field,h=parseInt(a[b],10),f=parseInt(a[e],10),l=parseInt(a[g],10);d(this.p.data).each(function(){parseInt(this[g],10)===l+1&&parseInt(this[b],10)>h&&parseInt(this[e],10)<f&&c.push(this)});break;case "adjacency":var i=this.p.treeReader.parent_id_field,j=this.p.localReader.id;d(this.p.data).each(function(){this[i]==a[j]&&c.push(this)})}});return c},getFullTreeNode:function(a){var c=[];this.each(function(){var b;if(this.grid&&this.p.treeGrid)switch(this.p.treeGridModel){case "nested":var e=
+this.p.treeReader.left_field,g=this.p.treeReader.right_field,h=this.p.treeReader.level_field,f=parseInt(a[e],10),l=parseInt(a[g],10),i=parseInt(a[h],10);d(this.p.data).each(function(){parseInt(this[h],10)>=i&&parseInt(this[e],10)>=f&&parseInt(this[e],10)<=l&&c.push(this)});break;case "adjacency":if(a){c.push(a);var j=this.p.treeReader.parent_id_field,o=this.p.localReader.id;d(this.p.data).each(function(n){b=c.length;for(n=0;n<b;n++)if(c[n][o]==this[j]){c.push(this);break}})}}});return c},getNodeAncestors:function(a){var c=
+[];this.each(function(){if(this.grid&&this.p.treeGrid)for(var b=d(this).jqGrid("getNodeParent",a);b;){c.push(b);b=d(this).jqGrid("getNodeParent",b)}});return c},isVisibleNode:function(a){var c=true;this.each(function(){if(this.grid&&this.p.treeGrid){var b=d(this).jqGrid("getNodeAncestors",a),e=this.p.treeReader.expanded_field;d(b).each(function(){c=c&&this[e];if(!c)return false})}});return c},isNodeLoaded:function(a){var c;this.each(function(){if(this.grid&&this.p.treeGrid){var b=this.p.treeReader.leaf_field;
+c=a!==undefined?a.loaded!==undefined?a.loaded:a[b]||d(this).jqGrid("getNodeChildren",a).length>0?true:false:false}});return c},expandNode:function(a){return this.each(function(){if(this.grid&&this.p.treeGrid){var c=this.p.treeReader.expanded_field,b=this.p.treeReader.parent_id_field,e=this.p.treeReader.loaded,g=this.p.treeReader.level_field,h=this.p.treeReader.left_field,f=this.p.treeReader.right_field;if(!a[c]){var l=d.jgrid.getAccessor(a,this.p.localReader.id),i=d("#"+l,this.grid.bDiv)[0],j=this.p._index[l];
+if(d(this).jqGrid("isNodeLoaded",this.p.data[j])){a[c]=true;d("div.treeclick",i).removeClass(this.p.treeIcons.plus+" tree-plus").addClass(this.p.treeIcons.minus+" tree-minus")}else{a[c]=true;d("div.treeclick",i).removeClass(this.p.treeIcons.plus+" tree-plus").addClass(this.p.treeIcons.minus+" tree-minus");this.p.treeANode=i.rowIndex;this.p.datatype=this.p.treedatatype;this.p.treeGridModel=="nested"?d(this).jqGrid("setGridParam",{postData:{nodeid:l,n_left:a[h],n_right:a[f],n_level:a[g]}}):d(this).jqGrid("setGridParam",
+{postData:{nodeid:l,parentid:a[b],n_level:a[g]}});d(this).trigger("reloadGrid");a[e]=true;this.p.treeGridModel=="nested"?d(this).jqGrid("setGridParam",{postData:{nodeid:"",n_left:"",n_right:"",n_level:""}}):d(this).jqGrid("setGridParam",{postData:{nodeid:"",parentid:"",n_level:""}})}}}})},collapseNode:function(a){return this.each(function(){if(this.grid&&this.p.treeGrid)if(a.expanded){a.expanded=false;var c=d.jgrid.getAccessor(a,this.p.localReader.id);c=d("#"+c,this.grid.bDiv)[0];d("div.treeclick",
+c).removeClass(this.p.treeIcons.minus+" tree-minus").addClass(this.p.treeIcons.plus+" tree-plus")}})},SortTree:function(a,c,b,e){return this.each(function(){if(this.grid&&this.p.treeGrid){var g,h,f,l=[],i=this,j;g=d(this).jqGrid("getRootNodes");g=d.jgrid.from(g);g.orderBy(a,c,b,e);j=g.select();g=0;for(h=j.length;g<h;g++){f=j[g];l.push(f);d(this).jqGrid("collectChildrenSortTree",l,f,a,c,b,e)}d.each(l,function(o){var n=d.jgrid.getAccessor(this,i.p.localReader.id);d("#"+i.p.id+" tbody tr:eq("+o+")").after(d("tr#"+
+n,i.grid.bDiv))});l=j=g=null}})},collectChildrenSortTree:function(a,c,b,e,g,h){return this.each(function(){if(this.grid&&this.p.treeGrid){var f,l,i,j;f=d(this).jqGrid("getNodeChildren",c);f=d.jgrid.from(f);f.orderBy(b,e,g,h);j=f.select();f=0;for(l=j.length;f<l;f++){i=j[f];a.push(i);d(this).jqGrid("collectChildrenSortTree",a,i,b,e,g,h)}}})},setTreeRow:function(a,c){var b=false;this.each(function(){if(this.grid&&this.p.treeGrid)b=d(this).jqGrid("setRowData",a,c)});return b},delTreeNode:function(a){return this.each(function(){var c=
+this.p.localReader.id,b=this.p.treeReader.left_field,e=this.p.treeReader.right_field,g,h,f;if(this.grid&&this.p.treeGrid){var l=this.p._index[a];if(l!==undefined){g=parseInt(this.p.data[l][e],10);h=g-parseInt(this.p.data[l][b],10)+1;l=d(this).jqGrid("getFullTreeNode",this.p.data[l]);if(l.length>0)for(var i=0;i<l.length;i++)d(this).jqGrid("delRowData",l[i][c]);if(this.p.treeGridModel==="nested"){c=d.jgrid.from(this.p.data).greater(b,g,{stype:"integer"}).select();if(c.length)for(f in c)c[f][b]=parseInt(c[f][b],
+10)-h;c=d.jgrid.from(this.p.data).greater(e,g,{stype:"integer"}).select();if(c.length)for(f in c)c[f][e]=parseInt(c[f][e],10)-h}}}})},addChildNode:function(a,c,b){var e=this[0];if(b){var g=e.p.treeReader.expanded_field,h=e.p.treeReader.leaf_field,f=e.p.treeReader.level_field,l=e.p.treeReader.parent_id_field,i=e.p.treeReader.left_field,j=e.p.treeReader.right_field,o=e.p.treeReader.loaded,n,k,m,r,p;n=0;var s=c,t;if(!a){p=e.p.data.length-1;if(p>=0)for(;p>=0;){n=Math.max(n,parseInt(e.p.data[p][e.p.localReader.id],
+10));p--}a=n+1}var u=d(e).jqGrid("getInd",c);t=false;if(c===undefined||c===null||c===""){s=c=null;n="last";r=e.p.tree_root_level;p=e.p.data.length+1}else{n="after";k=e.p._index[c];m=e.p.data[k];c=m[e.p.localReader.id];r=parseInt(m[f],10)+1;p=d(e).jqGrid("getFullTreeNode",m);if(p.length){s=p=p[p.length-1][e.p.localReader.id];p=d(e).jqGrid("getInd",s)+1}else p=d(e).jqGrid("getInd",c)+1;if(m[h]){t=true;m[g]=true;d(e.rows[u]).find("span.cell-wrapperleaf").removeClass("cell-wrapperleaf").addClass("cell-wrapper").end().find("div.tree-leaf").removeClass(e.p.treeIcons.leaf+
+" tree-leaf").addClass(e.p.treeIcons.minus+" tree-minus");e.p.data[k][h]=false;m[o]=true}}k=p+1;b[g]=false;b[o]=true;b[f]=r;b[h]=true;if(e.p.treeGridModel==="adjacency")b[l]=c;if(e.p.treeGridModel==="nested"){var q;if(c!==null){h=parseInt(m[j],10);f=d.jgrid.from(e.p.data);f=f.greaterOrEquals(j,h,{stype:"integer"});f=f.select();if(f.length)for(q in f){f[q][i]=f[q][i]>h?parseInt(f[q][i],10)+2:f[q][i];f[q][j]=f[q][j]>=h?parseInt(f[q][j],10)+2:f[q][j]}b[i]=h;b[j]=h+1}else{h=parseInt(d(e).jqGrid("getCol",
+j,false,"max"),10);f=d.jgrid.from(e.p.data).greater(i,h,{stype:"integer"}).select();if(f.length)for(q in f)f[q][i]=parseInt(f[q][i],10)+2;f=d.jgrid.from(e.p.data).greater(j,h,{stype:"integer"}).select();if(f.length)for(q in f)f[q][j]=parseInt(f[q][j],10)+2;b[i]=h+1;b[j]=h+2}}if(c===null||d(e).jqGrid("isNodeLoaded",m)||t){d(e).jqGrid("addRowData",a,b,n,s);d(e).jqGrid("setTreeNode",p,k)}m&&!m[g]&&d(e.rows[u]).find("div.treeclick").click()}}})})(jQuery);
+(function(b){b.jgrid.extend({jqGridImport:function(a){a=b.extend({imptype:"xml",impstring:"",impurl:"",mtype:"GET",impData:{},xmlGrid:{config:"roots>grid",data:"roots>rows"},jsonGrid:{config:"grid",data:"data"},ajaxOptions:{}},a||{});return this.each(function(){var d=this,c=function(f,g){var e=b(g.xmlGrid.config,f)[0],h=b(g.xmlGrid.data,f)[0],i;if(xmlJsonClass.xml2json&&b.jgrid.parse){e=xmlJsonClass.xml2json(e," ");e=b.jgrid.parse(e);for(var l in e)if(e.hasOwnProperty(l))i=e[l];if(h){h=e.grid.datatype;
+e.grid.datatype="xmlstring";e.grid.datastr=f;b(d).jqGrid(i).jqGrid("setGridParam",{datatype:h})}else b(d).jqGrid(i)}else alert("xml2json or parse are not present")},j=function(f,g){if(f&&typeof f=="string"){var e=b.jgrid.parse(f),h=e[g.jsonGrid.config];if(e=e[g.jsonGrid.data]){var i=h.datatype;h.datatype="jsonstring";h.datastr=e;b(d).jqGrid(h).jqGrid("setGridParam",{datatype:i})}else b(d).jqGrid(h)}};switch(a.imptype){case "xml":b.ajax(b.extend({url:a.impurl,type:a.mtype,data:a.impData,dataType:"xml",
+complete:function(f,g){if(g=="success"){c(f.responseXML,a);b.isFunction(a.importComplete)&&a.importComplete(f)}}},a.ajaxOptions));break;case "xmlstring":if(a.impstring&&typeof a.impstring=="string"){var k=b.jgrid.stringToDoc(a.impstring);if(k){c(k,a);b.isFunction(a.importComplete)&&a.importComplete(k);a.impstring=null}k=null}break;case "json":b.ajax(b.extend({url:a.impurl,type:a.mtype,data:a.impData,dataType:"json",complete:function(f,g){if(g=="success"){j(f.responseText,a);b.isFunction(a.importComplete)&&
+a.importComplete(f)}}},a.ajaxOptions));break;case "jsonstring":if(a.impstring&&typeof a.impstring=="string"){j(a.impstring,a);b.isFunction(a.importComplete)&&a.importComplete(a.impstring);a.impstring=null}}})},jqGridExport:function(a){a=b.extend({exptype:"xmlstring",root:"grid",ident:"\t"},a||{});var d=null;this.each(function(){if(this.grid){var c=b.extend({},b(this).jqGrid("getGridParam"));if(c.rownumbers){c.colNames.splice(0,1);c.colModel.splice(0,1)}if(c.multiselect){c.colNames.splice(0,1);c.colModel.splice(0,
+1)}if(c.subGrid){c.colNames.splice(0,1);c.colModel.splice(0,1)}c.knv=null;if(c.treeGrid)for(var j in c.treeReader)if(c.treeReader.hasOwnProperty(j)){c.colNames.splice(c.colNames.length-1);c.colModel.splice(c.colModel.length-1)}switch(a.exptype){case "xmlstring":d="<"+a.root+">"+xmlJsonClass.json2xml(c,a.ident)+"</"+a.root+">";break;case "jsonstring":d="{"+xmlJsonClass.toJson(c,a.root,a.ident,false)+"}";if(c.postData.filters!==undefined){d=d.replace(/filters":"/,'filters":');d=d.replace(/}]}"/,"}]}")}}}});
+return d},excelExport:function(a){a=b.extend({exptype:"remote",url:null,oper:"oper",tag:"excel",exportOptions:{}},a||{});return this.each(function(){if(this.grid){var d;if(a.exptype=="remote"){d=b.extend({},this.p.postData);d[a.oper]=a.tag;d=jQuery.param(d);d=a.url.indexOf("?")!=-1?a.url+"&"+d:a.url+"?"+d;window.location=d}}})}})})(jQuery);
+var xmlJsonClass={xml2json:function(a,b){if(a.nodeType===9)a=a.documentElement;var g=this.toJson(this.toObj(this.removeWhite(a)),a.nodeName,"\t");return"{\n"+b+(b?g.replace(/\t/g,b):g.replace(/\t|\n/g,""))+"\n}"},json2xml:function(a,b){var g=function(d,c,i){var h="",k,j;if(d instanceof Array)if(d.length===0)h+=i+"<"+c+">__EMPTY_ARRAY_</"+c+">\n";else{k=0;for(j=d.length;k<j;k+=1){var l=i+g(d[k],c,i+"\t")+"\n";h+=l}}else if(typeof d==="object"){k=false;h+=i+"<"+c;for(j in d)if(d.hasOwnProperty(j))if(j.charAt(0)===
+"@")h+=" "+j.substr(1)+'="'+d[j].toString()+'"';else k=true;h+=k?">":"/>";if(k){for(j in d)if(d.hasOwnProperty(j))if(j==="#text")h+=d[j];else if(j==="#cdata")h+="<![CDATA["+d[j]+"]]\>";else if(j.charAt(0)!=="@")h+=g(d[j],j,i+"\t");h+=(h.charAt(h.length-1)==="\n"?i:"")+"</"+c+">"}}else h+=typeof d==="function"?i+"<"+c+"><![CDATA["+d+"]]\></"+c+">":d.toString()==='""'||d.toString().length===0?i+"<"+c+">__EMPTY_STRING_</"+c+">":i+"<"+c+">"+d.toString()+"</"+c+">";return h},e="",f;for(f in a)if(a.hasOwnProperty(f))e+=
+g(a[f],f,"");return b?e.replace(/\t/g,b):e.replace(/\t|\n/g,"")},toObj:function(a){var b={},g=/function/i;if(a.nodeType===1){if(a.attributes.length){var e;for(e=0;e<a.attributes.length;e+=1)b["@"+a.attributes[e].nodeName]=(a.attributes[e].nodeValue||"").toString()}if(a.firstChild){var f=e=0,d=false,c;for(c=a.firstChild;c;c=c.nextSibling)if(c.nodeType===1)d=true;else if(c.nodeType===3&&c.nodeValue.match(/[^ \f\n\r\t\v]/))e+=1;else if(c.nodeType===4)f+=1;if(d)if(e<2&&f<2){this.removeWhite(a);for(c=
+a.firstChild;c;c=c.nextSibling)if(c.nodeType===3)b["#text"]=this.escape(c.nodeValue);else if(c.nodeType===4)if(g.test(c.nodeValue))b[c.nodeName]=[b[c.nodeName],c.nodeValue];else b["#cdata"]=this.escape(c.nodeValue);else if(b[c.nodeName])if(b[c.nodeName]instanceof Array)b[c.nodeName][b[c.nodeName].length]=this.toObj(c);else b[c.nodeName]=[b[c.nodeName],this.toObj(c)];else b[c.nodeName]=this.toObj(c)}else if(a.attributes.length)b["#text"]=this.escape(this.innerXml(a));else b=this.escape(this.innerXml(a));
+else if(e)if(a.attributes.length)b["#text"]=this.escape(this.innerXml(a));else{b=this.escape(this.innerXml(a));if(b==="__EMPTY_ARRAY_")b="[]";else if(b==="__EMPTY_STRING_")b=""}else if(f)if(f>1)b=this.escape(this.innerXml(a));else for(c=a.firstChild;c;c=c.nextSibling)if(g.test(a.firstChild.nodeValue)){b=a.firstChild.nodeValue;break}else b["#cdata"]=this.escape(c.nodeValue)}if(!a.attributes.length&&!a.firstChild)b=null}else if(a.nodeType===9)b=this.toObj(a.documentElement);else alert("unhandled node type: "+
+a.nodeType);return b},toJson:function(a,b,g,e){if(e===undefined)e=true;var f=b?'"'+b+'"':"",d="\t",c="\n";if(!e)c=d="";if(a==="[]")f+=b?":[]":"[]";else if(a instanceof Array){var i,h,k=[];h=0;for(i=a.length;h<i;h+=1)k[h]=this.toJson(a[h],"",g+d,e);f+=(b?":[":"[")+(k.length>1?c+g+d+k.join(","+c+g+d)+c+g:k.join(""))+"]"}else if(a===null)f+=(b&&":")+"null";else if(typeof a==="object"){i=[];for(h in a)if(a.hasOwnProperty(h))i[i.length]=this.toJson(a[h],h,g+d,e);f+=(b?":{":"{")+(i.length>1?c+g+d+i.join(","+
+c+g+d)+c+g:i.join(""))+"}"}else f+=typeof a==="string"?(b&&":")+'"'+a.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"':(b&&":")+'"'+a.toString()+'"';return f},innerXml:function(a){var b="";if("innerHTML"in a)b=a.innerHTML;else{var g=function(e){var f="",d;if(e.nodeType===1){f+="<"+e.nodeName;for(d=0;d<e.attributes.length;d+=1)f+=" "+e.attributes[d].nodeName+'="'+(e.attributes[d].nodeValue||"").toString()+'"';if(e.firstChild){f+=">";for(d=e.firstChild;d;d=d.nextSibling)f+=g(d);f+="</"+e.nodeName+">"}else f+=
+"/>"}else if(e.nodeType===3)f+=e.nodeValue;else if(e.nodeType===4)f+="<![CDATA["+e.nodeValue+"]]\>";return f};for(a=a.firstChild;a;a=a.nextSibling)b+=g(a)}return b},escape:function(a){return a.replace(/[\\]/g,"\\\\").replace(/[\"]/g,'\\"').replace(/[\n]/g,"\\n").replace(/[\r]/g,"\\r")},removeWhite:function(a){a.normalize();var b;for(b=a.firstChild;b;)if(b.nodeType===3)if(b.nodeValue.match(/[^ \f\n\r\t\v]/))b=b.nextSibling;else{var g=b.nextSibling;a.removeChild(b);b=g}else{b.nodeType===1&&this.removeWhite(b);
+b=b.nextSibling}return a}};
+function tableToGrid(n,o){jQuery(n).each(function(){if(!this.grid){jQuery(this).width("99%");var a=jQuery(this).width(),d=jQuery("tr td:first-child input[type=checkbox]:first",jQuery(this)),b=jQuery("tr td:first-child input[type=radio]:first",jQuery(this));d=d.length>0;b=!d&&b.length>0;var l=d||b,c=[],g=[];jQuery("th",jQuery(this)).each(function(){if(c.length===0&&l){c.push({name:"__selection__",index:"__selection__",width:0,hidden:true});g.push("__selection__")}else{c.push({name:jQuery(this).attr("id")||
+jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(" ").join("_"),index:jQuery(this).attr("id")||jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(" ").join("_"),width:jQuery(this).width()||150});g.push(jQuery(this).html())}});var f=[],h=[],i=[];jQuery("tbody > tr",jQuery(this)).each(function(){var j={},e=0;jQuery("td",jQuery(this)).each(function(){if(e===0&&l){var k=jQuery("input",jQuery(this)),m=k.attr("value");h.push(m||f.length);k.attr("checked")&&i.push(m);j[c[e].name]=
+k.attr("value")}else j[c[e].name]=jQuery(this).html();e++});e>0&&f.push(j)});jQuery(this).empty();jQuery(this).addClass("scroll");jQuery(this).jqGrid(jQuery.extend({datatype:"local",width:a,colNames:g,colModel:c,multiselect:d},o||{}));for(a=0;a<f.length;a++){b=null;if(h.length>0)if((b=h[a])&&b.replace)b=encodeURIComponent(b).replace(/[.\-%]/g,"_");if(b===null)b=a+1;jQuery(this).jqGrid("addRowData",b,f[a])}for(a=0;a<i.length;a++)jQuery(this).jqGrid("setSelection",i[a])}})};
+(function(a){if(a.browser.msie&&a.browser.version==8)a.expr[":"].hidden=function(b){return b.offsetWidth===0||b.offsetHeight===0||b.style.display=="none"};a.jgrid._multiselect=false;if(a.ui)if(a.ui.multiselect){if(a.ui.multiselect.prototype._setSelected){var q=a.ui.multiselect.prototype._setSelected;a.ui.multiselect.prototype._setSelected=function(b,g){var c=q.call(this,b,g);if(g&&this.selectedList){var f=this.element;this.selectedList.find("li").each(function(){a(this).data("optionLink")&&a(this).data("optionLink").remove().appendTo(f)})}return c}}if(a.ui.multiselect.prototype.destroy)a.ui.multiselect.prototype.destroy=
+function(){this.element.show();this.container.remove();a.Widget===undefined?a.widget.prototype.destroy.apply(this,arguments):a.Widget.prototype.destroy.apply(this,arguments)};a.jgrid._multiselect=true}a.jgrid.extend({sortableColumns:function(b){return this.each(function(){function g(){c.p.disableClick=true}var c=this,f=c.p.id;f={tolerance:"pointer",axis:"x",scrollSensitivity:"1",items:">th:not(:has(#jqgh_"+f+"_cb,#jqgh_"+f+"_rn,#jqgh_"+f+"_subgrid),:hidden)",placeholder:{element:function(h){return a(document.createElement(h[0].nodeName)).addClass(h[0].className+
+" ui-sortable-placeholder ui-state-highlight").removeClass("ui-sortable-helper")[0]},update:function(h,j){j.height(h.currentItem.innerHeight()-parseInt(h.currentItem.css("paddingTop")||0,10)-parseInt(h.currentItem.css("paddingBottom")||0,10));j.width(h.currentItem.innerWidth()-parseInt(h.currentItem.css("paddingLeft")||0,10)-parseInt(h.currentItem.css("paddingRight")||0,10))}},update:function(h,j){var i=a(j.item).parent();i=a(">th",i);var l={},m=c.p.id+"_";a.each(c.p.colModel,function(k){l[this.name]=
+k});var d=[];i.each(function(){var k=a(">div",this).get(0).id.replace(/^jqgh_/,"").replace(m,"");k in l&&d.push(l[k])});a(c).jqGrid("remapColumns",d,true,true);a.isFunction(c.p.sortable.update)&&c.p.sortable.update(d);setTimeout(function(){c.p.disableClick=false},50)}};if(c.p.sortable.options)a.extend(f,c.p.sortable.options);else if(a.isFunction(c.p.sortable))c.p.sortable={update:c.p.sortable};if(f.start){var e=f.start;f.start=function(h,j){g();e.call(this,h,j)}}else f.start=g;if(c.p.sortable.exclude)f.items+=
+":not("+c.p.sortable.exclude+")";b.sortable(f).data("sortable").floating=true})},columnChooser:function(b){function g(d,k){if(d)if(typeof d=="string")a.fn[d]&&a.fn[d].apply(k,a.makeArray(arguments).slice(2));else a.isFunction(d)&&d.apply(k,a.makeArray(arguments).slice(2))}var c=this;if(!a("#colchooser_"+c[0].p.id).length){var f=a('<div id="colchooser_'+c[0].p.id+'" style="position:relative;overflow:hidden"><div><select multiple="multiple"></select></div></div>'),e=a("select",f);b=a.extend({width:420,
+height:240,classname:null,done:function(d){d&&c.jqGrid("remapColumns",d,true)},msel:"multiselect",dlog:"dialog",dlog_opts:function(d){var k={};k[d.bSubmit]=function(){d.apply_perm();d.cleanup(false)};k[d.bCancel]=function(){d.cleanup(true)};return{buttons:k,close:function(){d.cleanup(true)},modal:d.modal?d.modal:false,resizable:d.resizable?d.resizable:true,width:d.width+20}},apply_perm:function(){a("option",e).each(function(){this.selected?c.jqGrid("showCol",h[this.value].name):c.jqGrid("hideCol",
+h[this.value].name)});var d=[];a("option[selected]",e).each(function(){d.push(parseInt(this.value,10))});a.each(d,function(){delete i[h[parseInt(this,10)].name]});a.each(i,function(){var k=parseInt(this,10);var p=d,o=k;if(o>=0){var n=p.slice(),r=n.splice(o,Math.max(p.length-o,o));if(o>p.length)o=p.length;n[o]=k;d=n.concat(r)}else d=void 0});b.done&&b.done.call(c,d)},cleanup:function(d){g(b.dlog,f,"destroy");g(b.msel,e,"destroy");f.remove();d&&b.done&&b.done.call(c)},msel_opts:{}},a.jgrid.col,b||{});
+if(a.ui)if(a.ui.multiselect)if(b.msel=="multiselect"){if(!a.jgrid._multiselect){alert("Multiselect plugin loaded after jqGrid. Please load the plugin before the jqGrid!");return}b.msel_opts=a.extend(a.ui.multiselect.defaults,b.msel_opts)}b.caption&&f.attr("title",b.caption);if(b.classname){f.addClass(b.classname);e.addClass(b.classname)}if(b.width){a(">div",f).css({width:b.width,margin:"0 auto"});e.css("width",b.width)}if(b.height){a(">div",f).css("height",b.height);e.css("height",b.height-10)}var h=
+c.jqGrid("getGridParam","colModel"),j=c.jqGrid("getGridParam","colNames"),i={},l=[];e.empty();a.each(h,function(d){i[this.name]=d;if(this.hidedlg)this.hidden||l.push(d);else e.append("<option value='"+d+"' "+(this.hidden?"":"selected='selected'")+">"+j[d]+"</option>")});var m=a.isFunction(b.dlog_opts)?b.dlog_opts.call(c,b):b.dlog_opts;g(b.dlog,f,m);m=a.isFunction(b.msel_opts)?b.msel_opts.call(c,b):b.msel_opts;g(b.msel,e,m)}},sortableRows:function(b){return this.each(function(){var g=this;if(g.grid)if(!g.p.treeGrid)if(a.fn.sortable){b=
+a.extend({cursor:"move",axis:"y",items:".jqgrow"},b||{});if(b.start&&a.isFunction(b.start)){b._start_=b.start;delete b.start}else b._start_=false;if(b.update&&a.isFunction(b.update)){b._update_=b.update;delete b.update}else b._update_=false;b.start=function(c,f){a(f.item).css("border-width","0px");a("td",f.item).each(function(j){this.style.width=g.grid.cols[j].style.width});if(g.p.subGrid){var e=a(f.item).attr("id");try{a(g).jqGrid("collapseSubGridRow",e)}catch(h){}}b._start_&&b._start_.apply(this,
+[c,f])};b.update=function(c,f){a(f.item).css("border-width","");g.p.rownumbers===true&&a("td.jqgrid-rownum",g.rows).each(function(e){a(this).html(e+1)});b._update_&&b._update_.apply(this,[c,f])};a("tbody:first",g).sortable(b);a("tbody:first",g).disableSelection()}})},gridDnD:function(b){return this.each(function(){function g(){var e=a.data(c,"dnd");a("tr.jqgrow:not(.ui-draggable)",c).draggable(a.isFunction(e.drag)?e.drag.call(a(c),e):e.drag)}var c=this;if(c.grid)if(!c.p.treeGrid)if(a.fn.draggable&&
+a.fn.droppable){a("#jqgrid_dnd").html()===null&&a("body").append("<table id='jqgrid_dnd' class='ui-jqgrid-dnd'></table>");if(typeof b=="string"&&b=="updateDnD"&&c.p.jqgdnd===true)g();else{b=a.extend({drag:function(e){return a.extend({start:function(h,j){if(c.p.subGrid){var i=a(j.helper).attr("id");try{a(c).jqGrid("collapseSubGridRow",i)}catch(l){}}for(i=0;i<a.data(c,"dnd").connectWith.length;i++)a(a.data(c,"dnd").connectWith[i]).jqGrid("getGridParam","reccount")=="0"&&a(a.data(c,"dnd").connectWith[i]).jqGrid("addRowData",
+"jqg_empty_row",{});j.helper.addClass("ui-state-highlight");a("td",j.helper).each(function(m){this.style.width=c.grid.headers[m].width+"px"});e.onstart&&a.isFunction(e.onstart)&&e.onstart.call(a(c),h,j)},stop:function(h,j){if(j.helper.dropped){var i=a(j.helper).attr("id");a(c).jqGrid("delRowData",i)}for(i=0;i<a.data(c,"dnd").connectWith.length;i++)a(a.data(c,"dnd").connectWith[i]).jqGrid("delRowData","jqg_empty_row");e.onstop&&a.isFunction(e.onstop)&&e.onstop.call(a(c),h,j)}},e.drag_opts||{})},drop:function(e){return a.extend({accept:function(h){if(!a(h).hasClass("jqgrow"))return h;
+var j=a(h).closest("table.ui-jqgrid-btable");if(j.length>0&&a.data(j[0],"dnd")!==undefined){h=a.data(j[0],"dnd").connectWith;return a.inArray("#"+this.id,h)!=-1?true:false}return h},drop:function(h,j){if(a(j.draggable).hasClass("jqgrow")){var i=a(j.draggable).attr("id");i=j.draggable.parent().parent().jqGrid("getRowData",i);if(!e.dropbyname){var l=0,m={},d,k=a("#"+this.id).jqGrid("getGridParam","colModel");try{for(var p in i){if(i.hasOwnProperty(p)&&k[l]){d=k[l].name;m[d]=i[p]}l++}i=m}catch(o){}}j.helper.dropped=
+true;if(e.beforedrop&&a.isFunction(e.beforedrop)){d=e.beforedrop.call(this,h,j,i,a("#"+c.id),a(this));if(typeof d!="undefined"&&d!==null&&typeof d=="object")i=d}if(j.helper.dropped){var n;if(e.autoid)if(a.isFunction(e.autoid))n=e.autoid.call(this,i);else{n=Math.ceil(Math.random()*1E3);n=e.autoidprefix+n}a("#"+this.id).jqGrid("addRowData",n,i,e.droppos)}e.ondrop&&a.isFunction(e.ondrop)&&e.ondrop.call(this,h,j,i)}}},e.drop_opts||{})},onstart:null,onstop:null,beforedrop:null,ondrop:null,drop_opts:{activeClass:"ui-state-active",
+hoverClass:"ui-state-hover"},drag_opts:{revert:"invalid",helper:"clone",cursor:"move",appendTo:"#jqgrid_dnd",zIndex:5E3},dropbyname:false,droppos:"first",autoid:true,autoidprefix:"dnd_"},b||{});if(b.connectWith){b.connectWith=b.connectWith.split(",");b.connectWith=a.map(b.connectWith,function(e){return a.trim(e)});a.data(c,"dnd",b);c.p.reccount!="0"&&!c.p.jqgdnd&&g();c.p.jqgdnd=true;for(var f=0;f<b.connectWith.length;f++)a(b.connectWith[f]).droppable(a.isFunction(b.drop)?b.drop.call(a(c),b):b.drop)}}}})},
+gridResize:function(b){return this.each(function(){var g=this;if(g.grid&&a.fn.resizable){b=a.extend({},b||{});if(b.alsoResize){b._alsoResize_=b.alsoResize;delete b.alsoResize}else b._alsoResize_=false;if(b.stop&&a.isFunction(b.stop)){b._stop_=b.stop;delete b.stop}else b._stop_=false;b.stop=function(c,f){a(g).jqGrid("setGridParam",{height:a("#gview_"+g.p.id+" .ui-jqgrid-bdiv").height()});a(g).jqGrid("setGridWidth",f.size.width,b.shrinkToFit);b._stop_&&b._stop_.call(g,c,f)};b.alsoResize=b._alsoResize_?
+eval("("+("{'#gview_"+g.p.id+" .ui-jqgrid-bdiv':true,'"+b._alsoResize_+"':true}")+")"):a(".ui-jqgrid-bdiv","#gview_"+g.p.id);delete b._alsoResize_;a("#gbox_"+g.p.id).resizable(b)}})}})})(jQuery);
Index: trunk/prototype/plugins/minimize/jquery.minimize.js
===================================================================
--- trunk/prototype/plugins/minimize/jquery.minimize.js	(revision 5341)
+++ trunk/prototype/plugins/minimize/jquery.minimize.js	(revision 5341)
@@ -0,0 +1,106 @@
+/*
+*	Extension of JQuery UI Dialog widget to add custom minimizing capabilities
+*	Written by: Ryan Curtis
+*
+*/
+(function($){
+	var _init = $.ui.dialog.prototype._init;
+	
+	//Optional top margin for page, wont let a user move a dialog into this spot.
+	var topMargin = 0;
+	
+	//Custom Dialog Init
+	$.ui.dialog.prototype._init = function() {
+		var self = this;
+        _init.apply(this, arguments);
+		uiDialogTitlebar = this.uiDialogTitlebar;
+		
+		
+		//we need two variables to preserve the original width and height so that can be restored.
+		this.options.originalWidth = this.options.width;
+		this.options.originalHeight = this.options.height;
+		
+		//save a reference to the resizable handle so we can hide it when necessary.
+		this.resizeableHandle =  this.uiDialog.resizable().find('.ui-resizable-se');
+		
+		//Save the height of the titlebar for the minimize operation
+		this.titlebarHeight = parseInt(uiDialogTitlebar.css('height')) + parseInt(uiDialogTitlebar.css('padding-top')) + parseInt(uiDialogTitlebar.css('padding-bottom')) + parseInt(this.uiDialog.css('padding-top')) + parseInt(this.uiDialog.css('padding-bottom')) ;
+		
+		uiDialogTitlebar.append('<a href="#"class="dialog-restore ui-dialog-titlebar-rest"><span class="ui-icon ui-icon-newwin"></span></a>');
+		uiDialogTitlebar.append('<a href="#" id="dialog-minimize" class="dialog-minimize ui-dialog-titlebar-min"><span class="ui-icon ui-icon-minusthick"></span></a>');
+		
+		//Minimize Button
+		this.uiDialogTitlebarMin = $('.dialog-minimize', uiDialogTitlebar).hover(function(){
+			$(this).addClass('ui-state-hover');
+		}, function(){
+			$(this).removeClass('ui-state-hover');
+		}).click(function(){
+			self.minimize();
+			return false;
+		});
+		//Restore Button
+		this.uiDialogTitlebarRest = $('.dialog-restore', uiDialogTitlebar).hover(function(){
+			$(this).addClass('ui-state-hover');
+		}, function(){
+			$(this).removeClass('ui-state-hover');
+		}).click(function(){
+			self.restore();
+			self.moveToTop(true);
+			return false;
+		}).hide();
+		
+		
+		//restore the minimize button on close
+		this.uiDialog.bind('dialogbeforeclose', function(event, ui) {
+			self.uiDialogTitlebarRest.hide();
+			self.uiDialogTitlebarMin.show();
+		});
+
+
+		
+	};
+	//Custom Dialog Functions
+	$.extend($.ui.dialog.prototype, {
+		restore: function() {
+			this.uiDialog.resizable( "option", "disabled", false );
+			//We want to prevent the dialog from expanding off the screen
+			var windowHeight = $(window).height();
+			var dialogHeight = this.options.originalHeight;
+			var dialogTop = parseInt(this.uiDialog.css('top'));
+			if(dialogHeight+dialogTop > windowHeight)
+			{
+				//there is 22 pixels of padding at the bottom of a dialog per css file
+				var newTop = windowHeight-dialogHeight-22;
+				this.uiDialog.css('top',newTop);
+			}			
+			var windowWidth = $(window).width();
+			var dialogWidth = this.options.originalWidth;
+			var dialogLeft = parseInt(this.uiDialog.css('left'));
+			if(dialogWidth+dialogLeft > windowWidth)
+			{
+				//there are 2 pixels of padding per css
+				var newLeft = windowWidth-dialogWidth-2;
+				this.uiDialog.css('left',newLeft);
+			}
+			this.uiDialog.css({width: this.options.originalWidth, height:this.options.originalHeight});
+			this.element.show();
+			
+			this.resizeableHandle.show();
+			this.uiDialogTitlebarRest.hide();
+			this.uiDialogTitlebarMin.show();
+		},
+		minimize: function() { 
+			//Store the original height/width
+			this.uiDialog.resizable( "option", "disabled", true );
+			this.options.originalWidth = this.options.width;
+			this.options.originalHeight = this.options.height;
+			
+			this.uiDialog.animate({width: 200, height:this.titlebarHeight},200);
+			this.element.hide();
+			
+			this.uiDialogTitlebarMin.hide();
+			this.uiDialogTitlebarRest.show();
+			this.resizeableHandle.hide();
+		}
+	});
+})(jQuery); 
Index: trunk/prototype/plugins/ejs/ejs_production.js
===================================================================
--- trunk/prototype/plugins/ejs/ejs_production.js	(revision 5283)
+++ trunk/prototype/plugins/ejs/ejs_production.js	(revision 5283)
@@ -0,0 +1,1 @@
+(function(){var rsplit=function(string,regex){var result=regex.exec(string),retArr=new Array(),first_idx,last_idx,first_bit;while(result!=null){first_idx=result.index;last_idx=regex.lastIndex;if((first_idx)!=0){first_bit=string.substring(0,first_idx);retArr.push(string.substring(0,first_idx));string=string.slice(first_idx)}retArr.push(result[0]);string=string.slice(result[0].length);result=regex.exec(string)}if(!string==""){retArr.push(string)}return retArr},chop=function(string){return string.substr(0,string.length-1)},extend=function(d,s){for(var n in s){if(s.hasOwnProperty(n)){d[n]=s[n]}}};EJS=function(options){options=typeof options=="string"?{view:options}:options;this.set_options(options);if(options.precompiled){this.template={};this.template.process=options.precompiled;EJS.update(this.name,this);return }if(options.element){if(typeof options.element=="string"){var name=options.element;options.element=document.getElementById(options.element);if(options.element==null){throw name+"does not exist!"}}if(options.element.value){this.text=options.element.value}else{this.text=options.element.innerHTML}this.name=options.element.id;this.type="["}else{if(options.url){options.url=EJS.endExt(options.url,this.extMatch);this.name=this.name?this.name:options.url;var url=options.url;var template=EJS.get(this.name,this.cache);if(template){return template}if(template==EJS.INVALID_PATH){return null}try{this.text=EJS.request(url+(this.cache?"":"?"+Math.random()))}catch(e){}if(this.text==null){throw ({type:"EJS",message:"There is no template at "+url})}}}var template=new EJS.Compiler(this.text,this.type);template.compile(options,this.name);EJS.update(this.name,this);this.template=template};EJS.prototype={render:function(object,extra_helpers){object=object||{};this._extra_helpers=extra_helpers;var v=new EJS.Helpers(object,extra_helpers||{});return this.template.process.call(object,object,v)},update:function(element,options){if(typeof element=="string"){element=document.getElementById(element)}if(options==null){_template=this;return function(object){EJS.prototype.update.call(_template,element,object)}}if(typeof options=="string"){params={};params.url=options;_template=this;params.onComplete=function(request){var object=eval(request.responseText);EJS.prototype.update.call(_template,element,object)};EJS.ajax_request(params)}else{element.innerHTML=this.render(options)}},out:function(){return this.template.out},set_options:function(options){this.type=options.type||EJS.type;this.cache=options.cache!=null?options.cache:EJS.cache;this.text=options.text||null;this.name=options.name||null;this.ext=options.ext||EJS.ext;this.extMatch=new RegExp(this.ext.replace(/\./,"."))}};EJS.endExt=function(path,match){if(!path){return null}match.lastIndex=0;return path+(match.test(path)?"":this.ext)};EJS.Scanner=function(source,left,right){extend(this,{left_delimiter:left+"%",right_delimiter:"%"+right,double_left:left+"%%",double_right:"%%"+right,left_equal:left+"%=",left_comment:left+"%#"});this.SplitRegexp=left=="["?/(\[%%)|(%%\])|(\[%=)|(\[%#)|(\[%)|(%\]\n)|(%\])|(\n)/:new RegExp("("+this.double_left+")|(%%"+this.double_right+")|("+this.left_equal+")|("+this.left_comment+")|("+this.left_delimiter+")|("+this.right_delimiter+"\n)|("+this.right_delimiter+")|(\n)");this.source=source;this.stag=null;this.lines=0};EJS.Scanner.to_text=function(input){if(input==null||input===undefined){return""}if(input instanceof Date){return input.toDateString()}if(input.toString){return input.toString()}return""};EJS.Scanner.prototype={scan:function(block){scanline=this.scanline;regex=this.SplitRegexp;if(!this.source==""){var source_split=rsplit(this.source,/\n/);for(var i=0;i<source_split.length;i++){var item=source_split[i];this.scanline(item,regex,block)}}},scanline:function(line,regex,block){this.lines++;var line_split=rsplit(line,regex);for(var i=0;i<line_split.length;i++){var token=line_split[i];if(token!=null){try{block(token,this)}catch(e){throw {type:"EJS.Scanner",line:this.lines}}}}}};EJS.Buffer=function(pre_cmd,post_cmd){this.line=new Array();this.script="";this.pre_cmd=pre_cmd;this.post_cmd=post_cmd;for(var i=0;i<this.pre_cmd.length;i++){this.push(pre_cmd[i])}};EJS.Buffer.prototype={push:function(cmd){this.line.push(cmd)},cr:function(){this.script=this.script+this.line.join("; ");this.line=new Array();this.script=this.script+"\n"},close:function(){if(this.line.length>0){for(var i=0;i<this.post_cmd.length;i++){this.push(pre_cmd[i])}this.script=this.script+this.line.join("; ");line=null}}};EJS.Compiler=function(source,left){this.pre_cmd=["var ___ViewO = [];"];this.post_cmd=new Array();this.source=" ";if(source!=null){if(typeof source=="string"){source=source.replace(/\r\n/g,"\n");source=source.replace(/\r/g,"\n");this.source=source}else{if(source.innerHTML){this.source=source.innerHTML}}if(typeof this.source!="string"){this.source=""}}left=left||"<";var right=">";switch(left){case"[":right="]";break;case"<":break;default:throw left+" is not a supported deliminator";break}this.scanner=new EJS.Scanner(this.source,left,right);this.out=""};EJS.Compiler.prototype={compile:function(options,name){options=options||{};this.out="";var put_cmd="___ViewO.push(";var insert_cmd=put_cmd;var buff=new EJS.Buffer(this.pre_cmd,this.post_cmd);var content="";var clean=function(content){content=content.replace(/\\/g,"\\\\");content=content.replace(/\n/g,"\\n");content=content.replace(/"/g,'\\"');return content};this.scanner.scan(function(token,scanner){if(scanner.stag==null){switch(token){case"\n":content=content+"\n";buff.push(put_cmd+'"'+clean(content)+'");');buff.cr();content="";break;case scanner.left_delimiter:case scanner.left_equal:case scanner.left_comment:scanner.stag=token;if(content.length>0){buff.push(put_cmd+'"'+clean(content)+'")')}content="";break;case scanner.double_left:content=content+scanner.left_delimiter;break;default:content=content+token;break}}else{switch(token){case scanner.right_delimiter:switch(scanner.stag){case scanner.left_delimiter:if(content[content.length-1]=="\n"){content=chop(content);buff.push(content);buff.cr()}else{buff.push(content)}break;case scanner.left_equal:buff.push(insert_cmd+"(EJS.Scanner.to_text("+content+")))");break}scanner.stag=null;content="";break;case scanner.double_right:content=content+scanner.right_delimiter;break;default:content=content+token;break}}});if(content.length>0){buff.push(put_cmd+'"'+clean(content)+'")')}buff.close();this.out=buff.script+";";var to_be_evaled="/*"+name+"*/this.process = function(_CONTEXT,_VIEW) { try { with(_VIEW) { with (_CONTEXT) {"+this.out+" return ___ViewO.join('');}}}catch(e){e.lineNumber=null;throw e;}};";try{eval(to_be_evaled)}catch(e){if(typeof JSLINT!="undefined"){JSLINT(this.out);for(var i=0;i<JSLINT.errors.length;i++){var error=JSLINT.errors[i];if(error.reason!="Unnecessary semicolon."){error.line++;var e=new Error();e.lineNumber=error.line;e.message=error.reason;if(options.view){e.fileName=options.view}throw e}}}else{throw e}}}};EJS.config=function(options){EJS.cache=options.cache!=null?options.cache:EJS.cache;EJS.type=options.type!=null?options.type:EJS.type;EJS.ext=options.ext!=null?options.ext:EJS.ext;var templates_directory=EJS.templates_directory||{};EJS.templates_directory=templates_directory;EJS.get=function(path,cache){if(cache==false){return null}if(templates_directory[path]){return templates_directory[path]}return null};EJS.update=function(path,template){if(path==null){return }templates_directory[path]=template};EJS.INVALID_PATH=-1};EJS.config({cache:true,type:"<",ext:".ejs"});EJS.Helpers=function(data,extras){this._data=data;this._extras=extras;extend(this,extras)};EJS.Helpers.prototype={view:function(options,data,helpers){if(!helpers){helpers=this._extras}if(!data){data=this._data}return new EJS(options).render(data,helpers)},to_text:function(input,null_text){if(input==null||input===undefined){return null_text||""}if(input instanceof Date){return input.toDateString()}if(input.toString){return input.toString().replace(/\n/g,"<br />").replace(/''/g,"'")}return""}};EJS.newRequest=function(){var factories=[function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new XMLHttpRequest()},function(){return new ActiveXObject("Microsoft.XMLHTTP")}];for(var i=0;i<factories.length;i++){try{var request=factories[i]();if(request!=null){return request}}catch(e){continue}}};EJS.request=function(path){var request=new EJS.newRequest();request.open("GET",path,false);try{request.send(null)}catch(e){return null}if(request.status==404||request.status==2||(request.status==0&&request.responseText=="")){return null}return request.responseText};EJS.ajax_request=function(params){params.method=(params.method?params.method:"GET");var request=new EJS.newRequest();request.onreadystatechange=function(){if(request.readyState==4){if(request.status==200){params.onComplete(request)}else{params.onComplete(request)}}};request.open(params.method,params.url);request.send(null)}})();EJS.Helpers.prototype.date_tag=function(C,O,A){if(!(O instanceof Date)){O=new Date()}var B=["January","February","March","April","May","June","July","August","September","October","November","December"];var G=[],D=[],P=[];var J=O.getFullYear();var H=O.getMonth();var N=O.getDate();for(var M=J-15;M<J+15;M++){G.push({value:M,text:M})}for(var E=0;E<12;E++){D.push({value:(E),text:B[E]})}for(var I=0;I<31;I++){P.push({value:(I+1),text:(I+1)})}var L=this.select_tag(C+"[year]",J,G,{id:C+"[year]"});var F=this.select_tag(C+"[month]",H,D,{id:C+"[month]"});var K=this.select_tag(C+"[day]",N,P,{id:C+"[day]"});return L+F+K};EJS.Helpers.prototype.form_tag=function(B,A){A=A||{};A.action=B;if(A.multipart==true){A.method="post";A.enctype="multipart/form-data"}return this.start_tag_for("form",A)};EJS.Helpers.prototype.form_tag_end=function(){return this.tag_end("form")};EJS.Helpers.prototype.hidden_field_tag=function(A,C,B){return this.input_field_tag(A,C,"hidden",B)};EJS.Helpers.prototype.input_field_tag=function(A,D,C,B){B=B||{};B.id=B.id||A;B.value=D||"";B.type=C||"text";B.name=A;return this.single_tag_for("input",B)};EJS.Helpers.prototype.is_current_page=function(A){return(window.location.href==A||window.location.pathname==A?true:false)};EJS.Helpers.prototype.link_to=function(B,A,C){if(!B){var B="null"}if(!C){var C={}}if(C.confirm){C.onclick=' var ret_confirm = confirm("'+C.confirm+'"); if(!ret_confirm){ return false;} ';C.confirm=null}C.href=A;return this.start_tag_for("a",C)+B+this.tag_end("a")};EJS.Helpers.prototype.submit_link_to=function(B,A,C){if(!B){var B="null"}if(!C){var C={}}C.onclick=C.onclick||"";if(C.confirm){C.onclick=' var ret_confirm = confirm("'+C.confirm+'"); if(!ret_confirm){ return false;} ';C.confirm=null}C.value=B;C.type="submit";C.onclick=C.onclick+(A?this.url_for(A):"")+"return false;";return this.start_tag_for("input",C)};EJS.Helpers.prototype.link_to_if=function(F,B,A,D,C,E){return this.link_to_unless((F==false),B,A,D,C,E)};EJS.Helpers.prototype.link_to_unless=function(E,B,A,C,D){C=C||{};if(E){if(D&&typeof D=="function"){return D(B,A,C,D)}else{return B}}else{return this.link_to(B,A,C)}};EJS.Helpers.prototype.link_to_unless_current=function(B,A,C,D){C=C||{};return this.link_to_unless(this.is_current_page(A),B,A,C,D)};EJS.Helpers.prototype.password_field_tag=function(A,C,B){return this.input_field_tag(A,C,"password",B)};EJS.Helpers.prototype.select_tag=function(D,G,H,F){F=F||{};F.id=F.id||D;F.value=G;F.name=D;var B="";B+=this.start_tag_for("select",F);for(var E=0;E<H.length;E++){var C=H[E];var A={value:C.value};if(C.value==G){A.selected="selected"}B+=this.start_tag_for("option",A)+C.text+this.tag_end("option")}B+=this.tag_end("select");return B};EJS.Helpers.prototype.single_tag_for=function(A,B){return this.tag(A,B,"/>")};EJS.Helpers.prototype.start_tag_for=function(A,B){return this.tag(A,B)};EJS.Helpers.prototype.submit_tag=function(A,B){B=B||{};B.type=B.type||"submit";B.value=A||"Submit";return this.single_tag_for("input",B)};EJS.Helpers.prototype.tag=function(C,E,D){if(!D){var D=">"}var B=" ";for(var A in E){if(E[A]!=null){var F=E[A].toString()}else{var F=""}if(A=="Class"){A="class"}if(F.indexOf("'")!=-1){B+=A+'="'+F+'" '}else{B+=A+"='"+F+"' "}}return"<"+C+B+D};EJS.Helpers.prototype.tag_end=function(A){return"</"+A+">"};EJS.Helpers.prototype.text_area_tag=function(A,C,B){B=B||{};B.id=B.id||A;B.name=B.name||A;C=C||"";if(B.size){B.cols=B.size.split("x")[0];B.rows=B.size.split("x")[1];delete B.size}B.cols=B.cols||50;B.rows=B.rows||4;return this.start_tag_for("textarea",B)+C+this.tag_end("textarea")};EJS.Helpers.prototype.text_tag=EJS.Helpers.prototype.text_area_tag;EJS.Helpers.prototype.text_field_tag=function(A,C,B){return this.input_field_tag(A,C,"text",B)};EJS.Helpers.prototype.url_for=function(A){return'window.location="'+A+'";'};EJS.Helpers.prototype.img_tag=function(B,C,A){A=A||{};A.src=B;A.alt=C;return this.single_tag_for("img",A)}
Index: trunk/prototype/plugins/ejs/view.js
===================================================================
--- trunk/prototype/plugins/ejs/view.js	(revision 5283)
+++ trunk/prototype/plugins/ejs/view.js	(revision 5283)
@@ -0,0 +1,200 @@
+EJS.Helpers.prototype.date_tag = function(name, value , html_options) {
+    if(! (value instanceof Date))
+		value = new Date()
+	
+	var month_names = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
+	var years = [], months = [], days =[];
+	var year = value.getFullYear();
+	var month = value.getMonth();
+	var day = value.getDate();
+	for(var y = year - 15; y < year+15 ; y++)
+	{
+		years.push({value: y, text: y})
+	}
+	for(var m = 0; m < 12; m++)
+	{
+		months.push({value: (m), text: month_names[m]})
+	}
+	for(var d = 0; d < 31; d++)
+	{
+		days.push({value: (d+1), text: (d+1)})
+	}
+	var year_select = this.select_tag(name+'[year]', year, years, {id: name+'[year]'} )
+	var month_select = this.select_tag(name+'[month]', month, months, {id: name+'[month]'})
+	var day_select = this.select_tag(name+'[day]', day, days, {id: name+'[day]'})
+	
+    return year_select+month_select+day_select;
+}
+
+EJS.Helpers.prototype.form_tag = function(action, html_options) {
+                 
+    
+    html_options     = html_options                     || {};
+	html_options.action = action
+    if(html_options.multipart == true) {
+        html_options.method = 'post';
+        html_options.enctype = 'multipart/form-data';
+    }
+    
+    return this.start_tag_for('form', html_options)
+}
+
+EJS.Helpers.prototype.form_tag_end = function() { return this.tag_end('form'); }
+
+EJS.Helpers.prototype.hidden_field_tag   = function(name, value, html_options) { 
+    return this.input_field_tag(name, value, 'hidden', html_options); 
+}
+
+EJS.Helpers.prototype.input_field_tag = function(name, value , inputType, html_options) {
+    
+    html_options = html_options || {};
+    html_options.id  = html_options.id  || name;
+    html_options.value = value || '';
+    html_options.type = inputType || 'text';
+    html_options.name = name;
+    
+    return this.single_tag_for('input', html_options)
+}
+
+EJS.Helpers.prototype.is_current_page = function(url) {
+	return (window.location.href == url || window.location.pathname == url ? true : false);
+}
+
+EJS.Helpers.prototype.link_to = function(name, url, html_options) {
+    if(!name) var name = 'null';
+    if(!html_options) var html_options = {}
+	
+	if(html_options.confirm){
+		html_options.onclick = 
+		" var ret_confirm = confirm(\""+html_options.confirm+"\"); if(!ret_confirm){ return false;} "
+		html_options.confirm = null;
+	}
+    html_options.href=url
+    return this.start_tag_for('a', html_options)+name+ this.tag_end('a');
+}
+
+EJS.Helpers.prototype.submit_link_to = function(name, url, html_options){
+	if(!name) var name = 'null';
+    if(!html_options) var html_options = {}
+    html_options.onclick = html_options.onclick  || '' ;
+	
+	if(html_options.confirm){
+		html_options.onclick = 
+		" var ret_confirm = confirm(\""+html_options.confirm+"\"); if(!ret_confirm){ return false;} "
+		html_options.confirm = null;
+	}
+	
+    html_options.value = name;
+	html_options.type = 'submit'
+    html_options.onclick=html_options.onclick+
+		(url ? this.url_for(url) : '')+'return false;';
+    //html_options.href='#'+(options ? Routes.url_for(options) : '')
+	return this.start_tag_for('input', html_options)
+}
+
+EJS.Helpers.prototype.link_to_if = function(condition, name, url, html_options, post, block) {
+	return this.link_to_unless((condition == false), name, url, html_options, post, block);
+}
+
+EJS.Helpers.prototype.link_to_unless = function(condition, name, url, html_options, block) {
+	html_options = html_options || {};
+	if(condition) {
+		if(block && typeof block == 'function') {
+			return block(name, url, html_options, block);
+		} else {
+			return name;
+		}
+	} else
+		return this.link_to(name, url, html_options);
+}
+
+EJS.Helpers.prototype.link_to_unless_current = function(name, url, html_options, block) {
+	html_options = html_options || {};
+	return this.link_to_unless(this.is_current_page(url), name, url, html_options, block)
+}
+
+
+EJS.Helpers.prototype.password_field_tag = function(name, value, html_options) { return this.input_field_tag(name, value, 'password', html_options); }
+
+EJS.Helpers.prototype.select_tag = function(name, value, choices, html_options) {     
+    html_options = html_options || {};
+    html_options.id  = html_options.id  || name;
+    html_options.value = value;
+	html_options.name = name;
+    
+    var txt = ''
+    txt += this.start_tag_for('select', html_options)
+    
+    for(var i = 0; i < choices.length; i++)
+    {
+        var choice = choices[i];
+        var optionOptions = {value: choice.value}
+        if(choice.value == value)
+            optionOptions.selected ='selected'
+        txt += this.start_tag_for('option', optionOptions )+choice.text+this.tag_end('option')
+    }
+    txt += this.tag_end('select');
+    return txt;
+}
+
+EJS.Helpers.prototype.single_tag_for = function(tag, html_options) { return this.tag(tag, html_options, '/>');}
+
+EJS.Helpers.prototype.start_tag_for = function(tag, html_options)  { return this.tag(tag, html_options); }
+
+EJS.Helpers.prototype.submit_tag = function(name, html_options) {  
+    html_options = html_options || {};
+    //html_options.name  = html_options.id  || 'commit';
+    html_options.type = html_options.type  || 'submit';
+    html_options.value = name || 'Submit';
+    return this.single_tag_for('input', html_options);
+}
+
+EJS.Helpers.prototype.tag = function(tag, html_options, end) {
+    if(!end) var end = '>'
+    var txt = ' '
+    for(var attr in html_options) { 
+	   if(html_options[attr] != null)
+        var value = html_options[attr].toString();
+       else
+        var value=''
+       if(attr == "Class") // special case because "class" is a reserved word in IE
+        attr = "class";
+       if( value.indexOf("'") != -1 )
+            txt += attr+'=\"'+value+'\" ' 
+       else
+            txt += attr+"='"+value+"' " 
+    }
+    return '<'+tag+txt+end;
+}
+
+EJS.Helpers.prototype.tag_end = function(tag)             { return '</'+tag+'>'; }
+
+EJS.Helpers.prototype.text_area_tag = function(name, value, html_options) { 
+    html_options = html_options || {};
+    html_options.id  = html_options.id  || name;
+    html_options.name  = html_options.name  || name;
+	value = value || ''
+    if(html_options.size) {
+        html_options.cols = html_options.size.split('x')[0]
+        html_options.rows = html_options.size.split('x')[1];
+        delete html_options.size
+    }
+    
+    html_options.cols = html_options.cols  || 50;
+    html_options.rows = html_options.rows  || 4;
+    
+    return  this.start_tag_for('textarea', html_options)+value+this.tag_end('textarea')
+}
+EJS.Helpers.prototype.text_tag = EJS.Helpers.prototype.text_area_tag
+
+EJS.Helpers.prototype.text_field_tag     = function(name, value, html_options) { return this.input_field_tag(name, value, 'text', html_options); }
+
+EJS.Helpers.prototype.url_for = function(url) {
+        return 'window.location="'+url+'";'
+}
+EJS.Helpers.prototype.img_tag = function(image_location, alt, options){
+	options = options || {};
+	options.src = image_location
+	options.alt = alt
+	return this.single_tag_for('img', options)
+}
Index: trunk/prototype/plugins/ejs/ejs.js
===================================================================
--- trunk/prototype/plugins/ejs/ejs.js	(revision 5283)
+++ trunk/prototype/plugins/ejs/ejs.js	(revision 5283)
@@ -0,0 +1,505 @@
+(function(){
+    
+
+var rsplit = function(string, regex) {
+	var result = regex.exec(string),retArr = new Array(), first_idx, last_idx, first_bit;
+	while (result != null)
+	{
+		first_idx = result.index; last_idx = regex.lastIndex;
+		if ((first_idx) != 0)
+		{
+			first_bit = string.substring(0,first_idx);
+			retArr.push(string.substring(0,first_idx));
+			string = string.slice(first_idx);
+		}		
+		retArr.push(result[0]);
+		string = string.slice(result[0].length);
+		result = regex.exec(string);	
+	}
+	if (! string == '')
+	{
+		retArr.push(string);
+	}
+	return retArr;
+},
+chop =  function(string){
+    return string.substr(0, string.length - 1);
+},
+extend = function(d, s){
+    for(var n in s){
+        if(s.hasOwnProperty(n))  d[n] = s[n]
+    }
+}
+
+
+EJS = function( options ){
+	options = typeof options == "string" ? {view: options} : options
+    this.set_options(options);
+	if(options.precompiled){
+		this.template = {};
+		this.template.process = options.precompiled;
+		EJS.update(this.name, this);
+		return;
+	}
+    if(options.element)
+	{
+		if(typeof options.element == 'string'){
+			var name = options.element
+			options.element = document.getElementById(  options.element )
+			if(options.element == null) throw name+'does not exist!'
+		}
+		if(options.element.value){
+			this.text = options.element.value
+		}else{
+			this.text = options.element.innerHTML
+		}
+		this.name = options.element.id
+		this.type = '['
+	}else if(options.url){
+        options.url = EJS.endExt(options.url, this.extMatch);
+		this.name = this.name ? this.name : options.url;
+        var url = options.url
+        //options.view = options.absolute_url || options.view || options.;
+		var template = EJS.get(this.name /*url*/, this.cache);
+		if (template) return template;
+	    if (template == EJS.INVALID_PATH) return null;
+        try{
+            this.text = EJS.request( url+(this.cache ? '' : '?'+Math.random() ));
+        }catch(e){}
+
+		if(this.text == null){
+            throw( {type: 'EJS', message: 'There is no template at '+url}  );
+		}
+		//this.name = url;
+	}
+	var template = new EJS.Compiler(this.text, this.type);
+
+	template.compile(options, this.name);
+
+	
+	EJS.update(this.name, this);
+	this.template = template;
+};
+/* @Prototype*/
+EJS.prototype = {
+	/**
+	 * Renders an object with extra view helpers attached to the view.
+	 * @param {Object} object data to be rendered
+	 * @param {Object} extra_helpers an object with additonal view helpers
+	 * @return {String} returns the result of the string
+	 */
+    render : function(object, extra_helpers){
+        object = object || {};
+        this._extra_helpers = extra_helpers;
+		var v = new EJS.Helpers(object, extra_helpers || {});
+		return this.template.process.call(object, object,v);
+	},
+    update : function(element, options){
+        if(typeof element == 'string'){
+			element = document.getElementById(element)
+		}
+		if(options == null){
+			_template = this;
+			return function(object){
+				EJS.prototype.update.call(_template, element, object)
+			}
+		}
+		if(typeof options == 'string'){
+			params = {}
+			params.url = options
+			_template = this;
+			params.onComplete = function(request){
+				var object = eval( request.responseText )
+				EJS.prototype.update.call(_template, element, object)
+			}
+			EJS.ajax_request(params)
+		}else
+		{
+			element.innerHTML = this.render(options)
+		}
+    },
+	out : function(){
+		return this.template.out;
+	},
+    /**
+     * Sets options on this view to be rendered with.
+     * @param {Object} options
+     */
+	set_options : function(options){
+        this.type = options.type || EJS.type;
+		this.cache = options.cache != null ? options.cache : EJS.cache;
+		this.text = options.text || null;
+		this.name =  options.name || null;
+		this.ext = options.ext || EJS.ext;
+		this.extMatch = new RegExp(this.ext.replace(/\./, '\.'));
+	}
+};
+EJS.endExt = function(path, match){
+	if(!path) return null;
+	match.lastIndex = 0
+	return path+ (match.test(path) ? '' : this.ext )
+}
+
+
+
+
+/* @Static*/
+EJS.Scanner = function(source, left, right) {
+	
+    extend(this,
+        {left_delimiter: 	left +'%',
+         right_delimiter: 	'%'+right,
+         double_left: 		left+'%%',
+         double_right:  	'%%'+right,
+         left_equal: 		left+'%=',
+         left_comment: 	left+'%#'})
+
+	this.SplitRegexp = left=='[' ? /(\[%%)|(%%\])|(\[%=)|(\[%#)|(\[%)|(%\]\n)|(%\])|(\n)/ : new RegExp('('+this.double_left+')|(%%'+this.double_right+')|('+this.left_equal+')|('+this.left_comment+')|('+this.left_delimiter+')|('+this.right_delimiter+'\n)|('+this.right_delimiter+')|(\n)') ;
+	
+	this.source = source;
+	this.stag = null;
+	this.lines = 0;
+};
+
+EJS.Scanner.to_text = function(input){
+	if(input == null || input === undefined)
+        return '';
+    if(input instanceof Date)
+		return input.toDateString();
+	if(input.toString) 
+        return input.toString();
+	return '';
+};
+
+EJS.Scanner.prototype = {
+  scan: function(block) {
+     scanline = this.scanline;
+	 regex = this.SplitRegexp;
+	 if (! this.source == '')
+	 {
+	 	 var source_split = rsplit(this.source, /\n/);
+	 	 for(var i=0; i<source_split.length; i++) {
+		 	 var item = source_split[i];
+			 this.scanline(item, regex, block);
+		 }
+	 }
+  },
+  scanline: function(line, regex, block) {
+	 this.lines++;
+	 var line_split = rsplit(line, regex);
+ 	 for(var i=0; i<line_split.length; i++) {
+	   var token = line_split[i];
+       if (token != null) {
+		   	try{
+	         	block(token, this);
+		 	}catch(e){
+				throw {type: 'EJS.Scanner', line: this.lines};
+			}
+       }
+	 }
+  }
+};
+
+
+EJS.Buffer = function(pre_cmd, post_cmd) {
+	this.line = new Array();
+	this.script = "";
+	this.pre_cmd = pre_cmd;
+	this.post_cmd = post_cmd;
+	for (var i=0; i<this.pre_cmd.length; i++)
+	{
+		this.push(pre_cmd[i]);
+	}
+};
+EJS.Buffer.prototype = {
+	
+  push: function(cmd) {
+	this.line.push(cmd);
+  },
+
+  cr: function() {
+	this.script = this.script + this.line.join('; ');
+	this.line = new Array();
+	this.script = this.script + "\n";
+  },
+
+  close: function() {
+	if (this.line.length > 0)
+	{
+		for (var i=0; i<this.post_cmd.length; i++){
+			this.push(pre_cmd[i]);
+		}
+		this.script = this.script + this.line.join('; ');
+		line = null;
+	}
+  }
+ 	
+};
+
+
+EJS.Compiler = function(source, left) {
+    this.pre_cmd = ['var ___ViewO = [];'];
+	this.post_cmd = new Array();
+	this.source = ' ';	
+	if (source != null)
+	{
+		if (typeof source == 'string')
+		{
+		    source = source.replace(/\r\n/g, "\n");
+            source = source.replace(/\r/g,   "\n");
+			this.source = source;
+		}else if (source.innerHTML){
+			this.source = source.innerHTML;
+		} 
+		if (typeof this.source != 'string'){
+			this.source = "";
+		}
+	}
+	left = left || '<';
+	var right = '>';
+	switch(left) {
+		case '[':
+			right = ']';
+			break;
+		case '<':
+			break;
+		default:
+			throw left+' is not a supported deliminator';
+			break;
+	}
+	this.scanner = new EJS.Scanner(this.source, left, right);
+	this.out = '';
+};
+EJS.Compiler.prototype = {
+  compile: function(options, name) {
+  	options = options || {};
+	this.out = '';
+	var put_cmd = "___ViewO.push(";
+	var insert_cmd = put_cmd;
+	var buff = new EJS.Buffer(this.pre_cmd, this.post_cmd);		
+	var content = '';
+	var clean = function(content)
+	{
+	    content = content.replace(/\\/g, '\\\\');
+        content = content.replace(/\n/g, '\\n');
+        content = content.replace(/"/g,  '\\"');
+        return content;
+	};
+	this.scanner.scan(function(token, scanner) {
+		if (scanner.stag == null)
+		{
+			switch(token) {
+				case '\n':
+					content = content + "\n";
+					buff.push(put_cmd + '"' + clean(content) + '");');
+					buff.cr();
+					content = '';
+					break;
+				case scanner.left_delimiter:
+				case scanner.left_equal:
+				case scanner.left_comment:
+					scanner.stag = token;
+					if (content.length > 0)
+					{
+						buff.push(put_cmd + '"' + clean(content) + '")');
+					}
+					content = '';
+					break;
+				case scanner.double_left:
+					content = content + scanner.left_delimiter;
+					break;
+				default:
+					content = content + token;
+					break;
+			}
+		}
+		else {
+			switch(token) {
+				case scanner.right_delimiter:
+					switch(scanner.stag) {
+						case scanner.left_delimiter:
+							if (content[content.length - 1] == '\n')
+							{
+								content = chop(content);
+								buff.push(content);
+								buff.cr();
+							}
+							else {
+								buff.push(content);
+							}
+							break;
+						case scanner.left_equal:
+							buff.push(insert_cmd + "(EJS.Scanner.to_text(" + content + ")))");
+							break;
+					}
+					scanner.stag = null;
+					content = '';
+					break;
+				case scanner.double_right:
+					content = content + scanner.right_delimiter;
+					break;
+				default:
+					content = content + token;
+					break;
+			}
+		}
+	});
+	if (content.length > 0)
+	{
+		// Chould be content.dump in Ruby
+		buff.push(put_cmd + '"' + clean(content) + '")');
+	}
+	buff.close();
+	this.out = buff.script + ";";
+	var to_be_evaled = '/*'+name+'*/this.process = function(_CONTEXT,_VIEW) { try { with(_VIEW) { with (_CONTEXT) {'+this.out+" return ___ViewO.join('');}}}catch(e){e.lineNumber=null;throw e;}};";
+	
+	try{
+		eval(to_be_evaled);
+	}catch(e){
+		if(typeof JSLINT != 'undefined'){
+			JSLINT(this.out);
+			for(var i = 0; i < JSLINT.errors.length; i++){
+				var error = JSLINT.errors[i];
+				if(error.reason != "Unnecessary semicolon."){
+					error.line++;
+					var e = new Error();
+					e.lineNumber = error.line;
+					e.message = error.reason;
+					if(options.view)
+						e.fileName = options.view;
+					throw e;
+				}
+			}
+		}else{
+			throw e;
+		}
+	}
+  }
+};
+
+
+//type, cache, folder
+/**
+ * Sets default options for all views
+ * @param {Object} options Set view with the following options
+ * <table class="options">
+				<tbody><tr><th>Option</th><th>Default</th><th>Description</th></tr>
+				<tr>
+					<td>type</td>
+					<td>'<'</td>
+					<td>type of magic tags.  Options are '&lt;' or '['
+					</td>
+				</tr>
+				<tr>
+					<td>cache</td>
+					<td>true in production mode, false in other modes</td>
+					<td>true to cache template.
+					</td>
+				</tr>
+	</tbody></table>
+ * 
+ */
+EJS.config = function(options){
+	EJS.cache = options.cache != null ? options.cache : EJS.cache;
+	EJS.type = options.type != null ? options.type : EJS.type;
+	EJS.ext = options.ext != null ? options.ext : EJS.ext;
+	
+	var templates_directory = EJS.templates_directory || {}; //nice and private container
+	EJS.templates_directory = templates_directory;
+	EJS.get = function(path, cache){
+		if(cache == false) return null;
+		if(templates_directory[path]) return templates_directory[path];
+  		return null;
+	};
+	
+	EJS.update = function(path, template) { 
+		if(path == null) return;
+		templates_directory[path] = template ;
+	};
+	
+	EJS.INVALID_PATH =  -1;
+};
+EJS.config( {cache: true, type: '<', ext: '.ejs' } );
+
+
+
+/**
+ * @constructor
+ * By adding functions to EJS.Helpers.prototype, those functions will be available in the 
+ * views.
+ * @init Creates a view helper.  This function is called internally.  You should never call it.
+ * @param {Object} data The data passed to the view.  Helpers have access to it through this._data
+ */
+EJS.Helpers = function(data, extras){
+	this._data = data;
+    this._extras = extras;
+    extend(this, extras );
+};
+/* @prototype*/
+EJS.Helpers.prototype = {
+    /**
+     * Renders a new view.  If data is passed in, uses that to render the view.
+     * @param {Object} options standard options passed to a new view.
+     * @param {optional:Object} data
+     * @return {String}
+     */
+	view: function(options, data, helpers){
+        if(!helpers) helpers = this._extras
+		if(!data) data = this._data;
+		return new EJS(options).render(data, helpers);
+	},
+    /**
+     * For a given value, tries to create a human representation.
+     * @param {Object} input the value being converted.
+     * @param {Object} null_text what text should be present if input == null or undefined, defaults to ''
+     * @return {String} 
+     */
+	to_text: function(input, null_text) {
+	    if(input == null || input === undefined) return null_text || '';
+	    if(input instanceof Date) return input.toDateString();
+		if(input.toString) return input.toString().replace(/\n/g, '<br />').replace(/''/g, "'");
+		return '';
+	}
+};
+    EJS.newRequest = function(){
+	   var factories = [function() { return new ActiveXObject("Msxml2.XMLHTTP"); },function() { return new XMLHttpRequest(); },function() { return new ActiveXObject("Microsoft.XMLHTTP"); }];
+	   for(var i = 0; i < factories.length; i++) {
+	        try {
+	            var request = factories[i]();
+	            if (request != null)  return request;
+	        }
+	        catch(e) { continue;}
+	   }
+	}
+	
+	EJS.request = function(path){
+	   var request = new EJS.newRequest()
+	   request.open("GET", path, false);
+	   
+	   try{request.send(null);}
+	   catch(e){return null;}
+	   
+	   if ( request.status == 404 || request.status == 2 ||(request.status == 0 && request.responseText == '') ) return null;
+	   
+	   return request.responseText
+	}
+	EJS.ajax_request = function(params){
+		params.method = ( params.method ? params.method : 'GET')
+		
+		var request = new EJS.newRequest();
+		request.onreadystatechange = function(){
+			if(request.readyState == 4){
+				if(request.status == 200){
+					params.onComplete(request)
+				}else
+				{
+					params.onComplete(request)
+				}
+			}
+		}
+		request.open(params.method, params.url)
+		request.send(null)
+	}
+
+
+})();
Index: trunk/prototype/plugins/fgmenu/menuContent.html
===================================================================
--- trunk/prototype/plugins/fgmenu/menuContent.html	(revision 5341)
+++ trunk/prototype/plugins/fgmenu/menuContent.html	(revision 5341)
@@ -0,0 +1,160 @@
+<ul>
+	<li><a href="#">Breaking News</a>
+		<ul>
+			<li><a href="#">Entertainment</a></li>
+			<li><a href="#">Politics</a></li>
+			<li><a href="#">A&amp;E</a></li>
+			<li><a href="#">Sports</a>
+				<ul>
+					<li><a href="#">Baseball</a></li>
+					<li><a href="#">Basketball</a></li>
+					<li><a href="#">A really long label would wrap nicely as you can see</a></li>
+					<li><a href="#">Swimming</a>
+						<ul>
+							<li><a href="#">High School</a></li>
+							<li><a href="#">College</a></li>
+							<li><a href="#">Professional</a>
+								<ul>
+									<li><a href="#">Mens Swimming</a>
+										<ul>
+											<li><a href="#">News</a></li>
+											<li><a href="#">Events</a></li>
+											<li><a href="#">Awards</a></li>
+											<li><a href="#">Schedule</a></li>
+											<li><a href="#">Team Members</a></li>
+											<li><a href="#">Fan Site</a></li>
+										</ul>
+									</li>
+									<li><a href="#">Womens Swimming</a>
+										<ul>
+											<li><a href="#">News</a></li>
+											<li><a href="#">Events</a></li>
+											<li><a href="#">Awards</a></li>
+											<li><a href="#">Schedule</a></li>
+											<li><a href="#">Team Members</a></li>
+											<li><a href="#">Fan Site</a></li>
+										</ul>
+									</li>
+								</ul>
+							</li>
+							<li><a href="#">Adult Recreational</a></li>
+							<li><a href="#">Youth Recreational</a></li>
+							<li><a href="#">Senior Recreational</a></li>
+						</ul>
+					</li>
+					<li><a href="#">Tennis</a></li>
+					<li><a href="#">Ice Skating</a></li>
+					<li><a href="#">Javascript Programming</a></li>
+					<li><a href="#">Running</a></li>
+					<li><a href="#">Walking</a></li>
+				</ul>
+			</li>
+			<li><a href="#">Local</a></li>
+			<li><a href="#">Health</a></li>
+		</ul>
+	</li>
+	<li><a href="#">Entertainment</a>
+	<ul>
+		<li><a href="#">Celebrity news</a></li>
+		<li><a href="#">Gossip</a></li>
+		<li><a href="#">Movies</a></li>
+		<li><a href="#">Music</a>
+		<ul>
+			<li><a href="#">Alternative</a></li>
+			<li><a href="#">Country</a></li>
+			<li><a href="#">Dance</a></li>
+			<li><a href="#">Electronica</a></li>
+			<li><a href="#">Metal</a></li>
+			<li><a href="#">Pop</a></li>
+			<li><a href="#">Rock</a>
+				<ul>
+					<li><a href="#">Bands</a>
+						<ul>
+							<li><a href="#">Dokken</a></li>
+						</ul>
+					</li>
+					<li><a href="#">Fan Clubs</a></li>
+					<li><a href="#">Songs</a></li>
+				</ul>
+			</li>
+		</ul>
+		</li>
+		<li><a href="#">Slide shows</a></li>
+		<li><a href="#">Red carpet</a></li>
+	</ul>
+	</li>
+	<li><a href="#">Finance</a>
+	<ul>
+		<li><a href="#">Personal</a>
+		<ul>
+			<li><a href="#">Loans</a></li>
+			<li><a href="#">Savings</a></li>
+			<li><a href="#">Mortgage</a></li>
+			<li><a href="#">Debt</a></li>
+		</ul>
+		</li>
+		<li><a href="#">Business</a></li>
+	</ul>
+	</li>
+	<li><a href="#">Food &#38; Cooking</a>
+	<ul>
+		<li><a href="#">Breakfast</a></li>
+		<li><a href="#">Lunch</a></li>
+		<li><a href="#">Dinner</a></li>
+		<li><a href="#">Dessert</a>
+			<ul>
+				<li><a href="#">Dump Cake</a></li>
+				<li><a href="#">Doritos</a></li>
+				<li><a href="#">Both please.</a></li>
+			</ul>
+		</li>
+	</ul>
+	</li>
+	<li><a href="#">Lifestyle</a></li>
+	<li><a href="#">News</a></li>
+	<li><a href="#">Politics</a></li>
+	<li><a href="#">Sports</a>
+		<ul>
+			<li><a href="#">Baseball</a></li>
+			<li><a href="#">Basketball</a></li>
+			<li><a href="#">Swimming</a>
+			<ul>
+				<li><a href="#">High School</a></li>
+				<li><a href="#">College</a></li>
+				<li><a href="#">Professional</a>
+				<ul>
+					<li><a href="#">Mens Swimming</a>
+					<ul>
+							<li><a href="#">News</a></li>
+							<li><a href="#">Events</a></li>
+							<li><a href="#">Awards</a></li>
+							<li><a href="#">Schedule</a></li>
+							<li><a href="#">Team Members</a></li>
+							<li><a href="#">Fan Site</a></li>
+						</ul>
+					</li>
+					<li><a href="#">Womens Swimming</a>
+					<ul>
+						<li><a href="#">News</a></li>
+						<li><a href="#">Events</a></li>
+						<li><a href="#">Awards</a></li>
+						<li><a href="#">Schedule</a></li>
+						<li><a href="#">Team Members</a></li>
+						<li><a href="#">Fan Site</a></li>
+					</ul>
+					</li>
+				</ul>
+				</li>
+				<li><a href="#">Adult Recreational</a></li>
+				<li><a href="#">Youth Recreational</a></li>
+				<li><a href="#">Senior Recreational</a></li>
+			</ul>
+			</li>
+			<li><a href="#">Tennis</a></li>
+			<li><a href="#">Ice Skating</a></li>
+			<li><a href="#">Javascript Programming</a></li>
+			<li><a href="#">Running</a></li>
+			<li><a href="#">Walking</a></li>
+		</ul>
+		</li>
+</ul>
Index: trunk/prototype/plugins/fgmenu/theme/ui.dialog.css
===================================================================
--- trunk/prototype/plugins/fgmenu/theme/ui.dialog.css	(revision 5341)
+++ trunk/prototype/plugins/fgmenu/theme/ui.dialog.css	(revision 5341)
@@ -0,0 +1,13 @@
+/* Dialog
+----------------------------------*/
+.ui-dialog { position: relative; padding: .2em; width: 300px; }
+.ui-dialog .ui-dialog-titlebar { padding: .5em .3em .3em 1em; position: relative;  }
+.ui-dialog .ui-dialog-title { float: left; margin: .1em 0 .2em; } 
+.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
+.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
+.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
+.ui-dialog .ui-dialog-content { border: 0; padding: .5em 1em; background: none; overflow: auto; }
+.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
+.ui-dialog .ui-dialog-buttonpane button { float: right; margin: .5em .4em .5em 0; cursor: pointer; padding: .2em .6em .3em .6em; line-height: 1.4em; width:auto; overflow:visible; }
+.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
+.ui-draggable .ui-dialog-titlebar { cursor: move; }
Index: trunk/prototype/plugins/fgmenu/theme/ui.resizable.css
===================================================================
--- trunk/prototype/plugins/fgmenu/theme/ui.resizable.css	(revision 5341)
+++ trunk/prototype/plugins/fgmenu/theme/ui.resizable.css	(revision 5341)
@@ -0,0 +1,13 @@
+/* Resizable
+----------------------------------*/
+.ui-resizable { position: relative;}
+.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;}
+.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
+.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0px; }
+.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0px; }
+.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0px; height: 100%; }
+.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0px; height: 100%; }
+.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
+.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
+.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
+.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}
Index: trunk/prototype/plugins/fgmenu/theme/ui.accordion.css
===================================================================
--- trunk/prototype/plugins/fgmenu/theme/ui.accordion.css	(revision 5341)
+++ trunk/prototype/plugins/fgmenu/theme/ui.accordion.css	(revision 5341)
@@ -0,0 +1,9 @@
+/* Accordion
+----------------------------------*/
+.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
+.ui-accordion li {display: inline;}
+.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }
+.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em 2.2em; }
+.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
+.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; }
+.ui-accordion .ui-accordion-content-active { display: block; }
Index: trunk/prototype/plugins/fgmenu/theme/ui.slider.css
===================================================================
--- trunk/prototype/plugins/fgmenu/theme/ui.slider.css	(revision 5341)
+++ trunk/prototype/plugins/fgmenu/theme/ui.slider.css	(revision 5341)
@@ -0,0 +1,17 @@
+/* Slider
+----------------------------------*/
+.ui-slider { position: relative; text-align: left; }
+.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
+.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: 1%; display: block; border: 0; }
+
+.ui-slider-horizontal { height: .8em; }
+.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
+.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
+.ui-slider-horizontal .ui-slider-range-min { left: 0; }
+.ui-slider-horizontal .ui-slider-range-max { right: 0; }
+
+.ui-slider-vertical { width: .8em; height: 100px; }
+.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
+.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
+.ui-slider-vertical .ui-slider-range-min { bottom: 0; }
+.ui-slider-vertical .ui-slider-range-max { top: 0; }
Index: trunk/prototype/plugins/fgmenu/theme/ui.theme.css
===================================================================
--- trunk/prototype/plugins/fgmenu/theme/ui.theme.css	(revision 5341)
+++ trunk/prototype/plugins/fgmenu/theme/ui.theme.css	(revision 5341)
@@ -0,0 +1,245 @@
+
+
+/*
+* jQuery UI CSS Framework
+* Copyright (c) 2009 AUTHORS.txt (http://ui.jquery.com/about)
+* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
+* To view and modify this theme, visit http://ui.jquery.com/themeroller/?ffDefault=segoe%20ui,%20Arial,%20sans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=3b3b35&bgTextureHeader=05_inset_soft.png&bgImgOpacityHeader=22&borderColorHeader=59584f&fcHeader=ffffff&iconColorHeader=e7e6e4&bgColorContent=f0efea&bgTextureContent=03_highlight_soft.png&bgImgOpacityContent=100&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=808080&bgColorDefault=327E04&bgTextureDefault=03_highlight_soft.png&bgImgOpacityDefault=25&borderColorDefault=327E04&fcDefault=ffffff&iconColorDefault=eeeeee&bgColorHover=5A9D1A&bgTextureHover=03_highlight_soft.png&bgImgOpacityHover=25&borderColorHover=327E04&fcHover=ffffff&iconColorHover=ffffff&bgColorActive=f0efea&bgTextureActive=07_diagonals_small.png&bgImgOpacityActive=100&borderColorActive=c4c5c3&fcActive=403D38&iconColorActive=8DC262&bgColorHighlight=fcf0ba&bgTextureHighlight=02_glass.png&bgImgOpacityHighlight=55&borderColorHighlight=e8e1b5&fcHighlight=363636&iconColorHighlight=8DC262&bgColorError=ffedad&bgTextureError=03_highlight_soft.png&bgImgOpacityError=95&borderColorError=e3a345&fcError=cd5c0a&iconColorError=cd0a0a&bgColorOverlay=2e2e28&bgTextureOverlay=21_glow_ball.png&bgImgOpacityOverlay=25&opacityOverlay=65&bgColorShadow=f0f0f0&bgTextureShadow=01_flat.png&bgImgOpacityShadow=35&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
+*/
+
+
+/* Component containers
+----------------------------------*/
+.ui-widget { font-family: segoe ui, Arial, sans-serif; font-size: 1.1em; }
+.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: segoe ui, Arial, sans-serif; font-size: 1em; }
+.ui-widget-content { border: 1px solid #aaaaaa; background: #f0efea url(images/ui-bg_highlight-soft_100_f0efea_1x100.png) 50% top repeat-x; color: #222222; }
+.ui-widget-content a { color: #222222; }
+.ui-widget-header { border: 1px solid #59584f; background: #3b3b35 url(images/ui-bg_inset-soft_22_3b3b35_1x100.png) 50% 50% repeat-x; color: #ffffff; font-weight: bold; }
+.ui-widget-header a { color: #ffffff; }
+
+/* Interaction states
+----------------------------------*/
+.ui-state-default, .ui-widget-content .ui-state-default { border: 1px solid #327E04; background: #327E04 url(images/ui-bg_highlight-soft_25_327E04_1x100.png) 50% 50% repeat-x; font-weight: bold; color: #ffffff; outline: none; }
+.ui-state-default a { color: #ffffff; text-decoration: none; outline: none; }
+.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus { border: 1px solid #327E04; background: #5A9D1A url(images/ui-bg_highlight-soft_25_5A9D1A_1x100.png) 50% 50% repeat-x; font-weight: bold; color: #ffffff; outline: none; }
+.ui-state-hover a { color: #ffffff; text-decoration: none; outline: none; }
+.ui-state-active, .ui-widget-content .ui-state-active { border: 1px solid #c4c5c3; background: #f0efea url(images/ui-bg_diagonals-small_100_f0efea_40x40.png) 50% 50% repeat; font-weight: bold; color: #403D38; outline: none; }
+.ui-state-active a { color: #403D38; outline: none; text-decoration: none; }
+
+/* Interaction Cues
+----------------------------------*/
+.ui-state-highlight, .ui-widget-content .ui-state-highlight {border: 1px solid #e8e1b5; background: #fcf0ba url(images/ui-bg_glass_55_fcf0ba_1x400.png) 50% 50% repeat-x; color: #363636; }
+.ui-state-highlight a, .ui-widget-content .ui-state-highlight a { color: #363636; }
+.ui-state-error, .ui-widget-content .ui-state-error {border: 1px solid #e3a345; background: #ffedad url(images/ui-bg_highlight-soft_95_ffedad_1x100.png) 50% top repeat-x; color: #cd5c0a; }
+.ui-state-error a, .ui-widget-content .ui-state-error a { color: #cd5c0a; }
+.ui-state-error-text, .ui-widget-content .ui-state-error-text { color: #cd5c0a; }
+.ui-state-disabled, .ui-widget-content .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
+.ui-priority-primary, .ui-widget-content .ui-priority-primary { font-weight: bold; }
+.ui-priority-secondary, .ui-widget-content .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
+
+/* Icons
+----------------------------------*/
+
+/* states and images */
+.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_808080_256x240.png); }
+.ui-widget-content .ui-icon {background-image: url(images/ui-icons_808080_256x240.png); }
+.ui-widget-header .ui-icon {background-image: url(images/ui-icons_e7e6e4_256x240.png); }
+.ui-state-default .ui-icon { background-image: url(images/ui-icons_eeeeee_256x240.png); }
+.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_ffffff_256x240.png); }
+.ui-state-active .ui-icon {background-image: url(images/ui-icons_8DC262_256x240.png); }
+.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_8DC262_256x240.png); }
+.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); }
+
+/* positioning */
+.ui-icon-carat-1-n { background-position: 0 0; }
+.ui-icon-carat-1-ne { background-position: -16px 0; }
+.ui-icon-carat-1-e { background-position: -32px 0; }
+.ui-icon-carat-1-se { background-position: -48px 0; }
+.ui-icon-carat-1-s { background-position: -64px 0; }
+.ui-icon-carat-1-sw { background-position: -80px 0; }
+.ui-icon-carat-1-w { background-position: -96px 0; }
+.ui-icon-carat-1-nw { background-position: -112px 0; }
+.ui-icon-carat-2-n-s { background-position: -128px 0; }
+.ui-icon-carat-2-e-w { background-position: -144px 0; }
+.ui-icon-triangle-1-n { background-position: 0 -16px; }
+.ui-icon-triangle-1-ne { background-position: -16px -16px; }
+.ui-icon-triangle-1-e { background-position: -32px -16px; }
+.ui-icon-triangle-1-se { background-position: -48px -16px; }
+.ui-icon-triangle-1-s { background-position: -64px -16px; }
+.ui-icon-triangle-1-sw { background-position: -80px -16px; }
+.ui-icon-triangle-1-w { background-position: -96px -16px; }
+.ui-icon-triangle-1-nw { background-position: -112px -16px; }
+.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
+.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
+.ui-icon-arrow-1-n { background-position: 0 -32px; }
+.ui-icon-arrow-1-ne { background-position: -16px -32px; }
+.ui-icon-arrow-1-e { background-position: -32px -32px; }
+.ui-icon-arrow-1-se { background-position: -48px -32px; }
+.ui-icon-arrow-1-s { background-position: -64px -32px; }
+.ui-icon-arrow-1-sw { background-position: -80px -32px; }
+.ui-icon-arrow-1-w { background-position: -96px -32px; }
+.ui-icon-arrow-1-nw { background-position: -112px -32px; }
+.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
+.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
+.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
+.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
+.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
+.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
+.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
+.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
+.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
+.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
+.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
+.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
+.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
+.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
+.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
+.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
+.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
+.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
+.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
+.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
+.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
+.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
+.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
+.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
+.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
+.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
+.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
+.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
+.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
+.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
+.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
+.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
+.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
+.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
+.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
+.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
+.ui-icon-arrow-4 { background-position: 0 -80px; }
+.ui-icon-arrow-4-diag { background-position: -16px -80px; }
+.ui-icon-extlink { background-position: -32px -80px; }
+.ui-icon-newwin { background-position: -48px -80px; }
+.ui-icon-refresh { background-position: -64px -80px; }
+.ui-icon-shuffle { background-position: -80px -80px; }
+.ui-icon-transfer-e-w { background-position: -96px -80px; }
+.ui-icon-transferthick-e-w { background-position: -112px -80px; }
+.ui-icon-folder-collapsed { background-position: 0 -96px; }
+.ui-icon-folder-open { background-position: -16px -96px; }
+.ui-icon-document { background-position: -32px -96px; }
+.ui-icon-document-b { background-position: -48px -96px; }
+.ui-icon-note { background-position: -64px -96px; }
+.ui-icon-mail-closed { background-position: -80px -96px; }
+.ui-icon-mail-open { background-position: -96px -96px; }
+.ui-icon-suitcase { background-position: -112px -96px; }
+.ui-icon-comment { background-position: -128px -96px; }
+.ui-icon-person { background-position: -144px -96px; }
+.ui-icon-print { background-position: -160px -96px; }
+.ui-icon-trash { background-position: -176px -96px; }
+.ui-icon-locked { background-position: -192px -96px; }
+.ui-icon-unlocked { background-position: -208px -96px; }
+.ui-icon-bookmark { background-position: -224px -96px; }
+.ui-icon-tag { background-position: -240px -96px; }
+.ui-icon-home { background-position: 0 -112px; }
+.ui-icon-flag { background-position: -16px -112px; }
+.ui-icon-calendar { background-position: -32px -112px; }
+.ui-icon-cart { background-position: -48px -112px; }
+.ui-icon-pencil { background-position: -64px -112px; }
+.ui-icon-clock { background-position: -80px -112px; }
+.ui-icon-disk { background-position: -96px -112px; }
+.ui-icon-calculator { background-position: -112px -112px; }
+.ui-icon-zoomin { background-position: -128px -112px; }
+.ui-icon-zoomout { background-position: -144px -112px; }
+.ui-icon-search { background-position: -160px -112px; }
+.ui-icon-wrench { background-position: -176px -112px; }
+.ui-icon-gear { background-position: -192px -112px; }
+.ui-icon-heart { background-position: -208px -112px; }
+.ui-icon-star { background-position: -224px -112px; }
+.ui-icon-link { background-position: -240px -112px; }
+.ui-icon-cancel { background-position: 0 -128px; }
+.ui-icon-plus { background-position: -16px -128px; }
+.ui-icon-plusthick { background-position: -32px -128px; }
+.ui-icon-minus { background-position: -48px -128px; }
+.ui-icon-minusthick { background-position: -64px -128px; }
+.ui-icon-close { background-position: -80px -128px; }
+.ui-icon-closethick { background-position: -96px -128px; }
+.ui-icon-key { background-position: -112px -128px; }
+.ui-icon-lightbulb { background-position: -128px -128px; }
+.ui-icon-scissors { background-position: -144px -128px; }
+.ui-icon-clipboard { background-position: -160px -128px; }
+.ui-icon-copy { background-position: -176px -128px; }
+.ui-icon-contact { background-position: -192px -128px; }
+.ui-icon-image { background-position: -208px -128px; }
+.ui-icon-video { background-position: -224px -128px; }
+.ui-icon-script { background-position: -240px -128px; }
+.ui-icon-alert { background-position: 0 -144px; }
+.ui-icon-info { background-position: -16px -144px; }
+.ui-icon-notice { background-position: -32px -144px; }
+.ui-icon-help { background-position: -48px -144px; }
+.ui-icon-check { background-position: -64px -144px; }
+.ui-icon-bullet { background-position: -80px -144px; }
+.ui-icon-radio-off { background-position: -96px -144px; }
+.ui-icon-radio-on { background-position: -112px -144px; }
+.ui-icon-pin-w { background-position: -128px -144px; }
+.ui-icon-pin-s { background-position: -144px -144px; }
+.ui-icon-play { background-position: 0 -160px; }
+.ui-icon-pause { background-position: -16px -160px; }
+.ui-icon-seek-next { background-position: -32px -160px; }
+.ui-icon-seek-prev { background-position: -48px -160px; }
+.ui-icon-seek-end { background-position: -64px -160px; }
+.ui-icon-seek-first { background-position: -80px -160px; }
+.ui-icon-stop { background-position: -96px -160px; }
+.ui-icon-eject { background-position: -112px -160px; }
+.ui-icon-volume-off { background-position: -128px -160px; }
+.ui-icon-volume-on { background-position: -144px -160px; }
+.ui-icon-power { background-position: 0 -176px; }
+.ui-icon-signal-diag { background-position: -16px -176px; }
+.ui-icon-signal { background-position: -32px -176px; }
+.ui-icon-battery-0 { background-position: -48px -176px; }
+.ui-icon-battery-1 { background-position: -64px -176px; }
+.ui-icon-battery-2 { background-position: -80px -176px; }
+.ui-icon-battery-3 { background-position: -96px -176px; }
+.ui-icon-circle-plus { background-position: 0 -192px; }
+.ui-icon-circle-minus { background-position: -16px -192px; }
+.ui-icon-circle-close { background-position: -32px -192px; }
+.ui-icon-circle-triangle-e { background-position: -48px -192px; }
+.ui-icon-circle-triangle-s { background-position: -64px -192px; }
+.ui-icon-circle-triangle-w { background-position: -80px -192px; }
+.ui-icon-circle-triangle-n { background-position: -96px -192px; }
+.ui-icon-circle-arrow-e { background-position: -112px -192px; }
+.ui-icon-circle-arrow-s { background-position: -128px -192px; }
+.ui-icon-circle-arrow-w { background-position: -144px -192px; }
+.ui-icon-circle-arrow-n { background-position: -160px -192px; }
+.ui-icon-circle-zoomin { background-position: -176px -192px; }
+.ui-icon-circle-zoomout { background-position: -192px -192px; }
+.ui-icon-circle-check { background-position: -208px -192px; }
+.ui-icon-circlesmall-plus { background-position: 0 -208px; }
+.ui-icon-circlesmall-minus { background-position: -16px -208px; }
+.ui-icon-circlesmall-close { background-position: -32px -208px; }
+.ui-icon-squaresmall-plus { background-position: -48px -208px; }
+.ui-icon-squaresmall-minus { background-position: -64px -208px; }
+.ui-icon-squaresmall-close { background-position: -80px -208px; }
+.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
+.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
+.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
+.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
+.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
+.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
+
+
+/* Misc visuals
+----------------------------------*/
+
+/* Corner radius */
+.ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; }
+.ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; }
+.ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; }
+.ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; }
+.ui-corner-top { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; }
+.ui-corner-bottom { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; }
+.ui-corner-right {  -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; }
+.ui-corner-left { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; }
+.ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; }
+
+/* Overlays */
+.ui-widget-overlay { background: #2e2e28 url(images/ui-bg_glow-ball_25_2e2e28_600x600.png) 50% 35% repeat-x; opacity: .65;filter:Alpha(Opacity=65); }
+.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #f0f0f0 url(images/ui-bg_flat_35_f0f0f0_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -webkit-border-radius: 8px; }
Index: trunk/prototype/plugins/fgmenu/theme/ui.all.css
===================================================================
--- trunk/prototype/plugins/fgmenu/theme/ui.all.css	(revision 5341)
+++ trunk/prototype/plugins/fgmenu/theme/ui.all.css	(revision 5341)
@@ -0,0 +1,2 @@
+@import "ui.base.css";
+@import "ui.theme.css";
Index: trunk/prototype/plugins/fgmenu/theme/ui.core.css
===================================================================
--- trunk/prototype/plugins/fgmenu/theme/ui.core.css	(revision 5341)
+++ trunk/prototype/plugins/fgmenu/theme/ui.core.css	(revision 5341)
@@ -0,0 +1,37 @@
+/*
+* jQuery UI CSS Framework
+* Copyright (c) 2009 AUTHORS.txt (http://ui.jquery.com/about)
+* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
+*/
+
+/* Layout helpers
+----------------------------------*/
+.ui-helper-hidden { display: none; }
+.ui-helper-hidden-accessible { position: absolute; left: -99999999px; }
+.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
+.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
+.ui-helper-clearfix { display: inline-block; }
+/* required comment for clearfix to work in Opera \*/
+* html .ui-helper-clearfix { height:1%; }
+.ui-helper-clearfix { display:block; }
+/* end clearfix */
+.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
+
+
+/* Interaction Cues
+----------------------------------*/
+.ui-state-disabled { cursor: default !important; }
+
+
+/* Icons
+----------------------------------*/
+
+/* states and images */
+.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
+
+
+/* Misc visuals
+----------------------------------*/
+
+/* Overlays */
+.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
Index: trunk/prototype/plugins/fgmenu/theme/ui.progressbar.css
===================================================================
--- trunk/prototype/plugins/fgmenu/theme/ui.progressbar.css	(revision 5341)
+++ trunk/prototype/plugins/fgmenu/theme/ui.progressbar.css	(revision 5341)
@@ -0,0 +1,4 @@
+/* Progressbar
+----------------------------------*/
+.ui-progressbar { height:2em; text-align: left; }
+.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }
Index: trunk/prototype/plugins/fgmenu/theme/ui.tabs.css
===================================================================
--- trunk/prototype/plugins/fgmenu/theme/ui.tabs.css	(revision 5341)
+++ trunk/prototype/plugins/fgmenu/theme/ui.tabs.css	(revision 5341)
@@ -0,0 +1,9 @@
+/* Tabs
+----------------------------------*/
+.ui-tabs {padding: .2em;}
+.ui-tabs .ui-tabs-nav { padding: .2em .2em 0 .2em;  position: relative; }
+.ui-tabs .ui-tabs-nav li { float: left; border-bottom: 0 !important; margin: 0 .2em -1px 0; padding: 0; list-style: none; }
+.ui-tabs .ui-tabs-nav li a { display:block; text-decoration: none; padding: .5em 1em; }
+.ui-tabs .ui-tabs-nav li.ui-tabs-selected {  padding-bottom: .1em; border-bottom: 0; }
+.ui-tabs .ui-tabs-panel { padding: 1em 1.4em;  display: block; border: 0; background: none; }
+.ui-tabs .ui-tabs-hide { display: none !important; }
Index: trunk/prototype/plugins/fgmenu/theme/ui.base.css
===================================================================
--- trunk/prototype/plugins/fgmenu/theme/ui.base.css	(revision 5341)
+++ trunk/prototype/plugins/fgmenu/theme/ui.base.css	(revision 5341)
@@ -0,0 +1,9 @@
+@import url("ui.core.css");
+
+@import url("ui.accordion.css");
+@import url("ui.datepicker.css");
+@import url("ui.dialog.css");
+@import url("ui.progressbar.css");
+@import url("ui.resizable.css");
+@import url("ui.slider.css");
+@import url("ui.tabs.css");
Index: trunk/prototype/plugins/fgmenu/theme/ui.datepicker.css
===================================================================
--- trunk/prototype/plugins/fgmenu/theme/ui.datepicker.css	(revision 5341)
+++ trunk/prototype/plugins/fgmenu/theme/ui.datepicker.css	(revision 5341)
@@ -0,0 +1,62 @@
+/* Datepicker
+----------------------------------*/
+.ui-datepicker { width: 17em; padding: .2em .2em 0; }
+.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
+.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
+.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
+.ui-datepicker .ui-datepicker-prev { left:2px; }
+.ui-datepicker .ui-datepicker-next { right:2px; }
+.ui-datepicker .ui-datepicker-prev-hover { left:1px; }
+.ui-datepicker .ui-datepicker-next-hover { right:1px; }
+.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px;  }
+.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
+.ui-datepicker .ui-datepicker-title select { float:left; font-size:1em; margin:1px 0; }
+.ui-datepicker select.ui-datepicker-month-year {width: 100%;}
+.ui-datepicker select.ui-datepicker-month, 
+.ui-datepicker select.ui-datepicker-year { width: 49%;}
+.ui-datepicker .ui-datepicker-title select.ui-datepicker-year { float: right; }
+.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
+.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0;  }
+.ui-datepicker td { border: 0; padding: 1px; }
+.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
+.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
+.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
+.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
+
+/* with multiple calendars */
+.ui-datepicker.ui-datepicker-multi { width:auto; }
+.ui-datepicker-multi .ui-datepicker-group { float:left; }
+.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
+.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
+.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
+.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
+.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
+.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
+.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
+.ui-datepicker-row-break { clear:left; width:100%; }
+
+/* RTL support */
+.ui-datepicker-rtl { direction: rtl; }
+.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
+.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
+.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
+.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
+.ui-datepicker-rtl .ui-datepicker-group { float:right; }
+.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
+.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
+
+/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
+.ui-datepicker-cover {
+    display: none; /*sorry for IE5*/
+    display/**/: block; /*sorry for IE5*/
+    position: absolute; /*must have*/
+    z-index: -1; /*must have*/
+    filter: mask(); /*must have*/
+    top: -4px; /*must have*/
+    left: -4px; /*must have*/
+    width: 200px; /*must have*/
+    height: 200px; /*must have*/
+}
Index: trunk/prototype/plugins/fgmenu/fg.menu.css
===================================================================
--- trunk/prototype/plugins/fgmenu/fg.menu.css	(revision 5341)
+++ trunk/prototype/plugins/fgmenu/fg.menu.css	(revision 5341)
@@ -0,0 +1,114 @@
+/* Styles for jQuery menu widget
+Author:	Maggie Wachs, maggie@filamentgroup.com
+Date:		September 2008
+*/
+
+
+/* REQUIRED STYLES - the menus will only render correctly with these rules */	
+
+.fg-menu-container { position: absolute; top:0; left:-999px; padding: .4em;  overflow: hidden; }
+.fg-menu-container.fg-menu-flyout { overflow: visible; }
+
+.fg-menu, .fg-menu ul { list-style-type:none; padding: 0; margin:0; }
+
+.fg-menu { position:relative; }
+.fg-menu-flyout .fg-menu { position:static; }
+
+.fg-menu ul { position:absolute; top:0; }
+.fg-menu ul ul { top:-1px; }
+
+.fg-menu-container.fg-menu-ipod .fg-menu-content, 
+.fg-menu-container.fg-menu-ipod .fg-menu-content ul { background: none !important; }
+
+.fg-menu.fg-menu-scroll,
+.fg-menu ul.fg-menu-scroll { overflow: scroll;  overflow-x: hidden; }
+
+.fg-menu li { clear:both; float:left; width:100%; margin: 0; padding:0; border: 0; }	
+.fg-menu li li { font-size:1em; } /* inner li font size must be reset so that they don't blow up */
+
+.fg-menu-flyout ul ul { padding: .4em; }
+.fg-menu-flyout li { position:relative; }
+
+.fg-menu-scroll { overflow: scroll; overflow-x: hidden; }
+
+.fg-menu-breadcrumb { margin: 0; padding: 0; }
+
+.fg-menu-footer {  margin-top: .4em; padding: .4em; }
+.fg-menu-header {  margin-bottom: .4em; padding: .4em; }
+
+.fg-menu-breadcrumb li { float: left; list-style: none; margin: 0; padding: 0 .2em; font-size: .9em; opacity: .7; }
+.fg-menu-breadcrumb li.fg-menu-prev-list,
+.fg-menu-breadcrumb li.fg-menu-current-crumb { clear: left; float: none; opacity: 1; }
+.fg-menu-breadcrumb li.fg-menu-current-crumb { padding-top: .2em; }
+
+.fg-menu-breadcrumb a, 
+.fg-menu-breadcrumb span { float: left; }
+
+.fg-menu-footer a:link,
+.fg-menu-footer a:visited { float:left; width:100%; text-decoration: none; }
+.fg-menu-footer a:hover,
+.fg-menu-footer a:active {  }
+
+.fg-menu-footer a span { float:left; cursor: pointer; }
+
+.fg-menu-breadcrumb .fg-menu-prev-list a:link,
+.fg-menu-breadcrumb .fg-menu-prev-list a:visited,
+.fg-menu-breadcrumb .fg-menu-prev-list a:hover,
+.fg-menu-breadcrumb .fg-menu-prev-list a:active { background-image: none; text-decoration:none; }
+	
+.fg-menu-breadcrumb .fg-menu-prev-list a { float: left; padding-right: .4em; }
+.fg-menu-breadcrumb .fg-menu-prev-list a .ui-icon { float: left; }
+	
+.fg-menu-breadcrumb .fg-menu-current-crumb a:link,
+.fg-menu-breadcrumb .fg-menu-current-crumb a:visited,
+.fg-menu-breadcrumb .fg-menu-current-crumb a:hover,
+.fg-menu-breadcrumb .fg-menu-current-crumb a:active { display:block; background-image:none; font-size:1.3em; text-decoration:none; }
+
+
+
+/* REQUIRED LINK STYLES: links are "display:block" by default; if the menu options are split into 
+	selectable node links and 'next' links, the script floats the node links left and floats the 'next' links to the right	*/
+
+.fg-menu a:link,
+.fg-menu a:visited,
+.fg-menu a:hover,
+.fg-menu a:active { float:left; width:92%; padding:.3em 3%; text-decoration:none; outline: 0 !important; }
+
+.fg-menu a { border: 1px dashed transparent; }
+
+.fg-menu a.ui-state-default:link,
+.fg-menu a.ui-state-default:visited,
+.fg-menu a.ui-state-default:hover,
+.fg-menu a.ui-state-default:active,
+.fg-menu a.ui-state-hover:link,
+.fg-menu a.ui-state-hover:visited,
+.fg-menu a.ui-state-hover:hover,
+.fg-menu a.ui-state-hover:active,
+ .fg-menu a.ui-state-active:link,
+ .fg-menu a.ui-state-active:visited,
+ .fg-menu a.ui-state-active:hover,
+.fg-menu a.ui-state-active:active { border-style: solid; font-weight: normal; }
+
+.fg-menu a span { display:block; cursor:pointer; }
+
+
+ /* SUGGESTED STYLES - for use with jQuery UI Themeroller CSS */	
+ 
+.fg-menu-indicator span { float:left; }
+.fg-menu-indicator span.ui-icon { float:right; }
+
+.fg-menu-content.ui-widget-content, 
+.fg-menu-content ul.ui-widget-content { border:0; }
+
+
+/* ICONS AND DIVIDERS */
+
+.fg-menu.fg-menu-has-icons a:link,
+.fg-menu.fg-menu-has-icons a:visited,
+.fg-menu.fg-menu-has-icons a:hover,
+.fg-menu.fg-menu-has-icons a:active { padding-left:20px; }
+
+.fg-menu .horizontal-divider hr, .fg-menu .horizontal-divider span { padding:0; margin:5px .6em; }
+.fg-menu .horizontal-divider hr { border:0; height:1px; }
+.fg-menu .horizontal-divider span { font-size:.9em; text-transform: uppercase; padding-left:.2em; }
+
Index: trunk/prototype/plugins/fgmenu/fg.menu.js
===================================================================
--- trunk/prototype/plugins/fgmenu/fg.menu.js	(revision 5341)
+++ trunk/prototype/plugins/fgmenu/fg.menu.js	(revision 5341)
@@ -0,0 +1,652 @@
+/*-------------------------------------------------------------------- 
+Scripts for creating and manipulating custom menus based on standard <ul> markup
+Version: 3.0, 03.31.2009
+
+By: Maggie Costello Wachs (maggie@filamentgroup.com) and Scott Jehl (scott@filamentgroup.com)
+	http://www.filamentgroup.com
+	* reference articles: http://www.filamentgroup.com/lab/jquery_ipod_style_drilldown_menu/
+		
+Copyright (c) 2009 Filament Group
+Dual licensed under the MIT (filamentgroup.com/examples/mit-license.txt) and GPL (filamentgroup.com/examples/gpl-license.txt) licenses.
+--------------------------------------------------------------------*/
+
+
+var allUIMenus = [];
+
+$.fn.menu = function(options){
+	var caller = this;
+	var options = options;
+	var m = new Menu(caller, options);	
+	allUIMenus.push(m);
+	
+	$(this)
+	.mousedown(function(){
+		if (!m.menuOpen) { m.showLoading(); };
+	})	
+	.click(function(){
+		if (m.menuOpen == false) { m.showMenu(); }
+		else { m.kill(); };
+		return false;
+	});	
+};
+
+function Menu(caller, options){
+	var menu = this;
+	var caller = $(caller);
+	var container = $('<div class="fg-menu-container ui-widget ui-widget-content ui-corner-all">'+options.content+'</div>');
+	
+	this.menuOpen = false;
+	this.menuExists = false;
+	
+	var options = jQuery.extend({
+		content: null,
+		width: 180, // width of menu container, must be set or passed in to calculate widths of child menus
+		maxHeight: 180, // max height of menu (if a drilldown: height does not include breadcrumb)
+		positionOpts: {
+			posX: 'left', 
+			posY: 'bottom',
+			offsetX: 0,
+			offsetY: 0,
+			directionH: 'right',
+			directionV: 'down', 
+			detectH: true, // do horizontal collision detection  
+			detectV: true, // do vertical collision detection
+			linkToFront: false
+		},
+		showSpeed: 200, // show/hide speed in milliseconds
+		callerOnState: 'ui-state-active', // class to change the appearance of the link/button when the menu is showing
+		loadingState: 'ui-state-loading', // class added to the link/button while the menu is created
+		linkHover: 'ui-state-hover', // class for menu option hover state
+		linkHoverSecondary: 'li-hover', // alternate class, may be used for multi-level menus		
+	// ----- multi-level menu defaults -----
+		crossSpeed: 200, // cross-fade speed for multi-level menus
+		crumbDefaultText: 'Choose an option:',
+		backLink: true, // in the ipod-style menu: instead of breadcrumbs, show only a 'back' link
+		backLinkText: 'Back',
+		flyOut: false, // multi-level menus are ipod-style by default; this parameter overrides to make a flyout instead
+		flyOutOnState: 'ui-state-default',
+		nextMenuLink: 'ui-icon-triangle-1-e', // class to style the link (specifically, a span within the link) used in the multi-level menu to show the next level
+		topLinkText: 'All',
+		nextCrumbLink: 'ui-icon-carat-1-e'	
+	}, options);
+	
+	var killAllMenus = function(){
+		$.each(allUIMenus, function(i){
+			if (allUIMenus[i].menuOpen) { allUIMenus[i].kill(); };	
+		});
+	};
+	
+	this.kill = function(){
+		caller
+			.removeClass(options.loadingState)
+			.removeClass('fg-menu-open')
+			.removeClass(options.callerOnState);	
+		container.find('li').removeClass(options.linkHoverSecondary).find('a').removeClass(options.linkHover);		
+		if (options.flyOutOnState) { container.find('li a').removeClass(options.flyOutOnState); };	
+		if (options.callerOnState) { 	caller.removeClass(options.callerOnState); };			
+		if (container.is('.fg-menu-ipod')) { menu.resetDrilldownMenu(); };
+		if (container.is('.fg-menu-flyout')) { menu.resetFlyoutMenu(); };	
+		container.parent().hide();	
+		menu.menuOpen = false;
+		$(document).unbind('click', killAllMenus);
+		$(document).unbind('keydown');
+	};
+	
+	this.showLoading = function(){
+		caller.addClass(options.loadingState);
+	};
+
+	this.showMenu = function(){
+		killAllMenus();
+		if (!menu.menuExists) { menu.create() };
+		caller
+			.addClass('fg-menu-open')
+			.addClass(options.callerOnState);
+		container.parent().show().click(function(){ menu.kill(); return false; });
+		container.hide().slideDown(options.showSpeed).find('.fg-menu:eq(0)');
+		menu.menuOpen = true;
+		caller.removeClass(options.loadingState);
+		$(document).click(killAllMenus);
+		
+		// assign key events
+		$(document).keydown(function(event){
+			var e;
+			if (event.which !="") { e = event.which; }
+			else if (event.charCode != "") { e = event.charCode; }
+			else if (event.keyCode != "") { e = event.keyCode; }
+			
+			var menuType = ($(event.target).parents('div').is('.fg-menu-flyout')) ? 'flyout' : 'ipod' ;
+			
+			switch(e) {
+				case 37: // left arrow 
+					if (menuType == 'flyout') {
+						$(event.target).trigger('mouseout');
+						if ($('.'+options.flyOutOnState).size() > 0) { $('.'+options.flyOutOnState).trigger('mouseover'); };
+					};
+					
+					if (menuType == 'ipod') {
+						$(event.target).trigger('mouseout');
+						if ($('.fg-menu-footer').find('a').size() > 0) { $('.fg-menu-footer').find('a').trigger('click'); };
+						if ($('.fg-menu-header').find('a').size() > 0) { $('.fg-menu-current-crumb').prev().find('a').trigger('click'); };
+						if ($('.fg-menu-current').prev().is('.fg-menu-indicator')) {
+							$('.fg-menu-current').prev().trigger('mouseover');							
+						};						
+					};
+					return false;
+					break;
+					
+				case 38: // up arrow 
+					if ($(event.target).is('.' + options.linkHover)) {	
+						var prevLink = $(event.target).parent().prev().find('a:eq(0)');						
+						if (prevLink.size() > 0) {
+							$(event.target).trigger('mouseout');
+							prevLink.trigger('mouseover');
+						};						
+					}
+					else { container.find('a:eq(0)').trigger('mouseover'); }
+					return false;
+					break;
+					
+				case 39: // right arrow 
+					if ($(event.target).is('.fg-menu-indicator')) {						
+						if (menuType == 'flyout') {
+							$(event.target).next().find('a:eq(0)').trigger('mouseover');
+						}
+						else if (menuType == 'ipod') {
+							$(event.target).trigger('click');						
+							setTimeout(function(){
+								$(event.target).next().find('a:eq(0)').trigger('mouseover');
+							}, options.crossSpeed);
+						};				
+					}; 
+					return false;
+					break;
+					
+				case 40: // down arrow 
+					if ($(event.target).is('.' + options.linkHover)) {
+						var nextLink = $(event.target).parent().next().find('a:eq(0)');						
+						if (nextLink.size() > 0) {							
+							$(event.target).trigger('mouseout');
+							nextLink.trigger('mouseover');
+						};				
+					}
+					else { container.find('a:eq(0)').trigger('mouseover'); }		
+					return false;						
+					break;
+					
+				case 27: // escape
+					killAllMenus();
+					break;
+					
+				case 13: // enter
+					if ($(event.target).is('.fg-menu-indicator') && menuType == 'ipod') {							
+						$(event.target).trigger('click');						
+						setTimeout(function(){
+							$(event.target).next().find('a:eq(0)').trigger('mouseover');
+						}, options.crossSpeed);					
+					}; 
+					break;
+			};			
+		});
+	};
+	
+	this.create = function(){	
+		container.css({ width: options.width }).appendTo('body').find('ul:first').not('.fg-menu-breadcrumb').addClass('fg-menu');
+		container.find('ul, li a').addClass('ui-corner-all');
+		
+		// aria roles & attributes
+		container.find('ul').attr('role', 'menu').eq(0).attr('aria-activedescendant','active-menuitem').attr('aria-labelledby', caller.attr('id'));
+		container.find('li').attr('role', 'menuitem');
+		container.find('li:has(ul)').attr('aria-haspopup', 'true').find('ul').attr('aria-expanded', 'false');
+		container.find('a').attr('tabindex', '-1');
+		
+		// when there are multiple levels of hierarchy, create flyout or drilldown menu
+		if (container.find('ul').size() > 1) {
+			if (options.flyOut) { menu.flyout(container, options); }
+			else { menu.drilldown(container, options); }	
+		}
+		else {
+			container.find('a').click(function(){
+				menu.chooseItem(this);
+				return false;
+			});
+		};	
+		
+		if (options.linkHover) {
+			var allLinks = container.find('.fg-menu li a');
+			allLinks.hover(
+				function(){
+					var menuitem = $(this);
+					$('.'+options.linkHover).removeClass(options.linkHover).blur().parent().removeAttr('id');
+					$(this).addClass(options.linkHover).focus().parent().attr('id','active-menuitem');
+				},
+				function(){
+					$(this).removeClass(options.linkHover).blur().parent().removeAttr('id');
+				}
+			);
+		};
+		
+		if (options.linkHoverSecondary) {
+			container.find('.fg-menu li').hover(
+				function(){
+					$(this).siblings('li').removeClass(options.linkHoverSecondary);
+					if (options.flyOutOnState) { $(this).siblings('li').find('a').removeClass(options.flyOutOnState); }
+					$(this).addClass(options.linkHoverSecondary);
+				},
+				function(){ $(this).removeClass(options.linkHoverSecondary); }
+			);
+		};	
+		
+		menu.setPosition(container, caller, options);
+		menu.menuExists = true;
+	};
+	
+	this.chooseItem = function(item){
+		if ($(item).hasClass('menu-pass-through')) {
+			return true;
+		} else if ($(item).hasClass('menu-command')) {
+			
+			menu.kill();
+			//alert($(item).attr('class'));
+			// edit this for your own custom function/callback:
+		}
+		$('#menuSelection').text($(item).text());	
+		location.href = $(item).attr('href');
+		
+	};
+};
+
+Menu.prototype.flyout = function(container, options) {
+	var menu = this;
+	
+	this.resetFlyoutMenu = function(){
+		var allLists = container.find('ul ul');
+		allLists.removeClass('ui-widget-content').hide();	
+	};
+	
+	container.addClass('fg-menu-flyout').find('li:has(ul)').each(function(){
+		var linkWidth = container.width();
+		var showTimer, hideTimer;
+		var allSubLists = $(this).find('ul');		
+		
+		allSubLists.css({ left: linkWidth, width: linkWidth }).hide();
+			
+		$(this).find('a:eq(0)').addClass('fg-menu-indicator').html('<span>' + $(this).find('a:eq(0)').text() + '</span><span class="ui-icon '+options.nextMenuLink+'"></span>').hover(
+			function(){
+				clearTimeout(hideTimer);
+				var subList = $(this).next();
+				if (!fitVertical(subList, $(this).offset().top)) { subList.css({ top: 'auto', bottom: 0 }); };
+				if (!fitHorizontal(subList, $(this).offset().left + 100)) { subList.css({ left: 'auto', right: linkWidth, 'z-index': 999 }); };
+				showTimer = setTimeout(function(){
+					subList.addClass('ui-widget-content').show(options.showSpeed).attr('aria-expanded', 'true');	
+				}, 300);	
+			},
+			function(){
+				clearTimeout(showTimer);
+				var subList = $(this).next();
+				hideTimer = setTimeout(function(){
+					subList.removeClass('ui-widget-content').hide(options.showSpeed).attr('aria-expanded', 'false');
+				}, 400);	
+			}
+		);
+
+		$(this).find('ul a').hover(
+			function(){
+				clearTimeout(hideTimer);
+				if ($(this).parents('ul').prev().is('a.fg-menu-indicator')) {
+					$(this).parents('ul').prev().addClass(options.flyOutOnState);
+				}
+			},
+			function(){
+				hideTimer = setTimeout(function(){
+					allSubLists.hide(options.showSpeed);
+					container.find(options.flyOutOnState).removeClass(options.flyOutOnState);
+				}, 500);	
+			}
+		);	
+	});
+	
+	container.find('a').click(function(){
+		menu.chooseItem(this);
+		return false;
+	});
+};
+
+
+Menu.prototype.drilldown = function(container, options) {
+	var menu = this;	
+	var topList = container.find('.fg-menu');	
+	var breadcrumb = $('<ul class="fg-menu-breadcrumb ui-widget-header ui-corner-all ui-helper-clearfix"></ul>');
+	var crumbDefaultHeader = $('<li class="fg-menu-breadcrumb-text">'+options.crumbDefaultText+'</li>');
+	var firstCrumbText = (options.backLink) ? options.backLinkText : options.topLinkText;
+	var firstCrumbClass = (options.backLink) ? 'fg-menu-prev-list' : 'fg-menu-all-lists';
+	var firstCrumbLinkClass = (options.backLink) ? 'ui-state-default ui-corner-all' : '';
+	var firstCrumbIcon = (options.backLink) ? '<span class="ui-icon ui-icon-triangle-1-w"></span>' : '';
+	var firstCrumb = $('<li class="'+firstCrumbClass+'"><a href="#" class="'+firstCrumbLinkClass+'">'+firstCrumbIcon+firstCrumbText+'</a></li>');
+	
+	container.addClass('fg-menu-ipod');
+	
+	if (options.backLink) { breadcrumb.addClass('fg-menu-footer').appendTo(container).hide(); }
+	else { breadcrumb.addClass('fg-menu-header').prependTo(container); };
+	breadcrumb.append(crumbDefaultHeader);
+	
+	var checkMenuHeight = function(el){
+		if (el.height() > options.maxHeight) { el.addClass('fg-menu-scroll') };	
+		el.css({ height: options.maxHeight });
+	};
+	
+	var resetChildMenu = function(el){ el.removeClass('fg-menu-scroll').removeClass('fg-menu-current').height('auto'); };
+	
+	this.resetDrilldownMenu = function(){
+		$('.fg-menu-current').removeClass('fg-menu-current');
+		topList.animate({ left: 0 }, options.crossSpeed, function(){
+			$(this).find('ul').each(function(){
+				$(this).hide();
+				resetChildMenu($(this));				
+			});
+			topList.addClass('fg-menu-current');			
+		});		
+		$('.fg-menu-all-lists').find('span').remove();	
+		breadcrumb.empty().append(crumbDefaultHeader);		
+		$('.fg-menu-footer').empty().hide();	
+		checkMenuHeight(topList);		
+	};
+	
+	topList
+		.addClass('fg-menu-content fg-menu-current ui-widget-content ui-helper-clearfix')
+		.css({ width: container.width() })
+		.find('ul')
+			.css({ width: container.width(), left: container.width() })
+			.addClass('ui-widget-content')
+			.hide();		
+	checkMenuHeight(topList);	
+	
+	topList.find('a').each(function(){
+		// if the link opens a child menu:
+		if ($(this).next().is('ul')) {
+			$(this)
+				.addClass('fg-menu-indicator')
+				.each(function(){ $(this).html('<span>' + $(this).text() + '</span><span class="ui-icon '+options.nextMenuLink+'"></span>'); })
+				.click(function(){ // ----- show the next menu			
+					var nextList = $(this).next();
+		    		var parentUl = $(this).parents('ul:eq(0)');   		
+		    		var parentLeft = (parentUl.is('.fg-menu-content')) ? 0 : parseFloat(topList.css('left'));    		
+		    		var nextLeftVal = Math.round(parentLeft - parseFloat(container.width()));
+		    		var footer = $('.fg-menu-footer');
+		    		
+		    		// show next menu   		
+		    		resetChildMenu(parentUl);
+		    		checkMenuHeight(nextList);
+					topList.animate({ left: nextLeftVal }, options.crossSpeed);						
+		    		nextList.show().addClass('fg-menu-current').attr('aria-expanded', 'true');    
+		    		
+		    		var setPrevMenu = function(backlink){
+		    			var b = backlink;
+		    			var c = $('.fg-menu-current');
+			    		var prevList = c.parents('ul:eq(0)');
+			    		c.hide().attr('aria-expanded', 'false');
+		    			resetChildMenu(c);
+		    			checkMenuHeight(prevList);
+			    		prevList.addClass('fg-menu-current').attr('aria-expanded', 'true');
+			    		if (prevList.hasClass('fg-menu-content')) { b.remove(); footer.hide(); };
+		    		};		
+		
+					// initialize "back" link
+					if (options.backLink) {
+						if (footer.find('a').size() == 0) {
+							footer.show();
+							$('<a href="#"><span class="ui-icon ui-icon-triangle-1-w"></span> <span>Back</span></a>')
+								.appendTo(footer)
+								.click(function(){ // ----- show the previous menu
+									var b = $(this);
+						    		var prevLeftVal = parseFloat(topList.css('left')) + container.width();		    						    		
+						    		topList.animate({ left: prevLeftVal },  options.crossSpeed, function(){
+						    			setPrevMenu(b);
+						    		});			
+									return false;
+								});
+						}
+					}
+					// or initialize top breadcrumb
+		    		else { 
+		    			if (breadcrumb.find('li').size() == 1){				
+							breadcrumb.empty().append(firstCrumb);
+							firstCrumb.find('a').click(function(){
+								menu.resetDrilldownMenu();
+								return false;
+							});
+						}
+						$('.fg-menu-current-crumb').removeClass('fg-menu-current-crumb');
+						var crumbText = $(this).find('span:eq(0)').text();
+						var newCrumb = $('<li class="fg-menu-current-crumb"><a href="javascript://" class="fg-menu-crumb">'+crumbText+'</a></li>');	
+						newCrumb
+							.appendTo(breadcrumb)
+							.find('a').click(function(){
+								if ($(this).parent().is('.fg-menu-current-crumb')){
+									menu.chooseItem(this);
+								}
+								else {
+									var newLeftVal = - ($('.fg-menu-current').parents('ul').size() - 1) * 180;
+									topList.animate({ left: newLeftVal }, options.crossSpeed, function(){
+										setPrevMenu();
+									});
+								
+									// make this the current crumb, delete all breadcrumbs after this one, and navigate to the relevant menu
+									$(this).parent().addClass('fg-menu-current-crumb').find('span').remove();
+									$(this).parent().nextAll().remove();									
+								};
+								return false;
+							});
+						newCrumb.prev().append(' <span class="ui-icon '+options.nextCrumbLink+'"></span>');
+		    		};			
+		    		return false;    		
+    			});
+		}
+		// if the link is a leaf node (doesn't open a child menu)
+		else {
+			$(this).click(function(){
+				menu.chooseItem(this);
+				return false;
+			});
+		};
+	});
+};
+
+
+/* Menu.prototype.setPosition parameters (defaults noted with *):
+	referrer = the link (or other element) used to show the overlaid object 
+	settings = can override the defaults:
+		- posX/Y: where the top left corner of the object should be positioned in relation to its referrer.
+				X: left*, center, right
+				Y: top, center, bottom*
+		- offsetX/Y: the number of pixels to be offset from the x or y position.  Can be a positive or negative number.
+		- directionH/V: where the entire menu should appear in relation to its referrer.
+				Horizontal: left*, right
+				Vertical: up, down*
+		- detectH/V: detect the viewport horizontally / vertically
+		- linkToFront: copy the menu link and place it on top of the menu (visual effect to make it look like it overlaps the object) */
+
+Menu.prototype.setPosition = function(widget, caller, options) { 
+	var el = widget;
+	var referrer = caller;
+	var dims = {
+		refX: referrer.offset().left,
+		refY: referrer.offset().top,
+		refW: referrer.getTotalWidth(),
+		refH: referrer.getTotalHeight()
+	};	
+	var options = options;
+	var xVal, yVal;
+	
+	var helper = $('<div class="positionHelper"></div>');
+	helper.css({ position: 'absolute', left: dims.refX, top: dims.refY, width: dims.refW, height: dims.refH });
+	el.wrap(helper);
+	
+	// get X pos
+	switch(options.positionOpts.posX) {
+		case 'left': 	xVal = 0; 
+			break;				
+		case 'center': xVal = dims.refW / 2;
+			break;				
+		case 'right': xVal = dims.refW;
+			break;
+	};
+	
+	// get Y pos
+	switch(options.positionOpts.posY) {
+		case 'top': 	yVal = 0;
+			break;				
+		case 'center': yVal = dims.refH / 2;
+			break;				
+		case 'bottom': yVal = dims.refH;
+			break;
+	};
+	
+	// add the offsets (zero by default)
+	xVal += options.positionOpts.offsetX;
+	yVal += options.positionOpts.offsetY;
+	
+	// position the object vertically
+	if (options.positionOpts.directionV == 'up') {
+		el.css({ top: 'auto', bottom: yVal });
+		if (options.positionOpts.detectV && !fitVertical(el)) {
+			el.css({ bottom: 'auto', top: yVal });
+		}
+	} 
+	else {
+		el.css({ bottom: 'auto', top: yVal });
+		if (options.positionOpts.detectV && !fitVertical(el)) {
+			el.css({ top: 'auto', bottom: yVal });
+		}
+	};
+	
+	// and horizontally
+	if (options.positionOpts.directionH == 'left') {
+		el.css({ left: 'auto', right: xVal });
+		if (options.positionOpts.detectH && !fitHorizontal(el)) {
+			el.css({ right: 'auto', left: xVal });
+		}
+	} 
+	else {
+		el.css({ right: 'auto', left: xVal });
+		if (options.positionOpts.detectH && !fitHorizontal(el)) {
+			el.css({ left: 'auto', right: xVal });
+		}
+	};
+	
+	// if specified, clone the referring element and position it so that it appears on top of the menu
+	if (options.positionOpts.linkToFront) {
+		referrer.clone().addClass('linkClone').css({
+			position: 'absolute', 
+			top: 0, 
+			right: 'auto', 
+			bottom: 'auto', 
+			left: 0, 
+			width: referrer.width(), 
+			height: referrer.height()
+		}).insertAfter(el);
+	};
+};
+
+
+/* Utilities to sort and find viewport dimensions */
+
+function sortBigToSmall(a, b) { return b - a; };
+
+jQuery.fn.getTotalWidth = function(){
+	return $(this).width() + parseInt($(this).css('paddingRight')) + parseInt($(this).css('paddingLeft')) + parseInt($(this).css('borderRightWidth')) + parseInt($(this).css('borderLeftWidth'));
+};
+
+jQuery.fn.getTotalHeight = function(){
+	return $(this).height() + parseInt($(this).css('paddingTop')) + parseInt($(this).css('paddingBottom')) + parseInt($(this).css('borderTopWidth')) + parseInt($(this).css('borderBottomWidth'));
+};
+
+function getScrollTop(){
+	return self.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
+};
+
+function getScrollLeft(){
+	return self.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft;
+};
+
+function getWindowHeight(){
+	var de = document.documentElement;
+	return self.innerHeight || (de && de.clientHeight) || document.body.clientHeight;
+};
+
+function getWindowWidth(){
+	var de = document.documentElement;
+	return self.innerWidth || (de && de.clientWidth) || document.body.clientWidth;
+};
+
+/* Utilities to test whether an element will fit in the viewport
+	Parameters:
+	el = element to position, required
+	leftOffset / topOffset = optional parameter if the offset cannot be calculated (i.e., if the object is in the DOM but is set to display: 'none') */
+	
+function fitHorizontal(el, leftOffset){
+	var leftVal = parseInt(leftOffset) || $(el).offset().left;
+	return (leftVal + $(el).width() <= getWindowWidth() + getScrollLeft() && leftVal - getScrollLeft() >= 0);
+};
+
+function fitVertical(el, topOffset){
+	var topVal = parseInt(topOffset) || $(el).offset().top;
+	return (topVal + $(el).height() <= getWindowHeight() + getScrollTop() && topVal - getScrollTop() >= 0);
+};
+
+/*-------------------------------------------------------------------- 
+ * javascript method: "pxToEm"
+ * by:
+   Scott Jehl (scott@filamentgroup.com) 
+   Maggie Wachs (maggie@filamentgroup.com)
+   http://www.filamentgroup.com
+ *
+ * Copyright (c) 2008 Filament Group
+ * Dual licensed under the MIT (filamentgroup.com/examples/mit-license.txt) and GPL (filamentgroup.com/examples/gpl-license.txt) licenses.
+ *
+ * Description: Extends the native Number and String objects with pxToEm method. pxToEm converts a pixel value to ems depending on inherited font size.  
+ * Article: http://www.filamentgroup.com/lab/retaining_scalable_interfaces_with_pixel_to_em_conversion/
+ * Demo: http://www.filamentgroup.com/examples/pxToEm/	 	
+ *							
+ * Options:  	 								
+ 		scope: string or jQuery selector for font-size scoping
+ 		reverse: Boolean, true reverses the conversion to em-px
+ * Dependencies: jQuery library						  
+ * Usage Example: myPixelValue.pxToEm(); or myPixelValue.pxToEm({'scope':'#navigation', reverse: true});
+ *
+ * Version: 2.0, 08.01.2008 
+ * Changelog:
+ *		08.02.2007 initial Version 1.0
+ *		08.01.2008 - fixed font-size calculation for IE
+--------------------------------------------------------------------*/
+
+Number.prototype.pxToEm = String.prototype.pxToEm = function(settings){
+	//set defaults
+	settings = jQuery.extend({
+		scope: 'body',
+		reverse: false
+	}, settings);
+	
+	var pxVal = (this == '') ? 0 : parseFloat(this);
+	var scopeVal;
+	var getWindowWidth = function(){
+		var de = document.documentElement;
+		return self.innerWidth || (de && de.clientWidth) || document.body.clientWidth;
+	};	
+	
+	/* When a percentage-based font-size is set on the body, IE returns that percent of the window width as the font-size. 
+		For example, if the body font-size is 62.5% and the window width is 1000px, IE will return 625px as the font-size. 	
+		When this happens, we calculate the correct body font-size (%) and multiply it by 16 (the standard browser font size) 
+		to get an accurate em value. */
+				
+	if (settings.scope == 'body' && $.browser.msie && (parseFloat($('body').css('font-size')) / getWindowWidth()).toFixed(1) > 0.0) {
+		var calcFontSize = function(){		
+			return (parseFloat($('body').css('font-size'))/getWindowWidth()).toFixed(3) * 16;
+		};
+		scopeVal = calcFontSize();
+	}
+	else { scopeVal = parseFloat(jQuery(settings.scope).css("font-size")); };
+			
+	var result = (settings.reverse == true) ? (pxVal * scopeVal).toFixed(2) + 'px' : (pxVal / scopeVal).toFixed(2) + 'em';
+	return result;
+};
Index: trunk/prototype/plugins/fgmenu/index.html
===================================================================
--- trunk/prototype/plugins/fgmenu/index.html	(revision 5341)
+++ trunk/prototype/plugins/fgmenu/index.html	(revision 5341)
@@ -0,0 +1,424 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>
+<title>Filament Group Lab</title>
+    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+    
+    <script type="text/javascript" src="jquery-1.3.2.min.js"></script>
+    <script type="text/javascript" src="fg.menu.js"></script>
+    
+    <link type="text/css" href="fg.menu.css" media="screen" rel="stylesheet" />
+    <link type="text/css" href="theme/ui.all.css" media="screen" rel="stylesheet" />
+    
+    <!-- styles for this example page only -->
+	<style type="text/css">
+	body { font-size:62.5%; margin:0; padding:0; }
+	#menuLog { font-size:1.4em; margin:20px; }
+	.hidden { position:absolute; top:0; left:-9999px; width:1px; height:1px; overflow:hidden; }
+	
+	.fg-button { clear:left; margin:0 4px 40px 20px; padding: .4em 1em; text-decoration:none !important; cursor:pointer; position: relative; text-align: center; zoom: 1; }
+	.fg-button .ui-icon { position: absolute; top: 50%; margin-top: -8px; left: 50%; margin-left: -8px; }
+	a.fg-button { float:left;  }
+	button.fg-button { width:auto; overflow:visible; } /* removes extra button width in IE */
+	
+	.fg-button-icon-left { padding-left: 2.1em; }
+	.fg-button-icon-right { padding-right: 2.1em; }
+	.fg-button-icon-left .ui-icon { right: auto; left: .2em; margin-left: 0; }
+	.fg-button-icon-right .ui-icon { left: auto; right: .2em; margin-left: 0; }
+	.fg-button-icon-solo { display:block; width:8px; text-indent: -9999px; }	 /* solo icon buttons must have block properties for the text-indent to work */	
+	
+	.fg-button.ui-state-loading .ui-icon { background: url(spinner_bar.gif) no-repeat 0 0; }
+	</style>
+	
+	<!-- style exceptions for IE 6 -->
+	<!--[if IE 6]>
+	<style type="text/css">
+		.fg-menu-ipod .fg-menu li { width: 95%; }
+		.fg-menu-ipod .ui-widget-content { border:0; }
+	</style>
+	<![endif]-->	
+    
+    <script type="text/javascript">    
+    $(function(){
+    	// BUTTONS
+    	$('.fg-button').hover(
+    		function(){ $(this).removeClass('ui-state-default').addClass('ui-state-focus'); },
+    		function(){ $(this).removeClass('ui-state-focus').addClass('ui-state-default'); }
+    	);
+    	
+    	// MENUS    	
+		$('#flat').menu({ 
+			content: $('#flat').next().html(), // grab content from this page
+			showSpeed: 400 
+		});
+		
+		$('#hierarchy').menu({
+			content: $('#hierarchy').next().html(),
+			crumbDefaultText: ' '
+		});
+		
+		$('#hierarchybreadcrumb').menu({
+			content: $('#hierarchybreadcrumb').next().html(),
+			backLink: false
+		});
+		
+		// or from an external source
+		$.get('menuContent.html', function(data){ // grab content from another page
+			$('#flyout').menu({ content: data, flyOut: true });
+		});
+    });
+    </script>
+    
+    <!-- theme switcher button -->
+    <script type="text/javascript" src="http://ui.jquery.com/applications/themeroller/themeswitchertool/"></script>
+	<script type="text/javascript"> $(function(){ $('<div style="position: absolute; top: 20px; right: 300px;" />').appendTo('body').themeswitcher(); }); </script>
+</head>
+
+<body>
+
+<p id="menuLog">You chose: <span id="menuSelection"></span></p>
+
+<a tabindex="0" href="#search-engines" class="fg-button fg-button-icon-right ui-widget ui-state-default ui-corner-all" id="flat"><span class="ui-icon ui-icon-triangle-1-s"></span>flat menu</a>
+<div id="search-engines" class="hidden">
+<ul>
+	<li><a href="#">Google</a></li>
+	<li><a href="#">Yahoo</a></li>
+	<li><a href="#">MSN</a></li>
+	<li><a href="#">Ask</a></li>
+	<li><a href="#">AOL</a></li>
+</ul>
+</div>
+
+<a tabindex="0" href="menuContent.html" class="fg-button fg-button-icon-right ui-widget ui-state-default ui-corner-all" id="flyout"><span class="ui-icon ui-icon-triangle-1-s"></span>flyout menu</a>
+
+<a tabindex="0" href="#news-items" class="fg-button fg-button-icon-right ui-widget ui-state-default ui-corner-all" id="hierarchy"><span class="ui-icon ui-icon-triangle-1-s"></span>ipod-style menu</a>
+<div id="news-items" class="hidden">
+<ul>
+	<li><a href="#">Breaking News</a>
+		<ul>
+			<li><a href="#">Entertainment</a></li>
+			<li><a href="http://www.w3schools.com/tags/html5.asp">Politics</a></li>
+			<li><a href="#">A&amp;E</a></li>
+			<li><a href="#">Sports</a>
+				<ul>
+					<li><a href="#">Baseball</a></li>
+					<li><a href="#">Basketball</a></li>
+					<li><a href="#">A really long label would wrap nicely as you can see</a></li>
+					<li><a href="#">Swimming</a>
+						<ul>
+							<li><a href="#">High School</a></li>
+							<li><a href="#">College</a></li>
+							<li><a href="#">Professional</a>
+								<ul>
+									<li><a href="#">Mens Swimming</a>
+										<ul>
+											<li><a href="#">News</a></li>
+											<li><a href="#">Events</a></li>
+											<li><a href="#">Awards</a></li>
+											<li><a href="#">Schedule</a></li>
+											<li><a href="#">Team Members</a></li>
+											<li><a href="#">Fan Site</a></li>
+										</ul>
+									</li>
+									<li><a href="#">Womens Swimming</a>
+										<ul>
+											<li><a href="#">News</a></li>
+											<li><a href="#">Events</a></li>
+											<li><a href="#">Awards</a></li>
+											<li><a href="#">Schedule</a></li>
+											<li><a href="#">Team Members</a></li>
+											<li><a href="#">Fan Site</a></li>
+										</ul>
+									</li>
+								</ul>
+							</li>
+							<li><a href="#">Adult Recreational</a></li>
+							<li><a href="#">Youth Recreational</a></li>
+							<li><a href="#">Senior Recreational</a></li>
+						</ul>
+					</li>
+					<li><a href="#">Tennis</a></li>
+					<li><a href="#">Ice Skating</a></li>
+					<li><a href="#">Javascript Programming</a></li>
+					<li><a href="#">Running</a></li>
+					<li><a href="#">Walking</a></li>
+				</ul>
+			</li>
+			<li><a href="#">Local</a></li>
+			<li><a href="#">Health</a></li>
+		</ul>
+	</li>
+	<li><a href="#">Entertainment</a>
+	<ul>
+		<li><a href="#">Celebrity news</a></li>
+		<li><a href="#">Gossip</a></li>
+		<li><a href="#">Movies</a></li>
+		<li><a href="#">Music</a>
+		<ul>
+			<li><a href="#">Alternative</a></li>
+			<li><a href="#">Country</a></li>
+			<li><a href="#">Dance</a></li>
+			<li><a href="#">Electronica</a></li>
+			<li><a href="#">Metal</a></li>
+			<li><a href="#">Pop</a></li>
+			<li><a href="#">Rock</a>
+				<ul>
+					<li><a href="#">Bands</a>
+						<ul>
+							<li><a href="#">Dokken</a></li>
+						</ul>
+					</li>
+					<li><a href="#">Fan Clubs</a></li>
+					<li><a href="#">Songs</a></li>
+				</ul>
+			</li>
+		</ul>
+		</li>
+		<li><a href="#">Slide shows</a></li>
+		<li><a href="#">Red carpet</a></li>
+	</ul>
+	</li>
+	<li><a href="#">Finance</a>
+	<ul>
+		<li><a href="#">Personal</a>
+		<ul>
+			<li><a href="#">Loans</a></li>
+			<li><a href="#">Savings</a></li>
+			<li><a href="#">Mortgage</a></li>
+			<li><a href="#">Debt</a></li>
+		</ul>
+		</li>
+		<li><a href="#">Business</a></li>
+	</ul>
+	</li>
+	<li><a href="#">Food &#38; Cooking</a>
+	<ul>
+		<li><a href="#">Breakfast</a></li>
+		<li><a href="#">Lunch</a></li>
+		<li><a href="#">Dinner</a></li>
+		<li><a href="#">Dessert</a>
+			<ul>
+				<li><a href="#">Dump Cake</a></li>
+				<li><a href="#">Doritos</a></li>
+				<li><a href="#">Both please.</a></li>
+			</ul>
+		</li>
+	</ul>
+	</li>
+	<li><a href="#">Lifestyle</a></li>
+	<li><a href="#">News</a></li>
+	<li><a href="#">Politics</a></li>
+	<li><a href="#">Sports</a>
+		<ul>
+			<li><a href="#">Baseball</a></li>
+			<li><a href="#">Basketball</a></li>
+			<li><a href="#">Swimming</a>
+			<ul>
+				<li><a href="#">High School</a></li>
+				<li><a href="#">College</a></li>
+				<li><a href="#">Professional</a>
+				<ul>
+					<li><a href="#">Mens Swimming</a>
+					<ul>
+							<li><a href="#">News</a></li>
+							<li><a href="#">Events</a></li>
+							<li><a href="#">Awards</a></li>
+							<li><a href="#">Schedule</a></li>
+							<li><a href="#">Team Members</a></li>
+							<li><a href="#">Fan Site</a></li>
+						</ul>
+					</li>
+					<li><a href="#">Womens Swimming</a>
+					<ul>
+						<li><a href="#">News</a></li>
+						<li><a href="#">Events</a></li>
+						<li><a href="#">Awards</a></li>
+						<li><a href="#">Schedule</a></li>
+						<li><a href="#">Team Members</a></li>
+						<li><a href="#">Fan Site</a></li>
+					</ul>
+					</li>
+				</ul>
+				</li>
+				<li><a href="#">Adult Recreational</a></li>
+				<li><a href="#">Youth Recreational</a></li>
+				<li><a href="#">Senior Recreational</a></li>
+			</ul>
+			</li>
+			<li><a href="#">Tennis</a></li>
+			<li><a href="#">Ice Skating</a></li>
+			<li><a href="#">Javascript Programming</a></li>
+			<li><a href="#">Running</a></li>
+			<li><a href="#">Walking</a></li>
+		</ul>
+		</li>
+	</ul>
+</div>
+
+<a tabindex="0" href="#news-items-2" class="fg-button fg-button-icon-right ui-widget ui-state-default ui-corner-all" id="hierarchybreadcrumb"><span class="ui-icon ui-icon-triangle-1-s"></span>ipod-style menu w/ breadcrumb</a>
+<div id="news-items-2" class="hidden">
+<ul>
+	<li><a href="#">Breaking News</a>
+		<ul>
+			<li><a href="#">Entertainment</a></li>
+			<li><a href="#">Politics</a></li>
+			<li><a href="#">A&amp;E</a></li>
+			<li><a href="#">Sports</a>
+				<ul>
+					<li><a href="#">Baseball</a></li>
+					<li><a href="#">Basketball</a></li>
+					<li><a href="#">A really long label would wrap nicely as you can see</a></li>
+					<li><a href="#">Swimming</a>
+						<ul>
+							<li><a href="#">High School</a></li>
+							<li><a href="#">College</a></li>
+							<li><a href="#">Professional</a>
+								<ul>
+									<li><a href="#">Mens Swimming</a>
+										<ul>
+											<li><a href="#">News</a></li>
+											<li><a href="#">Events</a></li>
+											<li><a href="#">Awards</a></li>
+											<li><a href="#">Schedule</a></li>
+											<li><a href="#">Team Members</a></li>
+											<li><a href="#">Fan Site</a></li>
+										</ul>
+									</li>
+									<li><a href="#">Womens Swimming</a>
+										<ul>
+											<li><a href="#">News</a></li>
+											<li><a href="#">Events</a></li>
+											<li><a href="#">Awards</a></li>
+											<li><a href="#">Schedule</a></li>
+											<li><a href="#">Team Members</a></li>
+											<li><a href="#">Fan Site</a></li>
+										</ul>
+									</li>
+								</ul>
+							</li>
+							<li><a href="#">Adult Recreational</a></li>
+							<li><a href="#">Youth Recreational</a></li>
+							<li><a href="#">Senior Recreational</a></li>
+						</ul>
+					</li>
+					<li><a href="#">Tennis</a></li>
+					<li><a href="#">Ice Skating</a></li>
+					<li><a href="#">Javascript Programming</a></li>
+					<li><a href="#">Running</a></li>
+					<li><a href="#">Walking</a></li>
+				</ul>
+			</li>
+			<li><a href="#">Local</a></li>
+			<li><a href="#">Health</a></li>
+		</ul>
+	</li>
+	<li><a href="#">Entertainment</a>
+	<ul>
+		<li><a href="#">Celebrity news</a></li>
+		<li><a href="#">Gossip</a></li>
+		<li><a href="#">Movies</a></li>
+		<li><a href="#">Music</a>
+		<ul>
+			<li><a href="#">Alternative</a></li>
+			<li><a href="#">Country</a></li>
+			<li><a href="#">Dance</a></li>
+			<li><a href="#">Electronica</a></li>
+			<li><a href="#">Metal</a></li>
+			<li><a href="#">Pop</a></li>
+			<li><a href="#">Rock</a>
+				<ul>
+					<li><a href="#">Bands</a>
+						<ul>
+							<li><a href="#">Dokken</a></li>
+						</ul>
+					</li>
+					<li><a href="#">Fan Clubs</a></li>
+					<li><a href="#">Songs</a></li>
+				</ul>
+			</li>
+		</ul>
+		</li>
+		<li><a href="#">Slide shows</a></li>
+		<li><a href="#">Red carpet</a></li>
+	</ul>
+	</li>
+	<li><a href="#">Finance</a>
+	<ul>
+		<li><a href="#">Personal</a>
+		<ul>
+			<li><a href="#">Loans</a></li>
+			<li><a href="#">Savings</a></li>
+			<li><a href="#">Mortgage</a></li>
+			<li><a href="#">Debt</a></li>
+		</ul>
+		</li>
+		<li><a href="#">Business</a></li>
+	</ul>
+	</li>
+	<li><a href="#">Food &#38; Cooking</a>
+	<ul>
+		<li><a href="#">Breakfast</a></li>
+		<li><a href="#">Lunch</a></li>
+		<li><a href="#">Dinner</a></li>
+		<li><a href="#">Dessert</a>
+			<ul>
+				<li><a href="#">Dump Cake</a></li>
+				<li><a href="#">Doritos</a></li>
+				<li><a href="#">Both please.</a></li>
+			</ul>
+		</li>
+	</ul>
+	</li>
+	<li><a href="#">Lifestyle</a></li>
+	<li><a href="#">News</a></li>
+	<li><a href="#">Politics</a></li>
+	<li><a href="#">Sports</a>
+		<ul>
+			<li><a href="#">Baseball</a></li>
+			<li><a href="#">Basketball</a></li>
+			<li><a href="#">Swimming</a>
+			<ul>
+				<li><a href="#">High School</a></li>
+				<li><a href="#">College</a></li>
+				<li><a href="#">Professional</a>
+				<ul>
+					<li><a href="#">Mens Swimming</a>
+					<ul>
+							<li><a href="#">News</a></li>
+							<li><a href="#">Events</a></li>
+							<li><a href="#">Awards</a></li>
+							<li><a href="#">Schedule</a></li>
+							<li><a href="#">Team Members</a></li>
+							<li><a href="#">Fan Site</a></li>
+						</ul>
+					</li>
+					<li><a href="#">Womens Swimming</a>
+					<ul>
+						<li><a href="#">News</a></li>
+						<li><a href="#">Events</a></li>
+						<li><a href="#">Awards</a></li>
+						<li><a href="#">Schedule</a></li>
+						<li><a href="#">Team Members</a></li>
+						<li><a href="#">Fan Site</a></li>
+					</ul>
+					</li>
+				</ul>
+				</li>
+				<li><a href="#">Adult Recreational</a></li>
+				<li><a href="#">Youth Recreational</a></li>
+				<li><a href="#">Senior Recreational</a></li>
+			</ul>
+			</li>
+			<li><a href="#">Tennis</a></li>
+			<li><a href="#">Ice Skating</a></li>
+			<li><a href="#">Javascript Programming</a></li>
+			<li><a href="#">Running</a></li>
+			<li><a href="#">Walking</a></li>
+		</ul>
+		</li>
+	</ul>
+</div>
+
+</body>
+</html>
Index: trunk/prototype/plugins/fgmenu/jquery-1.3.2.min.js
===================================================================
--- trunk/prototype/plugins/fgmenu/jquery-1.3.2.min.js	(revision 5341)
+++ trunk/prototype/plugins/fgmenu/jquery-1.3.2.min.js	(revision 5341)
@@ -0,0 +1,19 @@
+/*
+ * jQuery JavaScript Library v1.3.2
+ * http://jquery.com/
+ *
+ * Copyright (c) 2009 John Resig
+ * Dual licensed under the MIT and GPL licenses.
+ * http://docs.jquery.com/License
+ *
+ * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
+ * Revision: 6246
+ */
+(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F<J;F++){var G=M[F];if(G.selected){K=o(G).val();if(H){return K}L.push(K)}}return L}return(E.value||"").replace(/\r/g,"")}return g}if(typeof K==="number"){K+=""}return this.each(function(){if(this.nodeType!=1){return}if(o.isArray(K)&&/radio|checkbox/.test(this.type)){this.checked=(o.inArray(this.value,K)>=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G<E;G++){L.call(K(this[G],H),this.length>1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H<I;H++){if((G=arguments[H])!=null){for(var F in G){var K=J[F],L=G[F];if(J===L){continue}if(E&&L&&typeof L==="object"&&!L.nodeType){J[F]=o.extend(E,K||(L.length!=null?[]:{}),L)}else{if(L!==g){J[F]=L}}}}}return J};var b=/z-?index|font-?weight|opacity|zoom|line-?height/i,q=document.defaultView||{},s=Object.prototype.toString;o.extend({noConflict:function(E){l.$=p;if(E){l.jQuery=y}return o},isFunction:function(E){return s.call(E)==="[object Function]"},isArray:function(E){return s.call(E)==="[object Array]"},isXMLDoc:function(E){return E.nodeType===9&&E.documentElement.nodeName!=="HTML"||!!E.ownerDocument&&o.isXMLDoc(E.ownerDocument)},globalEval:function(G){if(G&&/\S/.test(G)){var F=document.getElementsByTagName("head")[0]||document.documentElement,E=document.createElement("script");E.type="text/javascript";if(o.support.scriptEval){E.appendChild(document.createTextNode(G))}else{E.text=G}F.insertBefore(E,F.firstChild);F.removeChild(E)}},nodeName:function(F,E){return F.nodeName&&F.nodeName.toUpperCase()==E.toUpperCase()},each:function(G,K,F){var E,H=0,I=G.length;if(F){if(I===g){for(E in G){if(K.apply(G[E],F)===false){break}}}else{for(;H<I;){if(K.apply(G[H++],F)===false){break}}}}else{if(I===g){for(E in G){if(K.call(G[E],E,G[E])===false){break}}}else{for(var J=G[0];H<I&&K.call(J,H,J)!==false;J=G[++H]){}}}return G},prop:function(H,I,G,F,E){if(o.isFunction(I)){I=I.call(H,F)}return typeof I==="number"&&G=="curCSS"&&!b.test(E)?I+"px":I},className:{add:function(E,F){o.each((F||"").split(/\s+/),function(G,H){if(E.nodeType==1&&!o.className.has(E.className,H)){E.className+=(E.className?" ":"")+H}})},remove:function(E,F){if(E.nodeType==1){E.className=F!==g?o.grep(E.className.split(/\s+/),function(G){return !o.className.has(F,G)}).join(" "):""}},has:function(F,E){return F&&o.inArray(E,(F.className||F).toString().split(/\s+/))>-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+"></"+T+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!O.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!O.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!O.indexOf("<td")||!O.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!O.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!o.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/<tbody/i.test(S),N=!O.indexOf("<table")&&!R?L.firstChild&&L.firstChild.childNodes:Q[1]=="<table>"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E<F;E++){if(H[E]===G){return E}}return -1},merge:function(H,E){var F=0,G,I=H.length;if(!o.support.getAll){while((G=E[F++])!=null){if(G.nodeType!=8){H[I++]=G}}}else{while((G=E[F++])!=null){H[I++]=G}}return H},unique:function(K){var F=[],E={};try{for(var G=0,H=K.length;G<H;G++){var J=o.data(K[G]);if(!E[J]){E[J]=true;F.push(K[G])}}}catch(I){F=K}return F},grep:function(F,J,E){var G=[];for(var H=0,I=F.length;H<I;H++){if(!E!=!J(F[H],H)){G.push(F[H])}}return G},map:function(E,J){var F=[];for(var G=0,H=E.length;G<H;G++){var I=J(E[G],G);if(I!=null){F[F.length]=I}}return F.concat.apply([],F)}});var C=navigator.userAgent.toLowerCase();o.browser={version:(C.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(C),opera:/opera/.test(C),msie:/msie/.test(C)&&!/opera/.test(C),mozilla:/mozilla/.test(C)&&!/(compatible|webkit)/.test(C)};o.each({parent:function(E){return E.parentNode},parents:function(E){return o.dir(E,"parentNode")},next:function(E){return o.nth(E,2,"nextSibling")},prev:function(E){return o.nth(E,2,"previousSibling")},nextAll:function(E){return o.dir(E,"nextSibling")},prevAll:function(E){return o.dir(E,"previousSibling")},siblings:function(E){return o.sibling(E.parentNode.firstChild,E)},children:function(E){return o.sibling(E.firstChild)},contents:function(E){return o.nodeName(E,"iframe")?E.contentDocument||E.contentWindow.document:o.makeArray(E.childNodes)}},function(E,F){o.fn[E]=function(G){var H=o.map(this,F);if(G&&typeof G=="string"){H=o.multiFilter(G,H)}return this.pushStack(o.unique(H),E,G)}});o.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(E,F){o.fn[E]=function(G){var J=[],L=o(G);for(var K=0,H=L.length;K<H;K++){var I=(K>0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}});
+/*
+ * Sizzle CSS Selector Engine - v0.9.3
+ *  Copyright 2009, The Dojo Foundation
+ *  Released under the MIT, BSD, and GPL Licenses.
+ *  More information: http://sizzlejs.com/
+ */
+(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa<ab.length;aa++){if(ab[aa]===ab[aa-1]){ab.splice(aa--,1)}}}}}return ab};F.matches=function(T,U){return F(T,null,null,U)};F.find=function(aa,T,ab){var Z,X;if(!aa){return[]}for(var W=0,V=I.order.length;W<V;W++){var Y=I.order[W],X;if((X=I.match[Y].exec(aa))){var U=RegExp.leftContext;if(U.substr(U.length-1)!=="\\"){X[1]=(X[1]||"").replace(/\\/g,"");Z=I.find[Y](X,T,ab);if(Z!=null){aa=aa.replace(I.match[Y],"");break}}}}if(!Z){Z=T.getElementsByTagName("*")}return{set:Z,expr:aa}};F.filter=function(ad,ac,ag,W){var V=ad,ai=[],aa=ac,Y,T,Z=ac&&ac[0]&&Q(ac[0]);while(ad&&ac.length){for(var ab in I.filter){if((Y=I.match[ab].exec(ad))!=null){var U=I.filter[ab],ah,af;T=false;if(aa==ai){ai=[]}if(I.preFilter[ab]){Y=I.preFilter[ab](Y,aa,ag,ai,W,Z);if(!Y){T=ah=true}else{if(Y===true){continue}}}if(Y){for(var X=0;(af=aa[X])!=null;X++){if(af){ah=U(af,Y,X,aa);var ae=W^!!ah;if(ag&&ah!=null){if(ae){T=true}else{aa[X]=false}}else{if(ae){ai.push(af);T=true}}}}}if(ah!==g){if(!ag){aa=ai}ad=ad.replace(I.match[ab],"");if(!T){return[]}break}}}if(ad==V){if(T==null){throw"Syntax error, unrecognized expression: "+ad}else{break}}V=ad}return aa};var I=F.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(T){return T.getAttribute("href")}},relative:{"+":function(aa,T,Z){var X=typeof T==="string",ab=X&&!/\W/.test(T),Y=X&&!ab;if(ab&&!Z){T=T.toUpperCase()}for(var W=0,V=aa.length,U;W<V;W++){if((U=aa[W])){while((U=U.previousSibling)&&U.nodeType!==1){}aa[W]=Y||U&&U.nodeName===T?U||false:U===T}}if(Y){F.filter(T,aa,true)}},">":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){var W=Y.parentNode;Z[V]=W.nodeName===U?W:false}}}else{for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){Z[V]=X?Y.parentNode:Y.parentNode===U}}if(X){F.filter(U,Z,true)}}},"":function(W,U,Y){var V=L++,T=S;if(!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("parentNode",U,V,W,X,Y)},"~":function(W,U,Y){var V=L++,T=S;if(typeof U==="string"&&!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("previousSibling",U,V,W,X,Y)}},find:{ID:function(U,V,W){if(typeof V.getElementById!=="undefined"&&!W){var T=V.getElementById(U[1]);return T?[T]:[]}},NAME:function(V,Y,Z){if(typeof Y.getElementsByName!=="undefined"){var U=[],X=Y.getElementsByName(V[1]);for(var W=0,T=X.length;W<T;W++){if(X[W].getAttribute("name")===V[1]){U.push(X[W])}}return U.length===0?null:U}},TAG:function(T,U){return U.getElementsByTagName(T[1])}},preFilter:{CLASS:function(W,U,V,T,Z,aa){W=" "+W[1].replace(/\\/g,"")+" ";if(aa){return W}for(var X=0,Y;(Y=U[X])!=null;X++){if(Y){if(Z^(Y.className&&(" "+Y.className+" ").indexOf(W)>=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return U<T[3]-0},gt:function(V,U,T){return U>T[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W<T;W++){if(Y[W]===Z){return false}}return true}}}},CHILD:function(T,W){var Z=W[1],U=T;switch(Z){case"only":case"first":while(U=U.previousSibling){if(U.nodeType===1){return false}}if(Z=="first"){return true}U=T;case"last":while(U=U.nextSibling){if(U.nodeType===1){return false}}return true;case"nth":var V=W[2],ac=W[3];if(V==1&&ac==0){return true}var Y=W[0],ab=T.parentNode;if(ab&&(ab.sizcache!==Y||!T.nodeIndex)){var X=0;for(U=ab.firstChild;U;U=U.nextSibling){if(U.nodeType===1){U.nodeIndex=++X}}ab.sizcache=Y}var aa=T.nodeIndex-ac;if(V==0){return aa==0}else{return(aa%V==0&&aa/V>=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V<T;V++){U.push(X[V])}}else{for(var V=0;X[V];V++){U.push(X[V])}}}return U}}var G;if(document.documentElement.compareDocumentPosition){G=function(U,T){var V=U.compareDocumentPosition(T)&4?-1:U===T?0:1;if(V===0){hasDuplicate=true}return V}}else{if("sourceIndex" in document.documentElement){G=function(U,T){var V=U.sourceIndex-T.sourceIndex;if(V===0){hasDuplicate=true}return V}}else{if(document.createRange){G=function(W,U){var V=W.ownerDocument.createRange(),T=U.ownerDocument.createRange();V.selectNode(W);V.collapse(true);T.selectNode(U);T.collapse(true);var X=V.compareBoundaryPoints(Range.START_TO_END,T);if(X===0){hasDuplicate=true}return X}}}}(function(){var U=document.createElement("form"),V="script"+(new Date).getTime();U.innerHTML="<input name='"+V+"'/>";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="<a href='#'></a>";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="<p class='TEST'></p>";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="<div class='test e'></div><div class='test'></div>";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1&&!ac){T.sizcache=Y;T.sizset=W}if(T.nodeName===Z){X=T;break}T=T[U]}ad[W]=X}}}function S(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1){if(!ac){T.sizcache=Y;T.sizset=W}if(typeof Z!=="string"){if(T===Z){X=true;break}}else{if(F.filter(Z,[T]).length>0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z<U;Z++){F(T,V[Z],W)}return F.filter(X,W)};o.find=F;o.filter=F.filter;o.expr=F.selectors;o.expr[":"]=o.expr.filters;F.selectors.filters.hidden=function(T){return T.offsetWidth===0||T.offsetHeight===0};F.selectors.filters.visible=function(T){return T.offsetWidth>0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F<E.length){o.event.proxy(G,E[F++])}return this.click(o.event.proxy(G,function(H){this.lastToggle=(this.lastToggle||0)%F;H.preventDefault();return E[this.lastToggle++].apply(this,arguments)||false}))},hover:function(E,F){return this.mouseenter(E).mouseleave(F)},ready:function(E){B();if(o.isReady){E.call(document,o)}else{o.readyList.push(E)}return this},live:function(G,F){var E=o.event.proxy(F);E.guid+=this.selector+G;o(document).bind(i(G,this.selector),this.selector,E);return this},die:function(F,E){o(document).unbind(i(F,this.selector),E?{guid:E.guid+this.selector+F}:null);return this}});function c(H){var E=RegExp("(^|\\.)"+H.type+"(\\.|$)"),G=true,F=[];o.each(o.data(this,"events").live||[],function(I,J){if(E.test(J.type)){var K=o(H.target).closest(J.data)[0];if(K){F.push({elem:K,fn:J})}}});F.sort(function(J,I){return o.data(J.elem,"closest")-o.data(I.elem,"closest")});o.each(F,function(){if(this.fn.call(this.elem,H,this.fn.data)===false){return(G=false)}});return G}function i(F,E){return["live",F,E.replace(/\./g,"`").replace(/ /g,"|")].join(".")}o.extend({isReady:false,readyList:[],ready:function(){if(!o.isReady){o.isReady=true;if(o.readyList){o.each(o.readyList,function(){this.call(document,o)});o.readyList=null}o(document).triggerHandler("ready")}}});var x=false;function B(){if(x){return}x=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);o.ready()},false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);o.ready()}});if(document.documentElement.doScroll&&l==l.top){(function(){if(o.isReady){return}try{document.documentElement.doScroll("left")}catch(E){setTimeout(arguments.callee,0);return}o.ready()})()}}}o.event.add(l,"load",o.ready)}o.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error").split(","),function(F,E){o.fn[E]=function(G){return G?this.bind(E,G):this.trigger(E)}});o(l).bind("unload",function(){for(var E in o.cache){if(E!=1&&o.cache[E].handle){o.event.remove(o.cache[E].handle.elem)}}});(function(){o.support={};var F=document.documentElement,G=document.createElement("script"),K=document.createElement("div"),J="script"+(new Date).getTime();K.style.display="none";K.innerHTML='   <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';var H=K.getElementsByTagName("*"),E=K.getElementsByTagName("a")[0];if(!H||!H.length||!E){return}o.support={leadingWhitespace:K.firstChild.nodeType==3,tbody:!K.getElementsByTagName("tbody").length,objectAll:!!K.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!K.getElementsByTagName("link").length,style:/red/.test(E.getAttribute("style")),hrefNormalized:E.getAttribute("href")==="/a",opacity:E.style.opacity==="0.5",cssFloat:!!E.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};G.type="text/javascript";try{G.appendChild(document.createTextNode("window."+J+"=1;"))}catch(I){}F.insertBefore(G,F.firstChild);if(l[J]){o.support.scriptEval=true;delete l[J]}F.removeChild(G);if(K.attachEvent&&K.fireEvent){K.attachEvent("onclick",function(){o.support.noCloneEvent=false;K.detachEvent("onclick",arguments.callee)});K.cloneNode(true).fireEvent("onclick")}o(function(){var L=document.createElement("div");L.style.width=L.style.paddingLeft="1px";document.body.appendChild(L);o.boxModel=o.support.boxModel=L.offsetWidth===2;document.body.removeChild(L).style.display="none"})})();var w=o.support.cssFloat?"cssFloat":"styleFloat";o.props={"for":"htmlFor","class":"className","float":w,cssFloat:w,styleFloat:w,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};o.fn.extend({_load:o.fn.load,load:function(G,J,K){if(typeof G!=="string"){return this._load(G)}var I=G.indexOf(" ");if(I>=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("<div/>").append(M.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H<F;H++){var E=o.data(this[H],"olddisplay");this[H].style.display=E||"";if(o.css(this[H],"display")==="none"){var G=this[H].tagName,K;if(m[G]){K=m[G]}else{var I=o("<"+G+" />").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H<F;H++){this[H].style.display=o.data(this[H],"olddisplay")||""}return this}},hide:function(H,I){if(H){return this.animate(t("hide",3),H,I)}else{for(var G=0,F=this.length;G<F;G++){var E=o.data(this[G],"olddisplay");if(!E&&E!=="none"){o.data(this[G],"olddisplay",o.css(this[G],"display"))}}for(var G=0,F=this.length;G<F;G++){this[G].style.display="none"}return this}},_toggle:o.fn.toggle,toggle:function(G,F){var E=typeof G==="boolean";return o.isFunction(G)&&o.isFunction(F)?this._toggle.apply(this,arguments):G==null||E?this.each(function(){var H=E?G:o(this).is(":hidden");o(this)[H?"show":"hide"]()}):this.animate(t("toggle",3),G,F)},fadeTo:function(E,G,F){return this.animate({opacity:G},E,F)},animate:function(I,F,H,G){var E=o.speed(F,H,G);return this[E.queue===false?"each":"queue"](function(){var K=o.extend({},E),M,L=this.nodeType==1&&o(this).is(":hidden"),J=this;for(M in I){if(I[M]=="hide"&&L||I[M]=="show"&&!L){return K.complete.call(this)}if((M=="height"||M=="width")&&this.style){K.display=o.css(this,"display");K.overflow=this.style.overflow}}if(K.overflow!=null){this.style.overflow="hidden"}K.curAnim=o.extend({},I);o.each(I,function(O,S){var R=new o.fx(J,K,O);if(/toggle|show|hide/.test(S)){R[S=="toggle"?L?"show":"hide":S](I)}else{var Q=S.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),T=R.cur(true)||0;if(Q){var N=parseFloat(Q[2]),P=Q[3]||"px";if(P!="px"){J.style[O]=(N||1)+P;T=((N||1)/R.cur(true))*T;J.style[O]=T+P}if(Q[1]){N=((Q[1]=="-="?-1:1)*N)+T}R.custom(T,N,P)}else{R.custom(T,S,"")}}});return true})},stop:function(F,E){var G=o.timers;if(F){this.queue([])}this.each(function(){for(var H=G.length-1;H>=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J<K.length;J++){if(!K[J]()){K.splice(J--,1)}}if(!K.length){clearInterval(n);n=g}},13)}},show:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());o(this.elem).show()},hide:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(H){var G=e();if(H||G>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})();
Index: trunk/prototype/plugins/farbtastic/LICENSE.txt
===================================================================
--- trunk/prototype/plugins/farbtastic/LICENSE.txt	(revision 5341)
+++ trunk/prototype/plugins/farbtastic/LICENSE.txt	(revision 5341)
@@ -0,0 +1,341 @@
+
+        GNU GENERAL PUBLIC LICENSE
+           Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+          Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+        GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+          NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+         END OF TERMS AND CONDITIONS
+
+      How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
Index: trunk/prototype/plugins/farbtastic/README.html
===================================================================
--- trunk/prototype/plugins/farbtastic/README.html	(revision 5341)
+++ trunk/prototype/plugins/farbtastic/README.html	(revision 5341)
@@ -0,0 +1,71 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html>
+<head><title>Farbtastic: jQuery color picker plug-in</title></head>
+<body>
+        <h1 class="title">Farbtastic: jQuery color picker plug-in</h1>
+    <div class="content"><p>Farbtastic is a <a href="http://www.jquery.com/">jQuery</a> plug-in that can add one or more color picker widgets into a page. Each widget is then linked to an existing element (e.g. a text field) and will update the element's value when a color is selected.</p>
+
+<p>Farbtastic uses layered transparent PNGs to render a saturation/luminance gradient inside of a hue circle. No Flash or pixel-sized divs are used.</p>
+
+<p>Farbtastic was written by <a href="http://www.acko.net/dev/farbtastic">Steven Wittens</a> and is licensed under the GPL.</p>
+
+<h2>Basic Usage</h2>
+<ol>
+<li>Include farbtastic.js and farbtastic.css in your HTML:<br />
+<div class="codeblock"><code>&lt;script type=&quot;text/javascript&quot; src=&quot;farbtastic.js&quot;&gt;&lt;/script&gt;<br />&lt;link rel=&quot;stylesheet&quot; href=&quot;farbtastic.css&quot; type=&quot;text/css&quot; /&gt;</code></div>
+</li>
+<li>Add a placeholder div and a text field to your HTML, and give each an ID:<br />
+<div class="codeblock"><code>&lt;form&gt;&lt;input type=&quot;text&quot; id=&quot;color&quot; name=&quot;color&quot; value=&quot;#123456&quot; /&gt;&lt;/form&gt;<br />&lt;div id=&quot;colorpicker&quot;&gt;&lt;/div&gt;</code></div>
+</li>
+<li>Add a ready() handler to the document which initializes the color picker and link it to the text field with the following syntax:<br />
+<div class="codeblock"><code>&lt;script type=&quot;text/javascript&quot;&gt;<br />&nbsp; $(document).ready(function() {<br />&nbsp; &nbsp; $(&#039;#colorpicker&#039;).farbtastic(&#039;#color&#039;);<br />&nbsp; });<br />&lt;/script&gt;</code></div>
+</li>
+</ol>
+<p>See demo1.html and demo2.html for an example (jquery.js is not included!).</p>
+<h2>Styling</h2>
+<p>The color picker is a block-level element and is 195x195 pixels large. You can control the position by styling your placeholder (e.g. floating it).</p>
+<p>Note that the black/white gradients inside wheel.png and mask.png were generated programmatically and cannot be recreated easily in an image editing program.</p>
+<h2>Advanced Usage</h2>
+<h3>jQuery Method</h3>
+<dl>
+<dt>$(...).farbtastic()<br />
+$(...).farbtastic(callback)</dt>
+<dd>This creates color pickers in the selected objects. <code>callback</code> is optional and can be a:</p>
+<ul>
+<li><em>DOM Node</em>, <em>jQuery object</em> or <em>jQuery selector</em>: the color picker will be linked to the selected element(s) by syncing the value (for form elements) and color (all elements).</li>
+<li><em>Function</em>: this function will be called whenever the user chooses a different color.</dd>
+</dl>
+<h3>Object</h3>
+<dl>
+<dt>$.farbtastic(placeholder)<br />
+$.farbtastic(placeholder, callback)<br />
+</dt>
+<dd>Invoking <code>$.farbtastic(placeholder)</code> is the same as using <code>$(placeholder).farbtastic()</code> except that the Farbtastic object is returned instead of the jQuery object. This allows you to use the Farbtastic methods and properties below.</p>
+<p>Note that there is only one Farbtastic object per placeholder. If you call <code>$.farbtastic(placeholder)</code> twice <em>with the same placeholder</em>, you will get the same object back each time.</p>
+<p>The optional <code>callback</code> argument behaves exactly as for the jQuery method.<br />
+</dd>
+</dl>
+</dd>
+</dl>
+<h3>Methods</h3>
+<dl>
+<dt>.linkTo(callback)</dt>
+<dd>Allows you to set a new callback. Any existing callbacks are removed. See above for the meaning of <code>callback</code>.</dd>
+<dt>.setColor(string)</dt>
+<dd>Sets the picker color to the given color in hex representation.</dd>
+<dt>.setColor([h, s, l])</dt>
+<dd>Sets the picker color to the given color in normalized HSL (0..1 scale).</dd>
+</dl>
+<h3>Properties</h3>
+<dl>
+<dt>.linked</dt>
+<dd>The elements (jQuery object) or callback function this picker is linked to.</dd>
+<dt>.color</dt>
+<dd>Current color in hex representation.</dd>
+<dt>.hsl</dt>
+<dd>Current color in normalized HSL.</dd>
+</dl>
+</div>
+</body>
+</html>
Index: trunk/prototype/plugins/farbtastic/farbtastic.css
===================================================================
--- trunk/prototype/plugins/farbtastic/farbtastic.css	(revision 5341)
+++ trunk/prototype/plugins/farbtastic/farbtastic.css	(revision 5341)
@@ -0,0 +1,51 @@
+/**
+ * Farbtastic Color Picker 1.2
+ * Â© 2008 Steven Wittens
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+.farbtastic {
+  position: relative;
+}
+.farbtastic * {
+  position: absolute;
+  cursor: crosshair;
+}
+.farbtastic, .farbtastic .wheel {
+  width: 195px;
+  height: 195px;
+}
+.farbtastic .color, .farbtastic .overlay {
+  top: 47px;
+  left: 47px;
+  width: 101px;
+  height: 101px;
+}
+.farbtastic .wheel {
+  background: url(wheel.png) no-repeat;
+  width: 195px;
+  height: 195px;
+}
+.farbtastic .overlay {
+  background: url(mask.png) no-repeat;
+}
+.farbtastic .marker {
+  width: 17px;
+  height: 17px;
+  margin: -8px 0 0 -8px;
+  overflow: hidden; 
+  background: url(marker.png) no-repeat;
+}
+
Index: trunk/prototype/plugins/farbtastic/CHANGELOG.html
===================================================================
--- trunk/prototype/plugins/farbtastic/CHANGELOG.html	(revision 5341)
+++ trunk/prototype/plugins/farbtastic/CHANGELOG.html	(revision 5341)
@@ -0,0 +1,26 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html>
+<head><title>Farbtastic: Changelog</title></head>
+<body>
+  <h1 class="title">Farbtastic: Changelog</h1>
+
+    <h2>1.2 - 2007/01/08</h2>
+    <ul>
+      <li>Fixed bug with linking multiple fields with the same value.</li>
+    </ul>
+    <h2>1.1 - 2006/10/27</h2>
+    <ul>
+      <li>Work around for the transparent PNGs in Internet Explorer.</li>
+      <li>Better mouse handling code to accomodate CSS-based layouts better.</li>
+    </ul>
+    <h2>1.0 - 2006/07/14</h2>
+    <ul>
+      <li>Initial release.</li>
+    </ul>
+
+    <p>More info on <a href="http://www.acko.net/dev/farbtastic">Acko.net</a>.</p>
+    <p>Created by <a href="http://www.acko.net/">Steven Wittens</a>.</p>
+
+</body>
+</html>
Index: trunk/prototype/plugins/farbtastic/farbtastic.js
===================================================================
--- trunk/prototype/plugins/farbtastic/farbtastic.js	(revision 5341)
+++ trunk/prototype/plugins/farbtastic/farbtastic.js	(revision 5341)
@@ -0,0 +1,361 @@
+/**
+ * Farbtastic Color Picker 1.2
+ * Â© 2008 Steven Wittens
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+jQuery.fn.farbtastic = function (callback) {
+  $.farbtastic(this, callback);
+  return this;
+};
+
+jQuery.farbtastic = function (container, callback) {
+  var container = $(container).get(0);
+  return container.farbtastic || (container.farbtastic = new jQuery._farbtastic(container, callback));
+}
+
+jQuery._farbtastic = function (container, callback) {
+  // Store farbtastic object
+  var fb = this;
+
+  // Insert markup
+  $(container).html('<div class="farbtastic"><div class="color"></div><div class="wheel"></div><div class="overlay"></div><div class="h-marker marker"></div><div class="sl-marker marker"></div></div>');
+  var e = $('.farbtastic', container);
+  fb.wheel = $('.wheel', container).get(0);
+  // Dimensions
+  fb.radius = 84;
+  fb.square = 100;
+  fb.width = 194;
+
+  // Fix background PNGs in IE6
+  if (navigator.appVersion.match(/MSIE [0-6]\./)) {
+    $('*', e).each(function () {
+      if (this.currentStyle.backgroundImage != 'none') {
+        var image = this.currentStyle.backgroundImage;
+        image = this.currentStyle.backgroundImage.substring(5, image.length - 2);
+        $(this).css({
+          'backgroundImage': 'none',
+          'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='" + image + "')"
+        });
+      }
+    });
+  }
+
+  /**
+   * Link to the given element(s) or callback.
+   */
+  fb.linkTo = function (callback) {
+    // Unbind previous nodes
+    if (typeof fb.callback == 'object') {
+      $(fb.callback).unbind('keyup', fb.updateValue);
+    }
+
+    // Reset color
+    fb.color = null;
+
+    // Bind callback or elements
+    if (typeof callback == 'function') {
+      fb.callback = callback;
+    }
+    else if (typeof callback == 'object' || typeof callback == 'string') {
+      fb.callback = $(callback);
+      fb.callback.bind('keyup', fb.updateValue);
+      if (fb.callback.get(0).value) {
+        fb.setColor(fb.callback.get(0).value);
+      }
+    }
+    return this;
+  }
+  fb.updateValue = function (event) {
+    if (this.value && this.value != fb.color) {
+      fb.setColor(this.value);
+    }
+  }
+
+  /**
+   * Change color with HTML syntax #123456
+   */
+  fb.setColor = function (color) {
+    var unpack = fb.unpack(color);
+    if (fb.color != color && unpack) {
+      fb.color = color;
+      fb.rgb = unpack;
+      fb.hsl = fb.RGBToHSL(fb.rgb);
+      fb.updateDisplay();
+    }
+    return this;
+  }
+
+  /**
+   * Change color with HSL triplet [0..1, 0..1, 0..1]
+   */
+  fb.setHSL = function (hsl) {
+    fb.hsl = hsl;
+    fb.rgb = fb.HSLToRGB(hsl);
+    fb.color = fb.pack(fb.rgb);
+    fb.updateDisplay();
+    return this;
+  }
+
+  /////////////////////////////////////////////////////
+
+  /**
+   * Retrieve the coordinates of the given event relative to the center
+   * of the widget.
+   */
+  fb.widgetCoords = function (event) {
+    var x, y;
+    var el = event.target || event.srcElement;
+    var reference = fb.wheel;
+
+    if (typeof event.offsetX != 'undefined') {
+      // Use offset coordinates and find common offsetParent
+      var pos = { x: event.offsetX, y: event.offsetY };
+
+      // Send the coordinates upwards through the offsetParent chain.
+      var e = el;
+      while (e) {
+        e.mouseX = pos.x;
+        e.mouseY = pos.y;
+        pos.x += e.offsetLeft;
+        pos.y += e.offsetTop;
+        e = e.offsetParent;
+      }
+
+      // Look for the coordinates starting from the wheel widget.
+      var e = reference;
+      var offset = { x: 0, y: 0 }
+      while (e) {
+        if (typeof e.mouseX != 'undefined') {
+          x = e.mouseX - offset.x;
+          y = e.mouseY - offset.y;
+          break;
+        }
+        offset.x += e.offsetLeft;
+        offset.y += e.offsetTop;
+        e = e.offsetParent;
+      }
+
+      // Reset stored coordinates
+      e = el;
+      while (e) {
+        e.mouseX = undefined;
+        e.mouseY = undefined;
+        e = e.offsetParent;
+      }
+    }
+    else {
+      // Use absolute coordinates
+      var pos = fb.absolutePosition(reference);
+	  
+/**
+ * TODO - 
+ * Remover este código assim que a comunidade do plugin farbtastic incorporar
+ * uma solução definitiva para o problema do container com scroll
+ */
+/**
+ * Begin: Solução temporária para o problema do container com scroll
+ */
+var pr = $(el).parents("div#divAppbox");
+pos.x -= + pr.scrollLeft();
+pos.y -= + pr.scrollTop(); 
+/**
+ * End: Solução temporária para o problema do container com scroll
+ */
+
+      x = (event.pageX || 0*(event.clientX + $('html').get(0).scrollLeft)) - pos.x;
+      y = (event.pageY || 0*(event.clientY + $('html').get(0).scrollTop)) - pos.y;
+    }
+    // Subtract distance to middle
+    return { x: x - fb.width / 2, y: y - fb.width / 2 };
+  }
+
+  /**
+   * Mousedown handler
+   */
+  fb.mousedown = function (event) {
+    // Capture mouse
+    if (!document.dragging) {
+      $(document).bind('mousemove', fb.mousemove).bind('mouseup', fb.mouseup);
+      document.dragging = true;
+    }
+
+    // Check which area is being dragged
+    var pos = fb.widgetCoords(event);
+    fb.circleDrag = Math.max(Math.abs(pos.x), Math.abs(pos.y)) * 2 > fb.square;
+
+    // Process
+    fb.mousemove(event);
+    return false;
+  }
+
+  /**
+   * Mousemove handler
+   */
+  fb.mousemove = function (event) {
+    // Get coordinates relative to color picker center
+    var pos = fb.widgetCoords(event);
+
+    // Set new HSL parameters
+    if (fb.circleDrag) {
+      var hue = Math.atan2(pos.x, -pos.y) / 6.28;
+      if (hue < 0) hue += 1;
+      fb.setHSL([hue, fb.hsl[1], fb.hsl[2]]);
+    }
+    else {
+      var sat = Math.max(0, Math.min(1, -(pos.x / fb.square) + .5));
+      var lum = Math.max(0, Math.min(1, -(pos.y / fb.square) + .5));
+      fb.setHSL([fb.hsl[0], sat, lum]);
+    }
+    return false;
+  }
+
+  /**
+   * Mouseup handler
+   */
+  fb.mouseup = function () {
+    // Uncapture mouse
+    $(document).unbind('mousemove', fb.mousemove);
+    $(document).unbind('mouseup', fb.mouseup);
+    document.dragging = false;
+  }
+
+  /**
+   * Update the markers and styles
+   */
+  fb.updateDisplay = function () {
+    // Markers
+    var angle = fb.hsl[0] * 6.28;
+    $('.h-marker', e).css({
+      left: Math.round(Math.sin(angle) * fb.radius + fb.width / 2) + 'px',
+      top: Math.round(-Math.cos(angle) * fb.radius + fb.width / 2) + 'px'
+    });
+
+    $('.sl-marker', e).css({
+      left: Math.round(fb.square * (.5 - fb.hsl[1]) + fb.width / 2) + 'px',
+      top: Math.round(fb.square * (.5 - fb.hsl[2]) + fb.width / 2) + 'px'
+    });
+
+    // Saturation/Luminance gradient
+    $('.color', e).css('backgroundColor', fb.pack(fb.HSLToRGB([fb.hsl[0], 1, 0.5])));
+
+    // Linked elements or callback
+    if (typeof fb.callback == 'object') {
+      // Set background/foreground color
+      $(fb.callback).css({
+        backgroundColor: fb.color,
+        color: fb.hsl[2] > 0.5 ? '#000' : '#fff'
+      });
+
+      // Change linked value
+      $(fb.callback).each(function() {
+        if (this.value && this.value != fb.color) {
+          this.value = fb.color;
+        }
+      });
+    }
+    else if (typeof fb.callback == 'function') {
+      fb.callback.call(fb, fb.color);
+    }
+  }
+
+  /**
+   * Get absolute position of element
+   */
+  fb.absolutePosition = function (el) {
+    var r = { x: el.offsetLeft, y: el.offsetTop };
+    // Resolve relative to offsetParent
+    if (el.offsetParent) {
+      var tmp = fb.absolutePosition(el.offsetParent);
+      r.x += tmp.x;
+      r.y += tmp.y;
+    }
+    return r;
+  };
+
+  /* Various color utility functions */
+  fb.pack = function (rgb) {
+    var r = Math.round(rgb[0] * 255);
+    var g = Math.round(rgb[1] * 255);
+    var b = Math.round(rgb[2] * 255);
+    return '#' + (r < 16 ? '0' : '') + r.toString(16) +
+           (g < 16 ? '0' : '') + g.toString(16) +
+           (b < 16 ? '0' : '') + b.toString(16);
+  }
+
+  fb.unpack = function (color) {
+    if (color.length == 7) {
+      return [parseInt('0x' + color.substring(1, 3)) / 255,
+        parseInt('0x' + color.substring(3, 5)) / 255,
+        parseInt('0x' + color.substring(5, 7)) / 255];
+    }
+    else if (color.length == 4) {
+      return [parseInt('0x' + color.substring(1, 2)) / 15,
+        parseInt('0x' + color.substring(2, 3)) / 15,
+        parseInt('0x' + color.substring(3, 4)) / 15];
+    }
+  }
+
+  fb.HSLToRGB = function (hsl) {
+    var m1, m2, r, g, b;
+    var h = hsl[0], s = hsl[1], l = hsl[2];
+    m2 = (l <= 0.5) ? l * (s + 1) : l + s - l*s;
+    m1 = l * 2 - m2;
+    return [this.hueToRGB(m1, m2, h+0.33333),
+        this.hueToRGB(m1, m2, h),
+        this.hueToRGB(m1, m2, h-0.33333)];
+  }
+
+  fb.hueToRGB = function (m1, m2, h) {
+    h = (h < 0) ? h + 1 : ((h > 1) ? h - 1 : h);
+    if (h * 6 < 1) return m1 + (m2 - m1) * h * 6;
+    if (h * 2 < 1) return m2;
+    if (h * 3 < 2) return m1 + (m2 - m1) * (0.66666 - h) * 6;
+    return m1;
+  }
+
+  fb.RGBToHSL = function (rgb) {
+    var min, max, delta, h, s, l;
+    var r = rgb[0], g = rgb[1], b = rgb[2];
+    min = Math.min(r, Math.min(g, b));
+    max = Math.max(r, Math.max(g, b));
+    delta = max - min;
+    l = (min + max) / 2;
+    s = 0;
+    if (l > 0 && l < 1) {
+      s = delta / (l < 0.5 ? (2 * l) : (2 - 2 * l));
+    }
+    h = 0;
+    if (delta > 0) {
+      if (max == r && max != g) h += (g - b) / delta;
+      if (max == g && max != b) h += (2 + (b - r) / delta);
+      if (max == b && max != r) h += (4 + (r - g) / delta);
+      h /= 6;
+    }
+    return [h, s, l];
+  }
+
+  // Install mousedown handler (the others are set on the document on-demand)
+  $('*', e).mousedown(fb.mousedown);
+
+    // Init color
+  fb.setColor('#000000');
+
+  // Set linked elements/callback
+  if (callback) {
+    fb.linkTo(callback);
+  }
+}
Index: trunk/prototype/plugins/icalendar/icalendarBasic.html
===================================================================
--- trunk/prototype/plugins/icalendar/icalendarBasic.html	(revision 5341)
+++ trunk/prototype/plugins/icalendar/icalendarBasic.html	(revision 5341)
@@ -0,0 +1,31 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
+<title>jQuery iCalendar</title>
+<style type="text/css">
+@import "jquery.icalendar.css";
+</style>
+<script type="text/javascript" src="jquery-1.4.2.js"></script>
+<script type="text/javascript" src="jquery.icalendar.js"></script>
+<script type="text/javascript">
+$(function () {
+	$('#basicICal').icalendar({start: new Date(2008, 1-1, 26, 11, 30, 00),
+		end: new Date(2008, 1-1, 26, 12, 45, 00),
+		title: 'Australia Day lunch',
+		description: 'A traditional barbeque for our big day',
+		location: 'On your local beach'});
+});
+</script>
+</head>
+<body>
+<h1>jQuery iCalendar Basics</h1>
+<p>This page demonstrates the very basics of the
+	<a href="http://keith-wood.name/icalendar.html">jQuery iCalendar plugin</a>.
+	It contains the minimum requirements for using the plugin and
+	can be used as the basis for your own experimentation.</p>
+<p>For more detail see the <a href="http://keith-wood.name/icalendarRef.html">documentation reference</a> page.</p>
+<p>Join us on Australia Day.</p>
+<div id="basicICal"></div>
+</body>
+</html>
Index: trunk/prototype/plugins/icalendar/jquery.icalendar.css
===================================================================
--- trunk/prototype/plugins/icalendar/jquery.icalendar.css	(revision 5341)
+++ trunk/prototype/plugins/icalendar/jquery.icalendar.css	(revision 5341)
@@ -0,0 +1,72 @@
+/* jQuery iCalendar styles v1.1.1 */
+.icalendar_popup_text {
+	cursor: pointer;
+	color: blue;
+	text-decoration: underline;
+}
+.icalendar_popup {
+	display: none;
+	position: absolute;
+	z-index: 100;
+}
+.icalendar_popup ul {
+	float: left;
+	width: 220px;
+	padding: 2px;
+	background-color: #eee;
+	border: 1px solid #aaa;
+}
+.icalendar_popup .icalendar_list li {
+	width: 50%;
+	margin: 0%;
+	padding: 2px 0px;
+	background-color: transparent;
+	border: none;
+}
+.icalendar_list {
+	display: block;
+	list-style-type: none;
+	font-size: 80%;
+	margin: 0px;
+	padding: 0px;
+}
+@media screen and (-webkit-min-device-pixel-ratio:0) {  /* Safari3/Opera9 */
+	.icalendar_list {
+		font-size: 100%;
+	}
+}
+html:first-child .icalendar_list {  /* Opera */
+	font-size: 80%;
+}
+.icalendar_list li {
+	float: left;
+	width: 12%;
+	margin: 0px 1px;
+	padding: 1px;
+	background-color: #eee;
+	border: 1px outset;
+}
+.icalendar_compact {
+	background-color: #eee;
+	border: 1px outset;
+}
+.icalendar_compact li {
+	width: 16px;
+	height: 16px;
+	margin: 0px;
+	padding: 2px;
+	background-color: transparent;
+	border: none;
+}
+.icalendar_list a {
+	width: 100%;
+	text-decoration: none;
+}
+.icalendar_list span {
+	display: inline-block;
+	width: 16px;
+	height: 16px;
+}
+.icalendar_list img {
+	border: none;
+}
Index: trunk/prototype/plugins/icalendar/jquery.icalendar.pack.js
===================================================================
--- trunk/prototype/plugins/icalendar/jquery.icalendar.pack.js	(revision 5341)
+++ trunk/prototype/plugins/icalendar/jquery.icalendar.pack.js	(revision 5341)
@@ -0,0 +1,7 @@
+/* http://keith-wood.name/icalendar.html
+   iCalendar processing for jQuery v1.1.1.
+   Written by Keith Wood (kbwood{at}iinet.com.au) October 2008.
+   Dual licensed under the GPL (http://dev.jquery.com/browser/trunk/jquery/GPL-LICENSE.txt) and 
+   MIT (http://dev.jquery.com/browser/trunk/jquery/MIT-LICENSE.txt) licenses. 
+   Please attribute the author if you use it. */
+eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(L($){8 p=\'Q\';8 q=\'Q-2O-25\';L 1y(){O.1I={26:[],2P:\'Q.3Y\',1J:16,2Q:\'3Z\',1K:1L,2R:1L,2S:\'40 1z 41 27...\',2T:\'\',29:\'\',2a:\'\',1c:14,18:14,1A:\'\',2b:\'\',1M:\'\',1k:\'\',U:\'\',1N:\'\',1d:14,2U:\'2c 1B 42 2V 2W 1z 2X 1s. 43?\',2Y:\'2c 1B 44 45 2W 1z 2X 1s\',2Z:\'46 1z 25 2d 1B 1z 2d 1s\\n\',2e:\'1s.47\',30:\'2c 1s 48 49, 4a 25 2d 1B 31 4b 4c:\\n\'};O.1C={\'32\':{1l:\'4d\',1e:0,1m:14,U:\'33://4e.32.34/27/1B?4f=4g\'+\'&V;4h={t}&V;1n={s}/{e}&V;31={d}&V;1k={l}&V;4i=4j:{u}\'},\'Q\':{1l:\'1y\',1e:1,1m:14,U:\'1D\'},\'4k\':{1l:\'4l\',1e:2,1m:14,U:\'1D\'},\'35\':{1l:\'4m\',1e:3,1m:36,U:\'33://27.35.34/?v=60&V;4n=d&V;1O=20\'+\'&V;1A={t}&V;4o={s}&V;4p={p}&V;4q={d}&V;4r={l}&V;U={u}&V;4s={r}\'}}}8 r=[{1o:\'37\',1i:1},{1o:\'38\',1i:60},{1o:\'39\',1i:2f},{1o:\'Y\',1i:2g},{1o:\'4t\',1i:1},{1o:\'4u\',1i:12},{1o:\'Y\',1i:4v}];8 s=0;8 t=1;8 u=2;8 w=3;8 x=4;8 y=5;8 z=6;$.2h(1y.3a,{1t:\'4w\',4x:L(a){2i(O.1I,a||{});N O},4y:L(a,b,c,d,e){O.1C[a]={1l:b,1e:c,1m:e,U:d};N O},4z:L(){N O.1C},3b:L(a,b){a=$(a);K(a.2j(O.1t)){N}a.4A(O.1t);O.2k(a,b)},4B:L(a,b){a=$(a);K(!a.2j(O.1t)){N}O.2k(a,b)},2k:L(i,j){j=2i($.2h({},O.1I,$.1P(i[0],p)||{}),j);$.1P(i[0],p,j);8 k=j.26||O.1I.26;K(k.X==0){$.1Q(O.1C,L(a){k[k.X]=a})}8 l=L(b,c){8 d={t:1u(j.1A),d:1u(j.1M),s:$.Q.19(j.1c),e:$.Q.19(j.18),p:$.Q.3c(j.1c,j.18),l:1u(j.1k),u:1u(j.U),c:1u(j.1N),r:2l(j.1d)};K(b.1m){b.1m.3d(i,[d,j])}8 e=b.U;$.1Q(d,L(n,v){8 a=1a 4C(\'\\\\{\'+n+\'\\\\}\',\'g\');e=e.1E(a,v)});8 e=(b.U==\'1D\'?\'#\':e);8 f=$(\'<3e></3e>\');8 g=$(\'<a 2m="\'+e+\'" 1A="\'+j.2T+b.1l+\'"\'+(b.U==\'1D\'?\'\':\' 2Q="\'+j.4D+\'"\')+\'></a>\');K(b.U==\'1D\'){g.3f(L(){N $.Q.3g(i[0],c)})}8 h=\'\';K(b.1e!=14){K(2n b.1e==\'4E\'){h+=\'<1R 1S="4F: \'+\'4G U(\'+j.2P+\') 4H-4I -\'+(b.1e*j.1J)+\'2o 4J;\'+($.1f.3h&&$.1f.2p<\'1.9\'?\' 3i-2q: \'+j.1J+\'2o; 3i-3j: \'+1p.4K(0,(j.1J/2)-5)+\'2o;\':\'\')+\'"></1R>\'}R{h+=\'<4L 3k="\'+b.1e+\'"\'+(($.1f.3h&&$.1f.2p<\'1.9\')||($.1f.3l&&$.1f.2p<\'7.0\')?\' 1S="2r-2s: 3j;"\':($.1f.3l?\' 1S="2r-2s: 4M;"\':($.1f.4N||$.1f.4O?\' 1S="2r-2s: 4P;"\':\'\')))+\'/>\'}h+=(j.1K?\'\':\'&#4Q;\')}g.4R(h+(j.1K?\'\':b.1l));f.1T(g);N f};8 m=$(\'<3m 1U="4S\'+(j.1K?\' 4T\':\'\')+\'"></3m>\');8 o=O.1C;$.1Q(k,L(a,b){m.1T(l(o[b],b))});i.3n().1T(m);K(j.2R){m.4U(\'<1R 1U="4V">\'+j.2S+\'</1R>\').4W(\'<1V 1U="3o"></1V>\');i.3f(L(){8 a=$(O);8 b=a.4X();$(\'.3o\',a).3p(\'2q\',b.2q).3p(\'3q\',b.3q+a.4Y()).4Z()})}},50:L(a){a=$(a);K(!a.2j(O.1t)){N}a.51(O.1t).3n();$.52(a[0],p)},3g:L(a,b){8 c=$.1P(a,p);8 d=3r(c);K(c.29){3s.1k.2m=c.29+\'?53=\'+54(d)}R K(c.2a){$(c.2a).55(d)}R K(!c.2e){2t(c.30+d)}R K(56(c.2U)){8 e=\'\';K(e=3t(d,c.2e)){2t(c.2Z+e)}R{2t(c.2Y)}}N 1L},11:L(a){N(a<10?\'0\':\'\')+a},3u:L(a,b){N(!a?\'\':\'\'+a.1v()+O.11(a.2u()+1)+O.11(a.1W()))},19:L(a,b){N(!a?\'\':(b?\'\'+a.1v()+O.11(a.2u()+1)+O.11(a.1W())+\'T\'+O.11(a.57())+O.11(a.2v())+O.11(a.58()):\'\'+a.59()+O.11(a.5a()+1)+O.11(a.5b())+\'T\'+O.11(a.5c())+O.11(a.5d())+O.11(a.5e())+\'Z\'))},3c:L(a,b){K(!a||!b){N\'\'}8 c=1p.5f(b.1j()-a.1j())/3v;8 d=1p.1F(c/2g);c-=d*2g;8 e=1p.1F(c/2f);c-=e*2f;8 f=1p.1F(c/60);c-=f*60;N(a.1j()>b.1j()?\'-\':\'\')+\'P\'+(d>0?d+\'D\':\'\')+(e||f||c?\'T\'+e+\'H\':\'\')+(f||c?f+\'M\':\'\')+(c?c+\'S\':\'\')},5g:L(d,e){K(!e){N d}8 f=1a Y(d.1j());8 g=I.15(e);K(!g){1q\'1X 2w\';}K(g[2]&&(g[3]||g[5]||g[6]||g[7])){1q\'1X 2w - 5h 5i 2V 5j 5k 5l\';}K(!g[4]&&(g[5]||g[6]||g[7])){1q\'1X 2w - 5m 5n 5o\';}8 h=(g[1]==\'-\'?-1:+1);8 i=L(a,b,c){a=2x(a);K(!5p(a)){f[\'5q\'+c](f[\'5r\'+c]()+h*a*b)}};K(g[2]){i(g[2],7,\'Y\')}R{i(g[3],1,\'Y\');i(g[5],1,\'39\');i(g[6],1,\'38\');i(g[7],1,\'37\')}N f},5s:L(a){8 b={};8 c={};8 d=3w(a);2y(d,0,b,c);K(!b.3x){1q\'1X 1y 1P\';}N b.3x},1Y:L(a,b){N 1Y(a,b)},5t:L(a,b){N 2z(a,b)}});L 2i(a,b){$.2h(a,b);1g(8 c 3y b){K(b[c]==14){a[c]=14}}N a}$.5u.Q=L(a){8 b=3z.3a.3A.5v(5w,1);N O.1Q(L(){K(2n a==\'3B\'){$.Q[\'1w\'+a+\'5x\'].3d($.Q,[O].3C(b))}R{$.Q.3b(O,a||{})}})};$.Q=1a 1y();L 36(b,c){8 d=L(a){N(a<10?\'0\':\'\')+a};8 e=(c.18?(c.18.1j()-c.1c.1j())/5y:0);b.p=(e?d(1p.1F(e/60))+\'\'+d(e%60):\'\');K(b.r){8 f=(c.1d.13&&c.1d.13[0].1O==\'5z\'?c.1d.13[0].1G.3D(\'\').1Z():\'\');8 g={3E:\'5A\',5B:\'5C\',5D:\'5E\',5F:\'5G\'}[c.1d.3F];b.r=(f||g?d(c.1d.2A||1)+(f||g):\'\')}}L 3r(c){8 d=L(a){8 b=\'\';21(a.X>2B){b+=a.2C(0,2B)+\'\\n\';a=\' \'+a.2C(2B)}b+=a;N b};N\'22:3G\\n\'+\'5H:2.0\\n\'+\'5I:5J.Q\\n\'+\'5K:5L\\n\'+\'22:3H\\n\'+\'5M:\'+1a Y().1j()+\'@\'+(3s.1k.2m.1E(/^[^\\/]*\\/\\/([^\\/]*)\\/.*$/,\'$1\')||\'5N\')+\'\\n\'+\'5O:\'+$.Q.19(1a Y())+\'\\n\'+(c.U?d(\'5P:\'+c.U)+\'\\n\':\'\')+(c.1N?d(\'5Q:\'+c.1N)+\'\\n\':\'\')+d(\'5R:\'+c.1A)+\'\\n\'+\'5S:\'+$.Q.19(c.1c)+\'\\n\'+\'5T:\'+$.Q.19(c.18)+\'\\n\'+(c.2b?d(\'5U:\'+c.2b)+\'\\n\':\'\')+(c.1M?d(\'5V:\'+c.1M)+\'\\n\':\'\')+(c.1k?d(\'5W:\'+c.1k)+\'\\n\':\'\')+(c.1d?2l(c.1d)+\'\\n\':\'\')+\'23:3H\\n\'+\'23:3G\'}L 2l(a){K(!a){N\'\'}8 b=\'\';K(a.1n){b=\'2D;2E=3I:\';K(!1b(a.1n)){a.1n=[a.1n]}1g(8 i=0;i<a.1n.X;i++){b+=(i>0?\',\':\'\')+$.Q.3u(a.1n[i])}}R K(a.1x){b=\'2D;2E=3I-5X:\';K(!1b(a.1x)){a.1x=[a.1x]}1g(8 i=0;i<a.1x.X;i++){b+=(i>0?\',\':\'\')+$.Q.19(a.1x[i])}}R K(a.1h){b=\'2D;2E=5Y:\';K(!1b(a.1h[0])){a.1h=[a.1h]}1g(8 i=0;i<a.1h.X;i++){b+=(i>0?\',\':\'\')+$.Q.19(a.1h[i][0])+\'/\'+(a.1h[i][1].3J!=Y?a.1h[i][1]:$.Q.19(a.1h[i][1]))}}R{b=\'5Z:61=\'+(a.3F||\'3E\').3K()+(a.2A?\';62=\'+a.2A:\'\')+(a.3L?\';63=\'+$.Q.19(a.3L):(a.3M?\';64=\'+a.3M:\'\'))+(a.3N!=14?\';65=\'+[\'66\',\'67\',\'68\',\'69\',\'6a\',\'6b\',\'6c\'][a.3N]:\'\');K(a.13){K(!1b(a.13)){a.13=[a.13]}1g(8 i=0;i<a.13.X;i++){K(!1b(a.13[i].1G)){a.13[i].1G=[a.13[i].1G]}b+=\';6d\'+a.13[i].1O.3K()+\'=\'+a.13[i].1G.3D(\',\')}}}N b}L 3t(a,b){$(\'#\'+q).6e();6f{$(\'6g\').1T(\'<1V 6h="\'+q+\'"><3O 3k="\'+b+\'" 6i="1s=\'+1u(a)+\'" 6j="0" 6k="0" 1O="6l/x-6m-2O"></3O></1V>\');N\'\'}6n(e){N e}}8 A=/^\\s(.*)$/;8 B=/^([A-2F-2G-9-]+)((?:;[A-2F-2G-9-]+=(?:"[^"]+"|[^";:,]+)(?:,(?:"[^"]+"|[^";:,]+))*)*):(.*)$/;8 C=/;([A-2F-2G-9-]+)=((?:"[^"]+"|[^";:,]+)(?:,(?:"[^"]+"|[^";:,]+))*)/g;8 D=/,?("[^"]+"|[^";:,]+)/g;8 E=/^(\\d{4})(\\d\\d)(\\d\\d)$/;8 F=/^(\\d{4})(\\d\\d)(\\d\\d)T(\\d\\d)(\\d\\d)(\\d\\d)(Z?)$/;8 G=/^(\\d{4})(\\d\\d)(\\d\\d)T(\\d\\d)(\\d\\d)(\\d\\d)(Z?)\\/(\\d{4})(\\d\\d)(\\d\\d)T(\\d\\d)(\\d\\d)(\\d\\d)(Z?)$/;8 H=/^([+-])(\\d\\d)(\\d\\d)$/;8 I=/^([+-])?P(\\d+W)?(\\d+D)?(T)?(\\d+H)?(\\d+M)?(\\d+S)?$/;8 J=[\'1U\'];L 3w(b){8 c=b.1E(/\\r\\n/g,\'\\n\').6o(\'\\n\');1g(8 i=c.X-1;i>0;i--){8 d=A.15(c[i]);K(d){c[i-1]+=d[1];c[i]=\'\'}}N $.6p(c,L(a,i){N(a?a:14)})}L 2y(a,b,c,d){K(b>=a.X||a[b].2H(\'22:\')!=0){1q\'2I 3P 1c\';}8 e={};8 f=a[b].2C(6);2J(c,f.1Z(),e);b++;21(b<a.X&&a[b].2H(\'23:\')!=0){K(a[b].2H(\'22:\')==0){b=2y(a,b,e,d)}R{8 g=3Q(a[b]);2J(e,g.3R,(g.2K?g.17:g))}b++}K(f==\'6q\'){8 h=H.15(e.6r.6s);K(h){d[e.1r]=(h[1]==\'-\'?-1:+1)*(2x(h[2],10)*60+2x(h[3],10))}}R{1g(8 i 3y e){2L(e[i],d)}}K(a[b]!=\'23:\'+f){1q\'2I 3P 18 \'+f;}N b}L 2L(c,d){K(!c){N}K(c.1r&&c.17){8 e=d[c.1r];8 f=L(a,b){a.3S(a.2v()-e);a.3T=b};K(1b(c.17)){1g(8 i=0;i<c.17.X;i++){f(c.17[i],c.1r)}}R K(c.17.1c&&c.17.18){f(c.17.1c,c.1r);f(c.17.18,c.1r)}R{f(c.17,c.1r)}}R K(1b(c)){1g(8 i=0;i<c.X;i++){2L(c[i],d)}}}L 2J(a,b,c){K(2n c==\'3B\'){c=c.1E(/\\\\n/g,\'\\n\')}K($.6t(b,J)>-1){b+=\'1w\'}K(a[b]){K(!1b(a[b])||a[\'1w\'+b+\'24\']){a[b]=[a[b]]}a[b][a[b].X]=c;K(a[\'1w\'+b+\'24\']){a[\'1w\'+b+\'24\']=6u}}R{a[b]=c;K(1b(c)){a[\'1w\'+b+\'24\']=3U}}}L 3Q(a){8 b={};8 c=B.15(a);K(!c){1q\'2I 6v 6w: \'+a;}b.3R=c[1].1Z();b.17=2M(c[3]);b.2K=3U;2z(b,c[2]);N b}L 2z(a,b){8 c=C.15(b);21(c){8 d=[];8 e=D.15(c[2]);21(e){d.6x(2M(e[1].1E(/^"(.*)"$/,\'$1\')));e=D.15(c[2])}a[c[1].1Z()]=(d.X>1?d:d[0]);a.2K=1L;c=C.15(b)}}L 2M(a){8 b=F.15(a);K(b){N 1H(b)}b=G.15(a);K(b){N{1c:1H(b),18:1H(b.3A(7))}}b=E.15(a);K(b){N 1H(b.3C([0,0,0,\'\']))}N a}L 1H(a){8 b=1a Y(a[1],a[2]-1,a[3],a[4],a[5],a[6]);b.3T=(a[7]?\'6y\':\'6z\');N 3V(b)}L 3V(a){a.3S(a.2v()-a.3W());N a}L 1Y(a,b){b=(b||b==0?b:1);8 c=1a Y(a.1v(),a.2u(),a.1W(),(a.3W()/-60));8 d=1a Y(c.1v(),1-1,4);8 e=d.3X();d.2N(4+b-e-(b>e?7:0));K(c<d){c.2N(c.1W()-3);N 1Y(c,b)}R K(c>1a Y(c.1v(),12-1,28)){8 f=1a Y(c.1v()+1,1-1,4);e=f.3X();f.2N(4+b-e-(b>e?7:0));K(c>=f){N 1}}N 1p.1F(((c-d)/(r[w].1i*3v))/7)+1}L 1b(a){N(a&&a.3J==3z)}})(6A);',62,409,'||||||||var||||||||||||||||||||||||||||||||||||||if|function||return|this||icalendar|else|||url|amp||length|Date|||_ensureTwo||by|null|exec||_value|end|formatDateTime|new|isArray|start|recurrence|icon|browser|for|periods|factor|getTime|location|display|override|dates|method|Math|throw|tzid|clipboard|markerClassName|encodeURIComponent|getFullYear|_|times|iCalendar|to|title|event|_sites|echo|replace|floor|values|makeDate|_defaults|iconSize|compact|false|description|contact|type|data|each|span|style|append|class|div|getDate|Invalid|getWeekOfYear|toLowerCase||while|BEGIN|END|IsArray|copy|sites|calendar||echoUrl|echoField|summary|The|the|copyFlash|3600|86400|extend|extendRemove|hasClass|_updateICalendar|makeRecurrence|href|typeof|px|version|left|vertical|align|alert|getMonth|getMinutes|duration|parseInt|parseGroup|parseParams|interval|75|substr|RDATE|VALUE|Za|z0|indexOf|Missing|addEntry|_simple|resolveTimezones|checkDate|setDate|flash|icons|target|popup|popupText|tipPrefix|copyConfirm|be|copied|your|copySucceeded|copyFailed|copyUnavailable|details|google|http|com|yahoo|yahooOverride|Seconds|Minutes|Hours|prototype|_attachICalendar|calculateDuration|apply|li|click|_echo|mozilla|padding|bottom|src|msie|ul|empty|icalendar_popup|css|top|makeICalendar|window|copyViaFlash|formatDate|1000|unfoldLines|vcalendar|in|Array|slice|string|concat|join|daily|freq|VCALENDAR|VEVENT|DATE|constructor|toUpperCase|until|count|weekStart|embed|group|parseEntry|_name|setMinutes|_type|true|utcDate|getTimezoneOffset|getDay|png|_blank|Send|my|will|Continue|has|been|Failed|swf|is|unavailable|please|from|below|Google|www|action|TEMPLATE|text|sprop|website|outlook|Outlook|Yahoo|view|st|dur|desc|in_loc|rpat|Month|FullYear|604800|hasICalendar|setDefaults|addSite|getSites|addClass|_changeICalendar|RegExp|_target|number|background|transparent|no|repeat|0px|max|img|middle|opera|safari|baseline|xa0|html|icalendar_list|icalendar_compact|before|icalendar_popup_text|wrap|offset|outerHeight|toggle|_destroyICalendar|removeClass|removeData|content|escape|val|confirm|getHours|getSeconds|getUTCFullYear|getUTCMonth|getUTCDate|getUTCHours|getUTCMinutes|getUTCSeconds|abs|addDuration|week|must|on|its|own|missing|time|marker|isNaN|setUTC|getUTC|parse|_parseParams|fn|call|arguments|ICalendar|60000|day|dy|weekly|wk|monthly|mh|yearly|yr|VERSION|PRODID|jquery|METHOD|PUBLISH|UID|localhost|DTSTAMP|URL|MAILTO|TITLE|DTSTART|DTEND|SUMMARY|DESCRIPTION|LOCATION|TIME|PERIOD|RRULE||FREQ|INTERVAL|UNTIL|COUNT|WKST|SU|MO|TU|WE|TH|FR|SA|BY|remove|try|body|id|FlashVars|width|height|application|shockwave|catch|split|map|VTIMEZONE|standard|tzoffsetto|inArray|undefined|entry|name|push|UTC|float|jQuery'.split('|'),0,{}))
Index: trunk/prototype/plugins/icalendar/jquery.icalendar.js
===================================================================
--- trunk/prototype/plugins/icalendar/jquery.icalendar.js	(revision 5341)
+++ trunk/prototype/plugins/icalendar/jquery.icalendar.js	(revision 5341)
@@ -0,0 +1,793 @@
+/* http://keith-wood.name/icalendar.html
+   iCalendar processing for jQuery v1.1.1.
+   Written by Keith Wood (kbwood{at}iinet.com.au) October 2008.
+   Dual licensed under the GPL (http://dev.jquery.com/browser/trunk/jquery/GPL-LICENSE.txt) and 
+   MIT (http://dev.jquery.com/browser/trunk/jquery/MIT-LICENSE.txt) licenses. 
+   Please attribute the author if you use it. */
+
+(function($) { // Hide scope, no $ conflict
+
+var PROP_NAME = 'icalendar';
+var FLASH_ID = 'icalendar-flash-copy';
+
+/* iCalendar sharing manager. */
+function iCalendar() {
+	this._defaults = {
+		sites: [],  // List of site IDs to use, empty for all
+		icons: 'icalendar.png', // Horizontal amalgamation of all site icons
+		iconSize: 16,  // The size of the individual icons
+		target: '_blank',  // The name of the target window for the iCalendar links
+		compact: false,  // True if a compact presentation should be used, false for full
+		popup: false,  // True to have it popup on demand, false to show always
+		popupText: 'Send to my calendar...', // Text for the popup trigger
+		tipPrefix: '',  // Additional text to show in the tool tip for each icon
+		echoUrl: '',  // The URL to echo back iCalendar content, or blank for clipboard
+		echoField: '', // The ID of a field to copy the iCalendar definition into, or blank for clipboard
+		start: null,  // The start date/time of the event
+		end: null,  // The end date/time of the event
+		title: '',  // The title of the event
+		summary: '',  // The summary of the event
+		description: '',  // The description of the event
+		location: '',  // The location of the event
+		url: '',  // A URL with more information about the event
+		contact: '',  // An e-mail address for further contact about the event
+		recurrence: null, // Details about a recurring event, an object with attributes:
+			// dates (Date or Date[]) or times (Date or Date[]) or
+			// periods (Date[2] or Date[][2] or [][Date, string]) or
+			// freq (string - secondly, minutely, hourly, daily, weekly, monthly, yearly),
+			// interval (number), until (Date), count (number), weekStart (number),
+			// by (object or object[] - type (string - second, minute, day, monthday, yearday,
+			// weekno, month, setpos), values (number or number[] or string or string[]))
+		// Confirmation message for clipboard copy
+		copyConfirm: 'The event will be copied to your clipboard. Continue?',
+		// Success message during clipboard copy
+		copySucceeded: 'The event has been copied to your clipboard',
+		// Failure message during clipboard copy
+		copyFailed: 'Failed to copy the event to the clipboard\n',
+		copyFlash: 'clipboard.swf', // The URL for the Flash clipboard copy module
+		// Clipboard not supported message
+		copyUnavailable: 'The clipboard is unavailable, please copy the event details from below:\n'
+	};
+	this._sites = {  // The definitions of the available iCalendar sites
+		'google': {display: 'Google', icon: 0, override: null,
+			url: 'http://www.google.com/calendar/event?action=TEMPLATE' +
+			'&amp;text={t}&amp;dates={s}/{e}&amp;details={d}&amp;location={l}&amp;sprop=website:{u}'},
+		'icalendar': {display: 'iCalendar', icon: 1, override: null, url: 'echo'},
+		'outlook': {display: 'Outlook', icon: 2, override: null, url: 'echo'},
+		'yahoo': {display: 'Yahoo', icon: 3, override: yahooOverride,
+			url: 'http://calendar.yahoo.com/?v=60&amp;view=d&amp;type=20' +
+			'&amp;title={t}&amp;st={s}&amp;dur={p}&amp;desc={d}&amp;in_loc={l}&amp;url={u}&amp;rpat={r}'}
+	};
+}
+
+var FREQ_SETTINGS = [{method: 'Seconds', factor: 1},
+	{method: 'Minutes', factor: 60}, {method: 'Hours', factor: 3600},
+	{method: 'Date', factor: 86400}, {method: 'Month', factor: 1},
+	{method: 'FullYear', factor: 12}, {method: 'Date', factor: 604800}];
+var SE = 0;
+var MI = 1;
+var HR = 2;
+var DY = 3;
+var MO = 4;
+var YR = 5;
+var WK = 6;
+
+$.extend(iCalendar.prototype, {
+	/* Class name added to elements to indicate already configured with iCalendar. */
+	markerClassName: 'hasICalendar',
+
+	/* Override the default settings for all iCalendar instances.
+	   @param  settings  (object) the new settings to use as defaults
+	   @return void */
+	setDefaults: function(settings) {
+		extendRemove(this._defaults, settings || {});
+		return this;
+	},
+
+	/* Add a new iCalendar site to the list.
+	   @param  id        (string) the ID of the new site
+	   @param  display   (string) the display name for this site
+	   @param  icon      (url) the location of an icon for this site (16x16), or
+	                     (number) the index of the icon within the combined image
+	   @param  url       (url) the submission URL for this site
+	                     with {t} marking where the event title should be inserted,
+	                     {s} indicating the event start date/time insertion point,
+	                     {e} indicating the event end date/time insertion point,
+	                     {p} indicating the event period (duration) insertion point,
+	                     {d} indicating the event description insertion point,
+	                     {l} indicating the event location insertion point,
+	                     {u} indicating the event URL insertion point,
+	                     {c} indicating the event contact insertion point,
+	                     {r} indicating the event recurrence insertion point
+	   @param  override  (function, optional) a function to override default settings
+	   @return void */
+	addSite: function(id, display, icon, url, override) {
+		this._sites[id] = {display: display, icon: icon, override: override, url: url};
+		return this;
+	},
+
+	/* Return the list of defined sites.
+	   @return  object[] - indexed by site id (string), each object contains
+	            display (string) the display name,
+	            icon    (string) the location of the icon, or
+	                    (number) the icon's index in the combined image
+	            url     (string) the submission URL for the site */
+	getSites: function() {
+		return this._sites;
+	},
+
+	/* Attach the iCalendar widget to a div. */
+	_attachICalendar: function(target, settings) {
+		target = $(target);
+		if (target.hasClass(this.markerClassName)) {
+			return;
+		}
+		target.addClass(this.markerClassName);
+		this._updateICalendar(target, settings);
+	},
+
+	/* Reconfigure the settings for an iCalendar div. */
+	_changeICalendar: function(target, settings) {
+		target = $(target);
+		if (!target.hasClass(this.markerClassName)) {
+			return;
+		}
+		this._updateICalendar(target, settings);
+	},
+
+	/* Construct the requested iCalendar links. */
+	_updateICalendar: function(target, settings) {
+		settings = extendRemove($.extend({}, this._defaults,
+			$.data(target[0], PROP_NAME) || {}), settings);
+		$.data(target[0], PROP_NAME, settings);
+		var sites = settings.sites || this._defaults.sites;
+		if (sites.length == 0) { // default to all sites
+			$.each(this._sites, function(id) {
+				sites[sites.length] = id;
+			});
+		}
+		var addSite = function(site, calId) {
+			var inserts = {t: encodeURIComponent(settings.title),
+				d: encodeURIComponent(settings.description),
+				s: $.icalendar.formatDateTime(settings.start),
+				e: $.icalendar.formatDateTime(settings.end),
+				p: $.icalendar.calculateDuration(settings.start, settings.end),
+				l: encodeURIComponent(settings.location),
+				u: encodeURIComponent(settings.url),
+				c: encodeURIComponent(settings.contact),
+				r: makeRecurrence(settings.recurrence)};
+			if (site.override) {
+				site.override.apply(target, [inserts, settings]);
+			}
+			var url = site.url;
+			$.each(inserts, function(n, v) {
+				var re = new RegExp('\\{' + n + '\\}', 'g');
+				url = url.replace(re, v);
+			});
+			var url = (site.url == 'echo' ? '#' : url);
+			var item = $('<li></li>');
+			var anchor = $('<a href="' + url + '" title="' + settings.tipPrefix + site.display + '"' +
+				(site.url == 'echo' ? '' : ' target="' + settings._target + '"') + '></a>');
+			if (site.url == 'echo') {
+				anchor.click(function() {
+					return $.icalendar._echo(target[0], calId);
+				});
+			}
+			var html = '';
+			if (site.icon != null) {
+				if (typeof site.icon == 'number') {
+					html += '<span style="background: ' +
+						'transparent url(' + settings.icons + ') no-repeat -' +
+						(site.icon * settings.iconSize) + 'px 0px;' +
+						($.browser.mozilla && $.browser.version < '1.9' ?
+						' padding-left: ' + settings.iconSize + 'px; padding-bottom: ' +
+						Math.max(0, (settings.iconSize / 2) - 5) + 'px;' : '') + '"></span>';
+				}
+				else {
+					html += '<img src="' + site.icon + '"' +
+						(($.browser.mozilla && $.browser.version < '1.9') ||
+						($.browser.msie && $.browser.version < '7.0') ?
+						' style="vertical-align: bottom;"' :
+						($.browser.msie ? ' style="vertical-align: middle;"' :
+						($.browser.opera || $.browser.safari ?
+						' style="vertical-align: baseline;"' : ''))) + '/>';
+				}
+				html +=	(settings.compact ? '' : '&#xa0;');
+			}
+			anchor.html(html + (settings.compact ? '' : site.display));
+			item.append(anchor);
+			return item;
+		};
+		var list = $('<ul class="icalendar_list' +
+			(settings.compact ? ' icalendar_compact' : '') + '"></ul>');
+		var allSites = this._sites;
+		$.each(sites, function(index, id) {
+			list.append(addSite(allSites[id], id));
+		});
+		target.empty().append(list);
+		if (settings.popup) {
+			list.before('<span class="icalendar_popup_text">' +
+				settings.popupText + '</span>').
+				wrap('<div class="icalendar_popup"></div>');
+			target.click(function() {
+				var target = $(this);
+				var offset = target.offset();
+				$('.icalendar_popup', target).css('left', offset.left).
+					css('top', offset.top + target.outerHeight()).toggle();
+			});
+		}
+	},
+
+	/* Remove the iCalendar widget from a div. */
+	_destroyICalendar: function(target) {
+		target = $(target);
+		if (!target.hasClass(this.markerClassName)) {
+			return;
+		}
+		target.removeClass(this.markerClassName).empty();
+		$.removeData(target[0], PROP_NAME);
+	},
+
+	/* Echo the iCalendar text back to the user either as a
+	   downloadable file or via the clipboard.
+	   @param  target  (element) the owning division
+	   @param  calId  (string) the ID of the site to send the calendar to */
+	_echo: function(target, calId) {
+		var settings = $.data(target, PROP_NAME);
+		var event = makeICalendar(settings);
+		if (settings.echoUrl) {
+			window.location.href = settings.echoUrl + '?content=' + escape(event);
+		}
+		else if (settings.echoField) {
+			$(settings.echoField).val(event);
+		}
+		else if (!settings.copyFlash) {
+			alert(settings.copyUnavailable + event);
+		}
+		else if (confirm(settings.copyConfirm)) {
+			var error = '';
+			if (error = copyViaFlash(event, settings.copyFlash)) {
+				alert(settings.copyFailed + error);
+				}
+				else {
+				alert(settings.copySucceeded);
+				}
+			}
+		return false; // Don't follow link
+	},
+	
+	/* Ensure a string has at least two digits.
+	   @param  value  (number) the number to convert
+	   @return  (string) the string equivalent */
+	_ensureTwo: function(value) {
+		return (value < 10 ? '0' : '') + value;
+	},
+
+	/* Format a date for iCalendar: yyyymmdd.
+	   @param  date   (Date) the date to format
+	   @return  (string) the formatted date */
+	formatDate: function(date, local) {
+		return (!date ? '' : '' + date.getFullYear() +
+			this._ensureTwo(date.getMonth() + 1) + this._ensureTwo(date.getDate()));
+	},
+
+	/* Format a date/time for iCalendar: yyyymmddThhmmss[Z].
+	   @param  dateTime  (Date) the date/time to format
+	   @param  local     (boolean) true if this should be a local date/time
+	   @return  (string) the formatted date/time */
+	formatDateTime: function(dateTime, local) {
+		return (!dateTime ? '' : (local ?
+			'' + dateTime.getFullYear() + this._ensureTwo(dateTime.getMonth() + 1) +
+			this._ensureTwo(dateTime.getDate()) + 'T' + this._ensureTwo(dateTime.getHours()) +
+			this._ensureTwo(dateTime.getMinutes()) + this._ensureTwo(dateTime.getSeconds()) :
+			'' + dateTime.getUTCFullYear() + this._ensureTwo(dateTime.getUTCMonth() + 1) +
+			this._ensureTwo(dateTime.getUTCDate()) + 'T' + this._ensureTwo(dateTime.getUTCHours()) +
+			this._ensureTwo(dateTime.getUTCMinutes()) + this._ensureTwo(dateTime.getUTCSeconds()) + 'Z'));
+	},
+
+	/* Calculate the duration between two date/times.
+	   @param  start  (Date) the starting date/time
+	   @param  end    (Date) the ending date/time
+	   @return  (string) the formatted duration or blank if invalid parameters */
+	calculateDuration: function(start, end) {
+		if (!start || !end) {
+			return '';
+		}
+		var seconds = Math.abs(end.getTime() - start.getTime()) / 1000;
+		var days = Math.floor(seconds / 86400);
+		seconds -= days * 86400;
+		var hours = Math.floor(seconds / 3600);
+		seconds -= hours * 3600;
+		var minutes = Math.floor(seconds / 60);
+		seconds -= minutes * 60;
+		return (start.getTime() > end.getTime() ? '-' : '') +
+			'P' + (days > 0 ? days + 'D' : '') +
+			(hours || minutes || seconds ? 'T' + hours + 'H' : '') +
+			(minutes || seconds ? minutes + 'M' : '') + (seconds ? seconds + 'S' : '');
+	},
+
+	/* Calculate the end date/time given a start and a duration.
+	   @param  start     (Date) the starting date/time
+	   @param  duration  (string) the description of the duration
+	   @return  (Date) the ending date/time
+	   @throws  error if an invalid duration is found */
+	addDuration: function(start, duration) {
+		if (!duration) {
+			return start;
+		}
+		var end = new Date(start.getTime());
+		var matches = DURATION.exec(duration);
+		if (!matches) {
+			throw 'Invalid duration';
+		}
+		if (matches[2] && (matches[3] || matches[5] || matches[6] || matches[7])) {
+			throw 'Invalid duration - week must be on its own'; // Week must be on its own
+		}
+		if (!matches[4] && (matches[5] || matches[6] || matches[7])) {
+			throw 'Invalid duration - missing time marker'; // Missing T with hours/minutes/seconds
+		}
+		var sign = (matches[1] == '-' ? -1 : +1);
+		var apply = function(value, factor, method) {
+			value = parseInt(value);
+			if (!isNaN(value)) {
+				end['setUTC' + method](end['getUTC' + method]() + sign * value * factor);
+			}
+		};
+		if (matches[2]) {
+			apply(matches[2], 7, 'Date');
+		}
+		else {
+			apply(matches[3], 1, 'Date');
+			apply(matches[5], 1, 'Hours');
+			apply(matches[6], 1, 'Minutes');
+			apply(matches[7], 1, 'Seconds');
+		}
+		return end;
+	},
+
+	/* Parse the iCalendar data into a JavaScript object model.
+	   @param  content  (string) the original iCalendar data
+	   @return  (object) the iCalendar JavaScript model
+	   @throws  errors if the iCalendar structure is incorrect */
+	parse: function(content) {
+		var cal = {};
+		var timezones = {};
+		var lines = unfoldLines(content);
+		parseGroup(lines, 0, cal, timezones);
+		if (!cal.vcalendar) {
+			throw 'Invalid iCalendar data';
+		}
+		return cal.vcalendar;
+	},
+
+	/* Calculate the week of the year for a given date
+	   according to the ISO 8601 definition.
+	   @param  date       (Date) the date to calculate the week for
+	   @param  weekStart  (number) the day on which a week starts:
+	                      0 = Sun, 1 = Mon, ... (optional, defaults to 1)
+	   @return  (number) the week for these parameters (1-53) */
+	getWeekOfYear: function(date, weekStart) {
+		return getWeekOfYear(date, weekStart);
+	},
+
+	_parseParams: function(owner, params) {
+		return parseParams(owner, params);
+	}
+});
+
+/* jQuery extend now ignores nulls! */
+function extendRemove(target, props) {
+	$.extend(target, props);
+	for (var name in props) {
+		if (props[name] == null) {
+			target[name] = null;
+		}
+	}
+	return target;
+}
+
+/* Attach the iCalendar functionality to a jQuery selection.
+   @param  command  (string) the command to run (optional, default 'attach')
+   @param  options  (object) the new settings to use for these iCalendar instances
+   @return  (jQuery object) jQuery for chaining further calls */
+$.fn.icalendar = function(options) {
+	var otherArgs = Array.prototype.slice.call(arguments, 1);
+	return this.each(function() {
+		if (typeof options == 'string') {
+			$.icalendar['_' + options + 'ICalendar'].
+				apply($.icalendar, [this].concat(otherArgs));
+		}
+		else {
+			$.icalendar._attachICalendar(this, options || {});
+		}
+	});
+};
+
+/* Initialise the iCalendar functionality. */
+$.icalendar = new iCalendar(); // singleton instance
+
+/* Override some substitution values for Yahoo.
+   @param  inserts   (object) current values (updated)
+   @param  settings  (object) current instance settings */
+function yahooOverride(inserts, settings) {
+	var twoDigits = function(value) {
+		return (value < 10 ? '0' : '') + value;
+	};
+	var dur = (settings.end ? (settings.end.getTime() - settings.start.getTime()) / 60000 : 0);
+	inserts.p = (dur ? twoDigits(Math.floor(dur / 60)) + '' + twoDigits(dur % 60) : ''); // hhmm
+	if (inserts.r) {
+		var byDay = (settings.recurrence.by && settings.recurrence.by[0].type == 'day' ?
+			settings.recurrence.by[0].values.join('').toLowerCase() : '');
+		var freq = {daily: 'dy', weekly: 'wk', monthly: 'mh', yearly: 'yr'}[settings.recurrence.freq];
+		inserts.r = (byDay || freq ? twoDigits(settings.recurrence.interval || 1) + (byDay || freq) : '');
+	}
+}
+
+/* Construct an iCalendar with an event object.
+   @param  event  (object) the event details
+   @return  (string) the iCalendar definition */
+function makeICalendar(event) {
+	var limit75 = function(text) {
+		var out = '';
+		while (text.length > 75) {
+			out += text.substr(0, 75) + '\n';
+			text = ' ' + text.substr(75);
+		}
+		out += text;
+		return out;
+	};
+	return 'BEGIN:VCALENDAR\n' +
+		'VERSION:2.0\n' +
+		'PRODID:jquery.icalendar\n' +
+		'METHOD:PUBLISH\n' +
+		'BEGIN:VEVENT\n' +
+		'UID:' + new Date().getTime() + '@' +
+		(window.location.href.replace(/^[^\/]*\/\/([^\/]*)\/.*$/, '$1') || 'localhost') + '\n' +
+		'DTSTAMP:' + $.icalendar.formatDateTime(new Date()) + '\n' +
+		(event.url ? limit75('URL:' + event.url) + '\n' : '') +
+		(event.contact ? limit75('MAILTO:' + event.contact) + '\n' : '') +
+		limit75('TITLE:' + event.title) + '\n' +
+		'DTSTART:' + $.icalendar.formatDateTime(event.start) + '\n' +
+		'DTEND:' + $.icalendar.formatDateTime(event.end) + '\n' +
+		(event.summary ? limit75('SUMMARY:' + event.summary) + '\n' : '') +
+		(event.description ? limit75('DESCRIPTION:' + event.description) + '\n' : '') +
+		(event.location ? limit75('LOCATION:' + event.location) + '\n' : '') +
+		(event.recurrence ? makeRecurrence(event.recurrence) + '\n' : '') +
+		'END:VEVENT\n' +
+		'END:VCALENDAR';
+}
+
+/* Construct an iCalendar recurrence definition.
+   @param  recur  (object) the recurrence details
+   @return  (string) the iCalendar definition */
+function makeRecurrence(recur) {
+	if (!recur) {
+	return '';
+	}
+	var def = '';
+	if (recur.dates) {
+		def = 'RDATE;VALUE=DATE:';
+		if (!isArray(recur.dates)) {
+			recur.dates = [recur.dates];
+		}
+		for (var i = 0; i < recur.dates.length; i++) {
+			def += (i > 0 ? ',' : '') + $.icalendar.formatDate(recur.dates[i]);
+		}
+	}
+	else if (recur.times) {
+		def = 'RDATE;VALUE=DATE-TIME:';
+		if (!isArray(recur.times)) {
+			recur.times = [recur.times];
+		}
+		for (var i = 0; i < recur.times.length; i++) {
+			def += (i > 0 ? ',' : '') + $.icalendar.formatDateTime(recur.times[i]);
+		}
+	}
+	else if (recur.periods) {
+		def = 'RDATE;VALUE=PERIOD:';
+		if (!isArray(recur.periods[0])) {
+			recur.periods = [recur.periods];
+		}
+		for (var i = 0; i < recur.periods.length; i++) {
+			def += (i > 0 ? ',' : '') + $.icalendar.formatDateTime(recur.periods[i][0]) +
+				'/' + (recur.periods[i][1].constructor != Date ? recur.periods[i][1] :
+				$.icalendar.formatDateTime(recur.periods[i][1]));
+		}
+	}
+	else {
+		def = 'RRULE:FREQ=' + (recur.freq || 'daily').toUpperCase() +
+			(recur.interval ? ';INTERVAL=' + recur.interval : '') +
+			(recur.until ? ';UNTIL=' + $.icalendar.formatDateTime(recur.until) :
+			(recur.count ? ';COUNT=' + recur.count : '')) +
+			(recur.weekStart != null ? ';WKST=' +
+			['SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA'][recur.weekStart] : '');
+		if (recur.by) {
+			if (!isArray(recur.by)) {
+				recur.by = [recur.by];
+			}
+			for (var i = 0; i < recur.by.length; i++) {
+				if (!isArray(recur.by[i].values)) {
+					recur.by[i].values = [recur.by[i].values];
+				}
+				def += ';BY' + recur.by[i].type.toUpperCase() + '=' +
+					recur.by[i].values.join(',');
+			}
+		}
+	}
+	return def;
+}
+
+/* Copy the given text to the system clipboard via Flash.
+   @param  text  (string) the text to copy
+   @param  url   (string) the URL for the Flash clipboard copy module
+   @return  (string) '' if successful, error message if not */
+function copyViaFlash(text, url) {
+	$('#' + FLASH_ID).remove();
+	try {
+		$('body').append('<div id="' + FLASH_ID + '"><embed src="' + url +
+		'" FlashVars="clipboard=' + encodeURIComponent(text) +
+		'" width="0" height="0" type="application/x-shockwave-flash"></embed></div>');
+		return '';
+	}
+	catch(e) {
+		return e;
+	}
+}
+
+/* Pattern for folded lines: start with a whitespace character */
+var FOLDED = /^\s(.*)$/;
+/* Pattern for an individual entry: name:value */
+var ENTRY = /^([A-Za-z0-9-]+)((?:;[A-Za-z0-9-]+=(?:"[^"]+"|[^";:,]+)(?:,(?:"[^"]+"|[^";:,]+))*)*):(.*)$/;
+/* Pattern for an individual parameter: name=value[,value] */
+var PARAM = /;([A-Za-z0-9-]+)=((?:"[^"]+"|[^";:,]+)(?:,(?:"[^"]+"|[^";:,]+))*)/g;
+/* Pattern for an individual parameter value: value | "value" */
+var PARAM_VALUE = /,?("[^"]+"|[^";:,]+)/g;
+/* Pattern for a date only field: yyyymmdd */
+var DATEONLY = /^(\d{4})(\d\d)(\d\d)$/;
+/* Pattern for a date/time field: yyyymmddThhmmss[Z] */
+var DATETIME = /^(\d{4})(\d\d)(\d\d)T(\d\d)(\d\d)(\d\d)(Z?)$/;
+/* Pattern for a date/time range field: yyyymmddThhmmss[Z]/yyyymmddThhmmss[Z] */
+var DATETIME_RANGE = /^(\d{4})(\d\d)(\d\d)T(\d\d)(\d\d)(\d\d)(Z?)\/(\d{4})(\d\d)(\d\d)T(\d\d)(\d\d)(\d\d)(Z?)$/;
+/* Pattern for a timezone offset field: +hhmm */
+var TZ_OFFSET = /^([+-])(\d\d)(\d\d)$/;
+/* Pattern for a duration: [+-]PnnW or [+-]PnnDTnnHnnMnnS */
+var DURATION = /^([+-])?P(\d+W)?(\d+D)?(T)?(\d+H)?(\d+M)?(\d+S)?$/;
+/* Reserved names not suitable for attrbiute names. */
+var RESERVED_NAMES = ['class'];
+
+/* iCalendar lines are split so the max length is no more than 75.
+   Split lines start with a whitespace character.
+   @param  content  (string) the original iCalendar data
+   @return  (string[]) the restored iCalendar data */
+function unfoldLines(content) {
+	var lines = content.replace(/\r\n/g, '\n').split('\n');
+	for (var i = lines.length - 1; i > 0; i--) {
+		var matches = FOLDED.exec(lines[i]);
+		if (matches) {
+			lines[i - 1] += matches[1];
+			lines[i] = '';
+		}
+	}
+	return $.map(lines, function(line, i) { // Remove blank lines
+		return (line ? line : null);
+	});
+}
+
+/* Parse a group in the file, delimited by BEGIN:xxx and END:xxx.
+   Recurse if an embedded group encountered.
+   @param  lines      (string[]) the iCalendar data
+   @param  index      (number) the current position within the data
+   @param  owner      (object) the current owner for the new group
+   @param  timezones  (object) collection of defined timezones
+   @return  (number) the updated position after processing this group
+   @throws  errors if group structure is incorrect */
+function parseGroup(lines, index, owner, timezones) {
+	if (index >= lines.length || lines[index].indexOf('BEGIN:') != 0) {
+		throw 'Missing group start';
+	}
+	var group = {};
+	var name = lines[index].substr(6);
+	addEntry(owner, name.toLowerCase(), group);
+	index++;
+	while (index < lines.length && lines[index].indexOf('END:') != 0) {
+		if (lines[index].indexOf('BEGIN:') == 0) { // Recurse for embedded group
+			index = parseGroup(lines, index, group, timezones);
+		}
+		else {
+			var entry = parseEntry(lines[index]);
+			addEntry(group, entry._name, (entry._simple ? entry._value : entry));
+		}
+		index++;
+	}
+	if (name == 'VTIMEZONE') { // Save timezone offset
+		var matches = TZ_OFFSET.exec(group.standard.tzoffsetto);
+		if (matches) {
+			timezones[group.tzid] = (matches[1] == '-' ? -1 : +1) *
+				(parseInt(matches[2], 10) * 60 + parseInt(matches[3], 10));
+		}
+	}
+	else {
+		for (var name2 in group) {
+			resolveTimezones(group[name2], timezones);
+		}
+	}
+	if (lines[index] != 'END:' + name) {
+		throw 'Missing group end ' + name;
+	}
+	return index;
+}
+
+/* Resolve timezone references for dates.
+   @param  value  (any) the current value to check - updated if appropriate
+   @param  timezones  (object) collection of defined timezones */
+function resolveTimezones(value, timezones) {
+	if (!value) {
+		return;
+	}
+	if (value.tzid && value._value) {
+		var offset = timezones[value.tzid];
+		var offsetDate = function(date, tzid) {
+			date.setMinutes(date.getMinutes() - offset);
+			date._type = tzid;
+		};
+		if (isArray(value._value)) {
+			for (var i = 0; i < value._value.length; i++) {
+				offsetDate(value._value[i], value.tzid);
+			}
+		}
+		else if (value._value.start && value._value.end) {
+			offsetDate(value._value.start, value.tzid);
+			offsetDate(value._value.end, value.tzid);
+		}
+		else {
+			offsetDate(value._value, value.tzid);
+		}
+	}
+	else if (isArray(value)) {
+		for (var i = 0; i < value.length; i++) {
+			resolveTimezones(value[i], timezones);
+		}
+	}
+}
+
+/* Add a new entry to an object, making multiple entries into an array.
+   @param  owner  (object) the owning object for the new entry
+   @param  name   (string) the name of the new entry
+   @param  value  (string or object) the new entry value */
+function addEntry(owner, name, value) {
+	if (typeof value == 'string') {
+		value = value.replace(/\\n/g, '\n');
+	}
+	if ($.inArray(name, RESERVED_NAMES) > -1) {
+		name += '_';
+	}
+	if (owner[name]) { // Turn multiple values into an array
+		if (!isArray(owner[name]) || owner['_' + name + 'IsArray']) {
+			owner[name] = [owner[name]];
+		}
+		owner[name][owner[name].length] = value;
+		if (owner['_' + name + 'IsArray']) {
+			owner['_' + name + 'IsArray'] = undefined;
+		}
+	}
+	else {
+		owner[name] = value;
+		if (isArray(value)) {
+			owner['_' + name + 'IsArray'] = true;
+		}
+	}
+}
+
+/* Parse an individual entry.
+   The format is: <name>[;<param>=<pvalue>]...:<value>
+   @param  line  (string) the line to parse
+   @return  (object) the parsed entry with _name and _value
+            attributes, _simple to indicate whether or not
+            other parameters, and other parameters as necessary */
+function parseEntry(line) {
+	var entry = {};
+	var matches = ENTRY.exec(line);
+	if (!matches) {
+		throw 'Missing entry name: ' + line;
+	}
+	entry._name = matches[1].toLowerCase();
+	entry._value = checkDate(matches[3]);
+	entry._simple = true;
+	parseParams(entry, matches[2]);
+	return entry;
+}
+
+/* Parse parameters for an individual entry.
+   The format is: <param>=<pvalue>[;...]
+   @param  owner   (object) the owning object for the parameters,
+                   updated with parameters as attributes, and
+				   _simple to indicate whether or not other parameters
+   @param  params  (string or string[]) the parameters to parse */
+function parseParams(owner, params) {
+	var param = PARAM.exec(params);
+	while (param) {
+		var values = [];
+		var value = PARAM_VALUE.exec(param[2]);
+		while (value) {
+			values.push(checkDate(value[1].replace(/^"(.*)"$/, '$1')));
+			value = PARAM_VALUE.exec(param[2]);
+		}
+		owner[param[1].toLowerCase()] = (values.length > 1 ? values : values[0]);
+		owner._simple = false;
+		param = PARAM.exec(params);
+	}
+}
+
+/* Convert a value into a Date object or array of Date objects if appropriate.
+   @param  value  (string) the value to check
+   @return  (string or Date) the converted value (if appropriate) */
+function checkDate(value) {
+	var matches = DATETIME.exec(value);
+	if (matches) {
+		return makeDate(matches);
+	}
+	matches = DATETIME_RANGE.exec(value);
+	if (matches) {
+		return {start: makeDate(matches), end: makeDate(matches.slice(7))};
+	}
+	matches = DATEONLY.exec(value);
+	if (matches) {
+		return makeDate(matches.concat([0, 0, 0, '']));
+	}
+	return value;
+}
+
+/* Create a date value from matches on a string.
+   @param  matches  (string[]) the component parts of the date
+   @return  (Date) the corresponding date */
+function makeDate(matches) {
+	var date = new Date(matches[1], matches[2] - 1, matches[3],
+		matches[4], matches[5], matches[6]);
+	date._type = (matches[7] ? 'UTC' : 'float');
+	return utcDate(date);
+}
+
+/* Standardise a date to UTC.
+   @param  date  (Date) the date to standardise
+   @return  (Date) the equivalent UTC date */
+function utcDate(date) {
+	date.setMinutes(date.getMinutes() - date.getTimezoneOffset());
+	return date;
+}
+
+/* Calculate the week of the year for a given date
+   according to the ISO 8601 definition.
+   @param  date       (Date) the date to calculate the week for
+   @param  weekStart  (number) the day on which a week starts:
+                      0 = Sun, 1 = Mon, ... (optional, defaults to 1)
+   @return  (number) the week for these parameters (1-53) */
+function getWeekOfYear(date, weekStart) {
+	weekStart = (weekStart || weekStart == 0 ? weekStart : 1);
+	var checkDate = new Date(date.getFullYear(), date.getMonth(), date.getDate(),
+		(date.getTimezoneOffset() / -60));
+	var firstDay = new Date(checkDate.getFullYear(), 1 - 1, 4); // First week always contains 4 Jan
+	var firstDOW = firstDay.getDay(); // Day of week: Sun = 0, Mon = 1, ...
+	firstDay.setDate(4 + weekStart - firstDOW - (weekStart > firstDOW ? 7 : 0)); // Preceding week start
+	if (checkDate < firstDay) { // Adjust first three days in year if necessary
+		checkDate.setDate(checkDate.getDate() - 3); // Generate for previous year
+		return getWeekOfYear(checkDate, weekStart);
+	} else if (checkDate > new Date(checkDate.getFullYear(), 12 - 1, 28)) { // Check last three days in year
+		var firstDay2 = new Date(checkDate.getFullYear() + 1, 1 - 1, 4); // Find first week in next year
+		firstDOW = firstDay2.getDay();
+		firstDay2.setDate(4 + weekStart - firstDOW - (weekStart > firstDOW ? 7 : 0));
+		if (checkDate >= firstDay2) { // Adjust if necessary
+			return 1;
+		}
+	}
+	return Math.floor(((checkDate - firstDay) /
+		(FREQ_SETTINGS[DY].factor * 1000)) / 7) + 1; // Weeks to given date
+}
+
+/* Determine whether an object is an array.
+   @param  a  (object) the object to test
+   @return  (boolean) true if it is an array, or false if not */
+function isArray(a) {
+	return (a && a.constructor == Array);
+}
+
+})(jQuery);
Index: trunk/prototype/plugins/icalendar/jquery.icalendar.min.js
===================================================================
--- trunk/prototype/plugins/icalendar/jquery.icalendar.min.js	(revision 5341)
+++ trunk/prototype/plugins/icalendar/jquery.icalendar.min.js	(revision 5341)
@@ -0,0 +1,7 @@
+/* http://keith-wood.name/icalendar.html
+   iCalendar processing for jQuery v1.1.1.
+   Written by Keith Wood (kbwood{at}iinet.com.au) October 2008.
+   Dual licensed under the GPL (http://dev.jquery.com/browser/trunk/jquery/GPL-LICENSE.txt) and 
+   MIT (http://dev.jquery.com/browser/trunk/jquery/MIT-LICENSE.txt) licenses. 
+   Please attribute the author if you use it. */
+(function($){var p='icalendar';var q='icalendar-flash-copy';function iCalendar(){this._defaults={sites:[],icons:'icalendar.png',iconSize:16,target:'_blank',compact:false,popup:false,popupText:'Send to my calendar...',tipPrefix:'',echoUrl:'',echoField:'',start:null,end:null,title:'',summary:'',description:'',location:'',url:'',contact:'',recurrence:null,copyConfirm:'The event will be copied to your clipboard. Continue?',copySucceeded:'The event has been copied to your clipboard',copyFailed:'Failed to copy the event to the clipboard\n',copyFlash:'clipboard.swf',copyUnavailable:'The clipboard is unavailable, please copy the event details from below:\n'};this._sites={'google':{display:'Google',icon:0,override:null,url:'http://www.google.com/calendar/event?action=TEMPLATE'+'&amp;text={t}&amp;dates={s}/{e}&amp;details={d}&amp;location={l}&amp;sprop=website:{u}'},'icalendar':{display:'iCalendar',icon:1,override:null,url:'echo'},'outlook':{display:'Outlook',icon:2,override:null,url:'echo'},'yahoo':{display:'Yahoo',icon:3,override:yahooOverride,url:'http://calendar.yahoo.com/?v=60&amp;view=d&amp;type=20'+'&amp;title={t}&amp;st={s}&amp;dur={p}&amp;desc={d}&amp;in_loc={l}&amp;url={u}&amp;rpat={r}'}}}var r=[{method:'Seconds',factor:1},{method:'Minutes',factor:60},{method:'Hours',factor:3600},{method:'Date',factor:86400},{method:'Month',factor:1},{method:'FullYear',factor:12},{method:'Date',factor:604800}];var s=0;var t=1;var u=2;var w=3;var x=4;var y=5;var z=6;$.extend(iCalendar.prototype,{markerClassName:'hasICalendar',setDefaults:function(a){extendRemove(this._defaults,a||{});return this},addSite:function(a,b,c,d,e){this._sites[a]={display:b,icon:c,override:e,url:d};return this},getSites:function(){return this._sites},_attachICalendar:function(a,b){a=$(a);if(a.hasClass(this.markerClassName)){return}a.addClass(this.markerClassName);this._updateICalendar(a,b)},_changeICalendar:function(a,b){a=$(a);if(!a.hasClass(this.markerClassName)){return}this._updateICalendar(a,b)},_updateICalendar:function(i,j){j=extendRemove($.extend({},this._defaults,$.data(i[0],p)||{}),j);$.data(i[0],p,j);var k=j.sites||this._defaults.sites;if(k.length==0){$.each(this._sites,function(a){k[k.length]=a})}var l=function(b,c){var d={t:encodeURIComponent(j.title),d:encodeURIComponent(j.description),s:$.icalendar.formatDateTime(j.start),e:$.icalendar.formatDateTime(j.end),p:$.icalendar.calculateDuration(j.start,j.end),l:encodeURIComponent(j.location),u:encodeURIComponent(j.url),c:encodeURIComponent(j.contact),r:makeRecurrence(j.recurrence)};if(b.override){b.override.apply(i,[d,j])}var e=b.url;$.each(d,function(n,v){var a=new RegExp('\\{'+n+'\\}','g');e=e.replace(a,v)});var e=(b.url=='echo'?'#':e);var f=$('<li></li>');var g=$('<a href="'+e+'" title="'+j.tipPrefix+b.display+'"'+(b.url=='echo'?'':' target="'+j._target+'"')+'></a>');if(b.url=='echo'){g.click(function(){return $.icalendar._echo(i[0],c)})}var h='';if(b.icon!=null){if(typeof b.icon=='number'){h+='<span style="background: '+'transparent url('+j.icons+') no-repeat -'+(b.icon*j.iconSize)+'px 0px;'+($.browser.mozilla&&$.browser.version<'1.9'?' padding-left: '+j.iconSize+'px; padding-bottom: '+Math.max(0,(j.iconSize/2)-5)+'px;':'')+'"></span>'}else{h+='<img src="'+b.icon+'"'+(($.browser.mozilla&&$.browser.version<'1.9')||($.browser.msie&&$.browser.version<'7.0')?' style="vertical-align: bottom;"':($.browser.msie?' style="vertical-align: middle;"':($.browser.opera||$.browser.safari?' style="vertical-align: baseline;"':'')))+'/>'}h+=(j.compact?'':'&#xa0;')}g.html(h+(j.compact?'':b.display));f.append(g);return f};var m=$('<ul class="icalendar_list'+(j.compact?' icalendar_compact':'')+'"></ul>');var o=this._sites;$.each(k,function(a,b){m.append(l(o[b],b))});i.empty().append(m);if(j.popup){m.before('<span class="icalendar_popup_text">'+j.popupText+'</span>').wrap('<div class="icalendar_popup"></div>');i.click(function(){var a=$(this);var b=a.offset();$('.icalendar_popup',a).css('left',b.left).css('top',b.top+a.outerHeight()).toggle()})}},_destroyICalendar:function(a){a=$(a);if(!a.hasClass(this.markerClassName)){return}a.removeClass(this.markerClassName).empty();$.removeData(a[0],p)},_echo:function(a,b){var c=$.data(a,p);var d=makeICalendar(c);if(c.echoUrl){window.location.href=c.echoUrl+'?content='+escape(d)}else if(c.echoField){$(c.echoField).val(d)}else if(!c.copyFlash){alert(c.copyUnavailable+d)}else if(confirm(c.copyConfirm)){var e='';if(e=copyViaFlash(d,c.copyFlash)){alert(c.copyFailed+e)}else{alert(c.copySucceeded)}}return false},_ensureTwo:function(a){return(a<10?'0':'')+a},formatDate:function(a,b){return(!a?'':''+a.getFullYear()+this._ensureTwo(a.getMonth()+1)+this._ensureTwo(a.getDate()))},formatDateTime:function(a,b){return(!a?'':(b?''+a.getFullYear()+this._ensureTwo(a.getMonth()+1)+this._ensureTwo(a.getDate())+'T'+this._ensureTwo(a.getHours())+this._ensureTwo(a.getMinutes())+this._ensureTwo(a.getSeconds()):''+a.getUTCFullYear()+this._ensureTwo(a.getUTCMonth()+1)+this._ensureTwo(a.getUTCDate())+'T'+this._ensureTwo(a.getUTCHours())+this._ensureTwo(a.getUTCMinutes())+this._ensureTwo(a.getUTCSeconds())+'Z'))},calculateDuration:function(a,b){if(!a||!b){return''}var c=Math.abs(b.getTime()-a.getTime())/1000;var d=Math.floor(c/86400);c-=d*86400;var e=Math.floor(c/3600);c-=e*3600;var f=Math.floor(c/60);c-=f*60;return(a.getTime()>b.getTime()?'-':'')+'P'+(d>0?d+'D':'')+(e||f||c?'T'+e+'H':'')+(f||c?f+'M':'')+(c?c+'S':'')},addDuration:function(d,e){if(!e){return d}var f=new Date(d.getTime());var g=I.exec(e);if(!g){throw'Invalid duration';}if(g[2]&&(g[3]||g[5]||g[6]||g[7])){throw'Invalid duration - week must be on its own';}if(!g[4]&&(g[5]||g[6]||g[7])){throw'Invalid duration - missing time marker';}var h=(g[1]=='-'?-1:+1);var i=function(a,b,c){a=parseInt(a);if(!isNaN(a)){f['setUTC'+c](f['getUTC'+c]()+h*a*b)}};if(g[2]){i(g[2],7,'Date')}else{i(g[3],1,'Date');i(g[5],1,'Hours');i(g[6],1,'Minutes');i(g[7],1,'Seconds')}return f},parse:function(a){var b={};var c={};var d=unfoldLines(a);parseGroup(d,0,b,c);if(!b.vcalendar){throw'Invalid iCalendar data';}return b.vcalendar},getWeekOfYear:function(a,b){return getWeekOfYear(a,b)},_parseParams:function(a,b){return parseParams(a,b)}});function extendRemove(a,b){$.extend(a,b);for(var c in b){if(b[c]==null){a[c]=null}}return a}$.fn.icalendar=function(a){var b=Array.prototype.slice.call(arguments,1);return this.each(function(){if(typeof a=='string'){$.icalendar['_'+a+'ICalendar'].apply($.icalendar,[this].concat(b))}else{$.icalendar._attachICalendar(this,a||{})}})};$.icalendar=new iCalendar();function yahooOverride(b,c){var d=function(a){return(a<10?'0':'')+a};var e=(c.end?(c.end.getTime()-c.start.getTime())/60000:0);b.p=(e?d(Math.floor(e/60))+''+d(e%60):'');if(b.r){var f=(c.recurrence.by&&c.recurrence.by[0].type=='day'?c.recurrence.by[0].values.join('').toLowerCase():'');var g={daily:'dy',weekly:'wk',monthly:'mh',yearly:'yr'}[c.recurrence.freq];b.r=(f||g?d(c.recurrence.interval||1)+(f||g):'')}}function makeICalendar(c){var d=function(a){var b='';while(a.length>75){b+=a.substr(0,75)+'\n';a=' '+a.substr(75)}b+=a;return b};return'BEGIN:VCALENDAR\n'+'VERSION:2.0\n'+'PRODID:jquery.icalendar\n'+'METHOD:PUBLISH\n'+'BEGIN:VEVENT\n'+'UID:'+new Date().getTime()+'@'+(window.location.href.replace(/^[^\/]*\/\/([^\/]*)\/.*$/,'$1')||'localhost')+'\n'+'DTSTAMP:'+$.icalendar.formatDateTime(new Date())+'\n'+(c.url?d('URL:'+c.url)+'\n':'')+(c.contact?d('MAILTO:'+c.contact)+'\n':'')+d('TITLE:'+c.title)+'\n'+'DTSTART:'+$.icalendar.formatDateTime(c.start)+'\n'+'DTEND:'+$.icalendar.formatDateTime(c.end)+'\n'+(c.summary?d('SUMMARY:'+c.summary)+'\n':'')+(c.description?d('DESCRIPTION:'+c.description)+'\n':'')+(c.location?d('LOCATION:'+c.location)+'\n':'')+(c.recurrence?makeRecurrence(c.recurrence)+'\n':'')+'END:VEVENT\n'+'END:VCALENDAR'}function makeRecurrence(a){if(!a){return''}var b='';if(a.dates){b='RDATE;VALUE=DATE:';if(!isArray(a.dates)){a.dates=[a.dates]}for(var i=0;i<a.dates.length;i++){b+=(i>0?',':'')+$.icalendar.formatDate(a.dates[i])}}else if(a.times){b='RDATE;VALUE=DATE-TIME:';if(!isArray(a.times)){a.times=[a.times]}for(var i=0;i<a.times.length;i++){b+=(i>0?',':'')+$.icalendar.formatDateTime(a.times[i])}}else if(a.periods){b='RDATE;VALUE=PERIOD:';if(!isArray(a.periods[0])){a.periods=[a.periods]}for(var i=0;i<a.periods.length;i++){b+=(i>0?',':'')+$.icalendar.formatDateTime(a.periods[i][0])+'/'+(a.periods[i][1].constructor!=Date?a.periods[i][1]:$.icalendar.formatDateTime(a.periods[i][1]))}}else{b='RRULE:FREQ='+(a.freq||'daily').toUpperCase()+(a.interval?';INTERVAL='+a.interval:'')+(a.until?';UNTIL='+$.icalendar.formatDateTime(a.until):(a.count?';COUNT='+a.count:''))+(a.weekStart!=null?';WKST='+['SU','MO','TU','WE','TH','FR','SA'][a.weekStart]:'');if(a.by){if(!isArray(a.by)){a.by=[a.by]}for(var i=0;i<a.by.length;i++){if(!isArray(a.by[i].values)){a.by[i].values=[a.by[i].values]}b+=';BY'+a.by[i].type.toUpperCase()+'='+a.by[i].values.join(',')}}}return b}function copyViaFlash(a,b){$('#'+q).remove();try{$('body').append('<div id="'+q+'"><embed src="'+b+'" FlashVars="clipboard='+encodeURIComponent(a)+'" width="0" height="0" type="application/x-shockwave-flash"></embed></div>');return''}catch(e){return e}}var A=/^\s(.*)$/;var B=/^([A-Za-z0-9-]+)((?:;[A-Za-z0-9-]+=(?:"[^"]+"|[^";:,]+)(?:,(?:"[^"]+"|[^";:,]+))*)*):(.*)$/;var C=/;([A-Za-z0-9-]+)=((?:"[^"]+"|[^";:,]+)(?:,(?:"[^"]+"|[^";:,]+))*)/g;var D=/,?("[^"]+"|[^";:,]+)/g;var E=/^(\d{4})(\d\d)(\d\d)$/;var F=/^(\d{4})(\d\d)(\d\d)T(\d\d)(\d\d)(\d\d)(Z?)$/;var G=/^(\d{4})(\d\d)(\d\d)T(\d\d)(\d\d)(\d\d)(Z?)\/(\d{4})(\d\d)(\d\d)T(\d\d)(\d\d)(\d\d)(Z?)$/;var H=/^([+-])(\d\d)(\d\d)$/;var I=/^([+-])?P(\d+W)?(\d+D)?(T)?(\d+H)?(\d+M)?(\d+S)?$/;var J=['class'];function unfoldLines(b){var c=b.replace(/\r\n/g,'\n').split('\n');for(var i=c.length-1;i>0;i--){var d=A.exec(c[i]);if(d){c[i-1]+=d[1];c[i]=''}}return $.map(c,function(a,i){return(a?a:null)})}function parseGroup(a,b,c,d){if(b>=a.length||a[b].indexOf('BEGIN:')!=0){throw'Missing group start';}var e={};var f=a[b].substr(6);addEntry(c,f.toLowerCase(),e);b++;while(b<a.length&&a[b].indexOf('END:')!=0){if(a[b].indexOf('BEGIN:')==0){b=parseGroup(a,b,e,d)}else{var g=parseEntry(a[b]);addEntry(e,g._name,(g._simple?g._value:g))}b++}if(f=='VTIMEZONE'){var h=H.exec(e.standard.tzoffsetto);if(h){d[e.tzid]=(h[1]=='-'?-1:+1)*(parseInt(h[2],10)*60+parseInt(h[3],10))}}else{for(var i in e){resolveTimezones(e[i],d)}}if(a[b]!='END:'+f){throw'Missing group end '+f;}return b}function resolveTimezones(c,d){if(!c){return}if(c.tzid&&c._value){var e=d[c.tzid];var f=function(a,b){a.setMinutes(a.getMinutes()-e);a._type=b};if(isArray(c._value)){for(var i=0;i<c._value.length;i++){f(c._value[i],c.tzid)}}else if(c._value.start&&c._value.end){f(c._value.start,c.tzid);f(c._value.end,c.tzid)}else{f(c._value,c.tzid)}}else if(isArray(c)){for(var i=0;i<c.length;i++){resolveTimezones(c[i],d)}}}function addEntry(a,b,c){if(typeof c=='string'){c=c.replace(/\\n/g,'\n')}if($.inArray(b,J)>-1){b+='_'}if(a[b]){if(!isArray(a[b])||a['_'+b+'IsArray']){a[b]=[a[b]]}a[b][a[b].length]=c;if(a['_'+b+'IsArray']){a['_'+b+'IsArray']=undefined}}else{a[b]=c;if(isArray(c)){a['_'+b+'IsArray']=true}}}function parseEntry(a){var b={};var c=B.exec(a);if(!c){throw'Missing entry name: '+a;}b._name=c[1].toLowerCase();b._value=checkDate(c[3]);b._simple=true;parseParams(b,c[2]);return b}function parseParams(a,b){var c=C.exec(b);while(c){var d=[];var e=D.exec(c[2]);while(e){d.push(checkDate(e[1].replace(/^"(.*)"$/,'$1')));e=D.exec(c[2])}a[c[1].toLowerCase()]=(d.length>1?d:d[0]);a._simple=false;c=C.exec(b)}}function checkDate(a){var b=F.exec(a);if(b){return makeDate(b)}b=G.exec(a);if(b){return{start:makeDate(b),end:makeDate(b.slice(7))}}b=E.exec(a);if(b){return makeDate(b.concat([0,0,0,'']))}return a}function makeDate(a){var b=new Date(a[1],a[2]-1,a[3],a[4],a[5],a[6]);b._type=(a[7]?'UTC':'float');return utcDate(b)}function utcDate(a){a.setMinutes(a.getMinutes()-a.getTimezoneOffset());return a}function getWeekOfYear(a,b){b=(b||b==0?b:1);var c=new Date(a.getFullYear(),a.getMonth(),a.getDate(),(a.getTimezoneOffset()/-60));var d=new Date(c.getFullYear(),1-1,4);var e=d.getDay();d.setDate(4+b-e-(b>e?7:0));if(c<d){c.setDate(c.getDate()-3);return getWeekOfYear(c,b)}else if(c>new Date(c.getFullYear(),12-1,28)){var f=new Date(c.getFullYear()+1,1-1,4);e=f.getDay();f.setDate(4+b-e-(b>e?7:0));if(c>=f){return 1}}return Math.floor(((c-d)/(r[w].factor*1000))/7)+1}function isArray(a){return(a&&a.constructor==Array)}})(jQuery);
Index: trunk/prototype/plugins/zebradialog/javascript/zebra_dialog.src.js
===================================================================
--- trunk/prototype/plugins/zebradialog/javascript/zebra_dialog.src.js	(revision 5341)
+++ trunk/prototype/plugins/zebradialog/javascript/zebra_dialog.src.js	(revision 5341)
@@ -0,0 +1,772 @@
+/**
+ *  Zebra_Dialog
+ *
+ *  A small (4KB minified), compact (one JS file, no dependencies other than jQuery 1.5.2+) and highly configurable
+ *  dialog box plugin for jQuery meant to replace JavaScript's "alert" and "confirmation" dialog boxes.
+ *
+ *  Can also be used as a notification widget - when configured to show no buttons and to close automatically - for updates
+ *  or errors, without distracting users from their browser experience by displaying obtrusive alerts.
+ *
+ *  Features:
+ *
+ *  -   great looks - out of the box
+ *  -   5 types of dialog boxes available: confirmation, information, warning, error and question;
+ *  -   easily customizable appearance by changing the CSS file
+ *  -   create modal or non-modal dialog boxes
+ *  -   easily add custom buttons
+ *  -   position the dialog box wherever you want - not just in the middle of the screen
+ *  -   use callback functions to handle user's choice
+ *  -   works in all major browsers (Firefox, Opera, Safari, Chrome, Internet Explorer 6, 7, 8, 9)
+ *
+ *  Visit {@link http://stefangabos.ro/jquery/zebra-dialog/} for more information.
+ *
+ *  For more resources visit {@link http://stefangabos.ro/}
+ *
+ *  @author     Stefan Gabos <contact@stefangabos.ro>
+ *  @version    1.1 (last revision: August 18, 2011)
+ *  @copyright  (c) 2011 Stefan Gabos
+ *  @license    http://www.gnu.org/licenses/lgpl-3.0.txt GNU LESSER GENERAL PUBLIC LICENSE
+ *  @package    Zebra_Dialog
+ */
+;(function($) {
+
+    $.Zebra_Dialog = function() {
+
+        // default options
+        var defaults = {
+
+            animation_speed:            250,            //  The speed, in milliseconds, by which the overlay and the
+                                                        //  dialog box will be animated when closing.
+                                                        //
+                                                        //  Default is 250
+
+            auto_close:                 false,          //  The number of milliseconds after which to automatically
+                                                        //  close the dialog box or FALSE to not automatically close the
+                                                        //  dialog box.
+                                                        //
+                                                        //  Default is FALSE
+
+            buttons:                    true,           //  Use this for localization and for adding custom buttons.
+                                                        //
+                                                        //  If set to TRUE, the default buttons will be used, depending
+                                                        //  on the type of the dialog box: ['Yes', 'No'] for "question"
+                                                        //  type and ['Ok'] for the other dialog box types.
+                                                        //
+                                                        //  For custom buttons, use an array containing the captions of
+                                                        //  the buttons to display: ['My button 1', 'My button 2'].
+                                                        //
+                                                        //  Set to FALSE if you want no buttons.
+                                                        //
+                                                        //  Note that when the dialog box is closed as a result of clicking
+                                                        //  a button, the "onClose" event is triggered and the callback
+                                                        //  function (if any) receives as argument the caption of the
+                                                        //  clicked button.
+                                                        //
+                                                        //  See the comments for the "onClose" event below for more
+                                                        //  information.
+
+            custom_class:                false,         //  An extra class to add to the dialog box's container. Useful
+                                                        //  for customizing a dialog box elements' styles at run-time.
+                                                        //
+                                                        //  For example, setting this value to "mycustom" and in the
+                                                        //  CSS file having something like
+                                                        //  .mycustom .ZebraDialog_Title { background: red }
+                                                        //  would set the dialog box title's background to red.
+                                                        //
+                                                        //  See the CSS file for what can be changed.
+                                                        //
+                                                        //  Default is FALSE
+
+            keyboard:                   true,           //  When set to TRUE, pressing the ESC key will close the dialog
+                                                        //  box.
+                                                        //
+                                                        //  Default is TRUE.
+
+            message:                    '',             //  The message in the dialog box - this is passed as argument
+                                                        //  when the plugin is called.
+
+            modal:                      true,           //  When set to TRUE there will be a semitransparent overlay
+                                                        //  behind the dialog box, preventing users from clicking 
+                                                        //  the page's content.
+                                                        //
+                                                        //  Default is TRUE
+
+            overlay_close:              true,           //  Should the dialog box close when the overlay is clicked?
+                                                        //
+                                                        //  Default is TRUE
+
+            overlay_opacity:            .9,             //  The opacity of the overlay (between 0 and 1)
+                                                        //
+                                                        //  Default is .9
+
+            position:                   'center',       //  Position of the dialog box.
+                                                        //
+                                                        //  Can be either "center" (which would center the dialog box) or
+                                                        //  an array with 2 elements, in the form of
+                                                        //  {'horizontal_position +/- offset', 'vertical_position +/- offset'}
+                                                        //  (notice how everything is enclosed in quotes) where
+                                                        //  "horizontal_position" can be "left", "right" or "center",
+                                                        //  "vertical_position" can be "top", "bottom" or "middle", and
+                                                        //  "offset" represents an optional number of pixels to add/substract
+                                                        //  from the respective horizontal or vertical position.
+                                                        //
+                                                        //  Positions are relative to the viewport (the area of the
+                                                        //  browser that is visible to the user)!
+                                                        //
+                                                        //  Examples:
+                                                        //
+                                                        //  ['left + 20', 'top + 20'] would position the dialog box in the
+                                                        //  top-left corner, shifted 20 pixels inside.
+                                                        //
+                                                        //  ['right - 20', 'bottom - 20'] would position the dialog box
+                                                        //  in the bottom-right corner, shifted 20 pixels inside.
+                                                        //
+                                                        //  ['center', 'top + 20'] would position the dialog box in
+                                                        //  center-top, shifted 20 pixels down.
+                                                        //
+                                                        //  Default is "center".
+
+            title:                      '',             //  Title of the dialog box
+                                                        //
+                                                        //  Default is "" (an empty string - no title)
+
+            type:                       'information',  //  Dialog box type.
+                                                        //
+                                                        //  Can be any of the following:
+                                                        //
+                                                        //  - confirmation
+                                                        //  - error
+                                                        //  - information
+                                                        //  - question
+                                                        //  - warning
+                                                        //
+                                                        //  If you don't want an icon, set the "type" property to FALSE.
+                                                        //
+                                                        //  By default, all types except "question" have a single button
+                                                        //  with the caption "Ok"; type "question" has two buttons, with
+                                                        //  the captions "Ok" and "Cancel" respectively.
+                                                        //
+                                                        //  Default is "information".
+
+            vcenter_short_message:      true,           //  Should short messages be vertically centered?
+                                                        //
+                                                        //  Default is TRUE
+
+            width:                      0,              //  By default, the width of the dialog box is set in the CSS
+                                                        //  file. Use this property to override the default width at
+                                                        //  run-time.
+                                                        //
+                                                        //  Must be an integer, greater than 0. Anything else will instruct
+                                                        //  the script to use the default value, as set in the CSS file.
+                                                        //  Value should be no less than 200 for optimal output.
+                                                        //
+                                                        //  Default is 0 - use the value from the CSS file.
+
+            onClose:                null                //  Event fired when the dialog box is closed.
+                                                        //
+                                                        //  The callback function (if any) receives as argument the
+                                                        //  caption of the clicked button or boolean FALSE if the dialog
+                                                        //  box is closed by pressing the ESC key or by clicking on the
+                                                        //  overlay.
+
+        }
+
+        // to avoid confusions, we use "plugin" to reference the current instance of the object
+        var plugin = this;
+
+        // this will hold the merged default, and user-provided options
+        plugin.settings = {};
+
+        // by default, we assume there are no custom options provided
+        options = {};
+
+        // if plugin is initialized so that first argument is a string
+        // that string is the message to be shown in the dialog box
+        if (typeof arguments[0] == 'string') options.message = arguments[0];
+            
+        // if plugin is initialized so that first or second argument is an object
+        if (typeof arguments[0] == 'object' || typeof arguments[1] == 'object')
+
+            // extend the options object with the user-provided options
+            options = $.extend(options, (typeof arguments[0] == 'object' ? arguments[0] : arguments[1]));
+
+        /**
+         *  Constructor of the method.
+         *
+         *  @return object  Returns a reference to the plugin
+         */
+        plugin.init = function() {
+
+            // the plugin's final properties are the merged default and user-provided options (if any)
+            plugin.settings = $.extend({}, defaults, options);
+
+            // check if browser is Internet Explorer 6 and set a flag accordingly as we need to perform some extra tasks
+            // later on for Internet Explorer 6
+            plugin.isIE6 = ($.browser.msie && parseInt($.browser.version, 10) == 6) || false;
+
+            // if dialog box should be modal
+            if (plugin.settings.modal) {
+
+                // create the overlay
+                plugin.overlay = jQuery('<div>', {
+
+                    'class':    'ZebraDialogOverlay'
+
+                // set some css properties of the overlay
+                }).css({
+
+                    'position': (plugin.isIE6 ? 'absolute' : 'fixed'),  //  for IE6 we emulate the "position:fixed" behaviour
+                    'left':     0,                                      //  the overlay starts at the top-left corner of the
+                    'top':      0,                                      //  browser window (later on we'll stretch it)
+                    'opacity':  plugin.settings.overlay_opacity,        //  set the overlay's opacity
+                    'z-index':  1000                                    //  set a high value for z-index
+
+                });
+
+                // if dialog box can be closed by clicking the overlay
+                if (plugin.settings.overlay_close)
+
+                    // when the overlay is clicked
+                    // remove the overlay and the dialog box from the DOM
+                    plugin.overlay.bind('click', plugin.close);
+
+                // append the overlay to the DOM
+                plugin.overlay.appendTo('body');
+
+            }
+
+            // create the dialog box
+            plugin.dialog = jQuery('<div>', {
+
+                'class':        'ZebraDialog' + (plugin.settings.custom_class ? ' ' + plugin.settings.custom_class : '')
+
+            // set some css properties of the dialog box
+            }).css({
+
+                'position':     (plugin.isIE6 ? 'absolute' : 'fixed'),  //  for IE6 we emulate the "position:fixed" behaviour
+                'left':         0,                                      //  by default, place it in the top-left corner of the
+                'top':          0,                                      //  browser window (we'll position it later)
+                'z-index':      1001,                                   //  the z-index must be higher than the overlay's z-index
+                'visibility':   'hidden'                                //  the dialog box is hidden for now
+
+            });
+
+            // if a notification message
+            if (!plugin.settings.buttons && plugin.settings.auto_close) {
+
+                // generate a unique id so that we can easily find similar notifications in the DOM and stack them properly
+                // (propert stacking is not currently implemented though)
+                // the unique id is made up of the box's position and its auto_close value
+                plugin.settings.uniqueid =  (plugin.settings.position + plugin.settings.auto_close + '').
+                                            replace(/\+/g, 'inc').replace(/\-/g, 'dec').replace(/[^a-z0-9]/gi, '');
+
+                // add the unique id as a class
+                plugin.dialog.addClass(plugin.settings.uniqueid);
+
+            }
+
+            // check to see if the "width" property is given as an integer
+            // try to convert to a integer
+            var tmp = parseInt(plugin.settings.width);
+
+            // if converted value is a valud number
+            if (!isNaN(tmp) && tmp == plugin.settings.width && tmp.toString() == plugin.settings.width.toString() && tmp > 0)
+
+                // set the dialog box's width
+                plugin.dialog.css({'width' : plugin.settings.width});
+
+            // if dialog box has a title
+            if (plugin.settings.title)
+
+                // create the title
+                jQuery('<h3>', {
+
+                    'class':    'ZebraDialog_Title'
+
+                // set the title's text
+                // and append the title to the dialog box
+                }).html(plugin.settings.title).appendTo(plugin.dialog);
+
+            // create the container of the actual message
+            // we save it as a reference because we'll use it later in the "draw" method
+            // if the "vcenter_short_message" property is TRUE
+            plugin.message = jQuery('<div>', {
+
+                // if a known dialog box type is specified, also show the appropriate icon
+                'class':    'ZebraDialog_Body' + (get_type() != '' ? ' ZebraDialog_Icon ZebraDialog_' + get_type() : '')
+
+            });
+
+            // if short messages are to be centered vertically
+            if (plugin.settings.vcenter_short_message)
+
+                // create a secondary container for the message and add everything to the message container
+                // (we'll later align the container vertically)
+                jQuery('<div>').html(plugin.settings.message).appendTo(plugin.message);
+
+            // if short messages are not to be centered vertically
+            else
+
+                // add the message to the message container
+                plugin.message.html(plugin.settings.message);
+
+            // add the message container to the dialog box
+            plugin.message.appendTo(plugin.dialog);
+
+            // get the buttons that are to be added to the dialog box
+            var buttons = get_buttons();
+
+            // if there are any buttons to be added to the dialog box
+            if (buttons) {
+
+                // create the button bar
+                var button_bar = jQuery('<div>', {
+
+                    'class':    'ZebraDialog_Buttons'
+
+                // append it to the dialog box
+                }).appendTo(plugin.dialog);
+
+                // iterate through the buttons that are to be attached to the dialog box
+                $.each(buttons, function(index, value) {
+
+                    // create button
+                    var button = jQuery('<a>', {
+
+                        'href':     'javascript:void(0)',
+                        'class':    'ZebraDialog_Button' + index
+
+                    // set button's caption
+                    }).html(value);
+
+                    // when the button is clicked
+                    button.bind('click', function() {
+
+                        // remove the overlay and the dialog box from the DOM
+                        // also pass the button's label as argument
+                        plugin.close(value)
+
+                    });
+
+                    // append the button to the button bar
+                    button.appendTo(button_bar);
+
+                });
+
+                // since buttons are floated,
+                // we need to clear floats
+                jQuery('<div>', {
+
+                    'style':    'clear:both'
+
+                }).appendTo(button_bar);
+
+            }
+
+            // insert the dialog box in the DOM
+            plugin.dialog.appendTo('body');
+
+            // if the browser window is resized
+            $(window).bind('resize', draw);
+
+            // if dialog box can be closed by pressing the ESC key
+            if (plugin.settings.keyboard)
+
+                // if a key is pressed
+                $(document).bind('keyup', _keyup);
+
+            // if browser is Internet Explorer 6 we attach an event to be fired whenever the window is scrolled
+            // that is because in IE6 we have to simulate "position:fixed"
+            if (plugin.isIE6)
+
+                // if window is scrolled
+                $(window).bind('scroll', _scroll);
+
+            // if plugin is to be closed automatically after a given number of milliseconds
+            if (plugin.settings.auto_close !== false)
+
+                // call the "close" method after the given number of milliseconds
+                setTimeout(plugin.close, plugin.settings.auto_close);
+
+            // draw the overlay and the dialog box
+            draw();
+
+            // return a reference to the object itself
+            return plugin;
+
+        }
+
+        /**
+         *  Close the dialog box
+         *
+         *  @return void
+         */
+        plugin.close = function() {
+
+            // remove all the event listeners
+            if (plugin.settings.keyboard) $(document).unbind('keyup', _keyup);
+
+            if (plugin.isIE6) $(window).unbind('scroll', _scroll);
+
+            $(window).unbind('resize', draw);
+
+            // if an overlay exists
+            if (plugin.settings.modal)
+
+                // animate overlay's css properties
+                plugin.overlay.animate({
+
+                    opacity: 0  // fade out the overlay
+
+                },
+
+                // animation speed
+                plugin.settings.animation_speed,
+
+                // when the animation is complete
+                function() {
+
+                    // remove the overlay from the DOM
+                    plugin.overlay.remove();
+
+                });
+
+            // animate dialog box's css properties
+            plugin.dialog.animate({
+
+                top: 0,     // move the dialog box to the top
+                opacity: 0  // fade out the dialog box
+
+            },
+
+            // animation speed
+            plugin.settings.animation_speed,
+
+            // when the animation is complete
+            function() {
+
+                // remove the dialog box from the DOM
+                plugin.dialog.remove();
+
+            });
+
+            // if a callback function exists for when closing the dialog box
+            if (plugin.settings.onClose && typeof plugin.settings.onClose == 'function')
+
+                // execute the callback function
+                plugin.settings.onClose(undefined != arguments[0] ? arguments[0] : '');
+
+        }
+
+        /**
+         *  Draw the overlay and the dialog box
+         *
+         *  @return void
+         *
+         *  @access private
+         */
+        var draw = function() {
+
+            var
+
+                // get the viewport width and height
+                viewport_width = $(window).width(),
+                viewport_height = $(window).height(),
+
+                // get dialog box's width and height
+                dialog_width = plugin.dialog.width(),
+                dialog_height = plugin.dialog.height(),
+
+                // the numeric representations for some constants that may exist in the "position" property
+                values = {
+
+                    'left':     0,
+                    'top':      0,
+                    'right':    viewport_width - dialog_width,
+                    'bottom':   viewport_height - dialog_height,
+                    'center':   (viewport_width - dialog_width) / 2,
+                    'middle':   (viewport_height - dialog_height) / 2
+
+                };
+
+            // reset these values
+            plugin.dialog_left = undefined;
+            plugin.dialog_top = undefined;
+
+            // if there is an overlay
+            // (the dialog box is modal)
+            if (plugin.settings.modal)
+
+                // stretch the overlay to cover the entire viewport
+                plugin.overlay.css({
+
+                    'width':    viewport_width,
+                    'height':   viewport_height
+
+                });
+
+            // if
+            if (
+
+                // the position is given as an array
+                $.isArray(plugin.settings.position) &&
+
+                // the array has exactly two elements
+                plugin.settings.position.length == 2 &&
+
+                // first element is a string
+                typeof plugin.settings.position[0] == 'string' &&
+
+                // first element contains only "left", "right", "center", numbers, spaces, plus and minus signs
+                plugin.settings.position[0].match(/^(left|right|center)[\s0-9\+\-]*$/) &&
+
+                // second element is a string
+                typeof plugin.settings.position[1] == 'string' &&
+
+                // second element contains only "top", "bottom", "middle", numbers, spaces, plus and minus signs
+                plugin.settings.position[1].match(/^(top|bottom|middle)[\s0-9\+\-]*$/)
+
+            ) {
+
+                // make sure both entries are lowercase
+                plugin.settings.position[0] = plugin.settings.position[0].toLowerCase();
+                plugin.settings.position[1] = plugin.settings.position[1].toLowerCase();
+
+                // iterate through the array of replacements
+                $.each(values, function(index, value) {
+
+                    // we need to check both the horizontal and vertical values
+                    for (var i = 0; i < 2; i++) {
+
+                        // replace if there is anything to be replaced
+                        var tmp = plugin.settings.position[i].replace(index, value);
+
+                        // if anything could be replaced
+                        if (tmp != plugin.settings.position[i])
+
+                            // evaluate string as a mathematical expression and set the appropriate value
+                            if (i == 0) plugin.dialog_left = eval(tmp); else plugin.dialog_top = eval(tmp);
+
+                    }
+
+                });
+
+            }
+
+            // if "dialog_left" and/or "dialog_top" values are still not set
+            if (undefined == plugin.dialog_left || undefined == plugin.dialog_top) {
+
+                // the dialog box will be in its default position, centered
+                plugin.dialog_left = values['center'];
+                plugin.dialog_top = values['middle'];
+
+            }
+
+            // if short messages are to be centered vertically
+            if (plugin.settings.vcenter_short_message) {
+
+                var
+
+                    // the secondary container - the one that containes the message
+                    message = plugin.message.find('div:first'),
+
+                    // the height of the secondary container
+                    message_height = message.height(),
+
+                    // the main container's height
+                    container_height = plugin.message.height();
+
+                // if we need to center the message vertically
+                if (message_height < container_height)
+
+                    // center the message vertically
+                    message.css({
+
+                        'margin-top':   (container_height - message_height) / 2
+
+                    });
+
+            }
+
+            // position the dialog box and make it visible
+            plugin.dialog.css({
+
+                'left':         plugin.dialog_left,
+                'top':          plugin.dialog_top,
+                'visibility':   'visible'
+
+            });
+
+            // move the focus to the first of the dialog box's buttons
+            plugin.dialog.find('a[class^=ZebraDialog_Button]:first').focus();
+
+            // if the browser is Internet Explorer 6, call the "emulate_fixed_position" method
+            // (if we do not apply a short delay, it sometimes does not work as expected)
+            if (plugin.isIE6) setTimeout(emulate_fixed_position, 500);
+
+        }
+
+        /**
+         *  Emulates "position:fixed" for Internet Explorer 6.
+         *
+         *  @return void
+         *
+         *  @access private
+         */
+        var emulate_fixed_position = function() {
+
+            var
+
+                // get how much the window is scrolled both horizontally and vertically
+                scroll_top = $(window).scrollTop(),
+                scroll_left = $(window).scrollLeft();
+
+            // if an overlay exists
+            if (plugin.settings.modal)
+
+                // make sure the overlay is stays positioned at the top of the viewport
+                plugin.overlay.css({
+
+                    'top':  scroll_top,
+                    'left': scroll_left
+
+                });
+
+            // make sure the dialog box always stays in the correct position
+            plugin.dialog.css({
+
+                'left': plugin.dialog_left + scroll_left,
+                'top':  plugin.dialog_top + scroll_top
+
+            });
+
+        }
+
+        /**
+         *  Returns an array containing the buttons that are to be added to the dialog box.
+         *
+         *  If no custom buttons are specified, the returned array depends on the type of the dialog box.
+         *
+         *  @return array       Returns an array containing the buttons that are to be added to the dialog box.
+         *
+         *  @access private
+         */
+        var get_buttons = function() {
+
+            // if plugin.settings.buttons is not TRUE and is not an array either, don't go further
+            if (plugin.settings.buttons !== true && !$.isArray(plugin.settings.buttons)) return false;
+
+            // if default buttons are to be used
+            if (plugin.settings.buttons === true)
+
+                // there are different buttons for different dialog box types
+                switch (plugin.settings.type) {
+
+                    // for "question" type
+                    case 'question':
+
+                        // there are two buttons
+                        plugin.settings.buttons = ['Yes', 'No'];
+
+                        break;
+
+                    // for the other types
+                    default:
+
+                        // there is only one button
+                        plugin.settings.buttons = ['Ok'];
+
+                }
+
+            // return the buttons in reversed order
+            // (buttons need to be added in reverse order because they are floated to the right)
+            return plugin.settings.buttons.reverse();
+
+        }
+
+        /**
+         *  Returns the type of the dialog box, or FALSE if type is not one of the five known types.
+         *
+         *  Values that may be returned by this method are:
+         *  -   Confirmation
+         *  -   Error
+         *  -   Information
+         *  -   Question
+         *  -   Warning
+         *
+         *  @return boolean     Returns the type of the dialog box, or FALSE if type is not one of the five known types.
+         *
+         *  @access private
+         */
+        var get_type = function() {
+
+            // see what is the type of the dialog box
+            switch (plugin.settings.type) {
+
+                // if one of the five supported types
+                case 'confirmation':
+                case 'error':
+                case 'information':
+                case 'question':
+                case 'warning':
+
+                    // return the dialog box's type, first letter capital
+                    return plugin.settings.type.charAt(0).toUpperCase() + plugin.settings.type.slice(1).toLowerCase();
+
+                    break;
+
+                // if unknown type
+                default:
+
+                    // return FALSE
+                    return false;
+
+            }
+
+        }
+
+        /**
+         *  Function to be called when the "onKeyUp" event occurs
+         *
+         *  Why as a sepparate function and not inline when binding the event? Because only this way we can "unbind" it
+         *  when we close the dialog box
+         *
+         *  @return boolean     Returns TRUE
+         *
+         *  @access private
+         */
+        var _keyup = function(e) {
+
+            // if pressed key is ESC
+            // remove the overlay and the dialog box from the DOM
+            if (e.which == 27) plugin.close();
+
+            // let the event bubble up
+            return true;
+
+        }
+
+        /**
+         *  Function to be called when the "onScroll" event occurs in Internet Explorer 6.
+         *
+         *  Why as a sepparate function and not inline when binding the event? Because only this way we can "unbind" it
+         *  when we close the dialog box
+         *
+         *  @return void
+         *
+         *  @access private
+         */
+        var _scroll = function() {
+
+            // make sure the overlay and the dialog box always stay in the correct position
+            emulate_fixed_position();
+
+        }
+
+        // fire up the plugin!
+        // call the "constructor" method
+        return plugin.init();
+
+    }
+
+})(jQuery);
Index: trunk/prototype/plugins/zebradialog/javascript/zebra_dialog.js
===================================================================
--- trunk/prototype/plugins/zebradialog/javascript/zebra_dialog.js	(revision 5341)
+++ trunk/prototype/plugins/zebradialog/javascript/zebra_dialog.js	(revision 5341)
@@ -0,0 +1,1 @@
+(function(c){c.Zebra_Dialog=function(e,h){var m={animation_speed:250,auto_close:!1,buttons:!0,custom_class:!1,keyboard:!0,message:"",modal:!0,overlay_close:!0,overlay_opacity:0.9,position:"center",title:"",type:"information",vcenter_short_message:!0,width:0,onClose:null},a=this;a.settings={};options={};if(typeof e=="string")options.message=e;if(typeof e=="object"||typeof h=="object")options=c.extend(options,typeof e=="object"?e:h);a.init=function(){a.settings=c.extend({},m,options);a.isIE6=c.browser.msie&& parseInt(c.browser.version,10)==6||!1;if(a.settings.modal)a.overlay=jQuery("<div>",{"class":"ZebraDialogOverlay"}).css({position:a.isIE6?"absolute":"fixed",left:0,top:0,opacity:a.settings.overlay_opacity,"z-index":1E3}),a.settings.overlay_close&&a.overlay.bind("click",a.close),a.overlay.appendTo("body");a.dialog=jQuery("<div>",{"class":"ZebraDialog"+(a.settings.custom_class?" "+a.settings.custom_class:"")}).css({position:a.isIE6?"absolute":"fixed",left:0,top:0,"z-index":1001,visibility:"hidden"}); if(!a.settings.buttons&&a.settings.auto_close)a.settings.uniqueid=(a.settings.position+a.settings.auto_close+"").replace(/\+/g,"inc").replace(/\-/g,"dec").replace(/[^a-z0-9]/gi,""),a.dialog.addClass(a.settings.uniqueid);var b=parseInt(a.settings.width);!isNaN(b)&&b==a.settings.width&&b.toString()==a.settings.width.toString()&&b>0&&a.dialog.css({width:a.settings.width});a.settings.title&&jQuery("<h3>",{"class":"ZebraDialog_Title"}).html(a.settings.title).appendTo(a.dialog);a.message=jQuery("<div>", {"class":"ZebraDialog_Body"+(i()!=""?" ZebraDialog_Icon ZebraDialog_"+i():"")});a.settings.vcenter_short_message?jQuery("<div>").html(a.settings.message).appendTo(a.message):a.message.html(a.settings.message);a.message.appendTo(a.dialog);if(a.settings.buttons!==!0&&!c.isArray(a.settings.buttons))b=!1;else{if(a.settings.buttons===!0)switch(a.settings.type){case "question":a.settings.buttons=["Yes","No"];break;default:a.settings.buttons=["Ok"]}b=a.settings.buttons.reverse()}if(b){var d=jQuery("<div>", {"class":"ZebraDialog_Buttons"}).appendTo(a.dialog);c.each(b,function(b,c){var e=jQuery("<a>",{href:"javascript:void(0)","class":"ZebraDialog_Button"+b}).html(c);e.bind("click",function(){a.close(c)});e.appendTo(d)});jQuery("<div>",{style:"clear:both"}).appendTo(d)}a.dialog.appendTo("body");c(window).bind("resize",g);a.settings.keyboard&&c(document).bind("keyup",j);a.isIE6&&c(window).bind("scroll",k);a.settings.auto_close!==!1&&setTimeout(a.close,a.settings.auto_close);g();return a};a.close=function(b){a.settings.keyboard&& c(document).unbind("keyup",j);a.isIE6&&c(window).unbind("scroll",k);c(window).unbind("resize",g);a.settings.modal&&a.overlay.animate({opacity:0},a.settings.animation_speed,function(){a.overlay.remove()});a.dialog.animate({top:0,opacity:0},a.settings.animation_speed,function(){a.dialog.remove()});if(a.settings.onClose&&typeof a.settings.onClose=="function")a.settings.onClose(void 0!=b?b:"")};var g=function(){var b=c(window).width(),d=c(window).height(),f=a.dialog.width(),e=a.dialog.height(),f={left:0, top:0,right:b-f,bottom:d-e,center:(b-f)/2,middle:(d-e)/2};a.dialog_left=void 0;a.dialog_top=void 0;a.settings.modal&&a.overlay.css({width:b,height:d});c.isArray(a.settings.position)&&a.settings.position.length==2&&typeof a.settings.position[0]=="string"&&a.settings.position[0].match(/^(left|right|center)[\s0-9\+\-]*$/)&&typeof a.settings.position[1]=="string"&&a.settings.position[1].match(/^(top|bottom|middle)[\s0-9\+\-]*$/)&&(a.settings.position[0]=a.settings.position[0].toLowerCase(),a.settings.position[1]= a.settings.position[1].toLowerCase(),c.each(f,function(b,c){for(var d=0;d<2;d++){var e=a.settings.position[d].replace(b,c);if(e!=a.settings.position[d])d==0?a.dialog_left=eval(e):a.dialog_top=eval(e)}}));if(void 0==a.dialog_left||void 0==a.dialog_top)a.dialog_left=f.center,a.dialog_top=f.middle;a.settings.vcenter_short_message&&(b=a.message.find("div:first"),d=b.height(),f=a.message.height(),d<f&&b.css({"margin-top":(f-d)/2}));a.dialog.css({left:a.dialog_left,top:a.dialog_top,visibility:"visible"}); a.dialog.find("a[class^=ZebraDialog_Button]:first").focus();a.isIE6&&setTimeout(l,500)},l=function(){var b=c(window).scrollTop(),d=c(window).scrollLeft();a.settings.modal&&a.overlay.css({top:b,left:d});a.dialog.css({left:a.dialog_left+d,top:a.dialog_top+b})},i=function(){switch(a.settings.type){case "confirmation":case "error":case "information":case "question":case "warning":return a.settings.type.charAt(0).toUpperCase()+a.settings.type.slice(1).toLowerCase();default:return!1}},j=function(b){b.which== 27&&a.close();return!0},k=function(){l()};return a.init()}})(jQuery);
Index: trunk/prototype/plugins/zebradialog/css/zebra_dialog.css
===================================================================
--- trunk/prototype/plugins/zebradialog/css/zebra_dialog.css	(revision 5341)
+++ trunk/prototype/plugins/zebradialog/css/zebra_dialog.css	(revision 5341)
@@ -0,0 +1,77 @@
+.ZebraDialog {
+    font-family: Tahoma, Arial, Helvetica, sans-serif;
+    font-size: 12px;
+    background: #FFF;
+    padding: 0px;
+    width: 350px;
+    color: #222;
+    -webkit-border-radius: 6px;
+    -moz-border-radius: 6px;
+    border-radius: 6px;
+    -webkit-box-shadow: 0px 0px 4px 2px #222;
+    -moz-box-shadow: 0px 0px 4px 2px #222;
+    box-shadow: 0px 0px 4px 2px #222;
+    *border: 1px solid #666;    /* IE6 & 7 */
+    border: 1px solid #666\9;   /* IE8 */
+}
+
+.ZebraDialog .ZebraDialog_Title {
+    margin: 0;
+    padding: 5px 10px;
+    font-weight: bold;
+    font-size: 14px;
+    background: #222;
+    color: #FFF;
+    text-align: left;
+    -webkit-border-top-left-radius: 4px;
+    -webkit-border-top-right-radius: 4px;
+    -moz-border-radius-topleft: 4px;
+    -moz-border-radius-topright: 4px;
+    border-top-left-radius: 4px;
+    border-top-right-radius: 4px;
+    *padding: 7px 10px;     /* IE6 & 7 */
+    padding: 7px 10px\9;    /* IE8 */
+}
+
+.ZebraDialog .ZebraDialog_Body              { background-repeat: no-repeat; background-position: 10px 10px; padding: 10px; text-align: left }
+
+.ZebraDialog .ZebraDialog_Icon              { padding: 10px 10px 10px 68px; min-height: 48px; _height: 48px }
+
+.ZebraDialog .ZebraDialog_Confirmation      { background-image: url('confirmation.png') }
+.ZebraDialog .ZebraDialog_Error             { background-image: url('error.png') }
+.ZebraDialog .ZebraDialog_Information       { background-image: url('information.png') }
+.ZebraDialog .ZebraDialog_Question          { background-image: url('question.png') }
+.ZebraDialog .ZebraDialog_Warning           { background-image: url('warning.png') }
+
+.ZebraDialog .ZebraDialog_Buttons {
+    background: #E5E5E5;
+    border-top: 1px solid #DADADA;
+    padding: 5px 5px 5px 10px;
+    -webkit-border-bottom-left-radius: 5px;
+    -webkit-border-bottom-right-radius: 5px;
+    -moz-border-radius-bottomleft: 5px;
+    -moz-border-radius-bottomright: 5px;
+    border-bottom-left-radius: 5px;
+    border-bottom-right-radius: 5px;
+}
+
+.ZebraDialog .ZebraDialog_Buttons a {
+    text-decoration: none;
+    font-weight: bold;
+    color: #000;
+    background: transparent;
+    border: 1px solid #AAA;
+    padding: 4px 10px;
+    float: right;
+    margin-right: 5px;
+    min-width: 60px;
+    _width: 60px;
+    text-align: center;
+    -webkit-border-radius: 4px;
+    -moz-border-radius: 4px;
+    border-radius: 4px;
+}
+
+.ZebraDialog .ZebraDialog_Buttons a:hover   { background: #717366; color: #FFF }
+
+.ZebraDialogOverlay                         { background: #666 }
Index: trunk/prototype/plugins/fileupload/jquery.fileupload-ui.css
===================================================================
--- trunk/prototype/plugins/fileupload/jquery.fileupload-ui.css	(revision 5341)
+++ trunk/prototype/plugins/fileupload/jquery.fileupload-ui.css	(revision 5341)
@@ -0,0 +1,100 @@
+@charset 'UTF-8';
+/*
+ * jQuery File Upload UI Plugin CSS 5.0.6
+ * https://github.com/blueimp/jQuery-File-Upload
+ *
+ * Copyright 2010, Sebastian Tschan
+ * https://blueimp.net
+ *
+ * Licensed under the MIT license:
+ * http://creativecommons.org/licenses/MIT/
+ */
+
+.fileupload-buttonbar .ui-button input {
+  position: absolute;
+  top: 0;
+  right: 0;
+  margin: 0;
+  border: solid transparent;
+  border-width: 0 0 100px 200px;
+  opacity: 0;
+  filter: alpha(opacity=0);
+  -o-transform: translate(250px, -50px) scale(1);
+  -moz-transform: translate(-300px, 0) scale(4);
+  direction: ltr;
+  cursor: pointer;
+}
+
+.fileinput-button {
+  overflow: hidden;
+}
+
+/* Fix for IE 6: */
+*html .fileinput-button {
+  padding: 2px 0;
+}
+
+/* Fix for IE 7: */
+*+html .fileinput-button {
+  padding: 2px 0;
+}
+
+.fileupload-buttonbar {
+  padding: 0.2em 0.4em;
+}
+
+.fileupload-buttonbar .ui-button {
+  vertical-align: middle;
+}
+
+.fileupload-content {
+  padding: 0.2em 0.4em;
+  border-top-width: 0;
+}
+
+.fileupload-content .ui-progressbar {
+  width: 200px;
+  height: 20px;
+}
+
+.fileupload-content .ui-progressbar-value {
+  background: url(pbar-ani.gif);
+}
+
+.fileupload-content .fileupload-progressbar {
+  width: 400px;
+  margin: 10px 0;
+}
+
+.files {
+  margin: 10px 0;
+  border-collapse: collapse;
+}
+
+.files td {
+  padding: 5px;
+  border-spacing: 5px;
+}
+
+.files img {
+  border: none;
+}
+
+.files .name {
+  padding: 0 10px;
+}
+
+.files .size {
+  padding: 0 10px 0 0;
+  text-align: right;
+  white-space: nowrap;
+}
+
+.ui-state-disabled .ui-state-disabled {
+  opacity: 1;
+  filter: alpha(opacity=100);
+}
+
+.ui-state-disabled input {
+  cursor: default;
+}
Index: trunk/prototype/plugins/fileupload/jquery.iframe-transport.js
===================================================================
--- trunk/prototype/plugins/fileupload/jquery.iframe-transport.js	(revision 5341)
+++ trunk/prototype/plugins/fileupload/jquery.iframe-transport.js	(revision 5341)
@@ -0,0 +1,156 @@
+/*
+ * jQuery Iframe Transport Plugin 1.2.2
+ * https://github.com/blueimp/jQuery-File-Upload
+ *
+ * Copyright 2011, Sebastian Tschan
+ * https://blueimp.net
+ *
+ * Licensed under the MIT license:
+ * http://creativecommons.org/licenses/MIT/
+ */
+
+/*jslint unparam: true */
+/*global jQuery */
+
+(function ($) {
+    'use strict';
+
+    // Helper variable to create unique names for the transport iframes:
+    var counter = 0;
+
+    // The iframe transport accepts three additional options:
+    // options.fileInput: a jQuery collection of file input fields
+    // options.paramName: the parameter name for the file form data,
+    //  overrides the name property of the file input field(s)
+    // options.formData: an array of objects with name and value properties,
+    //  equivalent to the return data of .serializeArray(), e.g.:
+    //  [{name: a, value: 1}, {name: b, value: 2}]
+    $.ajaxTransport('iframe', function (options, originalOptions, jqXHR) {
+        if (options.type === 'POST' || options.type === 'GET') {
+            var form,
+                iframe;
+            return {
+                send: function (headers, completeCallback) {
+                    form = $('<form style="display:none;"></form>');
+                    // javascript:false as initial iframe src
+                    // prevents warning popups on HTTPS in IE6.
+                    // IE versions below IE8 cannot set the name property of
+                    // elements that have already been added to the DOM,
+                    // so we set the name along with the iframe HTML markup:
+                    iframe = $(
+                        '<iframe src="javascript:false;" name="iframe-transport-' +
+                            (counter += 1) + '"></iframe>'
+                    ).bind('load', function () {
+                        var fileInputClones;
+                        iframe
+                            .unbind('load')
+                            .bind('load', function () {
+                                var response;
+                                // Wrap in a try/catch block to catch exceptions thrown
+                                // when trying to access cross-domain iframe contents:
+                                try {
+                                    response = iframe.contents();
+                                    // Google Chrome and Firefox do not throw an
+                                    // exception when calling iframe.contents() on
+                                    // cross-domain requests, so we unify the response:
+                                    if (!response.length || !response[0].firstChild) {
+                                        throw new Error();
+                                    }
+                                } catch (e) {
+                                    response = undefined;
+                                }
+                                // The complete callback returns the
+                                // iframe content document as response object:
+                                completeCallback(
+                                    200,
+                                    'success',
+                                    {'iframe': response}
+                                );
+                                // Fix for IE endless progress bar activity bug
+                                // (happens on form submits to iframe targets):
+                                $('<iframe src="javascript:false;"></iframe>')
+                                    .appendTo(form);
+                                form.remove();
+                            });
+                        form
+                            .prop('target', iframe.prop('name'))
+                            .prop('action', options.url)
+                            .prop('method', options.type);
+                        if (options.formData) {
+                            $.each(options.formData, function (index, field) {
+                                $('<input type="hidden"/>')
+                                    .prop('name', field.name)
+                                    .val(field.value)
+                                    .appendTo(form);
+                            });
+                        }
+                        if (options.fileInput && options.fileInput.length &&
+                                options.type === 'POST') {
+                            fileInputClones = options.fileInput.clone();
+                            // Insert a clone for each file input field:
+                            options.fileInput.after(function (index) {
+                                return fileInputClones[index];
+                            });
+                            if (options.paramName) {
+                                options.fileInput.each(function () {
+                                    $(this).prop('name', options.paramName);
+                                });
+                            }
+                            // Appending the file input fields to the hidden form
+                            // removes them from their original location:
+                            form
+                                .append(options.fileInput)
+                                .prop('enctype', 'multipart/form-data')
+                                // enctype must be set as encoding for IE:
+                                .prop('encoding', 'multipart/form-data');
+                        }
+                        form.submit();
+                        // Insert the file input fields at their original location
+                        // by replacing the clones with the originals:
+                        if (fileInputClones && fileInputClones.length) {
+                            options.fileInput.each(function (index, input) {
+                                var clone = $(fileInputClones[index]);
+                                $(input).prop('name', clone.prop('name'));
+                                clone.replaceWith(input);
+                            });
+                        }
+                    });
+                    form.append(iframe).appendTo('body');
+                },
+                abort: function () {
+                    if (iframe) {
+                        // javascript:false as iframe src aborts the request
+                        // and prevents warning popups on HTTPS in IE6.
+                        // concat is used to avoid the "Script URL" JSLint error:
+                        iframe
+                            .unbind('load')
+                            .prop('src', 'javascript'.concat(':false;'));
+                    }
+                    if (form) {
+                        form.remove();
+                    }
+                }
+            };
+        }
+    });
+
+    // The iframe transport returns the iframe content document as response.
+    // The following adds converters from iframe to text, json, html, and script:
+    $.ajaxSetup({
+        converters: {
+            'iframe text': function (iframe) {
+                return iframe.text();
+            },
+            'iframe json': function (iframe) {
+                return $.parseJSON(iframe.text());
+            },
+            'iframe html': function (iframe) {
+                return iframe.find('body').html();
+            },
+            'iframe script': function (iframe) {
+                return $.globalEval(iframe.text());
+            }
+        }
+    });
+
+}(jQuery));
Index: trunk/prototype/plugins/fileupload/jquery.fileupload-ui.js
===================================================================
--- trunk/prototype/plugins/fileupload/jquery.fileupload-ui.js	(revision 5341)
+++ trunk/prototype/plugins/fileupload/jquery.fileupload-ui.js	(revision 5341)
@@ -0,0 +1,650 @@
+/*
+ * jQuery File Upload User Interface Plugin 5.0.16
+ * https://github.com/blueimp/jQuery-File-Upload
+ *
+ * Copyright 2010, Sebastian Tschan
+ * https://blueimp.net
+ *
+ * Licensed under the MIT license:
+ * http://creativecommons.org/licenses/MIT/
+ */
+
+/*jslint nomen: true, unparam: true, regexp: true */
+/*global window, document, URL, webkitURL, FileReader, jQuery */
+
+(function ($) {
+    'use strict';
+    
+    // The UI version extends the basic fileupload widget and adds
+    // a complete user interface based on the given upload/download
+    // templates.
+    $.widget('blueimpUI.fileupload', $.blueimp.fileupload, {
+        
+        options: {
+            // By default, files added to the widget are uploaded as soon
+            // as the user clicks on the start buttons. To enable automatic
+            // uploads, set the following option to true:
+            autoUpload: false,
+            // The following option limits the number of files that are
+            // allowed to be uploaded using this widget:
+            maxNumberOfFiles: undefined,
+            // The maximum allowed file size:
+            maxFileSize: undefined,
+            // The minimum allowed file size:
+            minFileSize: 1,
+            // The regular expression for allowed file types, matches
+            // against either file type or file name:
+            acceptFileTypes:  /.+$/i,
+            // The regular expression to define for which files a preview
+            // image is shown, matched against the file type:
+            previewFileTypes: /^image\/(gif|jpeg|png)$/,
+            // The maximum width of the preview images:
+            previewMaxWidth: 80,
+            // The maximum height of the preview images:
+            previewMaxHeight: 80,
+            // By default, preview images are displayed as canvas elements
+            // if supported by the browser. Set the following option to false
+            // to always display preview images as img elements:
+            previewAsCanvas: true,
+            // The file upload template that is given as first argument to the
+            // jQuery.tmpl method to render the file uploads:
+            uploadTemplate: $('#template-upload'),
+            // The file download template, that is given as first argument to the
+            // jQuery.tmpl method to render the file downloads:
+            downloadTemplate: $('#template-download'),
+            // The expected data type of the upload response, sets the dataType
+            // option of the $.ajax upload requests:
+            dataType: 'json',
+            
+            // The add callback is invoked as soon as files are added to the fileupload
+            // widget (via file input selection, drag & drop or add API call).
+            // See the basic file upload widget for more information:
+            add: function (e, data) {
+                var that = $(this).data('fileupload');
+                that._adjustMaxNumberOfFiles(-data.files.length);
+                data.isAdjusted = true;
+                data.isValidated = that._validate(data.files);
+                data.context = that._renderUpload(data.files)
+                    .appendTo($(this).find('.files')).fadeIn(function () {
+                        // Fix for IE7 and lower:
+                        $(this).show();
+                    }).data('data', data);
+                if ((that.options.autoUpload || data.autoUpload) &&
+                        data.isValidated) {
+                    data.jqXHR = data.submit();
+                }
+            },
+            // Callback for the start of each file upload request:
+            send: function (e, data) {
+                if (!data.isValidated) {
+                    var that = $(this).data('fileupload');
+                    if (!data.isAdjusted) {
+                        that._adjustMaxNumberOfFiles(-data.files.length);
+                    }
+                    if (!that._validate(data.files)) {
+                        return false;
+                    }
+                }
+                if (data.context && data.dataType &&
+                        data.dataType.substr(0, 6) === 'iframe') {
+                    // Iframe Transport does not support progress events.
+                    // In lack of an indeterminate progress bar, we set
+                    // the progress to 100%, showing the full animated bar:
+                    data.context.find('.ui-progressbar').progressbar(
+                        'value',
+                        parseInt(100, 10)
+                    );
+                }
+            },
+            // Callback for successful uploads:
+            done: function (e, data) {
+                var that = $(this).data('fileupload');
+                if (data.context) {
+                    data.context.each(function (index) {
+                        var file = ($.isArray(data.result) &&
+                                data.result[index]) || {error: 'emptyResult'};
+                        if (file.error) {
+                            that._adjustMaxNumberOfFiles(1);
+                        }
+                        $(this).fadeOut(function () {
+                            that._renderDownload([file])
+                                .css('display', 'none')
+                                .replaceAll(this)
+                                .fadeIn(function () {
+                                    // Fix for IE7 and lower:
+                                    $(this).show();
+                                });
+                        });
+                    });
+                } else {
+                    that._renderDownload(data.result)
+                        .css('display', 'none')
+                        .appendTo($(this).find('.files'))
+                        .fadeIn(function () {
+                            // Fix for IE7 and lower:
+                            $(this).show();
+                        });
+                }
+            },
+            // Callback for failed (abort or error) uploads:
+            fail: function (e, data) {
+                var that = $(this).data('fileupload');
+                that._adjustMaxNumberOfFiles(data.files.length);
+                if (data.context) {
+                    data.context.each(function (index) {
+                        $(this).fadeOut(function () {
+                            if (data.errorThrown !== 'abort') {
+                                var file = data.files[index];
+                                file.error = file.error || data.errorThrown
+                                    || true;
+                                that._renderDownload([file])
+                                    .css('display', 'none')
+                                    .replaceAll(this)
+                                    .fadeIn(function () {
+                                        // Fix for IE7 and lower:
+                                        $(this).show();
+                                    });
+                            } else {
+                                data.context.remove();
+                            }
+                        });
+                    });
+                } else if (data.errorThrown !== 'abort') {
+                    that._adjustMaxNumberOfFiles(-data.files.length);
+                    data.context = that._renderUpload(data.files)
+                        .css('display', 'none')
+                        .appendTo($(this).find('.files'))
+                        .fadeIn(function () {
+                            // Fix for IE7 and lower:
+                            $(this).show();
+                        }).data('data', data);
+                }
+            },
+            // Callback for upload progress events:
+            progress: function (e, data) {
+                if (data.context) {
+                    data.context.find('.ui-progressbar').progressbar(
+                        'value',
+                        parseInt(data.loaded / data.total * 100, 10)
+                    );
+                }
+            },
+            // Callback for global upload progress events:
+            progressall: function (e, data) {
+                $(this).find('.fileupload-progressbar').progressbar(
+                    'value',
+                    parseInt(data.loaded / data.total * 100, 10)
+                );
+            },
+            // Callback for uploads start, equivalent to the global ajaxStart event:
+            start: function () {
+                $(this).find('.fileupload-progressbar')
+                    .progressbar('value', 0).fadeIn();
+            },
+            // Callback for uploads stop, equivalent to the global ajaxStop event:
+            stop: function () {
+                $(this).find('.fileupload-progressbar').fadeOut();
+            },
+            // Callback for file deletion:
+            destroy: function (e, data) {
+                var that = $(this).data('fileupload');
+                if (data.url) {
+                    $.ajax(data)
+                        .success(function () {
+                            that._adjustMaxNumberOfFiles(1);
+                            $(this).fadeOut(function () {
+                                $(this).remove();
+                            });
+                        });
+                } else {
+                    that._adjustMaxNumberOfFiles(1);
+                    data.context.fadeOut(function () {
+                        $(this).remove();
+                    });
+                }
+            }
+        },
+
+        // Scales the given image (img HTML element)
+        // using the given options.
+        // Returns a canvas object if the canvas option is true
+        // and the browser supports canvas, else the scaled image:
+        _scaleImage: function (img, options) {
+            options = options || {};
+            var canvas = document.createElement('canvas'),
+                scale = Math.min(
+                    (options.maxWidth || img.width) / img.width,
+                    (options.maxHeight || img.height) / img.height
+                );
+            if (scale >= 1) {
+                scale = Math.max(
+                    (options.minWidth || img.width) / img.width,
+                    (options.minHeight || img.height) / img.height
+                );
+            }
+            img.width = parseInt(img.width * scale, 10);
+            img.height = parseInt(img.height * scale, 10);
+            if (!options.canvas || !canvas.getContext) {
+                return img;
+            }
+            canvas.width = img.width;
+            canvas.height = img.height;
+            canvas.getContext('2d')
+                .drawImage(img, 0, 0, img.width, img.height);
+            return canvas;
+        },
+
+        _createObjectURL: function (file) {
+            var undef = 'undefined',
+                urlAPI = (typeof window.createObjectURL !== undef && window) ||
+                    (typeof URL !== undef && URL) ||
+                    (typeof webkitURL !== undef && webkitURL);
+            return urlAPI ? urlAPI.createObjectURL(file) : false;
+        },
+        
+        _revokeObjectURL: function (url) {
+            var undef = 'undefined',
+                urlAPI = (typeof window.revokeObjectURL !== undef && window) ||
+                    (typeof URL !== undef && URL) ||
+                    (typeof webkitURL !== undef && webkitURL);
+            return urlAPI ? urlAPI.revokeObjectURL(url) : false;
+        },
+
+        // Loads a given File object via FileReader interface,
+        // invokes the callback with a data url:
+        _loadFile: function (file, callback) {
+            if (typeof FileReader !== 'undefined' &&
+                    FileReader.prototype.readAsDataURL) {
+                var fileReader = new FileReader();
+                fileReader.onload = function (e) {
+                    callback(e.target.result);
+                };
+                fileReader.readAsDataURL(file);
+                return true;
+            }
+            return false;
+        },
+
+        // Loads an image for a given File object.
+        // Invokes the callback with an img or optional canvas
+        // element (if supported by the browser) as parameter:
+        _loadImage: function (file, callback, options) {
+            var that = this,
+                url,
+                img;
+            if (!options || !options.fileTypes ||
+                    options.fileTypes.test(file.type)) {
+                url = this._createObjectURL(file);
+                img = $('<img>').bind('load', function () {
+                    $(this).unbind('load');
+                    that._revokeObjectURL(url);
+                    callback(that._scaleImage(img[0], options));
+                });
+                if (url) {
+                    img.prop('src', url);
+                } else {
+                    this._loadFile(file, function (url) {
+                        img.prop('src', url);
+                    });
+                }
+            }
+        },
+
+        // Link handler, that allows to download files
+        // by drag & drop of the links to the desktop:
+        _enableDragToDesktop: function () {
+            var link = $(this),
+                url = link.prop('href'),
+                name = decodeURIComponent(url.split('/').pop())
+                    .replace(/:/g, '-'),
+                type = 'application/octet-stream';
+            link.bind('dragstart', function (e) {
+                try {
+                    e.originalEvent.dataTransfer.setData(
+                        'DownloadURL',
+                        [type, name, url].join(':')
+                    );
+                } catch (err) {}
+            });
+        },
+
+        _adjustMaxNumberOfFiles: function (operand) {
+            if (typeof this.options.maxNumberOfFiles === 'number') {
+                this.options.maxNumberOfFiles += operand;
+                if (this.options.maxNumberOfFiles < 1) {
+                    this._disableFileInputButton();
+                } else {
+                    this._enableFileInputButton();
+                }
+            }
+        },
+
+        _formatFileSize: function (file) {
+            if (typeof file.size !== 'number') {
+                return '';
+            }
+            if (file.size >= 1000000000) {
+                return (file.size / 1000000000).toFixed(2) + ' GB';
+            }
+            if (file.size >= 1000000) {
+                return (file.size / 1000000).toFixed(2) + ' MB';
+            }
+            return (file.size / 1000).toFixed(2) + ' KB';
+        },
+
+        _hasError: function (file) {
+            if (file.error) {
+                return file.error;
+            }
+            // The number of added files is subtracted from
+            // maxNumberOfFiles before validation, so we check if
+            // maxNumberOfFiles is below 0 (instead of below 1):
+            if (this.options.maxNumberOfFiles < 0) {
+                return 'maxNumberOfFiles';
+            }
+            // Files are accepted if either the file type or the file name
+            // matches against the acceptFileTypes regular expression, as
+            // only browsers with support for the File API report the type:
+            if (!(this.options.acceptFileTypes.test(file.type) ||
+                    this.options.acceptFileTypes.test(file.name))) {
+                return 'acceptFileTypes';
+            }
+            if (this.options.maxFileSize &&
+                    file.size > this.options.maxFileSize) {
+                return 'maxFileSize';
+            }
+            if (typeof file.size === 'number' &&
+                    file.size < this.options.minFileSize) {
+                return 'minFileSize';
+            }
+            return null;
+        },
+
+        _validate: function (files) {
+            var that = this,
+                valid = !!files.length;
+            $.each(files, function (index, file) {
+                file.error = that._hasError(file);
+                if (file.error) {
+                    valid = false;
+                }
+            });
+            return valid;
+        },
+
+        _uploadTemplateHelper: function (file) {
+            file.sizef = this._formatFileSize(file);
+            return file;
+        },
+
+        _renderUploadTemplate: function (files) {
+            var that = this;
+            return $.tmpl(
+                this.options.uploadTemplate,
+                $.map(files, function (file) {
+                    return that._uploadTemplateHelper(file);
+                })
+            );
+        },
+
+        _renderUpload: function (files) {
+            var that = this,
+                options = this.options,
+                tmpl = this._renderUploadTemplate(files),
+                isValidated = this._validate(files);
+            if (!(tmpl instanceof $)) {
+                return $();
+            }
+            tmpl.css('display', 'none');
+            // .slice(1).remove().end().first() removes all but the first
+            // element and selects only the first for the jQuery collection:
+            tmpl.find('.progress div').slice(
+                isValidated ? 1 : 0
+            ).remove().end().first()
+                .progressbar();
+            tmpl.find('.start button').slice(
+                this.options.autoUpload || !isValidated ? 0 : 1
+            ).remove().end().first()
+                .button({
+                    text: false,
+                    icons: {primary: 'ui-icon-circle-arrow-e'}
+                });
+            tmpl.find('.cancel button').slice(1).remove().end().first()
+                .button({
+                    text: false,
+                    icons: {primary: 'ui-icon-cancel'}
+                });
+            tmpl.find('.preview').each(function (index, node) {
+                that._loadImage(
+                    files[index],
+                    function (img) {
+                        $(img).hide().appendTo(node).fadeIn();
+                    },
+                    {
+                        maxWidth: options.previewMaxWidth,
+                        maxHeight: options.previewMaxHeight,
+                        fileTypes: options.previewFileTypes,
+                        canvas: options.previewAsCanvas
+                    }
+                );
+            });
+            return tmpl;
+        },
+
+        _downloadTemplateHelper: function (file) {
+            file.sizef = this._formatFileSize(file);
+            return file;
+        },
+
+        _renderDownloadTemplate: function (files) {
+            var that = this;
+            return $.tmpl(
+                this.options.downloadTemplate,
+                $.map(files, function (file) {
+                    return that._downloadTemplateHelper(file);
+                })
+            );
+        },
+        
+        _renderDownload: function (files) {
+            var tmpl = this._renderDownloadTemplate(files);
+            if (!(tmpl instanceof $)) {
+                return $();
+            }
+            tmpl.css('display', 'none');
+            tmpl.find('.delete button').button({
+                text: false,
+                icons: {primary: 'ui-icon-trash'}
+            });
+            tmpl.find('a').each(this._enableDragToDesktop);
+            return tmpl;
+        },
+        
+        _startHandler: function (e) {
+            e.preventDefault();
+            var tmpl = $(this).closest('.template-upload'),
+                data = tmpl.data('data');
+            if (data && data.submit && !data.jqXHR) {
+                data.jqXHR = data.submit();
+                $(this).fadeOut();
+            }
+        },
+        
+        _cancelHandler: function (e) {
+            e.preventDefault();
+            var tmpl = $(this).closest('.template-upload'),
+                data = tmpl.data('data') || {};
+            if (!data.jqXHR) {
+                data.errorThrown = 'abort';
+                e.data.fileupload._trigger('fail', e, data);
+            } else {
+                data.jqXHR.abort();
+            }
+        },
+        
+        _deleteHandler: function (e) {
+            e.preventDefault();
+            var button = $(this);
+            e.data.fileupload._trigger('destroy', e, {
+                context: button.closest('.template-download'),
+                url: button.attr('data-url'),
+                type: button.attr('data-type'),
+                dataType: e.data.fileupload.options.dataType
+            });
+        },
+        
+        _initEventHandlers: function () {
+            $.blueimp.fileupload.prototype._initEventHandlers.call(this);
+            var filesList = this.element.find('.files'),
+                eventData = {fileupload: this};
+            filesList.find('.start button')
+                .live(
+                    'click.' + this.options.namespace,
+                    eventData,
+                    this._startHandler
+                );
+            filesList.find('.cancel button')
+                .live(
+                    'click.' + this.options.namespace,
+                    eventData,
+                    this._cancelHandler
+                );
+            filesList.find('.delete button')
+                .live(
+                    'click.' + this.options.namespace,
+                    eventData,
+                    this._deleteHandler
+                );
+        },
+        
+        _destroyEventHandlers: function () {
+            var filesList = this.element.find('.files');
+            filesList.find('.start button')
+                .die('click.' + this.options.namespace);
+            filesList.find('.cancel button')
+                .die('click.' + this.options.namespace);
+            filesList.find('.delete button')
+                .die('click.' + this.options.namespace);
+            $.blueimp.fileupload.prototype._destroyEventHandlers.call(this);
+        },
+
+        _initFileUploadButtonBar: function () {
+            var fileUploadButtonBar = this.element.find('.fileupload-buttonbar'),
+                filesList = this.element.find('.files'),
+                ns = this.options.namespace;
+            fileUploadButtonBar
+                .addClass('ui-widget-header ui-corner-top');
+            this.element.find('.fileinput-button').each(function () {
+                var fileInput = $(this).find('input:file').detach();
+                $(this).button({icons: {primary: 'ui-icon-plusthick'}})
+                    .append(fileInput);
+            });
+            fileUploadButtonBar.find('.start')
+                .button({icons: {primary: 'ui-icon-circle-arrow-e'}})
+                .bind('click.' + ns, function (e) {
+                    e.preventDefault();
+                    filesList.find('.start button').click();
+                });
+            fileUploadButtonBar.find('.cancel')
+                .button({icons: {primary: 'ui-icon-cancel'}})
+                .bind('click.' + ns, function (e) {
+                    e.preventDefault();
+                    filesList.find('.cancel button').click();
+                });
+            fileUploadButtonBar.find('.delete')
+                .button({icons: {primary: 'ui-icon-trash'}})
+                .bind('click.' + ns, function (e) {
+                    e.preventDefault();
+                    filesList.find('.delete button').click();
+                });
+        },
+        
+        _destroyFileUploadButtonBar: function () {
+            this.element.find('.fileupload-buttonbar')
+                .removeClass('ui-widget-header ui-corner-top');
+            this.element.find('.fileinput-button').each(function () {
+                var fileInput = $(this).find('input:file').detach();
+                $(this).button('destroy')
+                    .append(fileInput);
+            });
+            this.element.find('.fileupload-buttonbar button')
+                .unbind('click.' + this.options.namespace)
+                .button('destroy');
+        },
+
+        _enableFileInputButton: function () {
+            this.element.find('.fileinput-button input:file:disabled')
+                .each(function () {
+                    var fileInput = $(this),
+                        button = fileInput.parent();
+                    fileInput.detach().prop('disabled', false);
+                    button.button('enable').append(fileInput);
+                });
+        },
+
+        _disableFileInputButton: function () {
+            this.element.find('.fileinput-button input:file:enabled')
+                .each(function () {
+                    var fileInput = $(this),
+                        button = fileInput.parent();
+                    fileInput.detach().prop('disabled', true);
+                    button.button('disable').append(fileInput);
+                });
+        },
+
+        _initTemplates: function () {
+            // Handle cases where the templates are defined
+            // after the widget library has been included:
+            if (this.options.uploadTemplate instanceof $ &&
+                    !this.options.uploadTemplate.length) {
+                this.options.uploadTemplate = $(
+                    this.options.uploadTemplate.selector
+                );
+            }
+            if (this.options.downloadTemplate instanceof $ &&
+                    !this.options.downloadTemplate.length) {
+                this.options.downloadTemplate = $(
+                    this.options.downloadTemplate.selector
+                );
+            }
+        },
+
+        _create: function () {
+            $.blueimp.fileupload.prototype._create.call(this);
+            this._initTemplates();
+            this.element
+                .addClass('ui-widget');
+            this._initFileUploadButtonBar();
+            this.element.find('.fileupload-content')
+                .addClass('ui-widget-content ui-corner-bottom');
+            this.element.find('.fileupload-progressbar')
+                .hide().progressbar();
+        },
+        
+        destroy: function () {
+            this.element.find('.fileupload-progressbar')
+                .progressbar('destroy');
+            this.element.find('.fileupload-content')
+                .removeClass('ui-widget-content ui-corner-bottom');
+            this._destroyFileUploadButtonBar();
+            this.element.removeClass('ui-widget');
+            $.blueimp.fileupload.prototype.destroy.call(this);
+        },
+        
+        enable: function () {
+            $.blueimp.fileupload.prototype.enable.call(this);
+            this.element.find(':ui-button').not('.fileinput-button')
+                .button('enable');
+            this._enableFileInputButton();
+        },
+        
+        disable: function () {
+            this.element.find(':ui-button').not('.fileinput-button')
+                .button('disable');
+            this._disableFileInputButton();
+            $.blueimp.fileupload.prototype.disable.call(this);
+        }
+
+    });
+
+}(jQuery));
Index: trunk/prototype/plugins/fileupload/README.txt
===================================================================
--- trunk/prototype/plugins/fileupload/README.txt	(revision 5341)
+++ trunk/prototype/plugins/fileupload/README.txt	(revision 5341)
@@ -0,0 +1,79 @@
+jQuery File Upload Plugin
+=========================
+
+Demo
+----
+http://aquantum-demo.appspot.com/file-upload
+
+Setup instructions
+------------------
+https://github.com/blueimp/jQuery-File-Upload/wiki/Setup
+
+Features
+--------
+  - Multiple file upload:
+    Allows to select multiple files at once and upload them simultaneously.
+  - Drag & Drop support:
+    Allows to upload files by dragging them from your desktop or filemanager and dropping them on your browser window.
+  - Upload progress bar:
+    Shows a progress bar indicating the upload progress for individual files and for all uploads combined.
+  - Cancelable uploads:
+    Individual file uploads can be canceled to stop the upload progress.
+  - Resumable uploads:
+    Aborted uploads can be resumed with browsers supporting the Blob API.
+  - Chunked uploads:
+    Large files can be uploaded in smaller chunks with browsers supporting the Blob API.
+  - Preview images:
+    A preview of image files can be displayed before uploading with browsers supporting the required HTML5 APIs.
+  - No browser plugins (e.g. Adobe Flash) required:
+    The implementation is based on open standards like HTML5 and JavaScript and requires no additional browser plugins.
+  - Graceful fallback for legacy browsers:
+    Uploads files via XMLHttpRequests if supported and uses iframes as fallback for legacy browsers.
+  - HTML file upload form fallback:
+    Shows a standard HTML file upload form if JavaScript is disabled.
+  - Cross-site file uploads:
+    Supports uploading files to a different domain with Cross-site XMLHttpRequests.
+  - Multiple plugin instances:
+    Allows to use multiple plugin instances on the same webpage.
+  - Customizable and extensible:
+    Provides an API to set individual options and define callBack methods for various upload events.
+  - Multipart and file contents stream uploads:
+    Files can be uploaded as standard "multipart/form-data" or file contents stream (HTTP PUT file upload).
+  - Compatible with any server-side application platform:
+    Works with Google App Engine (Python, Java), Ruby on Rails, PHP and any other platform that supports HTTP file uploads.
+
+Requirements
+------------
+  - jQuery v. 1.6+
+  - jQuery UI v. 1.8+ (required: Widget, optional: Progressbar, Button)
+  - jQuery Iframe Transport plugin (included)
+  - jQuery Templates plugin v. 1.0+ (optional)
+
+The jQuery UI widget factory is a requirement for the basic File Upload plugin, but very lightweight without any other dependencies. 
+The UI version of the File Upload plugin also requires the jQuery UI Progressbar and Button components as well as the jQuery Templates plugin. These dependencies are marked as optional, as the basic File Upload plugin can be used without them and the UI version of the plugin can be extended to override these dependencies with alternative solutions.
+
+Browser Support (tested versions)
+---------------------------------
+  - Google Chrome - 7.0+
+  - Apple Safari - 4.0+
+  - Mozilla Firefox - 3.0+
+  - Opera - 10.0+
+  - Microsoft Internet Explorer 6.0+
+
+Drag & Drop is only supported on Google Chrome, Firefox 4.0+ and Safari 5.0+.  
+Microsoft Internet Explorer has no support for multiple file selection or upload progress.  
+Extended browser support information:
+https://github.com/blueimp/jQuery-File-Upload/wiki/Browser-support
+
+License
+-------
+Released under the MIT license:
+http://creativecommons.org/licenses/MIT/
+
+Source Code & Download
+----------------------
+https://github.com/blueimp/jQuery-File-Upload
+
+Documentation
+-------------
+https://github.com/blueimp/jQuery-File-Upload/wiki
Index: trunk/prototype/plugins/fileupload/README.md
===================================================================
--- trunk/prototype/plugins/fileupload/README.md	(revision 5341)
+++ trunk/prototype/plugins/fileupload/README.md	(revision 5341)
@@ -0,0 +1,70 @@
+# jQuery File Upload Plugin
+
+## Demo
+[Demo File Upload](http://aquantum-demo.appspot.com/file-upload)
+
+## Setup instructions
+[How to setup the plugin on your website](https://github.com/blueimp/jQuery-File-Upload/wiki/Setup)
+
+## Features
+* **Multiple file upload:**  
+  Allows to select multiple files at once and upload them simultaneously.
+* **Drag & Drop support:**  
+  Allows to upload files by dragging them from your desktop or filemanager and dropping them on your browser window.
+* **Upload progress bar:**  
+  Shows a progress bar indicating the upload progress for individual files and for all uploads combined.
+* **Cancelable uploads:**  
+  Individual file uploads can be canceled to stop the upload progress.
+* **Resumable uploads:**  
+  Aborted uploads can be resumed with browsers supporting the Blob API.
+* **Chunked uploads:**  
+  Large files can be uploaded in smaller chunks with browsers supporting the Blob API.
+* **Preview images:**  
+  A preview of image files can be displayed before uploading with browsers supporting the required HTML5 APIs.
+* **No browser plugins (e.g. Adobe Flash) required:**  
+  The implementation is based on open standards like HTML5 and JavaScript and requires no additional browser plugins.
+* **Graceful fallback for legacy browsers:**  
+  Uploads files via XMLHttpRequests if supported and uses iframes as fallback for legacy browsers.
+* **HTML file upload form fallback:**  
+  Shows a standard HTML file upload form if JavaScript is disabled.
+* **Cross-site file uploads:**  
+  Supports uploading files to a different domain with Cross-site XMLHttpRequests.
+* **Multiple plugin instances:**  
+  Allows to use multiple plugin instances on the same webpage.
+* **Customizable and extensible:**  
+  Provides an API to set individual options and define callBack methods for various upload events.
+* **Multipart and file contents stream uploads:**  
+  Files can be uploaded as standard "multipart/form-data" or file contents stream (HTTP PUT file upload).
+* **Compatible with any server-side application platform:**  
+  Works with Google App Engine (Python, Java), Ruby on Rails, PHP and any other platform that supports HTTP file uploads.
+
+## Requirements
+* [jQuery](http://jquery.com/) v. 1.6+
+* [jQuery UI](http://jqueryui.com/) v. 1.8+ (required: Widget, optional: Progressbar, Button)
+* jQuery Iframe Transport plugin (included)
+* [jQuery Templates plugin](http://api.jquery.com/category/plugins/templates/) v. 1.0+ (optional)
+
+The jQuery UI widget factory is a requirement for the basic File Upload plugin, but very lightweight without any other dependencies. 
+The UI version of the File Upload plugin also requires the jQuery UI Progressbar and Button components as well as the jQuery Templates plugin. These dependencies are marked as optional, as the basic File Upload plugin can be used without them and the UI version of the plugin can be extended to override these dependencies with alternative solutions.
+
+## Browser Support (tested versions)
+* Google Chrome - 7.0+
+* Apple Safari - 4.0+
+* Mozilla Firefox - 3.0+
+* Opera - 10.0+
+* Microsoft Internet Explorer 6.0+
+
+Drag & Drop is only supported on Google Chrome, Firefox 4.0+ and Safari 5.0+.  
+Microsoft Internet Explorer has no support for multiple file selection or upload progress.  
+[Extended browser support information](https://github.com/blueimp/jQuery-File-Upload/wiki/Browser-support).
+
+## License
+Released under the [MIT license](http://creativecommons.org/licenses/MIT/).
+
+## Source Code & Download
+* Browse and checkout the [source code](https://github.com/blueimp/jQuery-File-Upload).
+* [Download](https://github.com/blueimp/jQuery-File-Upload/archives/master) the project to add the plugin to your website.
+
+## Documentation & Support
+* Documentation can be found on the [Project Wiki](https://github.com/blueimp/jQuery-File-Upload/wiki).
+* Support requests and bug reports can be posted to the [Issue Tracker](https://github.com/blueimp/jQuery-File-Upload/issues).
Index: trunk/prototype/plugins/fileupload/jquery.fileupload.js
===================================================================
--- trunk/prototype/plugins/fileupload/jquery.fileupload.js	(revision 5341)
+++ trunk/prototype/plugins/fileupload/jquery.fileupload.js	(revision 5341)
@@ -0,0 +1,760 @@
+/*
+ * jQuery File Upload Plugin 5.2
+ * https://github.com/blueimp/jQuery-File-Upload
+ *
+ * Copyright 2010, Sebastian Tschan
+ * https://blueimp.net
+ *
+ * Licensed under the MIT license:
+ * http://creativecommons.org/licenses/MIT/
+ */
+
+/*jslint nomen: true, unparam: true, regexp: true */
+/*global document, XMLHttpRequestUpload, Blob, File, FormData, location, jQuery */
+
+(function ($) {
+    'use strict';
+
+    // The fileupload widget listens for change events on file input fields
+    // defined via fileInput setting and drop events of the given dropZone.
+    // In addition to the default jQuery Widget methods, the fileupload widget
+    // exposes the "add" and "send" methods, to add or directly send files
+    // using the fileupload API.
+    // By default, files added via file input selection, drag & drop or
+    // "add" method are uploaded immediately, but it is possible to override
+    // the "add" callback option to queue file uploads.
+    $.widget('blueimp.fileupload', {
+        
+        options: {
+            // The namespace used for event handler binding on the dropZone and
+            // fileInput collections.
+            // If not set, the name of the widget ("fileupload") is used.
+            namespace: undefined,
+            // The drop target collection, by the default the complete document.
+            // Set to null or an empty collection to disable drag & drop support:
+            dropZone: $(document),
+            // The file input field collection, that is listened for change events.
+            // If undefined, it is set to the file input fields inside
+            // of the widget element on plugin initialization.
+            // Set to null or an empty collection to disable the change listener.
+            fileInput: undefined,
+            // By default, the file input field is replaced with a clone after
+            // each input field change event. This is required for iframe transport
+            // queues and allows change events to be fired for the same file
+            // selection, but can be disabled by setting the following option to false:
+            replaceFileInput: true,
+            // The parameter name for the file form data (the request argument name).
+            // If undefined or empty, the name property of the file input field is
+            // used, or "files[]" if the file input name property is also empty:
+            paramName: undefined,
+            // By default, each file of a selection is uploaded using an individual
+            // request for XHR type uploads. Set to false to upload file
+            // selections in one request each:
+            singleFileUploads: true,
+            // To limit the number of files uploaded with one XHR request,
+            // set the following option to an integer greater than 0:
+            limitMultiFileUploads: undefined,
+            // Set the following option to true to issue all file upload requests
+            // in a sequential order:
+            sequentialUploads: false,
+            // To limit the number of concurrent uploads,
+            // set the following option to an integer greater than 0:
+            limitConcurrentUploads: undefined,
+            // Set the following option to true to force iframe transport uploads:
+            forceIframeTransport: false,
+            // By default, XHR file uploads are sent as multipart/form-data.
+            // The iframe transport is always using multipart/form-data.
+            // Set to false to enable non-multipart XHR uploads:
+            multipart: true,
+            // To upload large files in smaller chunks, set the following option
+            // to a preferred maximum chunk size. If set to 0, null or undefined,
+            // or the browser does not support the required Blob API, files will
+            // be uploaded as a whole.
+            maxChunkSize: undefined,
+            // When a non-multipart upload or a chunked multipart upload has been
+            // aborted, this option can be used to resume the upload by setting
+            // it to the size of the already uploaded bytes. This option is most
+            // useful when modifying the options object inside of the "add" or
+            // "send" callbacks, as the options are cloned for each file upload.
+            uploadedBytes: undefined,
+            // By default, failed (abort or error) file uploads are removed from the
+            // global progress calculation. Set the following option to false to
+            // prevent recalculating the global progress data:
+            recalculateProgress: true,
+            
+            // Additional form data to be sent along with the file uploads can be set
+            // using this option, which accepts an array of objects with name and
+            // value properties, a function returning such an array, a FormData
+            // object (for XHR file uploads), or a simple object.
+            // The form of the first fileInput is given as parameter to the function:
+            formData: function (form) {
+                return form.serializeArray();
+            },
+            
+            // The add callback is invoked as soon as files are added to the fileupload
+            // widget (via file input selection, drag & drop or add API call).
+            // If the singleFileUploads option is enabled, this callback will be
+            // called once for each file in the selection for XHR file uplaods, else
+            // once for each file selection.
+            // The upload starts when the submit method is invoked on the data parameter.
+            // The data object contains a files property holding the added files
+            // and allows to override plugin options as well as define ajax settings.
+            // Listeners for this callback can also be bound the following way:
+            // .bind('fileuploadadd', func);
+            // data.submit() returns a Promise object and allows to attach additional
+            // handlers using jQuery's Deferred callbacks:
+            // data.submit().done(func).fail(func).always(func);
+            add: function (e, data) {
+                data.submit();
+            },
+            
+            // Other callbacks:
+            // Callback for the start of each file upload request:
+            // send: function (e, data) {}, // .bind('fileuploadsend', func);
+            // Callback for successful uploads:
+            // done: function (e, data) {}, // .bind('fileuploaddone', func);
+            // Callback for failed (abort or error) uploads:
+            // fail: function (e, data) {}, // .bind('fileuploadfail', func);
+            // Callback for completed (success, abort or error) requests:
+            // always: function (e, data) {}, // .bind('fileuploadalways', func);
+            // Callback for upload progress events:
+            // progress: function (e, data) {}, // .bind('fileuploadprogress', func);
+            // Callback for global upload progress events:
+            // progressall: function (e, data) {}, // .bind('fileuploadprogressall', func);
+            // Callback for uploads start, equivalent to the global ajaxStart event:
+            // start: function (e) {}, // .bind('fileuploadstart', func);
+            // Callback for uploads stop, equivalent to the global ajaxStop event:
+            // stop: function (e) {}, // .bind('fileuploadstop', func);
+            // Callback for change events of the fileInput collection:
+            // change: function (e, data) {}, // .bind('fileuploadchange', func);
+            // Callback for drop events of the dropZone collection:
+            // drop: function (e, data) {}, // .bind('fileuploaddrop', func);
+            // Callback for dragover events of the dropZone collection:
+            // dragover: function (e) {}, // .bind('fileuploaddragover', func);
+            
+            // The plugin options are used as settings object for the ajax calls.
+            // The following are jQuery ajax settings required for the file uploads:
+            processData: false,
+            contentType: false,
+            cache: false
+        },
+        
+        // A list of options that require a refresh after assigning a new value:
+        _refreshOptionsList: ['namespace', 'dropZone', 'fileInput'],
+
+        _isXHRUpload: function (options) {
+            var undef = 'undefined';
+            return !options.forceIframeTransport &&
+                typeof XMLHttpRequestUpload !== undef && typeof File !== undef &&
+                (!options.multipart || typeof FormData !== undef);
+        },
+
+        _getFormData: function (options) {
+            var formData;
+            if (typeof options.formData === 'function') {
+                return options.formData(options.form);
+            } else if ($.isArray(options.formData)) {
+                return options.formData;
+            } else if (options.formData) {
+                formData = [];
+                $.each(options.formData, function (name, value) {
+                    formData.push({name: name, value: value});
+                });
+                return formData;
+            }
+            return [];
+        },
+
+        _getTotal: function (files) {
+            var total = 0;
+            $.each(files, function (index, file) {
+                total += file.size || 1;
+            });
+            return total;
+        },
+
+        _onProgress: function (e, data) {
+            if (e.lengthComputable) {
+                var total = data.total || this._getTotal(data.files),
+                    loaded = parseInt(
+                        e.loaded / e.total * (data.chunkSize || total),
+                        10
+                    ) + (data.uploadedBytes || 0);
+                this._loaded += loaded - (data.loaded || data.uploadedBytes || 0);
+                data.lengthComputable = true;
+                data.loaded = loaded;
+                data.total = total;
+                // Trigger a custom progress event with a total data property set
+                // to the file size(s) of the current upload and a loaded data
+                // property calculated accordingly:
+                this._trigger('progress', e, data);
+                // Trigger a global progress event for all current file uploads,
+                // including ajax calls queued for sequential file uploads:
+                this._trigger('progressall', e, {
+                    lengthComputable: true,
+                    loaded: this._loaded,
+                    total: this._total
+                });
+            }
+        },
+
+        _initProgressListener: function (options) {
+            var that = this,
+                xhr = options.xhr ? options.xhr() : $.ajaxSettings.xhr();
+            // Accesss to the native XHR object is required to add event listeners
+            // for the upload progress event:
+            if (xhr.upload && xhr.upload.addEventListener) {
+                xhr.upload.addEventListener('progress', function (e) {
+                    that._onProgress(e, options);
+                }, false);
+                options.xhr = function () {
+                    return xhr;
+                };
+            }
+        },
+
+        _initXHRData: function (options) {
+            var formData,
+                file = options.files[0];
+            if (!options.multipart || options.blob) {
+                // For non-multipart uploads and chunked uploads,
+                // file meta data is not part of the request body,
+                // so we transmit this data as part of the HTTP headers.
+                // For cross domain requests, these headers must be allowed
+                // via Access-Control-Allow-Headers or removed using
+                // the beforeSend callback:
+                options.headers = $.extend(options.headers, {
+                    'X-File-Name': file.name,
+                    'X-File-Type': file.type,
+                    'X-File-Size': file.size
+                });
+                if (!options.blob) {
+                    // Non-chunked non-multipart upload:
+                    options.contentType = file.type;
+                    options.data = file;
+                } else if (!options.multipart) {
+                    // Chunked non-multipart upload:
+                    options.contentType = 'application/octet-stream';
+                    options.data = options.blob;
+                }
+            }
+            if (options.multipart && typeof FormData !== 'undefined') {
+                if (options.formData instanceof FormData) {
+                    formData = options.formData;
+                } else {
+                    formData = new FormData();
+                    $.each(this._getFormData(options), function (index, field) {
+                        formData.append(field.name, field.value);
+                    });
+                }
+                if (options.blob) {
+                    formData.append(options.paramName, options.blob);
+                } else {
+                    $.each(options.files, function (index, file) {
+                        // File objects are also Blob instances.
+                        // This check allows the tests to run with
+                        // dummy objects:
+                        if (file instanceof Blob) {
+                            formData.append(options.paramName, file);
+                        }
+                    });
+                }
+                options.data = formData;
+            }
+            // Blob reference is not needed anymore, free memory:
+            options.blob = null;
+        },
+        
+        _initIframeSettings: function (options) {
+            // Setting the dataType to iframe enables the iframe transport:
+            options.dataType = 'iframe ' + (options.dataType || '');
+            // The iframe transport accepts a serialized array as form data:
+            options.formData = this._getFormData(options);
+        },
+        
+        _initDataSettings: function (options) {
+            if (this._isXHRUpload(options)) {
+                if (!this._chunkedUpload(options, true)) {
+                    if (!options.data) {
+                        this._initXHRData(options);
+                    }
+                    this._initProgressListener(options);
+                }
+            } else {
+                this._initIframeSettings(options);
+            }
+        },
+        
+        _initFormSettings: function (options) {
+            // Retrieve missing options from the input field and the
+            // associated form, if available:
+            if (!options.form || !options.form.length) {
+                options.form = $(options.fileInput.prop('form'));
+            }
+            if (!options.paramName) {
+                options.paramName = options.fileInput.prop('name') ||
+                    'files[]';
+            }
+            if (!options.url) {
+                options.url = options.form.prop('action') || location.href;
+            }
+            // The HTTP request method must be "POST" or "PUT":
+            options.type = (options.type || options.form.prop('method') || '')
+                .toUpperCase();
+            if (options.type !== 'POST' && options.type !== 'PUT') {
+                options.type = 'POST';
+            }
+        },
+        
+        _getAJAXSettings: function (data) {
+            var options = $.extend({}, this.options, data);
+            this._initFormSettings(options);
+            this._initDataSettings(options);
+            return options;
+        },
+
+        // Maps jqXHR callbacks to the equivalent
+        // methods of the given Promise object:
+        _enhancePromise: function (promise) {
+            promise.success = promise.done;
+            promise.error = promise.fail;
+            promise.complete = promise.always;
+            return promise;
+        },
+
+        // Creates and returns a Promise object enhanced with
+        // the jqXHR methods abort, success, error and complete:
+        _getXHRPromise: function (resolveOrReject, context, args) {
+            var dfd = $.Deferred(),
+                promise = dfd.promise();
+            context = context || this.options.context || promise;
+            if (resolveOrReject === true) {
+                dfd.resolveWith(context, args);
+            } else if (resolveOrReject === false) {
+                dfd.rejectWith(context, args);
+            }
+            promise.abort = dfd.promise;
+            return this._enhancePromise(promise);
+        },
+
+        // Uploads a file in multiple, sequential requests
+        // by splitting the file up in multiple blob chunks.
+        // If the second parameter is true, only tests if the file
+        // should be uploaded in chunks, but does not invoke any
+        // upload requests:
+        _chunkedUpload: function (options, testOnly) {
+            var that = this,
+                file = options.files[0],
+                fs = file.size,
+                ub = options.uploadedBytes = options.uploadedBytes || 0,
+                mcs = options.maxChunkSize || fs,
+                // Use the Blob methods with the slice implementation
+                // according to the W3C Blob API specification:
+                slice = file.webkitSlice || file.mozSlice || file.slice,
+                upload,
+                n,
+                jqXHR,
+                pipe;
+            if (!(this._isXHRUpload(options) && slice && (ub || mcs < fs)) ||
+                    options.data) {
+                return false;
+            }
+            if (testOnly) {
+                return true;
+            }
+            if (ub >= fs) {
+                file.error = 'uploadedBytes';
+                return this._getXHRPromise(false);
+            }
+            // n is the number of blobs to upload,
+            // calculated via filesize, uploaded bytes and max chunk size:
+            n = Math.ceil((fs - ub) / mcs);
+            // The chunk upload method accepting the chunk number as parameter:
+            upload = function (i) {
+                if (!i) {
+                    return that._getXHRPromise(true);
+                }
+                // Upload the blobs in sequential order:
+                return upload(i -= 1).pipe(function () {
+                    // Clone the options object for each chunk upload:
+                    var o = $.extend({}, options);
+                    o.blob = slice.call(
+                        file,
+                        ub + i * mcs,
+                        ub + (i + 1) * mcs
+                    );
+                    // Store the current chunk size, as the blob itself
+                    // will be dereferenced after data processing:
+                    o.chunkSize = o.blob.size;
+                    // Process the upload data (the blob and potential form data):
+                    that._initXHRData(o);
+                    // Add progress listeners for this chunk upload:
+                    that._initProgressListener(o);
+                    jqXHR = ($.ajax(o) || that._getXHRPromise(false, o.context))
+                        .done(function () {
+                            // Create a progress event if upload is done and
+                            // no progress event has been invoked for this chunk:
+                            if (!o.loaded) {
+                                that._onProgress($.Event('progress', {
+                                    lengthComputable: true,
+                                    loaded: o.chunkSize,
+                                    total: o.chunkSize
+                                }), o);
+                            }
+                            options.uploadedBytes = o.uploadedBytes
+                                += o.chunkSize;
+                        });
+                    return jqXHR;
+                });
+            };
+            // Return the piped Promise object, enhanced with an abort method,
+            // which is delegated to the jqXHR object of the current upload,
+            // and jqXHR callbacks mapped to the equivalent Promise methods:
+            pipe = upload(n);
+            pipe.abort = function () {
+                return jqXHR.abort();
+            };
+            return this._enhancePromise(pipe);
+        },
+
+        _beforeSend: function (e, data) {
+            if (this._active === 0) {
+                // the start callback is triggered when an upload starts
+                // and no other uploads are currently running,
+                // equivalent to the global ajaxStart event:
+                this._trigger('start');
+            }
+            this._active += 1;
+            // Initialize the global progress values:
+            this._loaded += data.uploadedBytes || 0;
+            this._total += this._getTotal(data.files);
+        },
+
+        _onDone: function (result, textStatus, jqXHR, options) {
+            if (!this._isXHRUpload(options)) {
+                // Create a progress event for each iframe load:
+                this._onProgress($.Event('progress', {
+                    lengthComputable: true,
+                    loaded: 1,
+                    total: 1
+                }), options);
+            }
+            options.result = result;
+            options.textStatus = textStatus;
+            options.jqXHR = jqXHR;
+            this._trigger('done', null, options);
+        },
+
+        _onFail: function (jqXHR, textStatus, errorThrown, options) {
+            options.jqXHR = jqXHR;
+            options.textStatus = textStatus;
+            options.errorThrown = errorThrown;
+            this._trigger('fail', null, options);
+            if (options.recalculateProgress) {
+                // Remove the failed (error or abort) file upload from
+                // the global progress calculation:
+                this._loaded -= options.loaded || options.uploadedBytes || 0;
+                this._total -= options.total || this._getTotal(options.files);
+            }
+        },
+
+        _onAlways: function (result, textStatus, jqXHR, errorThrown, options) {
+            this._active -= 1;
+            options.result = result;
+            options.textStatus = textStatus;
+            options.jqXHR = jqXHR;
+            options.errorThrown = errorThrown;
+            this._trigger('always', null, options);
+            if (this._active === 0) {
+                // The stop callback is triggered when all uploads have
+                // been completed, equivalent to the global ajaxStop event:
+                this._trigger('stop');
+                // Reset the global progress values:
+                this._loaded = this._total = 0;
+            }
+        },
+
+        _onSend: function (e, data) {
+            var that = this,
+                jqXHR,
+                slot,
+                pipe,
+                options = that._getAJAXSettings(data),
+                send = function (resolve, args) {
+                    that._sending += 1;
+                    jqXHR = jqXHR || (
+                        (resolve !== false &&
+                        that._trigger('send', e, options) !== false &&
+                        (that._chunkedUpload(options) || $.ajax(options))) ||
+                        that._getXHRPromise(false, options.context, args)
+                    ).done(function (result, textStatus, jqXHR) {
+                        that._onDone(result, textStatus, jqXHR, options);
+                    }).fail(function (jqXHR, textStatus, errorThrown) {
+                        that._onFail(jqXHR, textStatus, errorThrown, options);
+                    }).always(function (a1, a2, a3) {
+                        that._sending -= 1;
+                        if (a3 && a3.done) {
+                            that._onAlways(a1, a2, a3, undefined, options);
+                        } else {
+                            that._onAlways(undefined, a2, a1, a3, options);
+                        }
+                        if (options.limitConcurrentUploads &&
+                                options.limitConcurrentUploads > that._sending) {
+                            // Start the next queued upload,
+                            // that has not been aborted:
+                            var nextSlot = that._slots.shift();
+                            while (nextSlot) {
+                                if (!nextSlot.isRejected()) {
+                                    nextSlot.resolve();
+                                    break;
+                                }
+                                nextSlot = that._slots.shift();
+                            }
+                        }
+                    });
+                    return jqXHR;
+                };
+            this._beforeSend(e, options);
+            if (this.options.sequentialUploads ||
+                    (this.options.limitConcurrentUploads &&
+                    this.options.limitConcurrentUploads <= this._sending)) {
+                if (this.options.limitConcurrentUploads > 1) {
+                    slot = $.Deferred();
+                    this._slots.push(slot);
+                    pipe = slot.pipe(send);
+                } else {
+                    pipe = (this._sequence = this._sequence.pipe(send, send));
+                }
+                // Return the piped Promise object, enhanced with an abort method,
+                // which is delegated to the jqXHR object of the current upload,
+                // and jqXHR callbacks mapped to the equivalent Promise methods:
+                pipe.abort = function () {
+                    var args = [undefined, 'abort', 'abort'];
+                    if (!jqXHR) {
+                        if (slot) {
+                            slot.rejectWith(args);
+                        }
+                        return send(false, args);
+                    }
+                    return jqXHR.abort();
+                };
+                return this._enhancePromise(pipe);
+            }
+            return send();
+        },
+        
+        _onAdd: function (e, data) {
+            var that = this,
+                result = true,
+                options = $.extend({}, this.options, data),
+                fileSet = data.files,
+                limit = options.limitMultiFileUploads,
+                i;
+            if (!(options.singleFileUploads || limit) ||
+                    !this._isXHRUpload(options)) {
+                fileSet = [fileSet];
+            } else if (!options.singleFileUploads && limit) {
+                fileSet = [];
+                for (i = 0; i < data.files.length; i += limit) {
+                    fileSet.push(data.files.slice(i, i + limit));
+                }
+            }
+            $.each(fileSet, function (index, file) {
+                var files = $.isArray(file) ? file : [file],
+                    newData = $.extend({}, data, {files: files});
+                newData.submit = function () {
+                    return that._onSend(e, newData);
+                };
+                return (result = that._trigger('add', e, newData));
+            });
+            return result;
+        },
+        
+        // File Normalization for Gecko 1.9.1 (Firefox 3.5) support:
+        _normalizeFile: function (index, file) {
+            if (file.name === undefined && file.size === undefined) {
+                file.name = file.fileName;
+                file.size = file.fileSize;
+            }
+        },
+
+        _replaceFileInput: function (input) {
+            var inputClone = input.clone(true);
+            $('<form></form>').append(inputClone)[0].reset();
+            // Detaching allows to insert the fileInput on another form
+            // without loosing the file input value:
+            input.after(inputClone).detach();
+            // Replace the original file input element in the fileInput
+            // collection with the clone, which has been copied including
+            // event handlers:
+            this.options.fileInput = this.options.fileInput.map(function (i, el) {
+                if (el === input[0]) {
+                    return inputClone[0];
+                }
+                return el;
+            });
+        },
+        
+        _onChange: function (e) {
+            var that = e.data.fileupload,
+                data = {
+                    files: $.each($.makeArray(e.target.files), that._normalizeFile),
+                    fileInput: $(e.target),
+                    form: $(e.target.form)
+                };
+            if (!data.files.length) {
+                // If the files property is not available, the browser does not
+                // support the File API and we add a pseudo File object with
+                // the input value as name with path information removed:
+                data.files = [{name: e.target.value.replace(/^.*\\/, '')}];
+            }
+            // Store the form reference as jQuery data for other event handlers,
+            // as the form property is not available after replacing the file input: 
+            if (data.form.length) {
+                data.fileInput.data('blueimp.fileupload.form', data.form);
+            } else {
+                data.form = data.fileInput.data('blueimp.fileupload.form');
+            }
+            if (that.options.replaceFileInput) {
+                that._replaceFileInput(data.fileInput);
+            }
+            if (that._trigger('change', e, data) === false ||
+                    that._onAdd(e, data) === false) {
+                return false;
+            }
+        },
+        
+        _onDrop: function (e) {
+            var that = e.data.fileupload,
+                dataTransfer = e.dataTransfer = e.originalEvent.dataTransfer,
+                data = {
+                    files: $.each(
+                        $.makeArray(dataTransfer && dataTransfer.files),
+                        that._normalizeFile
+                    )
+                };
+            if (that._trigger('drop', e, data) === false ||
+                    that._onAdd(e, data) === false) {
+                return false;
+            }
+            e.preventDefault();
+        },
+        
+        _onDragOver: function (e) {
+            var that = e.data.fileupload,
+                dataTransfer = e.dataTransfer = e.originalEvent.dataTransfer;
+            if (that._trigger('dragover', e) === false) {
+                return false;
+            }
+            if (dataTransfer) {
+                dataTransfer.dropEffect = dataTransfer.effectAllowed = 'copy';
+            }
+            e.preventDefault();
+        },
+        
+        _initEventHandlers: function () {
+            var ns = this.options.namespace || this.name;
+            this.options.dropZone
+                .bind('dragover.' + ns, {fileupload: this}, this._onDragOver)
+                .bind('drop.' + ns, {fileupload: this}, this._onDrop);
+            this.options.fileInput
+                .bind('change.' + ns, {fileupload: this}, this._onChange);
+        },
+
+        _destroyEventHandlers: function () {
+            var ns = this.options.namespace || this.name;
+            this.options.dropZone
+                .unbind('dragover.' + ns, this._onDragOver)
+                .unbind('drop.' + ns, this._onDrop);
+            this.options.fileInput
+                .unbind('change.' + ns, this._onChange);
+        },
+        
+        _beforeSetOption: function (key, value) {
+            this._destroyEventHandlers();
+        },
+        
+        _afterSetOption: function (key, value) {
+            var options = this.options;
+            if (!options.fileInput) {
+                options.fileInput = $();
+            }
+            if (!options.dropZone) {
+                options.dropZone = $();
+            }
+            this._initEventHandlers();
+        },
+        
+        _setOption: function (key, value) {
+            var refresh = $.inArray(key, this._refreshOptionsList) !== -1;
+            if (refresh) {
+                this._beforeSetOption(key, value);
+            }
+            $.Widget.prototype._setOption.call(this, key, value);
+            if (refresh) {
+                this._afterSetOption(key, value);
+            }
+        },
+
+        _create: function () {
+            var options = this.options;
+            if (options.fileInput === undefined) {
+                options.fileInput = this.element.is('input:file') ?
+                    this.element : this.element.find('input:file');
+            } else if (!options.fileInput) {
+                options.fileInput = $();
+            }
+            if (!options.dropZone) {
+                options.dropZone = $();
+            }
+            this._slots = [];
+            this._sequence = this._getXHRPromise(true);
+            this._sending = this._active = this._loaded = this._total = 0;
+            this._initEventHandlers();
+        },
+        
+        destroy: function () {
+            this._destroyEventHandlers();
+            $.Widget.prototype.destroy.call(this);
+        },
+
+        enable: function () {
+            $.Widget.prototype.enable.call(this);
+            this._initEventHandlers();
+        },
+        
+        disable: function () {
+            this._destroyEventHandlers();
+            $.Widget.prototype.disable.call(this);
+        },
+
+        // This method is exposed to the widget API and allows adding files
+        // using the fileupload API. The data parameter accepts an object which
+        // must have a files property and can contain additional options:
+        // .fileupload('add', {files: filesList});
+        add: function (data) {
+            if (!data || this.options.disabled) {
+                return;
+            }
+            data.files = $.each($.makeArray(data.files), this._normalizeFile);
+            this._onAdd(null, data);
+        },
+        
+        // This method is exposed to the widget API and allows sending files
+        // using the fileupload API. The data parameter accepts an object which
+        // must have a files property and can contain additional options:
+        // .fileupload('send', {files: filesList});
+        // The method returns a Promise object for the file upload call.
+        send: function (data) {
+            if (data && !this.options.disabled) {
+                data.files = $.each($.makeArray(data.files), this._normalizeFile);
+                if (data.files.length) {
+                    return this._onSend(null, data);
+                }
+            }
+            return this._getXHRPromise(false, data && data.context);
+        }
+        
+    });
+    
+}(jQuery));
Index: trunk/prototype/plugins/dateFormat/dateFormat.js
===================================================================
--- trunk/prototype/plugins/dateFormat/dateFormat.js	(revision 5341)
+++ trunk/prototype/plugins/dateFormat/dateFormat.js	(revision 5341)
@@ -0,0 +1,126 @@
+/*
+ * Date Format 1.2.3
+ * (c) 2007-2009 Steven Levithan <stevenlevithan.com>
+ * MIT license
+ *
+ * Includes enhancements by Scott Trenda <scott.trenda.net>
+ * and Kris Kowal <cixar.com/~kris.kowal/>
+ *
+ * Accepts a date, a mask, or a date and a mask.
+ * Returns a formatted version of the given date.
+ * The date defaults to the current date/time.
+ * The mask defaults to dateFormat.masks.default.
+ */
+
+var dateFormat = function () {
+	var	token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,
+		timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,
+		timezoneClip = /[^-+\dA-Z]/g,
+		pad = function (val, len) {
+			val = String(val);
+			len = len || 2;
+			while (val.length < len) val = "0" + val;
+			return val;
+		};
+
+	// Regexes and supporting functions are cached through closure
+	return function (date, mask, utc) {
+		var dF = dateFormat;
+
+		// You can't provide utc if you skip other args (use the "UTC:" mask prefix)
+		if (arguments.length == 1 && Object.prototype.toString.call(date) == "[object String]" && !/\d/.test(date)) {
+			mask = date;
+			date = undefined;
+		}
+
+		// Passing date through Date applies Date.parse, if necessary
+		date = date ? new Date(date) : new Date;
+		if (isNaN(date)) throw SyntaxError("invalid date");
+
+		mask = String(dF.masks[mask] || mask || dF.masks["default"]);
+
+		// Allow setting the utc argument via the mask
+		if (mask.slice(0, 4) == "UTC:") {
+			mask = mask.slice(4);
+			utc = true;
+		}
+
+		var	_ = utc ? "getUTC" : "get",
+			d = date[_ + "Date"](),
+			D = date[_ + "Day"](),
+			m = date[_ + "Month"](),
+			y = date[_ + "FullYear"](),
+			H = date[_ + "Hours"](),
+			M = date[_ + "Minutes"](),
+			s = date[_ + "Seconds"](),
+			L = date[_ + "Milliseconds"](),
+			o = utc ? 0 : date.getTimezoneOffset(),
+			flags = {
+				d:    d,
+				dd:   pad(d),
+				ddd:  dF.i18n.dayNames[D],
+				dddd: dF.i18n.dayNames[D + 7],
+				m:    m + 1,
+				mm:   pad(m + 1),
+				mmm:  dF.i18n.monthNames[m],
+				mmmm: dF.i18n.monthNames[m + 12],
+				yy:   String(y).slice(2),
+				yyyy: y,
+				h:    H % 12 || 12,
+				hh:   pad(H % 12 || 12),
+				H:    H,
+				HH:   pad(H),
+				M:    M,
+				MM:   pad(M),
+				s:    s,
+				ss:   pad(s),
+				l:    pad(L, 3),
+				L:    pad(L > 99 ? Math.round(L / 10) : L),
+				t:    H < 12 ? "a"  : "p",
+				tt:   H < 12 ? "am" : "pm",
+				T:    H < 12 ? "A"  : "P",
+				TT:   H < 12 ? "AM" : "PM",
+				Z:    utc ? "UTC" : (String(date).match(timezone) || [""]).pop().replace(timezoneClip, ""),
+				o:    (o > 0 ? "-" : "+") + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4),
+				S:    ["th", "st", "nd", "rd"][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10]
+			};
+
+		return mask.replace(token, function ($0) {
+			return $0 in flags ? flags[$0] : $0.slice(1, $0.length - 1);
+		});
+	};
+}();
+
+// Some common format strings
+dateFormat.masks = {
+	"default":      "ddd mmm dd yyyy HH:MM:ss",
+	shortDate:      "m/d/yy",
+	mediumDate:     "mmm d, yyyy",
+	longDate:       "mmmm d, yyyy",
+	fullDate:       "dddd, mmmm d, yyyy",
+	shortTime:      "h:MM TT",
+	mediumTime:     "h:MM:ss TT",
+	longTime:       "h:MM:ss TT Z",
+	isoDate:        "yyyy-mm-dd",
+	isoTime:        "HH:MM:ss",
+	isoDateTime:    "yyyy-mm-dd'T'HH:MM:ss",
+	isoUtcDateTime: "UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"
+};
+
+// Internationalization strings
+dateFormat.i18n = {
+	dayNames: [
+		"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat",
+		"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
+	],
+	monthNames: [
+		"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
+		"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
+	]
+};
+
+// For convenience...
+Date.prototype.format = function (mask, utc) {
+	return dateFormat(this, mask, utc);
+};
+
Index: trunk/prototype/plugins/jpicker/jpicker-1.1.6.js
===================================================================
--- trunk/prototype/plugins/jpicker/jpicker-1.1.6.js	(revision 5341)
+++ trunk/prototype/plugins/jpicker/jpicker-1.1.6.js	(revision 5341)
@@ -0,0 +1,2086 @@
+﻿/*
+ * jPicker 1.1.6
+ *
+ * jQuery Plugin for Photoshop style color picker
+ *
+ * Copyright (c) 2010 Christopher T. Tillman
+ * Digital Magic Productions, Inc. (http://www.digitalmagicpro.com/)
+ * MIT style license, FREE to use, alter, copy, sell, and especially ENHANCE
+ *
+ * Painstakingly ported from John Dyers' excellent work on his own color picker based on the Prototype framework.
+ *
+ * John Dyers' website: (http://johndyer.name)
+ * Color Picker page:   (http://johndyer.name/post/2007/09/PhotoShop-like-JavaScript-Color-Picker.aspx)
+ *
+ */
+(function($, version)
+{
+  Math.precision = function(value, precision)
+    {
+      if (precision === undefined) precision = 0;
+      return Math.round(value * Math.pow(10, precision)) / Math.pow(10, precision);
+    };
+  var Slider = // encapsulate slider functionality for the ColorMap and ColorBar - could be useful to use a jQuery UI draggable for this with certain extensions
+      function(bar, options)
+      {
+        var $this = this, // private properties, methods, and events - keep these variables and classes invisible to outside code
+          arrow = bar.find('img:first'), // the arrow image to drag
+          minX = 0,
+          maxX = 100,
+          rangeX = 100,
+          minY = 0,
+          maxY = 100,
+          rangeY = 100,
+          x = 0,
+          y = 0,
+          offset,
+          timeout,
+          changeEvents = new Array(),
+          fireChangeEvents =
+            function(context)
+            {
+              for (var i = 0; i < changeEvents.length; i++) changeEvents[i].call($this, $this, context);
+            },
+          mouseDown = // bind the mousedown to the bar not the arrow for quick snapping to the clicked location
+            function(e)
+            {
+              var off = bar.offset();
+              offset = { l: off.left | 0, t: off.top | 0 };
+              clearTimeout(timeout);
+              timeout = setTimeout( // using setTimeout for visual updates - once the style is updated the browser will re-render internally allowing the next Javascript to run
+                function()
+                {
+                  setValuesFromMousePosition.call($this, e);
+                }, 0);
+              // Bind mousemove and mouseup event to the document so it responds when dragged of of the bar - we will unbind these when on mouseup to save processing
+              $(document).bind('mousemove', mouseMove).bind('mouseup', mouseUp);
+              e.preventDefault(); // don't try to select anything or drag the image to the desktop
+            },
+          mouseMove = // set the values as the mouse moves
+            function(e)
+            {
+              clearTimeout(timeout);
+              timeout = setTimeout(
+                function()
+                {
+                  setValuesFromMousePosition.call($this, e);
+                }, 0);
+              e.stopPropagation();
+              e.preventDefault();
+              return false;
+            },
+          mouseUp = // unbind the document events - they aren't needed when not dragging
+            function(e)
+            {
+              $(document).unbind('mouseup', mouseUp).unbind('mousemove', mouseMove);
+              e.stopPropagation();
+              e.preventDefault();
+              return false;
+            },
+          setValuesFromMousePosition = // calculate mouse position and set value within the current range
+            function(e)
+            {
+              var locX = e.pageX - offset.l,
+                  locY = e.pageY - offset.t,
+                  barW = bar.w, // local copies for YUI compressor
+                  barH = bar.h;
+              // keep the arrow within the bounds of the bar
+              if (locX < 0) locX = 0;
+              else if (locX > barW) locX = barW;
+              if (locY < 0) locY = 0;
+              else if (locY > barH) locY = barH;
+              val.call($this, 'xy', { x: ((locX / barW) * rangeX) + minX, y: ((locY / barH) * rangeY) + minY });
+            },
+          draw =
+            function()
+            {
+              var arrowOffsetX = 0,
+                arrowOffsetY = 0,
+                barW = bar.w,
+                barH = bar.h,
+                arrowW = arrow.w,
+                arrowH = arrow.h;
+              setTimeout(
+                function()
+                {
+                  if (rangeX > 0) // range is greater than zero
+                  {
+                    // constrain to bounds
+                    if (x == maxX) arrowOffsetX = barW;
+                    else arrowOffsetX = ((x / rangeX) * barW) | 0;
+                  }
+                  if (rangeY > 0) // range is greater than zero
+                  {
+                    // constrain to bounds
+                    if (y == maxY) arrowOffsetY = barH;
+                    else arrowOffsetY = ((y / rangeY) * barH) | 0;
+                  }
+                  // if arrow width is greater than bar width, center arrow and prevent horizontal dragging
+                  if (arrowW >= barW) arrowOffsetX = (barW >> 1) - (arrowW >> 1); // number >> 1 - superfast bitwise divide by two and truncate (move bits over one bit discarding lowest)
+                  else arrowOffsetX -= arrowW >> 1;
+                  // if arrow height is greater than bar height, center arrow and prevent vertical dragging
+                  if (arrowH >= barH) arrowOffsetY = (barH >> 1) - (arrowH >> 1);
+                  else arrowOffsetY -= arrowH >> 1;
+                  // set the arrow position based on these offsets
+                  arrow.css({ left: arrowOffsetX + 'px', top: arrowOffsetY + 'px' });
+                }, 0);
+            },
+          val =
+            function(name, value, context)
+            {
+              var set = value !== undefined;
+              if (!set)
+              {
+                if (name === undefined || name == null) name = 'xy';
+                switch (name.toLowerCase())
+                {
+                  case 'x': return x;
+                  case 'y': return y;
+                  case 'xy':
+                  default: return { x: x, y: y };
+                }
+              }
+              if (context != null && context == $this) return;
+              var changed = false,
+                  newX,
+                  newY;
+              if (name == null) name = 'xy';
+              switch (name.toLowerCase())
+              {
+                case 'x':
+                  newX = value && (value.x && value.x | 0 || value | 0) || 0;
+                  break;
+                case 'y':
+                  newY = value && (value.y && value.y | 0 || value | 0) || 0;
+                  break;
+                case 'xy':
+                default:
+                  newX = value && value.x && value.x | 0 || 0;
+                  newY = value && value.y && value.y | 0 || 0;
+                  break;
+              }
+              if (newX != null)
+              {
+                if (newX < minX) newX = minX;
+                else if (newX > maxX) newX = maxX;
+                if (x != newX)
+                {
+                  x = newX;
+                  changed = true;
+                }
+              }
+              if (newY != null)
+              {
+                if (newY < minY) newY = minY;
+                else if (newY > maxY) newY = maxY;
+                if (y != newY)
+                {
+                  y = newY;
+                  changed = true;
+                }
+              }
+              changed && fireChangeEvents.call($this, context || $this);
+            },
+          range =
+            function (name, value)
+            {
+              var set = value !== undefined;
+              if (!set)
+              {
+                if (name === undefined || name == null) name = 'all';
+                switch (name.toLowerCase())
+                {
+                  case 'minx': return minX;
+                  case 'maxx': return maxX;
+                  case 'rangex': return { minX: minX, maxX: maxX, rangeX: rangeX };
+                  case 'miny': return minY;
+                  case 'maxy': return maxY;
+                  case 'rangey': return { minY: minY, maxY: maxY, rangeY: rangeY };
+                  case 'all':
+                  default: return { minX: minX, maxX: maxX, rangeX: rangeX, minY: minY, maxY: maxY, rangeY: rangeY };
+                }
+              }
+              var changed = false,
+                  newMinX,
+                  newMaxX,
+                  newMinY,
+                  newMaxY;
+              if (name == null) name = 'all';
+              switch (name.toLowerCase())
+              {
+                case 'minx':
+                  newMinX = value && (value.minX && value.minX | 0 || value | 0) || 0;
+                  break;
+                case 'maxx':
+                  newMaxX = value && (value.maxX && value.maxX | 0 || value | 0) || 0;
+                  break;
+                case 'rangex':
+                  newMinX = value && value.minX && value.minX | 0 || 0;
+                  newMaxX = value && value.maxX && value.maxX | 0 || 0;
+                  break;
+                case 'miny':
+                  newMinY = value && (value.minY && value.minY | 0 || value | 0) || 0;
+                  break;
+                case 'maxy':
+                  newMaxY = value && (value.maxY && value.maxY | 0 || value | 0) || 0;
+                  break;
+                case 'rangey':
+                  newMinY = value && value.minY && value.minY | 0 || 0;
+                  newMaxY = value && value.maxY && value.maxY | 0 || 0;
+                  break;
+                case 'all':
+                default:
+                  newMinX = value && value.minX && value.minX | 0 || 0;
+                  newMaxX = value && value.maxX && value.maxX | 0 || 0;
+                  newMinY = value && value.minY && value.minY | 0 || 0;
+                  newMaxY = value && value.maxY && value.maxY | 0 || 0;
+                  break;
+              }
+              if (newMinX != null && minX != newMinX)
+              {
+                minX = newMinX;
+                rangeX = maxX - minX;
+              }
+              if (newMaxX != null && maxX != newMaxX)
+              {
+                maxX = newMaxX;
+                rangeX = maxX - minX;
+              }
+              if (newMinY != null && minY != newMinY)
+              {
+                minY = newMinY;
+                rangeY = maxY - minY;
+              }
+              if (newMaxY != null && maxY != newMaxY)
+              {
+                maxY = newMaxY;
+                rangeY = maxY - minY;
+              }
+            },
+          bind =
+            function (callback)
+            {
+              if ($.isFunction(callback)) changeEvents.push(callback);
+            },
+          unbind =
+            function (callback)
+            {
+              if (!$.isFunction(callback)) return;
+              var i;
+              while ((i = $.inArray(callback, changeEvents)) != -1) changeEvents.splice(i, 1);
+            },
+          destroy =
+            function()
+            {
+              // unbind all possible events and null objects
+              $(document).unbind('mouseup', mouseUp).unbind('mousemove', mouseMove);
+              bar.unbind('mousedown', mouseDown);
+              bar = null;
+              arrow = null;
+              changeEvents = null;
+            };
+        $.extend(true, $this, // public properties, methods, and event bindings - these we need to access from other controls
+          {
+            val: val,
+            range: range,
+            bind: bind,
+            unbind: unbind,
+            destroy: destroy
+          });
+        // initialize this control
+        arrow.src = options.arrow && options.arrow.image;
+        arrow.w = options.arrow && options.arrow.width || arrow.width();
+        arrow.h = options.arrow && options.arrow.height || arrow.height();
+        bar.w = options.map && options.map.width || bar.width();
+        bar.h = options.map && options.map.height || bar.height();
+        // bind mousedown event
+        bar.bind('mousedown', mouseDown);
+        bind.call($this, draw);
+      },
+    ColorValuePicker = // controls for all the input elements for the typing in color values
+      function(picker, color, bindedHex, alphaPrecision)
+      {
+        var $this = this, // private properties and methods
+          inputs = picker.find('td.Text input'),
+          red = inputs.eq(3),
+          green = inputs.eq(4),
+          blue = inputs.eq(5),
+          alpha = inputs.length > 7 ? inputs.eq(6) : null,
+          hue = inputs.eq(0),
+          saturation = inputs.eq(1),
+          value = inputs.eq(2),
+          hex = inputs.eq(inputs.length > 7 ? 7 : 6),
+          ahex = inputs.length > 7 ? inputs.eq(8) : null,
+          keyDown = // input box key down - use arrows to alter color
+            function(e)
+            {
+              if (e.target.value == '' && e.target != hex.get(0) && (bindedHex != null && e.target != bindedHex.get(0) || bindedHex == null)) return;
+              if (!validateKey(e)) return e;
+              switch (e.target)
+              {
+                case red.get(0):
+                  switch (e.keyCode)
+                  {
+                    case 38:
+                      red.val(setValueInRange.call($this, (red.val() << 0) + 1, 0, 255));
+                      color.val('r', red.val(), e.target);
+                      return false;
+                    case 40:
+                      red.val(setValueInRange.call($this, (red.val() << 0) - 1, 0, 255));
+                      color.val('r', red.val(), e.target);
+                      return false;
+                  }
+                  break;
+                case green.get(0):
+                  switch (e.keyCode)
+                  {
+                    case 38:
+                      green.val(setValueInRange.call($this, (green.val() << 0) + 1, 0, 255));
+                      color.val('g', green.val(), e.target);
+                      return false;
+                    case 40:
+                      green.val(setValueInRange.call($this, (green.val() << 0) - 1, 0, 255));
+                      color.val('g', green.val(), e.target);
+                      return false;
+                  }
+                  break;
+                case blue.get(0):
+                  switch (e.keyCode)
+                  {
+                    case 38:
+                      blue.val(setValueInRange.call($this, (blue.val() << 0) + 1, 0, 255));
+                      color.val('b', blue.val(), e.target);
+                      return false;
+                    case 40:
+                      blue.val(setValueInRange.call($this, (blue.val() << 0) - 1, 0, 255));
+                      color.val('b', blue.val(), e.target);
+                      return false;
+                  }
+                  break;
+                case alpha && alpha.get(0):
+                  switch (e.keyCode)
+                  {
+                    case 38:
+                      alpha.val(setValueInRange.call($this, parseFloat(alpha.val()) + 1, 0, 100));
+                      color.val('a', Math.precision((alpha.val() * 255) / 100, alphaPrecision), e.target);
+                      return false;
+                    case 40:
+                      alpha.val(setValueInRange.call($this, parseFloat(alpha.val()) - 1, 0, 100));
+                      color.val('a', Math.precision((alpha.val() * 255) / 100, alphaPrecision), e.target);
+                      return false;
+                  }
+                  break;
+                case hue.get(0):
+                  switch (e.keyCode)
+                  {
+                    case 38:
+                      hue.val(setValueInRange.call($this, (hue.val() << 0) + 1, 0, 360));
+                      color.val('h', hue.val(), e.target);
+                      return false;
+                    case 40:
+                      hue.val(setValueInRange.call($this, (hue.val() << 0) - 1, 0, 360));
+                      color.val('h', hue.val(), e.target);
+                      return false;
+                  }
+                  break;
+                case saturation.get(0):
+                  switch (e.keyCode)
+                  {
+                    case 38:
+                      saturation.val(setValueInRange.call($this, (saturation.val() << 0) + 1, 0, 100));
+                      color.val('s', saturation.val(), e.target);
+                      return false;
+                    case 40:
+                      saturation.val(setValueInRange.call($this, (saturation.val() << 0) - 1, 0, 100));
+                      color.val('s', saturation.val(), e.target);
+                      return false;
+                  }
+                  break;
+                case value.get(0):
+                  switch (e.keyCode)
+                  {
+                    case 38:
+                      value.val(setValueInRange.call($this, (value.val() << 0) + 1, 0, 100));
+                      color.val('v', value.val(), e.target);
+                      return false;
+                    case 40:
+                      value.val(setValueInRange.call($this, (value.val() << 0) - 1, 0, 100));
+                      color.val('v', value.val(), e.target);
+                      return false;
+                  }
+                  break;
+              }
+            },
+          keyUp = // input box key up - validate value and set color
+            function(e)
+            {
+              if (e.target.value == '' && e.target != hex.get(0) && (bindedHex != null && e.target != bindedHex.get(0) || bindedHex == null)) return;
+              if (!validateKey(e)) return e;
+              switch (e.target)
+              {
+                case red.get(0):
+                  red.val(setValueInRange.call($this, red.val(), 0, 255));
+                  color.val('r', red.val(), e.target);
+                  break;
+                case green.get(0):
+                  green.val(setValueInRange.call($this, green.val(), 0, 255));
+                  color.val('g', green.val(), e.target);
+                  break;
+                case blue.get(0):
+                  blue.val(setValueInRange.call($this, blue.val(), 0, 255));
+                  color.val('b', blue.val(), e.target);
+                  break;
+                case alpha && alpha.get(0):
+                  alpha.val(setValueInRange.call($this, alpha.val(), 0, 100));
+                  color.val('a', Math.precision((alpha.val() * 255) / 100, alphaPrecision), e.target);
+                  break;
+                case hue.get(0):
+                  hue.val(setValueInRange.call($this, hue.val(), 0, 360));
+                  color.val('h', hue.val(), e.target);
+                  break;
+                case saturation.get(0):
+                  saturation.val(setValueInRange.call($this, saturation.val(), 0, 100));
+                  color.val('s', saturation.val(), e.target);
+                  break;
+                case value.get(0):
+                  value.val(setValueInRange.call($this, value.val(), 0, 100));
+                  color.val('v', value.val(), e.target);
+                  break;
+                case hex.get(0):
+                  hex.val(hex.val().replace(/[^a-fA-F0-9]/g, '').toLowerCase().substring(0, 6));
+                  bindedHex && bindedHex.val(hex.val());
+                  color.val('hex', hex.val() != '' ? hex.val() : null, e.target);
+                  break;
+                case bindedHex && bindedHex.get(0):
+                  bindedHex.val(bindedHex.val().replace(/[^a-fA-F0-9]/g, '').toLowerCase().substring(0, 6));
+                  hex.val(bindedHex.val());
+                  color.val('hex', bindedHex.val() != '' ? bindedHex.val() : null, e.target);
+                  break;
+                case ahex && ahex.get(0):
+                  ahex.val(ahex.val().replace(/[^a-fA-F0-9]/g, '').toLowerCase().substring(0, 2));
+                  color.val('a', ahex.val() != null ? parseInt(ahex.val(), 16) : null, e.target);
+                  break;
+              }
+            },
+          blur = // input box blur - reset to original if value empty
+            function(e)
+            {
+              if (color.val() != null)
+              {
+                switch (e.target)
+                {
+                  case red.get(0): red.val(color.val('r')); break;
+                  case green.get(0): green.val(color.val('g')); break;
+                  case blue.get(0): blue.val(color.val('b')); break;
+                  case alpha && alpha.get(0): alpha.val(Math.precision((color.val('a') * 100) / 255, alphaPrecision)); break;
+                  case hue.get(0): hue.val(color.val('h')); break;
+                  case saturation.get(0): saturation.val(color.val('s')); break;
+                  case value.get(0): value.val(color.val('v')); break;
+                  case hex.get(0):
+                  case bindedHex && bindedHex.get(0):
+                    hex.val(color.val('hex'));
+                    bindedHex && bindedHex.val(color.val('hex'));
+                    break;
+                  case ahex && ahex.get(0): ahex.val(color.val('ahex').substring(6)); break;
+                }
+              }
+            },
+          validateKey = // validate key
+            function(e)
+            {
+              switch(e.keyCode)
+              {
+                case 9:
+                case 16:
+                case 29:
+                case 37:
+                case 39:
+                  return false;
+                case 'c'.charCodeAt():
+                case 'v'.charCodeAt():
+                  if (e.ctrlKey) return false;
+              }
+              return true;
+            },
+          setValueInRange = // constrain value within range
+            function(value, min, max)
+            {
+              if (value == '' || isNaN(value)) return min;
+              if (value > max) return max;
+              if (value < min) return min;
+              return value;
+            },
+          colorChanged =
+            function(ui, context)
+            {
+              var all = ui.val('all');
+              if (context != red.get(0)) red.val(all != null ? all.r : '');
+              if (context != green.get(0)) green.val(all != null ? all.g : '');
+              if (context != blue.get(0)) blue.val(all != null ? all.b : '');
+              if (alpha && context != alpha.get(0)) alpha.val(all != null ? Math.precision((all.a * 100) / 255, alphaPrecision) : '');
+              if (context != hue.get(0)) hue.val(all != null ? all.h : '');
+              if (context != saturation.get(0)) saturation.val(all != null ? all.s : '');
+              if (context != value.get(0)) value.val(all != null ? all.v : '');
+              if (context != hex.get(0) && (bindedHex && context != bindedHex.get(0) || !bindedHex)) hex.val(all != null ? all.hex : '');
+              if (bindedHex && context != bindedHex.get(0) && context != hex.get(0)) bindedHex.val(all != null ? all.hex : '');
+              if (ahex && context != ahex.get(0)) ahex.val(all != null ? all.ahex.substring(6) : '');
+            },
+          destroy =
+            function()
+            {
+              // unbind all events and null objects
+              red.add(green).add(blue).add(alpha).add(hue).add(saturation).add(value).add(hex).add(bindedHex).add(ahex).unbind('keyup', keyUp).unbind('blur', blur);
+              red.add(green).add(blue).add(alpha).add(hue).add(saturation).add(value).unbind('keydown', keyDown);
+              color.unbind(colorChanged);
+              red = null;
+              green = null;
+              blue = null;
+              alpha = null;
+              hue = null;
+              saturation = null;
+              value = null;
+              hex = null;
+              ahex = null;
+            };
+        $.extend(true, $this, // public properties and methods
+          {
+            destroy: destroy
+          });
+        red.add(green).add(blue).add(alpha).add(hue).add(saturation).add(value).add(hex).add(bindedHex).add(ahex).bind('keyup', keyUp).bind('blur', blur);
+        red.add(green).add(blue).add(alpha).add(hue).add(saturation).add(value).bind('keydown', keyDown);
+        color.bind(colorChanged);
+      };
+  $.jPicker =
+    {
+      List: [], // array holding references to each active instance of the control
+      Color: // color object - we will be able to assign by any color space type or retrieve any color space info
+             // we want this public so we can optionally assign new color objects to initial values using inputs other than a string hex value (also supported)
+        function(init)
+        {
+          var $this = this,
+            r,
+            g,
+            b,
+            a,
+            h,
+            s,
+            v,
+            changeEvents = new Array(),
+            fireChangeEvents = 
+              function(context)
+              {
+                for (var i = 0; i < changeEvents.length; i++) changeEvents[i].call($this, $this, context);
+              },
+            val =
+              function(name, value, context)
+              {
+                var set = value !== undefined;
+                if (!set)
+                {
+                  if (name === undefined || name == null || name == '') name = 'all';
+                  if (r == null) return null;
+                  switch (name.toLowerCase())
+                  {
+                    case 'ahex': return ColorMethods.rgbaToHex({ r: r, g: g, b: b, a: a });
+                    case 'hex': return val('ahex').substring(0, 6);
+                    case 'all': return { r: r, g: g, b: b, a: a, h: h, s: s, v: v, hex: val.call($this, 'hex'), ahex: val.call($this, 'ahex') };
+                    default:
+                      var ret={};
+                      for (var i = 0; i < name.length; i++)
+                      {
+                        switch (name.charAt(i))
+                        {
+                          case 'r':
+                            if (name.length == 1) ret = r;
+                            else ret.r = r;
+                            break;
+                          case 'g':
+                            if (name.length == 1) ret = g;
+                            else ret.g = g;
+                            break;
+                          case 'b':
+                            if (name.length == 1) ret = b;
+                            else ret.b = b;
+                            break;
+                          case 'a':
+                            if (name.length == 1) ret = a;
+                            else ret.a = a;
+                            break;
+                          case 'h':
+                            if (name.length == 1) ret = h;
+                            else ret.h = h;
+                            break;
+                          case 's':
+                            if (name.length == 1) ret = s;
+                            else ret.s = s;
+                            break;
+                          case 'v':
+                            if (name.length == 1) ret = v;
+                            else ret.v = v;
+                            break;
+                        }
+                      }
+                      return ret == {} ? val.call($this, 'all') : ret;
+                      break;
+                  }
+                }
+                if (context != null && context == $this) return;
+                var changed = false;
+                if (name == null) name = '';
+                if (value == null)
+                {
+                  if (r != null)
+                  {
+                    r = null;
+                    changed = true;
+                  }
+                  if (g != null)
+                  {
+                    g = null;
+                    changed = true;
+                  }
+                  if (b != null)
+                  {
+                    b = null;
+                    changed = true;
+                  }
+                  if (a != null)
+                  {
+                    a = null;
+                    changed = true;
+                  }
+                  if (h != null)
+                  {
+                    h = null;
+                    changed = true;
+                  }
+                  if (s != null)
+                  {
+                    s = null;
+                    changed = true;
+                  }
+                  if (v != null)
+                  {
+                    v = null;
+                    changed = true;
+                  }
+                  changed && fireChangeEvents.call($this, context || $this);
+                  return;
+                }
+                switch (name.toLowerCase())
+                {
+                  case 'ahex':
+                  case 'hex':
+                    var ret = ColorMethods.hexToRgba(value && (value.ahex || value.hex) || value || '00000000');
+                    val.call($this, 'rgba', { r: ret.r, g: ret.g, b: ret.b, a: name == 'ahex' ? ret.a : a != null ? a : 255 }, context);
+                    break;
+                  default:
+                    if (value && (value.ahex != null || value.hex != null))
+                    {
+                      val.call($this, 'ahex', value.ahex || value.hex || '00000000', context);
+                      return;
+                    }
+                    var newV = {}, rgb = false, hsv = false;
+                    if (value.r !== undefined && !name.indexOf('r') == -1) name += 'r';
+                    if (value.g !== undefined && !name.indexOf('g') == -1) name += 'g';
+                    if (value.b !== undefined && !name.indexOf('b') == -1) name += 'b';
+                    if (value.a !== undefined && !name.indexOf('a') == -1) name += 'a';
+                    if (value.h !== undefined && !name.indexOf('h') == -1) name += 'h';
+                    if (value.s !== undefined && !name.indexOf('s') == -1) name += 's';
+                    if (value.v !== undefined && !name.indexOf('v') == -1) name += 'v';
+                    for (var i = 0; i < name.length; i++)
+                    {
+                      switch (name.charAt(i))
+                      {
+                        case 'r':
+                          if (hsv) continue;
+                          rgb = true;
+                          newV.r = value && value.r && value.r | 0 || value && value | 0 || 0;
+                          if (newV.r < 0) newV.r = 0;
+                          else if (newV.r > 255) newV.r = 255;
+                          if (r != newV.r)
+                          {
+                            r = newV.r;
+                            changed = true;
+                          }
+                          break;
+                        case 'g':
+                          if (hsv) continue;
+                          rgb = true;
+                          newV.g = value && value.g && value.g | 0 || value && value | 0 || 0;
+                          if (newV.g < 0) newV.g = 0;
+                          else if (newV.g > 255) newV.g = 255;
+                          if (g != newV.g)
+                          {
+                            g = newV.g;
+                            changed = true;
+                          }
+                          break;
+                        case 'b':
+                          if (hsv) continue;
+                          rgb = true;
+                          newV.b = value && value.b && value.b | 0 || value && value | 0 || 0;
+                          if (newV.b < 0) newV.b = 0;
+                          else if (newV.b > 255) newV.b = 255;
+                          if (b != newV.b)
+                          {
+                            b = newV.b;
+                            changed = true;
+                          }
+                          break;
+                        case 'a':
+                          newV.a = value && value.a != null ? value.a | 0 : value != null ? value | 0 : 255;
+                          if (newV.a < 0) newV.a = 0;
+                          else if (newV.a > 255) newV.a = 255;
+                          if (a != newV.a)
+                          {
+                            a = newV.a;
+                            changed = true;
+                          }
+                          break;
+                        case 'h':
+                          if (rgb) continue;
+                          hsv = true;
+                          newV.h = value && value.h && value.h | 0 || value && value | 0 || 0;
+                          if (newV.h < 0) newV.h = 0;
+                          else if (newV.h > 360) newV.h = 360;
+                          if (h != newV.h)
+                          {
+                            h = newV.h;
+                            changed = true;
+                          }
+                          break;
+                        case 's':
+                          if (rgb) continue;
+                          hsv = true;
+                          newV.s = value && value.s != null ? value.s | 0 : value != null ? value | 0 : 100;
+                          if (newV.s < 0) newV.s = 0;
+                          else if (newV.s > 100) newV.s = 100;
+                          if (s != newV.s)
+                          {
+                            s = newV.s;
+                            changed = true;
+                          }
+                          break;
+                        case 'v':
+                          if (rgb) continue;
+                          hsv = true;
+                          newV.v = value && value.v != null ? value.v | 0 : value != null ? value | 0 : 100;
+                          if (newV.v < 0) newV.v = 0;
+                          else if (newV.v > 100) newV.v = 100;
+                          if (v != newV.v)
+                          {
+                            v = newV.v;
+                            changed = true;
+                          }
+                          break;
+                      }
+                    }
+                    if (changed)
+                    {
+                      if (rgb)
+                      {
+                        r = r || 0;
+                        g = g || 0;
+                        b = b || 0;
+                        var ret = ColorMethods.rgbToHsv({ r: r, g: g, b: b });
+                        h = ret.h;
+                        s = ret.s;
+                        v = ret.v;
+                      }
+                      else if (hsv)
+                      {
+                        h = h || 0;
+                        s = s != null ? s : 100;
+                        v = v != null ? v : 100;
+                        var ret = ColorMethods.hsvToRgb({ h: h, s: s, v: v });
+                        r = ret.r;
+                        g = ret.g;
+                        b = ret.b;
+                      }
+                      a = a != null ? a : 255;
+                      fireChangeEvents.call($this, context || $this);
+                    }
+                    break;
+                }
+              },
+            bind =
+              function(callback)
+              {
+                if ($.isFunction(callback)) changeEvents.push(callback);
+              },
+            unbind =
+              function(callback)
+              {
+                if (!$.isFunction(callback)) return;
+                var i;
+                while ((i = $.inArray(callback, changeEvents)) != -1) changeEvents.splice(i, 1);
+              },
+            destroy =
+              function()
+              {
+                changeEvents = null;
+              }
+          $.extend(true, $this, // public properties and methods
+            {
+              val: val,
+              bind: bind,
+              unbind: unbind,
+              destroy: destroy
+            });
+          if (init)
+          {
+            if (init.ahex != null) val('ahex', init);
+            else if (init.hex != null) val((init.a != null ? 'a' : '') + 'hex', init.a != null ? { ahex: init.hex + ColorMethods.intToHex(init.a) } : init);
+            else if (init.r != null && init.g != null && init.b != null) val('rgb' + (init.a != null ? 'a' : ''), init);
+            else if (init.h != null && init.s != null && init.v != null) val('hsv' + (init.a != null ? 'a' : ''), init);
+          }
+        },
+      ColorMethods: // color conversion methods  - make public to give use to external scripts
+        {
+          hexToRgba:
+            function(hex)
+            {
+              hex = this.validateHex(hex);
+              if (hex == '') return { r: null, g: null, b: null, a: null };
+              var r = '00', g = '00', b = '00', a = '255';
+              if (hex.length == 6) hex += 'ff';
+              if (hex.length > 6)
+              {
+                r = hex.substring(0, 2);
+                g = hex.substring(2, 4);
+                b = hex.substring(4, 6);
+                a = hex.substring(6, hex.length);
+              }
+              else
+              {
+                if (hex.length > 4)
+                {
+                  r = hex.substring(4, hex.length);
+                  hex = hex.substring(0, 4);
+                }
+                if (hex.length > 2)
+                {
+                  g = hex.substring(2, hex.length);
+                  hex = hex.substring(0, 2);
+                }
+                if (hex.length > 0) b = hex.substring(0, hex.length);
+              }
+              return { r: this.hexToInt(r), g: this.hexToInt(g), b: this.hexToInt(b), a: this.hexToInt(a) };
+            },
+          validateHex:
+            function(hex)
+            {
+              hex = hex.toLowerCase().replace(/[^a-f0-9]/g, '');
+              if (hex.length > 8) hex = hex.substring(0, 8);
+              return hex;
+            },
+          rgbaToHex:
+            function(rgba)
+            {
+              return this.intToHex(rgba.r) + this.intToHex(rgba.g) + this.intToHex(rgba.b) + this.intToHex(rgba.a);
+            },
+          intToHex:
+            function(dec)
+            {
+              var result = (dec | 0).toString(16);
+              if (result.length == 1) result = ('0' + result);
+              return result.toLowerCase();
+            },
+          hexToInt:
+            function(hex)
+            {
+              return parseInt(hex, 16);
+            },
+          rgbToHsv:
+            function(rgb)
+            {
+              var r = rgb.r / 255, g = rgb.g / 255, b = rgb.b / 255, hsv = { h: 0, s: 0, v: 0 }, min = 0, max = 0, delta;
+              if (r >= g && r >= b)
+              {
+                max = r;
+                min = g > b ? b : g;
+              }
+              else if (g >= b && g >= r)
+              {
+                max = g;
+                min = r > b ? b : r;
+              }
+              else
+              {
+                max = b;
+                min = g > r ? r : g;
+              }
+              hsv.v = max;
+              hsv.s = max ? (max - min) / max : 0;
+              if (!hsv.s) hsv.h = 0;
+              else
+              {
+                delta = max - min;
+                if (r == max) hsv.h = (g - b) / delta;
+                else if (g == max) hsv.h = 2 + (b - r) / delta;
+                else hsv.h = 4 + (r - g) / delta;
+                hsv.h = parseInt(hsv.h * 60);
+                if (hsv.h < 0) hsv.h += 360;
+              }
+              hsv.s = (hsv.s * 100) | 0;
+              hsv.v = (hsv.v * 100) | 0;
+              return hsv;
+            },
+          hsvToRgb:
+            function(hsv)
+            {
+              var rgb = { r: 0, g: 0, b: 0, a: 100 }, h = hsv.h, s = hsv.s, v = hsv.v;
+              if (s == 0)
+              {
+                if (v == 0) rgb.r = rgb.g = rgb.b = 0;
+                else rgb.r = rgb.g = rgb.b = (v * 255 / 100) | 0;
+              }
+              else
+              {
+                if (h == 360) h = 0;
+                h /= 60;
+                s = s / 100;
+                v = v / 100;
+                var i = h | 0,
+                    f = h - i,
+                    p = v * (1 - s),
+                    q = v * (1 - (s * f)),
+                    t = v * (1 - (s * (1 - f)));
+                switch (i)
+                {
+                  case 0:
+                    rgb.r = v;
+                    rgb.g = t;
+                    rgb.b = p;
+                    break;
+                  case 1:
+                    rgb.r = q;
+                    rgb.g = v;
+                    rgb.b = p;
+                    break;
+                  case 2:
+                    rgb.r = p;
+                    rgb.g = v;
+                    rgb.b = t;
+                    break;
+                  case 3:
+                    rgb.r = p;
+                    rgb.g = q;
+                    rgb.b = v;
+                    break;
+                  case 4:
+                    rgb.r = t;
+                    rgb.g = p;
+                    rgb.b = v;
+                    break;
+                  case 5:
+                    rgb.r = v;
+                    rgb.g = p;
+                    rgb.b = q;
+                    break;
+                }
+                rgb.r = (rgb.r * 255) | 0;
+                rgb.g = (rgb.g * 255) | 0;
+                rgb.b = (rgb.b * 255) | 0;
+              }
+              return rgb;
+            }
+        }
+    };
+  var Color = $.jPicker.Color, List = $.jPicker.List, ColorMethods = $.jPicker.ColorMethods; // local copies for YUI compressor
+  $.fn.jPicker =
+    function(options)
+    {
+      var $arguments = arguments;
+      return this.each(
+        function()
+        {
+          var $this = this, settings = $.extend(true, {}, $.fn.jPicker.defaults, options); // local copies for YUI compressor
+          if ($($this).get(0).nodeName.toLowerCase() == 'input') // Add color picker icon if binding to an input element and bind the events to the input
+          {
+            $.extend(true, settings,
+              {
+                window:
+                {
+                  bindToInput: true,
+                  expandable: true,
+                  input: $($this)
+                }
+              });
+            if($($this).val()=='')
+            {
+              settings.color.active = new Color({ hex: null });
+              settings.color.current = new Color({ hex: null });
+            }
+            else if (ColorMethods.validateHex($($this).val()))
+            {
+              settings.color.active = new Color({ hex: $($this).val(), a: settings.color.active.val('a') });
+              settings.color.current = new Color({ hex: $($this).val(), a: settings.color.active.val('a') });
+            }
+          }
+          if (settings.window.expandable)
+            $($this).after('<span class="jPicker"><span class="Icon"><span class="Color">&nbsp;</span><span class="Alpha">&nbsp;</span><span class="Image" title="Click To Open Color Picker">&nbsp;</span><span class="Container">&nbsp;</span></span></span>');
+          else settings.window.liveUpdate = false; // Basic control binding for inline use - You will need to override the liveCallback or commitCallback function to retrieve results
+          var isLessThanIE7 = parseFloat(navigator.appVersion.split('MSIE')[1]) < 7 && document.body.filters, // needed to run the AlphaImageLoader function for IE6
+            container = null,
+            colorMapDiv = null,
+            colorBarDiv = null,
+            colorMapL1 = null, // different layers of colorMap and colorBar
+            colorMapL2 = null,
+            colorMapL3 = null,
+            colorBarL1 = null,
+            colorBarL2 = null,
+            colorBarL3 = null,
+            colorBarL4 = null,
+            colorBarL5 = null,
+            colorBarL6 = null,
+            colorMap = null, // color maps
+            colorBar = null,
+            colorPicker = null,
+            elementStartX = null, // Used to record the starting css positions for dragging the control
+            elementStartY = null,
+            pageStartX = null, // Used to record the mousedown coordinates for dragging the control
+            pageStartY = null,
+            activePreview = null, // color boxes above the radio buttons
+            currentPreview = null,
+            okButton = null,
+            cancelButton = null,
+            grid = null, // preset colors grid
+            iconColor = null, // iconColor for popup icon
+            iconAlpha = null, // iconAlpha for popup icon
+            iconImage = null, // iconImage popup icon
+            moveBar = null, // drag bar
+            setColorMode = // set color mode and update visuals for the new color mode
+              function(colorMode)
+              {
+                var active = color.active, // local copies for YUI compressor
+                  clientPath = images.clientPath,
+                  hex = active.val('hex'),
+                  rgbMap,
+                  rgbBar;
+                settings.color.mode = colorMode;
+                switch (colorMode)
+                {
+                  case 'h':
+                    setTimeout(
+                      function()
+                      {
+                        setBG.call($this, colorMapDiv, 'transparent');
+                        setImgLoc.call($this, colorMapL1, 0);
+                        setAlpha.call($this, colorMapL1, 100);
+                        setImgLoc.call($this, colorMapL2, 260);
+                        setAlpha.call($this, colorMapL2, 100);
+                        setBG.call($this, colorBarDiv, 'transparent');
+                        setImgLoc.call($this, colorBarL1, 0);
+                        setAlpha.call($this, colorBarL1, 100);
+                        setImgLoc.call($this, colorBarL2, 260);
+                        setAlpha.call($this, colorBarL2, 100);
+                        setImgLoc.call($this, colorBarL3, 260);
+                        setAlpha.call($this, colorBarL3, 100);
+                        setImgLoc.call($this, colorBarL4, 260);
+                        setAlpha.call($this, colorBarL4, 100);
+                        setImgLoc.call($this, colorBarL6, 260);
+                        setAlpha.call($this, colorBarL6, 100);
+                      }, 0);
+                    colorMap.range('all', { minX: 0, maxX: 100, minY: 0, maxY: 100 });
+                    colorBar.range('rangeY', { minY: 0, maxY: 360 });
+                    if (active.val('ahex') == null) break;
+                    colorMap.val('xy', { x: active.val('s'), y: 100 - active.val('v') }, colorMap);
+                    colorBar.val('y', 360 - active.val('h'), colorBar);
+                    break;
+                  case 's':
+                    setTimeout(
+                      function()
+                      {
+                        setBG.call($this, colorMapDiv, 'transparent');
+                        setImgLoc.call($this, colorMapL1, -260);
+                        setImgLoc.call($this, colorMapL2, -520);
+                        setImgLoc.call($this, colorBarL1, -260);
+                        setImgLoc.call($this, colorBarL2, -520);
+                        setImgLoc.call($this, colorBarL6, 260);
+                        setAlpha.call($this, colorBarL6, 100);
+                      }, 0);
+                    colorMap.range('all', { minX: 0, maxX: 360, minY: 0, maxY: 100 });
+                    colorBar.range('rangeY', { minY: 0, maxY: 100 });
+                    if (active.val('ahex') == null) break;
+                    colorMap.val('xy', { x: active.val('h'), y: 100 - active.val('v') }, colorMap);
+                    colorBar.val('y', 100 - active.val('s'), colorBar);
+                    break;
+                  case 'v':
+                    setTimeout(
+                      function()
+                      {
+                        setBG.call($this, colorMapDiv, '000000');
+                        setImgLoc.call($this, colorMapL1, -780);
+                        setImgLoc.call($this, colorMapL2, 260);
+                        setBG.call($this, colorBarDiv, hex);
+                        setImgLoc.call($this, colorBarL1, -520);
+                        setImgLoc.call($this, colorBarL2, 260);
+                        setAlpha.call($this, colorBarL2, 100);
+                        setImgLoc.call($this, colorBarL6, 260);
+                        setAlpha.call($this, colorBarL6, 100);
+                      }, 0);
+                    colorMap.range('all', { minX: 0, maxX: 360, minY: 0, maxY: 100 });
+                    colorBar.range('rangeY', { minY: 0, maxY: 100 });
+                    if (active.val('ahex') == null) break;
+                    colorMap.val('xy', { x: active.val('h'), y: 100 - active.val('s') }, colorMap);
+                    colorBar.val('y', 100 - active.val('v'), colorBar);
+                    break;
+                  case 'r':
+                    rgbMap = -1040;
+                    rgbBar = -780;
+                    colorMap.range('all', { minX: 0, maxX: 255, minY: 0, maxY: 255 });
+                    colorBar.range('rangeY', { minY: 0, maxY: 255 });
+                    if (active.val('ahex') == null) break;
+                    colorMap.val('xy', { x: active.val('b'), y: 255 - active.val('g') }, colorMap);
+                    colorBar.val('y', 255 - active.val('r'), colorBar);
+                    break;
+                  case 'g':
+                    rgbMap = -1560;
+                    rgbBar = -1820;
+                    colorMap.range('all', { minX: 0, maxX: 255, minY: 0, maxY: 255 });
+                    colorBar.range('rangeY', { minY: 0, maxY: 255 });
+                    if (active.val('ahex') == null) break;
+                    colorMap.val('xy', { x: active.val('b'), y: 255 - active.val('r') }, colorMap);
+                    colorBar.val('y', 255 - active.val('g'), colorBar);
+                    break;
+                  case 'b':
+                    rgbMap = -2080;
+                    rgbBar = -2860;
+                    colorMap.range('all', { minX: 0, maxX: 255, minY: 0, maxY: 255 });
+                    colorBar.range('rangeY', { minY: 0, maxY: 255 });
+                    if (active.val('ahex') == null) break;
+                    colorMap.val('xy', { x: active.val('r'), y: 255 - active.val('g') }, colorMap);
+                    colorBar.val('y', 255 - active.val('b'), colorBar);
+                    break;
+                  case 'a':
+                    setTimeout(
+                      function()
+                      {
+                        setBG.call($this, colorMapDiv, 'transparent');
+                        setImgLoc.call($this, colorMapL1, -260);
+                        setImgLoc.call($this, colorMapL2, -520);
+                        setImgLoc.call($this, colorBarL1, 260);
+                        setImgLoc.call($this, colorBarL2, 260);
+                        setAlpha.call($this, colorBarL2, 100);
+                        setImgLoc.call($this, colorBarL6, 0);
+                        setAlpha.call($this, colorBarL6, 100);
+                      }, 0);
+                    colorMap.range('all', { minX: 0, maxX: 360, minY: 0, maxY: 100 });
+                    colorBar.range('rangeY', { minY: 0, maxY: 255 });
+                    if (active.val('ahex') == null) break;
+                    colorMap.val('xy', { x: active.val('h'), y: 100 - active.val('v') }, colorMap);
+                    colorBar.val('y', 255 - active.val('a'), colorBar);
+                    break;
+                  default:
+                    throw ('Invalid Mode');
+                    break;
+                }
+                switch (colorMode)
+                {
+                  case 'h':
+                    break;
+                  case 's':
+                  case 'v':
+                  case 'a':
+                    setTimeout(
+                      function()
+                      {
+                        setAlpha.call($this, colorMapL1, 100);
+                        setAlpha.call($this, colorBarL1, 100);
+                        setImgLoc.call($this, colorBarL3, 260);
+                        setAlpha.call($this, colorBarL3, 100);
+                        setImgLoc.call($this, colorBarL4, 260);
+                        setAlpha.call($this, colorBarL4, 100);
+                      }, 0);
+                    break;
+                  case 'r':
+                  case 'g':
+                  case 'b':
+                    setTimeout(
+                      function()
+                      {
+                        setBG.call($this, colorMapDiv, 'transparent');
+                        setBG.call($this, colorBarDiv, 'transparent');
+                        setAlpha.call($this, colorBarL1, 100);
+                        setAlpha.call($this, colorMapL1, 100);
+                        setImgLoc.call($this, colorMapL1, rgbMap);
+                        setImgLoc.call($this, colorMapL2, rgbMap - 260);
+                        setImgLoc.call($this, colorBarL1, rgbBar - 780);
+                        setImgLoc.call($this, colorBarL2, rgbBar - 520);
+                        setImgLoc.call($this, colorBarL3, rgbBar);
+                        setImgLoc.call($this, colorBarL4, rgbBar - 260);
+                        setImgLoc.call($this, colorBarL6, 260);
+                        setAlpha.call($this, colorBarL6, 100);
+                      }, 0);
+                    break;
+                }
+                if (active.val('ahex') == null) return;
+                activeColorChanged.call($this, active);
+              },
+            activeColorChanged = // Update color when user changes text values
+              function(ui, context)
+              {
+                if (context == null || (context != colorBar && context != colorMap)) positionMapAndBarArrows.call($this, ui, context);
+                setTimeout(
+                  function()
+                  {
+                    updatePreview.call($this, ui);
+                    updateMapVisuals.call($this, ui);
+                    updateBarVisuals.call($this, ui);
+                  }, 0);
+              },
+            mapValueChanged = // user has dragged the ColorMap pointer
+              function(ui, context)
+              {
+                var active = color.active;
+                if (context != colorMap && active.val() == null) return;
+                var xy = ui.val('all');
+                switch (settings.color.mode)
+                {
+                  case 'h':
+                    active.val('sv', { s: xy.x, v: 100 - xy.y }, context);
+                    break;
+                  case 's':
+                  case 'a':
+                    active.val('hv', { h: xy.x, v: 100 - xy.y }, context);
+                    break;
+                  case 'v':
+                    active.val('hs', { h: xy.x, s: 100 - xy.y }, context);
+                    break;
+                  case 'r':
+                    active.val('gb', { g: 255 - xy.y, b: xy.x }, context);
+                    break;
+                  case 'g':
+                    active.val('rb', { r: 255 - xy.y, b: xy.x }, context);
+                    break;
+                  case 'b':
+                    active.val('rg', { r: xy.x, g: 255 - xy.y }, context);
+                    break;
+                }
+              },
+            colorBarValueChanged = // user has dragged the ColorBar slider
+              function(ui, context)
+              {
+                var active = color.active;
+                if (context != colorBar && active.val() == null) return;
+                switch (settings.color.mode)
+                {
+                  case 'h':
+                    active.val('h', { h: 360 - ui.val('y') }, context);
+                    break;
+                  case 's':
+                    active.val('s', { s: 100 - ui.val('y') }, context);
+                    break;
+                  case 'v':
+                    active.val('v', { v: 100 - ui.val('y') }, context);
+                    break;
+                  case 'r':
+                    active.val('r', { r: 255 - ui.val('y') }, context);
+                    break;
+                  case 'g':
+                    active.val('g', { g: 255 - ui.val('y') }, context);
+                    break;
+                  case 'b':
+                    active.val('b', { b: 255 - ui.val('y') }, context);
+                    break;
+                  case 'a':
+                    active.val('a', 255 - ui.val('y'), context);
+                    break;
+                }
+              },
+            positionMapAndBarArrows = // position map and bar arrows to match current color
+              function(ui, context)
+              {
+                if (context != colorMap)
+                {
+                  switch (settings.color.mode)
+                  {
+                    case 'h':
+                      var sv = ui.val('sv');
+                      colorMap.val('xy', { x: sv != null ? sv.s : 100, y: 100 - (sv != null ? sv.v : 100) }, context);
+                      break;
+                    case 's':
+                    case 'a':
+                      var hv = ui.val('hv');
+                      colorMap.val('xy', { x: hv && hv.h || 0, y: 100 - (hv != null ? hv.v : 100) }, context);
+                      break;
+                    case 'v':
+                      var hs = ui.val('hs');
+                      colorMap.val('xy', { x: hs && hs.h || 0, y: 100 - (hs != null ? hs.s : 100) }, context);
+                      break;
+                    case 'r':
+                      var bg = ui.val('bg');
+                      colorMap.val('xy', { x: bg && bg.b || 0, y: 255 - (bg && bg.g || 0) }, context);
+                      break;
+                    case 'g':
+                      var br = ui.val('br');
+                      colorMap.val('xy', { x: br && br.b || 0, y: 255 - (br && br.r || 0) }, context);
+                      break;
+                    case 'b':
+                      var rg = ui.val('rg');
+                      colorMap.val('xy', { x: rg && rg.r || 0, y: 255 - (rg && rg.g || 0) }, context);
+                      break;
+                  }
+                }
+                if (context != colorBar)
+                {
+                  switch (settings.color.mode)
+                  {
+                    case 'h':
+                      colorBar.val('y', 360 - (ui.val('h') || 0), context);
+                      break;
+                    case 's':
+                      var s = ui.val('s');
+                      colorBar.val('y', 100 - (s != null ? s : 100), context);
+                      break;
+                    case 'v':
+                      var v = ui.val('v');
+                      colorBar.val('y', 100 - (v != null ? v : 100), context);
+                      break;
+                    case 'r':
+                      colorBar.val('y', 255 - (ui.val('r') || 0), context);
+                      break;
+                    case 'g':
+                      colorBar.val('y', 255 - (ui.val('g') || 0), context);
+                      break;
+                    case 'b':
+                      colorBar.val('y', 255 - (ui.val('b') || 0), context);
+                      break;
+                    case 'a':
+                      var a = ui.val('a');
+                      colorBar.val('y', 255 - (a != null ? a : 255), context);
+                      break;
+                  }
+                }
+              },
+            updatePreview =
+              function(ui)
+              {
+                try
+                {
+                  var all = ui.val('all');
+                  activePreview.css({ backgroundColor: all && '#' + all.hex || 'transparent' });
+                  setAlpha.call($this, activePreview, all && Math.precision((all.a * 100) / 255, 4) || 0);
+                }
+                catch (e) { }
+              },
+            updateMapVisuals =
+              function(ui)
+              {
+                switch (settings.color.mode)
+                {
+                  case 'h':
+                    setBG.call($this, colorMapDiv, new Color({ h: ui.val('h') || 0, s: 100, v: 100 }).val('hex'));
+                    break;
+                  case 's':
+                  case 'a':
+                    var s = ui.val('s');
+                    setAlpha.call($this, colorMapL2, 100 - (s != null ? s : 100));
+                    break;
+                  case 'v':
+                    var v = ui.val('v');
+                    setAlpha.call($this, colorMapL1, v != null ? v : 100);
+                    break;
+                  case 'r':
+                    setAlpha.call($this, colorMapL2, Math.precision((ui.val('r') || 0) / 255 * 100, 4));
+                    break;
+                  case 'g':
+                    setAlpha.call($this, colorMapL2, Math.precision((ui.val('g') || 0) / 255 * 100, 4));
+                    break;
+                  case 'b':
+                    setAlpha.call($this, colorMapL2, Math.precision((ui.val('b') || 0) / 255 * 100));
+                    break;
+                }
+                var a = ui.val('a');
+                setAlpha.call($this, colorMapL3, Math.precision(((255 - (a || 0)) * 100) / 255, 4));
+              },
+            updateBarVisuals =
+              function(ui)
+              {
+                switch (settings.color.mode)
+                {
+                  case 'h':
+                    var a = ui.val('a');
+                    setAlpha.call($this, colorBarL5, Math.precision(((255 - (a || 0)) * 100) / 255, 4));
+                    break;
+                  case 's':
+                    var hva = ui.val('hva'),
+                        saturatedColor = new Color({ h: hva && hva.h || 0, s: 100, v: hva != null ? hva.v : 100 });
+                    setBG.call($this, colorBarDiv, saturatedColor.val('hex'));
+                    setAlpha.call($this, colorBarL2, 100 - (hva != null ? hva.v : 100));
+                    setAlpha.call($this, colorBarL5, Math.precision(((255 - (hva && hva.a || 0)) * 100) / 255, 4));
+                    break;
+                  case 'v':
+                    var hsa = ui.val('hsa'),
+                        valueColor = new Color({ h: hsa && hsa.h || 0, s: hsa != null ? hsa.s : 100, v: 100 });
+                    setBG.call($this, colorBarDiv, valueColor.val('hex'));
+                    setAlpha.call($this, colorBarL5, Math.precision(((255 - (hsa && hsa.a || 0)) * 100) / 255, 4));
+                    break;
+                  case 'r':
+                  case 'g':
+                  case 'b':
+                    var hValue = 0, vValue = 0, rgba = ui.val('rgba');
+                    if (settings.color.mode == 'r')
+                    {
+                      hValue = rgba && rgba.b || 0;
+                      vValue = rgba && rgba.g || 0;
+                    }
+                    else if (settings.color.mode == 'g')
+                    {
+                      hValue = rgba && rgba.b || 0;
+                      vValue = rgba && rgba.r || 0;
+                    }
+                    else if (settings.color.mode == 'b')
+                    {
+                      hValue = rgba && rgba.r || 0;
+                      vValue = rgba && rgba.g || 0;
+                    }
+                    var middle = vValue > hValue ? hValue : vValue;
+                    setAlpha.call($this, colorBarL2, hValue > vValue ? Math.precision(((hValue - vValue) / (255 - vValue)) * 100, 4) : 0);
+                    setAlpha.call($this, colorBarL3, vValue > hValue ? Math.precision(((vValue - hValue) / (255 - hValue)) * 100, 4) : 0);
+                    setAlpha.call($this, colorBarL4, Math.precision((middle / 255) * 100, 4));
+                    setAlpha.call($this, colorBarL5, Math.precision(((255 - (rgba && rgba.a || 0)) * 100) / 255, 4));
+                    break;
+                  case 'a':
+                    var a = ui.val('a');
+                    setBG.call($this, colorBarDiv, ui.val('hex') || '000000');
+                    setAlpha.call($this, colorBarL5, a != null ? 0 : 100);
+                    setAlpha.call($this, colorBarL6, a != null ? 100 : 0);
+                    break;
+                }
+              },
+            setBG =
+              function(el, c)
+              {
+                el.css({ backgroundColor: c && c.length == 6 && '#' + c || 'transparent' });
+              },
+            setImg =
+              function(img, src)
+              {
+                if (isLessThanIE7 && (src.indexOf('AlphaBar.png') != -1 || src.indexOf('Bars.png') != -1 || src.indexOf('Maps.png') != -1))
+                {
+                  img.attr('pngSrc', src);
+                  img.css({ backgroundImage: 'none', filter: 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + src + '\', sizingMethod=\'scale\')' });
+                }
+                else img.css({ backgroundImage: 'url(\'' + src + '\')' });
+              },
+            setImgLoc =
+              function(img, y)
+              {
+                img.css({ top: y + 'px' });
+              },
+            setAlpha =
+              function(obj, alpha)
+              {
+                obj.css({ visibility: alpha > 0 ? 'visible' : 'hidden' });
+                if (alpha > 0 && alpha < 100)
+                {
+                  if (isLessThanIE7)
+                  {
+                    var src = obj.attr('pngSrc');
+                    if (src != null && (src.indexOf('AlphaBar.png') != -1 || src.indexOf('Bars.png') != -1 || src.indexOf('Maps.png') != -1))
+                      obj.css({ filter: 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + src + '\', sizingMethod=\'scale\') progid:DXImageTransform.Microsoft.Alpha(opacity=' + alpha + ')' });
+                    else obj.css({ opacity: Math.precision(alpha / 100, 4) });
+                  }
+                  else obj.css({ opacity: Math.precision(alpha / 100, 4) });
+                }
+                else if (alpha == 0 || alpha == 100)
+                {
+                  if (isLessThanIE7)
+                  {
+                    var src = obj.attr('pngSrc');
+                    if (src != null && (src.indexOf('AlphaBar.png') != -1 || src.indexOf('Bars.png') != -1 || src.indexOf('Maps.png') != -1))
+                      obj.css({ filter: 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + src + '\', sizingMethod=\'scale\')' });
+                    else obj.css({ opacity: '' });
+                  }
+                  else obj.css({ opacity: '' });
+                }
+              },
+            revertColor = // revert color to original color when opened
+              function()
+              {
+                color.active.val('ahex', color.current.val('ahex'));
+              },
+            commitColor = // commit the color changes
+              function()
+              {
+                color.current.val('ahex', color.active.val('ahex'));
+              },
+            radioClicked =
+              function(e)
+              {
+                $(this).parents('tbody:first').find('input:radio[value!="'+e.target.value+'"]').removeAttr('checked');
+                setColorMode.call($this, e.target.value);
+              },
+            currentClicked =
+              function()
+              {
+                revertColor.call($this);
+              },
+            cancelClicked =
+              function()
+              {
+                revertColor.call($this);
+                settings.window.expandable && hide.call($this);
+                $.isFunction(cancelCallback) && cancelCallback.call($this, color.active, cancelButton);
+              },
+            okClicked =
+              function()
+              {
+                commitColor.call($this);
+                settings.window.expandable && hide.call($this);
+                $.isFunction(commitCallback) && commitCallback.call($this, color.active, okButton);
+              },
+            iconImageClicked =
+              function()
+              {
+                show.call($this);
+              },
+            currentColorChanged =
+              function(ui, context)
+              {
+                var hex = ui.val('hex');
+                currentPreview.css({ backgroundColor: hex && '#' + hex || 'transparent' });
+                setAlpha.call($this, currentPreview, Math.precision(((ui.val('a') || 0) * 100) / 255, 4));
+              },
+            expandableColorChanged =
+              function(ui, context)
+              {
+                var hex = ui.val('hex');
+                var va = ui.val('va');
+                iconColor.css({ backgroundColor: hex && '#' + hex || 'transparent' });
+                setAlpha.call($this, iconAlpha, Math.precision(((255 - (va && va.a || 0)) * 100) / 255, 4));
+                if (settings.window.bindToInput&&settings.window.updateInputColor)
+                  settings.window.input.css(
+                    {
+                      backgroundColor: hex && '#' + hex || 'transparent',
+                      color: va == null || va.v > 75 ? '#000000' : '#ffffff'
+                    });
+              },
+            moveBarMouseDown =
+              function(e)
+              {
+                var element = settings.window.element, // local copies for YUI compressor
+                  page = settings.window.page;
+                elementStartX = parseInt(container.css('left'));
+                elementStartY = parseInt(container.css('top'));
+                pageStartX = e.pageX;
+                pageStartY = e.pageY;
+                // bind events to document to move window - we will unbind these on mouseup
+                $(document).bind('mousemove', documentMouseMove).bind('mouseup', documentMouseUp);
+                e.preventDefault(); // prevent attempted dragging of the column
+              },
+            documentMouseMove =
+              function(e)
+              {
+                container.css({ left: elementStartX - (pageStartX - e.pageX) + 'px', top: elementStartY - (pageStartY - e.pageY) + 'px' });
+                if (settings.window.expandable && !$.support.boxModel) container.prev().css({ left: container.css("left"), top: container.css("top") });
+                e.stopPropagation();
+                e.preventDefault();
+                return false;
+              },
+            documentMouseUp =
+              function(e)
+              {
+                $(document).unbind('mousemove', documentMouseMove).unbind('mouseup', documentMouseUp);
+                e.stopPropagation();
+                e.preventDefault();
+                return false;
+              },
+            quickPickClicked =
+              function(e)
+              {
+                e.preventDefault();
+                e.stopPropagation();
+                color.active.val('ahex', $(this).attr('title') || null, e.target);
+                return false;
+              },
+            commitCallback = $.isFunction($arguments[1]) && $arguments[1] || null,
+            liveCallback = $.isFunction($arguments[2]) && $arguments[2] || null,
+            cancelCallback = $.isFunction($arguments[3]) && $arguments[3] || null,
+            show =
+              function()
+              {
+                color.current.val('ahex', color.active.val('ahex'));
+                var attachIFrame = function()
+                  {
+                    if (!settings.window.expandable || $.support.boxModel) return;
+                    var table = container.find('table:first');
+                    container.before('<iframe/>');
+                    container.prev().css({ width: table.width(), height: container.height(), opacity: 0, position: 'absolute', left: container.css("left"), top: container.css("top") });
+                  };
+                if (settings.window.expandable)
+                {
+                  $(document.body).children('div.jPicker.Container').css({zIndex:10});
+                  container.css({zIndex:20});
+                }
+                switch (settings.window.effects.type)
+                {
+                  case 'fade':
+                    container.fadeIn(settings.window.effects.speed.show, attachIFrame);
+                    break;
+                  case 'slide':
+                    container.slideDown(settings.window.effects.speed.show, attachIFrame);
+                    break;
+                  case 'show':
+                  default:
+                    container.show(settings.window.effects.speed.show, attachIFrame);
+                    break;
+                }
+              },
+            hide =
+              function()
+              {
+                var removeIFrame = function()
+                  {
+                    if (settings.window.expandable) container.css({ zIndex: 10 });
+                    if (!settings.window.expandable || $.support.boxModel) return;
+                    container.prev().remove();
+                  };
+                switch (settings.window.effects.type)
+                {
+                  case 'fade':
+                    container.fadeOut(settings.window.effects.speed.hide, removeIFrame);
+                    break;
+                  case 'slide':
+                    container.slideUp(settings.window.effects.speed.hide, removeIFrame);
+                    break;
+                  case 'show':
+                  default:
+                    container.hide(settings.window.effects.speed.hide, removeIFrame);
+                    break;
+                }
+              },
+            initialize =
+              function()
+              {
+                var win = settings.window,
+                    popup = win.expandable ? $($this).next().find('.Container:first') : null;
+                container = win.expandable ? $('<div/>') : $($this);
+                container.addClass('jPicker Container');
+                if (win.expandable) container.hide();
+                container.get(0).onselectstart = function(event){ if (event.target.nodeName.toLowerCase() !== 'input') return false; };
+                // inject html source code - we are using a single table for this control - I know tables are considered bad, but it takes care of equal height columns and
+                // this control really is tabular data, so I believe it is the right move
+                var all = color.active.val('all');
+                if (win.alphaPrecision < 0) win.alphaPrecision = 0;
+                else if (win.alphaPrecision > 2) win.alphaPrecision = 2;
+                var controlHtml='<table class="jPicker" cellpadding="0" cellspacing="0"><tbody>' + (win.expandable ? '<tr><td class="Move" colspan="5">&nbsp;</td></tr>' : '') + '<tr><td rowspan="9"><h2 class="Title">' + (win.title || localization.text.title) + '</h2><div class="Map"><span class="Map1">&nbsp;</span><span class="Map2">&nbsp;</span><span class="Map3">&nbsp;</span><img src="' + images.clientPath + images.colorMap.arrow.file + '" class="Arrow"/></div></td><td rowspan="9"><div class="Bar"><span class="Map1">&nbsp;</span><span class="Map2">&nbsp;</span><span class="Map3">&nbsp;</span><span class="Map4">&nbsp;</span><span class="Map5">&nbsp;</span><span class="Map6">&nbsp;</span><img src="' + images.clientPath + images.colorBar.arrow.file + '" class="Arrow"/></div></td><td colspan="2" class="Preview">' + localization.text.newColor + '<div><span class="Active" title="' + localization.tooltips.colors.newColor + '">&nbsp;</span><span class="Current" title="' + localization.tooltips.colors.currentColor + '">&nbsp;</span></div>' + localization.text.currentColor + '</td><td rowspan="9" class="Button"><input type="button" class="Ok" value="' + localization.text.ok + '" title="' + localization.tooltips.buttons.ok + '"/><input type="button" class="Cancel" value="' + localization.text.cancel + '" title="' + localization.tooltips.buttons.cancel + '"/><hr/><div class="Grid">&nbsp;</div></td></tr><tr class="Hue"><td class="Radio"><label title="' + localization.tooltips.hue.radio + '"><input type="radio" value="h"' + (settings.color.mode == 'h' ? ' checked="checked"' : '') + '/>H:</label></td><td class="Text"><input type="text" maxlength="3" value="' + (all != null ? all.h : '') + '" title="' + localization.tooltips.hue.textbox + '"/>&nbsp;&deg;</td></tr><tr class="Saturation"><td class="Radio"><label title="' + localization.tooltips.saturation.radio + '"><input type="radio" value="s"' + (settings.color.mode == 's' ? ' checked="checked"' : '') + '/>S:</label></td><td class="Text"><input type="text" maxlength="3" value="' + (all != null ? all.s : '') + '" title="' + localization.tooltips.saturation.textbox + '"/>&nbsp;%</td></tr><tr class="Value"><td class="Radio"><label title="' + localization.tooltips.value.radio + '"><input type="radio" value="v"' + (settings.color.mode == 'v' ? ' checked="checked"' : '') + '/>V:</label><br/><br/></td><td class="Text"><input type="text" maxlength="3" value="' + (all != null ? all.v : '') + '" title="' + localization.tooltips.value.textbox + '"/>&nbsp;%<br/><br/></td></tr><tr class="Red"><td class="Radio"><label title="' + localization.tooltips.red.radio + '"><input type="radio" value="r"' + (settings.color.mode == 'r' ? ' checked="checked"' : '') + '/>R:</label></td><td class="Text"><input type="text" maxlength="3" value="' + (all != null ? all.r : '') + '" title="' + localization.tooltips.red.textbox + '"/></td></tr><tr class="Green"><td class="Radio"><label title="' + localization.tooltips.green.radio + '"><input type="radio" value="g"' + (settings.color.mode == 'g' ? ' checked="checked"' : '') + '/>G:</label></td><td class="Text"><input type="text" maxlength="3" value="' + (all != null ? all.g : '') + '" title="' + localization.tooltips.green.textbox + '"/></td></tr><tr class="Blue"><td class="Radio"><label title="' + localization.tooltips.blue.radio + '"><input type="radio" value="b"' + (settings.color.mode == 'b' ? ' checked="checked"' : '') + '/>B:</label></td><td class="Text"><input type="text" maxlength="3" value="' + (all != null ? all.b : '') + '" title="' + localization.tooltips.blue.textbox + '"/></td></tr><tr class="Alpha"><td class="Radio">' + (win.alphaSupport ? '<label title="' + localization.tooltips.alpha.radio + '"><input type="radio" value="a"' + (settings.color.mode == 'a' ? ' checked="checked"' : '') + '/>A:</label>' : '&nbsp;') + '</td><td class="Text">' + (win.alphaSupport ? '<input type="text" maxlength="' + (3 + win.alphaPrecision) + '" value="' + (all != null ? Math.precision((all.a * 100) / 255, win.alphaPrecision) : '') + '" title="' + localization.tooltips.alpha.textbox + '"/>&nbsp;%' : '&nbsp;') + '</td></tr><tr class="Hex"><td colspan="2" class="Text"><label title="' + localization.tooltips.hex.textbox + '">#:<input type="text" maxlength="6" class="Hex" value="' + (all != null ? all.hex : '') + '"/></label>' + (win.alphaSupport ? '<input type="text" maxlength="2" class="AHex" value="' + (all != null ? all.ahex.substring(6) : '') + '" title="' + localization.tooltips.hex.alpha + '"/></td>' : '&nbsp;') + '</tr></tbody></table>';
+                if (win.expandable)
+                {
+                  container.html(controlHtml);
+                  if($(document.body).children('div.jPicker.Container').length==0)$(document.body).prepend(container);
+                  else $(document.body).children('div.jPicker.Container:last').after(container);
+                  container.mousedown(
+                    function()
+                    {
+                      $(document.body).children('div.jPicker.Container').css({zIndex:10});
+                      container.css({zIndex:20});
+                    });
+                  container.css( // positions must be set and display set to absolute before source code injection or IE will size the container to fit the window
+                    {
+                      left:
+                        win.position.x == 'left' ? (popup.offset().left - 530 - (win.position.y == 'center' ? 25 : 0)) + 'px' :
+                        win.position.x == 'center' ? (popup.offset().left - 260) + 'px' :
+                        win.position.x == 'right' ? (popup.offset().left - 10 + (win.position.y == 'center' ? 25 : 0)) + 'px' :
+                        win.position.x == 'screenCenter' ? (($(document).width() >> 1) - 260) + 'px' : (popup.offset().left + parseInt(win.position.x)) + 'px',
+                      position: 'absolute',
+                      top: win.position.y == 'top' ? (popup.offset().top - 312) + 'px' :
+                           win.position.y == 'center' ? (popup.offset().top - 156) + 'px' :
+                           win.position.y == 'bottom' ? (popup.offset().top + 25) + 'px' : (popup.offset().top + parseInt(win.position.y)) + 'px'
+                    });
+                }
+                else
+                {
+                  container = $($this);
+                  container.html(controlHtml);
+                }
+                // initialize the objects to the source code just injected
+                var tbody = container.find('tbody:first');
+                colorMapDiv = tbody.find('div.Map:first');
+                colorBarDiv = tbody.find('div.Bar:first');
+                var MapMaps = colorMapDiv.find('span'),
+                    BarMaps = colorBarDiv.find('span');
+                colorMapL1 = MapMaps.filter('.Map1:first');
+                colorMapL2 = MapMaps.filter('.Map2:first');
+                colorMapL3 = MapMaps.filter('.Map3:first');
+                colorBarL1 = BarMaps.filter('.Map1:first');
+                colorBarL2 = BarMaps.filter('.Map2:first');
+                colorBarL3 = BarMaps.filter('.Map3:first');
+                colorBarL4 = BarMaps.filter('.Map4:first');
+                colorBarL5 = BarMaps.filter('.Map5:first');
+                colorBarL6 = BarMaps.filter('.Map6:first');
+                // create color pickers and maps
+                colorMap = new Slider(colorMapDiv,
+                  {
+                    map:
+                    {
+                      width: images.colorMap.width,
+                      height: images.colorMap.height
+                    },
+                    arrow:
+                    {
+                      image: images.clientPath + images.colorMap.arrow.file,
+                      width: images.colorMap.arrow.width,
+                      height: images.colorMap.arrow.height
+                    }
+                  });
+                colorMap.bind(mapValueChanged);
+                colorBar = new Slider(colorBarDiv,
+                  {
+                    map:
+                    {
+                      width: images.colorBar.width,
+                      height: images.colorBar.height
+                    },
+                    arrow:
+                    {
+                      image: images.clientPath + images.colorBar.arrow.file,
+                      width: images.colorBar.arrow.width,
+                      height: images.colorBar.arrow.height
+                    }
+                  });
+                colorBar.bind(colorBarValueChanged);
+                colorPicker = new ColorValuePicker(tbody, color.active, win.expandable && win.bindToInput ? win.input : null, win.alphaPrecision);
+                var hex = all != null ? all.hex : null,
+                    preview = tbody.find('.Preview'),
+                    button = tbody.find('.Button');
+                activePreview = preview.find('.Active:first').css({ backgroundColor: hex && '#' + hex || 'transparent' });
+                currentPreview = preview.find('.Current:first').css({ backgroundColor: hex && '#' + hex || 'transparent' }).bind('click', currentClicked);
+                setAlpha.call($this, currentPreview, Math.precision(color.current.val('a') * 100) / 255, 4);
+                okButton = button.find('.Ok:first').bind('click', okClicked);
+                cancelButton = button.find('.Cancel:first').bind('click', cancelClicked);
+                grid = button.find('.Grid:first');
+                setTimeout(
+                  function()
+                  {
+                    setImg.call($this, colorMapL1, images.clientPath + 'Maps.png');
+                    setImg.call($this, colorMapL2, images.clientPath + 'Maps.png');
+                    setImg.call($this, colorMapL3, images.clientPath + 'map-opacity.png');
+                    setImg.call($this, colorBarL1, images.clientPath + 'Bars.png');
+                    setImg.call($this, colorBarL2, images.clientPath + 'Bars.png');
+                    setImg.call($this, colorBarL3, images.clientPath + 'Bars.png');
+                    setImg.call($this, colorBarL4, images.clientPath + 'Bars.png');
+                    setImg.call($this, colorBarL5, images.clientPath + 'bar-opacity.png');
+                    setImg.call($this, colorBarL6, images.clientPath + 'AlphaBar.png');
+                    setImg.call($this, preview.find('div:first'), images.clientPath + 'preview-opacity.png');
+                  }, 0);
+                tbody.find('td.Radio input').bind('click', radioClicked);
+                // initialize quick list
+                if (color.quickList && color.quickList.length > 0)
+                {
+                  var html = '';
+                  for (i = 0; i < color.quickList.length; i++)
+                  {
+                    /* if default colors are hex strings, change them to color objects */
+                    if ((typeof (color.quickList[i])).toString().toLowerCase() == 'string') color.quickList[i] = new Color({ hex: color.quickList[i] });
+                    var alpha = color.quickList[i].val('a');
+                    var ahex = color.quickList[i].val('ahex');
+                    if (!win.alphaSupport && ahex) ahex = ahex.substring(0, 6) + 'ff';
+                    var quickHex = color.quickList[i].val('hex');
+                    html+='<span class="QuickColor"' + (ahex && ' title="#' + ahex + '"' || '') + ' style="background-color:' + (quickHex && '#' + quickHex || '') + ';' + (quickHex ? '' : 'background-image:url(' + images.clientPath + 'NoColor.png)') + (win.alphaSupport && alpha && alpha < 255 ? ';opacity:' + Math.precision(alpha / 255, 4) + ';filter:Alpha(opacity=' + Math.precision(alpha / 2.55, 4) + ')' : '') + '">&nbsp;</span>';
+                  }
+                  setImg.call($this, grid, images.clientPath + 'bar-opacity.png');
+                  grid.html(html);
+                  grid.find('.QuickColor').click(quickPickClicked);
+                }
+                setColorMode.call($this, settings.color.mode);
+                color.active.bind(activeColorChanged);
+                $.isFunction(liveCallback) && color.active.bind(liveCallback);
+                color.current.bind(currentColorChanged);
+                // bind to input
+                if (win.expandable)
+                {
+                  $this.icon = popup.parents('.Icon:first');
+                  iconColor = $this.icon.find('.Color:first').css({ backgroundColor: hex && '#' + hex || 'transparent' });
+                  iconAlpha = $this.icon.find('.Alpha:first');
+                  setImg.call($this, iconAlpha, images.clientPath + 'bar-opacity.png');
+                  setAlpha.call($this, iconAlpha, Math.precision(((255 - (all != null ? all.a : 0)) * 100) / 255, 4));
+                  iconImage = $this.icon.find('.Image:first').css(
+                    {
+                      backgroundImage: 'url(\'' + images.clientPath + images.picker.file + '\')'
+                    }).bind('click', iconImageClicked);
+                  if (win.bindToInput&&win.updateInputColor)
+                    win.input.css(
+                      {
+                        backgroundColor: hex && '#' + hex || 'transparent',
+                        color: all == null || all.v > 75 ? '#000000' : '#ffffff'
+                      });
+                  moveBar = tbody.find('.Move:first').bind('mousedown', moveBarMouseDown);
+                  color.active.bind(expandableColorChanged);
+                }
+                else show.call($this);
+              },
+            destroy =
+              function()
+              {
+                container.find('td.Radio input').unbind('click', radioClicked);
+                currentPreview.unbind('click', currentClicked);
+                cancelButton.unbind('click', cancelClicked);
+                okButton.unbind('click', okClicked);
+                if (settings.window.expandable)
+                {
+                  iconImage.unbind('click', iconImageClicked);
+                  moveBar.unbind('mousedown', moveBarMouseDown);
+                  $this.icon = null;
+                }
+                container.find('.QuickColor').unbind('click', quickPickClicked);
+                colorMapDiv = null;
+                colorBarDiv = null;
+                colorMapL1 = null;
+                colorMapL2 = null;
+                colorMapL3 = null;
+                colorBarL1 = null;
+                colorBarL2 = null;
+                colorBarL3 = null;
+                colorBarL4 = null;
+                colorBarL5 = null;
+                colorBarL6 = null;
+                colorMap.destroy();
+                colorMap = null;
+                colorBar.destroy();
+                colorBar = null;
+                colorPicker.destroy();
+                colorPicker = null;
+                activePreview = null;
+                currentPreview = null;
+                okButton = null;
+                cancelButton = null;
+                grid = null;
+                commitCallback = null;
+                cancelCallback = null;
+                liveCallback = null;
+                container.html('');
+                for (i = 0; i < List.length; i++) if (List[i] == $this) List.splice(i, 1);
+              },
+            images = settings.images, // local copies for YUI compressor
+            localization = settings.localization,
+            color =
+              {
+                active: (typeof(settings.color.active)).toString().toLowerCase() == 'string' ? new Color({ ahex: !settings.window.alphaSupport && settings.color.active ? settings.color.active.substring(0, 6) + 'ff' : settings.color.active }) : new Color({ ahex: !settings.window.alphaSupport && settings.color.active.val('ahex') ? settings.color.active.val('ahex').substring(0, 6) + 'ff' : settings.color.active.val('ahex') }),
+                current: (typeof(settings.color.active)).toString().toLowerCase() == 'string' ? new Color({ ahex: !settings.window.alphaSupport && settings.color.active ? settings.color.active.substring(0, 6) + 'ff' : settings.color.active }) : new Color({ ahex: !settings.window.alphaSupport && settings.color.active.val('ahex') ? settings.color.active.val('ahex').substring(0, 6) + 'ff' : settings.color.active.val('ahex') }),
+                quickList: settings.color.quickList
+              };
+          $.extend(true, $this, // public properties, methods, and callbacks
+            {
+              commitCallback: commitCallback, // commitCallback function can be overridden to return the selected color to a method you specify when the user clicks "OK"
+              liveCallback: liveCallback, // liveCallback function can be overridden to return the selected color to a method you specify in live mode (continuous update)
+              cancelCallback: cancelCallback, // cancelCallback function can be overridden to a method you specify when the user clicks "Cancel"
+              color: color,
+              show: show,
+              hide: hide,
+              destroy: destroy // destroys this control entirely, removing all events and objects, and removing itself from the List
+            });
+          List.push($this);
+          setTimeout(
+            function()
+            {
+              initialize.call($this);
+            }, 0);
+        });
+    };
+  $.fn.jPicker.defaults = /* jPicker defaults - you can change anything in this section (such as the clientPath to your images) without fear of breaking the program */
+      {
+      window:
+        {
+          title: null, /* any title for the jPicker window itself - displays "Drag Markers To Pick A Color" if left null */
+          effects:
+          {
+            type: 'slide', /* effect used to show/hide an expandable picker. Acceptable values "slide", "show", "fade" */
+            speed:
+            {
+              show: 'slow', /* duration of "show" effect. Acceptable values are "fast", "slow", or time in ms */
+              hide: 'fast' /* duration of "hide" effect. Acceptable values are "fast", "slow", or time in ms */
+            }
+          },
+          position:
+          {
+            x: 'screenCenter', /* acceptable values "left", "center", "right", "screenCenter", or relative px value */
+            y: 'top' /* acceptable values "top", "bottom", "center", or relative px value */
+          },
+          expandable: false, /* default to large static picker - set to true to make an expandable picker (small icon with popup) - set automatically when binded to input element */
+          liveUpdate: true, /* set false if you want the user to have to click "OK" before the binded input box updates values (always "true" for expandable picker) */
+          alphaSupport: false, /* set to true to enable alpha picking */
+          alphaPrecision: 0, /* set decimal precision for alpha percentage display - hex codes do not map directly to percentage integers - range 0-2 */
+          updateInputColor: true /* set to false to prevent binded input colors from changing */
+        },
+      color:
+        {
+          mode: 'h', /* acceptabled values "h" (hue), "s" (saturation), "v" (value), "r" (red), "g" (green), "b" (blue), "a" (alpha) */
+          active: new Color({ ahex: '#ffcc00ff' }), /* acceptable values are any declared $.jPicker.Color object or string HEX value (e.g. #ffc000) WITH OR WITHOUT the "#" prefix */
+          quickList: /* the quick pick color list */
+            [
+              new Color({ h: 360, s: 33, v: 100 }), /* acceptable values are any declared $.jPicker.Color object or string HEX value (e.g. #ffc000) WITH OR WITHOUT the "#" prefix */
+              new Color({ h: 360, s: 66, v: 100 }),
+              new Color({ h: 360, s: 100, v: 100 }),
+              new Color({ h: 360, s: 100, v: 75 }),
+              new Color({ h: 360, s: 100, v: 50 }),
+              new Color({ h: 180, s: 0, v: 100 }),
+              new Color({ h: 30, s: 33, v: 100 }),
+              new Color({ h: 30, s: 66, v: 100 }),
+              new Color({ h: 30, s: 100, v: 100 }),
+              new Color({ h: 30, s: 100, v: 75 }),
+              new Color({ h: 30, s: 100, v: 50 }),
+              new Color({ h: 180, s: 0, v: 90 }),
+              new Color({ h: 60, s: 33, v: 100 }),
+              new Color({ h: 60, s: 66, v: 100 }),
+              new Color({ h: 60, s: 100, v: 100 }),
+              new Color({ h: 60, s: 100, v: 75 }),
+              new Color({ h: 60, s: 100, v: 50 }),
+              new Color({ h: 180, s: 0, v: 80 }),
+              new Color({ h: 90, s: 33, v: 100 }),
+              new Color({ h: 90, s: 66, v: 100 }),
+              new Color({ h: 90, s: 100, v: 100 }),
+              new Color({ h: 90, s: 100, v: 75 }),
+              new Color({ h: 90, s: 100, v: 50 }),
+              new Color({ h: 180, s: 0, v: 70 }),
+              new Color({ h: 120, s: 33, v: 100 }),
+              new Color({ h: 120, s: 66, v: 100 }),
+              new Color({ h: 120, s: 100, v: 100 }),
+              new Color({ h: 120, s: 100, v: 75 }),
+              new Color({ h: 120, s: 100, v: 50 }),
+              new Color({ h: 180, s: 0, v: 60 }),
+              new Color({ h: 150, s: 33, v: 100 }),
+              new Color({ h: 150, s: 66, v: 100 }),
+              new Color({ h: 150, s: 100, v: 100 }),
+              new Color({ h: 150, s: 100, v: 75 }),
+              new Color({ h: 150, s: 100, v: 50 }),
+              new Color({ h: 180, s: 0, v: 50 }),
+              new Color({ h: 180, s: 33, v: 100 }),
+              new Color({ h: 180, s: 66, v: 100 }),
+              new Color({ h: 180, s: 100, v: 100 }),
+              new Color({ h: 180, s: 100, v: 75 }),
+              new Color({ h: 180, s: 100, v: 50 }),
+              new Color({ h: 180, s: 0, v: 40 }),
+              new Color({ h: 210, s: 33, v: 100 }),
+              new Color({ h: 210, s: 66, v: 100 }),
+              new Color({ h: 210, s: 100, v: 100 }),
+              new Color({ h: 210, s: 100, v: 75 }),
+              new Color({ h: 210, s: 100, v: 50 }),
+              new Color({ h: 180, s: 0, v: 30 }),
+              new Color({ h: 240, s: 33, v: 100 }),
+              new Color({ h: 240, s: 66, v: 100 }),
+              new Color({ h: 240, s: 100, v: 100 }),
+              new Color({ h: 240, s: 100, v: 75 }),
+              new Color({ h: 240, s: 100, v: 50 }),
+              new Color({ h: 180, s: 0, v: 20 }),
+              new Color({ h: 270, s: 33, v: 100 }),
+              new Color({ h: 270, s: 66, v: 100 }),
+              new Color({ h: 270, s: 100, v: 100 }),
+              new Color({ h: 270, s: 100, v: 75 }),
+              new Color({ h: 270, s: 100, v: 50 }),
+              new Color({ h: 180, s: 0, v: 10 }),
+              new Color({ h: 300, s: 33, v: 100 }),
+              new Color({ h: 300, s: 66, v: 100 }),
+              new Color({ h: 300, s: 100, v: 100 }),
+              new Color({ h: 300, s: 100, v: 75 }),
+              new Color({ h: 300, s: 100, v: 50 }),
+              new Color({ h: 180, s: 0, v: 0 }),
+              new Color({ h: 330, s: 33, v: 100 }),
+              new Color({ h: 330, s: 66, v: 100 }),
+              new Color({ h: 330, s: 100, v: 100 }),
+              new Color({ h: 330, s: 100, v: 75 }),
+              new Color({ h: 330, s: 100, v: 50 }),
+              new Color()
+            ]
+        },
+      images:
+        {
+          clientPath: '/jPicker/images/', /* Path to image files */
+          colorMap:
+          {
+            width: 256,
+            height: 256,
+            arrow:
+            {
+              file: 'mappoint.gif', /* ColorMap arrow icon */
+              width: 15,
+              height: 15
+            }
+          },
+          colorBar:
+          {
+            width: 20,
+            height: 256,
+            arrow:
+            {
+              file: 'rangearrows.gif', /* ColorBar arrow icon */
+              width: 20,
+              height: 7
+            }
+          },
+          picker:
+          {
+            file: 'picker.gif', /* Color Picker icon */
+            width: 25,
+            height: 24
+          }
+        },
+      localization: /* alter these to change the text presented by the picker (e.g. different language) */
+        {
+          text:
+          {
+            title: 'Drag Markers To Pick A Color',
+            newColor: 'new',
+            currentColor: 'current',
+            ok: 'OK',
+            cancel: 'Cancel'
+          },
+          tooltips:
+          {
+            colors:
+            {
+              newColor: 'New Color - Press &ldquo;OK&rdquo; To Commit',
+              currentColor: 'Click To Revert To Original Color'
+            },
+            buttons:
+            {
+              ok: 'Commit To This Color Selection',
+              cancel: 'Cancel And Revert To Original Color'
+            },
+            hue:
+            {
+              radio: 'Set To &ldquo;Hue&rdquo; Color Mode',
+              textbox: 'Enter A &ldquo;Hue&rdquo; Value (0-360&deg;)'
+            },
+            saturation:
+            {
+              radio: 'Set To &ldquo;Saturation&rdquo; Color Mode',
+              textbox: 'Enter A &ldquo;Saturation&rdquo; Value (0-100%)'
+            },
+            value:
+            {
+              radio: 'Set To &ldquo;Value&rdquo; Color Mode',
+              textbox: 'Enter A &ldquo;Value&rdquo; Value (0-100%)'
+            },
+            red:
+            {
+              radio: 'Set To &ldquo;Red&rdquo; Color Mode',
+              textbox: 'Enter A &ldquo;Red&rdquo; Value (0-255)'
+            },
+            green:
+            {
+              radio: 'Set To &ldquo;Green&rdquo; Color Mode',
+              textbox: 'Enter A &ldquo;Green&rdquo; Value (0-255)'
+            },
+            blue:
+            {
+              radio: 'Set To &ldquo;Blue&rdquo; Color Mode',
+              textbox: 'Enter A &ldquo;Blue&rdquo; Value (0-255)'
+            },
+            alpha:
+            {
+              radio: 'Set To &ldquo;Alpha&rdquo; Color Mode',
+              textbox: 'Enter A &ldquo;Alpha&rdquo; Value (0-100)'
+            },
+            hex:
+            {
+              textbox: 'Enter A &ldquo;Hex&rdquo; Color Value (#000000-#ffffff)',
+              alpha: 'Enter A &ldquo;Alpha&rdquo; Value (#00-#ff)'
+            }
+          }
+        }
+    };
+})(jQuery, '1.1.6');
Index: trunk/prototype/plugins/jpicker/ChangeLog.txt
===================================================================
--- trunk/prototype/plugins/jpicker/ChangeLog.txt	(revision 5341)
+++ trunk/prototype/plugins/jpicker/ChangeLog.txt	(revision 5341)
@@ -0,0 +1,121 @@
+﻿Change Log
+______________
+1.1.6
+  Corrected bug preventing selections inside input values in some browsers - the onselectstart function no longer captures on input boxes.
+  Added support for up/down arrow adjustments of the currently focused input box making the picker more keyboard friendly.
+  Added ticks around the backgroundImage assignments to correct for paths with whitespace.
+
+1.1.5
+  Corrected Color object constructor to allow setting of the "alpha" value as per the documentation which previously didn't work.
+  Added support for translucency for quickList colors with checkered background - Only available if "alphaSupport" is enabled.
+  Restricted default color to "alpha" of 255 if "alphaSupport" is disabled - It will now assign an explicit alpha of 255 when disabled.
+  Added new setting variable "alphaPrecision" which indicates the number of decimal points to allow in the alpha percentage display - Now defaults to 0.
+
+1.1.4
+  Changed "alpha" range from 0-100 to 0-255 to correct truncating and rounding errors caused by attempting to get an integer percentage that matches a hex value.
+  "alpha" percentage display will now show up to 1 decimal point for more accurate representation of "alpha" value.
+  Color object now accepts "alpha" values in a range of 0-255 and also returns the same when getting the "alpha" value. You will need to run ((alpha * 100) / 255) to retrieve a percentage value.
+  Reworked the table layout and labels to remove the need for the label to reference the radio input box. This reduces injected code and removes the need to generate unique ids on the radio buttons.
+  Transparent/invisible caret on NULL color is now corrected - uses the same caret color as a white color.
+  Setting a binded input value of "" or no value attribute will now create a NULL color on initialization instead of the settings default color.
+  Added a dynamic, invisible "iframe" behind a dialog picker in all browsers that fail jQuery.support.boxModel (currently IE <= 7 Quirks Mode). This prevents "select" box from showing through the picker.
+
+1.1.3
+  Now adding popup color pickers to document.body instead of inline with the popup control. This corrects issues with the picker not showing beyond a relative container scope.
+  No longer need to hide popup icon in Internet Explorer for picker elements lower in the DOM than the currently active one since the picker itself is attached to document.body (it is always higher in the DOM now).
+  Popup pickers are now bring-to-front selectable. Clicking on the picker will bring it above all other pickers on the page instead of having to drag one out from underneath another.
+  Corrected jPicker.List/setTimeout bug which allowed an instance to bind to the List in an order other than the order the initialization function was called.
+  Added a updateInputColor option (default true) to allow for a binded input field that does not automatically update its background/text color.
+
+1.1.2
+  Reworked the find methods and contexts for element searches. Now using ":first" instead of ".eq(0)" to take advantage of early out searches. Much faster initialization of the picker, on the order of 6 times.
+  Now using setTimeout for calling visual updates. Dramatically improved marker dragging in all browsers. Reduces blocking as re-rendering is internal to the browser and independent of the other javascript still in progress.
+  Marker updates can now cancel a previous valueChanged event when a new mouseMove event comes in. IE8 marker dragging is still slower, much over 5 times faster than it was.
+  Reworked entire quickPick list creation. It now adds up source code and does a single "html" method instead of multiple "append" methods. This is a large part of the speed increase on initialization.
+  The vast majority of all running scripts on both initialization and dragging is now occupied altering the style rules and finding elements (init only) instead of jPicker code.
+  All methods previously called with global context now use the "call" method for using the context of the class running the method. "this" in a callback is now the DOM node (jQuery style) and jPicker instead of "window".
+  Added "effects" section of window settings to allow different show/hide effects and durations.
+  Removed change log and read me from the full source code to separate files (ChangeLog.txt and ReadMe.txt) and an HTML demonstration/documentation page (Example.txt).
+
+1.1.1
+  Correct IE exception caused by attempting to set "#transparent" to CSS background-color.
+
+1.1.0
+  Reworked nearly the entire plugin including the internal and external event model, bindings, DOM searches, classes, and overall presentation.
+  The Color object now supports a changed event that you can bind to (or just bind to the picker events still included).
+  Event order has been reversed, instead of a change event on the map/bar/text fields updating the display, they now update the Color object which then fires the events that update the display.
+  alphaSupport re-implemented by request - default behavior is off.
+  Hex code now only 6 characters again.
+  Color object can now have its value changed from code, using the "val" method, and it will fire all events necessary to update the display.
+  Removed all "get_*" methods from the color object, instead opting for a single "val" method for getting and setting, more in line with familiar jQuery methods.
+  Better rendering for all IE versions in Quirks mode.
+
+1.0.13
+  Updated transparency algorithm for red/green/blue color modes. The algorithm from John Dyers' color picker was close but incorrect. Bar colors are now pixel perfect with the new algorithm.
+  Changed from using "background-position" on the color maps to an element of full height using the "top" attribute for image-map location using "overflow: hidden" to hide overdraw.
+  IE7/8 ignores opacity on elements taller than 4096px. Image maps therefore no longer include a blank first map so the Bar is just under 4096. Blank is now accomplished by setting the "top" setting to below the map display.
+  New colorBar picker image that does not draw outside of the element since the elements now hide overdraw.
+  Added IE5.5/6 support for the picker. This is why it now uses maps of full height and the "top" attribute for map locations.
+  Moved the images in the maps to 4 pixels apart from each other. IE7/8 change the first pixel of the bottom-border of 2px to partially transparent showing a portion of a different color map without this.
+
+1.0.12
+  Added minified CSS file.
+  Added IE7/8 Quirks Mode support.
+  Added configurable string constants for all text and tooltips. You can now change the default values for different languages.
+  Privatized the RGBA values in the Color object for better NULL handling. YOU MUST USE THE NEW GET FUNCTIONS TO ACCESS THE COLOR PROPERTIES.
+  Better NULL color handling and an additional "No Color Selected" quick pick color.
+  More consistent behavior across multiple versions of browsers.
+  Added alpha response to the binded color picker icon.
+  Removed "alphaSupport" variable. It is now always supported.
+
+1.0.11b
+  Corrected NULL behavior in IE. jQuery was getting an exception when attempting to assign a backgroundColor style of '#'. Now assigns 'transparent' if color is NULL.
+  Can now create new Color object WITH OR WITHOUT the '#' prefix.
+
+1.0.11
+  Added ability for NULL colors (delete the hex value). Color will be returned as color.hex == ''. Can set the default color to an empty hex string as well.
+  cancelCallback now returns the original color for use in programming responses.
+
+1.0.10
+  Corrected table layout and tweaked display for more consisent presentation. Nice catch from Jonathan Pasquier.
+
+1.0.9
+  Added optional title variable for each jPicker window.
+
+1.0.8
+  Moved all images into a few sprites - now using backgroundPosition to change color maps and bars instead of changing the image - this should be faster to download and run.
+   
+1.0.7
+  RENAMED CSS FILE TO INCLUDE VERSION NUMBER!!! YOU MUST USE THIS VERSIONED CSS FILE!!! There will be no need to do your own CSS version number increments from now on.
+  Added opacity feedback to color preview boxes.
+  Removed reliance on "id" value of containing object. Subobjects are now found by class and container instead of id's. This drastically reduces injected code.
+  Removed (jQuery).jPicker.getListElementById(id) function since "id" is no longer incorporated or required.
+
+1.0.6
+  Corrected picker bugs introduced with 1.0.5.
+  Removed alpha slider bar until activated - default behavior for alpha is now OFF.
+  Corrected Color constructor bug not allowing values of 0 for initial value (it was evaluating false and missing the init code - Thanks Pavol).
+  Removed title tags (tooltips) from color maps and bars - They get in the way in some browsers (e.g. IE - dragging marker does NOT prevent or hide the tooltip).
+  THERE WERE CSS FILE CHANGES WITH THIS UPDATE!!! IF YOU USE NEVER-EXPIRE HEADERS, YOU WILL NEED TO INCREMENT YOUR CSS FILE VERSION NUMBER!!!
+
+1.0.5
+  Added opacity support to picker and color/callback methods. New property "a" (alpha - range from 0-100) in all color objects now - defaults to 100% opaque. (Thank you Pavol)
+  Added title attributes to input elements - gives short tooltip directions on what button or field does.
+  Commit callback used to fire on control initialization (twice actually) - This has been corrected, it does not fire on initialization.
+  THERE WERE CSS FILE CHANGES WITH THIS UPDATE!!! IF YOU USE NEVER-EXPIRE HEADERS, YOU WILL NEED TO INCREMENT YOUR CSS FILE VERSION NUMBER!!!
+
+1.0.4
+  Added ability for smaller picker icon with expandable window on any DOM element (not just input).
+  "draggable" property renamed to "expandable" and its scope increased to create small picker icon or large static picker.
+
+1.0.3
+  Added cancelCallback function for registering an external function when user clicks cancel button. (Thank you Jeff and Pavol)
+
+1.0.2
+  Random bug fixes - speed concerns.
+
+1.0.1
+  Corrected closure based memeory leak - there may be others?
+
+1.0.0
+  First Release.
Index: trunk/prototype/plugins/jpicker/jpicker-1.1.6.min.js
===================================================================
--- trunk/prototype/plugins/jpicker/jpicker-1.1.6.min.js	(revision 5341)
+++ trunk/prototype/plugins/jpicker/jpicker-1.1.6.min.js	(revision 5341)
@@ -0,0 +1,1 @@
+﻿(function(e,a){Math.precision=function(j,h){if(h===undefined){h=0}return Math.round(j*Math.pow(10,h))/Math.pow(10,h)};var d=function(z,k){var o=this,j=z.find("img:first"),F=0,E=100,w=100,D=0,C=100,v=100,s=0,p=0,n,q,u=new Array(),l=function(y){for(var x=0;x<u.length;x++){u[x].call(o,o,y)}},H=function(x){var y=z.offset();n={l:y.left|0,t:y.top|0};clearTimeout(q);q=setTimeout(function(){A.call(o,x)},0);e(document).bind("mousemove",h).bind("mouseup",B);x.preventDefault()},h=function(x){clearTimeout(q);q=setTimeout(function(){A.call(o,x)},0);x.stopPropagation();x.preventDefault();return false},B=function(x){e(document).unbind("mouseup",B).unbind("mousemove",h);x.stopPropagation();x.preventDefault();return false},A=function(M){var K=M.pageX-n.l,x=M.pageY-n.t,L=z.w,y=z.h;if(K<0){K=0}else{if(K>L){K=L}}if(x<0){x=0}else{if(x>y){x=y}}J.call(o,"xy",{x:((K/L)*w)+F,y:((x/y)*v)+D})},r=function(){var L=0,x=0,N=z.w,K=z.h,M=j.w,y=j.h;setTimeout(function(){if(w>0){if(s==E){L=N}else{L=((s/w)*N)|0}}if(v>0){if(p==C){x=K}else{x=((p/v)*K)|0}}if(M>=N){L=(N>>1)-(M>>1)}else{L-=M>>1}if(y>=K){x=(K>>1)-(y>>1)}else{x-=y>>1}j.css({left:L+"px",top:x+"px"})},0)},J=function(x,K,y){var O=K!==undefined;if(!O){if(x===undefined||x==null){x="xy"}switch(x.toLowerCase()){case"x":return s;case"y":return p;case"xy":default:return{x:s,y:p}}}if(y!=null&&y==o){return}var N=false,M,L;if(x==null){x="xy"}switch(x.toLowerCase()){case"x":M=K&&(K.x&&K.x|0||K|0)||0;break;case"y":L=K&&(K.y&&K.y|0||K|0)||0;break;case"xy":default:M=K&&K.x&&K.x|0||0;L=K&&K.y&&K.y|0||0;break}if(M!=null){if(M<F){M=F}else{if(M>E){M=E}}if(s!=M){s=M;N=true}}if(L!=null){if(L<D){L=D}else{if(L>C){L=C}}if(p!=L){p=L;N=true}}N&&l.call(o,y||o)},t=function(x,L){var P=L!==undefined;if(!P){if(x===undefined||x==null){x="all"}switch(x.toLowerCase()){case"minx":return F;case"maxx":return E;case"rangex":return{minX:F,maxX:E,rangeX:w};case"miny":return D;case"maxy":return C;case"rangey":return{minY:D,maxY:C,rangeY:v};case"all":default:return{minX:F,maxX:E,rangeX:w,minY:D,maxY:C,rangeY:v}}}var O=false,N,K,M,y;if(x==null){x="all"}switch(x.toLowerCase()){case"minx":N=L&&(L.minX&&L.minX|0||L|0)||0;break;case"maxx":K=L&&(L.maxX&&L.maxX|0||L|0)||0;break;case"rangex":N=L&&L.minX&&L.minX|0||0;K=L&&L.maxX&&L.maxX|0||0;break;case"miny":M=L&&(L.minY&&L.minY|0||L|0)||0;break;case"maxy":y=L&&(L.maxY&&L.maxY|0||L|0)||0;break;case"rangey":M=L&&L.minY&&L.minY|0||0;y=L&&L.maxY&&L.maxY|0||0;break;case"all":default:N=L&&L.minX&&L.minX|0||0;K=L&&L.maxX&&L.maxX|0||0;M=L&&L.minY&&L.minY|0||0;y=L&&L.maxY&&L.maxY|0||0;break}if(N!=null&&F!=N){F=N;w=E-F}if(K!=null&&E!=K){E=K;w=E-F}if(M!=null&&D!=M){D=M;v=C-D}if(y!=null&&C!=y){C=y;v=C-D}},I=function(x){if(e.isFunction(x)){u.push(x)}},m=function(y){if(!e.isFunction(y)){return}var x;while((x=e.inArray(y,u))!=-1){u.splice(x,1)}},G=function(){e(document).unbind("mouseup",B).unbind("mousemove",h);z.unbind("mousedown",H);z=null;j=null;u=null};e.extend(true,o,{val:J,range:t,bind:I,unbind:m,destroy:G});j.src=k.arrow&&k.arrow.image;j.w=k.arrow&&k.arrow.width||j.width();j.h=k.arrow&&k.arrow.height||j.height();z.w=k.map&&k.map.width||z.width();z.h=k.map&&k.map.height||z.height();z.bind("mousedown",H);I.call(o,r)},b=function(u,z,k,y){var q=this,l=u.find("td.Text input"),r=l.eq(3),v=l.eq(4),h=l.eq(5),o=l.length>7?l.eq(6):null,n=l.eq(0),p=l.eq(1),x=l.eq(2),s=l.eq(l.length>7?7:6),B=l.length>7?l.eq(8):null,C=function(E){if(E.target.value==""&&E.target!=s.get(0)&&(k!=null&&E.target!=k.get(0)||k==null)){return}if(!t(E)){return E}switch(E.target){case r.get(0):switch(E.keyCode){case 38:r.val(j.call(q,(r.val()<<0)+1,0,255));z.val("r",r.val(),E.target);return false;case 40:r.val(j.call(q,(r.val()<<0)-1,0,255));z.val("r",r.val(),E.target);return false}break;case v.get(0):switch(E.keyCode){case 38:v.val(j.call(q,(v.val()<<0)+1,0,255));z.val("g",v.val(),E.target);return false;case 40:v.val(j.call(q,(v.val()<<0)-1,0,255));z.val("g",v.val(),E.target);return false}break;case h.get(0):switch(E.keyCode){case 38:h.val(j.call(q,(h.val()<<0)+1,0,255));z.val("b",h.val(),E.target);return false;case 40:h.val(j.call(q,(h.val()<<0)-1,0,255));z.val("b",h.val(),E.target);return false}break;case o&&o.get(0):switch(E.keyCode){case 38:o.val(j.call(q,parseFloat(o.val())+1,0,100));z.val("a",Math.precision((o.val()*255)/100,y),E.target);return false;case 40:o.val(j.call(q,parseFloat(o.val())-1,0,100));z.val("a",Math.precision((o.val()*255)/100,y),E.target);return false}break;case n.get(0):switch(E.keyCode){case 38:n.val(j.call(q,(n.val()<<0)+1,0,360));z.val("h",n.val(),E.target);return false;case 40:n.val(j.call(q,(n.val()<<0)-1,0,360));z.val("h",n.val(),E.target);return false}break;case p.get(0):switch(E.keyCode){case 38:p.val(j.call(q,(p.val()<<0)+1,0,100));z.val("s",p.val(),E.target);return false;case 40:p.val(j.call(q,(p.val()<<0)-1,0,100));z.val("s",p.val(),E.target);return false}break;case x.get(0):switch(E.keyCode){case 38:x.val(j.call(q,(x.val()<<0)+1,0,100));z.val("v",x.val(),E.target);return false;case 40:x.val(j.call(q,(x.val()<<0)-1,0,100));z.val("v",x.val(),E.target);return false}break}},w=function(E){if(E.target.value==""&&E.target!=s.get(0)&&(k!=null&&E.target!=k.get(0)||k==null)){return}if(!t(E)){return E}switch(E.target){case r.get(0):r.val(j.call(q,r.val(),0,255));z.val("r",r.val(),E.target);break;case v.get(0):v.val(j.call(q,v.val(),0,255));z.val("g",v.val(),E.target);break;case h.get(0):h.val(j.call(q,h.val(),0,255));z.val("b",h.val(),E.target);break;case o&&o.get(0):o.val(j.call(q,o.val(),0,100));z.val("a",Math.precision((o.val()*255)/100,y),E.target);break;case n.get(0):n.val(j.call(q,n.val(),0,360));z.val("h",n.val(),E.target);break;case p.get(0):p.val(j.call(q,p.val(),0,100));z.val("s",p.val(),E.target);break;case x.get(0):x.val(j.call(q,x.val(),0,100));z.val("v",x.val(),E.target);break;case s.get(0):s.val(s.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6));k&&k.val(s.val());z.val("hex",s.val()!=""?s.val():null,E.target);break;case k&&k.get(0):k.val(k.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6));s.val(k.val());z.val("hex",k.val()!=""?k.val():null,E.target);break;case B&&B.get(0):B.val(B.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,2));z.val("a",B.val()!=null?parseInt(B.val(),16):null,E.target);break}},A=function(E){if(z.val()!=null){switch(E.target){case r.get(0):r.val(z.val("r"));break;case v.get(0):v.val(z.val("g"));break;case h.get(0):h.val(z.val("b"));break;case o&&o.get(0):o.val(Math.precision((z.val("a")*100)/255,y));break;case n.get(0):n.val(z.val("h"));break;case p.get(0):p.val(z.val("s"));break;case x.get(0):x.val(z.val("v"));break;case s.get(0):case k&&k.get(0):s.val(z.val("hex"));k&&k.val(z.val("hex"));break;case B&&B.get(0):B.val(z.val("ahex").substring(6));break}}},t=function(E){switch(E.keyCode){case 9:case 16:case 29:case 37:case 39:return false;case"c".charCodeAt():case"v".charCodeAt():if(E.ctrlKey){return false}}return true},j=function(G,F,E){if(G==""||isNaN(G)){return F}if(G>E){return E}if(G<F){return F}return G},m=function(G,E){var F=G.val("all");if(E!=r.get(0)){r.val(F!=null?F.r:"")}if(E!=v.get(0)){v.val(F!=null?F.g:"")}if(E!=h.get(0)){h.val(F!=null?F.b:"")}if(o&&E!=o.get(0)){o.val(F!=null?Math.precision((F.a*100)/255,y):"")}if(E!=n.get(0)){n.val(F!=null?F.h:"")}if(E!=p.get(0)){p.val(F!=null?F.s:"")}if(E!=x.get(0)){x.val(F!=null?F.v:"")}if(E!=s.get(0)&&(k&&E!=k.get(0)||!k)){s.val(F!=null?F.hex:"")}if(k&&E!=k.get(0)&&E!=s.get(0)){k.val(F!=null?F.hex:"")}if(B&&E!=B.get(0)){B.val(F!=null?F.ahex.substring(6):"")}},D=function(){r.add(v).add(h).add(o).add(n).add(p).add(x).add(s).add(k).add(B).unbind("keyup",w).unbind("blur",A);r.add(v).add(h).add(o).add(n).add(p).add(x).unbind("keydown",C);z.unbind(m);r=null;v=null;h=null;o=null;n=null;p=null;x=null;s=null;B=null};e.extend(true,q,{destroy:D});r.add(v).add(h).add(o).add(n).add(p).add(x).add(s).add(k).add(B).bind("keyup",w).bind("blur",A);r.add(v).add(h).add(o).add(n).add(p).add(x).bind("keydown",C);z.bind(m)};e.jPicker={List:[],Color:function(z){var q=this,j,o,t,u,n,A,x,k=new Array(),m=function(r){for(var h=0;h<k.length;h++){k[h].call(q,q,r)}},l=function(h,G,r){var F=G!==undefined;if(!F){if(h===undefined||h==null||h==""){h="all"}if(j==null){return null}switch(h.toLowerCase()){case"ahex":return g.rgbaToHex({r:j,g:o,b:t,a:u});case"hex":return l("ahex").substring(0,6);case"all":return{r:j,g:o,b:t,a:u,h:n,s:A,v:x,hex:l.call(q,"hex"),ahex:l.call(q,"ahex")};default:var D={};for(var B=0;B<h.length;B++){switch(h.charAt(B)){case"r":if(h.length==1){D=j}else{D.r=j}break;case"g":if(h.length==1){D=o}else{D.g=o}break;case"b":if(h.length==1){D=t}else{D.b=t}break;case"a":if(h.length==1){D=u}else{D.a=u}break;case"h":if(h.length==1){D=n}else{D.h=n}break;case"s":if(h.length==1){D=A}else{D.s=A}break;case"v":if(h.length==1){D=x}else{D.v=x}break}}return D=={}?l.call(q,"all"):D;break}}if(r!=null&&r==q){return}var v=false;if(h==null){h=""}if(G==null){if(j!=null){j=null;v=true}if(o!=null){o=null;v=true}if(t!=null){t=null;v=true}if(u!=null){u=null;v=true}if(n!=null){n=null;v=true}if(A!=null){A=null;v=true}if(x!=null){x=null;v=true}v&&m.call(q,r||q);return}switch(h.toLowerCase()){case"ahex":case"hex":var D=g.hexToRgba(G&&(G.ahex||G.hex)||G||"00000000");l.call(q,"rgba",{r:D.r,g:D.g,b:D.b,a:h=="ahex"?D.a:u!=null?u:255},r);break;default:if(G&&(G.ahex!=null||G.hex!=null)){l.call(q,"ahex",G.ahex||G.hex||"00000000",r);return}var s={},E=false,C=false;if(G.r!==undefined&&!h.indexOf("r")==-1){h+="r"}if(G.g!==undefined&&!h.indexOf("g")==-1){h+="g"}if(G.b!==undefined&&!h.indexOf("b")==-1){h+="b"}if(G.a!==undefined&&!h.indexOf("a")==-1){h+="a"}if(G.h!==undefined&&!h.indexOf("h")==-1){h+="h"}if(G.s!==undefined&&!h.indexOf("s")==-1){h+="s"}if(G.v!==undefined&&!h.indexOf("v")==-1){h+="v"}for(var B=0;B<h.length;B++){switch(h.charAt(B)){case"r":if(C){continue}E=true;s.r=G&&G.r&&G.r|0||G&&G|0||0;if(s.r<0){s.r=0}else{if(s.r>255){s.r=255}}if(j!=s.r){j=s.r;v=true}break;case"g":if(C){continue}E=true;s.g=G&&G.g&&G.g|0||G&&G|0||0;if(s.g<0){s.g=0}else{if(s.g>255){s.g=255}}if(o!=s.g){o=s.g;v=true}break;case"b":if(C){continue}E=true;s.b=G&&G.b&&G.b|0||G&&G|0||0;if(s.b<0){s.b=0}else{if(s.b>255){s.b=255}}if(t!=s.b){t=s.b;v=true}break;case"a":s.a=G&&G.a!=null?G.a|0:G!=null?G|0:255;if(s.a<0){s.a=0}else{if(s.a>255){s.a=255}}if(u!=s.a){u=s.a;v=true}break;case"h":if(E){continue}C=true;s.h=G&&G.h&&G.h|0||G&&G|0||0;if(s.h<0){s.h=0}else{if(s.h>360){s.h=360}}if(n!=s.h){n=s.h;v=true}break;case"s":if(E){continue}C=true;s.s=G&&G.s!=null?G.s|0:G!=null?G|0:100;if(s.s<0){s.s=0}else{if(s.s>100){s.s=100}}if(A!=s.s){A=s.s;v=true}break;case"v":if(E){continue}C=true;s.v=G&&G.v!=null?G.v|0:G!=null?G|0:100;if(s.v<0){s.v=0}else{if(s.v>100){s.v=100}}if(x!=s.v){x=s.v;v=true}break}}if(v){if(E){j=j||0;o=o||0;t=t||0;var D=g.rgbToHsv({r:j,g:o,b:t});n=D.h;A=D.s;x=D.v}else{if(C){n=n||0;A=A!=null?A:100;x=x!=null?x:100;var D=g.hsvToRgb({h:n,s:A,v:x});j=D.r;o=D.g;t=D.b}}u=u!=null?u:255;m.call(q,r||q)}break}},p=function(h){if(e.isFunction(h)){k.push(h)}},y=function(r){if(!e.isFunction(r)){return}var h;while((h=e.inArray(r,k))!=-1){k.splice(h,1)}},w=function(){k=null};e.extend(true,q,{val:l,bind:p,unbind:y,destroy:w});if(z){if(z.ahex!=null){l("ahex",z)}else{if(z.hex!=null){l((z.a!=null?"a":"")+"hex",z.a!=null?{ahex:z.hex+g.intToHex(z.a)}:z)}else{if(z.r!=null&&z.g!=null&&z.b!=null){l("rgb"+(z.a!=null?"a":""),z)}else{if(z.h!=null&&z.s!=null&&z.v!=null){l("hsv"+(z.a!=null?"a":""),z)}}}}}},ColorMethods:{hexToRgba:function(m){m=this.validateHex(m);if(m==""){return{r:null,g:null,b:null,a:null}}var l="00",k="00",h="00",j="255";if(m.length==6){m+="ff"}if(m.length>6){l=m.substring(0,2);k=m.substring(2,4);h=m.substring(4,6);j=m.substring(6,m.length)}else{if(m.length>4){l=m.substring(4,m.length);m=m.substring(0,4)}if(m.length>2){k=m.substring(2,m.length);m=m.substring(0,2)}if(m.length>0){h=m.substring(0,m.length)}}return{r:this.hexToInt(l),g:this.hexToInt(k),b:this.hexToInt(h),a:this.hexToInt(j)}},validateHex:function(h){h=h.toLowerCase().replace(/[^a-f0-9]/g,"");if(h.length>8){h=h.substring(0,8)}return h},rgbaToHex:function(h){return this.intToHex(h.r)+this.intToHex(h.g)+this.intToHex(h.b)+this.intToHex(h.a)},intToHex:function(j){var h=(j|0).toString(16);if(h.length==1){h=("0"+h)}return h.toLowerCase()},hexToInt:function(h){return parseInt(h,16)},rgbToHsv:function(l){var o=l.r/255,n=l.g/255,j=l.b/255,k={h:0,s:0,v:0},m=0,h=0,p;if(o>=n&&o>=j){h=o;m=n>j?j:n}else{if(n>=j&&n>=o){h=n;m=o>j?j:o}else{h=j;m=n>o?o:n}}k.v=h;k.s=h?(h-m)/h:0;if(!k.s){k.h=0}else{p=h-m;if(o==h){k.h=(n-j)/p}else{if(n==h){k.h=2+(j-o)/p}else{k.h=4+(o-n)/p}}k.h=parseInt(k.h*60);if(k.h<0){k.h+=360}}k.s=(k.s*100)|0;k.v=(k.v*100)|0;return k},hsvToRgb:function(n){var r={r:0,g:0,b:0,a:100},m=n.h,x=n.s,u=n.v;if(x==0){if(u==0){r.r=r.g=r.b=0}else{r.r=r.g=r.b=(u*255/100)|0}}else{if(m==360){m=0}m/=60;x=x/100;u=u/100;var l=m|0,o=m-l,k=u*(1-x),j=u*(1-(x*o)),w=u*(1-(x*(1-o)));switch(l){case 0:r.r=u;r.g=w;r.b=k;break;case 1:r.r=j;r.g=u;r.b=k;break;case 2:r.r=k;r.g=u;r.b=w;break;case 3:r.r=k;r.g=j;r.b=u;break;case 4:r.r=w;r.g=k;r.b=u;break;case 5:r.r=u;r.g=k;r.b=j;break}r.r=(r.r*255)|0;r.g=(r.g*255)|0;r.b=(r.b*255)|0}return r}}};var f=e.jPicker.Color,c=e.jPicker.List,g=e.jPicker.ColorMethods;e.fn.jPicker=function(j){var h=arguments;return this.each(function(){var w=this,av=e.extend(true,{},e.fn.jPicker.defaults,j);if(e(w).get(0).nodeName.toLowerCase()=="input"){e.extend(true,av,{window:{bindToInput:true,expandable:true,input:e(w)}});if(e(w).val()==""){av.color.active=new f({hex:null});av.color.current=new f({hex:null})}else{if(g.validateHex(e(w).val())){av.color.active=new f({hex:e(w).val(),a:av.color.active.val("a")});av.color.current=new f({hex:e(w).val(),a:av.color.active.val("a")})}}}if(av.window.expandable){e(w).after('<span class="jPicker"><span class="Icon"><span class="Color">&nbsp;</span><span class="Alpha">&nbsp;</span><span class="Image" title="Click To Open Color Picker">&nbsp;</span><span class="Container">&nbsp;</span></span></span>')}else{av.window.liveUpdate=false}var Q=parseFloat(navigator.appVersion.split("MSIE")[1])<7&&document.body.filters,R=null,l=null,s=null,au=null,at=null,ar=null,P=null,O=null,N=null,M=null,L=null,K=null,D=null,U=null,aw=null,J=null,I=null,am=null,ai=null,E=null,an=null,ah=null,X=null,ab=null,aq=null,r=null,C=null,u=null,ag=function(aB){var aD=G.active,aE=n.clientPath,aA=aD.val("hex"),aC,az;av.color.mode=aB;switch(aB){case"h":setTimeout(function(){y.call(w,l,"transparent");x.call(w,au,0);Y.call(w,au,100);x.call(w,at,260);Y.call(w,at,100);y.call(w,s,"transparent");x.call(w,P,0);Y.call(w,P,100);x.call(w,O,260);Y.call(w,O,100);x.call(w,N,260);Y.call(w,N,100);x.call(w,M,260);Y.call(w,M,100);x.call(w,K,260);Y.call(w,K,100)},0);D.range("all",{minX:0,maxX:100,minY:0,maxY:100});U.range("rangeY",{minY:0,maxY:360});if(aD.val("ahex")==null){break}D.val("xy",{x:aD.val("s"),y:100-aD.val("v")},D);U.val("y",360-aD.val("h"),U);break;case"s":setTimeout(function(){y.call(w,l,"transparent");x.call(w,au,-260);x.call(w,at,-520);x.call(w,P,-260);x.call(w,O,-520);x.call(w,K,260);Y.call(w,K,100)},0);D.range("all",{minX:0,maxX:360,minY:0,maxY:100});U.range("rangeY",{minY:0,maxY:100});if(aD.val("ahex")==null){break}D.val("xy",{x:aD.val("h"),y:100-aD.val("v")},D);U.val("y",100-aD.val("s"),U);break;case"v":setTimeout(function(){y.call(w,l,"000000");x.call(w,au,-780);x.call(w,at,260);y.call(w,s,aA);x.call(w,P,-520);x.call(w,O,260);Y.call(w,O,100);x.call(w,K,260);Y.call(w,K,100)},0);D.range("all",{minX:0,maxX:360,minY:0,maxY:100});U.range("rangeY",{minY:0,maxY:100});if(aD.val("ahex")==null){break}D.val("xy",{x:aD.val("h"),y:100-aD.val("s")},D);U.val("y",100-aD.val("v"),U);break;case"r":aC=-1040;az=-780;D.range("all",{minX:0,maxX:255,minY:0,maxY:255});U.range("rangeY",{minY:0,maxY:255});if(aD.val("ahex")==null){break}D.val("xy",{x:aD.val("b"),y:255-aD.val("g")},D);U.val("y",255-aD.val("r"),U);break;case"g":aC=-1560;az=-1820;D.range("all",{minX:0,maxX:255,minY:0,maxY:255});U.range("rangeY",{minY:0,maxY:255});if(aD.val("ahex")==null){break}D.val("xy",{x:aD.val("b"),y:255-aD.val("r")},D);U.val("y",255-aD.val("g"),U);break;case"b":aC=-2080;az=-2860;D.range("all",{minX:0,maxX:255,minY:0,maxY:255});U.range("rangeY",{minY:0,maxY:255});if(aD.val("ahex")==null){break}D.val("xy",{x:aD.val("r"),y:255-aD.val("g")},D);U.val("y",255-aD.val("b"),U);break;case"a":setTimeout(function(){y.call(w,l,"transparent");x.call(w,au,-260);x.call(w,at,-520);x.call(w,P,260);x.call(w,O,260);Y.call(w,O,100);x.call(w,K,0);Y.call(w,K,100)},0);D.range("all",{minX:0,maxX:360,minY:0,maxY:100});U.range("rangeY",{minY:0,maxY:255});if(aD.val("ahex")==null){break}D.val("xy",{x:aD.val("h"),y:100-aD.val("v")},D);U.val("y",255-aD.val("a"),U);break;default:throw ("Invalid Mode");break}switch(aB){case"h":break;case"s":case"v":case"a":setTimeout(function(){Y.call(w,au,100);Y.call(w,P,100);x.call(w,N,260);Y.call(w,N,100);x.call(w,M,260);Y.call(w,M,100)},0);break;case"r":case"g":case"b":setTimeout(function(){y.call(w,l,"transparent");y.call(w,s,"transparent");Y.call(w,P,100);Y.call(w,au,100);x.call(w,au,aC);x.call(w,at,aC-260);x.call(w,P,az-780);x.call(w,O,az-520);x.call(w,N,az);x.call(w,M,az-260);x.call(w,K,260);Y.call(w,K,100)},0);break}if(aD.val("ahex")==null){return}aj.call(w,aD)},aj=function(aA,az){if(az==null||(az!=U&&az!=D)){v.call(w,aA,az)}setTimeout(function(){ay.call(w,aA);al.call(w,aA);W.call(w,aA)},0)},z=function(aA,az){var aC=G.active;if(az!=D&&aC.val()==null){return}var aB=aA.val("all");switch(av.color.mode){case"h":aC.val("sv",{s:aB.x,v:100-aB.y},az);break;case"s":case"a":aC.val("hv",{h:aB.x,v:100-aB.y},az);break;case"v":aC.val("hs",{h:aB.x,s:100-aB.y},az);break;case"r":aC.val("gb",{g:255-aB.y,b:aB.x},az);break;case"g":aC.val("rb",{r:255-aB.y,b:aB.x},az);break;case"b":aC.val("rg",{r:aB.x,g:255-aB.y},az);break}},ac=function(aA,az){var aB=G.active;if(az!=U&&aB.val()==null){return}switch(av.color.mode){case"h":aB.val("h",{h:360-aA.val("y")},az);break;case"s":aB.val("s",{s:100-aA.val("y")},az);break;case"v":aB.val("v",{v:100-aA.val("y")},az);break;case"r":aB.val("r",{r:255-aA.val("y")},az);break;case"g":aB.val("g",{g:255-aA.val("y")},az);break;case"b":aB.val("b",{b:255-aA.val("y")},az);break;case"a":aB.val("a",255-aA.val("y"),az);break}},v=function(aC,az){if(az!=D){switch(av.color.mode){case"h":var aH=aC.val("sv");D.val("xy",{x:aH!=null?aH.s:100,y:100-(aH!=null?aH.v:100)},az);break;case"s":case"a":var aB=aC.val("hv");D.val("xy",{x:aB&&aB.h||0,y:100-(aB!=null?aB.v:100)},az);break;case"v":var aE=aC.val("hs");D.val("xy",{x:aE&&aE.h||0,y:100-(aE!=null?aE.s:100)},az);break;case"r":var aA=aC.val("bg");D.val("xy",{x:aA&&aA.b||0,y:255-(aA&&aA.g||0)},az);break;case"g":var aI=aC.val("br");D.val("xy",{x:aI&&aI.b||0,y:255-(aI&&aI.r||0)},az);break;case"b":var aG=aC.val("rg");D.val("xy",{x:aG&&aG.r||0,y:255-(aG&&aG.g||0)},az);break}}if(az!=U){switch(av.color.mode){case"h":U.val("y",360-(aC.val("h")||0),az);break;case"s":var aJ=aC.val("s");U.val("y",100-(aJ!=null?aJ:100),az);break;case"v":var aF=aC.val("v");U.val("y",100-(aF!=null?aF:100),az);break;case"r":U.val("y",255-(aC.val("r")||0),az);break;case"g":U.val("y",255-(aC.val("g")||0),az);break;case"b":U.val("y",255-(aC.val("b")||0),az);break;case"a":var aD=aC.val("a");U.val("y",255-(aD!=null?aD:255),az);break}}},ay=function(aA){try{var az=aA.val("all");E.css({backgroundColor:az&&"#"+az.hex||"transparent"});Y.call(w,E,az&&Math.precision((az.a*100)/255,4)||0)}catch(aB){}},al=function(aC){switch(av.color.mode){case"h":y.call(w,l,new f({h:aC.val("h")||0,s:100,v:100}).val("hex"));break;case"s":case"a":var aB=aC.val("s");Y.call(w,at,100-(aB!=null?aB:100));break;case"v":var aA=aC.val("v");Y.call(w,au,aA!=null?aA:100);break;case"r":Y.call(w,at,Math.precision((aC.val("r")||0)/255*100,4));break;case"g":Y.call(w,at,Math.precision((aC.val("g")||0)/255*100,4));break;case"b":Y.call(w,at,Math.precision((aC.val("b")||0)/255*100));break}var az=aC.val("a");Y.call(w,ar,Math.precision(((255-(az||0))*100)/255,4))},W=function(aF){switch(av.color.mode){case"h":var aH=aF.val("a");Y.call(w,L,Math.precision(((255-(aH||0))*100)/255,4));break;case"s":var aA=aF.val("hva"),aB=new f({h:aA&&aA.h||0,s:100,v:aA!=null?aA.v:100});y.call(w,s,aB.val("hex"));Y.call(w,O,100-(aA!=null?aA.v:100));Y.call(w,L,Math.precision(((255-(aA&&aA.a||0))*100)/255,4));break;case"v":var aC=aF.val("hsa"),aE=new f({h:aC&&aC.h||0,s:aC!=null?aC.s:100,v:100});y.call(w,s,aE.val("hex"));Y.call(w,L,Math.precision(((255-(aC&&aC.a||0))*100)/255,4));break;case"r":case"g":case"b":var aD=0,aG=0,az=aF.val("rgba");if(av.color.mode=="r"){aD=az&&az.b||0;aG=az&&az.g||0}else{if(av.color.mode=="g"){aD=az&&az.b||0;aG=az&&az.r||0}else{if(av.color.mode=="b"){aD=az&&az.r||0;aG=az&&az.g||0}}}var aI=aG>aD?aD:aG;Y.call(w,O,aD>aG?Math.precision(((aD-aG)/(255-aG))*100,4):0);Y.call(w,N,aG>aD?Math.precision(((aG-aD)/(255-aD))*100,4):0);Y.call(w,M,Math.precision((aI/255)*100,4));Y.call(w,L,Math.precision(((255-(az&&az.a||0))*100)/255,4));break;case"a":var aH=aF.val("a");y.call(w,s,aF.val("hex")||"000000");Y.call(w,L,aH!=null?0:100);Y.call(w,K,aH!=null?100:0);break}},y=function(az,aA){az.css({backgroundColor:aA&&aA.length==6&&"#"+aA||"transparent"})},t=function(az,aA){if(Q&&(aA.indexOf("AlphaBar.png")!=-1||aA.indexOf("Bars.png")!=-1||aA.indexOf("Maps.png")!=-1)){az.attr("pngSrc",aA);az.css({backgroundImage:"none",filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+aA+"', sizingMethod='scale')"})}else{az.css({backgroundImage:"url('"+aA+"')"})}},x=function(az,aA){az.css({top:aA+"px"})},Y=function(aA,az){aA.css({visibility:az>0?"visible":"hidden"});if(az>0&&az<100){if(Q){var aB=aA.attr("pngSrc");if(aB!=null&&(aB.indexOf("AlphaBar.png")!=-1||aB.indexOf("Bars.png")!=-1||aB.indexOf("Maps.png")!=-1)){aA.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+aB+"', sizingMethod='scale') progid:DXImageTransform.Microsoft.Alpha(opacity="+az+")"})}else{aA.css({opacity:Math.precision(az/100,4)})}}else{aA.css({opacity:Math.precision(az/100,4)})}}else{if(az==0||az==100){if(Q){var aB=aA.attr("pngSrc");if(aB!=null&&(aB.indexOf("AlphaBar.png")!=-1||aB.indexOf("Bars.png")!=-1||aB.indexOf("Maps.png")!=-1)){aA.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+aB+"', sizingMethod='scale')"})}else{aA.css({opacity:""})}}else{aA.css({opacity:""})}}}},B=function(){G.active.val("ahex",G.current.val("ahex"))},T=function(){G.current.val("ahex",G.active.val("ahex"))},A=function(az){e(this).parents("tbody:first").find('input:radio[value!="'+az.target.value+'"]').removeAttr("checked");ag.call(w,az.target.value)},Z=function(){B.call(w)},q=function(){B.call(w);av.window.expandable&&ao.call(w);e.isFunction(ax)&&ax.call(w,G.active,X)},m=function(){T.call(w);av.window.expandable&&ao.call(w);e.isFunction(ae)&&ae.call(w,G.active,ah)},af=function(){V.call(w)},ap=function(aB,az){var aA=aB.val("hex");an.css({backgroundColor:aA&&"#"+aA||"transparent"});Y.call(w,an,Math.precision(((aB.val("a")||0)*100)/255,4))},H=function(aC,az){var aB=aC.val("hex");var aA=aC.val("va");aq.css({backgroundColor:aB&&"#"+aB||"transparent"});Y.call(w,r,Math.precision(((255-(aA&&aA.a||0))*100)/255,4));if(av.window.bindToInput&&av.window.updateInputColor){av.window.input.css({backgroundColor:aB&&"#"+aB||"transparent",color:aA==null||aA.v>75?"#000000":"#ffffff"})}},S=function(aB){var az=av.window.element,aA=av.window.page;J=parseInt(R.css("left"));I=parseInt(R.css("top"));am=aB.pageX;ai=aB.pageY;e(document).bind("mousemove",k).bind("mouseup",p);aB.preventDefault()},k=function(az){R.css({left:J-(am-az.pageX)+"px",top:I-(ai-az.pageY)+"px"});if(av.window.expandable&&!e.support.boxModel){R.prev().css({left:R.css("left"),top:R.css("top")})}az.stopPropagation();az.preventDefault();return false},p=function(az){e(document).unbind("mousemove",k).unbind("mouseup",p);az.stopPropagation();az.preventDefault();return false},F=function(az){az.preventDefault();az.stopPropagation();G.active.val("ahex",e(this).attr("title")||null,az.target);return false},ae=e.isFunction(h[1])&&h[1]||null,ad=e.isFunction(h[2])&&h[2]||null,ax=e.isFunction(h[3])&&h[3]||null,V=function(){G.current.val("ahex",G.active.val("ahex"));var az=function(){if(!av.window.expandable||e.support.boxModel){return}var aA=R.find("table:first");R.before("<iframe/>");R.prev().css({width:aA.width(),height:R.height(),opacity:0,position:"absolute",left:R.css("left"),top:R.css("top")})};if(av.window.expandable){e(document.body).children("div.jPicker.Container").css({zIndex:10});R.css({zIndex:20})}switch(av.window.effects.type){case"fade":R.fadeIn(av.window.effects.speed.show,az);break;case"slide":R.slideDown(av.window.effects.speed.show,az);break;case"show":default:R.show(av.window.effects.speed.show,az);break}},ao=function(){var az=function(){if(av.window.expandable){R.css({zIndex:10})}if(!av.window.expandable||e.support.boxModel){return}R.prev().remove()};switch(av.window.effects.type){case"fade":R.fadeOut(av.window.effects.speed.hide,az);break;case"slide":R.slideUp(av.window.effects.speed.hide,az);break;case"show":default:R.hide(av.window.effects.speed.hide,az);break}},o=function(){var aG=av.window,az=aG.expandable?e(w).next().find(".Container:first"):null;R=aG.expandable?e("<div/>"):e(w);R.addClass("jPicker Container");if(aG.expandable){R.hide()}R.get(0).onselectstart=function(aN){if(aN.target.nodeName.toLowerCase()!=="input"){return false}};var aJ=G.active.val("all");if(aG.alphaPrecision<0){aG.alphaPrecision=0}else{if(aG.alphaPrecision>2){aG.alphaPrecision=2}}var aK='<table class="jPicker" cellpadding="0" cellspacing="0"><tbody>'+(aG.expandable?'<tr><td class="Move" colspan="5">&nbsp;</td></tr>':"")+'<tr><td rowspan="9"><h2 class="Title">'+(aG.title||aa.text.title)+'</h2><div class="Map"><span class="Map1">&nbsp;</span><span class="Map2">&nbsp;</span><span class="Map3">&nbsp;</span><img src="'+n.clientPath+n.colorMap.arrow.file+'" class="Arrow"/></div></td><td rowspan="9"><div class="Bar"><span class="Map1">&nbsp;</span><span class="Map2">&nbsp;</span><span class="Map3">&nbsp;</span><span class="Map4">&nbsp;</span><span class="Map5">&nbsp;</span><span class="Map6">&nbsp;</span><img src="'+n.clientPath+n.colorBar.arrow.file+'" class="Arrow"/></div></td><td colspan="2" class="Preview">'+aa.text.newColor+'<div><span class="Active" title="'+aa.tooltips.colors.newColor+'">&nbsp;</span><span class="Current" title="'+aa.tooltips.colors.currentColor+'">&nbsp;</span></div>'+aa.text.currentColor+'</td><td rowspan="9" class="Button"><input type="button" class="Ok" value="'+aa.text.ok+'" title="'+aa.tooltips.buttons.ok+'"/><input type="button" class="Cancel" value="'+aa.text.cancel+'" title="'+aa.tooltips.buttons.cancel+'"/><hr/><div class="Grid">&nbsp;</div></td></tr><tr class="Hue"><td class="Radio"><label title="'+aa.tooltips.hue.radio+'"><input type="radio" value="h"'+(av.color.mode=="h"?' checked="checked"':"")+'/>H:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(aJ!=null?aJ.h:"")+'" title="'+aa.tooltips.hue.textbox+'"/>&nbsp;&deg;</td></tr><tr class="Saturation"><td class="Radio"><label title="'+aa.tooltips.saturation.radio+'"><input type="radio" value="s"'+(av.color.mode=="s"?' checked="checked"':"")+'/>S:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(aJ!=null?aJ.s:"")+'" title="'+aa.tooltips.saturation.textbox+'"/>&nbsp;%</td></tr><tr class="Value"><td class="Radio"><label title="'+aa.tooltips.value.radio+'"><input type="radio" value="v"'+(av.color.mode=="v"?' checked="checked"':"")+'/>V:</label><br/><br/></td><td class="Text"><input type="text" maxlength="3" value="'+(aJ!=null?aJ.v:"")+'" title="'+aa.tooltips.value.textbox+'"/>&nbsp;%<br/><br/></td></tr><tr class="Red"><td class="Radio"><label title="'+aa.tooltips.red.radio+'"><input type="radio" value="r"'+(av.color.mode=="r"?' checked="checked"':"")+'/>R:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(aJ!=null?aJ.r:"")+'" title="'+aa.tooltips.red.textbox+'"/></td></tr><tr class="Green"><td class="Radio"><label title="'+aa.tooltips.green.radio+'"><input type="radio" value="g"'+(av.color.mode=="g"?' checked="checked"':"")+'/>G:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(aJ!=null?aJ.g:"")+'" title="'+aa.tooltips.green.textbox+'"/></td></tr><tr class="Blue"><td class="Radio"><label title="'+aa.tooltips.blue.radio+'"><input type="radio" value="b"'+(av.color.mode=="b"?' checked="checked"':"")+'/>B:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(aJ!=null?aJ.b:"")+'" title="'+aa.tooltips.blue.textbox+'"/></td></tr><tr class="Alpha"><td class="Radio">'+(aG.alphaSupport?'<label title="'+aa.tooltips.alpha.radio+'"><input type="radio" value="a"'+(av.color.mode=="a"?' checked="checked"':"")+"/>A:</label>":"&nbsp;")+'</td><td class="Text">'+(aG.alphaSupport?'<input type="text" maxlength="'+(3+aG.alphaPrecision)+'" value="'+(aJ!=null?Math.precision((aJ.a*100)/255,aG.alphaPrecision):"")+'" title="'+aa.tooltips.alpha.textbox+'"/>&nbsp;%':"&nbsp;")+'</td></tr><tr class="Hex"><td colspan="2" class="Text"><label title="'+aa.tooltips.hex.textbox+'">#:<input type="text" maxlength="6" class="Hex" value="'+(aJ!=null?aJ.hex:"")+'"/></label>'+(aG.alphaSupport?'<input type="text" maxlength="2" class="AHex" value="'+(aJ!=null?aJ.ahex.substring(6):"")+'" title="'+aa.tooltips.hex.alpha+'"/></td>':"&nbsp;")+"</tr></tbody></table>";if(aG.expandable){R.html(aK);if(e(document.body).children("div.jPicker.Container").length==0){e(document.body).prepend(R)}else{e(document.body).children("div.jPicker.Container:last").after(R)}R.mousedown(function(){e(document.body).children("div.jPicker.Container").css({zIndex:10});R.css({zIndex:20})});R.css({left:aG.position.x=="left"?(az.offset().left-530-(aG.position.y=="center"?25:0))+"px":aG.position.x=="center"?(az.offset().left-260)+"px":aG.position.x=="right"?(az.offset().left-10+(aG.position.y=="center"?25:0))+"px":aG.position.x=="screenCenter"?((e(document).width()>>1)-260)+"px":(az.offset().left+parseInt(aG.position.x))+"px",position:"absolute",top:aG.position.y=="top"?(az.offset().top-312)+"px":aG.position.y=="center"?(az.offset().top-156)+"px":aG.position.y=="bottom"?(az.offset().top+25)+"px":(az.offset().top+parseInt(aG.position.y))+"px"})}else{R=e(w);R.html(aK)}var aD=R.find("tbody:first");l=aD.find("div.Map:first");s=aD.find("div.Bar:first");var aL=l.find("span"),aI=s.find("span");au=aL.filter(".Map1:first");at=aL.filter(".Map2:first");ar=aL.filter(".Map3:first");P=aI.filter(".Map1:first");O=aI.filter(".Map2:first");N=aI.filter(".Map3:first");M=aI.filter(".Map4:first");L=aI.filter(".Map5:first");K=aI.filter(".Map6:first");D=new d(l,{map:{width:n.colorMap.width,height:n.colorMap.height},arrow:{image:n.clientPath+n.colorMap.arrow.file,width:n.colorMap.arrow.width,height:n.colorMap.arrow.height}});D.bind(z);U=new d(s,{map:{width:n.colorBar.width,height:n.colorBar.height},arrow:{image:n.clientPath+n.colorBar.arrow.file,width:n.colorBar.arrow.width,height:n.colorBar.arrow.height}});U.bind(ac);aw=new b(aD,G.active,aG.expandable&&aG.bindToInput?aG.input:null,aG.alphaPrecision);var aB=aJ!=null?aJ.hex:null,aH=aD.find(".Preview"),aF=aD.find(".Button");E=aH.find(".Active:first").css({backgroundColor:aB&&"#"+aB||"transparent"});an=aH.find(".Current:first").css({backgroundColor:aB&&"#"+aB||"transparent"}).bind("click",Z);Y.call(w,an,Math.precision(G.current.val("a")*100)/255,4);ah=aF.find(".Ok:first").bind("click",m);X=aF.find(".Cancel:first").bind("click",q);ab=aF.find(".Grid:first");setTimeout(function(){t.call(w,au,n.clientPath+"Maps.png");t.call(w,at,n.clientPath+"Maps.png");t.call(w,ar,n.clientPath+"map-opacity.png");t.call(w,P,n.clientPath+"Bars.png");t.call(w,O,n.clientPath+"Bars.png");t.call(w,N,n.clientPath+"Bars.png");t.call(w,M,n.clientPath+"Bars.png");t.call(w,L,n.clientPath+"bar-opacity.png");t.call(w,K,n.clientPath+"AlphaBar.png");t.call(w,aH.find("div:first"),n.clientPath+"preview-opacity.png")},0);aD.find("td.Radio input").bind("click",A);if(G.quickList&&G.quickList.length>0){var aE="";for(i=0;i<G.quickList.length;i++){if((typeof(G.quickList[i])).toString().toLowerCase()=="string"){G.quickList[i]=new f({hex:G.quickList[i]})}var aC=G.quickList[i].val("a");var aM=G.quickList[i].val("ahex");if(!aG.alphaSupport&&aM){aM=aM.substring(0,6)+"ff"}var aA=G.quickList[i].val("hex");aE+='<span class="QuickColor"'+(aM&&' title="#'+aM+'"'||"")+' style="background-color:'+(aA&&"#"+aA||"")+";"+(aA?"":"background-image:url("+n.clientPath+"NoColor.png)")+(aG.alphaSupport&&aC&&aC<255?";opacity:"+Math.precision(aC/255,4)+";filter:Alpha(opacity="+Math.precision(aC/2.55,4)+")":"")+'">&nbsp;</span>'}t.call(w,ab,n.clientPath+"bar-opacity.png");ab.html(aE);ab.find(".QuickColor").click(F)}ag.call(w,av.color.mode);G.active.bind(aj);e.isFunction(ad)&&G.active.bind(ad);G.current.bind(ap);if(aG.expandable){w.icon=az.parents(".Icon:first");aq=w.icon.find(".Color:first").css({backgroundColor:aB&&"#"+aB||"transparent"});r=w.icon.find(".Alpha:first");t.call(w,r,n.clientPath+"bar-opacity.png");Y.call(w,r,Math.precision(((255-(aJ!=null?aJ.a:0))*100)/255,4));C=w.icon.find(".Image:first").css({backgroundImage:"url('"+n.clientPath+n.picker.file+"')"}).bind("click",af);if(aG.bindToInput&&aG.updateInputColor){aG.input.css({backgroundColor:aB&&"#"+aB||"transparent",color:aJ==null||aJ.v>75?"#000000":"#ffffff"})}u=aD.find(".Move:first").bind("mousedown",S);G.active.bind(H)}else{V.call(w)}},ak=function(){R.find("td.Radio input").unbind("click",A);an.unbind("click",Z);X.unbind("click",q);ah.unbind("click",m);if(av.window.expandable){C.unbind("click",af);u.unbind("mousedown",S);w.icon=null}R.find(".QuickColor").unbind("click",F);l=null;s=null;au=null;at=null;ar=null;P=null;O=null;N=null;M=null;L=null;K=null;D.destroy();D=null;U.destroy();U=null;aw.destroy();aw=null;E=null;an=null;ah=null;X=null;ab=null;ae=null;ax=null;ad=null;R.html("");for(i=0;i<c.length;i++){if(c[i]==w){c.splice(i,1)}}},n=av.images,aa=av.localization,G={active:(typeof(av.color.active)).toString().toLowerCase()=="string"?new f({ahex:!av.window.alphaSupport&&av.color.active?av.color.active.substring(0,6)+"ff":av.color.active}):new f({ahex:!av.window.alphaSupport&&av.color.active.val("ahex")?av.color.active.val("ahex").substring(0,6)+"ff":av.color.active.val("ahex")}),current:(typeof(av.color.active)).toString().toLowerCase()=="string"?new f({ahex:!av.window.alphaSupport&&av.color.active?av.color.active.substring(0,6)+"ff":av.color.active}):new f({ahex:!av.window.alphaSupport&&av.color.active.val("ahex")?av.color.active.val("ahex").substring(0,6)+"ff":av.color.active.val("ahex")}),quickList:av.color.quickList};e.extend(true,w,{commitCallback:ae,liveCallback:ad,cancelCallback:ax,color:G,show:V,hide:ao,destroy:ak});c.push(w);setTimeout(function(){o.call(w)},0)})};e.fn.jPicker.defaults={window:{title:null,effects:{type:"slide",speed:{show:"slow",hide:"fast"}},position:{x:"screenCenter",y:"top"},expandable:false,liveUpdate:true,alphaSupport:false,alphaPrecision:0,updateInputColor:true},color:{mode:"h",active:new f({ahex:"#ffcc00ff"}),quickList:[new f({h:360,s:33,v:100}),new f({h:360,s:66,v:100}),new f({h:360,s:100,v:100}),new f({h:360,s:100,v:75}),new f({h:360,s:100,v:50}),new f({h:180,s:0,v:100}),new f({h:30,s:33,v:100}),new f({h:30,s:66,v:100}),new f({h:30,s:100,v:100}),new f({h:30,s:100,v:75}),new f({h:30,s:100,v:50}),new f({h:180,s:0,v:90}),new f({h:60,s:33,v:100}),new f({h:60,s:66,v:100}),new f({h:60,s:100,v:100}),new f({h:60,s:100,v:75}),new f({h:60,s:100,v:50}),new f({h:180,s:0,v:80}),new f({h:90,s:33,v:100}),new f({h:90,s:66,v:100}),new f({h:90,s:100,v:100}),new f({h:90,s:100,v:75}),new f({h:90,s:100,v:50}),new f({h:180,s:0,v:70}),new f({h:120,s:33,v:100}),new f({h:120,s:66,v:100}),new f({h:120,s:100,v:100}),new f({h:120,s:100,v:75}),new f({h:120,s:100,v:50}),new f({h:180,s:0,v:60}),new f({h:150,s:33,v:100}),new f({h:150,s:66,v:100}),new f({h:150,s:100,v:100}),new f({h:150,s:100,v:75}),new f({h:150,s:100,v:50}),new f({h:180,s:0,v:50}),new f({h:180,s:33,v:100}),new f({h:180,s:66,v:100}),new f({h:180,s:100,v:100}),new f({h:180,s:100,v:75}),new f({h:180,s:100,v:50}),new f({h:180,s:0,v:40}),new f({h:210,s:33,v:100}),new f({h:210,s:66,v:100}),new f({h:210,s:100,v:100}),new f({h:210,s:100,v:75}),new f({h:210,s:100,v:50}),new f({h:180,s:0,v:30}),new f({h:240,s:33,v:100}),new f({h:240,s:66,v:100}),new f({h:240,s:100,v:100}),new f({h:240,s:100,v:75}),new f({h:240,s:100,v:50}),new f({h:180,s:0,v:20}),new f({h:270,s:33,v:100}),new f({h:270,s:66,v:100}),new f({h:270,s:100,v:100}),new f({h:270,s:100,v:75}),new f({h:270,s:100,v:50}),new f({h:180,s:0,v:10}),new f({h:300,s:33,v:100}),new f({h:300,s:66,v:100}),new f({h:300,s:100,v:100}),new f({h:300,s:100,v:75}),new f({h:300,s:100,v:50}),new f({h:180,s:0,v:0}),new f({h:330,s:33,v:100}),new f({h:330,s:66,v:100}),new f({h:330,s:100,v:100}),new f({h:330,s:100,v:75}),new f({h:330,s:100,v:50}),new f()]},images:{clientPath:"/jPicker/images/",colorMap:{width:256,height:256,arrow:{file:"mappoint.gif",width:15,height:15}},colorBar:{width:20,height:256,arrow:{file:"rangearrows.gif",width:20,height:7}},picker:{file:"picker.gif",width:25,height:24}},localization:{text:{title:"Drag Markers To Pick A Color",newColor:"new",currentColor:"current",ok:"OK",cancel:"Cancel"},tooltips:{colors:{newColor:"New Color - Press &ldquo;OK&rdquo; To Commit",currentColor:"Click To Revert To Original Color"},buttons:{ok:"Commit To This Color Selection",cancel:"Cancel And Revert To Original Color"},hue:{radio:"Set To &ldquo;Hue&rdquo; Color Mode",textbox:"Enter A &ldquo;Hue&rdquo; Value (0-360&deg;)"},saturation:{radio:"Set To &ldquo;Saturation&rdquo; Color Mode",textbox:"Enter A &ldquo;Saturation&rdquo; Value (0-100%)"},value:{radio:"Set To &ldquo;Value&rdquo; Color Mode",textbox:"Enter A &ldquo;Value&rdquo; Value (0-100%)"},red:{radio:"Set To &ldquo;Red&rdquo; Color Mode",textbox:"Enter A &ldquo;Red&rdquo; Value (0-255)"},green:{radio:"Set To &ldquo;Green&rdquo; Color Mode",textbox:"Enter A &ldquo;Green&rdquo; Value (0-255)"},blue:{radio:"Set To &ldquo;Blue&rdquo; Color Mode",textbox:"Enter A &ldquo;Blue&rdquo; Value (0-255)"},alpha:{radio:"Set To &ldquo;Alpha&rdquo; Color Mode",textbox:"Enter A &ldquo;Alpha&rdquo; Value (0-100)"},hex:{textbox:"Enter A &ldquo;Hex&rdquo; Color Value (#000000-#ffffff)",alpha:"Enter A &ldquo;Alpha&rdquo; Value (#00-#ff)"}}}}})(jQuery,"1.1.6");
Index: trunk/prototype/plugins/jpicker/css/jPicker-1.1.6.css
===================================================================
--- trunk/prototype/plugins/jpicker/css/jPicker-1.1.6.css	(revision 5341)
+++ trunk/prototype/plugins/jpicker/css/jPicker-1.1.6.css	(revision 5341)
@@ -0,0 +1,232 @@
+﻿.jPicker .Icon {
+  display: inline-block;
+  height: 24px; /* change this value if using a different sized color picker icon */
+  position: relative; /* make this element an absolute positioning container */
+  text-align: left; /* make the zero width children position to the left of container */
+  width: 25px; /* change this value if using a different sized color picker icon */
+}
+.jPicker .Icon span.Color, .jPicker .Icon span.Alpha {
+  background-position: 2px 2px;
+  display: block;
+  height: 100%;
+  left: 0px;
+  position: absolute;
+  top: 0px;
+  width: 100%;
+}
+.jPicker .Icon span.Image {
+  background-repeat: no-repeat;
+  cursor: pointer;
+  display: block;
+  height: 100%;
+  left: 0px;
+  position: absolute;
+  top: 0px;
+  width: 100%;
+}
+.jPicker.Container {
+  color: #000;
+  z-index: 10;
+}
+table.jPicker {
+  background-color: #efefef;
+  border: 1px outset #666;
+  font-family: Arial, Helvetica, Sans-Serif;
+  font-size: 12px !important;
+  margin: 0px;
+  padding: 5px;
+  width: 545px;
+  z-index: 20;
+}
+.jPicker .Move {
+  background-color: #dddddd;
+  border-color: #fff #666 #666 #fff;
+  border-style: solid;
+  border-width: 1px;
+  cursor: move;
+  height: 12px;
+  padding: 0px;
+}
+.jPicker .Title {
+  font-size: 11px !important;
+  font-weight: bold;
+  margin: -2px 0px 0px 0px;
+  padding: 10px 0px 0px 0px;
+  text-align: center;
+  width: 100%;
+}
+.jPicker div.Map {
+  border-bottom: 2px solid #fff;
+  border-left: 2px solid #9a9a9a;
+  border-right: 2px solid #fff;
+  border-top: 2px solid #9a9a9a;
+  cursor: crosshair;
+  height: 260px; /* IE 6 incorrectly draws border inside the width and height instead of outside - We will fix this to 256px later */
+  margin: 0px 10px 10px 10px;
+  overflow: hidden; /* hide the overdraw of the Color Map icon when at edge of viewing box */
+  padding: 0px;
+  position: relative; /* make this element an absolute positioning container */
+  width: 260px; /* IE 6 incorrectly draws border inside the width and height instead of outside - We will fix this to 256px later */
+}
+.jPicker div[class="Map"] {
+  height: 256px; /* correct to 256px for browsers that support the "[class="xxx"]" selector (IE7+,Firefox,Safari,Chrome,Opera,etc.) */
+  width: 256px; /* correct to 256px for browsers that support the "[class="xxx"]" selector (IE7+,Firefox,Safari,Chrome,Opera,etc.) */
+}
+.jPicker div.Bar {
+  border-bottom: 2px solid #fff;
+  border-left: 2px solid #9a9a9a;
+  border-right: 2px solid #fff;
+  border-top: 2px solid #9a9a9a;
+  cursor: n-resize;
+  height: 260px; /* IE 6 incorrectly draws border inside the width and height instead of outside - We will fix this to 256px later */
+  margin: 12px 10px 0px 5px;
+  overflow: hidden;
+  padding: 0px;
+  position: relative;
+  width: 24px; /* IE 6 incorrectly draws border inside the width and height instead of outside - We will fix this to 20px later */
+}
+.jPicker div[class="Bar"] {
+  height: 256px; /* correct to 256px for browsers that support the "[class="xxx"]" selector (IE7+,Firefox,Safari,Chrome,Opera,etc.) */
+  width: 20px; /* correct to 20px for browsers that support the "[class="xxx"]" selector (IE7+,Firefox,Safari,Chrome,Opera,etc.) */
+}
+.jPicker .Map .Map1, .jPicker .Map .Map2, .jPicker .Map .Map3, .jPicker .Bar .Map1, .jPicker .Bar .Map2, .jPicker .Bar .Map3, .jPicker .Bar .Map4, .jPicker .Bar .Map5, .jPicker .Bar .Map6 {
+  background-color: transparent;
+  background-image: none;
+  display: block;
+  left: 0px;
+  position: absolute;
+  top: 0px;
+}
+.jPicker .Map .Map1, .jPicker .Map .Map2, .jPicker .Map .Map3 {
+  height: 2596px;
+  width: 256px; /* must specify pixel width. IE7/8 Quirks mode ignores opacity for an absolutely positioned item in a relative container with "overflow: visible". The marker in the colorBar
+                   would not be drawn if its overflow is set to hidden. */
+}
+.jPicker .Bar .Map1, .jPicker .Bar .Map2, .jPicker .Bar .Map3, .jPicker .Bar .Map4 {
+  height: 3896px;
+  width: 20px; /* must specify pixel width. IE7/8 Quirks mode ignores opacity for an absolutely positioned item in a relative container with "overflow: visible". The marker in the colorBar
+                  would not be drawn if its overflow is set to hidden. */
+}
+.jPicker .Bar .Map5, .jPicker .Bar .Map6 {
+  height: 256px;
+  width: 20px; /* must specify pixel width. IE7/8 Quirks mode ignores opacity for an absolutely positioned item in a relative container with "overflow: visible". The marker in the colorBar
+                  would not be drawn if its overflow is set to hidden. */
+}
+.jPicker .Map .Map1, .jPicker .Map .Map2, .jPicker .Bar .Map6 {
+  background-repeat: no-repeat;
+}
+.jPicker .Map .Map3, .jPicker .Bar .Map5 {
+  background-repeat: repeat;
+}
+.jPicker .Bar .Map1, .jPicker .Bar .Map2, .jPicker .Bar .Map3, .jPicker .Bar .Map4 {
+  background-repeat: repeat-x;
+}
+.jPicker .Map .Arrow {
+  display: block;
+  position: absolute;
+}
+.jPicker .Bar .Arrow {
+  display: block;
+  left: 0px; /* (arrow width / 2) - (element width / 2) - position arrows' center in elements' center */
+  position: absolute;
+}
+.jPicker .Preview {
+  font-size: 9px;
+  padding: 5px 0px 0px 0px;
+  text-align: center;
+}
+.jPicker .Preview div {
+  border: 2px inset #eee;
+  height: 62px;
+  margin: 0px auto;
+  padding: 0px;
+  width: 62px;
+}
+.jPicker .Preview div span {
+  border: 1px solid #000;
+  display: block;
+  height: 30px;
+  margin: 0px auto;
+  padding: 0px;
+  width: 60px;
+}
+.jPicker .Preview .Active {
+  border-bottom-width: 0px;
+}
+.jPicker .Preview .Current {
+  border-top-width: 0px;
+  cursor: pointer;
+}
+.jPicker input {
+  font-size: 13px;
+}
+.jPicker .Button {
+  text-align: center;
+  padding: 0px 4px;
+  width: 115px;
+}
+.jPicker .Button input {
+  padding: 2px 0px;
+  width: 100px;
+}
+.jPicker .Button .Ok {
+  margin: 12px 0px 5px 0px;
+}
+.jPicker td {
+  margin: 0px;
+  padding: 0px;
+}
+.jPicker td.Radio {
+  margin: 0px;
+  padding: 0px;
+  width: 31px;
+}
+.jPicker td.Radio input {
+  margin: 0px 5px 0px 0px;
+  padding: 0px;
+}
+.jPicker td.Text {
+  font-size: 12px !important;
+  height: 22px;
+  margin: 0px;
+  padding: 0px;
+  text-align: left;
+  width: 70px;
+}
+.jPicker tr.Hex td.Text {
+  width: 100px;
+}
+.jPicker td.Text input {
+  background-color: #fff;
+  border: 1px inset #aaa;
+  height: 19px;
+  margin: 0px 0px 0px 5px;
+  text-align: left;
+  width: 30px;
+}
+.jPicker td[class="Text"] input {
+  height: 15px;
+}
+.jPicker tr.Hex td.Text input.Hex {
+  width: 50px;
+}
+.jPicker tr.Hex td.Text input.AHex {
+  width: 20px;
+}
+.jPicker .Grid {
+  text-align: center;
+  width: 114px;
+}
+.jPicker .Grid span.QuickColor {
+  border: 1px inset #aaa;
+  cursor: pointer;
+  display: inline-block;
+  height: 15px;
+  line-height: 15px;
+  margin: 0px;
+  padding: 0px;
+  width: 19px;
+}
+.jPicker .Grid span[class="QuickColor"] {
+  width: 17px;
+}
Index: trunk/prototype/plugins/jpicker/css/jPicker-1.1.6.min.css
===================================================================
--- trunk/prototype/plugins/jpicker/css/jPicker-1.1.6.min.css	(revision 5341)
+++ trunk/prototype/plugins/jpicker/css/jPicker-1.1.6.min.css	(revision 5341)
@@ -0,0 +1,1 @@
+﻿.jPicker .Icon{display:inline-block;height:24px;position:relative;text-align:left;width:25px}.jPicker .Icon span.Color,.jPicker .Icon span.Alpha{background-position:2px 2px;display:block;height:100%;left:0;position:absolute;top:0;width:100%}.jPicker .Icon span.Image{background-repeat:no-repeat;cursor:pointer;display:block;height:100%;left:0;position:absolute;top:0;width:100%}.jPicker.Container{color:#000;z-index:10}table.jPicker{background-color:#efefef;border:1px outset #666;font-family:Arial,Helvetica,Sans-Serif;font-size:12px!important;margin:0;padding:5px;width:545px;z-index:20}.jPicker .Move{background-color:#ddd;border-color:#fff #666 #666 #fff;border-style:solid;border-width:1px;cursor:move;height:12px;padding:0}.jPicker .Title{font-size:11px!important;font-weight:bold;margin:-2px 0 0 0;padding:10px 0 0 0;text-align:center;width:100%}.jPicker div.Map{border-bottom:2px solid #fff;border-left:2px solid #9a9a9a;border-right:2px solid #fff;border-top:2px solid #9a9a9a;cursor:crosshair;height:260px;margin:0 10px 10px 10px;overflow:hidden;padding:0;position:relative;width:260px}.jPicker div[class="Map"]{height:256px;width:256px}.jPicker div.Bar{border-bottom:2px solid #fff;border-left:2px solid #9a9a9a;border-right:2px solid #fff;border-top:2px solid #9a9a9a;cursor:n-resize;height:260px;margin:12px 10px 0 5px;overflow:hidden;padding:0;position:relative;width:24px}.jPicker div[class="Bar"]{height:256px;width:20px}.jPicker .Map .Map1,.jPicker .Map .Map2,.jPicker .Map .Map3,.jPicker .Bar .Map1,.jPicker .Bar .Map2,.jPicker .Bar .Map3,.jPicker .Bar .Map4,.jPicker .Bar .Map5,.jPicker .Bar .Map6{background-color:transparent;background-image:none;display:block;left:0;position:absolute;top:0}.jPicker .Map .Map1,.jPicker .Map .Map2,.jPicker .Map .Map3{height:2596px;width:256px}.jPicker .Bar .Map1,.jPicker .Bar .Map2,.jPicker .Bar .Map3,.jPicker .Bar .Map4{height:3896px;width:20px}.jPicker .Bar .Map5,.jPicker .Bar .Map6{height:256px;width:20px}.jPicker .Map .Map1,.jPicker .Map .Map2,.jPicker .Bar .Map6{background-repeat:no-repeat}.jPicker .Map .Map3,.jPicker .Bar .Map5{background-repeat:repeat}.jPicker .Bar .Map1,.jPicker .Bar .Map2,.jPicker .Bar .Map3,.jPicker .Bar .Map4{background-repeat:repeat-x}.jPicker .Map .Arrow{display:block;position:absolute}.jPicker .Bar .Arrow{display:block;left:0;position:absolute}.jPicker .Preview{font-size:9px;padding:5px 0 0 0;text-align:center}.jPicker .Preview div{border:2px inset #eee;height:62px;margin:0 auto;padding:0;width:62px}.jPicker .Preview div span{border:1px solid #000;display:block;height:30px;margin:0 auto;padding:0;width:60px}.jPicker .Preview .Active{border-bottom-width:0}.jPicker .Preview .Current{border-top-width:0;cursor:pointer}.jPicker input{font-size:13px}.jPicker .Button{text-align:center;padding:0 4px;width:115px}.jPicker .Button input{padding:2px 0;width:100px}.jPicker .Button .Ok{margin:12px 0 5px 0}.jPicker td{margin:0;padding:0}.jPicker td.Radio{margin:0;padding:0;width:31px}.jPicker td.Radio input{margin:0 5px 0 0;padding:0}.jPicker td.Text{font-size:12px!important;height:22px;margin:0;padding:0;text-align:left;width:70px}.jPicker tr.Hex td.Text{width:100px}.jPicker td.Text input{background-color:#fff;border:1px inset #aaa;height:19px;margin:0 0 0 5px;text-align:left;width:30px}.jPicker td[class="Text"] input{height:15px}.jPicker tr.Hex td.Text input.Hex{width:50px}.jPicker tr.Hex td.Text input.AHex{width:20px}.jPicker .Grid{text-align:center;width:114px}.jPicker .Grid span.QuickColor{border:1px inset #aaa;cursor:pointer;display:inline-block;height:15px;line-height:15px;margin:0;padding:0;width:19px}.jPicker .Grid span[class="QuickColor"]{width:17px}
Index: trunk/prototype/plugins/jpicker/ReadMe.txt
===================================================================
--- trunk/prototype/plugins/jpicker/ReadMe.txt	(revision 5341)
+++ trunk/prototype/plugins/jpicker/ReadMe.txt	(revision 5341)
@@ -0,0 +1,47 @@
+﻿jPicker 1.1.6
+
+jQuery Plugin for Photoshop style color picker
+
+Copyright (c) 2010 Christopher T. Tillman
+Digital Magic Productions, Inc. (http://www.digitalmagicpro.com/)
+MIT style license, FREE to use, alter, copy, sell, and especially ENHANCE
+
+Painstakingly ported from John Dyers' excellent work on his own color picker based on the Prototype framework.
+
+John Dyers' website: (http://johndyer.name)
+Color Picker page:   (http://johndyer.name/post/2007/09/PhotoShop-like-JavaScript-Color-Picker.aspx)
+
+
+    jPicker is a fast, lightweight jQuery plugin for including an advanced color picker in your web projects.
+It has been painstakenly ported from John Dyers' awesome work on his picker using the Prototype framework.
+
+    jPicker supports all current browsers and has been extensively tested in Chrome, Firefox, IE5.5+, Safari,
+and Opera.
+
+    If you are updating a current version, you MUST always use the CSS and image files from the download as
+there may have been changes.
+
+    If you are moving from a V1.0.* version, you MUST read the docs below to implement some changes to the
+Color object returned by the callback functions.
+
+
+Known Issues
+______________
+Attaching multiple jPicker objects on a single page will slow performance.
+  jPicker creates a new instance of the picker for every element. Performance will suffer when binding dozens of instances.
+
+
+Coming Soon
+______________
+
+    Will consider supporting jQuery ThemeRoller CSS API for theming the UI if demand exists.
+
+Planned For Future Release
+______________
+
+  Move the jPicker object to a single instance that all selection instances point to.
+     - This will result in much faster operation and initialization for pages with multiple pickers.
+
+  Add activateCallback option for calling a callback function when the jPicker is activated or its binding is switched to a different picker element.
+  
+  Add multiple window modes for picker operation, include modal, popup, windowed, and exclusive.
Index: trunk/prototype/plugins/jpicker/Example.html
===================================================================
--- trunk/prototype/plugins/jpicker/Example.html	(revision 5341)
+++ trunk/prototype/plugins/jpicker/Example.html	(revision 5341)
@@ -0,0 +1,774 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>
+  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+  <title>Digital Magic Productions - jPicker - A jQuery Color Picker Plugin</title>
+  <link rel="Stylesheet" type="text/css" href="css/jpicker-1.1.6.min.css" />
+  <link rel="Stylesheet" type="text/css" href="jPicker.css" />
+  <script src="jquery-1.4.4.min.js" type="text/javascript"></script>
+  <script src="jpicker-1.1.6.min.js" type="text/javascript"></script>
+  <script type="text/javascript">
+    $(function()
+      {
+        $.fn.jPicker.defaults.images.clientPath='images/';
+        var LiveCallbackElement = $('#Live'),
+            LiveCallbackButton = $('#LiveButton');
+        $('#Inline').jPicker({window:{title:'Inline Example'}});
+        $('#Expandable').jPicker({window:{expandable:true,title:'Expandable Example'}});
+        $('#Alpha').jPicker({window:{expandable:true,title:'Alpha (Transparency) Example)',alphaSupport:true},color:{active:new $.jPicker.Color({ahex:'99330099'})}});
+        $('#Binded').jPicker({window:{title:'Binded Example'},color:{active:new $.jPicker.Color({ahex:'993300ff'})}});
+        $('.Multiple').jPicker({window:{title:'Multiple Binded Example'}});
+        $('#Callbacks').jPicker(
+          {window:{title:'Callback Example'}},
+          function(color, context)
+          {
+            var all = color.val('all');
+            alert('Color chosen - hex: ' + (all && '#' + all.hex || 'none') + ' - alpha: ' + (all && all.a + '%' || 'none'));
+            $('#Commit').css({ backgroundColor: all && '#' + all.hex || 'transparent' });
+          },
+          function(color, context)
+          {
+            if (context == LiveCallbackButton.get(0)) alert('Color set from button');
+            var hex = color.val('hex');
+            LiveCallbackElement.css({ backgroundColor: hex && '#' + hex || 'transparent' });
+          },
+          function(color, context)
+          {
+            alert('"Cancel" Button Clicked');
+          });
+        $('#LiveButton').click(
+          function()
+          {
+            $.jPicker.List[7].color.active.val('hex', 'e2ddcf', this);
+          });
+        $('#AlterColors').jPicker({window:{title:'Color Interaction Example'}});
+        $('#GetActiveColor').click(
+          function()
+          {
+            alert($.jPicker.List[8].color.active.val('ahex'));
+          });
+        $('#GetRG').click(
+          function()
+          {
+            var rg=$.jPicker.List[8].color.active.val('rg');
+            alert('red: ' + rg.r + ', green: ' + rg.g);
+          });
+        $('#SetHue').click(
+          function()
+          {
+            $.jPicker.List[8].color.active.val('h', 133);
+          });
+        $('#SetValue').click(
+          function()
+          {
+            $.jPicker.List[8].color.active.val('v', 38);
+          });
+        $('#SetRG').click(
+          function()
+          {
+            $.jPicker.List[8].color.active.val('rg', { r: 213, g: 118 });
+          });
+      });
+  </script>
+</head>
+<body>
+  <div id="jPicker">
+    <h2>jPicker - A jQuery Color Picker Plugin.</h2>
+    <p>
+      jPicker is a fast, lightweight jQuery plugin for including an advanced color picker in your web projects. It has been painstakenly ported from John Dyers' awesome work on his picker using the Prototype framework.<br /><br />
+      jPicker supports all current browsers and has been extensively tested in Chrome, Firefox, IE5.5+, Safari, and Opera.<br /><br />
+      If you are updating a current version, you MUST always use the CSS and image files from the download as there may have been changes.<br /><br />
+      If you are moving from a V1.0.* version, you MUST read the docs below to implement some changes to the Color object returned by the callback functions.<br /><br />
+      <a href="http://johndyer.name/post/2007/09/PhotoShop-like-JavaScript-Color-Picker.aspx" class="newWindow">View John Dyer's prototype plugin here.</a><br /><br />
+      View jPicker details a docs below.<br /><br />
+      <a href="http://code.google.com/p/jpicker/" class="newWindow">Check out the source from Google Code.</a>
+    </p><hr /><br />
+    <h2>jPicker Inline Example</h2>
+    <p>
+      jPicker can be used inline by binding to any block level element.<br /><br />
+      <code>jPicker() -- no arguments</code>
+      <pre>
+&lt;script type="text/javascript"&gt;        
+  $(document).ready(
+    function()
+    {
+      $('#Inline').jPicker();
+    });
+&lt;/script&gt;
+&lt;div id="Inline"&gt;&lt;/div&gt;</pre>
+      <div id="Inline"></div>
+    </p><hr /><br />
+    <h2>jPicker Expandable Example</h2>
+    <p>
+      jPicker can also display only a small picker icon that opens a popup for editing.<br /><br />
+      <code>jPicker({ window: { expandable: true }})</code>
+      <pre>
+&lt;script type="text/javascript"&gt;
+  $(document).ready(
+    function()
+    {
+      $('#Expandable').jPicker(
+        {
+          window:
+          {
+            expandable: true
+          }
+        });
+    });
+&lt;/script&gt;
+&lt;span id="Expandable"&gt;&lt;/span&gt;</pre>
+      <span id="Expandable"></span>
+    </p><hr /><br />
+    <h2>jPicker Alpha Channel Example</h2>
+    <p>
+      jPicker can also pick colors with alpha (transparency) values.<br /><br />
+      <code>jPicker({ window: { expandable: true }})</code>
+      <pre>
+&lt;script type="text/javascript"&gt;        
+  $(document).ready(
+    function()
+    {
+      $('#Alpha').jPicker(
+        {
+          window:
+          {
+            expandable: true
+          },
+          color:
+          {
+            alphaSupport: true,
+            active: new $.jPicker.Color({ ahex: '99330099' })
+          }
+        });
+    });
+&lt;/script&gt;
+&lt;span id="Alpha"&gt;&lt;/span&gt;</pre>
+      <span id="Alpha"></span>
+    </p><hr /><br />
+    <h2>jPicker Binded Example</h2>
+    <p>
+      jPicker can also be binded to an input element.<br /><br />
+      <code>jPicker() -- no arguments</code>
+      <pre>
+&lt;script type="text/javascript"&gt;        
+  $(document).ready(
+    function()
+    {
+      $('#Binded').jPicker();
+    });
+&lt;/script&gt;
+&lt;input id="Binded" type="text" value="e2ddcf" /&gt;</pre>
+      <input id="Binded" type="text" value="e2ddcf" />
+    </p><hr /><br />
+    <h2>Multiple jPicker Binded Example</h2>
+    <p>
+      jPicker can also be binded to multiple elements at a time.<br /><br />
+      <code>jPicker() -- no arguments</code>
+      <pre>
+&lt;script type="text/javascript"&gt;        
+  $(document).ready(
+    function()
+    {
+      $('.Multiple').jPicker();
+    });
+&lt;/script&gt;
+&lt;input class="Multiple" type="text" value="e2ddcf" /&gt;&lt;br /&gt;
+&lt;input class="Multiple" type="text" value="" /&gt;&lt;br /&gt;
+&lt;input class="Multiple" type="text" value="fda0f7" /&gt;</pre>
+      <input class="Multiple" type="text" value="e2ddcf" /><br />
+      <input class="Multiple" type="text" value="" /><br />
+      <input class="Multiple" type="text" value="fda0f7" /><br />
+    </p><hr /><br />
+    <h2>jPicker Callback Functions</h2>
+    <p>
+      Register for callback function to have it interact with your page.<br /><br />
+      <code>jPicker([settings, [commitCallback, [liveCallback, [cancelCallback]]]])</code>
+      <pre>
+&lt;script type="text/javascript"&gt;
+  $(document).ready(
+    function()
+    {
+      var LiveCallbackElement = $('#Live'),
+          LiveCallbackButton = $('#LiveButton');  // you don't want it searching this
+                                                  // on every live callback!!!
+      $('#Callbacks').jPicker(
+        {},
+        function(color, context)
+        {
+          var all = color.val('all');
+          alert('Color chosen - hex: ' + (all && '#' + all.hex || 'none') +
+            ' - alpha: ' + (all && all.a + '%' || 'none'));
+          $('#Commit').css(
+            {
+              backgroundColor: all && '#' + all.hex || 'transparent'
+            }); // prevent IE from throwing exception if hex is empty
+        },
+        function(color, context)
+        {
+          if (context == LiveCallbackButton.get(0)) alert('Color set from button');
+          var hex = color.val('hex');
+          LiveCallbackElement.css(
+            {
+              backgroundColor: hex && '#' + hex || 'transparent'
+            }); // prevent IE from throwing exception if hex is empty
+        },
+        function(color, context)
+        {
+          alert('"Cancel" Button Clicked');
+        });      
+      $('#LiveButton').click(
+        function()
+        {
+          $.jPicker.List[0].color.active.val('hex', 'e2ddcf', this);
+        });
+    });
+&lt;/script&gt;
+&lt;input id="Callbacks" type="text" value="e2ddcf" /&gt;
+&lt;span id="Commit" style="background-color: #e2ddcf; display: block; --
+          float: left; height: 50px; margin: 10px; width: 50px;"&gt; --
+          Commit&lt;/span&gt;
+&lt;span id="Live" style="display: block; float: left; height: 50px; --
+          margin: 10px; width: 50px;"&gt;Live&lt;/span&gt;
+&lt;input id="LiveButton" type="button" value="Set To #e2ddcf" /&gt;</pre>
+      <input id="Callbacks" type="text" value="e2ddcf" /><br />
+      <span id="Commit" style="background-color: #e2ddcf; display: block; float: left; height: 50px; margin: 10px; width: 50px;">Commit</span>
+      <span id="Live" style="display: block; float: left; height: 50px; margin: 10px; width: 50px;">Live</span>
+      <input id="LiveButton" type="button" value="Set To #e2ddcf" />
+    </p><hr /><br />
+    <h2>jPicker Settings And Colors</h2>
+    <p>
+      Use the "val" method on the active color for interaction with the picker.<br /><br />
+      <code>(jQuery).jPicker.List[index]</code>
+      <pre>
+&lt;script type="text/javascript"&gt;        
+  $(document).ready(
+    function()
+    {
+      $('#AlterColors').jPicker();
+      $('#GetActiveColor').click(
+        function()
+        {
+          alert($.jPicker.List[0].color.active.val('ahex'));
+        });
+      $('#GetRG').click(
+        function()
+        {
+          var rg=$.jPicker.List[0].color.active.val('rg');
+          alert('red: ' + rg.r + ', green: ' + rg.g);
+        });
+      $('#SetHue').click(
+        function()
+        {
+          $.jPicker.List[0].color.active.val('h', 133);
+        });
+      $('#SetValue').click(
+        function()
+        {
+          $.jPicker.List[0].color.active.val('v', 38);
+        });
+      $('#SetRG').click(
+        function()
+        {
+          $.jPicker.List[0].color.active.val('rg', { r: 213, g: 118 });
+        });
+    });
+&lt;/script&gt;
+&lt;input id="AlterColors" type="text" value="e2ddcf" /&gt;&lt;br /&gt;
+&lt;input id="GetActiveColor" type="button" value="Get Active Color" /&gt;&lt;br /&gt;
+&lt;input id="GetRG" type="button" value="Get Red/Green Value" /&gt;&lt;br /&gt;
+&lt;input id="SetHue" type="button" value="Set Hue To 133" /&gt;&lt;br /&gt;
+&lt;input id="SetValue" type="button" value="Set Value To 38" /&gt;&lt;br /&gt;
+&lt;input id="SetRG" type="button" value="Set Red/Green To 213, 118" /&gt;</pre>
+      <input id="AlterColors" type="text" value="e2ddcf" /><br />
+      <input id="GetActiveColor" type="button" value="Get Active Color" /><br />
+      <input id="GetRG" type="button" value="Get Red/Green Value" /><br />
+      <input id="SetHue" type="button" value="Set Hue To 133" /><br />
+      <input id="SetValue" type="button" value="Set Value To 38" /><br />
+      <input id="SetRG" type="button" value="Set Red/Green To 213, 118" />
+    </p><hr /><br />
+    <h2>jPicker Core</h2>
+    <p>
+      jPicker Core function - returns the jQuery object.<br /><br />
+      <code>jPicker([settings, [commitCallback, [liveCallback, [cancelCallback]]]])</code>
+    </p><hr /><br />
+    <h2>Settings</h2>
+    <p>
+      settings [object]: (with defaults)<br />
+      <pre>
+{
+  window: // used to define the position of the popup window
+          // only useful in binded mode
+  {
+    title: null, // any title for the jPicker window itself - displays
+                 // "Drag Markers To Pick A Color" if left null
+    position:
+    {
+      x: 'screenCenter', // acceptable values "left", "center", "right",
+                         // "screenCenter", or relative px value
+      y: 'top', // acceptable values "top", "bottom", "center", or relative px
+                // value
+    },
+    expandable: false, // default to large static picker - set to true to make an
+                       // expandable picker (small icon with popup) - set
+                       // automatically when binded to input element
+    liveUpdate: true, // set false if you want the user to click "OK" before the
+                      // binded input box updates values (always "true" for
+                      // expandable picker)
+    alphaSupport: false, // set to true to enable alpha picking
+    alphaPrecision: 0, // set decimal precision for alpha percentage display -
+                       // hex codes do not map directly to percentage integers -
+                       // range 0-2
+    updateInputColor: true // set to false to prevent binded input colors from
+                           // changing
+  },
+  color:
+  {
+    mode: 'h', // acceptable values "h" (hue), "s" (saturation), "v" (brightness),
+               // "r" (red), "g" (green), "b" (blue), "a" (alpha)
+    active: new $.jPicker.Color({ hex: 'ffc000' }), // accepts any declared
+               // jPicker.Color object or hex string WITH OR WITHOUT '#'
+    quickList: // this list of quick pick colors - override for a different list
+      [
+        new $.jPicker.Color({ h: 360, s: 33, v: 100}), // accepts any declared
+               // jPicker.Color object or hex string WITH OR WITHOUT '#'
+        new $.jPicker.Color({ h: 360, s: 66, v: 100}),
+        (...) // removed for brevity
+        new $.jPicker.Color({ h: 330, s: 100, v: 50}),
+        new $.jPicker.Color()
+      ]
+  },
+  images
+  {
+    clientPath: '/jPicker/images/', // Path to image files
+    colorMap: // colorMap size and arrow icon
+    {
+      width: 256, // Map width - don't override unless using a smaller image set
+      height: 256, // Map height - don't override unles using a smaller image set
+      arrow:
+      {
+        file: 'mappoint.gif', // Arrow icon image file
+        width: 15, // Arrow icon width
+        height: 15 // Arrow icon height
+      }
+    },
+    colorBar: // colorBar size and arrow icon
+    {
+      width: 20, // Bar width - don't override unless using a smaller image set
+      height: 256, // Bar height - don't override unless using a smaller image set
+      arrow:
+      {
+        file: 'rangearrows.gif', // Arrow icon image file
+        width: 40, // Arrow icon width
+        height: 9 // Arrow icon height
+      }
+    },
+    picker: // picker icon and size
+    {
+      file: 'picker.gif', // Picker icon image file
+      width: 25, // Picker width - don't override unless using a smaller image set
+      height: 24 // Picker height - don't override unless using a smaller image set
+    }
+  },
+  localization:
+  {
+    text:
+    {
+      title: 'Drag Markers To Pick A Color',
+      newColor: 'new',
+      currentColor: 'current',
+      ok: 'OK',
+      cancel: 'Cancel'
+    },
+    tooltips:
+    {
+      colors:
+      {
+        newColor: 'New Color - Press &ldquo;OK&rdquo; To Commit',
+        currentColor: 'Click To Revert To Original Color'
+      },
+      buttons:
+      {
+        ok: 'Commit To This Color Selection',
+        cancel: 'Cancel And Revert To Original Color'
+      },
+      hue:
+      {
+        radio: 'Set To &ldquo;Hue&rdquo; Color Mode',
+        textbox: 'Enter A &ldquo;Hue&rdquo; Value (0-360&deg;)'
+      },
+      saturation:
+      {
+        radio: 'Set To &ldquo;Saturation&rdquo; Color Mode',
+        textbox: 'Enter A &ldquo;Saturation&rdquo; Value (0-100%)'
+      },
+      brightness:
+      {
+        radio: 'Set To &ldquo;Brightness&rdquo; Color Mode',
+        textbox: 'Enter A &ldquo;Brightness&rdquo; Value (0-100%)'
+      },
+      red:
+      {
+        radio: 'Set To &ldquo;Red&rdquo; Color Mode',
+        textbox: 'Enter A &ldquo;Red&rdquo; Value (0-255)'
+      },
+      green:
+      {
+        radio: 'Set To &ldquo;Green&rdquo; Color Mode',
+        textbox: 'Enter A &ldquo;Green&rdquo; Value (0-255)'
+      },
+      blue:
+      {
+        radio: 'Set To &ldquo;Blue&rdquo; Color Mode',
+        textbox: 'Enter A &ldquo;Blue&rdquo; Value (0-255)'
+      },
+      alpha:
+      {
+        radio: 'Set To &ldquo;Alpha&rdquo; Color Mode',
+        textbox: 'Enter A &ldquo;Alpha&rdquo; Value (0-100)'
+      },
+      hex:
+      {
+        textbox: 'Enter A &ldquo;Hex&rdquo; Color Value (#000000-#ffffff)',
+        alpha: 'Enter A &ldquo;Alpha&rdquo; Value (#00-#ff)'
+      }
+    }
+  }
+}</pre>
+    </p><hr /><br />
+    <h2>Callback Pattern</h2>
+    <p>
+      <code>function(jPicker.Color color, object context){...}</code>
+    </p><hr /><br />
+    <h2>jPicker List</h2>
+    <p>
+      The list of active jPicker objects.<br /><br />
+      <code>(jQuery).jPicker.List[]</code>
+    </p><hr /><br />
+    <h2>jPicker Color Class</h2>
+    <p>
+      Definition of the jPicker.Color class.<br />
+      <pre>
+(jQuery).jPicker.Color()
+(jQuery).jPicker.Color({ ahex: 'ffffffff' })
+(jQuery).jPicker.Color({ hex: 'ffffff', [a: (0-255)] })
+(jQuery).jPicker.Color({ r: (0-255), g: (0-255), b: (0-255), [a: (0-255)] })
+(jQuery).jPicker.Color({ h: (0-360), s: (0-100), v: (0-100), [a: (0-255)] })
+{
+  val: function(name, value, context),
+  bind: function(callback) where callback is function(color, [context]),
+  unbind: function(callback)
+}
+
+method "val" usage
+
+val(name) : get value
+
+  'r':     red         (0-255)
+  'g':     green       (0-255)
+  'b':     blue        (0-255)
+  'a':     alpha       (0-255)
+  'h':     hue         (0-360)
+  's':     saturation  (0-100)
+  'v':     value       (0-100)
+  'hex':   hex         (000000-ffffff)
+  'ahex':  ahex        (00000000-ffffffff)
+  'all':   all         all
+  
+  ex. Usage
+
+    val('r'):     (0-255)
+    val('h'):     (0-360)
+    val('hex'):   (000000-ffffff)
+    val('rg'):    { r: (0-255), g: (0-255) }
+    val('rgba'):  { r: (0-255), g: (0-255), b: (0-255), a: (0-255) }
+    val('hvga'):  { h: (0-255), v: (0-100), g: (0-255), a: (0-255) }
+    val('all'):   { r: (0-255), g: (0-255), b: (0-255), a: (0-255), h: (0-360) --
+                    s: (0-100), v: (0-100), hex: (000000-ffffff), --
+                    ahex: (00000000-ffffffff) }
+
+val(name, value, [context]) : set value
+
+  'r':     red         (0-255)
+  'g':     green       (0-255)
+  'b':     blue        (0-255)
+  'a':     alpha       (0-255)
+  'h':     hue         (0-360)
+  's':     saturation  (0-100)
+  'v':     value       (0-100)
+  'hex':   hex         (000000-ffffff)
+  'ahex':  ahex        (00000000-ffffffff)
+  
+  ex. Usage
+
+    val('r', (0-255)) || val('r', { r: (0-255) })
+    val('h', (0-360)) || val('h', { h: (0-360) })
+    val('hex', (000000-ffffff)) || val('hex', { hex: (000000-ffffff) })
+    val('rg', { r: (0-255), g: (0-255) })
+    val('rgba', { r: (-255), g: (0-255), b: (0-255), a: (0-255) })
+    val(null, { r: (0-255), g: (0-255) })
+    val('hvga'):  incorrect usage - cannot set hsv AND rgb as they will conflict</pre>
+    </p><hr /><br />
+    <h2>jPicker ColorMethod Utility Class</h2>
+    <p>
+      Static methods for altering and retrieving different color spaces.<br />
+      <pre>
+(jQuery).jPicker.ColorMethods.hexToRgba:
+    function(hex)
+    returns { r: (0-255), g: (0-255), b: (0-255), a: (0-255) }
+    
+(jQuery).jPicker.ColorMethods.validateHex:
+    function(hex)
+    returns new hex string
+    
+(jQuery).jPicker.ColorMethods.rgbaToHex:
+    function({ r: (0-255), g: (0-255), b: (0-255), a: (0-255) })
+    returns hex string
+    
+(jQuery).jPicker.ColorMethods.intToHex:
+    function(number)
+    returns hex string
+    
+(jQuery).jPicker.ColorMethods.hexToInt:
+    function(hex)
+    return integer
+
+(jQuery).jPicker.ColorMethods.rgbToHsv:
+    function({ r: (0-255), g: (0-255), b: (0-255) })
+    returns { h: (0-360), s: (0-100), v: (0-100) }
+
+(jQuery).jPicker.ColorMethods.hsvToRgb:
+    function({ h: (0-360), s: (0-100), v: (0-100) })
+    returns { r: (0-255), g: (0-255), b: (0-255) }
+</pre>
+    </p><hr /><br />
+    <h2>Known Issues</h2>
+    <ul>
+      <li>
+        <h3>Attaching multiple jPicker objects on a single page will slow performance.</h3>
+        <ul>
+          <li>jPicker creates a new instance of the picker for every element. Performance will suffer when binding dozens of instances.</li>
+        </ul>
+      </li>
+    </ul><hr />
+    <h2>Coming Soon</h2>
+    <ul>
+      <li>
+        <ul>
+          <li>Will consider supporting jQuery ThemeRoller CSS API for theming the UI if demand exists.</li>
+        </ul>
+      </li>
+    </ul><hr />
+    <h2>Planned For Future Release</h2>
+    <ul>
+      <li>
+        Move the jPicker object to a single instance that all selection instances point to.
+        <ul>
+          <li>This will result in much faster operation and initialization for pages with multiple pickers.</li>
+        </ul>
+      </li>
+      <li>Add activateCallback option for calling a callback function when the jPicker is activated or its binding is switched to a different picker element.</li>
+    </ul><hr />
+    <h2>Change Log</h2>
+    <ul>
+      <li>
+        <h3>V1.1.5:</h3>
+        <ul>
+          <li>Corrected Color object constructor to allow setting of the "alpha" value as per the documentation which previously didn't work.</li>
+          <li>Added support for translucency for quickList colors with checkered background - Only available if "alphaSupport" is enabled.</li>
+          <li>Restricted default color to "alpha" of 255 if "alphaSupport" is disabled - It will now assign an explicit alpha of 255 when disabled.</li>
+          <li>Added new setting variable "alphaPrecision" which indicates the number of decimal points to allow in the alpha percentage display - Now defaults to 0.</li>
+        </ul>
+      </li>
+      <li>
+        <h3>V1.1.4:</h3>
+        <ul>
+          <li>Changed "alpha" range from 0-100 to 0-255 to correct truncating and rounding errors caused by attempting to get an integer percentage that matches a hex value.</li>
+          <li>"alpha" percentage display will now show up to 1 decimal point for more accurate representation of "alpha" value.</li>
+          <li>Color object now accepts "alpha" values in a range of 0-255 and also returns the same when getting the "alpha" value. You will need to run ((alpha * 100) / 255) to retrieve a percentage value.</li>
+          <li>Reworked the table layout and labels to remove the need for the label to reference the radio input box. This reduces injected code and removes the need to generate unique ids on the radio buttons.</li>
+          <li>Transparent/invisible caret on NULL color is now corrected - uses the same caret color as a white color.</li>
+          <li>Setting a binded input value of "" or no value attribute will now create a NULL color on initialization instead of the settings default color.</li>
+          <li>Added a dynamic, invisible "iframe" behind a dialog picker in all browsers that fail jQuery.support.boxModel (currently IE <= 7 Quirks Mode). This prevents "select" box from showing through the picker.</li>
+        </ul>
+      </li>
+      <li>
+        <h3>V1.1.3:</h3>
+        <ul>
+          <li>Now adding popup color pickers to document.body instead of inline with the popup control. This corrects issues with the picker not showing beyond a relative container scope.</li>
+          <li>No longer need to hide popup icon in Internet Explorer for picker elements lower in the DOM than the currently active one since the picker itself is attached to document.body (it is always higher in the DOM now).</li>
+          <li>Popup pickers are now bring-to-front selectable. Clicking on the picker will bring it above all other pickers on the page instead of having to drag one out from underneath another.</li>
+          <li>Corrected jPicker.List/setTimeout bug which allowed an instance to bind to the List in an order other than the order the initialization function was called.</li>
+          <li>Added a updateInputColor option (default true) to allow for a binded input field that does not automatically update its background/text color.</li>
+        </ul>
+        <hr />
+      </li>
+      <li>
+        <h3>V1.1.2:</h3>
+        <ul>
+          <li>Reworked the find methods and contexts for element searches. Now using ":first" instead of ".eq(0)" to take advantage of early out searches. Much faster initialization of the picker, on the order of 6 times.</li>
+          <li>Now using setTimeout for calling visual updates. Dramatically improved marker dragging in all browsers. Reduces blocking as re-rendering is internal to the browser and independent of the other javascript still in progress.</li>
+          <li>Marker updates can now cancel a previous valueChanged event when a new mouseMove event comes in. IE8 marker dragging is still slower, much over 5 times faster than it was.</li>
+          <li>Reworked entire quickPick list creation. It now adds up source code and does a single "html" method instead of multiple "append" methods. This is a large part of the speed increase on initialization.</li>
+          <li>The vast majority of all running scripts on both initialization and dragging is now occupied altering the style rules and finding elements (init only) instead of jPicker code.</li>
+          <li>All methods previously called with global context now use the "call" method for using the context of the class running the method. "this" in a callback is now the DOM node (jQuery style) and jPicker instead of "window".</li>
+          <li>Added "effects" section of window settings to allow different show/hide effects and durations.</li>
+          <li>Removed change log and read me from the full source code to separate files (ChangeLog.txt and ReadMe.txt) and an HTML demonstration/documentation page (Example.txt).</li>
+        </ul>
+        <hr />
+      </li>
+      <li>
+        <h3>V1.1.1:</h3>
+        <ul>
+          <li>Correct IE exception caused by attempting to set "#transparent" to CSS background-color.</li>
+        </ul>
+        <hr />
+      </li>
+      <li>
+        <h3>V1.1.0:</h3>
+        <ul>
+          <li>Reworked nearly the entire plugin including the internal and external event model, bindings, DOM searches, classes, and overall presentation.</li>
+          <li>The Color object now supports a changed event that you can bind to (or just bind to the picker events still included).</li>
+          <li>Event order has been reversed, instead of an change event on the map/bar/text fields updating the display, they now update the Color object which then fires the events that update the display.</li>
+          <li>alphaSupport re-implemented by request - default behavior is off.</li>
+          <li>Hex code now only 6 characters again.</li>
+          <li>Color object can now have its value changed from code, using the "val" method, and it will fire all events necessary to update the display.</li>
+          <li>Removed all "get_*" methods from the color object, instead opting for a single "val" method for getting and setting, more in line with familiar jQuery methods.</li>
+          <li>Better rendering for all IE versions in Quirks mode.</li>
+        </ul>
+        <hr />
+      </li>
+      <li>
+        <h3>V1.0.13:</h3>
+        <ul>
+          <li>Updated transparency algorithm for red/green/blue color modes. The algorithm from John Dyers' color picker was close but incorrect. Bar colors are now pixel perfect with the new algorithm.</li>
+          <li>Changed from using "background-position" on the color maps to an element of full height using the "top" attribute for image-map location using "overflow: hidden" to hide overdraw.</li>
+          <li>IE7/8 ignores opacity on elements taller than 4096px. Image maps therefore no longer include a blank first map so the Bar is just under 4096. Blank is now accomplished by setting the "top" setting to below the map display.</li>
+          <li>New colorBar picker image that does not draw outside of the element since the elements now hide overdraw.</li>
+          <li>Added IE5.5/6 support for the picker. This is why it now uses maps of full height and the "top" attribute for map locations.</li>
+          <li>Moved the images in the maps to 4 pixels apart from each other. IE7/8 change the first pixel of the bottom-border of 2px to partially transparent showing a portion of a different color map without this.</li>
+        </ul>
+        <hr />
+      </li>
+      <li>
+        <h3>V1.0.12:</h3>
+        <ul>
+          <li>Added minified CSS file.</li>
+          <li>Added IE7/8 Quirks Mode support.</li>
+          <li>Added configurable string constants for all text and tooltips. You can now change the default values for different languages.</li>
+          <li>Privatized the RGBA values in the Color object for better NULL handling. YOU MUST USE THE NEW GET FUNCTIONS TO ACCESS THE COLOR PROPERTIES.</li>
+          <li>Better NULL color handling and an additional "No Color Selected" quick pick color.</li>
+          <li>More consistent behavior across multiple versions of browsers.</li>
+          <li>Added alpha response to the binded color picker icon.</li>
+          <li>Removed "alphaSupport" variable. It is now always supported.</li>
+        </ul>
+        <hr />
+      </li>
+      <li>
+        <h3>V1.0.11b:</h3>
+        <ul>
+          <li>Corrected NULL behavior in IE. jQuery was getting an exception when attempting to assign a backgroundColor style of '#'. Now assigns 'transparent' if color is NULL.</li>
+          <li>Can now create new Color object WITH OR WITHOUT the '#' prefix.</li>
+        </ul>
+        <hr />
+      </li>
+      <li>
+        <h3>V1.0.11:</h3>
+        <ul>
+          <li>Added ability for NULL colors (delete the hex value). Color will be returned as color.hex == ''. Can set the default color to an empty hex string as well.</li>
+          <li>cancelCallback now returns the original color for use in programming responses.</li>
+        </ul>
+        <hr />
+      </li>
+      <li>
+        <h3>V1.0.10:</h3>
+        <ul>
+          <li>Corrected table layout and tweaked display for more consisent presentation. Nice catch from Jonathan Pasquier.</li>
+        </ul>
+        <hr />
+      </li>
+      <li>
+        <h3>V1.0.9:</h3>
+        <ul>
+          <li>Added optional title variable for each jPicker window.</li>
+        </ul>
+        <hr />
+      </li>
+      <li>
+        <h3>V1.0.8:</h3>
+        <ul>
+          <li>Moved all images into a few sprites - now using backgroundPosition to change color maps and bars instead of changing the image - this should be faster to download and run.</li>
+        </ul>
+        <hr />
+      </li>
+      <li>
+        <h3>V1.0.7:</h3>
+        <ul>
+          <li>RENAMED CSS FILE TO INCLUDE VERSION NUMBER!!! YOU MUST USE THIS VERSIONED CSS FILE!!! There will be no need to do your own CSS version number increments from now on.</li>
+          <li>Added opacity feedback to color preview boxes.</li>
+          <li>Removed reliance on "id" value of containing object. Subobjects are now found by class and container instead of id's. This drastically reduces injected code.</li>
+          <li>Removed (jQuery).jPicker.getListElementById(id) function since "id" is no longer incorporated or required.</li>
+        </ul>
+        <hr />
+      </li>
+      <li>
+        <h3>V1.0.6:</h3>
+        <ul>
+          <li>Corrected picker bugs introduced with 1.0.5.</li>
+          <li>Removed alpha slider bar until activated - default behavior for alpha is now OFF.</li>
+          <li>Corrected Color constructor bug not allowing values of 0 for initial value (it was evaluating false and missing the init code - Thanks Pavol).</li>
+          <li>Removed title tags (tooltips) from color maps and bars - They get in the way in some browsers (e.g. IE - dragging marker does NOT prevent or hide the tooltip).</li>
+          <li>THERE WERE CSS FILE CHANGES WITH THIS UPDATE!!! IF YOU USE NEVER-EXPIRE HEADERS, YOU WILL NEED TO INCREMENT YOUR CSS FILE VERSION NUMBER!!!</li>
+        </ul>
+        <hr />
+      </li>
+      <li>
+        <h3>V1.0.5:</h3>
+        <ul>
+          <li>Added opacity support to picker and color/callback methods. New property "a" (alpha - range from 0-100) in all color objects now - defaults to 100% opaque. (Thank you Pavol)</li>
+          <li>Added title attributes to input elements - gives short tooltip directions on what button or field does.</li>
+          <li>Commit callback used to fire on control initialization (twice actually) - This has been corrected, it does not fire on initialization.</li>
+          <li>THERE WERE CSS FILE CHANGES WITH THIS UPDATE!!! IF YOU USE NEVER-EXPIRE HEADERS, YOU WILL NEED TO INCREMENT YOUR CSS FILE VERSION NUMBER!!!</li>
+        </ul>
+        <hr />
+      </li>
+      <li>
+        <h3>V1.0.4:</h3>
+        <ul>
+          <li>Added ability for smaller picker icon with expandable window on any DOM element (not just input).</li>
+          <li>"draggable" property renamed to "expandable" and its scope increased to create small picker icon or large static picker.</li>
+        </ul>
+        <hr />
+      </li>
+      <li>
+        <h3>V1.0.3</h3>
+        <ul>
+          <li>Added cancelCallback function for registering an external function when user clicks cancel button. (Thank you Jeff and Pavol)</li>
+        </ul>
+        <hr />
+      </li>
+      <li>
+        <h3>V1.0.2</h3>
+        <ul>
+          <li>Random bug fixes - speed concerns.</li>
+        </ul>
+        <hr />
+      </li>
+      <li>
+        <h3>V1.0.1</h3>
+        <ul>
+          <li>Corrected closure based memeory leak - there may be others?</li>
+        </ul>
+        <hr />
+      </li>
+      <li>
+        <h3>V1.0.0</h3>
+        <ul>
+          <li>First Release.</li>
+        </ul>
+        <hr />
+      </li>
+    </ul>
+  </div>
+</body>
+</html>
Index: trunk/prototype/plugins/jpicker/jPicker.css
===================================================================
--- trunk/prototype/plugins/jpicker/jPicker.css	(revision 5341)
+++ trunk/prototype/plugins/jpicker/jPicker.css	(revision 5341)
@@ -0,0 +1,17 @@
+﻿@media all 
+{
+	#jPicker { margin: 0px 8px; text-align: left; }
+	#jPicker ul { font-size: 15px; margin: 0px 0px 0px 15px; padding: 0px; }
+	#jPicker ul li { list-style: disc; padding: 2px 0px; }
+	#jPicker ul li ul { margin-bottom: 10px; }
+	#jPicker ul li ul li { list-style: circle; }
+	#jPicker p { font-size: 13px; padding: 0px 10px; }
+	#jPicker hr { clear: both; }
+	#jPicker h2.jPicker { font-size: 16px; padding: 20px 10px; }
+	#jPicker code { color: #8bd; font-size: 14px; font-weight: bold; }
+	#jPicker pre { background: #eee; border: 1px solid #000; color: #000; display: block; font-size: 11px; margin: 10px 5px; padding: 5px; }
+	#jPicker span { font-size: 13px; text-align: center; }
+	#jPicker a { color: #ff8050; }
+	#jPicker input { font-size: 13px; padding: 2px 5px; }
+	#jPicker h2 { font-size: 16px; margin: 10px 0px; }
+}
Index: trunk/prototype/plugins/jpicker/jquery-1.4.4.min.js
===================================================================
--- trunk/prototype/plugins/jpicker/jquery-1.4.4.min.js	(revision 5341)
+++ trunk/prototype/plugins/jpicker/jquery-1.4.4.min.js	(revision 5341)
@@ -0,0 +1,167 @@
+/*!
+ * jQuery JavaScript Library v1.4.4
+ * http://jquery.com/
+ *
+ * Copyright 2010, John Resig
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * Includes Sizzle.js
+ * http://sizzlejs.com/
+ * Copyright 2010, The Dojo Foundation
+ * Released under the MIT, BSD, and GPL Licenses.
+ *
+ * Date: Thu Nov 11 19:04:53 2010 -0500
+ */
+(function(E,B){function ka(a,b,d){if(d===B&&a.nodeType===1){d=a.getAttribute("data-"+b);if(typeof d==="string"){try{d=d==="true"?true:d==="false"?false:d==="null"?null:!c.isNaN(d)?parseFloat(d):Ja.test(d)?c.parseJSON(d):d}catch(e){}c.data(a,b,d)}else d=B}return d}function U(){return false}function ca(){return true}function la(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function Ka(a){var b,d,e,f,h,l,k,o,x,r,A,C=[];f=[];h=c.data(this,this.nodeType?"events":"__events__");if(typeof h==="function")h=
+h.events;if(!(a.liveFired===this||!h||!h.live||a.button&&a.type==="click")){if(a.namespace)A=RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)");a.liveFired=this;var J=h.live.slice(0);for(k=0;k<J.length;k++){h=J[k];h.origType.replace(X,"")===a.type?f.push(h.selector):J.splice(k--,1)}f=c(a.target).closest(f,a.currentTarget);o=0;for(x=f.length;o<x;o++){r=f[o];for(k=0;k<J.length;k++){h=J[k];if(r.selector===h.selector&&(!A||A.test(h.namespace))){l=r.elem;e=null;if(h.preType==="mouseenter"||
+h.preType==="mouseleave"){a.type=h.preType;e=c(a.relatedTarget).closest(h.selector)[0]}if(!e||e!==l)C.push({elem:l,handleObj:h,level:r.level})}}}o=0;for(x=C.length;o<x;o++){f=C[o];if(d&&f.level>d)break;a.currentTarget=f.elem;a.data=f.handleObj.data;a.handleObj=f.handleObj;A=f.handleObj.origHandler.apply(f.elem,arguments);if(A===false||a.isPropagationStopped()){d=f.level;if(A===false)b=false;if(a.isImmediatePropagationStopped())break}}return b}}function Y(a,b){return(a&&a!=="*"?a+".":"")+b.replace(La,
+"`").replace(Ma,"&")}function ma(a,b,d){if(c.isFunction(b))return c.grep(a,function(f,h){return!!b.call(f,h,f)===d});else if(b.nodeType)return c.grep(a,function(f){return f===b===d});else if(typeof b==="string"){var e=c.grep(a,function(f){return f.nodeType===1});if(Na.test(b))return c.filter(b,e,!d);else b=c.filter(b,e)}return c.grep(a,function(f){return c.inArray(f,b)>=0===d})}function na(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var e=c.data(a[d++]),f=c.data(this,
+e);if(e=e&&e.events){delete f.handle;f.events={};for(var h in e)for(var l in e[h])c.event.add(this,h,e[h][l],e[h][l].data)}}})}function Oa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function oa(a,b,d){var e=b==="width"?a.offsetWidth:a.offsetHeight;if(d==="border")return e;c.each(b==="width"?Pa:Qa,function(){d||(e-=parseFloat(c.css(a,"padding"+this))||0);if(d==="margin")e+=parseFloat(c.css(a,
+"margin"+this))||0;else e-=parseFloat(c.css(a,"border"+this+"Width"))||0});return e}function da(a,b,d,e){if(c.isArray(b)&&b.length)c.each(b,function(f,h){d||Ra.test(a)?e(a,h):da(a+"["+(typeof h==="object"||c.isArray(h)?f:"")+"]",h,d,e)});else if(!d&&b!=null&&typeof b==="object")c.isEmptyObject(b)?e(a,""):c.each(b,function(f,h){da(a+"["+f+"]",h,d,e)});else e(a,b)}function S(a,b){var d={};c.each(pa.concat.apply([],pa.slice(0,b)),function(){d[this]=a});return d}function qa(a){if(!ea[a]){var b=c("<"+
+a+">").appendTo("body"),d=b.css("display");b.remove();if(d==="none"||d==="")d="block";ea[a]=d}return ea[a]}function fa(a){return c.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var t=E.document,c=function(){function a(){if(!b.isReady){try{t.documentElement.doScroll("left")}catch(j){setTimeout(a,1);return}b.ready()}}var b=function(j,s){return new b.fn.init(j,s)},d=E.jQuery,e=E.$,f,h=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,l=/\S/,k=/^\s+/,o=/\s+$/,x=/\W/,r=/\d/,A=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,
+C=/^[\],:{}\s]*$/,J=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,w=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,I=/(?:^|:|,)(?:\s*\[)+/g,L=/(webkit)[ \/]([\w.]+)/,g=/(opera)(?:.*version)?[ \/]([\w.]+)/,i=/(msie) ([\w.]+)/,n=/(mozilla)(?:.*? rv:([\w.]+))?/,m=navigator.userAgent,p=false,q=[],u,y=Object.prototype.toString,F=Object.prototype.hasOwnProperty,M=Array.prototype.push,N=Array.prototype.slice,O=String.prototype.trim,D=Array.prototype.indexOf,R={};b.fn=b.prototype={init:function(j,
+s){var v,z,H;if(!j)return this;if(j.nodeType){this.context=this[0]=j;this.length=1;return this}if(j==="body"&&!s&&t.body){this.context=t;this[0]=t.body;this.selector="body";this.length=1;return this}if(typeof j==="string")if((v=h.exec(j))&&(v[1]||!s))if(v[1]){H=s?s.ownerDocument||s:t;if(z=A.exec(j))if(b.isPlainObject(s)){j=[t.createElement(z[1])];b.fn.attr.call(j,s,true)}else j=[H.createElement(z[1])];else{z=b.buildFragment([v[1]],[H]);j=(z.cacheable?z.fragment.cloneNode(true):z.fragment).childNodes}return b.merge(this,
+j)}else{if((z=t.getElementById(v[2]))&&z.parentNode){if(z.id!==v[2])return f.find(j);this.length=1;this[0]=z}this.context=t;this.selector=j;return this}else if(!s&&!x.test(j)){this.selector=j;this.context=t;j=t.getElementsByTagName(j);return b.merge(this,j)}else return!s||s.jquery?(s||f).find(j):b(s).find(j);else if(b.isFunction(j))return f.ready(j);if(j.selector!==B){this.selector=j.selector;this.context=j.context}return b.makeArray(j,this)},selector:"",jquery:"1.4.4",length:0,size:function(){return this.length},
+toArray:function(){return N.call(this,0)},get:function(j){return j==null?this.toArray():j<0?this.slice(j)[0]:this[j]},pushStack:function(j,s,v){var z=b();b.isArray(j)?M.apply(z,j):b.merge(z,j);z.prevObject=this;z.context=this.context;if(s==="find")z.selector=this.selector+(this.selector?" ":"")+v;else if(s)z.selector=this.selector+"."+s+"("+v+")";return z},each:function(j,s){return b.each(this,j,s)},ready:function(j){b.bindReady();if(b.isReady)j.call(t,b);else q&&q.push(j);return this},eq:function(j){return j===
+-1?this.slice(j):this.slice(j,+j+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(N.apply(this,arguments),"slice",N.call(arguments).join(","))},map:function(j){return this.pushStack(b.map(this,function(s,v){return j.call(s,v,s)}))},end:function(){return this.prevObject||b(null)},push:M,sort:[].sort,splice:[].splice};b.fn.init.prototype=b.fn;b.extend=b.fn.extend=function(){var j,s,v,z,H,G=arguments[0]||{},K=1,Q=arguments.length,ga=false;
+if(typeof G==="boolean"){ga=G;G=arguments[1]||{};K=2}if(typeof G!=="object"&&!b.isFunction(G))G={};if(Q===K){G=this;--K}for(;K<Q;K++)if((j=arguments[K])!=null)for(s in j){v=G[s];z=j[s];if(G!==z)if(ga&&z&&(b.isPlainObject(z)||(H=b.isArray(z)))){if(H){H=false;v=v&&b.isArray(v)?v:[]}else v=v&&b.isPlainObject(v)?v:{};G[s]=b.extend(ga,v,z)}else if(z!==B)G[s]=z}return G};b.extend({noConflict:function(j){E.$=e;if(j)E.jQuery=d;return b},isReady:false,readyWait:1,ready:function(j){j===true&&b.readyWait--;
+if(!b.readyWait||j!==true&&!b.isReady){if(!t.body)return setTimeout(b.ready,1);b.isReady=true;if(!(j!==true&&--b.readyWait>0))if(q){var s=0,v=q;for(q=null;j=v[s++];)j.call(t,b);b.fn.trigger&&b(t).trigger("ready").unbind("ready")}}},bindReady:function(){if(!p){p=true;if(t.readyState==="complete")return setTimeout(b.ready,1);if(t.addEventListener){t.addEventListener("DOMContentLoaded",u,false);E.addEventListener("load",b.ready,false)}else if(t.attachEvent){t.attachEvent("onreadystatechange",u);E.attachEvent("onload",
+b.ready);var j=false;try{j=E.frameElement==null}catch(s){}t.documentElement.doScroll&&j&&a()}}},isFunction:function(j){return b.type(j)==="function"},isArray:Array.isArray||function(j){return b.type(j)==="array"},isWindow:function(j){return j&&typeof j==="object"&&"setInterval"in j},isNaN:function(j){return j==null||!r.test(j)||isNaN(j)},type:function(j){return j==null?String(j):R[y.call(j)]||"object"},isPlainObject:function(j){if(!j||b.type(j)!=="object"||j.nodeType||b.isWindow(j))return false;if(j.constructor&&
+!F.call(j,"constructor")&&!F.call(j.constructor.prototype,"isPrototypeOf"))return false;for(var s in j);return s===B||F.call(j,s)},isEmptyObject:function(j){for(var s in j)return false;return true},error:function(j){throw j;},parseJSON:function(j){if(typeof j!=="string"||!j)return null;j=b.trim(j);if(C.test(j.replace(J,"@").replace(w,"]").replace(I,"")))return E.JSON&&E.JSON.parse?E.JSON.parse(j):(new Function("return "+j))();else b.error("Invalid JSON: "+j)},noop:function(){},globalEval:function(j){if(j&&
+l.test(j)){var s=t.getElementsByTagName("head")[0]||t.documentElement,v=t.createElement("script");v.type="text/javascript";if(b.support.scriptEval)v.appendChild(t.createTextNode(j));else v.text=j;s.insertBefore(v,s.firstChild);s.removeChild(v)}},nodeName:function(j,s){return j.nodeName&&j.nodeName.toUpperCase()===s.toUpperCase()},each:function(j,s,v){var z,H=0,G=j.length,K=G===B||b.isFunction(j);if(v)if(K)for(z in j){if(s.apply(j[z],v)===false)break}else for(;H<G;){if(s.apply(j[H++],v)===false)break}else if(K)for(z in j){if(s.call(j[z],
+z,j[z])===false)break}else for(v=j[0];H<G&&s.call(v,H,v)!==false;v=j[++H]);return j},trim:O?function(j){return j==null?"":O.call(j)}:function(j){return j==null?"":j.toString().replace(k,"").replace(o,"")},makeArray:function(j,s){var v=s||[];if(j!=null){var z=b.type(j);j.length==null||z==="string"||z==="function"||z==="regexp"||b.isWindow(j)?M.call(v,j):b.merge(v,j)}return v},inArray:function(j,s){if(s.indexOf)return s.indexOf(j);for(var v=0,z=s.length;v<z;v++)if(s[v]===j)return v;return-1},merge:function(j,
+s){var v=j.length,z=0;if(typeof s.length==="number")for(var H=s.length;z<H;z++)j[v++]=s[z];else for(;s[z]!==B;)j[v++]=s[z++];j.length=v;return j},grep:function(j,s,v){var z=[],H;v=!!v;for(var G=0,K=j.length;G<K;G++){H=!!s(j[G],G);v!==H&&z.push(j[G])}return z},map:function(j,s,v){for(var z=[],H,G=0,K=j.length;G<K;G++){H=s(j[G],G,v);if(H!=null)z[z.length]=H}return z.concat.apply([],z)},guid:1,proxy:function(j,s,v){if(arguments.length===2)if(typeof s==="string"){v=j;j=v[s];s=B}else if(s&&!b.isFunction(s)){v=
+s;s=B}if(!s&&j)s=function(){return j.apply(v||this,arguments)};if(j)s.guid=j.guid=j.guid||s.guid||b.guid++;return s},access:function(j,s,v,z,H,G){var K=j.length;if(typeof s==="object"){for(var Q in s)b.access(j,Q,s[Q],z,H,v);return j}if(v!==B){z=!G&&z&&b.isFunction(v);for(Q=0;Q<K;Q++)H(j[Q],s,z?v.call(j[Q],Q,H(j[Q],s)):v,G);return j}return K?H(j[0],s):B},now:function(){return(new Date).getTime()},uaMatch:function(j){j=j.toLowerCase();j=L.exec(j)||g.exec(j)||i.exec(j)||j.indexOf("compatible")<0&&n.exec(j)||
+[];return{browser:j[1]||"",version:j[2]||"0"}},browser:{}});b.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(j,s){R["[object "+s+"]"]=s.toLowerCase()});m=b.uaMatch(m);if(m.browser){b.browser[m.browser]=true;b.browser.version=m.version}if(b.browser.webkit)b.browser.safari=true;if(D)b.inArray=function(j,s){return D.call(s,j)};if(!/\s/.test("\u00a0")){k=/^[\s\xA0]+/;o=/[\s\xA0]+$/}f=b(t);if(t.addEventListener)u=function(){t.removeEventListener("DOMContentLoaded",u,
+false);b.ready()};else if(t.attachEvent)u=function(){if(t.readyState==="complete"){t.detachEvent("onreadystatechange",u);b.ready()}};return E.jQuery=E.$=b}();(function(){c.support={};var a=t.documentElement,b=t.createElement("script"),d=t.createElement("div"),e="script"+c.now();d.style.display="none";d.innerHTML="   <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";var f=d.getElementsByTagName("*"),h=d.getElementsByTagName("a")[0],l=t.createElement("select"),
+k=l.appendChild(t.createElement("option"));if(!(!f||!f.length||!h)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(h.getAttribute("style")),hrefNormalized:h.getAttribute("href")==="/a",opacity:/^0.55$/.test(h.style.opacity),cssFloat:!!h.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:k.selected,deleteExpando:true,optDisabled:false,checkClone:false,
+scriptEval:false,noCloneEvent:true,boxModel:null,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableHiddenOffsets:true};l.disabled=true;c.support.optDisabled=!k.disabled;b.type="text/javascript";try{b.appendChild(t.createTextNode("window."+e+"=1;"))}catch(o){}a.insertBefore(b,a.firstChild);if(E[e]){c.support.scriptEval=true;delete E[e]}try{delete b.test}catch(x){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function r(){c.support.noCloneEvent=
+false;d.detachEvent("onclick",r)});d.cloneNode(true).fireEvent("onclick")}d=t.createElement("div");d.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";a=t.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var r=t.createElement("div");r.style.width=r.style.paddingLeft="1px";t.body.appendChild(r);c.boxModel=c.support.boxModel=r.offsetWidth===2;if("zoom"in r.style){r.style.display="inline";r.style.zoom=
+1;c.support.inlineBlockNeedsLayout=r.offsetWidth===2;r.style.display="";r.innerHTML="<div style='width:4px;'></div>";c.support.shrinkWrapBlocks=r.offsetWidth!==2}r.innerHTML="<table><tr><td style='padding:0;display:none'></td><td>t</td></tr></table>";var A=r.getElementsByTagName("td");c.support.reliableHiddenOffsets=A[0].offsetHeight===0;A[0].style.display="";A[1].style.display="none";c.support.reliableHiddenOffsets=c.support.reliableHiddenOffsets&&A[0].offsetHeight===0;r.innerHTML="";t.body.removeChild(r).style.display=
+"none"});a=function(r){var A=t.createElement("div");r="on"+r;var C=r in A;if(!C){A.setAttribute(r,"return;");C=typeof A[r]==="function"}return C};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=f=h=null}})();var ra={},Ja=/^(?:\{.*\}|\[.*\])$/;c.extend({cache:{},uuid:0,expando:"jQuery"+c.now(),noData:{embed:true,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},data:function(a,b,d){if(c.acceptData(a)){a=a==E?ra:a;var e=a.nodeType,f=e?a[c.expando]:null,h=
+c.cache;if(!(e&&!f&&typeof b==="string"&&d===B)){if(e)f||(a[c.expando]=f=++c.uuid);else h=a;if(typeof b==="object")if(e)h[f]=c.extend(h[f],b);else c.extend(h,b);else if(e&&!h[f])h[f]={};a=e?h[f]:h;if(d!==B)a[b]=d;return typeof b==="string"?a[b]:a}}},removeData:function(a,b){if(c.acceptData(a)){a=a==E?ra:a;var d=a.nodeType,e=d?a[c.expando]:a,f=c.cache,h=d?f[e]:e;if(b){if(h){delete h[b];d&&c.isEmptyObject(h)&&c.removeData(a)}}else if(d&&c.support.deleteExpando)delete a[c.expando];else if(a.removeAttribute)a.removeAttribute(c.expando);
+else if(d)delete f[e];else for(var l in a)delete a[l]}},acceptData:function(a){if(a.nodeName){var b=c.noData[a.nodeName.toLowerCase()];if(b)return!(b===true||a.getAttribute("classid")!==b)}return true}});c.fn.extend({data:function(a,b){var d=null;if(typeof a==="undefined"){if(this.length){var e=this[0].attributes,f;d=c.data(this[0]);for(var h=0,l=e.length;h<l;h++){f=e[h].name;if(f.indexOf("data-")===0){f=f.substr(5);ka(this[0],f,d[f])}}}return d}else if(typeof a==="object")return this.each(function(){c.data(this,
+a)});var k=a.split(".");k[1]=k[1]?"."+k[1]:"";if(b===B){d=this.triggerHandler("getData"+k[1]+"!",[k[0]]);if(d===B&&this.length){d=c.data(this[0],a);d=ka(this[0],a,d)}return d===B&&k[1]?this.data(k[0]):d}else return this.each(function(){var o=c(this),x=[k[0],b];o.triggerHandler("setData"+k[1]+"!",x);c.data(this,a,b);o.triggerHandler("changeData"+k[1]+"!",x)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var e=
+c.data(a,b);if(!d)return e||[];if(!e||c.isArray(d))e=c.data(a,b,c.makeArray(d));else e.push(d);return e}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),e=d.shift();if(e==="inprogress")e=d.shift();if(e){b==="fx"&&d.unshift("inprogress");e.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===B)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,
+a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var sa=/[\n\t]/g,ha=/\s+/,Sa=/\r/g,Ta=/^(?:href|src|style)$/,Ua=/^(?:button|input)$/i,Va=/^(?:button|input|object|select|textarea)$/i,Wa=/^a(?:rea)?$/i,ta=/^(?:radio|checkbox)$/i;c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",
+colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};c.fn.extend({attr:function(a,b){return c.access(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(x){var r=c(this);r.addClass(a.call(this,x,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ha),d=0,e=this.length;d<e;d++){var f=this[d];if(f.nodeType===
+1)if(f.className){for(var h=" "+f.className+" ",l=f.className,k=0,o=b.length;k<o;k++)if(h.indexOf(" "+b[k]+" ")<0)l+=" "+b[k];f.className=c.trim(l)}else f.className=a}return this},removeClass:function(a){if(c.isFunction(a))return this.each(function(o){var x=c(this);x.removeClass(a.call(this,o,x.attr("class")))});if(a&&typeof a==="string"||a===B)for(var b=(a||"").split(ha),d=0,e=this.length;d<e;d++){var f=this[d];if(f.nodeType===1&&f.className)if(a){for(var h=(" "+f.className+" ").replace(sa," "),
+l=0,k=b.length;l<k;l++)h=h.replace(" "+b[l]+" "," ");f.className=c.trim(h)}else f.className=""}return this},toggleClass:function(a,b){var d=typeof a,e=typeof b==="boolean";if(c.isFunction(a))return this.each(function(f){var h=c(this);h.toggleClass(a.call(this,f,h.attr("class"),b),b)});return this.each(function(){if(d==="string")for(var f,h=0,l=c(this),k=b,o=a.split(ha);f=o[h++];){k=e?k:!l.hasClass(f);l[k?"addClass":"removeClass"](f)}else if(d==="undefined"||d==="boolean"){this.className&&c.data(this,
+"__className__",this.className);this.className=this.className||a===false?"":c.data(this,"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,d=this.length;b<d;b++)if((" "+this[b].className+" ").replace(sa," ").indexOf(a)>-1)return true;return false},val:function(a){if(!arguments.length){var b=this[0];if(b){if(c.nodeName(b,"option")){var d=b.attributes.value;return!d||d.specified?b.value:b.text}if(c.nodeName(b,"select")){var e=b.selectedIndex;d=[];var f=b.options;b=b.type==="select-one";
+if(e<0)return null;var h=b?e:0;for(e=b?e+1:f.length;h<e;h++){var l=f[h];if(l.selected&&(c.support.optDisabled?!l.disabled:l.getAttribute("disabled")===null)&&(!l.parentNode.disabled||!c.nodeName(l.parentNode,"optgroup"))){a=c(l).val();if(b)return a;d.push(a)}}return d}if(ta.test(b.type)&&!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Sa,"")}return B}var k=c.isFunction(a);return this.each(function(o){var x=c(this),r=a;if(this.nodeType===1){if(k)r=
+a.call(this,o,x.val());if(r==null)r="";else if(typeof r==="number")r+="";else if(c.isArray(r))r=c.map(r,function(C){return C==null?"":C+""});if(c.isArray(r)&&ta.test(this.type))this.checked=c.inArray(x.val(),r)>=0;else if(c.nodeName(this,"select")){var A=c.makeArray(r);c("option",this).each(function(){this.selected=c.inArray(c(this).val(),A)>=0});if(!A.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},
+attr:function(a,b,d,e){if(!a||a.nodeType===3||a.nodeType===8)return B;if(e&&b in c.attrFn)return c(a)[b](d);e=a.nodeType!==1||!c.isXMLDoc(a);var f=d!==B;b=e&&c.props[b]||b;var h=Ta.test(b);if((b in a||a[b]!==B)&&e&&!h){if(f){b==="type"&&Ua.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");if(d===null)a.nodeType===1&&a.removeAttribute(b);else a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&
+b.specified?b.value:Va.test(a.nodeName)||Wa.test(a.nodeName)&&a.href?0:B;return a[b]}if(!c.support.style&&e&&b==="style"){if(f)a.style.cssText=""+d;return a.style.cssText}f&&a.setAttribute(b,""+d);if(!a.attributes[b]&&a.hasAttribute&&!a.hasAttribute(b))return B;a=!c.support.hrefNormalized&&e&&h?a.getAttribute(b,2):a.getAttribute(b);return a===null?B:a}});var X=/\.(.*)$/,ia=/^(?:textarea|input|select)$/i,La=/\./g,Ma=/ /g,Xa=/[^\w\s.|`]/g,Ya=function(a){return a.replace(Xa,"\\$&")},ua={focusin:0,focusout:0};
+c.event={add:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(c.isWindow(a)&&a!==E&&!a.frameElement)a=E;if(d===false)d=U;else if(!d)return;var f,h;if(d.handler){f=d;d=f.handler}if(!d.guid)d.guid=c.guid++;if(h=c.data(a)){var l=a.nodeType?"events":"__events__",k=h[l],o=h.handle;if(typeof k==="function"){o=k.handle;k=k.events}else if(!k){a.nodeType||(h[l]=h=function(){});h.events=k={}}if(!o)h.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,
+arguments):B};o.elem=a;b=b.split(" ");for(var x=0,r;l=b[x++];){h=f?c.extend({},f):{handler:d,data:e};if(l.indexOf(".")>-1){r=l.split(".");l=r.shift();h.namespace=r.slice(0).sort().join(".")}else{r=[];h.namespace=""}h.type=l;if(!h.guid)h.guid=d.guid;var A=k[l],C=c.event.special[l]||{};if(!A){A=k[l]=[];if(!C.setup||C.setup.call(a,e,r,o)===false)if(a.addEventListener)a.addEventListener(l,o,false);else a.attachEvent&&a.attachEvent("on"+l,o)}if(C.add){C.add.call(a,h);if(!h.handler.guid)h.handler.guid=
+d.guid}A.push(h);c.event.global[l]=true}a=null}}},global:{},remove:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(d===false)d=U;var f,h,l=0,k,o,x,r,A,C,J=a.nodeType?"events":"__events__",w=c.data(a),I=w&&w[J];if(w&&I){if(typeof I==="function"){w=I;I=I.events}if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(f in I)c.event.remove(a,f+b)}else{for(b=b.split(" ");f=b[l++];){r=f;k=f.indexOf(".")<0;o=[];if(!k){o=f.split(".");f=o.shift();x=RegExp("(^|\\.)"+
+c.map(o.slice(0).sort(),Ya).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(A=I[f])if(d){r=c.event.special[f]||{};for(h=e||0;h<A.length;h++){C=A[h];if(d.guid===C.guid){if(k||x.test(C.namespace)){e==null&&A.splice(h--,1);r.remove&&r.remove.call(a,C)}if(e!=null)break}}if(A.length===0||e!=null&&A.length===1){if(!r.teardown||r.teardown.call(a,o)===false)c.removeEvent(a,f,w.handle);delete I[f]}}else for(h=0;h<A.length;h++){C=A[h];if(k||x.test(C.namespace)){c.event.remove(a,r,C.handler,h);A.splice(h--,1)}}}if(c.isEmptyObject(I)){if(b=
+w.handle)b.elem=null;delete w.events;delete w.handle;if(typeof w==="function")c.removeData(a,J);else c.isEmptyObject(w)&&c.removeData(a)}}}}},trigger:function(a,b,d,e){var f=a.type||a;if(!e){a=typeof a==="object"?a[c.expando]?a:c.extend(c.Event(f),a):c.Event(f);if(f.indexOf("!")>=0){a.type=f=f.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[f]&&c.each(c.cache,function(){this.events&&this.events[f]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===
+8)return B;a.result=B;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(e=d.nodeType?c.data(d,"handle"):(c.data(d,"__events__")||{}).handle)&&e.apply(d,b);e=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+f]&&d["on"+f].apply(d,b)===false){a.result=false;a.preventDefault()}}catch(h){}if(!a.isPropagationStopped()&&e)c.event.trigger(a,b,e,true);else if(!a.isDefaultPrevented()){var l;e=a.target;var k=f.replace(X,""),o=c.nodeName(e,"a")&&k===
+"click",x=c.event.special[k]||{};if((!x._default||x._default.call(d,a)===false)&&!o&&!(e&&e.nodeName&&c.noData[e.nodeName.toLowerCase()])){try{if(e[k]){if(l=e["on"+k])e["on"+k]=null;c.event.triggered=true;e[k]()}}catch(r){}if(l)e["on"+k]=l;c.event.triggered=false}}},handle:function(a){var b,d,e,f;d=[];var h=c.makeArray(arguments);a=h[0]=c.event.fix(a||E.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;if(!b){e=a.type.split(".");a.type=e.shift();d=e.slice(0).sort();e=RegExp("(^|\\.)"+
+d.join("\\.(?:.*\\.)?")+"(\\.|$)")}a.namespace=a.namespace||d.join(".");f=c.data(this,this.nodeType?"events":"__events__");if(typeof f==="function")f=f.events;d=(f||{})[a.type];if(f&&d){d=d.slice(0);f=0;for(var l=d.length;f<l;f++){var k=d[f];if(b||e.test(k.namespace)){a.handler=k.handler;a.data=k.data;a.handleObj=k;k=k.handler.apply(this,h);if(k!==B){a.result=k;if(k===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
+fix:function(a){if(a[c.expando])return a;var b=a;a=c.Event(b);for(var d=this.props.length,e;d;){e=this.props[--d];a[e]=b[e]}if(!a.target)a.target=a.srcElement||t;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=t.documentElement;d=t.body;a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop||
+d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0)}if(a.which==null&&(a.charCode!=null||a.keyCode!=null))a.which=a.charCode!=null?a.charCode:a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==B)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a){c.event.add(this,Y(a.origType,a.selector),c.extend({},a,{handler:Ka,guid:a.handler.guid}))},remove:function(a){c.event.remove(this,
+Y(a.origType,a.selector),a)}},beforeunload:{setup:function(a,b,d){if(c.isWindow(this))this.onbeforeunload=d},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};c.removeEvent=t.removeEventListener?function(a,b,d){a.removeEventListener&&a.removeEventListener(b,d,false)}:function(a,b,d){a.detachEvent&&a.detachEvent("on"+b,d)};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent=a;this.type=a.type}else this.type=a;this.timeStamp=
+c.now();this[c.expando]=true};c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=ca;var a=this.originalEvent;if(a)if(a.preventDefault)a.preventDefault();else a.returnValue=false},stopPropagation:function(){this.isPropagationStopped=ca;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=ca;this.stopPropagation()},isDefaultPrevented:U,isPropagationStopped:U,isImmediatePropagationStopped:U};
+var va=function(a){var b=a.relatedTarget;try{for(;b&&b!==this;)b=b.parentNode;if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}}catch(d){}},wa=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?wa:va,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?wa:va)}}});if(!c.support.submitBubbles)c.event.special.submit={setup:function(){if(this.nodeName.toLowerCase()!==
+"form"){c.event.add(this,"click.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="submit"||d==="image")&&c(b).closest("form").length){a.liveFired=B;return la("submit",this,arguments)}});c.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="text"||d==="password")&&c(b).closest("form").length&&a.keyCode===13){a.liveFired=B;return la("submit",this,arguments)}})}else return false},teardown:function(){c.event.remove(this,".specialSubmit")}};if(!c.support.changeBubbles){var V,
+xa=function(a){var b=a.type,d=a.value;if(b==="radio"||b==="checkbox")d=a.checked;else if(b==="select-multiple")d=a.selectedIndex>-1?c.map(a.options,function(e){return e.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},Z=function(a,b){var d=a.target,e,f;if(!(!ia.test(d.nodeName)||d.readOnly)){e=c.data(d,"_change_data");f=xa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",f);if(!(e===B||f===e))if(e!=null||f){a.type="change";a.liveFired=
+B;return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:Z,beforedeactivate:Z,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return Z.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return Z.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,"_change_data",xa(a))}},setup:function(){if(this.type===
+"file")return false;for(var a in V)c.event.add(this,a+".specialChange",V[a]);return ia.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return ia.test(this.nodeName)}};V=c.event.special.change.filters;V.focus=V.beforeactivate}t.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(e){e=c.event.fix(e);e.type=b;return c.event.trigger(e,null,e.target)}c.event.special[b]={setup:function(){ua[b]++===0&&t.addEventListener(a,d,true)},teardown:function(){--ua[b]===
+0&&t.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,e,f){if(typeof d==="object"){for(var h in d)this[b](h,e,d[h],f);return this}if(c.isFunction(e)||e===false){f=e;e=B}var l=b==="one"?c.proxy(f,function(o){c(this).unbind(o,l);return f.apply(this,arguments)}):f;if(d==="unload"&&b!=="one")this.one(d,e,f);else{h=0;for(var k=this.length;h<k;h++)c.event.add(this[h],d,l,e)}return this}});c.fn.extend({unbind:function(a,b){if(typeof a==="object"&&!a.preventDefault)for(var d in a)this.unbind(d,
+a[d]);else{d=0;for(var e=this.length;d<e;d++)c.event.remove(this[d],a,b)}return this},delegate:function(a,b,d,e){return this.live(b,d,e,a)},undelegate:function(a,b,d){return arguments.length===0?this.unbind("live"):this.die(b,null,d,a)},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){var d=c.Event(a);d.preventDefault();d.stopPropagation();c.event.trigger(d,b,this[0]);return d.result}},toggle:function(a){for(var b=arguments,d=
+1;d<b.length;)c.proxy(a,b[d++]);return this.click(c.proxy(a,function(e){var f=(c.data(this,"lastToggle"+a.guid)||0)%d;c.data(this,"lastToggle"+a.guid,f+1);e.preventDefault();return b[f].apply(this,arguments)||false}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var ya={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};c.each(["live","die"],function(a,b){c.fn[b]=function(d,e,f,h){var l,k=0,o,x,r=h||this.selector;h=h?this:c(this.context);if(typeof d===
+"object"&&!d.preventDefault){for(l in d)h[b](l,e,d[l],r);return this}if(c.isFunction(e)){f=e;e=B}for(d=(d||"").split(" ");(l=d[k++])!=null;){o=X.exec(l);x="";if(o){x=o[0];l=l.replace(X,"")}if(l==="hover")d.push("mouseenter"+x,"mouseleave"+x);else{o=l;if(l==="focus"||l==="blur"){d.push(ya[l]+x);l+=x}else l=(ya[l]||l)+x;if(b==="live"){x=0;for(var A=h.length;x<A;x++)c.event.add(h[x],"live."+Y(l,r),{data:e,selector:r,handler:f,origType:l,origHandler:f,preType:o})}else h.unbind("live."+Y(l,r),f)}}return this}});
+c.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){c.fn[b]=function(d,e){if(e==null){e=d;d=null}return arguments.length>0?this.bind(b,d,e):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});E.attachEvent&&!E.addEventListener&&c(E).bind("unload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}});
+(function(){function a(g,i,n,m,p,q){p=0;for(var u=m.length;p<u;p++){var y=m[p];if(y){var F=false;for(y=y[g];y;){if(y.sizcache===n){F=m[y.sizset];break}if(y.nodeType===1&&!q){y.sizcache=n;y.sizset=p}if(y.nodeName.toLowerCase()===i){F=y;break}y=y[g]}m[p]=F}}}function b(g,i,n,m,p,q){p=0;for(var u=m.length;p<u;p++){var y=m[p];if(y){var F=false;for(y=y[g];y;){if(y.sizcache===n){F=m[y.sizset];break}if(y.nodeType===1){if(!q){y.sizcache=n;y.sizset=p}if(typeof i!=="string"){if(y===i){F=true;break}}else if(k.filter(i,
+[y]).length>0){F=y;break}}y=y[g]}m[p]=F}}}var d=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,f=Object.prototype.toString,h=false,l=true;[0,0].sort(function(){l=false;return 0});var k=function(g,i,n,m){n=n||[];var p=i=i||t;if(i.nodeType!==1&&i.nodeType!==9)return[];if(!g||typeof g!=="string")return n;var q,u,y,F,M,N=true,O=k.isXML(i),D=[],R=g;do{d.exec("");if(q=d.exec(R)){R=q[3];D.push(q[1]);if(q[2]){F=q[3];
+break}}}while(q);if(D.length>1&&x.exec(g))if(D.length===2&&o.relative[D[0]])u=L(D[0]+D[1],i);else for(u=o.relative[D[0]]?[i]:k(D.shift(),i);D.length;){g=D.shift();if(o.relative[g])g+=D.shift();u=L(g,u)}else{if(!m&&D.length>1&&i.nodeType===9&&!O&&o.match.ID.test(D[0])&&!o.match.ID.test(D[D.length-1])){q=k.find(D.shift(),i,O);i=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]}if(i){q=m?{expr:D.pop(),set:C(m)}:k.find(D.pop(),D.length===1&&(D[0]==="~"||D[0]==="+")&&i.parentNode?i.parentNode:i,O);u=q.expr?k.filter(q.expr,
+q.set):q.set;if(D.length>0)y=C(u);else N=false;for(;D.length;){q=M=D.pop();if(o.relative[M])q=D.pop();else M="";if(q==null)q=i;o.relative[M](y,q,O)}}else y=[]}y||(y=u);y||k.error(M||g);if(f.call(y)==="[object Array]")if(N)if(i&&i.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&k.contains(i,y[g])))n.push(u[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&n.push(u[g]);else n.push.apply(n,y);else C(y,n);if(F){k(F,p,n,m);k.uniqueSort(n)}return n};k.uniqueSort=function(g){if(w){h=
+l;g.sort(w);if(h)for(var i=1;i<g.length;i++)g[i]===g[i-1]&&g.splice(i--,1)}return g};k.matches=function(g,i){return k(g,null,null,i)};k.matchesSelector=function(g,i){return k(i,null,null,[g]).length>0};k.find=function(g,i,n){var m;if(!g)return[];for(var p=0,q=o.order.length;p<q;p++){var u,y=o.order[p];if(u=o.leftMatch[y].exec(g)){var F=u[1];u.splice(1,1);if(F.substr(F.length-1)!=="\\"){u[1]=(u[1]||"").replace(/\\/g,"");m=o.find[y](u,i,n);if(m!=null){g=g.replace(o.match[y],"");break}}}}m||(m=i.getElementsByTagName("*"));
+return{set:m,expr:g}};k.filter=function(g,i,n,m){for(var p,q,u=g,y=[],F=i,M=i&&i[0]&&k.isXML(i[0]);g&&i.length;){for(var N in o.filter)if((p=o.leftMatch[N].exec(g))!=null&&p[2]){var O,D,R=o.filter[N];D=p[1];q=false;p.splice(1,1);if(D.substr(D.length-1)!=="\\"){if(F===y)y=[];if(o.preFilter[N])if(p=o.preFilter[N](p,F,n,y,m,M)){if(p===true)continue}else q=O=true;if(p)for(var j=0;(D=F[j])!=null;j++)if(D){O=R(D,p,j,F);var s=m^!!O;if(n&&O!=null)if(s)q=true;else F[j]=false;else if(s){y.push(D);q=true}}if(O!==
+B){n||(F=y);g=g.replace(o.match[N],"");if(!q)return[];break}}}if(g===u)if(q==null)k.error(g);else break;u=g}return F};k.error=function(g){throw"Syntax error, unrecognized expression: "+g;};var o=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+\-]*)\))?/,
+POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(g){return g.getAttribute("href")}},relative:{"+":function(g,i){var n=typeof i==="string",m=n&&!/\W/.test(i);n=n&&!m;if(m)i=i.toLowerCase();m=0;for(var p=g.length,q;m<p;m++)if(q=g[m]){for(;(q=q.previousSibling)&&q.nodeType!==1;);g[m]=n||q&&q.nodeName.toLowerCase()===
+i?q||false:q===i}n&&k.filter(i,g,true)},">":function(g,i){var n,m=typeof i==="string",p=0,q=g.length;if(m&&!/\W/.test(i))for(i=i.toLowerCase();p<q;p++){if(n=g[p]){n=n.parentNode;g[p]=n.nodeName.toLowerCase()===i?n:false}}else{for(;p<q;p++)if(n=g[p])g[p]=m?n.parentNode:n.parentNode===i;m&&k.filter(i,g,true)}},"":function(g,i,n){var m,p=e++,q=b;if(typeof i==="string"&&!/\W/.test(i)){m=i=i.toLowerCase();q=a}q("parentNode",i,p,g,m,n)},"~":function(g,i,n){var m,p=e++,q=b;if(typeof i==="string"&&!/\W/.test(i)){m=
+i=i.toLowerCase();q=a}q("previousSibling",i,p,g,m,n)}},find:{ID:function(g,i,n){if(typeof i.getElementById!=="undefined"&&!n)return(g=i.getElementById(g[1]))&&g.parentNode?[g]:[]},NAME:function(g,i){if(typeof i.getElementsByName!=="undefined"){for(var n=[],m=i.getElementsByName(g[1]),p=0,q=m.length;p<q;p++)m[p].getAttribute("name")===g[1]&&n.push(m[p]);return n.length===0?null:n}},TAG:function(g,i){return i.getElementsByTagName(g[1])}},preFilter:{CLASS:function(g,i,n,m,p,q){g=" "+g[1].replace(/\\/g,
+"")+" ";if(q)return g;q=0;for(var u;(u=i[q])!=null;q++)if(u)if(p^(u.className&&(" "+u.className+" ").replace(/[\t\n]/g," ").indexOf(g)>=0))n||m.push(u);else if(n)i[q]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},CHILD:function(g){if(g[1]==="nth"){var i=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=i[1]+(i[2]||1)-0;g[3]=i[3]-0}g[0]=e++;return g},ATTR:function(g,i,n,
+m,p,q){i=g[1].replace(/\\/g,"");if(!q&&o.attrMap[i])g[1]=o.attrMap[i];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,i,n,m,p){if(g[1]==="not")if((d.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,i);else{g=k.filter(g[3],i,n,true^p);n||m.push.apply(m,g);return false}else if(o.match.POS.test(g[0])||o.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===
+true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,i,n){return!!k(n[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===
+g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},setFilters:{first:function(g,i){return i===0},last:function(g,i,n,m){return i===m.length-1},even:function(g,i){return i%2===0},odd:function(g,i){return i%2===1},lt:function(g,i,n){return i<n[3]-0},gt:function(g,i,n){return i>n[3]-0},nth:function(g,i,n){return n[3]-
+0===i},eq:function(g,i,n){return n[3]-0===i}},filter:{PSEUDO:function(g,i,n,m){var p=i[1],q=o.filters[p];if(q)return q(g,n,i,m);else if(p==="contains")return(g.textContent||g.innerText||k.getText([g])||"").indexOf(i[3])>=0;else if(p==="not"){i=i[3];n=0;for(m=i.length;n<m;n++)if(i[n]===g)return false;return true}else k.error("Syntax error, unrecognized expression: "+p)},CHILD:function(g,i){var n=i[1],m=g;switch(n){case "only":case "first":for(;m=m.previousSibling;)if(m.nodeType===1)return false;if(n===
+"first")return true;m=g;case "last":for(;m=m.nextSibling;)if(m.nodeType===1)return false;return true;case "nth":n=i[2];var p=i[3];if(n===1&&p===0)return true;var q=i[0],u=g.parentNode;if(u&&(u.sizcache!==q||!g.nodeIndex)){var y=0;for(m=u.firstChild;m;m=m.nextSibling)if(m.nodeType===1)m.nodeIndex=++y;u.sizcache=q}m=g.nodeIndex-p;return n===0?m===0:m%n===0&&m/n>=0}},ID:function(g,i){return g.nodeType===1&&g.getAttribute("id")===i},TAG:function(g,i){return i==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===
+i},CLASS:function(g,i){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(i)>-1},ATTR:function(g,i){var n=i[1];n=o.attrHandle[n]?o.attrHandle[n](g):g[n]!=null?g[n]:g.getAttribute(n);var m=n+"",p=i[2],q=i[4];return n==null?p==="!=":p==="="?m===q:p==="*="?m.indexOf(q)>=0:p==="~="?(" "+m+" ").indexOf(q)>=0:!q?m&&n!==false:p==="!="?m!==q:p==="^="?m.indexOf(q)===0:p==="$="?m.substr(m.length-q.length)===q:p==="|="?m===q||m.substr(0,q.length+1)===q+"-":false},POS:function(g,i,n,m){var p=o.setFilters[i[2]];
+if(p)return p(g,n,i,m)}}},x=o.match.POS,r=function(g,i){return"\\"+(i-0+1)},A;for(A in o.match){o.match[A]=RegExp(o.match[A].source+/(?![^\[]*\])(?![^\(]*\))/.source);o.leftMatch[A]=RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[A].source.replace(/\\(\d+)/g,r))}var C=function(g,i){g=Array.prototype.slice.call(g,0);if(i){i.push.apply(i,g);return i}return g};try{Array.prototype.slice.call(t.documentElement.childNodes,0)}catch(J){C=function(g,i){var n=0,m=i||[];if(f.call(g)==="[object Array]")Array.prototype.push.apply(m,
+g);else if(typeof g.length==="number")for(var p=g.length;n<p;n++)m.push(g[n]);else for(;g[n];n++)m.push(g[n]);return m}}var w,I;if(t.documentElement.compareDocumentPosition)w=function(g,i){if(g===i){h=true;return 0}if(!g.compareDocumentPosition||!i.compareDocumentPosition)return g.compareDocumentPosition?-1:1;return g.compareDocumentPosition(i)&4?-1:1};else{w=function(g,i){var n,m,p=[],q=[];n=g.parentNode;m=i.parentNode;var u=n;if(g===i){h=true;return 0}else if(n===m)return I(g,i);else if(n){if(!m)return 1}else return-1;
+for(;u;){p.unshift(u);u=u.parentNode}for(u=m;u;){q.unshift(u);u=u.parentNode}n=p.length;m=q.length;for(u=0;u<n&&u<m;u++)if(p[u]!==q[u])return I(p[u],q[u]);return u===n?I(g,q[u],-1):I(p[u],i,1)};I=function(g,i,n){if(g===i)return n;for(g=g.nextSibling;g;){if(g===i)return-1;g=g.nextSibling}return 1}}k.getText=function(g){for(var i="",n,m=0;g[m];m++){n=g[m];if(n.nodeType===3||n.nodeType===4)i+=n.nodeValue;else if(n.nodeType!==8)i+=k.getText(n.childNodes)}return i};(function(){var g=t.createElement("div"),
+i="script"+(new Date).getTime(),n=t.documentElement;g.innerHTML="<a name='"+i+"'/>";n.insertBefore(g,n.firstChild);if(t.getElementById(i)){o.find.ID=function(m,p,q){if(typeof p.getElementById!=="undefined"&&!q)return(p=p.getElementById(m[1]))?p.id===m[1]||typeof p.getAttributeNode!=="undefined"&&p.getAttributeNode("id").nodeValue===m[1]?[p]:B:[]};o.filter.ID=function(m,p){var q=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&q&&q.nodeValue===p}}n.removeChild(g);
+n=g=null})();(function(){var g=t.createElement("div");g.appendChild(t.createComment(""));if(g.getElementsByTagName("*").length>0)o.find.TAG=function(i,n){var m=n.getElementsByTagName(i[1]);if(i[1]==="*"){for(var p=[],q=0;m[q];q++)m[q].nodeType===1&&p.push(m[q]);m=p}return m};g.innerHTML="<a href='#'></a>";if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")o.attrHandle.href=function(i){return i.getAttribute("href",2)};g=null})();t.querySelectorAll&&
+function(){var g=k,i=t.createElement("div");i.innerHTML="<p class='TEST'></p>";if(!(i.querySelectorAll&&i.querySelectorAll(".TEST").length===0)){k=function(m,p,q,u){p=p||t;m=m.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!u&&!k.isXML(p))if(p.nodeType===9)try{return C(p.querySelectorAll(m),q)}catch(y){}else if(p.nodeType===1&&p.nodeName.toLowerCase()!=="object"){var F=p.getAttribute("id"),M=F||"__sizzle__";F||p.setAttribute("id",M);try{return C(p.querySelectorAll("#"+M+" "+m),q)}catch(N){}finally{F||
+p.removeAttribute("id")}}return g(m,p,q,u)};for(var n in g)k[n]=g[n];i=null}}();(function(){var g=t.documentElement,i=g.matchesSelector||g.mozMatchesSelector||g.webkitMatchesSelector||g.msMatchesSelector,n=false;try{i.call(t.documentElement,"[test!='']:sizzle")}catch(m){n=true}if(i)k.matchesSelector=function(p,q){q=q.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(p))try{if(n||!o.match.PSEUDO.test(q)&&!/!=/.test(q))return i.call(p,q)}catch(u){}return k(q,null,null,[p]).length>0}})();(function(){var g=
+t.createElement("div");g.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){o.order.splice(1,0,"CLASS");o.find.CLASS=function(i,n,m){if(typeof n.getElementsByClassName!=="undefined"&&!m)return n.getElementsByClassName(i[1])};g=null}}})();k.contains=t.documentElement.contains?function(g,i){return g!==i&&(g.contains?g.contains(i):true)}:t.documentElement.compareDocumentPosition?
+function(g,i){return!!(g.compareDocumentPosition(i)&16)}:function(){return false};k.isXML=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false};var L=function(g,i){for(var n,m=[],p="",q=i.nodeType?[i]:i;n=o.match.PSEUDO.exec(g);){p+=n[0];g=g.replace(o.match.PSEUDO,"")}g=o.relative[g]?g+"*":g;n=0;for(var u=q.length;n<u;n++)k(g,q[n],m);return k.filter(p,m)};c.find=k;c.expr=k.selectors;c.expr[":"]=c.expr.filters;c.unique=k.uniqueSort;c.text=k.getText;c.isXMLDoc=k.isXML;
+c.contains=k.contains})();var Za=/Until$/,$a=/^(?:parents|prevUntil|prevAll)/,ab=/,/,Na=/^.[^:#\[\.,]*$/,bb=Array.prototype.slice,cb=c.expr.match.POS;c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,e=0,f=this.length;e<f;e++){d=b.length;c.find(a,this[e],b);if(e>0)for(var h=d;h<b.length;h++)for(var l=0;l<d;l++)if(b[l]===b[h]){b.splice(h--,1);break}}return b},has:function(a){var b=c(a);return this.filter(function(){for(var d=0,e=b.length;d<e;d++)if(c.contains(this,b[d]))return true})},
+not:function(a){return this.pushStack(ma(this,a,false),"not",a)},filter:function(a){return this.pushStack(ma(this,a,true),"filter",a)},is:function(a){return!!a&&c.filter(a,this).length>0},closest:function(a,b){var d=[],e,f,h=this[0];if(c.isArray(a)){var l,k={},o=1;if(h&&a.length){e=0;for(f=a.length;e<f;e++){l=a[e];k[l]||(k[l]=c.expr.match.POS.test(l)?c(l,b||this.context):l)}for(;h&&h.ownerDocument&&h!==b;){for(l in k){e=k[l];if(e.jquery?e.index(h)>-1:c(h).is(e))d.push({selector:l,elem:h,level:o})}h=
+h.parentNode;o++}}return d}l=cb.test(a)?c(a,b||this.context):null;e=0;for(f=this.length;e<f;e++)for(h=this[e];h;)if(l?l.index(h)>-1:c.find.matchesSelector(h,a)){d.push(h);break}else{h=h.parentNode;if(!h||!h.ownerDocument||h===b)break}d=d.length>1?c.unique(d):d;return this.pushStack(d,"closest",a)},index:function(a){if(!a||typeof a==="string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var d=typeof a==="string"?c(a,b||this.context):
+c.makeArray(a),e=c.merge(this.get(),d);return this.pushStack(!d[0]||!d[0].parentNode||d[0].parentNode.nodeType===11||!e[0]||!e[0].parentNode||e[0].parentNode.nodeType===11?e:c.unique(e))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,
+2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,
+b){c.fn[a]=function(d,e){var f=c.map(this,b,d);Za.test(a)||(e=d);if(e&&typeof e==="string")f=c.filter(e,f);f=this.length>1?c.unique(f):f;if((this.length>1||ab.test(e))&&$a.test(a))f=f.reverse();return this.pushStack(f,a,bb.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return b.length===1?c.find.matchesSelector(b[0],a)?[b[0]]:[]:c.find.matches(a,b)},dir:function(a,b,d){var e=[];for(a=a[b];a&&a.nodeType!==9&&(d===B||a.nodeType!==1||!c(a).is(d));){a.nodeType===1&&
+e.push(a);a=a[b]}return e},nth:function(a,b,d){b=b||1;for(var e=0;a;a=a[d])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var za=/ jQuery\d+="(?:\d+|null)"/g,$=/^\s+/,Aa=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Ba=/<([\w:]+)/,db=/<tbody/i,eb=/<|&#?\w+;/,Ca=/<(?:script|object|embed|option|style)/i,Da=/checked\s*(?:[^=]|=\s*.checked.)/i,fb=/\=([^="'>\s]+\/)>/g,P={option:[1,
+"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};P.optgroup=P.option;P.tbody=P.tfoot=P.colgroup=P.caption=P.thead;P.th=P.td;if(!c.support.htmlSerialize)P._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=
+c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==B)return this.empty().append((this[0]&&this[0].ownerDocument||t).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this},
+wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})},
+prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,
+this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,e;(e=this[d])!=null;d++)if(!a||c.filter(a,[e]).length){if(!b&&e.nodeType===1){c.cleanData(e.getElementsByTagName("*"));c.cleanData([e])}e.parentNode&&e.parentNode.removeChild(e)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild);
+return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,e=this.ownerDocument;if(!d){d=e.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(za,"").replace(fb,'="$1">').replace($,"")],e)[0]}else return this.cloneNode(true)});if(a===true){na(this,b);na(this.find("*"),b.find("*"))}return b},html:function(a){if(a===B)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(za,""):null;
+else if(typeof a==="string"&&!Ca.test(a)&&(c.support.leadingWhitespace||!$.test(a))&&!P[(Ba.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Aa,"<$1></$2>");try{for(var b=0,d=this.length;b<d;b++)if(this[b].nodeType===1){c.cleanData(this[b].getElementsByTagName("*"));this[b].innerHTML=a}}catch(e){this.empty().append(a)}}else c.isFunction(a)?this.each(function(f){var h=c(this);h.html(a.call(this,f,h.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(c.isFunction(a))return this.each(function(b){var d=
+c(this),e=d.html();d.replaceWith(a.call(this,b,e))});if(typeof a!=="string")a=c(a).detach();return this.each(function(){var b=this.nextSibling,d=this.parentNode;c(this).remove();b?c(b).before(a):c(d).append(a)})}else return this.pushStack(c(c.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,true)},domManip:function(a,b,d){var e,f,h,l=a[0],k=[];if(!c.support.checkClone&&arguments.length===3&&typeof l==="string"&&Da.test(l))return this.each(function(){c(this).domManip(a,
+b,d,true)});if(c.isFunction(l))return this.each(function(x){var r=c(this);a[0]=l.call(this,x,b?r.html():B);r.domManip(a,b,d)});if(this[0]){e=l&&l.parentNode;e=c.support.parentNode&&e&&e.nodeType===11&&e.childNodes.length===this.length?{fragment:e}:c.buildFragment(a,this,k);h=e.fragment;if(f=h.childNodes.length===1?h=h.firstChild:h.firstChild){b=b&&c.nodeName(f,"tr");f=0;for(var o=this.length;f<o;f++)d.call(b?c.nodeName(this[f],"table")?this[f].getElementsByTagName("tbody")[0]||this[f].appendChild(this[f].ownerDocument.createElement("tbody")):
+this[f]:this[f],f>0||e.cacheable||this.length>1?h.cloneNode(true):h)}k.length&&c.each(k,Oa)}return this}});c.buildFragment=function(a,b,d){var e,f,h;b=b&&b[0]?b[0].ownerDocument||b[0]:t;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===t&&!Ca.test(a[0])&&(c.support.checkClone||!Da.test(a[0]))){f=true;if(h=c.fragments[a[0]])if(h!==1)e=h}if(!e){e=b.createDocumentFragment();c.clean(a,b,e,d)}if(f)c.fragments[a[0]]=h?e:1;return{fragment:e,cacheable:f}};c.fragments={};c.each({appendTo:"append",
+prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var e=[];d=c(d);var f=this.length===1&&this[0].parentNode;if(f&&f.nodeType===11&&f.childNodes.length===1&&d.length===1){d[b](this[0]);return this}else{f=0;for(var h=d.length;f<h;f++){var l=(f>0?this.clone(true):this).get();c(d[f])[b](l);e=e.concat(l)}return this.pushStack(e,a,d.selector)}}});c.extend({clean:function(a,b,d,e){b=b||t;if(typeof b.createElement==="undefined")b=b.ownerDocument||
+b[0]&&b[0].ownerDocument||t;for(var f=[],h=0,l;(l=a[h])!=null;h++){if(typeof l==="number")l+="";if(l){if(typeof l==="string"&&!eb.test(l))l=b.createTextNode(l);else if(typeof l==="string"){l=l.replace(Aa,"<$1></$2>");var k=(Ba.exec(l)||["",""])[1].toLowerCase(),o=P[k]||P._default,x=o[0],r=b.createElement("div");for(r.innerHTML=o[1]+l+o[2];x--;)r=r.lastChild;if(!c.support.tbody){x=db.test(l);k=k==="table"&&!x?r.firstChild&&r.firstChild.childNodes:o[1]==="<table>"&&!x?r.childNodes:[];for(o=k.length-
+1;o>=0;--o)c.nodeName(k[o],"tbody")&&!k[o].childNodes.length&&k[o].parentNode.removeChild(k[o])}!c.support.leadingWhitespace&&$.test(l)&&r.insertBefore(b.createTextNode($.exec(l)[0]),r.firstChild);l=r.childNodes}if(l.nodeType)f.push(l);else f=c.merge(f,l)}}if(d)for(h=0;f[h];h++)if(e&&c.nodeName(f[h],"script")&&(!f[h].type||f[h].type.toLowerCase()==="text/javascript"))e.push(f[h].parentNode?f[h].parentNode.removeChild(f[h]):f[h]);else{f[h].nodeType===1&&f.splice.apply(f,[h+1,0].concat(c.makeArray(f[h].getElementsByTagName("script"))));
+d.appendChild(f[h])}return f},cleanData:function(a){for(var b,d,e=c.cache,f=c.event.special,h=c.support.deleteExpando,l=0,k;(k=a[l])!=null;l++)if(!(k.nodeName&&c.noData[k.nodeName.toLowerCase()]))if(d=k[c.expando]){if((b=e[d])&&b.events)for(var o in b.events)f[o]?c.event.remove(k,o):c.removeEvent(k,o,b.handle);if(h)delete k[c.expando];else k.removeAttribute&&k.removeAttribute(c.expando);delete e[d]}}});var Ea=/alpha\([^)]*\)/i,gb=/opacity=([^)]*)/,hb=/-([a-z])/ig,ib=/([A-Z])/g,Fa=/^-?\d+(?:px)?$/i,
+jb=/^-?\d/,kb={position:"absolute",visibility:"hidden",display:"block"},Pa=["Left","Right"],Qa=["Top","Bottom"],W,Ga,aa,lb=function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){if(arguments.length===2&&b===B)return this;return c.access(this,a,b,true,function(d,e,f){return f!==B?c.style(d,e,f):c.css(d,e)})};c.extend({cssHooks:{opacity:{get:function(a,b){if(b){var d=W(a,"opacity","opacity");return d===""?"1":d}else return a.style.opacity}}},cssNumber:{zIndex:true,fontWeight:true,opacity:true,
+zoom:true,lineHeight:true},cssProps:{"float":c.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,d,e){if(!(!a||a.nodeType===3||a.nodeType===8||!a.style)){var f,h=c.camelCase(b),l=a.style,k=c.cssHooks[h];b=c.cssProps[h]||h;if(d!==B){if(!(typeof d==="number"&&isNaN(d)||d==null)){if(typeof d==="number"&&!c.cssNumber[h])d+="px";if(!k||!("set"in k)||(d=k.set(a,d))!==B)try{l[b]=d}catch(o){}}}else{if(k&&"get"in k&&(f=k.get(a,false,e))!==B)return f;return l[b]}}},css:function(a,b,d){var e,f=c.camelCase(b),
+h=c.cssHooks[f];b=c.cssProps[f]||f;if(h&&"get"in h&&(e=h.get(a,true,d))!==B)return e;else if(W)return W(a,b,f)},swap:function(a,b,d){var e={},f;for(f in b){e[f]=a.style[f];a.style[f]=b[f]}d.call(a);for(f in b)a.style[f]=e[f]},camelCase:function(a){return a.replace(hb,lb)}});c.curCSS=c.css;c.each(["height","width"],function(a,b){c.cssHooks[b]={get:function(d,e,f){var h;if(e){if(d.offsetWidth!==0)h=oa(d,b,f);else c.swap(d,kb,function(){h=oa(d,b,f)});if(h<=0){h=W(d,b,b);if(h==="0px"&&aa)h=aa(d,b,b);
+if(h!=null)return h===""||h==="auto"?"0px":h}if(h<0||h==null){h=d.style[b];return h===""||h==="auto"?"0px":h}return typeof h==="string"?h:h+"px"}},set:function(d,e){if(Fa.test(e)){e=parseFloat(e);if(e>=0)return e+"px"}else return e}}});if(!c.support.opacity)c.cssHooks.opacity={get:function(a,b){return gb.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var d=a.style;d.zoom=1;var e=c.isNaN(b)?"":"alpha(opacity="+b*100+")",f=
+d.filter||"";d.filter=Ea.test(f)?f.replace(Ea,e):d.filter+" "+e}};if(t.defaultView&&t.defaultView.getComputedStyle)Ga=function(a,b,d){var e;d=d.replace(ib,"-$1").toLowerCase();if(!(b=a.ownerDocument.defaultView))return B;if(b=b.getComputedStyle(a,null)){e=b.getPropertyValue(d);if(e===""&&!c.contains(a.ownerDocument.documentElement,a))e=c.style(a,d)}return e};if(t.documentElement.currentStyle)aa=function(a,b){var d,e,f=a.currentStyle&&a.currentStyle[b],h=a.style;if(!Fa.test(f)&&jb.test(f)){d=h.left;
+e=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;h.left=b==="fontSize"?"1em":f||0;f=h.pixelLeft+"px";h.left=d;a.runtimeStyle.left=e}return f===""?"auto":f};W=Ga||aa;if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=a.offsetHeight;return a.offsetWidth===0&&b===0||!c.support.reliableHiddenOffsets&&(a.style.display||c.css(a,"display"))==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var mb=c.now(),nb=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
+ob=/^(?:select|textarea)/i,pb=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,qb=/^(?:GET|HEAD)$/,Ra=/\[\]$/,T=/\=\?(&|$)/,ja=/\?/,rb=/([?&])_=[^&]*/,sb=/^(\w+:)?\/\/([^\/?#]+)/,tb=/%20/g,ub=/#.*$/,Ha=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!=="string"&&Ha)return Ha.apply(this,arguments);else if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var f=a.slice(e,a.length);a=a.slice(0,e)}e="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b===
+"object"){b=c.param(b,c.ajaxSettings.traditional);e="POST"}var h=this;c.ajax({url:a,type:e,dataType:"html",data:b,complete:function(l,k){if(k==="success"||k==="notmodified")h.html(f?c("<div>").append(l.responseText.replace(nb,"")).find(f):l.responseText);d&&h.each(d,[l.responseText,k,l])}});return this},serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&
+!this.disabled&&(this.checked||ob.test(this.nodeName)||pb.test(this.type))}).map(function(a,b){var d=c(this).val();return d==null?null:c.isArray(d)?c.map(d,function(e){return{name:b.name,value:e}}):{name:b.name,value:d}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,e){if(c.isFunction(b)){e=e||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:e})},
+getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,e){if(c.isFunction(b)){e=e||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:e})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return new E.XMLHttpRequest},accepts:{xml:"application/xml, text/xml",html:"text/html",
+script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},ajax:function(a){var b=c.extend(true,{},c.ajaxSettings,a),d,e,f,h=b.type.toUpperCase(),l=qb.test(h);b.url=b.url.replace(ub,"");b.context=a&&a.context!=null?a.context:b;if(b.data&&b.processData&&typeof b.data!=="string")b.data=c.param(b.data,b.traditional);if(b.dataType==="jsonp"){if(h==="GET")T.test(b.url)||(b.url+=(ja.test(b.url)?"&":"?")+(b.jsonp||"callback")+"=?");else if(!b.data||
+!T.test(b.data))b.data=(b.data?b.data+"&":"")+(b.jsonp||"callback")+"=?";b.dataType="json"}if(b.dataType==="json"&&(b.data&&T.test(b.data)||T.test(b.url))){d=b.jsonpCallback||"jsonp"+mb++;if(b.data)b.data=(b.data+"").replace(T,"="+d+"$1");b.url=b.url.replace(T,"="+d+"$1");b.dataType="script";var k=E[d];E[d]=function(m){if(c.isFunction(k))k(m);else{E[d]=B;try{delete E[d]}catch(p){}}f=m;c.handleSuccess(b,w,e,f);c.handleComplete(b,w,e,f);r&&r.removeChild(A)}}if(b.dataType==="script"&&b.cache===null)b.cache=
+false;if(b.cache===false&&l){var o=c.now(),x=b.url.replace(rb,"$1_="+o);b.url=x+(x===b.url?(ja.test(b.url)?"&":"?")+"_="+o:"")}if(b.data&&l)b.url+=(ja.test(b.url)?"&":"?")+b.data;b.global&&c.active++===0&&c.event.trigger("ajaxStart");o=(o=sb.exec(b.url))&&(o[1]&&o[1].toLowerCase()!==location.protocol||o[2].toLowerCase()!==location.host);if(b.dataType==="script"&&h==="GET"&&o){var r=t.getElementsByTagName("head")[0]||t.documentElement,A=t.createElement("script");if(b.scriptCharset)A.charset=b.scriptCharset;
+A.src=b.url;if(!d){var C=false;A.onload=A.onreadystatechange=function(){if(!C&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){C=true;c.handleSuccess(b,w,e,f);c.handleComplete(b,w,e,f);A.onload=A.onreadystatechange=null;r&&A.parentNode&&r.removeChild(A)}}}r.insertBefore(A,r.firstChild);return B}var J=false,w=b.xhr();if(w){b.username?w.open(h,b.url,b.async,b.username,b.password):w.open(h,b.url,b.async);try{if(b.data!=null&&!l||a&&a.contentType)w.setRequestHeader("Content-Type",
+b.contentType);if(b.ifModified){c.lastModified[b.url]&&w.setRequestHeader("If-Modified-Since",c.lastModified[b.url]);c.etag[b.url]&&w.setRequestHeader("If-None-Match",c.etag[b.url])}o||w.setRequestHeader("X-Requested-With","XMLHttpRequest");w.setRequestHeader("Accept",b.dataType&&b.accepts[b.dataType]?b.accepts[b.dataType]+", */*; q=0.01":b.accepts._default)}catch(I){}if(b.beforeSend&&b.beforeSend.call(b.context,w,b)===false){b.global&&c.active--===1&&c.event.trigger("ajaxStop");w.abort();return false}b.global&&
+c.triggerGlobal(b,"ajaxSend",[w,b]);var L=w.onreadystatechange=function(m){if(!w||w.readyState===0||m==="abort"){J||c.handleComplete(b,w,e,f);J=true;if(w)w.onreadystatechange=c.noop}else if(!J&&w&&(w.readyState===4||m==="timeout")){J=true;w.onreadystatechange=c.noop;e=m==="timeout"?"timeout":!c.httpSuccess(w)?"error":b.ifModified&&c.httpNotModified(w,b.url)?"notmodified":"success";var p;if(e==="success")try{f=c.httpData(w,b.dataType,b)}catch(q){e="parsererror";p=q}if(e==="success"||e==="notmodified")d||
+c.handleSuccess(b,w,e,f);else c.handleError(b,w,e,p);d||c.handleComplete(b,w,e,f);m==="timeout"&&w.abort();if(b.async)w=null}};try{var g=w.abort;w.abort=function(){w&&Function.prototype.call.call(g,w);L("abort")}}catch(i){}b.async&&b.timeout>0&&setTimeout(function(){w&&!J&&L("timeout")},b.timeout);try{w.send(l||b.data==null?null:b.data)}catch(n){c.handleError(b,w,null,n);c.handleComplete(b,w,e,f)}b.async||L();return w}},param:function(a,b){var d=[],e=function(h,l){l=c.isFunction(l)?l():l;d[d.length]=
+encodeURIComponent(h)+"="+encodeURIComponent(l)};if(b===B)b=c.ajaxSettings.traditional;if(c.isArray(a)||a.jquery)c.each(a,function(){e(this.name,this.value)});else for(var f in a)da(f,a[f],b,e);return d.join("&").replace(tb,"+")}});c.extend({active:0,lastModified:{},etag:{},handleError:function(a,b,d,e){a.error&&a.error.call(a.context,b,d,e);a.global&&c.triggerGlobal(a,"ajaxError",[b,a,e])},handleSuccess:function(a,b,d,e){a.success&&a.success.call(a.context,e,d,b);a.global&&c.triggerGlobal(a,"ajaxSuccess",
+[b,a])},handleComplete:function(a,b,d){a.complete&&a.complete.call(a.context,b,d);a.global&&c.triggerGlobal(a,"ajaxComplete",[b,a]);a.global&&c.active--===1&&c.event.trigger("ajaxStop")},triggerGlobal:function(a,b,d){(a.context&&a.context.url==null?c(a.context):c.event).trigger(b,d)},httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===1223}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),
+e=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(e)c.etag[b]=e;return a.status===304},httpData:function(a,b,d){var e=a.getResponseHeader("content-type")||"",f=b==="xml"||!b&&e.indexOf("xml")>=0;a=f?a.responseXML:a.responseText;f&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b==="json"||!b&&e.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&e.indexOf("javascript")>=0)c.globalEval(a);return a}});
+if(E.ActiveXObject)c.ajaxSettings.xhr=function(){if(E.location.protocol!=="file:")try{return new E.XMLHttpRequest}catch(a){}try{return new E.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}};c.support.ajax=!!c.ajaxSettings.xhr();var ea={},vb=/^(?:toggle|show|hide)$/,wb=/^([+\-]=)?([\d+.\-]+)(.*)$/,ba,pa=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b,d){if(a||a===0)return this.animate(S("show",
+3),a,b,d);else{d=0;for(var e=this.length;d<e;d++){a=this[d];b=a.style.display;if(!c.data(a,"olddisplay")&&b==="none")b=a.style.display="";b===""&&c.css(a,"display")==="none"&&c.data(a,"olddisplay",qa(a.nodeName))}for(d=0;d<e;d++){a=this[d];b=a.style.display;if(b===""||b==="none")a.style.display=c.data(a,"olddisplay")||""}return this}},hide:function(a,b,d){if(a||a===0)return this.animate(S("hide",3),a,b,d);else{a=0;for(b=this.length;a<b;a++){d=c.css(this[a],"display");d!=="none"&&c.data(this[a],"olddisplay",
+d)}for(a=0;a<b;a++)this[a].style.display="none";return this}},_toggle:c.fn.toggle,toggle:function(a,b,d){var e=typeof a==="boolean";if(c.isFunction(a)&&c.isFunction(b))this._toggle.apply(this,arguments);else a==null||e?this.each(function(){var f=e?a:c(this).is(":hidden");c(this)[f?"show":"hide"]()}):this.animate(S("toggle",3),a,b,d);return this},fadeTo:function(a,b,d,e){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,d,e)},animate:function(a,b,d,e){var f=c.speed(b,
+d,e);if(c.isEmptyObject(a))return this.each(f.complete);return this[f.queue===false?"each":"queue"](function(){var h=c.extend({},f),l,k=this.nodeType===1,o=k&&c(this).is(":hidden"),x=this;for(l in a){var r=c.camelCase(l);if(l!==r){a[r]=a[l];delete a[l];l=r}if(a[l]==="hide"&&o||a[l]==="show"&&!o)return h.complete.call(this);if(k&&(l==="height"||l==="width")){h.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY];if(c.css(this,"display")==="inline"&&c.css(this,"float")==="none")if(c.support.inlineBlockNeedsLayout)if(qa(this.nodeName)===
+"inline")this.style.display="inline-block";else{this.style.display="inline";this.style.zoom=1}else this.style.display="inline-block"}if(c.isArray(a[l])){(h.specialEasing=h.specialEasing||{})[l]=a[l][1];a[l]=a[l][0]}}if(h.overflow!=null)this.style.overflow="hidden";h.curAnim=c.extend({},a);c.each(a,function(A,C){var J=new c.fx(x,h,A);if(vb.test(C))J[C==="toggle"?o?"show":"hide":C](a);else{var w=wb.exec(C),I=J.cur()||0;if(w){var L=parseFloat(w[2]),g=w[3]||"px";if(g!=="px"){c.style(x,A,(L||1)+g);I=(L||
+1)/J.cur()*I;c.style(x,A,I+g)}if(w[1])L=(w[1]==="-="?-1:1)*L+I;J.custom(I,L,g)}else J.custom(I,C,"")}});return true})},stop:function(a,b){var d=c.timers;a&&this.queue([]);this.each(function(){for(var e=d.length-1;e>=0;e--)if(d[e].elem===this){b&&d[e](true);d.splice(e,1)}});b||this.dequeue();return this}});c.each({slideDown:S("show",1),slideUp:S("hide",1),slideToggle:S("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){c.fn[a]=function(d,e,f){return this.animate(b,
+d,e,f)}});c.extend({speed:function(a,b,d){var e=a&&typeof a==="object"?c.extend({},a):{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};e.duration=c.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in c.fx.speeds?c.fx.speeds[e.duration]:c.fx.speeds._default;e.old=e.complete;e.complete=function(){e.queue!==false&&c(this).dequeue();c.isFunction(e.old)&&e.old.call(this)};return e},easing:{linear:function(a,b,d,e){return d+e*a},swing:function(a,b,d,e){return(-Math.cos(a*
+Math.PI)/2+0.5)*e+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||c.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a=parseFloat(c.css(this.elem,this.prop));return a&&a>-1E4?a:0},custom:function(a,b,d){function e(l){return f.step(l)}
+var f=this,h=c.fx;this.startTime=c.now();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;this.pos=this.state=0;e.elem=this.elem;if(e()&&c.timers.push(e)&&!ba)ba=setInterval(h.tick,h.interval)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;
+this.custom(this.cur(),0)},step:function(a){var b=c.now(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var e in this.options.curAnim)if(this.options.curAnim[e]!==true)d=false;if(d){if(this.options.overflow!=null&&!c.support.shrinkWrapBlocks){var f=this.elem,h=this.options;c.each(["","X","Y"],function(k,o){f.style["overflow"+o]=h.overflow[k]})}this.options.hide&&c(this.elem).hide();if(this.options.hide||
+this.options.show)for(var l in this.options.curAnim)c.style(this.elem,l,this.options.orig[l]);this.options.complete.call(this.elem)}return false}else{a=b-this.startTime;this.state=a/this.options.duration;b=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||b](this.state,a,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=
+c.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||c.fx.stop()},interval:13,stop:function(){clearInterval(ba);ba=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){c.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!=null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(c.expr&&c.expr.filters)c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===
+b.elem}).length};var xb=/^t(?:able|d|h)$/i,Ia=/^(?:body|html)$/i;c.fn.offset="getBoundingClientRect"in t.documentElement?function(a){var b=this[0],d;if(a)return this.each(function(l){c.offset.setOffset(this,a,l)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);try{d=b.getBoundingClientRect()}catch(e){}var f=b.ownerDocument,h=f.documentElement;if(!d||!c.contains(h,b))return d||{top:0,left:0};b=f.body;f=fa(f);return{top:d.top+(f.pageYOffset||c.support.boxModel&&
+h.scrollTop||b.scrollTop)-(h.clientTop||b.clientTop||0),left:d.left+(f.pageXOffset||c.support.boxModel&&h.scrollLeft||b.scrollLeft)-(h.clientLeft||b.clientLeft||0)}}:function(a){var b=this[0];if(a)return this.each(function(x){c.offset.setOffset(this,a,x)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);c.offset.initialize();var d,e=b.offsetParent,f=b.ownerDocument,h=f.documentElement,l=f.body;d=(f=f.defaultView)?f.getComputedStyle(b,null):b.currentStyle;
+for(var k=b.offsetTop,o=b.offsetLeft;(b=b.parentNode)&&b!==l&&b!==h;){if(c.offset.supportsFixedPosition&&d.position==="fixed")break;d=f?f.getComputedStyle(b,null):b.currentStyle;k-=b.scrollTop;o-=b.scrollLeft;if(b===e){k+=b.offsetTop;o+=b.offsetLeft;if(c.offset.doesNotAddBorder&&!(c.offset.doesAddBorderForTableAndCells&&xb.test(b.nodeName))){k+=parseFloat(d.borderTopWidth)||0;o+=parseFloat(d.borderLeftWidth)||0}e=b.offsetParent}if(c.offset.subtractsBorderForOverflowNotVisible&&d.overflow!=="visible"){k+=
+parseFloat(d.borderTopWidth)||0;o+=parseFloat(d.borderLeftWidth)||0}d=d}if(d.position==="relative"||d.position==="static"){k+=l.offsetTop;o+=l.offsetLeft}if(c.offset.supportsFixedPosition&&d.position==="fixed"){k+=Math.max(h.scrollTop,l.scrollTop);o+=Math.max(h.scrollLeft,l.scrollLeft)}return{top:k,left:o}};c.offset={initialize:function(){var a=t.body,b=t.createElement("div"),d,e,f,h=parseFloat(c.css(a,"marginTop"))||0;c.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",
+height:"1px",visibility:"hidden"});b.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";a.insertBefore(b,a.firstChild);d=b.firstChild;e=d.firstChild;f=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=e.offsetTop!==5;this.doesAddBorderForTableAndCells=
+f.offsetTop===5;e.style.position="fixed";e.style.top="20px";this.supportsFixedPosition=e.offsetTop===20||e.offsetTop===15;e.style.position=e.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=e.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==h;a.removeChild(b);c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.css(a,
+"marginTop"))||0;d+=parseFloat(c.css(a,"marginLeft"))||0}return{top:b,left:d}},setOffset:function(a,b,d){var e=c.css(a,"position");if(e==="static")a.style.position="relative";var f=c(a),h=f.offset(),l=c.css(a,"top"),k=c.css(a,"left"),o=e==="absolute"&&c.inArray("auto",[l,k])>-1;e={};var x={};if(o)x=f.position();l=o?x.top:parseInt(l,10)||0;k=o?x.left:parseInt(k,10)||0;if(c.isFunction(b))b=b.call(a,d,h);if(b.top!=null)e.top=b.top-h.top+l;if(b.left!=null)e.left=b.left-h.left+k;"using"in b?b.using.call(a,
+e):f.css(e)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),e=Ia.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.css(a,"marginTop"))||0;d.left-=parseFloat(c.css(a,"marginLeft"))||0;e.top+=parseFloat(c.css(b[0],"borderTopWidth"))||0;e.left+=parseFloat(c.css(b[0],"borderLeftWidth"))||0;return{top:d.top-e.top,left:d.left-e.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||t.body;a&&!Ia.test(a.nodeName)&&
+c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(e){var f=this[0],h;if(!f)return null;if(e!==B)return this.each(function(){if(h=fa(this))h.scrollTo(!a?e:c(h).scrollLeft(),a?e:c(h).scrollTop());else this[d]=e});else return(h=fa(f))?"pageXOffset"in h?h[a?"pageYOffset":"pageXOffset"]:c.support.boxModel&&h.document.documentElement[d]||h.document.body[d]:f[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();
+c.fn["inner"+b]=function(){return this[0]?parseFloat(c.css(this[0],d,"padding")):null};c.fn["outer"+b]=function(e){return this[0]?parseFloat(c.css(this[0],d,e?"margin":"border")):null};c.fn[d]=function(e){var f=this[0];if(!f)return e==null?null:this;if(c.isFunction(e))return this.each(function(l){var k=c(this);k[d](e.call(this,l,k[d]()))});if(c.isWindow(f))return f.document.compatMode==="CSS1Compat"&&f.document.documentElement["client"+b]||f.document.body["client"+b];else if(f.nodeType===9)return Math.max(f.documentElement["client"+
+b],f.body["scroll"+b],f.documentElement["scroll"+b],f.body["offset"+b],f.documentElement["offset"+b]);else if(e===B){f=c.css(f,d);var h=parseFloat(f);return c.isNaN(h)?f:h}else return this.css(d,typeof e==="string"?e:e+"px")}})})(window);
Index: trunk/prototype/plugins/icalcreator/iCalUtilityFunctions.class.php
===================================================================
--- trunk/prototype/plugins/icalcreator/iCalUtilityFunctions.class.php	(revision 5341)
+++ trunk/prototype/plugins/icalcreator/iCalUtilityFunctions.class.php	(revision 5341)
@@ -0,0 +1,1575 @@
+<?php
+/**
+ * iCalcreator class v2.10.5
+ * copyright (c) 2007-2011 Kjell-Inge Gustafsson kigkonsult
+ * www.kigkonsult.se/iCalcreator/index.php
+ * ical@kigkonsult.se
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+/**
+ * moving all utility (static) functions to a utility class
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.10.1 - 2011-07-16
+ *
+ */
+class iCalUtilityFunctions {
+  // Store the single instance of iCalUtilityFunctions
+  private static $m_pInstance;
+
+  // Private constructor to limit object instantiation to within the class
+  private function __construct() {
+    $m_pInstance = FALSE;
+  }
+
+  // Getter method for creating/returning the single instance of this class
+  public static function getInstance() {
+    if (!self::$m_pInstance)
+      self::$m_pInstance = new iCalUtilityFunctions();
+
+    return self::$m_pInstance;
+  }
+/**
+ * check a date(-time) for an opt. timezone and if it is a DATE-TIME or DATE
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.16 - 2008-10-25
+ * @param array $date, date to check
+ * @param int $parno, no of date parts (i.e. year, month.. .)
+ * @return array $params, property parameters
+ */
+  public static function _chkdatecfg( $theDate, & $parno, & $params ) {
+    if( isset( $params['TZID'] ))
+      $parno = 6;
+    elseif( isset( $params['VALUE'] ) && ( 'DATE' == $params['VALUE'] ))
+      $parno = 3;
+    else {
+      if( isset( $params['VALUE'] ) && ( 'PERIOD' == $params['VALUE'] ))
+        $parno = 7;
+      if( is_array( $theDate )) {
+        if( isset( $theDate['timestamp'] ))
+          $tzid = ( isset( $theDate['tz'] )) ? $theDate['tz'] : null;
+        else
+          $tzid = ( isset( $theDate['tz'] )) ? $theDate['tz'] : ( 7 == count( $theDate )) ? end( $theDate ) : null;
+        if( !empty( $tzid )) {
+          $parno = 7;
+          if( !iCalUtilityFunctions::_isOffset( $tzid ))
+            $params['TZID'] = $tzid; // save only timezone
+        }
+        elseif( !$parno && ( 3 == count( $theDate )) &&
+          ( isset( $params['VALUE'] ) && ( 'DATE' == $params['VALUE'] )))
+          $parno = 3;
+        else
+          $parno = 6;
+      }
+      else { // string
+        $date = trim( $theDate );
+        if( 'Z' == substr( $date, -1 ))
+          $parno = 7; // UTC DATE-TIME
+        elseif((( 8 == strlen( $date ) && ctype_digit( $date )) || ( 11 >= strlen( $date ))) &&
+          ( !isset( $params['VALUE'] ) || !in_array( $params['VALUE'], array( 'DATE-TIME', 'PERIOD' ))))
+          $parno = 3; // DATE
+        $date = iCalUtilityFunctions::_date_time_string( $date, $parno );
+        if( !empty( $date['tz'] )) {
+          $parno = 7;
+          if( !iCalUtilityFunctions::_isOffset( $date['tz'] ))
+            $params['TZID'] = $date['tz']; // save only timezone
+        }
+        elseif( empty( $parno ))
+          $parno = 6;
+      }
+      if( isset( $params['TZID'] ))
+        $parno = 6;
+    }
+  }
+/**
+ * create (very simple) timezone and standard/daylight components
+ *
+ * Result when 'Europe/Stockholm' is used as timezone:
+ *
+ * BEGIN:VTIMEZONE
+ * TZID:Europe/Stockholm
+ * BEGIN:STANDARD
+ * DTSTART:20101031T020000
+ * TZOFFSETFROM:+0200
+ * TZOFFSETTO:+0100
+ * RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
+ * TZNAME:CET
+ * END:STANDARD
+ * BEGIN:DAYLIGHT
+ * DTSTART:20100328T030000
+ * TZOFFSETFROM:+0100
+ * TZOFFSETTO:+0200
+ * RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3
+ * TZNAME:CEST
+ * END:DAYLIGHT
+ * END:VTIMEZONE
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.10.3 - 2011-08-01
+ * @param object $calendar, reference to an iCalcreator calendar instance
+ * @param string $timezone, a PHP5 (DateTimeZone) valid timezone
+ * @param array $xProp, *[x-propName => x-propValue], optional
+ * @return bool
+ */
+  public static function createTimezone( & $calendar, $timezone, $xProp=array() ) {
+    if( !class_exists( 'DateTimeZone' ))
+      return FALSE;
+    if( empty( $timezone ))
+      return FALSE;
+    try {
+      $dtz = new DateTimeZone( $timezone );
+    }
+    catch( Exception $e ) {
+      return FALSE;
+    }
+    $stdDTSTART  = $stdTZOFFSETTO = $stdTZOFFSETFROM = $stdTZNAME = $dlghtDTSTART = $dlghtTZOFFSETTO = $dlghtTZOFFSETFROM = $dlghtTZNAME = FALSE;
+    $dateNow     = new DateTime();
+    $transitions = $dtz->getTransitions();
+    foreach( $transitions as $trans ) {
+      if( FALSE === ( $date = DateTime::createFromFormat( 'Y-m-d', substr( $trans['time'], 0, 10 ))))
+        continue;
+      if( $date > $dateNow )
+        break;
+      if( TRUE !== $trans['isdst'] ) {
+        $stdDTSTART    = $trans['time'];
+        $stdTZOFFSETTO = $dlghtTZOFFSETFROM = iCalUtilityFunctions::offsetSec2His( $trans['offset'] );
+        $stdTZNAME     = $trans['abbr'];
+      }
+      else {
+        $dlghtDTSTART    = $trans['time'];
+        $dlghtTZOFFSETTO = $stdTZOFFSETFROM = iCalUtilityFunctions::offsetSec2His( $trans['offset'] );
+        $dlghtTZNAME     = $trans['abbr'];
+      }
+    }
+    if( !$stdDTSTART || !$stdTZOFFSETTO || !$stdTZOFFSETFROM )
+      return FALSE;
+    $tz  = & $calendar->newComponent( 'vtimezone' );
+    $tz->setproperty( 'tzid', $timezone );
+    if( !empty( $xProp )) {
+      foreach( $xProp as $xPropName => $xPropValue )
+        if( 'x-' == strtolower( substr( $xPropName, 0, 2 )))
+          $tz->setproperty( $xPropName, $xPropValue );
+    }
+    $std = & $tz->newComponent( 'standard' );
+    $std->setProperty( 'dtstart',        $stdDTSTART );
+    if( $stdTZNAME )
+      $std->setProperty( 'tzname',       $stdTZNAME );
+    $std->setProperty( 'tzoffsetto',     $stdTZOFFSETTO );
+    $std->setProperty( 'tzoffsetfrom',   $stdTZOFFSETFROM );
+    if(( $stdTZOFFSETTO != $stdTZOFFSETFROM  ) && ( FALSE === iCalUtilityFunctions::_setTZrrule( $std )))
+      $std->setProperty( 'RRULE', array( 'FREQ' => 'YEARLY', 'BYDAY' => array( '-1', 'DAY' => 'SU' ), 'BYMONTH' => 10 ));
+    if(( !$dlghtDTSTART || !$dlghtTZOFFSETTO || !$dlghtTZOFFSETFROM ) || ( $dlghtTZOFFSETTO == $dlghtTZOFFSETFROM ))
+      return TRUE;
+    $dlght = & $tz->newComponent( 'daylight' );
+    $dlght->setProperty( 'dtstart',      $dlghtDTSTART );
+    if( $dlghtTZNAME )
+      $dlght->setProperty( 'tzname',     $dlghtTZNAME );
+    $dlght->setProperty( 'tzoffsetto',   $dlghtTZOFFSETTO );
+    $dlght->setProperty( 'tzoffsetfrom', $dlghtTZOFFSETFROM );
+    if( FALSE === iCalUtilityFunctions::_setTZrrule( $dlght ))
+      $dlght->setProperty( 'RRULE', array( 'FREQ' => 'YEARLY', 'BYDAY' => array( '-1', 'DAY' => 'SU' ), 'BYMONTH' => 3 ));
+    return TRUE;
+  }
+/**
+ * convert date/datetime to timestamp
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-10-30
+ * @param array  $datetime  datetime/(date)
+ * @param string $tz        timezone
+ * @return timestamp
+ */
+  public static function _date2timestamp( $datetime, $tz=null ) {
+    $output = null;
+    if( !isset( $datetime['hour'] )) $datetime['hour'] = '0';
+    if( !isset( $datetime['min'] ))  $datetime['min']  = '0';
+    if( !isset( $datetime['sec'] ))  $datetime['sec']  = '0';
+    foreach( $datetime as $dkey => $dvalue ) {
+      if( 'tz' != $dkey )
+        $datetime[$dkey] = (integer) $dvalue;
+    }
+    if( $tz )
+      $datetime['tz'] = $tz;
+    $offset = ( isset( $datetime['tz'] ) && ( '' < trim ( $datetime['tz'] ))) ? iCalUtilityFunctions::_tz2offset( $datetime['tz'] ) : 0;
+    $output = mktime( $datetime['hour'], $datetime['min'], ($datetime['sec'] + $offset), $datetime['month'], $datetime['day'], $datetime['year'] );
+    return $output;
+  }
+/**
+ * ensures internal date-time/date format for input date-time/date in array format
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 0.3.0 - 2006-08-15
+ * @param array $datetime
+ * @param int $parno optional, default FALSE
+ * @return array
+ */
+  public static function _date_time_array( $datetime, $parno=FALSE ) {
+    $output = array();
+    foreach( $datetime as $dateKey => $datePart ) {
+      switch ( $dateKey ) {
+        case '0': case 'year':   $output['year']  = $datePart; break;
+        case '1': case 'month':  $output['month'] = $datePart; break;
+        case '2': case 'day':    $output['day']   = $datePart; break;
+      }
+      if( 3 != $parno ) {
+        switch ( $dateKey ) {
+          case '0':
+          case '1':
+          case '2': break;
+          case '3': case 'hour': $output['hour']  = $datePart; break;
+          case '4': case 'min' : $output['min']   = $datePart; break;
+          case '5': case 'sec' : $output['sec']   = $datePart; break;
+          case '6': case 'tz'  : $output['tz']    = $datePart; break;
+        }
+      }
+    }
+    if( 3 != $parno ) {
+      if( !isset( $output['hour'] ))
+        $output['hour'] = 0;
+      if( !isset( $output['min']  ))
+        $output['min'] = 0;
+      if( !isset( $output['sec']  ))
+        $output['sec'] = 0;
+    }
+    return $output;
+  }
+/**
+ * ensures internal date-time/date format for input date-time/date in string fromat
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.6.35 - 2010-12-03
+ * @param array $datetime
+ * @param int $parno optional, default FALSE
+ * @return array
+ */
+  public static function _date_time_string( $datetime, $parno=FALSE ) {
+    $datetime = (string) trim( $datetime );
+    $tz  = null;
+    $len = strlen( $datetime ) - 1;
+    if( 'Z' == substr( $datetime, -1 )) {
+      $tz = 'Z';
+      $datetime = trim( substr( $datetime, 0, $len ));
+    }
+    elseif( ( ctype_digit( substr( $datetime, -2, 2 ))) && // time or date
+                  ( '-' == substr( $datetime, -3, 1 )) ||
+                  ( ':' == substr( $datetime, -3, 1 )) ||
+                  ( '.' == substr( $datetime, -3, 1 ))) {
+      $continue = TRUE;
+    }
+    elseif( ( ctype_digit( substr( $datetime, -4, 4 ))) && // 4 pos offset
+            ( ' +' == substr( $datetime, -6, 2 )) ||
+            ( ' -' == substr( $datetime, -6, 2 ))) {
+      $tz = substr( $datetime, -5, 5 );
+      $datetime = substr( $datetime, 0, ($len - 5));
+    }
+    elseif( ( ctype_digit( substr( $datetime, -6, 6 ))) && // 6 pos offset
+            ( ' +' == substr( $datetime, -8, 2 )) ||
+            ( ' -' == substr( $datetime, -8, 2 ))) {
+      $tz = substr( $datetime, -7, 7 );
+      $datetime = substr( $datetime, 0, ($len - 7));
+    }
+    elseif( ( 6 < $len ) && ( ctype_digit( substr( $datetime, -6, 6 )))) {
+      $continue = TRUE;
+    }
+    elseif( 'T' ==  substr( $datetime, -7, 1 )) {
+      $continue = TRUE;
+    }
+    else {
+      $cx  = $tx = 0;    //  19970415T133000 US-Eastern
+      for( $cx = -1; $cx > ( 9 - $len ); $cx-- ) {
+        $char = substr( $datetime, $cx, 1 );
+        if(( ' ' == $char) || ctype_digit( $char))
+          break; // if exists, tz ends here.. . ?
+        else
+           $tx--; // tz length counter
+      }
+      if( 0 > $tx ) {
+        $tz = substr( $datetime, $tx );
+        $datetime = trim( substr( $datetime, 0, $len + $tx + 1 ));
+      }
+    }
+    if( 0 < substr_count( $datetime, '-' )) {
+      $datetime = str_replace( '-', '/', $datetime );
+    }
+    elseif( ctype_digit( substr( $datetime, 0, 8 )) &&
+           ( 'T' ==      substr( $datetime, 8, 1 )) &&
+            ctype_digit( substr( $datetime, 9, 6 ))) {
+      $datetime = substr( $datetime,  4, 2 )
+             .'/'.substr( $datetime,  6, 2 )
+             .'/'.substr( $datetime,  0, 4 )
+             .' '.substr( $datetime,  9, 2 )
+             .':'.substr( $datetime, 11, 2 )
+             .':'.substr( $datetime, 13);
+    }
+    $datestring = date( 'Y-m-d H:i:s', strtotime( $datetime ));
+    $tz                = trim( $tz );
+    $output            = array();
+    $output['year']    = substr( $datestring, 0, 4 );
+    $output['month']   = substr( $datestring, 5, 2 );
+    $output['day']     = substr( $datestring, 8, 2 );
+    if(( 6 == $parno ) || ( 7 == $parno ) || ( !$parno && ( 'Z' == $tz ))) {
+      $output['hour']  = substr( $datestring, 11, 2 );
+      $output['min']   = substr( $datestring, 14, 2 );
+      $output['sec']   = substr( $datestring, 17, 2 );
+      if( !empty( $tz ))
+        $output['tz']  = $tz;
+    }
+    elseif( 3 != $parno ) {
+      if(( '00' < substr( $datestring, 11, 2 )) ||
+         ( '00' < substr( $datestring, 14, 2 )) ||
+         ( '00' < substr( $datestring, 17, 2 ))) {
+        $output['hour']  = substr( $datestring, 11, 2 );
+        $output['min']   = substr( $datestring, 14, 2 );
+        $output['sec']   = substr( $datestring, 17, 2 );
+      }
+      if( !empty( $tz ))
+        $output['tz']  = $tz;
+    }
+    return $output;
+  }
+/**
+ * convert local startdate/enddate (Ymd[His]) to duration array
+ *
+ * uses this component dates if missing input dates
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.6.11 - 2010-10-21
+ * @param array $startdate
+ * @param array $duration
+ * @return array duration
+ */
+  public static function _date2duration( $startdate, $enddate ) {
+    $startWdate  = mktime( 0, 0, 0, $startdate['month'], $startdate['day'], $startdate['year'] );
+    $endWdate    = mktime( 0, 0, 0, $enddate['month'],   $enddate['day'],   $enddate['year'] );
+    $wduration   = $endWdate - $startWdate;
+    $dur         = array();
+    $dur['week'] = (int) floor( $wduration / ( 7 * 24 * 60 * 60 ));
+    $wduration   =              $wduration % ( 7 * 24 * 60 * 60 );
+    $dur['day']  = (int) floor( $wduration / ( 24 * 60 * 60 ));
+    $wduration   =              $wduration % ( 24 * 60 * 60 );
+    $dur['hour'] = (int) floor( $wduration / ( 60 * 60 ));
+    $wduration   =              $wduration % ( 60 * 60 );
+    $dur['min']  = (int) floor( $wduration / ( 60 ));
+    $dur['sec']  = (int)        $wduration % ( 60 );
+    return $dur;
+  }
+/**
+ * ensures internal duration format for input in array format
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.1.1 - 2007-06-24
+ * @param array $duration
+ * @return array
+ */
+  public static function _duration_array( $duration ) {
+    $output = array();
+    if(    is_array( $duration )        &&
+       ( 1 == count( $duration ))       &&
+              isset( $duration['sec'] ) &&
+              ( 60 < $duration['sec'] )) {
+      $durseconds  = $duration['sec'];
+      $output['week'] = floor( $durseconds / ( 60 * 60 * 24 * 7 ));
+      $durseconds  =           $durseconds % ( 60 * 60 * 24 * 7 );
+      $output['day']  = floor( $durseconds / ( 60 * 60 * 24 ));
+      $durseconds  =           $durseconds % ( 60 * 60 * 24 );
+      $output['hour'] = floor( $durseconds / ( 60 * 60 ));
+      $durseconds  =           $durseconds % ( 60 * 60 );
+      $output['min']  = floor( $durseconds / ( 60 ));
+      $output['sec']  =      ( $durseconds % ( 60 ));
+    }
+    else {
+      foreach( $duration as $durKey => $durValue ) {
+        if( empty( $durValue )) continue;
+        switch ( $durKey ) {
+          case '0': case 'week': $output['week']  = $durValue; break;
+          case '1': case 'day':  $output['day']   = $durValue; break;
+          case '2': case 'hour': $output['hour']  = $durValue; break;
+          case '3': case 'min':  $output['min']   = $durValue; break;
+          case '4': case 'sec':  $output['sec']   = $durValue; break;
+        }
+      }
+    }
+    if( isset( $output['week'] ) && ( 0 < $output['week'] )) {
+      unset( $output['day'], $output['hour'], $output['min'], $output['sec'] );
+      return $output;
+    }
+    unset( $output['week'] );
+    if( empty( $output['day'] ))
+      unset( $output['day'] );
+    if ( isset( $output['hour'] ) || isset( $output['min'] ) || isset( $output['sec'] )) {
+      if( !isset( $output['hour'] )) $output['hour'] = 0;
+      if( !isset( $output['min']  )) $output['min']  = 0;
+      if( !isset( $output['sec']  )) $output['sec']  = 0;
+      if(( 0 == $output['hour'] ) && ( 0 == $output['min'] ) && ( 0 == $output['sec'] ))
+        unset( $output['hour'], $output['min'], $output['sec'] );
+    }
+    return $output;
+  }
+/**
+ * ensures internal duration format for input in string format
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.0.5 - 2007-03-14
+ * @param string $duration
+ * @return array
+ */
+  public static function _duration_string( $duration ) {
+    $duration = (string) trim( $duration );
+    while( 'P' != strtoupper( substr( $duration, 0, 1 ))) {
+      if( 0 < strlen( $duration ))
+        $duration = substr( $duration, 1 );
+      else
+        return false; // no leading P !?!?
+    }
+    $duration = substr( $duration, 1 ); // skip P
+    $duration = str_replace ( 't', 'T', $duration );
+    $duration = str_replace ( 'T', '', $duration );
+    $output = array();
+    $val    = null;
+    for( $ix=0; $ix < strlen( $duration ); $ix++ ) {
+      switch( strtoupper( substr( $duration, $ix, 1 ))) {
+       case 'W':
+         $output['week'] = $val;
+         $val            = null;
+         break;
+       case 'D':
+         $output['day']  = $val;
+         $val            = null;
+         break;
+       case 'H':
+         $output['hour'] = $val;
+         $val            = null;
+         break;
+       case 'M':
+         $output['min']  = $val;
+         $val            = null;
+         break;
+       case 'S':
+         $output['sec']  = $val;
+         $val            = null;
+         break;
+       default:
+         if( !ctype_digit( substr( $duration, $ix, 1 )))
+           return false; // unknown duration control character  !?!?
+         else
+           $val .= substr( $duration, $ix, 1 );
+      }
+    }
+    return iCalUtilityFunctions::_duration_array( $output );
+  }
+/**
+ * convert duration to date in array format
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.8.7 - 2011-03-03
+ * @param array $startdate
+ * @param array $duration
+ * @return array, date format
+ */
+  public static function _duration2date( $startdate=null, $duration=null ) {
+    if( empty( $startdate )) return FALSE;
+    if( empty( $duration ))  return FALSE;
+    $dateOnly          = ( isset( $startdate['hour'] ) || isset( $startdate['min'] ) || isset( $startdate['sec'] )) ? FALSE : TRUE;
+    $startdate['hour'] = ( isset( $startdate['hour'] )) ? $startdate['hour'] : 0;
+    $startdate['min']  = ( isset( $startdate['min'] ))  ? $startdate['min']  : 0;
+    $startdate['sec']  = ( isset( $startdate['sec'] ))  ? $startdate['sec']  : 0;
+    $dtend = 0;
+    if(    isset( $duration['week'] ))
+      $dtend += ( $duration['week'] * 7 * 24 * 60 * 60 );
+    if(    isset( $duration['day'] ))
+      $dtend += ( $duration['day'] * 24 * 60 * 60 );
+    if(    isset( $duration['hour'] ))
+      $dtend += ( $duration['hour'] * 60 *60 );
+    if(    isset( $duration['min'] ))
+      $dtend += ( $duration['min'] * 60 );
+    if(    isset( $duration['sec'] ))
+      $dtend +=   $duration['sec'];
+    $dtend  = mktime( $startdate['hour'], $startdate['min'], ( $startdate['sec'] + $dtend ), $startdate['month'], $startdate['day'], $startdate['year'] );
+    $dtend2 = array();
+    $dtend2['year']   = date('Y', $dtend );
+    $dtend2['month']  = date('m', $dtend );
+    $dtend2['day']    = date('d', $dtend );
+    $dtend2['hour']   = date('H', $dtend );
+    $dtend2['min']    = date('i', $dtend );
+    $dtend2['sec']    = date('s', $dtend );
+    if( isset( $startdate['tz'] ))
+      $dtend2['tz']   = $startdate['tz'];
+    if( $dateOnly && (( 0 == $dtend2['hour'] ) && ( 0 == $dtend2['min'] ) && ( 0 == $dtend2['sec'] )))
+      unset( $dtend2['hour'], $dtend2['min'], $dtend2['sec'] );
+    return $dtend2;
+  }
+/**
+ * if not preSet, if exist, remove key with expected value from array and return hit value else return elseValue
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.16 - 2008-11-08
+ * @param array $array
+ * @param string $expkey, expected key
+ * @param string $expval, expected value
+ * @param int $hitVal optional, return value if found
+ * @param int $elseVal optional, return value if not found
+ * @param int $preSet optional, return value if already preset
+ * @return int
+ */
+  public static function _existRem( &$array, $expkey, $expval=FALSE, $hitVal=null, $elseVal=null, $preSet=null ) {
+    if( $preSet )
+      return $preSet;
+    if( !is_array( $array ) || ( 0 == count( $array )))
+      return $elseVal;
+    foreach( $array as $key => $value ) {
+      if( strtoupper( $expkey ) == strtoupper( $key )) {
+        if( !$expval || ( strtoupper( $expval ) == strtoupper( $array[$key] ))) {
+          unset( $array[$key] );
+          return $hitVal;
+        }
+      }
+    }
+    return $elseVal;
+  }
+/**
+ * creates formatted output for calendar component property data value type date/date-time
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-10-30
+ * @param array   $datetime
+ * @param int     $parno, optional, default 6
+ * @return string
+ */
+  public static function _format_date_time( $datetime, $parno=6 ) {
+    if( !isset( $datetime['year'] )  &&
+        !isset( $datetime['month'] ) &&
+        !isset( $datetime['day'] )   &&
+        !isset( $datetime['hour'] )  &&
+        !isset( $datetime['min'] )   &&
+        !isset( $datetime['sec'] ))
+      return ;
+    $output = null;
+    // if( !isset( $datetime['day'] )) { $o=''; foreach($datetime as $k=>$v) {if(is_array($v)) $v=implode('-',$v);$o.=" $k=>$v";} echo " day SAKNAS : $o <br />\n"; }
+    foreach( $datetime as $dkey => & $dvalue )
+      if( 'tz' != $dkey ) $dvalue = (integer) $dvalue;
+    $output = date('Ymd', mktime( 0, 0, 0, $datetime['month'], $datetime['day'], $datetime['year']));
+    if( isset( $datetime['hour'] )  ||
+        isset( $datetime['min'] )   ||
+        isset( $datetime['sec'] )   ||
+        isset( $datetime['tz'] )) {
+      if( isset( $datetime['tz'] )  &&
+         !isset( $datetime['hour'] ))
+        $datetime['hour'] = 0;
+      if( isset( $datetime['hour'] )  &&
+         !isset( $datetime['min'] ))
+        $datetime['min'] = 0;
+      if( isset( $datetime['hour'] )  &&
+          isset( $datetime['min'] )   &&
+         !isset( $datetime['sec'] ))
+        $datetime['sec'] = 0;
+      $date = mktime( $datetime['hour'], $datetime['min'], $datetime['sec'], $datetime['month'], $datetime['day'], $datetime['year']);
+      $output .= date('\THis', $date );
+      if( isset( $datetime['tz'] ) && ( '' < trim ( $datetime['tz'] ))) {
+        $datetime['tz'] = trim( $datetime['tz'] );
+        if( 'Z' == $datetime['tz'] )
+          $output .= 'Z';
+        $offset = iCalUtilityFunctions::_tz2offset( $datetime['tz'] );
+        if( 0 != $offset ) {
+          $date = mktime( $datetime['hour'], $datetime['min'], ($datetime['sec'] + $offset), $datetime['month'], $datetime['day'], $datetime['year']);
+          $output    = date( 'Ymd\THis\Z', $date );
+        }
+      }
+      elseif( 7 == $parno )
+        $output .= 'Z';
+    }
+    return $output;
+  }
+/**
+ * creates formatted output for calendar component property data value type duration
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.9.9 - 2011-06-17
+ * @param array $duration ( week, day, hour, min, sec )
+ * @return string
+ */
+  public static function _format_duration( $duration ) {
+    if( isset( $duration['week'] ) ||
+        isset( $duration['day'] )  ||
+        isset( $duration['hour'] ) ||
+        isset( $duration['min'] )  ||
+        isset( $duration['sec'] ))
+       $ok = TRUE;
+    else
+      return;
+    if( isset( $duration['week'] ) && ( 0 < $duration['week'] ))
+      return 'P'.$duration['week'].'W';
+    $output = 'P';
+    if( isset($duration['day'] ) && ( 0 < $duration['day'] ))
+      $output .= $duration['day'].'D';
+    if(( isset( $duration['hour']) && ( 0 < $duration['hour'] )) ||
+       ( isset( $duration['min'])  && ( 0 < $duration['min'] ))  ||
+       ( isset( $duration['sec'])  && ( 0 < $duration['sec'] )))
+      $output .= 'T';
+    $output .= ( isset( $duration['hour']) && ( 0 < $duration['hour'] )) ? $duration['hour'].'H' : '';
+    $output .= ( isset( $duration['min'])  && ( 0 < $duration['min'] ))  ? $duration['min']. 'M' : '';
+    $output .= ( isset( $duration['sec'])  && ( 0 < $duration['sec'] ))  ? $duration['sec']. 'S' : '';
+    if( 'P' == $output )
+      $output = 'PT0S';
+    return $output;
+  }
+/**
+ * checks if input array contains a date
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.16 - 2008-10-25
+ * @param array $input
+ * @return bool
+ */
+  public static function _isArrayDate( $input ) {
+    if( isset( $input['week'] ) || ( !in_array( count( $input ), array( 3, 6, 7 ))))
+      return FALSE;
+    if( 7 == count( $input ))
+      return TRUE;
+    if( isset( $input['year'] ) && isset( $input['month'] ) && isset( $input['day'] ))
+      return checkdate( (int) $input['month'], (int) $input['day'], (int) $input['year'] );
+    if( isset( $input['day'] ) || isset( $input['hour'] ) || isset( $input['min'] ) || isset( $input['sec'] ))
+      return FALSE;
+    if( in_array( 0, $input ))
+      return FALSE;
+    if(( 1970 > $input[0] ) || ( 12 < $input[1] ) || ( 31 < $input[2] ))
+      return FALSE;
+    if(( isset( $input[0] ) && isset( $input[1] ) && isset( $input[2] )) &&
+         checkdate( (int) $input[1], (int) $input[2], (int) $input[0] ))
+      return TRUE;
+    $input = iCalUtilityFunctions::_date_time_string( $input[1].'/'.$input[2].'/'.$input[0], 3 ); //  m - d - Y
+    if( isset( $input['year'] ) && isset( $input['month'] ) && isset( $input['day'] ))
+      return checkdate( (int) $input['month'], (int) $input['day'], (int) $input['year'] );
+    return FALSE;
+  }
+/**
+ * checks if input array contains a timestamp date
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.16 - 2008-10-18
+ * @param array $input
+ * @return bool
+ */
+  public static function _isArrayTimestampDate( $input ) {
+    return ( is_array( $input ) && isset( $input['timestamp'] )) ? TRUE : FALSE ;
+  }
+/**
+ * controll if input string contains trailing UTC offset
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.16 - 2008-10-19
+ * @param string $input
+ * @return bool
+ */
+  public static function _isOffset( $input ) {
+    $input         = trim( (string) $input );
+    if( 'Z' == substr( $input, -1 ))
+      return TRUE;
+    elseif((   5 <= strlen( $input )) &&
+       ( in_array( substr( $input, -5, 1 ), array( '+', '-' ))) &&
+       (   '0000'  < substr( $input, -4 )) && (   '9999' >= substr( $input, -4 )))
+      return TRUE;
+    elseif((    7 <= strlen( $input )) &&
+       ( in_array( substr( $input, -7, 1 ), array( '+', '-' ))) &&
+       ( '000000'  < substr( $input, -6 )) && ( '999999' >= substr( $input, -6 )))
+      return TRUE;
+    return FALSE;
+
+  }
+/**
+ * transform offset in seconds to [-/+]hhmm[ss]
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2011-05-02
+ * @param string $seconds
+ * @return string
+ */
+  public static function offsetSec2His( $seconds ) {
+    if( '-' == substr( $seconds, 0, 1 )) {
+      $prefix  = '-';
+      $seconds = substr( $seconds, 1 );
+    }
+    elseif( '+' == substr( $seconds, 0, 1 )) {
+      $prefix  = '+';
+      $seconds = substr( $seconds, 1 );
+    }
+    else
+      $prefix  = '+';
+    $output  = '';
+    $hour    = (int) floor( $seconds / 3600 );
+    if( 10 > $hour )
+      $hour  = '0'.$hour;
+    $seconds = $seconds % 3600;
+    $min     = (int) floor( $seconds / 60 );
+    if( 10 > $min )
+      $min   = '0'.$min;
+    $output  = $hour.$min;
+    $seconds = $seconds % 60;
+    if( 0 < $seconds) {
+      if( 9 < $seconds)
+        $output .= $seconds;
+      else
+        $output .= '0'.$seconds;
+    }
+    return $prefix.$output;
+  }
+/**
+ * remakes a recur pattern to an array of dates
+ *
+ * if missing, UNTIL is set 1 year from startdate (emergency break)
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.9.10 - 2011-07-07
+ * @param array $result, array to update, array([timestamp] => timestamp)
+ * @param array $recur, pattern for recurrency (only value part, params ignored)
+ * @param array $wdate, component start date
+ * @param array $startdate, start date
+ * @param array $enddate, optional
+ * @return array of recurrence (start-)dates as index
+ * @todo BYHOUR, BYMINUTE, BYSECOND, ev. BYSETPOS due to ambiguity, WEEKLY at year end/start
+ */
+  public static function _recur2date( & $result, $recur, $wdate, $startdate, $enddate=FALSE ) {
+    foreach( $wdate as $k => $v ) if( ctype_digit( $v )) $wdate[$k] = (int) $v;
+    $wdateStart  = $wdate;
+    $wdatets     = iCalUtilityFunctions::_date2timestamp( $wdate );
+    $startdatets = iCalUtilityFunctions::_date2timestamp( $startdate );
+    if( !$enddate ) {
+      $enddate = $startdate;
+      $enddate['year'] += 1;
+    }
+// echo "recur __in_ comp start ".implode('-',$wdate)." period start ".implode('-',$startdate)." period end ".implode('-',$enddate)."<br />\n";print_r($recur);echo "<br />\n";//test###
+    $endDatets = iCalUtilityFunctions::_date2timestamp( $enddate ); // fix break
+    if( !isset( $recur['COUNT'] ) && !isset( $recur['UNTIL'] ))
+      $recur['UNTIL'] = $enddate; // create break
+    if( isset( $recur['UNTIL'] )) {
+      $tdatets = iCalUtilityFunctions::_date2timestamp( $recur['UNTIL'] );
+      if( $endDatets > $tdatets ) {
+        $endDatets = $tdatets; // emergency break
+        $enddate   = iCalUtilityFunctions::_timestamp2date( $endDatets, 6 );
+      }
+      else
+        $recur['UNTIL'] = iCalUtilityFunctions::_timestamp2date( $endDatets, 6 );
+    }
+    if( $wdatets > $endDatets ) {
+// echo "recur out of date ".implode('-',iCalUtilityFunctions::_date_time_string(date('Y-m-d H:i:s',$wdatets),6))."<br />\n";//test
+      return array(); // nothing to do.. .
+    }
+    if( !isset( $recur['FREQ'] )) // "MUST be specified.. ."
+      $recur['FREQ'] = 'DAILY'; // ??
+    $wkst = ( isset( $recur['WKST'] ) && ( 'SU' == $recur['WKST'] )) ? 24*60*60 : 0; // ??
+    $weekStart = (int) date( 'W', ( $wdatets + $wkst ));
+    if( !isset( $recur['INTERVAL'] ))
+      $recur['INTERVAL'] = 1;
+    $countcnt = ( !isset( $recur['BYSETPOS'] )) ? 1 : 0; // DTSTART counts as the first occurrence
+            /* find out how to step up dates and set index for interval count */
+    $step = array();
+    if( 'YEARLY' == $recur['FREQ'] )
+      $step['year']  = 1;
+    elseif( 'MONTHLY' == $recur['FREQ'] )
+      $step['month'] = 1;
+    elseif( 'WEEKLY' == $recur['FREQ'] )
+      $step['day']   = 7;
+    else
+      $step['day']   = 1;
+    if( isset( $step['year'] ) && isset( $recur['BYMONTH'] ))
+      $step = array( 'month' => 1 );
+    if( empty( $step ) && isset( $recur['BYWEEKNO'] )) // ??
+      $step = array( 'day' => 7 );
+    if( isset( $recur['BYYEARDAY'] ) || isset( $recur['BYMONTHDAY'] ) || isset( $recur['BYDAY'] ))
+      $step = array( 'day' => 1 );
+    $intervalarr = array();
+    if( 1 < $recur['INTERVAL'] ) {
+      $intervalix = iCalUtilityFunctions::_recurIntervalIx( $recur['FREQ'], $wdate, $wkst );
+      $intervalarr = array( $intervalix => 0 );
+    }
+    if( isset( $recur['BYSETPOS'] )) { // save start date + weekno
+      $bysetposymd1 = $bysetposymd2 = $bysetposw1 = $bysetposw2 = array();
+// echo "bysetposXold_start=$bysetposYold $bysetposMold $bysetposDold<br />\n"; // test ###
+      if( is_array( $recur['BYSETPOS'] )) {
+        foreach( $recur['BYSETPOS'] as $bix => $bval )
+          $recur['BYSETPOS'][$bix] = (int) $bval;
+      }
+      else
+        $recur['BYSETPOS'] = array( (int) $recur['BYSETPOS'] );
+      if( 'YEARLY' == $recur['FREQ'] ) {
+        $wdate['month'] = $wdate['day'] = 1; // start from beginning of year
+        $wdatets        = iCalUtilityFunctions::_date2timestamp( $wdate );
+        iCalUtilityFunctions::_stepdate( $enddate, $endDatets, array( 'year' => 1 )); // make sure to count whole last year
+      }
+      elseif( 'MONTHLY' == $recur['FREQ'] ) {
+        $wdate['day']   = 1; // start from beginning of month
+        $wdatets        = iCalUtilityFunctions::_date2timestamp( $wdate );
+        iCalUtilityFunctions::_stepdate( $enddate, $endDatets, array( 'month' => 1 )); // make sure to count whole last month
+      }
+      else
+        iCalUtilityFunctions::_stepdate( $enddate, $endDatets, $step); // make sure to count whole last period
+// echo "BYSETPOS endDat++ =".implode('-',$enddate).' step='.var_export($step,TRUE)."<br />\n";//test###
+      $bysetposWold = (int) date( 'W', ( $wdatets + $wkst ));
+      $bysetposYold = $wdate['year'];
+      $bysetposMold = $wdate['month'];
+      $bysetposDold = $wdate['day'];
+    }
+    else
+      iCalUtilityFunctions::_stepdate( $wdate, $wdatets, $step);
+    $year_old     = null;
+    $daynames     = array( 'SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA' );
+             /* MAIN LOOP */
+// echo "recur start ".implode('-',$wdate)." end ".implode('-',$enddate)."<br />\n";//test
+    while( TRUE ) {
+      if( isset( $endDatets ) && ( $wdatets > $endDatets ))
+        break;
+      if( isset( $recur['COUNT'] ) && ( $countcnt >= $recur['COUNT'] ))
+        break;
+      if( $year_old != $wdate['year'] ) {
+        $year_old   = $wdate['year'];
+        $daycnts    = array();
+        $yeardays   = $weekno = 0;
+        $yeardaycnt = array();
+        for( $m = 1; $m <= 12; $m++ ) { // count up and update up-counters
+          $daycnts[$m] = array();
+          $weekdaycnt = array();
+          foreach( $daynames as $dn )
+            $yeardaycnt[$dn] = $weekdaycnt[$dn] = 0;
+          $mcnt     = date( 't', mktime( 0, 0, 0, $m, 1, $wdate['year'] ));
+          for( $d   = 1; $d <= $mcnt; $d++ ) {
+            $daycnts[$m][$d] = array();
+            if( isset( $recur['BYYEARDAY'] )) {
+              $yeardays++;
+              $daycnts[$m][$d]['yearcnt_up'] = $yeardays;
+            }
+            if( isset( $recur['BYDAY'] )) {
+              $day    = date( 'w', mktime( 0, 0, 0, $m, $d, $wdate['year'] ));
+              $day    = $daynames[$day];
+              $daycnts[$m][$d]['DAY'] = $day;
+              $weekdaycnt[$day]++;
+              $daycnts[$m][$d]['monthdayno_up'] = $weekdaycnt[$day];
+              $yeardaycnt[$day]++;
+              $daycnts[$m][$d]['yeardayno_up'] = $yeardaycnt[$day];
+            }
+            if(  isset( $recur['BYWEEKNO'] ) || ( $recur['FREQ'] == 'WEEKLY' ))
+              $daycnts[$m][$d]['weekno_up'] =(int)date('W',mktime(0,0,$wkst,$m,$d,$wdate['year']));
+          }
+        }
+        $daycnt = 0;
+        $yeardaycnt = array();
+        if(  isset( $recur['BYWEEKNO'] ) || ( $recur['FREQ'] == 'WEEKLY' )) {
+          $weekno = null;
+          for( $d=31; $d > 25; $d-- ) { // get last weekno for year
+            if( !$weekno )
+              $weekno = $daycnts[12][$d]['weekno_up'];
+            elseif( $weekno < $daycnts[12][$d]['weekno_up'] ) {
+              $weekno = $daycnts[12][$d]['weekno_up'];
+              break;
+            }
+          }
+        }
+        for( $m = 12; $m > 0; $m-- ) { // count down and update down-counters
+          $weekdaycnt = array();
+          foreach( $daynames as $dn )
+            $yeardaycnt[$dn] = $weekdaycnt[$dn] = 0;
+          $monthcnt = 0;
+          $mcnt     = date( 't', mktime( 0, 0, 0, $m, 1, $wdate['year'] ));
+          for( $d   = $mcnt; $d > 0; $d-- ) {
+            if( isset( $recur['BYYEARDAY'] )) {
+              $daycnt -= 1;
+              $daycnts[$m][$d]['yearcnt_down'] = $daycnt;
+            }
+            if( isset( $recur['BYMONTHDAY'] )) {
+              $monthcnt -= 1;
+              $daycnts[$m][$d]['monthcnt_down'] = $monthcnt;
+            }
+            if( isset( $recur['BYDAY'] )) {
+              $day  = $daycnts[$m][$d]['DAY'];
+              $weekdaycnt[$day] -= 1;
+              $daycnts[$m][$d]['monthdayno_down'] = $weekdaycnt[$day];
+              $yeardaycnt[$day] -= 1;
+              $daycnts[$m][$d]['yeardayno_down'] = $yeardaycnt[$day];
+            }
+            if(  isset( $recur['BYWEEKNO'] ) || ( $recur['FREQ'] == 'WEEKLY' ))
+              $daycnts[$m][$d]['weekno_down'] = ($daycnts[$m][$d]['weekno_up'] - $weekno - 1);
+          }
+        }
+      }
+            /* check interval */
+      if( 1 < $recur['INTERVAL'] ) {
+            /* create interval index */
+        $intervalix = iCalUtilityFunctions::_recurIntervalIx( $recur['FREQ'], $wdate, $wkst );
+            /* check interval */
+        $currentKey = array_keys( $intervalarr );
+        $currentKey = end( $currentKey ); // get last index
+        if( $currentKey != $intervalix )
+          $intervalarr = array( $intervalix => ( $intervalarr[$currentKey] + 1 ));
+        if(( $recur['INTERVAL'] != $intervalarr[$intervalix] ) &&
+           ( 0 != $intervalarr[$intervalix] )) {
+            /* step up date */
+// echo "skip: ".implode('-',$wdate)." ix=$intervalix old=$currentKey interval=".$intervalarr[$intervalix]."<br />\n";//test
+          iCalUtilityFunctions::_stepdate( $wdate, $wdatets, $step);
+          continue;
+        }
+        else // continue within the selected interval
+          $intervalarr[$intervalix] = 0;
+// echo "cont: ".implode('-',$wdate)." ix=$intervalix old=$currentKey interval=".$intervalarr[$intervalix]."<br />\n";//test
+      }
+      $updateOK = TRUE;
+      if( $updateOK && isset( $recur['BYMONTH'] ))
+        $updateOK = iCalUtilityFunctions::_recurBYcntcheck( $recur['BYMONTH']
+                                           , $wdate['month']
+                                           ,($wdate['month'] - 13));
+      if( $updateOK && isset( $recur['BYWEEKNO'] ))
+        $updateOK = iCalUtilityFunctions::_recurBYcntcheck( $recur['BYWEEKNO']
+                                           , $daycnts[$wdate['month']][$wdate['day']]['weekno_up']
+                                           , $daycnts[$wdate['month']][$wdate['day']]['weekno_down'] );
+      if( $updateOK && isset( $recur['BYYEARDAY'] ))
+        $updateOK = iCalUtilityFunctions::_recurBYcntcheck( $recur['BYYEARDAY']
+                                           , $daycnts[$wdate['month']][$wdate['day']]['yearcnt_up']
+                                           , $daycnts[$wdate['month']][$wdate['day']]['yearcnt_down'] );
+      if( $updateOK && isset( $recur['BYMONTHDAY'] ))
+        $updateOK = iCalUtilityFunctions::_recurBYcntcheck( $recur['BYMONTHDAY']
+                                           , $wdate['day']
+                                           , $daycnts[$wdate['month']][$wdate['day']]['monthcnt_down'] );
+// echo "efter BYMONTHDAY: ".implode('-',$wdate).' status: '; echo ($updateOK) ? 'TRUE' : 'FALSE'; echo "<br />\n";//test###
+      if( $updateOK && isset( $recur['BYDAY'] )) {
+        $updateOK = FALSE;
+        $m = $wdate['month'];
+        $d = $wdate['day'];
+        if( isset( $recur['BYDAY']['DAY'] )) { // single day, opt with year/month day order no
+          $daynoexists = $daynosw = $daynamesw =  FALSE;
+          if( $recur['BYDAY']['DAY'] == $daycnts[$m][$d]['DAY'] )
+            $daynamesw = TRUE;
+          if( isset( $recur['BYDAY'][0] )) {
+            $daynoexists = TRUE;
+            if(( isset( $recur['FREQ'] ) && ( $recur['FREQ'] == 'MONTHLY' )) || isset( $recur['BYMONTH'] ))
+              $daynosw = iCalUtilityFunctions::_recurBYcntcheck( $recur['BYDAY'][0]
+                                                , $daycnts[$m][$d]['monthdayno_up']
+                                                , $daycnts[$m][$d]['monthdayno_down'] );
+            elseif( isset( $recur['FREQ'] ) && ( $recur['FREQ'] == 'YEARLY' ))
+              $daynosw = iCalUtilityFunctions::_recurBYcntcheck( $recur['BYDAY'][0]
+                                                , $daycnts[$m][$d]['yeardayno_up']
+                                                , $daycnts[$m][$d]['yeardayno_down'] );
+          }
+          if((  $daynoexists &&  $daynosw && $daynamesw ) ||
+             ( !$daynoexists && !$daynosw && $daynamesw )) {
+            $updateOK = TRUE;
+          }
+// echo "daynoexists:$daynoexists daynosw:$daynosw daynamesw:$daynamesw<br />\n"; // test ###
+        }
+        else {
+          foreach( $recur['BYDAY'] as $bydayvalue ) {
+            $daynoexists = $daynosw = $daynamesw = FALSE;
+            if( isset( $bydayvalue['DAY'] ) &&
+                     ( $bydayvalue['DAY'] == $daycnts[$m][$d]['DAY'] ))
+              $daynamesw = TRUE;
+            if( isset( $bydayvalue[0] )) {
+              $daynoexists = TRUE;
+              if(( isset( $recur['FREQ'] ) && ( $recur['FREQ'] == 'MONTHLY' )) ||
+                   isset( $recur['BYMONTH'] ))
+                $daynosw = iCalUtilityFunctions::_recurBYcntcheck( $bydayvalue['0']
+                                                  , $daycnts[$m][$d]['monthdayno_up']
+                                                  , $daycnts[$m][$d]['monthdayno_down'] );
+              elseif( isset( $recur['FREQ'] ) && ( $recur['FREQ'] == 'YEARLY' ))
+                $daynosw = iCalUtilityFunctions::_recurBYcntcheck( $bydayvalue['0']
+                                                  , $daycnts[$m][$d]['yeardayno_up']
+                                                  , $daycnts[$m][$d]['yeardayno_down'] );
+            }
+// echo "daynoexists:$daynoexists daynosw:$daynosw daynamesw:$daynamesw<br />\n"; // test ###
+            if((  $daynoexists &&  $daynosw && $daynamesw ) ||
+               ( !$daynoexists && !$daynosw && $daynamesw )) {
+              $updateOK = TRUE;
+              break;
+            }
+          }
+        }
+      }
+// echo "efter BYDAY: ".implode('-',$wdate).' status: '; echo ($updateOK) ? 'TRUE' : 'FALSE'; echo "<br />\n"; // test ###
+            /* check BYSETPOS */
+      if( $updateOK ) {
+        if( isset( $recur['BYSETPOS'] ) &&
+          ( in_array( $recur['FREQ'], array( 'YEARLY', 'MONTHLY', 'WEEKLY', 'DAILY' )))) {
+          if( isset( $recur['WEEKLY'] )) {
+            if( $bysetposWold == $daycnts[$wdate['month']][$wdate['day']]['weekno_up'] )
+              $bysetposw1[] = $wdatets;
+            else
+              $bysetposw2[] = $wdatets;
+          }
+          else {
+            if(( isset( $recur['FREQ'] ) && ( 'YEARLY'      == $recur['FREQ'] )  &&
+                                            ( $bysetposYold == $wdate['year'] ))   ||
+               ( isset( $recur['FREQ'] ) && ( 'MONTHLY'     == $recur['FREQ'] )  &&
+                                           (( $bysetposYold == $wdate['year'] )  &&
+                                            ( $bysetposMold == $wdate['month'] ))) ||
+               ( isset( $recur['FREQ'] ) && ( 'DAILY'       == $recur['FREQ'] )  &&
+                                           (( $bysetposYold == $wdate['year'] )  &&
+                                            ( $bysetposMold == $wdate['month'])  &&
+                                            ( $bysetposDold == $wdate['day'] )))) {
+// echo "bysetposymd1[]=".implode('-',iCalUtilityFunctions::_date_time_string(date('Y-m-d H:i:s',$wdatets),6))."<br />\n";//test
+              $bysetposymd1[] = $wdatets;
+            }
+            else {
+// echo "bysetposymd2[]=".implode('-',iCalUtilityFunctions::_date_time_string(date('Y-m-d H:i:s',$wdatets),6))."<br />\n";//test
+              $bysetposymd2[] = $wdatets;
+            }
+          }
+        }
+        else {
+            /* update result array if BYSETPOS is set */
+          $countcnt++;
+          if( $startdatets <= $wdatets ) { // only output within period
+            $result[$wdatets] = TRUE;
+// echo "recur ".implode('-',iCalUtilityFunctions::_date_time_string(date('Y-m-d H:i:s',$wdatets),6))."<br />\n";//test
+          }
+// echo "recur undate ".implode('-',iCalUtilityFunctions::_date_time_string(date('Y-m-d H:i:s',$wdatets),6))." okdatstart ".implode('-',iCalUtilityFunctions::_date_time_string(date('Y-m-d H:i:s',$startdatets),6))."<br />\n";//test
+          $updateOK = FALSE;
+        }
+      }
+            /* step up date */
+      iCalUtilityFunctions::_stepdate( $wdate, $wdatets, $step);
+            /* check if BYSETPOS is set for updating result array */
+      if( $updateOK && isset( $recur['BYSETPOS'] )) {
+        $bysetpos       = FALSE;
+        if( isset( $recur['FREQ'] ) && ( 'YEARLY'  == $recur['FREQ'] ) &&
+          ( $bysetposYold != $wdate['year'] )) {
+          $bysetpos     = TRUE;
+          $bysetposYold = $wdate['year'];
+        }
+        elseif( isset( $recur['FREQ'] ) && ( 'MONTHLY' == $recur['FREQ'] &&
+         (( $bysetposYold != $wdate['year'] ) || ( $bysetposMold != $wdate['month'] )))) {
+          $bysetpos     = TRUE;
+          $bysetposYold = $wdate['year'];
+          $bysetposMold = $wdate['month'];
+        }
+        elseif( isset( $recur['FREQ'] ) && ( 'WEEKLY'  == $recur['FREQ'] )) {
+          $weekno = (int) date( 'W', mktime( 0, 0, $wkst, $wdate['month'], $wdate['day'], $wdate['year']));
+          if( $bysetposWold != $weekno ) {
+            $bysetposWold = $weekno;
+            $bysetpos     = TRUE;
+          }
+        }
+        elseif( isset( $recur['FREQ'] ) && ( 'DAILY'   == $recur['FREQ'] ) &&
+         (( $bysetposYold != $wdate['year'] )  ||
+          ( $bysetposMold != $wdate['month'] ) ||
+          ( $bysetposDold != $wdate['day'] ))) {
+          $bysetpos     = TRUE;
+          $bysetposYold = $wdate['year'];
+          $bysetposMold = $wdate['month'];
+          $bysetposDold = $wdate['day'];
+        }
+        if( $bysetpos ) {
+          if( isset( $recur['BYWEEKNO'] )) {
+            $bysetposarr1 = & $bysetposw1;
+            $bysetposarr2 = & $bysetposw2;
+          }
+          else {
+            $bysetposarr1 = & $bysetposymd1;
+            $bysetposarr2 = & $bysetposymd2;
+          }
+// echo 'test fÃ¶re out startYMD (weekno)='.$wdateStart['year'].':'.$wdateStart['month'].':'.$wdateStart['day']." ($weekStart) "; // test ###
+          foreach( $recur['BYSETPOS'] as $ix ) {
+            if( 0 > $ix ) // both positive and negative BYSETPOS allowed
+              $ix = ( count( $bysetposarr1 ) + $ix + 1);
+            $ix--;
+            if( isset( $bysetposarr1[$ix] )) {
+              if( $startdatets <= $bysetposarr1[$ix] ) { // only output within period
+//                $testdate   = iCalUtilityFunctions::_timestamp2date( $bysetposarr1[$ix], 6 );                // test ###
+//                $testweekno = (int) date( 'W', mktime( 0, 0, $wkst, $testdate['month'], $testdate['day'], $testdate['year'] )); // test ###
+// echo " testYMD (weekno)=".$testdate['year'].':'.$testdate['month'].':'.$testdate['day']." ($testweekno)";   // test ###
+                $result[$bysetposarr1[$ix]] = TRUE;
+// echo " recur ".implode('-',iCalUtilityFunctions::_date_time_string(date('Y-m-d H:i:s',$bysetposarr1[$ix]),6)); // test ###
+              }
+              $countcnt++;
+            }
+            if( isset( $recur['COUNT'] ) && ( $countcnt >= $recur['COUNT'] ))
+              break;
+          }
+// echo "<br />\n"; // test ###
+          $bysetposarr1 = $bysetposarr2;
+          $bysetposarr2 = array();
+        }
+      }
+    }
+  }
+  public static function _recurBYcntcheck( $BYvalue, $upValue, $downValue ) {
+    if( is_array( $BYvalue ) &&
+      ( in_array( $upValue, $BYvalue ) || in_array( $downValue, $BYvalue )))
+      return TRUE;
+    elseif(( $BYvalue == $upValue ) || ( $BYvalue == $downValue ))
+      return TRUE;
+    else
+      return FALSE;
+  }
+  public static function _recurIntervalIx( $freq, $date, $wkst ) {
+            /* create interval index */
+    switch( $freq ) {
+      case 'YEARLY':
+        $intervalix = $date['year'];
+        break;
+      case 'MONTHLY':
+        $intervalix = $date['year'].'-'.$date['month'];
+        break;
+      case 'WEEKLY':
+        $wdatets    = iCalUtilityFunctions::_date2timestamp( $date );
+        $intervalix = (int) date( 'W', ( $wdatets + $wkst ));
+       break;
+      case 'DAILY':
+           default:
+        $intervalix = $date['year'].'-'.$date['month'].'-'.$date['day'];
+        break;
+    }
+    return $intervalix;
+  }
+/**
+ * convert input format for exrule and rrule to internal format
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.9.10 - 2011-07-07
+ * @param array $rexrule
+ * @return array
+ */
+  public static function _setRexrule( $rexrule ) {
+    $input          = array();
+    if( empty( $rexrule ))
+      return $input;
+    foreach( $rexrule as $rexrulelabel => $rexrulevalue ) {
+      $rexrulelabel = strtoupper( $rexrulelabel );
+      if( 'UNTIL'  != $rexrulelabel )
+        $input[$rexrulelabel]   = $rexrulevalue;
+      else {
+        if( iCalUtilityFunctions::_isArrayTimestampDate( $rexrulevalue )) // timestamp date
+          $input[$rexrulelabel] = iCalUtilityFunctions::_timestamp2date( $rexrulevalue, 6 );
+        elseif( iCalUtilityFunctions::_isArrayDate( $rexrulevalue )) // date-time
+          $input[$rexrulelabel] = iCalUtilityFunctions::_date_time_array( $rexrulevalue, 6 );
+        elseif( 8 <= strlen( trim( $rexrulevalue ))) // ex. 2006-08-03 10:12:18
+          $input[$rexrulelabel] = iCalUtilityFunctions::_date_time_string( $rexrulevalue );
+        if(( 3 < count( $input[$rexrulelabel] )) && !isset( $input[$rexrulelabel]['tz'] ))
+          $input[$rexrulelabel]['tz'] = 'Z';
+      }
+    }
+            /* set recurrence rule specification in rfc2445 order */
+    $input2 = array();
+    if( isset( $input['FREQ'] ))
+      $input2['FREQ']       = $input['FREQ'];
+    if( isset( $input['UNTIL'] ))
+      $input2['UNTIL']      = $input['UNTIL'];
+    elseif( isset( $input['COUNT'] ))
+      $input2['COUNT']      = $input['COUNT'];
+    if( isset( $input['INTERVAL'] ))
+      $input2['INTERVAL']   = $input['INTERVAL'];
+    if( isset( $input['BYSECOND'] ))
+      $input2['BYSECOND']   = $input['BYSECOND'];
+    if( isset( $input['BYMINUTE'] ))
+      $input2['BYMINUTE']   = $input['BYMINUTE'];
+    if( isset( $input['BYHOUR'] ))
+      $input2['BYHOUR']     = $input['BYHOUR'];
+    if( isset( $input['BYDAY'] )) {
+      if( !is_array( $input['BYDAY'] )) // ensure upper case.. .
+        $input2['BYDAY']    = strtoupper( $input['BYDAY'] );
+      else {
+        foreach( $input['BYDAY'] as $BYDAYx => $BYDAYv ) {
+          if( 'DAY'        == strtoupper( $BYDAYx ))
+             $input2['BYDAY']['DAY'] = strtoupper( $BYDAYv );
+          elseif( !is_array( $BYDAYv )) {
+             $input2['BYDAY'][$BYDAYx]  = $BYDAYv;
+          }
+          else {
+            foreach( $BYDAYv as $BYDAYx2 => $BYDAYv2 ) {
+              if( 'DAY'    == strtoupper( $BYDAYx2 ))
+                 $input2['BYDAY'][$BYDAYx]['DAY'] = strtoupper( $BYDAYv2 );
+              else
+                 $input2['BYDAY'][$BYDAYx][$BYDAYx2] = $BYDAYv2;
+            }
+          }
+        }
+      }
+    }
+    if( isset( $input['BYMONTHDAY'] ))
+      $input2['BYMONTHDAY'] = $input['BYMONTHDAY'];
+    if( isset( $input['BYYEARDAY'] ))
+      $input2['BYYEARDAY']  = $input['BYYEARDAY'];
+    if( isset( $input['BYWEEKNO'] ))
+      $input2['BYWEEKNO']   = $input['BYWEEKNO'];
+    if( isset( $input['BYMONTH'] ))
+      $input2['BYMONTH']    = $input['BYMONTH'];
+    if( isset( $input['BYSETPOS'] ))
+      $input2['BYSETPOS']   = $input['BYSETPOS'];
+    if( isset( $input['WKST'] ))
+      $input2['WKST']       = $input['WKST'];
+    return $input2;
+  }
+/**
+ * convert format for input date to internal date with parameters
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.10.4 - 2011-08-03
+ * @param mixed $year
+ * @param mixed $month optional
+ * @param int $day optional
+ * @param int $hour optional
+ * @param int $min optional
+ * @param int $sec optional
+ * @param string $tz optional
+ * @param array $params optional
+ * @param string $caller optional
+ * @param string $objName optional
+ * @param string $tzid optional
+ * @return array
+ */
+  public static function _setDate( $year, $month=FALSE, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $tz=FALSE, $params=FALSE, $caller=null, $objName=null, $tzid=FALSE ) {
+    $input = $parno = null;
+    $localtime = (( 'dtstart' == $caller ) && in_array( $objName, array( 'vtimezone', 'standard', 'daylight' ))) ? TRUE : FALSE;
+    if( iCalUtilityFunctions::_isArrayDate( $year )) {
+      if( $localtime ) unset ( $month['VALUE'], $month['TZID'] );
+      $input['params'] = iCalUtilityFunctions::_setParams( $month, array( 'VALUE' => 'DATE-TIME' ));
+      if( isset( $input['params']['TZID'] )) {
+        $input['params']['VALUE'] = 'DATE-TIME';
+        unset( $year['tz'] );
+      }
+      $hitval          = (( !empty( $year['tz'] ) || !empty( $year[6] ))) ? 7 : 6;
+      $parno           = iCalUtilityFunctions::_existRem( $input['params'], 'VALUE', 'DATE-TIME', $hitval );
+      $parno           = iCalUtilityFunctions::_existRem( $input['params'], 'VALUE', 'DATE', 3, count( $year ), $parno );
+      $input['value']  = iCalUtilityFunctions::_date_time_array( $year, $parno );
+    }
+    elseif( iCalUtilityFunctions::_isArrayTimestampDate( $year )) {
+      if( $localtime ) unset ( $month['VALUE'], $month['TZID'] );
+      $input['params'] = iCalUtilityFunctions::_setParams( $month, array( 'VALUE' => 'DATE-TIME' ));
+      if( isset( $input['params']['TZID'] )) {
+        $input['params']['VALUE'] = 'DATE-TIME';
+        unset( $year['tz'] );
+      }
+      $parno           = iCalUtilityFunctions::_existRem( $input['params'], 'VALUE', 'DATE', 3 );
+      $hitval          = ( isset( $year['tz'] )) ? 7 : 6;
+      $parno           = iCalUtilityFunctions::_existRem( $input['params'], 'VALUE', 'DATE-TIME', $hitval, $parno );
+      $input['value']  = iCalUtilityFunctions::_timestamp2date( $year, $parno );
+    }
+    elseif( 8 <= strlen( trim( $year ))) { // ex. 2006-08-03 10:12:18
+      if( $localtime ) unset ( $month['VALUE'], $month['TZID'] );
+      $input['params'] = iCalUtilityFunctions::_setParams( $month, array( 'VALUE' => 'DATE-TIME' ));
+      if( isset( $input['params']['TZID'] )) {
+        $input['params']['VALUE'] = 'DATE-TIME';
+        $parno = 6;
+      }
+      elseif( $tzid && iCalUtilityFunctions::_isOffset( substr( $year, -7 ))) {
+        if(( in_array( substr( $year, -5, 1 ), array( '+', '-' ))) &&
+           (   '0000'  < substr( $year, -4 )) && (   '9999' >= substr( $year, -4 )))
+          $year = substr( $year, 0, ( strlen( $year ) - 5 ));
+        elseif(( in_array( substr( $input, -7, 1 ), array( '+', '-' ))) &&
+               ( '000000'  < substr( $input, -6 )) && ( '999999' >= substr( $input, -6 )))
+          $year = substr( $year, 0, ( strlen( $year ) - 7 ));
+        $parno = 6;
+      }
+      $parno           = iCalUtilityFunctions::_existRem( $input['params'], 'VALUE', 'DATE-TIME', 7, $parno );
+      $parno           = iCalUtilityFunctions::_existRem( $input['params'], 'VALUE', 'DATE', 3, $parno, $parno );
+      $input['value']  = iCalUtilityFunctions::_date_time_string( $year, $parno );
+    }
+    else {
+      if( is_array( $params )) {
+        if( $localtime ) unset ( $params['VALUE'], $params['TZID'] );
+        $input['params'] = iCalUtilityFunctions::_setParams( $params, array( 'VALUE' => 'DATE-TIME' ));
+      }
+      elseif( is_array( $tz )) {
+        $input['params'] = iCalUtilityFunctions::_setParams( $tz,     array( 'VALUE' => 'DATE-TIME' ));
+        $tz = FALSE;
+      }
+      elseif( is_array( $hour )) {
+        $input['params'] = iCalUtilityFunctions::_setParams( $hour,   array( 'VALUE' => 'DATE-TIME' ));
+        $hour = $min = $sec = $tz = FALSE;
+      }
+      if( isset( $input['params']['TZID'] )) {
+        $tz            = null;
+        $input['params']['VALUE'] = 'DATE-TIME';
+      }
+      $parno           = iCalUtilityFunctions::_existRem( $input['params'], 'VALUE', 'DATE', 3 );
+      $hitval          = ( !empty( $tz )) ? 7 : 6;
+      $parno           = iCalUtilityFunctions::_existRem( $input['params'], 'VALUE', 'DATE-TIME', $hitval, $parno, $parno );
+      $input['value']  = array( 'year'  => $year, 'month' => $month, 'day'   => $day );
+      if( 3 != $parno ) {
+        $input['value']['hour'] = ( $hour ) ? $hour : '0';
+        $input['value']['min']  = ( $min )  ? $min  : '0';
+        $input['value']['sec']  = ( $sec )  ? $sec  : '0';
+        if( !empty( $tz ))
+          $input['value']['tz'] = $tz;
+      }
+    }
+    if( 3 == $parno ) {
+      $input['params']['VALUE'] = 'DATE';
+      unset( $input['value']['tz'] );
+      unset( $input['params']['TZID'] );
+    }
+    elseif( isset( $input['params']['TZID'] ))
+      unset( $input['value']['tz'] );
+    if( $localtime )
+      unset( $input['value']['tz'], $input['params']['TZID'] );
+    elseif(( !isset( $input['params']['VALUE'] ) || ( $input['params']['VALUE'] != 'DATE' )) && !isset( $input['params']['TZID'] ) && $tzid )
+      $input['params']['TZID'] = $tzid;
+    if( isset( $input['value']['tz'] ))
+      $input['value']['tz'] = (string) $input['value']['tz'];
+    if( !empty( $input['value']['tz'] ) && ( 'Z' != $input['value']['tz'] ) &&
+      ( !iCalUtilityFunctions::_isOffset( $input['value']['tz'] )))
+      $input['params']['TZID'] = $input['value']['tz'];
+    return $input;
+  }
+/**
+ * convert format for input date (UTC) to internal date with parameters
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.17 - 2008-10-31
+ * @param mixed $year
+ * @param mixed $month optional
+ * @param int $day optional
+ * @param int $hour optional
+ * @param int $min optional
+ * @param int $sec optional
+ * @param array $params optional
+ * @return array
+ */
+  public static function _setDate2( $year, $month=FALSE, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $params=FALSE ) {
+    $input = null;
+    if( iCalUtilityFunctions::_isArrayDate( $year )) {
+      $input['value']  = iCalUtilityFunctions::_date_time_array( $year, 7 );
+      $input['params'] = iCalUtilityFunctions::_setParams( $month, array( 'VALUE' => 'DATE-TIME' ) );
+    }
+    elseif( iCalUtilityFunctions::_isArrayTimestampDate( $year )) {
+      $input['value']  = iCalUtilityFunctions::_timestamp2date( $year, 7 );
+      $input['params'] = iCalUtilityFunctions::_setParams( $month, array( 'VALUE' => 'DATE-TIME' ) );
+    }
+    elseif( 8 <= strlen( trim( $year ))) { // ex. 2006-08-03 10:12:18
+      $input['value']  = iCalUtilityFunctions::_date_time_string( $year, 7 );
+      $input['params'] = iCalUtilityFunctions::_setParams( $month, array( 'VALUE' => 'DATE-TIME' ) );
+    }
+    else {
+      $input['value']  = array( 'year'  => $year
+                              , 'month' => $month
+                              , 'day'   => $day
+                              , 'hour'  => $hour
+                              , 'min'   => $min
+                              , 'sec'   => $sec );
+      $input['params'] = iCalUtilityFunctions::_setParams( $params, array( 'VALUE' => 'DATE-TIME' ));
+    }
+    $parno = iCalUtilityFunctions::_existRem( $input['params'], 'VALUE', 'DATE-TIME', 7 ); // remove default
+    if( !isset( $input['value']['hour'] ))
+      $input['value']['hour'] = 0;
+    if( !isset( $input['value']['min'] ))
+      $input['value']['min'] = 0;
+    if( !isset( $input['value']['sec'] ))
+      $input['value']['sec'] = 0;
+    if( !isset( $input['value']['tz'] ) || !iCalUtilityFunctions::_isOffset( $input['value']['tz'] ))
+      $input['value']['tz'] = 'Z';
+    return $input;
+  }
+/**
+ * check index and set (an indexed) content in multiple value array
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.6.12 - 2011-01-03
+ * @param array $valArr
+ * @param mixed $value
+ * @param array $params
+ * @param array $defaults
+ * @param int $index
+ * @return void
+ */
+  public static function _setMval( & $valArr, $value, $params=FALSE, $defaults=FALSE, $index=FALSE ) {
+    if( !is_array( $valArr )) $valArr = array();
+    if( $index )
+      $index = $index - 1;
+    elseif( 0 < count( $valArr )) {
+      $keys  = array_keys( $valArr );
+      $index = end( $keys ) + 1;
+    }
+    else
+      $index = 0;
+    $valArr[$index] = array( 'value' => $value, 'params' => iCalUtilityFunctions::_setParams( $params, $defaults ));
+    ksort( $valArr );
+  }
+/**
+ * set input (formatted) parameters- component property attributes
+ *
+ * default parameters can be set, if missing
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 1.x.x - 2007-05-01
+ * @param array $params
+ * @param array $defaults
+ * @return array
+ */
+  public static function _setParams( $params, $defaults=FALSE ) {
+    if( !is_array( $params))
+      $params = array();
+    $input = array();
+    foreach( $params as $paramKey => $paramValue ) {
+      if( is_array( $paramValue )) {
+        foreach( $paramValue as $pkey => $pValue ) {
+          if(( '"' == substr( $pValue, 0, 1 )) && ( '"' == substr( $pValue, -1 )))
+            $paramValue[$pkey] = substr( $pValue, 1, ( strlen( $pValue ) - 2 ));
+        }
+      }
+      elseif(( '"' == substr( $paramValue, 0, 1 )) && ( '"' == substr( $paramValue, -1 )))
+        $paramValue = substr( $paramValue, 1, ( strlen( $paramValue ) - 2 ));
+      if( 'VALUE' == strtoupper( $paramKey ))
+        $input['VALUE']                 = strtoupper( $paramValue );
+      else
+        $input[strtoupper( $paramKey )] = $paramValue;
+    }
+    if( is_array( $defaults )) {
+      foreach( $defaults as $paramKey => $paramValue ) {
+        if( !isset( $input[$paramKey] ))
+          $input[$paramKey] = $paramValue;
+      }
+    }
+    return (0 < count( $input )) ? $input : null;
+  }
+/**
+ * set RRULE in vtimezone standard/daylight components based on component dtstart
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.10.3 - 2011-08-01
+ * @param object $obj, reference to an iCalcreator vtimezone standard/daylight instance
+ * @return bool
+ */
+  public static function _setTZrrule( & $obj ) {
+    if( FALSE === ( $date = $obj->getProperty( 'dtstart' )))
+      return FALSE;
+    $ts      = mktime( (int) $date['hour'], (int) $date['min'], (int) $date['sec'], (int) $date['month'], (int) $date['day'], (int) $date['year'] );
+    $daysNm  = array( 'SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA', 'SU' );
+    $day     = $daysNm[date( 'N', $ts )];
+    $daycnt  = date( 't', $ts ) - $date['day'];
+    if( 8 > $daycnt )
+      $ordwk = -1;
+    elseif( 15 > $daycnt)
+      $ordwk = -2;
+    elseif( 8 > $date['day'] )
+      $ordwk = 1;
+    else
+      $ordwk = 2;
+    $obj->setProperty( 'RRULE', array( 'FREQ' => 'YEARLY', 'BYDAY' => array( (string) $ordwk, 'DAY' => $day ), 'BYMONTH' => (int) $date['month'] ));
+    return TRUE;
+  }
+/**
+ * step date, return updated date, array and timpstamp
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.16 - 2008-10-18
+ * @param array $date, date to step
+ * @param int $timestamp
+ * @param array $step, default array( 'day' => 1 )
+ * @return void
+ */
+  public static function _stepdate( &$date, &$timestamp, $step=array( 'day' => 1 )) {
+    foreach( $step as $stepix => $stepvalue )
+      $date[$stepix] += $stepvalue;
+    $timestamp  = iCalUtilityFunctions::_date2timestamp( $date );
+    $date       = iCalUtilityFunctions::_timestamp2date( $timestamp, 6 );
+    foreach( $date as $k => $v ) {
+      if( ctype_digit( $v ))
+        $date[$k] = (int) $v;
+    }
+  }
+/**
+ * convert timestamp to date array
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.16 - 2008-11-01
+ * @param mixed $timestamp
+ * @param int $parno
+ * @return array
+ */
+  public static function _timestamp2date( $timestamp, $parno=6 ) {
+    if( is_array( $timestamp )) {
+      if(( 7 == $parno ) && !empty( $timestamp['tz'] ))
+        $tz = $timestamp['tz'];
+      $timestamp = $timestamp['timestamp'];
+    }
+    $output = array( 'year'  => date( 'Y', $timestamp )
+                   , 'month' => date( 'm', $timestamp )
+                   , 'day'   => date( 'd', $timestamp ));
+    if( 3 != $parno ) {
+             $output['hour'] =  date( 'H', $timestamp );
+             $output['min']  =  date( 'i', $timestamp );
+             $output['sec']  =  date( 's', $timestamp );
+      if( isset( $tz ))
+        $output['tz'] = $tz;
+    }
+    return $output;
+  }
+/**
+ * convert timestamp to duration in array format
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.6.23 - 2010-10-23
+ * @param int $timestamp
+ * @return array, duration format
+ */
+  public static function _timestamp2duration( $timestamp ) {
+    $dur         = array();
+    $dur['week'] = (int) floor( $timestamp / ( 7 * 24 * 60 * 60 ));
+    $timestamp   =              $timestamp % ( 7 * 24 * 60 * 60 );
+    $dur['day']  = (int) floor( $timestamp / ( 24 * 60 * 60 ));
+    $timestamp   =              $timestamp % ( 24 * 60 * 60 );
+    $dur['hour'] = (int) floor( $timestamp / ( 60 * 60 ));
+    $timestamp   =              $timestamp % ( 60 * 60 );
+    $dur['min']  = (int) floor( $timestamp / ( 60 ));
+    $dur['sec']  = (int)        $timestamp % ( 60 );
+    return $dur;
+  }
+/**
+ * transforms a dateTime from a timezone to another using PHP DateTime and DateTimeZone class (PHP >= PHP 5.2.0)
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.10.5 - 2011-08-03
+ * @param string $date    (date to alter)
+ * @param string $tzFrom, PHP valid old timezone
+ * @param string $tzTo,   PHP valid new timezone, default 'UTC'
+ * @param string $format, (opt) date output format, default 'Ymd\THis'
+ * @return bool
+ */
+  public static function transformDateTime( & $date, $tzFrom, $tzTo='UTC', $format = 'Ymd\THis' ) {
+    if( !class_exists( 'DateTime' ) || !class_exists( 'DateTimeZone' ))
+      return FALSE;
+    if( FALSE === ( $timestamp = strtotime( $date )))
+      return FALSE;
+    try {
+      $d = new DateTime( date( 'Y-m-d H:i:s', $timestamp ), new DateTimeZone( $tzFrom ));
+      $d->setTimezone( new DateTimeZone( $tzTo ));
+    }
+    catch (Exception $e) {
+      return FALSE;
+    }
+    $date = $d->format( $format );
+    return TRUE;
+  }
+/**
+ * convert (numeric) local time offset to seconds correcting localtime to GMT
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.16 - 2008-10-19
+ * @param string $offset
+ * @return integer
+ */
+  public static function _tz2offset( $tz ) {
+    $tz           = trim( (string) $tz );
+    $offset       = 0;
+    if(((     5  != strlen( $tz )) && ( 7  != strlen( $tz ))) ||
+       ((    '+' != substr( $tz, 0, 1 )) && ( '-' != substr( $tz, 0, 1 ))) ||
+       (( '0000' >= substr( $tz, 1, 4 )) && ( '9999' < substr( $tz, 1, 4 ))) ||
+           (( 7  == strlen( $tz )) && ( '00' > substr( $tz, 5, 2 )) && ( '99' < substr( $tz, 5, 2 ))))
+      return $offset;
+    $hours2sec    = (int) substr( $tz, 1, 2 ) * 3600;
+    $min2sec      = (int) substr( $tz, 3, 2 ) *   60;
+    $sec          = ( 7  == strlen( $tz )) ? (int) substr( $tz, -2 ) : '00';
+    $offset       = $hours2sec + $min2sec + $sec;
+    $offset       = ('-' == substr( $tz, 0, 1 )) ? $offset : -1 * $offset;
+    return $offset;
+  }
+}
+?>
Index: trunk/prototype/plugins/icalcreator/iCalcreator.class.php
===================================================================
--- trunk/prototype/plugins/icalcreator/iCalcreator.class.php	(revision 5399)
+++ trunk/prototype/plugins/icalcreator/iCalcreator.class.php	(revision 5399)
@@ -0,0 +1,6914 @@
+<?php
+/*********************************************************************************/
+/**
+ * iCalcreator class v2.10.5
+ * copyright (c) 2007-2011 Kjell-Inge Gustafsson kigkonsult
+ * www.kigkonsult.se/iCalcreator/index.php
+ * ical@kigkonsult.se
+ *
+ * Description:
+ * This file is a PHP implementation of RFC 2445.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+/*********************************************************************************/
+/*********************************************************************************/
+/*         A little setup                                                        */
+/*********************************************************************************/
+            /* your local language code */
+// define( 'ICAL_LANG', 'sv' );
+            // alt. autosetting
+/*
+$langstr     = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
+$pos         = strpos( $langstr, ';' );
+if ($pos   !== false) {
+  $langstr   = substr( $langstr, 0, $pos );
+  $pos       = strpos( $langstr, ',' );
+  if ($pos !== false) {
+    $pos     = strpos( $langstr, ',' );
+    $langstr = substr( $langstr, 0, $pos );
+  }
+  define( 'ICAL_LANG', $langstr );
+}
+*/
+/*********************************************************************************/
+/*         only for phpversion 5.1 and later,                                    */
+/*         date management, default timezone setting                             */
+/*         since 2.6.36 - 2010-12-31 */
+if( substr( phpversion(), 0, 3 ) >= '5.1' )
+  // && ( 'UTC' == date_default_timezone_get()))
+  date_default_timezone_set( 'Europe/Stockholm' );
+/*********************************************************************************/
+/*         since 2.6.22 - 2010-09-25, do NOT remove!!                            */
+require_once ROOTPATH.'/plugins/icalcreator/iCalUtilityFunctions.class.php';
+/*********************************************************************************/
+/*         version, do NOT remove!!                                              */
+define( 'ICALCREATOR_VERSION', 'iCalcreator 2.10.5' );
+/*********************************************************************************/
+/*********************************************************************************/
+/**
+ * vcalendar class
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.9.6 - 2011-05-14
+ */
+class icalCreator {
+            //  calendar property variables
+  var $calscale;
+  var $method;
+  var $prodid;
+  var $version;
+  var $xprop;
+            //  container for calendar components
+  var $components;
+            //  component config variables
+  var $allowEmpty;
+  var $unique_id;
+  var $language;
+  var $directory;
+  var $filename;
+  var $url;
+  var $delimiter;
+  var $nl;
+  var $format;
+  var $dtzid;
+            //  component internal variables
+  var $attributeDelimiter;
+  var $valueInit;
+            //  component xCal declaration container
+  var $xcaldecl;
+/**
+ * constructor for calendar object
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.9.6 - 2011-05-14
+ * @param array $config
+ * @return void
+ */
+  function icalCreator ( $config = array()) {
+    $this->_makeVersion();
+    $this->calscale   = null;
+    $this->method     = null;
+    $this->_makeUnique_id();
+    $this->prodid     = null;
+    $this->xprop      = array();
+    $this->language   = null;
+    $this->directory  = null;
+    $this->filename   = null;
+    $this->url        = null;
+    $this->dtzid      = null;
+/**
+ *   language = <Text identifying a language, as defined in [RFC 1766]>
+ */
+    if( defined( 'ICAL_LANG' ) && !isset( $config['language'] ))
+                                          $config['language']   = ICAL_LANG;
+    if( !isset( $config['allowEmpty'] ))  $config['allowEmpty'] = TRUE;
+    if( !isset( $config['nl'] ))          $config['nl']         = "\r\n";
+    if( !isset( $config['format'] ))      $config['format']     = 'iCal';
+    if( !isset( $config['delimiter'] ))   $config['delimiter']  = DIRECTORY_SEPARATOR;
+    $this->setConfig( $config );
+
+    $this->xcaldecl   = array();
+    $this->components = array();
+  }
+/*********************************************************************************/
+/**
+ * Property Name: CALSCALE
+ */
+/**
+ * creates formatted output for calendar property calscale
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-10-21
+ * @return string
+ */
+  function createCalscale() {
+    if( empty( $this->calscale )) return FALSE;
+    switch( $this->format ) {
+      case 'xcal':
+        return ' calscale="'.$this->calscale.'"'.$this->nl;
+        break;
+      default:
+        return 'CALSCALE:'.$this->calscale.$this->nl;
+        break;
+    }
+  }
+/**
+ * set calendar property calscale
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-10-21
+ * @param string $value
+ * @return void
+ */
+  function setCalscale( $value ) {
+    if( empty( $value )) return FALSE;
+    $this->calscale = $value;
+  }
+/*********************************************************************************/
+/**
+ * Property Name: METHOD
+ */
+/**
+ * creates formatted output for calendar property method
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 0.9.7 - 2006-11-20
+ * @return string
+ */
+  function createMethod() {
+    if( empty( $this->method )) return FALSE;
+    switch( $this->format ) {
+      case 'xcal':
+        return ' method="'.$this->method.'"'.$this->nl;
+        break;
+      default:
+        return 'METHOD:'.$this->method.$this->nl;
+        break;
+    }
+  }
+/**
+ * set calendar property method
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-20-23
+ * @param string $value
+ * @return bool
+ */
+  function setMethod( $value ) {
+    if( empty( $value )) return FALSE;
+    $this->method = $value;
+    return TRUE;
+  }
+/*********************************************************************************/
+/**
+ * Property Name: PRODID
+ *
+ *  The identifier is RECOMMENDED to be the identical syntax to the
+ * [RFC 822] addr-spec. A good method to assure uniqueness is to put the
+ * domain name or a domain literal IP address of the host on which.. .
+ */
+/**
+ * creates formatted output for calendar property prodid
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 0.9.7 - 2006-11-20
+ * @return string
+ */
+  function createProdid() {
+    if( !isset( $this->prodid ))
+      $this->_makeProdid();
+    switch( $this->format ) {
+      case 'xcal':
+        return ' prodid="'.$this->prodid.'"'.$this->nl;
+        break;
+      default:
+        return 'PRODID:'.$this->prodid.$this->nl;
+        break;
+    }
+  }
+/**
+ * make default value for calendar prodid
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.6.8 - 2009-12-30
+ * @return void
+ */
+  function _makeProdid() {
+    $this->prodid  = '-//'.$this->unique_id.'//NONSGML kigkonsult.se '.ICALCREATOR_VERSION.'//'.strtoupper( $this->language );
+  }
+/**
+ * Conformance: The property MUST be specified once in an iCalendar object.
+ * Description: The vendor of the implementation SHOULD assure that this
+ * is a globally unique identifier; using some technique such as an FPI
+ * value, as defined in [ISO 9070].
+ */
+/**
+ * make default unique_id for calendar prodid
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 0.3.0 - 2006-08-10
+ * @return void
+ */
+  function _makeUnique_id() {
+    $this->unique_id  = ( isset( $_SERVER['SERVER_NAME'] )) ? gethostbyname( $_SERVER['SERVER_NAME'] ) : 'localhost';
+  }
+/*********************************************************************************/
+/**
+ * Property Name: VERSION
+ *
+ * Description: A value of "2.0" corresponds to this memo.
+ */
+/**
+ * creates formatted output for calendar property version
+
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 0.9.7 - 2006-11-20
+ * @return string
+ */
+  function createVersion() {
+    if( empty( $this->version ))
+      $this->_makeVersion();
+    switch( $this->format ) {
+      case 'xcal':
+        return ' version="'.$this->version.'"'.$this->nl;
+        break;
+      default:
+        return 'VERSION:'.$this->version.$this->nl;
+        break;
+    }
+  }
+/**
+ * set default calendar version
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 0.3.0 - 2006-08-10
+ * @return void
+ */
+  function _makeVersion() {
+    $this->version = '2.0';
+  }
+/**
+ * set calendar version
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-10-23
+ * @param string $value
+ * @return void
+ */
+  function setVersion( $value ) {
+    if( empty( $value )) return FALSE;
+    $this->version = $value;
+    return TRUE;
+  }
+/*********************************************************************************/
+/**
+ * Property Name: x-prop
+ */
+/**
+ * creates formatted output for calendar property x-prop, iCal format only
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.9.3 - 2011-05-14
+ * @return string
+ */
+  function createXprop() {
+    if( 'xcal' == $this->format )
+      return false;
+    if( empty( $this->xprop ) || !is_array( $this->xprop )) return FALSE;
+    $output = null;
+    $toolbox = new calendarComponent();
+    $toolbox->setConfig( $this->getConfig());
+    foreach( $this->xprop as $label => $xpropPart ) {
+      if( !isset($xpropPart['value']) || ( empty( $xpropPart['value'] ) && !is_numeric( $xpropPart['value'] ))) {
+        $output  .= $toolbox->_createElement( $label );
+        continue;
+      }
+      $attributes = $toolbox->_createParams( $xpropPart['params'], array( 'LANGUAGE' ));
+      if( is_array( $xpropPart['value'] )) {
+        foreach( $xpropPart['value'] as $pix => $theXpart )
+          $xpropPart['value'][$pix] = $toolbox->_strrep( $theXpart );
+        $xpropPart['value']  = implode( ',', $xpropPart['value'] );
+      }
+      else
+        $xpropPart['value'] = $toolbox->_strrep( $xpropPart['value'] );
+      $output    .= $toolbox->_createElement( $label, $attributes, $xpropPart['value'] );
+    }
+    return $output;
+  }
+/**
+ * set calendar property x-prop
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.9.3 - 2011-05-14
+ * @param string $label
+ * @param string $value
+ * @param array $params optional
+ * @return bool
+ */
+  function setXprop( $label, $value, $params=FALSE ) {
+    if( empty( $label )) return FALSE;
+    if( empty( $value ) && !is_numeric( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
+    $xprop           = array( 'value' => $value );
+    $xprop['params'] = iCalUtilityFunctions::_setParams( $params );
+    if( !is_array( $this->xprop )) $this->xprop = array();
+    $this->xprop[strtoupper( $label )] = $xprop;
+    return TRUE;
+  }
+/*********************************************************************************/
+/**
+ * delete calendar property value
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.8.8 - 2011-03-15
+ * @param mixed $propName, bool FALSE => X-property
+ * @param int $propix, optional, if specific property is wanted in case of multiply occurences
+ * @return bool, if successfull delete
+ */
+  function deleteProperty( $propName=FALSE, $propix=FALSE ) {
+    $propName = ( $propName ) ? strtoupper( $propName ) : 'X-PROP';
+    if( !$propix )
+      $propix = ( isset( $this->propdelix[$propName] ) && ( 'X-PROP' != $propName )) ? $this->propdelix[$propName] + 2 : 1;
+    $this->propdelix[$propName] = --$propix;
+    $return = FALSE;
+    switch( $propName ) {
+      case 'CALSCALE':
+        if( isset( $this->calscale )) {
+          $this->calscale = null;
+          $return = TRUE;
+        }
+        break;
+      case 'METHOD':
+        if( isset( $this->method )) {
+          $this->method   = null;
+          $return = TRUE;
+        }
+        break;
+      default:
+        $reduced = array();
+        if( $propName != 'X-PROP' ) {
+          if( !isset( $this->xprop[$propName] )) { unset( $this->propdelix[$propName] ); return FALSE; }
+          foreach( $this->xprop as $k => $a ) {
+            if(( $k != $propName ) && !empty( $a ))
+              $reduced[$k] = $a;
+          }
+        }
+        else {
+          if( count( $this->xprop ) <= $propix )  return FALSE;
+          $xpropno = 0;
+          foreach( $this->xprop as $xpropkey => $xpropvalue ) {
+            if( $propix != $xpropno )
+              $reduced[$xpropkey] = $xpropvalue;
+            $xpropno++;
+          }
+        }
+        $this->xprop = $reduced;
+        if( empty( $this->xprop )) {
+          unset( $this->propdelix[$propName] );
+          return FALSE;
+        }
+        return TRUE;
+    }
+    return $return;
+  }
+/**
+ * get calendar property value/params
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.8.8 - 2011-04-16
+ * @param string $propName, optional
+ * @param int $propix, optional, if specific property is wanted in case of multiply occurences
+ * @param bool $inclParam=FALSE
+ * @return mixed
+ */
+  function getProperty( $propName=FALSE, $propix=FALSE, $inclParam=FALSE ) {
+    $propName = ( $propName ) ? strtoupper( $propName ) : 'X-PROP';
+    if( 'X-PROP' == $propName ) {
+      if( !$propix )
+        $propix = ( isset( $this->propix[$propName] )) ? $this->propix[$propName] + 2 : 1;
+      $this->propix[$propName] = --$propix;
+    }
+    switch( $propName ) {
+      case 'ATTENDEE':
+      case 'CATEGORIES':
+      case 'DTSTART':
+      case 'LOCATION':
+      case 'ORGANIZER':
+      case 'PRIORITY':
+      case 'RESOURCES':
+      case 'STATUS':
+      case 'SUMMARY':
+      case 'RECURRENCE-ID-UID':
+      case 'R-UID':
+      case 'UID':
+        $output = array();
+        foreach ( $this->components as $cix => $component) {
+          if( !in_array( $component->objName, array('vevent', 'vtodo', 'vjournal', 'vfreebusy' )))
+            continue;
+          if(( 'ATTENDEE' == $propName ) || ( 'CATEGORIES' == $propName ) || ( 'RESOURCES' == $propName )) {
+            $component->_getProperties( $propName, $output );
+            continue;
+          }
+          elseif(( 3 < strlen( $propName )) && ( 'UID' == substr( $propName, -3 ))) {
+            if( FALSE !== ( $content = $component->getProperty( 'RECURRENCE-ID' )))
+              $content = $component->getProperty( 'UID' );
+          }
+          elseif( FALSE === ( $content = $component->getProperty( $propName )))
+            continue;
+          if( FALSE === $content )
+            continue;
+          elseif( is_array( $content )) {
+            if( isset( $content['year'] )) {
+              $key  = sprintf( '%04d%02d%02d', $content['year'], $content['month'], $content['day'] );
+              if( !isset( $output[$key] ))
+                $output[$key] = 1;
+              else
+                $output[$key] += 1;
+            }
+            else {
+              foreach( $content as $partValue => $partCount ) {
+                if( !isset( $output[$partValue] ))
+                  $output[$partValue] = $partCount;
+                else
+                  $output[$partValue] += $partCount;
+              }
+            }
+          } // end elseif( is_array( $content )) {
+          elseif( !isset( $output[$content] ))
+            $output[$content] = 1;
+          else
+            $output[$content] += 1;
+        } // end foreach ( $this->components as $cix => $component)
+        if( !empty( $output ))
+          ksort( $output );
+        return $output;
+        break;
+
+      case 'CALSCALE':
+        return ( !empty( $this->calscale )) ? $this->calscale : FALSE;
+        break;
+      case 'METHOD':
+        return ( !empty( $this->method )) ? $this->method : FALSE;
+        break;
+      case 'PRODID':
+        if( empty( $this->prodid ))
+          $this->_makeProdid();
+        return $this->prodid;
+        break;
+      case 'VERSION':
+        return ( !empty( $this->version )) ? $this->version : FALSE;
+        break;
+      default:
+        if( $propName != 'X-PROP' ) {
+          if( !isset( $this->xprop[$propName] )) return FALSE;
+          return ( $inclParam ) ? array( $propName, $this->xprop[$propName] )
+                                : array( $propName, $this->xprop[$propName]['value'] );
+        }
+        else {
+          if( empty( $this->xprop )) return FALSE;
+          $xpropno = 0;
+          foreach( $this->xprop as $xpropkey => $xpropvalue ) {
+            if( $propix == $xpropno )
+              return ( $inclParam ) ? array( $xpropkey, $this->xprop[$xpropkey] )
+                                    : array( $xpropkey, $this->xprop[$xpropkey]['value'] );
+            else
+              $xpropno++;
+          }
+          unset( $this->propix[$propName] );
+          return FALSE; // not found ??
+        }
+    }
+    return FALSE;
+  }
+/**
+ * general vcalendar property setting
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.2.13 - 2007-11-04
+ * @param mixed $args variable number of function arguments,
+ *                    first argument is ALWAYS component name,
+ *                    second ALWAYS component value!
+ * @return bool
+ */
+  function setProperty () {
+    $numargs    = func_num_args();
+    if( 1 > $numargs )
+      return FALSE;
+    $arglist    = func_get_args();
+    $arglist[0] = strtoupper( $arglist[0] );
+    switch( $arglist[0] ) {
+      case 'CALSCALE':
+        return $this->setCalscale( $arglist[1] );
+      case 'METHOD':
+        return $this->setMethod( $arglist[1] );
+      case 'VERSION':
+        return $this->setVersion( $arglist[1] );
+      default:
+        if( !isset( $arglist[1] )) $arglist[1] = null;
+        if( !isset( $arglist[2] )) $arglist[2] = null;
+        return $this->setXprop( $arglist[0], $arglist[1], $arglist[2] );
+    }
+    return FALSE;
+  }
+/*********************************************************************************/
+/**
+ * get vcalendar config values or * calendar components
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.9.6 - 2011-05-14
+ * @param mixed $config
+ * @return value
+ */
+  function getConfig( $config = FALSE ) {
+    if( !$config ) {
+      $return = array();
+      $return['ALLOWEMPTY']  = $this->getConfig( 'ALLOWEMPTY' );
+      $return['DELIMITER']   = $this->getConfig( 'DELIMITER' );
+      $return['DIRECTORY']   = $this->getConfig( 'DIRECTORY' );
+      $return['FILENAME']    = $this->getConfig( 'FILENAME' );
+      $return['DIRFILE']     = $this->getConfig( 'DIRFILE' );
+      $return['FILESIZE']    = $this->getConfig( 'FILESIZE' );
+      $return['FORMAT']      = $this->getConfig( 'FORMAT' );
+      if( FALSE !== ( $lang  = $this->getConfig( 'LANGUAGE' )))
+        $return['LANGUAGE']  = $lang;
+      $return['NEWLINECHAR'] = $this->getConfig( 'NEWLINECHAR' );
+      $return['UNIQUE_ID']   = $this->getConfig( 'UNIQUE_ID' );
+      if( FALSE !== ( $url   = $this->getConfig( 'URL' )))
+        $return['URL']       = $url;
+      $return['TZID']        = $this->getConfig( 'TZID' );
+      return $return;
+    }
+    switch( strtoupper( $config )) {
+      case 'ALLOWEMPTY':
+        return $this->allowEmpty;
+        break;
+      case 'COMPSINFO':
+        unset( $this->compix );
+        $info = array();
+        foreach( $this->components as $cix => $component ) {
+          if( empty( $component )) continue;
+          $info[$cix]['ordno'] = $cix + 1;
+          $info[$cix]['type']  = $component->objName;
+          $info[$cix]['uid']   = $component->getProperty( 'uid' );
+          $info[$cix]['props'] = $component->getConfig( 'propinfo' );
+          $info[$cix]['sub']   = $component->getConfig( 'compsinfo' );
+        }
+        return $info;
+        break;
+      case 'DELIMITER':
+        return $this->delimiter;
+        break;
+      case 'DIRECTORY':
+        if( empty( $this->directory ))
+          $this->directory = '.';
+        return $this->directory;
+        break;
+      case 'DIRFILE':
+        return $this->getConfig( 'directory' ).$this->getConfig( 'delimiter' ).$this->getConfig( 'filename' );
+        break;
+      case 'FILEINFO':
+        return array( $this->getConfig( 'directory' )
+                    , $this->getConfig( 'filename' )
+                    , $this->getConfig( 'filesize' ));
+        break;
+      case 'FILENAME':
+        if( empty( $this->filename )) {
+          if( 'xcal' == $this->format )
+            $this->filename = date( 'YmdHis' ).'.xml'; // recommended xcs.. .
+          else
+            $this->filename = date( 'YmdHis' ).'.ics';
+        }
+        return $this->filename;
+        break;
+      case 'FILESIZE':
+        $size    = 0;
+        if( empty( $this->url )) {
+          $dirfile = $this->getConfig( 'dirfile' );
+          if( !is_file( $dirfile ) || ( FALSE === ( $size = filesize( $dirfile ))))
+            $size = 0;
+          clearstatcache();
+        }
+        return $size;
+        break;
+      case 'FORMAT':
+        return ( $this->format == 'xcal' ) ? 'xCal' : 'iCal';
+        break;
+      case 'LANGUAGE':
+         /* get language for calendar component as defined in [RFC 1766] */
+        return $this->language;
+        break;
+      case 'NL':
+      case 'NEWLINECHAR':
+        return $this->nl;
+        break;
+      case 'TZID':
+        return $this->dtzid;
+        break;
+      case 'UNIQUE_ID':
+        return $this->unique_id;
+        break;
+      case 'URL':
+        if( !empty( $this->url ))
+          return $this->url;
+        else
+          return FALSE;
+        break;
+    }
+  }
+/**
+ * general vcalendar config setting
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.9.6 - 2011-05-14
+ * @param mixed  $config
+ * @param string $value
+ * @return void
+ */
+  function setConfig( $config, $value = FALSE) {
+    if( is_array( $config )) {
+      foreach( $config as $cKey => $cValue ) {
+        if( FALSE === $this->setConfig( $cKey, $cValue ))
+          return FALSE;
+      }
+      return TRUE;
+    }
+    $res = FALSE;
+    switch( strtoupper( $config )) {
+      case 'ALLOWEMPTY':
+        $this->allowEmpty = $value;
+        $subcfg  = array( 'ALLOWEMPTY' => $value );
+        $res = TRUE;
+        break;
+      case 'DELIMITER':
+        $this->delimiter = $value;
+        return TRUE;
+        break;
+      case 'DIRECTORY':
+        $value   = trim( $value );
+        $del     = $this->getConfig('delimiter');
+        if( $del == substr( $value, ( 0 - strlen( $del ))))
+          $value = substr( $value, 0, ( strlen( $value ) - strlen( $del )));
+        if( is_dir( $value )) {
+            /* local directory */
+          clearstatcache();
+          $this->directory = $value;
+          $this->url       = null;
+          return TRUE;
+        }
+        else
+          return FALSE;
+        break;
+      case 'FILENAME':
+        $value   = trim( $value );
+        if( !empty( $this->url )) {
+            /* remote directory+file -> URL */
+          $this->filename = $value;
+          return TRUE;
+        }
+        $dirfile = $this->getConfig( 'directory' ).$this->getConfig( 'delimiter' ).$value;
+        if( file_exists( $dirfile )) {
+            /* local file exists */
+          if( is_readable( $dirfile ) || is_writable( $dirfile )) {
+            clearstatcache();
+            $this->filename = $value;
+            return TRUE;
+          }
+          else
+            return FALSE;
+        }
+        elseif( is_readable($this->getConfig( 'directory' ) ) || is_writable( $this->getConfig( 'directory' ) )) {
+            /* read- or writable directory */
+          $this->filename = $value;
+          return TRUE;
+        }
+        else
+          return FALSE;
+        break;
+      case 'FORMAT':
+        $value   = trim( strtolower( $value ));
+        if( 'xcal' == $value ) {
+          $this->format             = 'xcal';
+          $this->attributeDelimiter = $this->nl;
+          $this->valueInit          = null;
+        }
+        else {
+          $this->format             = null;
+          $this->attributeDelimiter = ';';
+          $this->valueInit          = ':';
+        }
+        $subcfg  = array( 'FORMAT' => $value );
+        $res = TRUE;
+        break;
+      case 'LANGUAGE':
+         // set language for calendar component as defined in [RFC 1766]
+        $value   = trim( $value );
+        $this->language = $value;
+        $subcfg  = array( 'LANGUAGE' => $value );
+        $res = TRUE;
+        break;
+      case 'NL':
+      case 'NEWLINECHAR':
+        $this->nl = $value;
+        $subcfg  = array( 'NL' => $value );
+        $res = TRUE;
+        break;
+      case 'TZID':
+        $this->dtzid = $value;
+        $subcfg  = array( 'TZID' => $value );
+        $res = TRUE;
+        break;
+      case 'UNIQUE_ID':
+        $value   = trim( $value );
+        $this->unique_id = $value;
+        $subcfg  = array( 'UNIQUE_ID' => $value );
+        $res = TRUE;
+        break;
+      case 'URL':
+            /* remote file - URL */
+        $value     = trim( $value );
+        $value     = str_replace( 'HTTP://',   'http://', $value );
+        $value     = str_replace( 'WEBCAL://', 'http://', $value );
+        $value     = str_replace( 'webcal://', 'http://', $value );
+        $this->url = $value;
+        $this->directory = null;
+        $parts     = pathinfo( $value );
+        return $this->setConfig( 'filename',  $parts['basename'] );
+        break;
+      default:  // any unvalid config key.. .
+        return TRUE;
+    }
+    if( !$res ) return FALSE;
+    if( isset( $subcfg ) && !empty( $this->components )) {
+      foreach( $subcfg as $cfgkey => $cfgvalue ) {
+        foreach( $this->components as $cix => $component ) {
+          $res = $component->setConfig( $cfgkey, $cfgvalue, TRUE );
+          if( !$res )
+            break 2;
+          $this->components[$cix] = $component->copy(); // PHP4 compliant
+        }
+      }
+    }
+    return $res;
+  }
+/*********************************************************************************/
+/**
+ * add calendar component to container
+ *
+ * alias to setComponent
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 1.x.x - 2007-04-24
+ * @param object $component calendar component
+ * @return void
+ */
+  function addComponent( $component ) {
+    $this->setComponent( $component );
+  }
+/**
+ * delete calendar component from container
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.8.8 - 2011-03-15
+ * @param mixed $arg1 ordno / component type / component uid
+ * @param mixed $arg2 optional, ordno if arg1 = component type
+ * @return void
+ */
+  function deleteComponent( $arg1, $arg2=FALSE  ) {
+    $argType = $index = null;
+    if ( ctype_digit( (string) $arg1 )) {
+      $argType = 'INDEX';
+      $index   = (int) $arg1 - 1;
+    }
+    elseif(( strlen( $arg1 ) <= strlen( 'vfreebusy' )) && ( FALSE === strpos( $arg1, '@' ))) {
+      $argType = strtolower( $arg1 );
+      $index   = ( !empty( $arg2 ) && ctype_digit( (string) $arg2 )) ? (( int ) $arg2 - 1 ) : 0;
+    }
+    $cix1dC = 0;
+    foreach ( $this->components as $cix => $component) {
+      if( empty( $component )) continue;
+      if(( 'INDEX' == $argType ) && ( $index == $cix )) {
+        unset( $this->components[$cix] );
+        return TRUE;
+      }
+      elseif( $argType == $component->objName ) {
+        if( $index == $cix1dC ) {
+          unset( $this->components[$cix] );
+          return TRUE;
+        }
+        $cix1dC++;
+      }
+      elseif( !$argType && ($arg1 == $component->getProperty( 'uid' ))) {
+        unset( $this->components[$cix] );
+        return TRUE;
+      }
+    }
+    return FALSE;
+  }
+/**
+ * get calendar component from container
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.9.1 - 2011-04-16
+ * @param mixed $arg1 optional, ordno/component type/ component uid
+ * @param mixed $arg2 optional, ordno if arg1 = component type
+ * @return object
+ */
+  function getComponent( $arg1=FALSE, $arg2=FALSE ) {
+    $index = $argType = null;
+    if ( !$arg1 ) { // first or next in component chain
+      $argType = 'INDEX';
+      $index   = $this->compix['INDEX'] = ( isset( $this->compix['INDEX'] )) ? $this->compix['INDEX'] + 1 : 1;
+    }
+    elseif ( ctype_digit( (string) $arg1 )) { // specific component in chain
+      $argType = 'INDEX';
+      $index   = (int) $arg1;
+      unset( $this->compix );
+    }
+    elseif( is_array( $arg1 )) { // array( *[propertyName => propertyValue] )
+      $arg2  = implode( '-', array_keys( $arg1 ));
+      $index = $this->compix[$arg2] = ( isset( $this->compix[$arg2] )) ? $this->compix[$arg2] + 1 : 1;
+      $dateProps  = array( 'DTSTART', 'DTEND', 'DUE', 'CREATED', 'COMPLETED', 'DTSTAMP', 'LAST-MODIFIED', 'RECURRENCE-ID' );
+      $otherProps = array( 'ATTENDEE', 'CATEGORIES', 'LOCATION', 'ORGANIZER', 'PRIORITY', 'RESOURCES', 'STATUS', 'SUMMARY', 'UID' );
+    }
+    elseif(( strlen( $arg1 ) <= strlen( 'vfreebusy' )) && ( FALSE === strpos( $arg1, '@' ))) { // object class name
+      unset( $this->compix['INDEX'] );
+      $argType = strtolower( $arg1 );
+      if( !$arg2 )
+        $index = $this->compix[$argType] = ( isset( $this->compix[$argType] )) ? $this->compix[$argType] + 1 : 1;
+      elseif( isset( $arg2 ) && ctype_digit( (string) $arg2 ))
+        $index = (int) $arg2;
+    }
+    elseif(( strlen( $arg1 ) > strlen( 'vfreebusy' )) && ( FALSE !== strpos( $arg1, '@' ))) { // UID as 1st argument
+      if( !$arg2 )
+        $index = $this->compix[$arg1] = ( isset( $this->compix[$arg1] )) ? $this->compix[$arg1] + 1 : 1;
+      elseif( isset( $arg2 ) && ctype_digit( (string) $arg2 ))
+        $index = (int) $arg2;
+    }
+    if( isset( $index ))
+      $index  -= 1;
+    $ckeys = array_keys( $this->components );
+    if( !empty( $index) && ( $index > end(  $ckeys )))
+      return FALSE;
+    $cix1gC = 0;
+    foreach ( $this->components as $cix => $component) {
+      if( empty( $component )) continue;
+      if(( 'INDEX' == $argType ) && ( $index == $cix ))
+        return $component->copy();
+      elseif( $argType == $component->objName ) {
+        if( $index == $cix1gC )
+          return $component->copy();
+        $cix1gC++;
+      }
+      elseif( is_array( $arg1 )) { // array( *[propertyName => propertyValue] )
+        $hit = FALSE;
+        foreach( $arg1 as $pName => $pValue ) {
+          $pName = strtoupper( $pName );
+          if( !in_array( $pName, $dateProps ) && !in_array( $pName, $otherProps ))
+            continue;
+          if(( 'ATTENDEE' == $pName ) || ( 'CATEGORIES' == $pName ) || ( 'RESOURCES' == $pName )) { // multiple ocurrence may occur
+            $propValues = array();
+            $component->_getProperties( $pName, $propValues );
+            $propValues = array_keys( $propValues );
+            $hit = ( in_array( $pValue, $propValues )) ? TRUE : FALSE;
+            continue;
+          } // end   if(( 'CATEGORIES' == $propName ) || ( 'RESOURCES' == $propName )) { // multiple ocurrence may occur
+          if( FALSE === ( $value = $component->getProperty( $pName ))) { // single ocurrency
+            $hit = FALSE; // missing property
+            continue;
+          }
+          if( 'SUMMARY' == $pName ) { // exists within (any case)
+            $hit = ( FALSE !== stripos( $d, $pValue )) ? TRUE : FALSE;
+            continue;
+          }
+          if( in_array( strtoupper( $pName ), $dateProps )) {
+            $valuedate = sprintf( '%04d%02d%02d', $value['year'], $value['month'], $value['day'] );
+            if( 8 < strlen( $pValue )) {
+              if( isset( $value['hour'] )) {
+                if( 'T' == substr( $pValue, 8, 1 ))
+                  $pValue = str_replace( 'T', '', $pValue );
+                $valuedate .= sprintf( '%02d%02d%02d', $value['hour'], $value['min'], $value['sec'] );
+              }
+              else
+                $pValue = substr( $pValue, 0, 8 );
+            }
+            $hit = ( $pValue == $valuedate ) ? TRUE : FALSE;
+            continue;
+          }
+          elseif( !is_array( $value ))
+            $value = array( $value );
+          foreach( $value as $part ) {
+            $part = ( FALSE !== strpos( $part, ',' )) ? explode( ',', $part ) : array( $part );
+            foreach( $part as $subPart ) {
+              if( $pValue == $subPart ) {
+                $hit = TRUE;
+                continue 2;
+              }
+            }
+          }
+          $hit = FALSE; // no hit in property
+        } // end  foreach( $arg1 as $pName => $pValue )
+        if( $hit ) {
+          if( $index == $cix1gC )
+            return $component->copy();
+          $cix1gC++;
+        }
+      } // end elseif( is_array( $arg1 )) { // array( *[propertyName => propertyValue] )
+      elseif( !$argType && ($arg1 == $component->getProperty( 'uid' ))) { // UID
+        if( $index == $cix1gC )
+          return $component->copy();
+        $cix1gC++;
+      }
+    } // end foreach ( $this->components.. .
+            /* not found.. . */
+    unset( $this->compix );
+    return FALSE;
+  }
+/**
+ * create new calendar component, already included within calendar
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.6.33 - 2011-01-03
+ * @param string $compType component type
+ * @return object (reference)
+ */
+  function & newComponent( $compType ) {
+    $config = $this->getConfig();
+    $keys   = array_keys( $this->components );
+    $ix     = end( $keys) + 1;
+    switch( strtoupper( $compType )) {
+      case 'EVENT':
+      case 'VEVENT':
+        $this->components[$ix] = new vevent( $config );
+        break;
+      case 'TODO':
+      case 'VTODO':
+        $this->components[$ix] = new vtodo( $config );
+        break;
+      case 'JOURNAL':
+      case 'VJOURNAL':
+        $this->components[$ix] = new vjournal( $config );
+        break;
+      case 'FREEBUSY':
+      case 'VFREEBUSY':
+        $this->components[$ix] = new vfreebusy( $config );
+        break;
+      case 'TIMEZONE':
+      case 'VTIMEZONE':
+        array_unshift( $this->components, new vtimezone( $config ));
+        $ix = 0;
+        break;
+      default:
+        return FALSE;
+    }
+    return $this->components[$ix];
+  }
+/**
+ * select components from calendar on date or selectOption basis
+ *
+ * Ensure DTSTART is set for every component.
+ * No date controls occurs.
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.9.7 - 2011-06-04
+ * @param mixed $startY optional, start Year, default current Year ALT. array selecOptions
+ * @param int $startM optional,  start Month, default current Month
+ * @param int $startD optional,  start Day, default current Day
+ * @param int $endY optional,    end Year, default $startY
+ * @param int $endY optional,    end Month, default $startM
+ * @param int $endY optional,    end Day, default $startD
+ * @param mixed $cType optional, calendar component type(-s), default FALSE=all else string/array type(-s)
+ * @param bool $flat optional,   FALSE (default) => output : array[Year][Month][Day][]
+ *                               TRUE => output : array[] (ignores split)
+ * @param bool $any optional,    TRUE (default) - select component that take place within period
+ *                               FALSE - only components that starts within period
+ * @param bool $split optional,  TRUE (default) - one component copy every day it take place during the
+ *                                       period (implies flat=FALSE)
+ *                               FALSE - one occurance of component only in output array
+ * @return array or FALSE
+ */
+  function selectComponents( $startY=FALSE, $startM=FALSE, $startD=FALSE, $endY=FALSE, $endM=FALSE, $endD=FALSE, $cType=FALSE, $flat=FALSE, $any=TRUE, $split=TRUE ) {
+            /* check  if empty calendar */
+    if( 0 >= count( $this->components )) return FALSE;
+    if( is_array( $startY ))
+      return $this->selectComponents2( $startY );
+            /* check default dates */
+    if( !$startY ) $startY = date( 'Y' );
+    if( !$startM ) $startM = date( 'm' );
+    if( !$startD ) $startD = date( 'd' );
+    $startDate = mktime( 0, 0, 0, $startM, $startD, $startY );
+    if( !$endY )   $endY   = $startY;
+    if( !$endM )   $endM   = $startM;
+    if( !$endD )   $endD   = $startD;
+    $endDate   = mktime( 23, 59, 59, $endM, $endD, $endY );
+//echo 'selectComp arg='.date( 'Y-m-d H:i:s', $startDate).' -- '.date( 'Y-m-d H:i:s', $endDate)."<br />\n"; $tcnt = 0;// test ###
+            /* check component types */
+    $validTypes = array('vevent', 'vtodo', 'vjournal', 'vfreebusy' );
+    if( is_array( $cType )) {
+      foreach( $cType as $cix => $theType ) {
+        $cType[$cix] = $theType = strtolower( $theType );
+        if( !in_array( $theType, $validTypes ))
+          $cType[$cix] = 'vevent';
+      }
+      $cType = array_unique( $cType );
+    }
+    elseif( !empty( $cType )) {
+      $cType = strtolower( $cType );
+      if( !in_array( $cType, $validTypes ))
+        $cType = array( 'vevent' );
+      else
+        $cType = array( $cType );
+    }
+    else
+      $cType = $validTypes;
+    if( 0 >= count( $cType ))
+      $cType = $validTypes;
+    if(( TRUE === $flat ) && ( TRUE === $split )) // invalid combination
+      $split = FALSE;
+            /* iterate components */
+    $result = array();
+    foreach ( $this->components as $cix => $component ) {
+      if( empty( $component )) continue;
+      unset( $start );
+            /* deselect unvalid type components */
+      if( !in_array( $component->objName, $cType )) continue;
+      $start = $component->getProperty( 'dtstart' );
+            /* select due when dtstart is missing */
+      if( empty( $start ) && ( $component->objName == 'vtodo' ) && ( FALSE === ( $start = $component->getProperty( 'due' ))))
+        continue;
+      $dtendExist = $dueExist = $durationExist = $endAllDayEvent = FALSE;
+      unset( $end, $startWdate, $endWdate, $rdurWsecs, $rdur, $exdatelist, $workstart, $workend, $endDateFormat ); // clean up
+      $startWdate = iCalUtilityFunctions::_date2timestamp( $start );
+      $startDateFormat = ( isset( $start['hour'] )) ? 'Y-m-d H:i:s' : 'Y-m-d';
+            /* get end date from dtend/due/duration properties */
+      $end = $component->getProperty( 'dtend' );
+      if( !empty( $end )) {
+        $dtendExist = TRUE;
+        $endDateFormat = ( isset( $end['hour'] )) ? 'Y-m-d H:i:s' : 'Y-m-d';
+      }
+      if( empty( $end ) && ( $component->objName == 'vtodo' )) {
+        $end = $component->getProperty( 'due' );
+        if( !empty( $end )) {
+          $dueExist = TRUE;
+          $endDateFormat = ( isset( $end['hour'] )) ? 'Y-m-d H:i:s' : 'Y-m-d';
+        }
+      }
+      if( !empty( $end ) && !isset( $end['hour'] )) {
+          /* a DTEND without time part regards an event that ends the day before,
+             for an all-day event DTSTART=20071201 DTEND=20071202 (taking place 20071201!!! */
+        $endAllDayEvent = TRUE;
+        $endWdate = mktime( 23, 59, 59, $end['month'], ($end['day'] - 1), $end['year'] );
+        $end['year']  = date( 'Y', $endWdate );
+        $end['month'] = date( 'm', $endWdate );
+        $end['day']   = date( 'd', $endWdate );
+        $end['hour']  = 23;
+        $end['min']   = $end['sec'] = 59;
+      }
+      if( empty( $end )) {
+        $end = $component->getProperty( 'duration', FALSE, FALSE, TRUE );// in dtend (array) format
+        if( !empty( $end ))
+          $durationExist = TRUE;
+          $endDateFormat = ( isset( $start['hour'] )) ? 'Y-m-d H:i:s' : 'Y-m-d';
+// if( !empty($end))  echo 'selectComp 4 start='.implode('-',$start).' end='.implode('-',$end)."<br />\n"; // test ###
+      }
+      if( empty( $end )) { // assume one day duration if missing end date
+        $end = array( 'year' => $start['year'], 'month' => $start['month'], 'day' => $start['day'], 'hour' => 23, 'min' => 59, 'sec' => 59 );
+      }
+// if( isset($end))  echo 'selectComp 5 start='.implode('-',$start).' end='.implode('-',$end)."<br />\n"; // test ###
+      $endWdate = iCalUtilityFunctions::_date2timestamp( $end );
+      if( $endWdate < $startWdate ) { // MUST be after start date!!
+        $end = array( 'year' => $start['year'], 'month' => $start['month'], 'day' => $start['day'], 'hour' => 23, 'min' => 59, 'sec' => 59 );
+        $endWdate = iCalUtilityFunctions::_date2timestamp( $end );
+      }
+      $rdurWsecs  = $endWdate - $startWdate; // compute component duration in seconds
+            /* make a list of optional exclude dates for component occurence from exrule and exdate */
+      $exdatelist = array();
+      $workstart  = iCalUtilityFunctions::_timestamp2date(( $startDate - $rdurWsecs ), 6);
+      $workend    = iCalUtilityFunctions::_timestamp2date(( $endDate + $rdurWsecs ), 6);
+      while( FALSE !== ( $exrule = $component->getProperty( 'exrule' )))    // check exrule
+        iCalUtilityFunctions::_recur2date( $exdatelist, $exrule, $start, $workstart, $workend );
+      while( FALSE !== ( $exdate = $component->getProperty( 'exdate' ))) {  // check exdate
+        foreach( $exdate as $theExdate ) {
+          $exWdate = iCalUtilityFunctions::_date2timestamp( $theExdate );
+          $exWdate = mktime( 0, 0, 0, date( 'm', $exWdate ), date( 'd', $exWdate ), date( 'Y', $exWdate ) ); // on a day-basis !!!
+          if((( $startDate - $rdurWsecs ) <= $exWdate ) && ( $endDate >= $exWdate ))
+            $exdatelist[$exWdate] = TRUE;
+        }
+      }
+            /* if 'any' components, check repeating components, removing all excluding dates */
+      if( TRUE === $any ) {
+            /* make a list of optional repeating dates for component occurence, rrule, rdate */
+        $recurlist = array();
+        while( FALSE !== ( $rrule = $component->getProperty( 'rrule' )))    // check rrule
+          iCalUtilityFunctions::_recur2date( $recurlist, $rrule, $start, $workstart, $workend );
+        foreach( $recurlist as $recurkey => $recurvalue ) // key=match date as timestamp
+          $recurlist[$recurkey] = $rdurWsecs; // add duration in seconds
+        while( FALSE !== ( $rdate = $component->getProperty( 'rdate' ))) {  // check rdate
+          foreach( $rdate as $theRdate ) {
+            if( is_array( $theRdate ) && ( 2 == count( $theRdate )) &&  // all days within PERIOD
+                   array_key_exists( '0', $theRdate ) &&  array_key_exists( '1', $theRdate )) {
+              $rstart = iCalUtilityFunctions::_date2timestamp( $theRdate[0] );
+              if(( $rstart < ( $startDate - $rdurWsecs )) || ( $rstart > $endDate ))
+                continue;
+              if( isset( $theRdate[1]['year'] )) // date-date period
+                $rend = iCalUtilityFunctions::_date2timestamp( $theRdate[1] );
+              else {                             // date-duration period
+                $rend = iCalUtilityFunctions::_duration2date( $theRdate[0], $theRdate[1] );
+                $rend = iCalUtilityFunctions::_date2timestamp( $rend );
+              }
+              while( $rstart < $rend ) {
+                $recurlist[$rstart] = $rdurWsecs; // set start date for recurrence instance + rdate duration in seconds
+                $rstart = mktime( date( 'H', $rstart ), date( 'i', $rstart ), date( 's', $rstart ), date( 'm', $rstart ), date( 'd', $rstart ) + 1, date( 'Y', $rstart ) ); // step one day
+              }
+            } // PERIOD end
+            else { // single date
+              $theRdate = iCalUtilityFunctions::_date2timestamp( $theRdate );
+              if((( $startDate - $rdurWsecs ) <= $theRdate ) && ( $endDate >= $theRdate ))
+                $recurlist[$theRdate] = $rdurWsecs; // set start date for recurrence instance + event duration in seconds
+            }
+          }
+        }
+        if( 0 < count( $recurlist )) {
+          ksort( $recurlist );
+          $xRecurrence = 1;
+          foreach( $recurlist as $recurkey => $durvalue ) {
+// echo "recurKey=".date( 'Y-m-d H:i:s', $recurkey ).' dur='.iCalUtilityFunctions::offsetSec2His( $durvalue )."<br />\n"; // test ###;
+            if((( $startDate - $rdurWsecs ) > $recurkey ) || ( $endDate < $recurkey )) // not within period
+              continue;
+            $checkDate = mktime( 0, 0, 0, date( 'm', $recurkey ), date( 'd', $recurkey ), date( 'Y', $recurkey ) ); // on a day-basis !!!
+            if( isset( $exdatelist[$checkDate] )) // check excluded dates
+              continue;
+            if( $startWdate >= $recurkey ) // exclude component start date
+              continue;
+            $component2   = $component->copy();
+            $rstart = $recurkey;
+            $rend   = $recurkey + $durvalue;
+           /* add repeating components within valid dates to output array, only start date set */
+            if( $flat ) {
+              $datestring = date( $startDateFormat, $recurkey );
+              if( isset( $start['tz'] ))
+                $datestring .= ' '.$start['tz'];
+// echo "X-CURRENT-DTSTART 0 =$datestring tcnt =".++$tcnt."<br />";$component2->setProperty( 'X-CNT', $tcnt ); // test ###
+              $component2->setProperty( 'X-CURRENT-DTSTART', $datestring );
+              if( $dtendExist || $dueExist || $durationExist ) {
+                $datestring = date( $endDateFormat, $recurkey + $durvalue );   // fixa korrekt sluttid
+                if( isset( $end['tz'] ))
+                  $datestring .= ' '.$end['tz'];
+                $propName = ( !$dueExist ) ? 'X-CURRENT-DTEND' : 'X-CURRENT-DUE';
+                $component2->setProperty( $propName, $datestring );
+              } // end if( $dtendExist || $dueExist || $durationExist )
+              $component2->setProperty( 'X-RECURRENCE', ++$xRecurrence );
+              $result[$component2->getProperty( 'UID' )] = $component2->copy(); // copy to output
+            }
+           /* add repeating components within valid dates to output array, one each day */
+            elseif( $split ) {
+              if( $rend > $endDate )
+                $rend = $endDate;
+              $startYMD = date( 'Ymd', $rstart );
+              $endYMD   = date( 'Ymd', $rend );
+// echo "splitStart=".date( 'Y-m-d H:i:s', $rstart ).' end='.date( 'Y-m-d H:i:s', $rend )."<br />\n"; // test ###;
+              while( $rstart <= $rend ) { // iterate.. .
+                $checkDate = mktime( 0, 0, 0, date( 'm', $rstart ), date( 'd', $rstart ), date( 'Y', $rstart ) ); // on a day-basis !!!
+                if( isset( $exdatelist[$checkDate] ))  // exclude any recurrence START date, found in exdatelist
+                  break;
+// echo "checking date after startdate=".date( 'Y-m-d H:i:s', $rstart ).' mot '.date( 'Y-m-d H:i:s', $startDate )."<br />"; // test ###;
+                if( $rstart >= $startDate ) {    // date after dtstart
+                  if( date( 'Ymd', $rstart ) > $startYMD ) // date after dtstart
+                    $datestring = date( $startDateFormat, $checkDate );
+                  else
+                    $datestring = date( $startDateFormat, $rstart );
+                  if( isset( $start['tz'] ))
+                    $datestring .= ' '.$start['tz'];
+//echo "X-CURRENT-DTSTART 1 = $datestring xRecurrence=$xRecurrence tcnt =".++$tcnt."<br />";$component2->setProperty( 'X-CNT', $tcnt ); // test ###
+                  $component2->setProperty( 'X-CURRENT-DTSTART', $datestring );
+                  if( $dtendExist || $dueExist || $durationExist ) {
+                    if( date( 'Ymd', $rstart ) < $endYMD ) // not the last day
+                      $tend = mktime( 23, 59, 59, date( 'm', $rstart ), date( 'd', $rstart ), date( 'Y', $rstart ));
+                    else
+                      $tend = mktime( date( 'H', $endWdate ), date( 'i', $endWdate ), date( 's', $endWdate ), date( 'm', $rstart ), date( 'd', $rstart ), date( 'Y', $rstart ) ); // on a day-basis !!!
+                    $datestring = date( $endDateFormat, $tend );
+                    if( isset( $end['tz'] ))
+                      $datestring .= ' '.$end['tz'];
+                    $propName = ( !$dueExist ) ? 'X-CURRENT-DTEND' : 'X-CURRENT-DUE';
+                    $component2->setProperty( $propName, $datestring );
+                  } // end if( $dtendExist || $dueExist || $durationExist )
+                  $component2->setProperty( 'X-RECURRENCE', $xRecurrence );
+                  $wd = getdate( $rstart );
+                  $result[$wd['year']][$wd['mon']][$wd['mday']][$component2->getProperty( 'UID' )] = $component2->copy(); // copy to output
+                } // end if( $checkDate > $startYMD ) {    // date after dtstart
+                $rstart = mktime( date( 'H', $rstart ), date( 'i', $rstart ), date( 's', $rstart ), date( 'm', $rstart ), date( 'd', $rstart ) + 1, date( 'Y', $rstart ) ); // step one day
+              } // end while( $rstart <= $rend )
+              $xRecurrence += 1;
+            } // end elseif( $split )
+            elseif( $rstart >= $startDate ) {     // date within period   //* flat=FALSE && split=FALSE *//
+              $checkDate = mktime( 0, 0, 0, date( 'm', $rstart ), date( 'd', $rstart ), date( 'Y', $rstart ) ); // on a day-basis !!!
+              if( !isset( $exdatelist[$checkDate] )) { // exclude any recurrence START date, found in exdatelist
+                $xRecurrence += 1;
+                $datestring = date( $startDateFormat, $rstart );
+                if( isset( $start['tz'] ))
+                  $datestring .= ' '.$start['tz'];
+//echo "X-CURRENT-DTSTART 2 = $datestring xRecurrence=$xRecurrence tcnt =".++$tcnt."<br />";$component2->setProperty( 'X-CNT', $tcnt ); // test ###
+                $component2->setProperty( 'X-CURRENT-DTSTART', $datestring );
+                if( $dtendExist || $dueExist || $durationExist ) {
+                  $rstart += $rdurWsecs;
+                  if( date( 'Ymd', $rstart ) < date( 'Ymd', $endWdate ))
+                    $tend = mktime( 23, 59, 59, date( 'm', $rstart ), date( 'd', $rstart ), date( 'Y', $rstart ));
+                  else
+                    $tend = mktime( date( 'H', $endWdate ), date( 'i', $endWdate ), date( 's', $endWdate ), date( 'm', $rstart ), date( 'd', $rstart ), date( 'Y', $rstart ) ); // on a day-basis !!!
+                  $datestring = date( $endDateFormat, $tend );
+                  if( isset( $end['tz'] ))
+                    $datestring .= ' '.$end['tz'];
+                  $propName = ( !$dueExist ) ? 'X-CURRENT-DTEND' : 'X-CURRENT-DUE';
+                  $component2->setProperty( $propName, $datestring );
+                } // end if( $dtendExist || $dueExist || $durationExist )
+                $component2->setProperty( 'X-RECURRENCE', $xRecurrence );
+                $wd = getdate( $rstart );
+                $result[$wd['year']][$wd['mon']][$wd['mday']][$component2->getProperty( 'UID' )] = $component2->copy(); // copy to output
+              } // end if( !isset( $exdatelist[$checkDate] ))
+            } // end elseif( $rstart >= $startDate )
+          } // end foreach( $recurlist as $recurkey => $durvalue )
+        } // end if( 0 < count( $recurlist ))
+            /* deselect components with startdate/enddate not within period */
+        if(( $endWdate < $startDate ) || ( $startWdate > $endDate ))
+          continue;
+      } // end if( TRUE === $any )
+            /* deselect components with startdate not within period */
+      elseif(( $startWdate < $startDate ) || ( $startWdate > $endDate ))
+        continue;
+            /* add the selected component (WITHIN valid dates) to output array */
+      if( $flat )
+        $result[$component->getProperty( 'UID' )] = $component->copy(); // copy to output;
+      elseif( $split ) { // split the original component
+        if( $endWdate > $endDate )
+          $endWdate = $endDate;     // use period end date
+        $rstart = $startWdate;
+        if( $rstart < $startDate )
+          $rstart = $startDate; // use period start date
+        $checkDate = mktime( 0, 0, 0, date( 'm', $rstart ), date( 'd', $rstart ), date( 'Y', $rstart ) ); // on a day-basis !!!
+        if( !isset( $exdatelist[$checkDate] )) { // exclude any recurrence START date, found in exdatelist
+          foreach( array( 'X-CURRENT-DTSTART','X-CURRENT-DTEND','X-CURRENT-DUE','X-RECURRENCE' ) as $propName )
+            $component->deleteProperty( $propName ); // remove any x-props, if set
+          while( $rstart <= $endWdate ) { // iterate
+            if( $rstart > $startWdate ) { // if NOT startdate, set X-properties
+              $datestring = date( $startDateFormat, mktime( 0, 0, 0, date( 'm', $rstart ), date( 'd', $rstart ), date( 'Y', $rstart )));
+              if( isset( $start['tz'] ))
+                $datestring .= ' '.$start['tz'];
+// echo "X-CURRENT-DTSTART 3 = $datestring xRecurrence=$xRecurrence tcnt =".++$tcnt."<br />";$component->setProperty( 'X-CNT', $tcnt ); // test ###
+              $component->setProperty( 'X-CURRENT-DTSTART', $datestring );
+              if( $dtendExist || $dueExist || $durationExist ) {
+                if( date( 'Ymd', $rstart ) < date( 'Ymd', $endWdate ))
+                  $tend = mktime( 0, 0, 0, date( 'm', $rstart ), date( 'd', $rstart ), date( 'Y', $rstart ));
+                else
+                  $tend = mktime( date( 'H', $endWdate ), date( 'i', $endWdate ), date( 's', $endWdate ), date( 'm', $rstart ), date( 'd', $rstart ), date( 'Y', $rstart ) ); // on a day-basis !!!
+                $datestring = date( $endDateFormat, $tend );
+                if( isset( $end['tz'] ))
+                  $datestring .= ' '.$end['tz'];
+                $propName = ( !$dueExist ) ? 'X-CURRENT-DTEND' : 'X-CURRENT-DUE';
+                $component->setProperty( $propName, $datestring );
+              } // end if( $dtendExist || $dueExist || $durationExist )
+            } // end if( $rstart > $startWdate )
+            $wd = getdate( $rstart );
+            $result[$wd['year']][$wd['mon']][$wd['mday']][$component->getProperty( 'UID' )] = $component->copy(); // copy to output
+            $rstart = mktime( date( 'H', $rstart ), date( 'i', $rstart ), date( 's', $rstart ), date( 'm', $rstart ), date( 'd', $rstart ) + 1, date( 'Y', $rstart ) ); // step one day
+          } // end while( $rstart <= $endWdate )
+        } // end if( !isset( $exdatelist[$checkDate] ))
+      } // end if( $split )   -  else use component date
+      elseif( $startWdate >= $startDate ) {          // within period
+        $checkDate = mktime( 0, 0, 0, date( 'm', $startWdate ), date( 'd', $startWdate ), date( 'Y', $startWdate ) ); // on a day-basis !!!
+        if( !isset( $exdatelist[$checkDate] )) { // exclude any recurrence START date, found in exdatelist
+          foreach( array( 'X-CURRENT-DTSTART','X-CURRENT-DTEND','X-CURRENT-DUE','X-RECURRENCE' ) as $propName )
+            $component->deleteProperty( $propName ); // remove any x-props, if set
+          $wd = getdate( $startWdate );
+          $result[$wd['year']][$wd['mon']][$wd['mday']][$component->getProperty( 'UID' )] = $component->copy(); // copy to output
+        }
+      }
+    } // end foreach ( $this->components as $cix => $component )
+    if( 0 >= count( $result )) return FALSE;
+    elseif( !$flat ) {
+      foreach( $result as $y => $yeararr ) {
+        foreach( $yeararr as $m => $montharr ) {
+          foreach( $montharr as $d => $dayarr )
+            $result[$y][$m][$d] = array_values( $dayarr ); // skip tricky UID-index
+          ksort( $result[$y][$m] );
+        }
+        ksort( $result[$y] );
+      }
+      ksort( $result );
+    } // end elseif( !$flat )
+    return $result;
+  }
+/**
+ * select components from calendar on based on Categories, Location, Resources and/or Summary
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.8.8 - 2011-05-03
+ * @param array $selectOptions, (string) key => (mixed) value, (key=propertyName)
+ * @return array
+ */
+  function selectComponents2( $selectOptions ) {
+    $output = array();
+    $allowedProperties = array( 'ATTENDEE', 'CATEGORIES', 'LOCATION', 'ORGANIZER', 'RESOURCES', 'PRIORITY', 'STATUS', 'SUMMARY', 'UID' );
+    foreach( $this->components as $cix => $component3 ) {
+      if( !in_array( $component3->objName, array('vevent', 'vtodo', 'vjournal', 'vfreebusy' )))
+        continue;
+      $uid = $component3->getProperty( 'UID' );
+      foreach( $selectOptions as $propName => $pvalue ) {
+        $propName = strtoupper( $propName );
+        if( !in_array( $propName, $allowedProperties ))
+          continue;
+        if( !is_array( $pvalue ))
+          $pvalue = array( $pvalue );
+        if(( 'UID' == $propName ) && in_array( $uid, $pvalue )) {
+          $output[] = $component3->copy();
+          continue;
+        }
+        elseif(( 'ATTENDEE' == $propName ) || ( 'CATEGORIES' == $propName ) || ( 'RESOURCES' == $propName )) {
+          $propValues = array();
+          $component3->_getProperties( $propName, $propValues );
+          $propValues = array_keys( $propValues );
+          foreach( $pvalue as $theValue ) {
+            if( in_array( $theValue, $propValues ) && !isset( $output[$uid] )) {
+              $output[$uid] = $component3->copy();
+              break;
+            }
+          }
+          continue;
+        } // end   elseif(( 'ATTENDEE' == $propName ) || ( 'CATEGORIES' == $propName ) || ( 'RESOURCES' == $propName ))
+        elseif( FALSE === ( $d = $component3->getProperty( $propName ))) // single ocurrence
+          continue;
+        if( is_array( $d )) {
+          foreach( $d as $part ) {
+            if( in_array( $part, $pvalue ) && !isset( $output[$uid] ))
+              $output[$uid] = $component3->copy();
+          }
+        }
+        elseif(( 'SUMMARY' == $propName ) && !isset( $output[$uid] )) {
+          foreach( $pvalue as $pval ) {
+            if( FALSE !== stripos( $d, $pval )) {
+              $output[$uid] = $component3->copy();
+              break;
+            }
+          }
+        }
+        elseif( in_array( $d, $pvalue ) && !isset( $output[$uid] ))
+          $output[$uid] = $component3->copy();
+      } // end foreach( $selectOptions as $propName => $pvalue ) {
+    } // end foreach( $this->components as $cix => $component3 ) {
+    if( !empty( $output )) {
+      ksort( $output );
+      $output = array_values( $output );
+    }
+    return $output;
+  }
+/**
+ * add calendar component to container
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.8.8 - 2011-03-15
+ * @param object $component calendar component
+ * @param mixed $arg1 optional, ordno/component type/ component uid
+ * @param mixed $arg2 optional, ordno if arg1 = component type
+ * @return void
+ */
+  function setComponent( $component, $arg1=FALSE, $arg2=FALSE  ) {
+    $component->setConfig( $this->getConfig(), FALSE, TRUE );
+    if( !in_array( $component->objName, array( 'valarm', 'vtimezone' ))) {
+            /* make sure dtstamp and uid is set */
+      $dummy1 = $component->getProperty( 'dtstamp' );
+      $dummy2 = $component->getProperty( 'uid' );
+    }
+    if( !$arg1 ) { // plain insert, last in chain
+      $this->components[] = $component->copy();
+      return TRUE;
+    }
+    $argType = $index = null;
+    if ( ctype_digit( (string) $arg1 )) { // index insert/replace
+      $argType = 'INDEX';
+      $index   = (int) $arg1 - 1;
+    }
+    elseif( in_array( strtolower( $arg1 ), array( 'vevent', 'vtodo', 'vjournal', 'vfreebusy', 'valarm', 'vtimezone' ))) {
+      $argType = strtolower( $arg1 );
+      $index = ( ctype_digit( (string) $arg2 )) ? ((int) $arg2) - 1 : 0;
+    }
+    // else if arg1 is set, arg1 must be an UID
+    $cix1sC = 0;
+    foreach ( $this->components as $cix => $component2) {
+      if( empty( $component2 )) continue;
+      if(( 'INDEX' == $argType ) && ( $index == $cix )) { // index insert/replace
+        $this->components[$cix] = $component->copy();
+        return TRUE;
+      }
+      elseif( $argType == $component2->objName ) { // component Type index insert/replace
+        if( $index == $cix1sC ) {
+          $this->components[$cix] = $component->copy();
+          return TRUE;
+        }
+        $cix1sC++;
+      }
+      elseif( !$argType && ( $arg1 == $component2->getProperty( 'uid' ))) { // UID insert/replace
+        $this->components[$cix] = $component->copy();
+        return TRUE;
+      }
+    }
+            /* arg1=index and not found.. . insert at index .. .*/
+    if( 'INDEX' == $argType ) {
+      $this->components[$index] = $component->copy();
+      ksort( $this->components, SORT_NUMERIC );
+    }
+    else    /* not found.. . insert last in chain anyway .. .*/
+      $this->components[] = $component->copy();
+    return TRUE;
+  }
+/**
+ * sort iCal compoments
+ *
+ * ascending sort on properties (if exist) x-current-dtstart, dtstart,
+ * x-current-dtend, dtend, x-current-due, due, duration, created, dtstamp, uid
+ * if no arguments, otherwise sorting on argument CATEGORIES, LOCATION, SUMMARY or RESOURCES
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.8.4 - 2011-06-02
+ * @param string $sortArg, optional
+ * @return void
+ *
+ */
+  function sort( $sortArg=FALSE ) {
+    if( is_array( $this->components )) {
+      if( $sortArg ) {
+        $sortArg = strtoupper( $sortArg );
+        if( !in_array( $sortArg, array( 'ATTENDEE', 'CATEGORIES', 'DTSTAMP', 'LOCATION', 'ORGANIZER', 'RESOURCES', 'PRIORITY', 'STATUS', 'SUMMARY' )))
+          $sortArg = FALSE;
+      }
+            /* set sort parameters for each component */
+      foreach( $this->components as $cix => & $c ) {
+        $c->srtk = array( '0', '0', '0', '0' );
+        if( 'vtimezone' == $c->objName ) {
+          if( FALSE === ( $c->srtk[0] = $c->getProperty( 'tzid' )))
+            $c->srtk[0] = 0;
+          continue;
+        }
+        elseif( $sortArg ) {
+          if(( 'ATTENDEE' == $sortArg ) || ( 'CATEGORIES' == $sortArg ) || ( 'RESOURCES'  == $sortArg )) {
+            $propValues = array();
+            $c->_getProperties( $sortArg, $propValues );
+            $c->srtk[0] = reset( array_keys( $propValues ));
+          }
+          elseif( FALSE !== ( $d = $c->getProperty( $sortArg )))
+            $c->srtk[0] = $d;
+          continue;
+        }
+        if( FALSE !== ( $d = $c->getProperty( 'X-CURRENT-DTSTART' )))
+          $c->srtk[0] = iCalUtilityFunctions::_date_time_string( $d[1] );
+        elseif( FALSE === ( $c->srtk[0] = $c->getProperty( 'dtstart' )))
+          $c->srtk[1] = 0;                                                  // sortkey 0 : dtstart
+        if( FALSE !== ( $d = $c->getProperty( 'X-CURRENT-DTEND' )))
+          $c->srtk[1] = iCalUtilityFunctions::_date_time_string( $d[1] );   // sortkey 1 : dtend/due(/dtstart+duration)
+        elseif( FALSE === ( $c->srtk[1] = $c->getProperty( 'dtend' ))) {
+          if( FALSE !== ( $d = $c->getProperty( 'X-CURRENT-DUE' )))
+            $c->srtk[1] = iCalUtilityFunctions::_date_time_string( $d[1] );
+          elseif( FALSE === ( $c->srtk[1] = $c->getProperty( 'due' )))
+            if( FALSE === ( $c->srtk[1] = $c->getProperty( 'duration', FALSE, FALSE, TRUE )))
+              $c->srtk[1] = 0;
+        }
+        if( FALSE === ( $c->srtk[2] = $c->getProperty( 'created' )))      // sortkey 2 : created/dtstamp
+          if( FALSE === ( $c->srtk[2] = $c->getProperty( 'dtstamp' )))
+            $c->srtk[2] = 0;
+        if( FALSE === ( $c->srtk[3] = $c->getProperty( 'uid' )))          // sortkey 3 : uid
+          $c->srtk[3] = 0;
+      } // end foreach( $this->components as & $c
+            /* sort */
+      usort( $this->components, array( $this, '_cmpfcn' ));
+    }
+  }
+  function _cmpfcn( $a, $b ) {
+    if(        empty( $a ))                       return -1;
+    if(        empty( $b ))                       return  1;
+    if( 'vtimezone' == $a->objName ) {
+      if( 'vtimezone' != $b->objName )            return -1;
+      elseif( $a->srtk[0] <= $b->srtk[0] )        return -1;
+      else                                        return  1;
+    }
+    elseif( 'vtimezone' == $b->objName )          return  1;
+    $sortkeys = array( 'year', 'month', 'day', 'hour', 'min', 'sec' );
+    for( $k = 0; $k < 4 ; $k++ ) {
+      if(        empty( $a->srtk[$k] ))           return -1;
+      elseif(    empty( $b->srtk[$k] ))           return  1;
+      if( is_array( $a->srtk[$k] )) {
+        if( is_array( $b->srtk[$k] )) {
+          foreach( $sortkeys as $key ) {
+            if    (  empty( $a->srtk[$k][$key] )) return -1;
+            elseif(  empty( $b->srtk[$k][$key] )) return  1;
+            if    (         $a->srtk[$k][$key] == $b->srtk[$k][$key])
+                                                  continue;
+            if    ((  (int) $a->srtk[$k][$key] ) < ((int) $b->srtk[$k][$key] ))
+                                                  return -1;
+            elseif((  (int) $a->srtk[$k][$key] ) > ((int) $b->srtk[$k][$key] ))
+                                                  return  1;
+          }
+        }
+        else                                      return -1;
+      }
+      elseif( is_array( $b->srtk[$k] ))           return  1;
+      elseif( $a->srtk[$k] < $b->srtk[$k] )       return -1;
+      elseif( $a->srtk[$k] > $b->srtk[$k] )       return  1;
+    }
+    return 0;
+  }
+/**
+ * parse iCal text/file into vcalendar, components, properties and parameters
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.8.2 - 2011-05-21
+ * @param mixed $unparsedtext, optional, strict rfc2445 formatted, single property string or array of property strings
+ * @return bool FALSE if error occurs during parsing
+ *
+ */
+  function parse( $unparsedtext=FALSE ) {
+    $nl = $this->getConfig( 'nl' );
+    if(( FALSE === $unparsedtext ) || empty( $unparsedtext )) {
+            /* directory+filename is set previously via setConfig directory+filename or url */
+      if( FALSE === ( $filename = $this->getConfig( 'url' )))
+        $filename = $this->getConfig( 'dirfile' );
+            /* READ FILE */
+      if( FALSE === ( $rows = file_get_contents( $filename )))
+        return FALSE;                 /* err 1 */
+    }
+    elseif( is_array( $unparsedtext ))
+      $rows =  implode( '\n'.$nl, $unparsedtext );
+    else
+      $rows = & $unparsedtext;
+            /* identify BEGIN:VCALENDAR, MUST be first row */
+    if( 'BEGIN:VCALENDAR' != strtoupper( substr( $rows, 0, 15 )))
+      return FALSE;                   /* err 8 */
+            /* fix line folding */
+    $eolchars = array( "\r\n", "\n\r", "\n", "\r" ); // check all line endings
+    $EOLmark = FALSE;
+    foreach( $eolchars as $eolchar ) {
+      if( !$EOLmark  && ( FALSE !== strpos( $rows, $eolchar ))) {
+        $rows = str_replace( $eolchar." ",  '',  $rows );
+        $rows = str_replace( $eolchar."\t", '',  $rows );
+        if( $eolchar != $nl )
+          $rows = str_replace( $eolchar,    $nl, $rows );
+        $EOLmark = TRUE;
+      }
+    }
+    $tmp = explode( $nl, $rows );
+    $rows = array();
+    foreach( $tmp as $tmpr )
+      if( !empty( $tmpr ))
+        $rows[] = $tmpr;
+            /* skip trailing empty lines */
+    $lix = count( $rows ) - 1;
+    while( empty( $rows[$lix] ) && ( 0 < $lix ))
+      $lix -= 1;
+            /* identify ending END:VCALENDAR row, MUST  be last row */
+    if( 'END:VCALENDAR'   != strtoupper( substr( $rows[$lix], 0, 13 )))
+      return FALSE;                   /* err 9 */
+    if( 3 > count( $rows ))
+      return FALSE;                   /* err 10 */
+    $comp    = & $this;
+    $calsync = 0;
+            /* identify components and update unparsed data within component */
+    $config = $this->getConfig();
+    foreach( $rows as $line ) {
+      if( '' == trim( $line ))
+        continue;
+      if(     'BEGIN:VCALENDAR' == strtoupper( substr( $line, 0, 15 ))) {
+        $calsync++;
+        continue;
+      }
+      elseif( 'END:VCALENDAR'   == strtoupper( substr( $line, 0, 13 ))) {
+        $calsync--;
+        break;
+      }
+      elseif( 1 != $calsync )
+        return FALSE;                 /* err 20 */
+      elseif( in_array( strtoupper( substr( $line, 0, 6 )), array( 'END:VE', 'END:VF', 'END:VJ', 'END:VT' ))) {
+        $this->components[] = $comp->copy();
+        continue;
+      }
+
+      if(     'BEGIN:VEVENT'    == strtoupper( substr( $line, 0, 12 )))
+        $comp = new vevent( $config );
+      elseif( 'BEGIN:VFREEBUSY' == strtoupper( substr( $line, 0, 15 )))
+        $comp = new vfreebusy( $config );
+      elseif( 'BEGIN:VJOURNAL'  == strtoupper( substr( $line, 0, 14 )))
+        $comp = new vjournal( $config );
+      elseif( 'BEGIN:VTODO'     == strtoupper( substr( $line, 0, 11 )))
+        $comp = new vtodo( $config );
+      elseif( 'BEGIN:VTIMEZONE' == strtoupper( substr( $line, 0, 15 )))
+        $comp = new vtimezone( $config );
+      else  /* update component with unparsed data */
+        $comp->unparsed[] = $line;
+    } // end - foreach( rows.. .
+    unset( $config );
+            /* parse data for calendar (this) object */
+    if( isset( $this->unparsed ) && is_array( $this->unparsed ) && ( 0 < count( $this->unparsed ))) {
+            /* concatenate property values spread over several lines */
+      $lastix    = -1;
+      $propnames = array( 'calscale','method','prodid','version','x-' );
+      $proprows  = array();
+      foreach( $this->unparsed as $line ) {
+        if( '' == trim( $line ))
+          continue;
+        $newProp = FALSE;
+        foreach ( $propnames as $propname ) {
+          if( $propname == strtolower( substr( $line, 0, strlen( $propname )))) {
+            $newProp = TRUE;
+            break;
+          }
+        }
+        if( $newProp ) {
+          $newProp = FALSE;
+          $lastix++;
+          $proprows[$lastix]  = $line;
+        }
+        else
+          $proprows[$lastix] .= '!"#Â€%&/()=?'.$line;
+      }
+      foreach( $proprows as $line ) {
+        $line = str_replace( '!"#Â€%&/()=? ', '', $line );
+        $line = str_replace( '!"#Â€%&/()=?', '', $line );
+        if( '\n' == substr( $line, -2 ))
+          $line = substr( $line, 0, strlen( $line ) - 2 );
+            /* get property name */
+        $cix = $propname = null;
+        for( $cix=0, $clen = strlen( $line ); $cix < $clen; $cix++ ) {
+          if( in_array( $line[$cix], array( ':', ';' )))
+            break;
+          else
+            $propname .= $line[$cix];
+        }
+            /* ignore version/prodid properties */
+        if( in_array( strtoupper( $propname ), array( 'VERSION', 'PRODID' )))
+          continue;
+        $line = substr( $line, $cix);
+            /* separate attributes from value */
+        $attr   = array();
+        $attrix = -1;
+        $strlen = strlen( $line );
+        for( $cix=0; $cix < $strlen; $cix++ ) {
+          if((       ':'   == $line[$cix] )             &&
+                   ( '://' != substr( $line, $cix, 3 )) &&
+             ( !in_array( strtolower( substr( $line, $cix - 3, 4 )), array( 'fax:', 'cid:', 'sms:', 'tel:', 'urn:' ))) &&
+             ( !in_array( strtolower( substr( $line, $cix - 4, 5 )), array( 'crid:', 'news:', 'pres:' ))) &&
+             ( 'mailto:'   != strtolower( substr( $line, $cix - 6, 7 )))) {
+            $attrEnd = TRUE;
+            if(( $cix < ( $strlen - 4 )) &&
+                 ctype_digit( substr( $line, $cix+1, 4 ))) { // an URI with a (4pos) portnr??
+              for( $c2ix = $cix; 3 < $c2ix; $c2ix-- ) {
+                if( '://' == substr( $line, $c2ix - 2, 3 )) {
+                  $attrEnd = FALSE;
+                  break; // an URI with a portnr!!
+                }
+              }
+            }
+            if( $attrEnd) {
+              $line = substr( $line, $cix + 1 );
+              break;
+            }
+          }
+          if( ';' == $line[$cix] )
+            $attr[++$attrix] = null;
+          else
+            $attr[$attrix] .= $line[$cix];
+        }
+
+            /* make attributes in array format */
+        $propattr = array();
+        foreach( $attr as $attribute ) {
+          $attrsplit = explode( '=', $attribute, 2 );
+          if( 1 < count( $attrsplit ))
+            $propattr[$attrsplit[0]] = $attrsplit[1];
+          else
+            $propattr[] = $attribute;
+        }
+            /* update Property */
+        if( FALSE !== strpos( $line, ',' )) {
+          $content  = explode( ',', $line );
+          $clen     = count( $content );
+          for( $cix = 0; $cix < $clen; $cix++ ) {
+            if( "\\" == substr( $content[$cix], -1 )) {
+              $content[$cix] .= ','.$content[$cix + 1];
+              unset( $content[$cix + 1] );
+              $cix++;
+            }
+          }
+          if( 1 < count( $content )) {
+            foreach( $content as $cix => $contentPart )
+              $content[$cix] = calendarComponent::_strunrep( $contentPart );
+            $this->setProperty( $propname, $content, $propattr );
+            continue;
+          }
+          else
+            $line = reset( $content );
+          $line = calendarComponent::_strunrep( $line );
+        }
+        $this->setProperty( $propname, trim( $line ), $propattr );
+      } // end - foreach( $this->unparsed.. .
+    } // end - if( is_array( $this->unparsed.. .
+    unset( $unparsedtext, $rows, $this->unparsed, $proprows );
+            /* parse Components */
+    if( is_array( $this->components ) && ( 0 < count( $this->components ))) {
+      $ckeys = array_keys( $this->components );
+      foreach( $ckeys as $ckey ) {
+        if( !empty( $this->components[$ckey] ) && !empty( $this->components[$ckey]->unparsed )) {
+          $this->components[$ckey]->parse();
+        }
+      }
+    }
+    else
+      return FALSE;                   /* err 91 or something.. . */
+    return TRUE;
+  }
+/*********************************************************************************/
+/**
+ * creates formatted output for calendar object instance
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.8.1 - 2011-03-12
+ * @return string
+ */
+  function createCalendar() {
+    $calendarInit1 = $calendarInit2 = $calendarxCaldecl = $calendarStart = $calendar = null;
+    switch( $this->format ) {
+      case 'xcal':
+        $calendarInit1 = '<?xml version="1.0" encoding="UTF-8"?>'.$this->nl.
+                         '<!DOCTYPE iCalendar PUBLIC "-//IETF//DTD XCAL/iCalendar XML//EN"'.$this->nl.
+                         '"http://www.ietf.org/internet-drafts/draft-ietf-calsch-many-xcal-01.txt"';
+        $calendarInit2 = '>'.$this->nl;
+        $calendarStart = '<vcalendar';
+        break;
+      default:
+        $calendarStart = 'BEGIN:VCALENDAR'.$this->nl;
+        break;
+    }
+    $calendarStart .= $this->createVersion();
+    $calendarStart .= $this->createProdid();
+    $calendarStart .= $this->createCalscale();
+    $calendarStart .= $this->createMethod();
+    switch( $this->format ) {
+      case 'xcal':
+        $nlstrlen = strlen( $this->nl );
+        if( $this->nl == substr( $calendarStart, ( 0 - $nlstrlen )))
+          $calendarStart = substr( $calendarStart, 0, ( strlen( $calendarStart ) - $nlstrlen ));
+        $calendarStart .= '>'.$this->nl;
+        break;
+      default:
+        break;
+    }
+    $calendar .= $this->createXprop();
+    foreach( $this->components as $component ) {
+      if( empty( $component )) continue;
+      $component->setConfig( $this->getConfig(), FALSE, TRUE );
+      $calendar .= $component->createComponent( $this->xcaldecl );
+    }
+    if(( 0 < count( $this->xcaldecl )) && ( 'xcal' == $this->format )) { // xCal only
+      $calendarInit1 .= $this->nl.'['.$this->nl;
+      $old_xcaldecl = array();
+      foreach( $this->xcaldecl as $declix => $declPart ) {
+        if(( 0 < count( $old_xcaldecl)) &&
+           ( in_array( $declPart['uri'],      $old_xcaldecl['uri'] )) &&
+           ( in_array( $declPart['external'], $old_xcaldecl['external'] )))
+          continue; // no duplicate uri and ext. references
+        $calendarxCaldecl .= '<!';
+        foreach( $declPart as $declKey => $declValue ) {
+          switch( $declKey ) {                    // index
+            case 'xmldecl':                       // no 1
+              $calendarxCaldecl .= $declValue.' ';
+              break;
+            case 'uri':                           // no 2
+              $calendarxCaldecl .= $declValue.' ';
+              $old_xcaldecl['uri'][] = $declValue;
+              break;
+            case 'ref':                           // no 3
+              $calendarxCaldecl .= $declValue.' ';
+              break;
+            case 'external':                      // no 4
+              $calendarxCaldecl .= '"'.$declValue.'" ';
+              $old_xcaldecl['external'][] = $declValue;
+              break;
+            case 'type':                          // no 5
+              $calendarxCaldecl .= $declValue.' ';
+              break;
+            case 'type2':                         // no 6
+              $calendarxCaldecl .= $declValue;
+              break;
+          }
+        }
+        $calendarxCaldecl .= '>'.$this->nl;
+      }
+      $calendarInit2 = ']'.$calendarInit2;
+    }
+    switch( $this->format ) {
+      case 'xcal':
+        $calendar .= '</vcalendar>'.$this->nl;
+        break;
+      default:
+        $calendar .= 'END:VCALENDAR'.$this->nl;
+        break;
+    }
+    return $calendarInit1.$calendarxCaldecl.$calendarInit2.$calendarStart.$calendar;
+  }
+/**
+ * a HTTP redirect header is sent with created, updated and/or parsed calendar
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.9.12 - 2011-07-13
+ * @param bool $utf8Encode
+ * @param bool $gzip
+ * @return redirect
+ */
+  function returnCalendar( $utf8Encode=FALSE, $gzip=FALSE ) {
+    $filename = $this->getConfig( 'filename' );
+    $output   = $this->createCalendar();
+    if( $utf8Encode )
+      $output = utf8_encode( $output );
+    if( $gzip ) {
+      $output = gzencode( $output, 9 );
+      header( 'Content-Encoding: gzip');
+      header( 'Vary: *');
+    }
+    $filesize = strlen( $output );
+    if( 'xcal' == $this->format )
+      header( 'Content-Type: application/calendar+xml; charset=utf-8' );
+    else
+      header( 'Content-Type: text/calendar; charset=utf-8' );
+    header( 'Content-Length: '.$filesize );
+    header( 'Content-Disposition: attachment; filename="'.$filename.'"' );
+    header( 'Cache-Control: max-age=10' );
+    echo $output;
+    die();
+  }
+/**
+ * save content in a file
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.2.12 - 2007-12-30
+ * @param string $directory optional
+ * @param string $filename optional
+ * @param string $delimiter optional
+ * @return bool
+ */
+  function saveCalendar( $directory=FALSE, $filename=FALSE, $delimiter=FALSE ) {
+    if( $directory )
+      $this->setConfig( 'directory', $directory );
+    if( $filename )
+      $this->setConfig( 'filename',  $filename );
+    if( $delimiter && ($delimiter != DIRECTORY_SEPARATOR ))
+      $this->setConfig( 'delimiter', $delimiter );
+    if( FALSE === ( $dirfile = $this->getConfig( 'url' )))
+      $dirfile = $this->getConfig( 'dirfile' );
+    $iCalFile = @fopen( $dirfile, 'w' );
+    if( $iCalFile ) {
+      if( FALSE === fwrite( $iCalFile, $this->createCalendar() ))
+        return FALSE;
+      fclose( $iCalFile );
+      return TRUE;
+    }
+    else
+      return FALSE;
+  }
+/**
+ * if recent version of calendar file exists (default one hour), an HTTP redirect header is sent
+ * else FALSE is returned
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.2.12 - 2007-10-28
+ * @param string $directory optional alt. int timeout
+ * @param string $filename optional
+ * @param string $delimiter optional
+ * @param int timeout optional, default 3600 sec
+ * @return redirect/FALSE
+ */
+  function useCachedCalendar( $directory=FALSE, $filename=FALSE, $delimiter=FALSE, $timeout=3600) {
+    if ( $directory && ctype_digit( (string) $directory ) && !$filename ) {
+      $timeout   = (int) $directory;
+      $directory = FALSE;
+    }
+    if( $directory )
+      $this->setConfig( 'directory', $directory );
+    if( $filename )
+      $this->setConfig( 'filename',  $filename );
+    if( $delimiter && ( $delimiter != DIRECTORY_SEPARATOR ))
+      $this->setConfig( 'delimiter', $delimiter );
+    $filesize    = $this->getConfig( 'filesize' );
+    if( 0 >= $filesize )
+      return FALSE;
+    $dirfile     = $this->getConfig( 'dirfile' );
+    if( time() - filemtime( $dirfile ) < $timeout) {
+      clearstatcache();
+      $dirfile   = $this->getConfig( 'dirfile' );
+      $filename  = $this->getConfig( 'filename' );
+//    if( headers_sent( $filename, $linenum ))
+//      die( "Headers already sent in $filename on line $linenum\n" );
+      if( 'xcal' == $this->format )
+        header( 'Content-Type: application/calendar+xml; charset=utf-8' );
+      else
+        header( 'Content-Type: text/calendar; charset=utf-8' );
+      header( 'Content-Length: '.$filesize );
+      header( 'Content-Disposition: attachment; filename="'.$filename.'"' );
+      header( 'Cache-Control: max-age=10' );
+      $fp = @fopen( $dirfile, 'r' );
+      if( $fp ) {
+        fpassthru( $fp );
+        fclose( $fp );
+      }
+      die();
+    }
+    else
+      return FALSE;
+  }
+}
+/*********************************************************************************/
+/*********************************************************************************/
+/**
+ *  abstract class for calendar components
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.9.6 - 2011-05-14
+ */
+class calendarComponent {
+            //  component property variables
+  var $uid;
+  var $dtstamp;
+
+            //  component config variables
+  var $allowEmpty;
+  var $language;
+  var $nl;
+  var $unique_id;
+  var $format;
+  var $objName; // created automatically at instance creation
+  var $dtzid;   // default (local) timezone
+            //  component internal variables
+  var $componentStart1;
+  var $componentStart2;
+  var $componentEnd1;
+  var $componentEnd2;
+  var $elementStart1;
+  var $elementStart2;
+  var $elementEnd1;
+  var $elementEnd2;
+  var $intAttrDelimiter;
+  var $attributeDelimiter;
+  var $valueInit;
+            //  component xCal declaration container
+  var $xcaldecl;
+/**
+ * constructor for calendar component object
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.9.6 - 2011-05-17
+ */
+  function calendarComponent() {
+    $this->objName         = ( isset( $this->timezonetype )) ?
+                          strtolower( $this->timezonetype )  :  get_class ( $this );
+    $this->uid             = array();
+    $this->dtstamp         = array();
+
+    $this->language        = null;
+    $this->nl              = null;
+    $this->unique_id       = null;
+    $this->format          = null;
+    $this->dtzid           = null;
+    $this->allowEmpty      = TRUE;
+    $this->xcaldecl        = array();
+
+    $this->_createFormat();
+    $this->_makeDtstamp();
+  }
+/*********************************************************************************/
+/**
+ * Property Name: ACTION
+ */
+/**
+ * creates formatted output for calendar component property action
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-10-22
+ * @return string
+ */
+  function createAction() {
+    if( empty( $this->action )) return FALSE;
+    if( empty( $this->action['value'] ))
+      return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'ACTION' ) : FALSE;
+    $attributes = $this->_createParams( $this->action['params'] );
+    return $this->_createElement( 'ACTION', $attributes, $this->action['value'] );
+  }
+/**
+ * set calendar component property action
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-11-04
+ * @param string $value  "AUDIO" / "DISPLAY" / "EMAIL" / "PROCEDURE"
+ * @param mixed $params
+ * @return bool
+ */
+  function setAction( $value, $params=FALSE ) {
+    if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
+    $this->action = array( 'value' => $value, 'params' => iCalUtilityFunctions::_setParams( $params ));
+    return TRUE;
+  }
+/*********************************************************************************/
+/**
+ * Property Name: ATTACH
+ */
+/**
+ * creates formatted output for calendar component property attach
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 0.9.7 - 2006-11-23
+ * @return string
+ */
+  function createAttach() {
+    if( empty( $this->attach )) return FALSE;
+    $output       = null;
+    foreach( $this->attach as $attachPart ) {
+      if(! empty( $attachPart['value'] )) {
+        $attributes = $this->_createParams( $attachPart['params'] );
+        $output    .= $this->_createElement( 'ATTACH', $attributes, $attachPart['value'] );
+      }
+      elseif( $this->getConfig( 'allowEmpty' )) $output .= $this->_createElement( 'ATTACH' );
+    }
+    return $output;
+  }
+/**
+ * set calendar component property attach
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.5.1 - 2008-11-06
+ * @param string $value
+ * @param array $params, optional
+ * @param integer $index, optional
+ * @return bool
+ */
+  function setAttach( $value, $params=FALSE, $index=FALSE ) {
+    if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
+    iCalUtilityFunctions::_setMval( $this->attach, $value, $params, FALSE, $index );
+    return TRUE;
+  }
+/*********************************************************************************/
+/**
+ * Property Name: ATTENDEE
+ */
+/**
+ * creates formatted output for calendar component property attendee
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.9.8 - 2011-05-30
+ * @return string
+ */
+  function createAttendee() {
+    if( empty( $this->attendee )) return FALSE;
+    $output = null;
+    foreach( $this->attendee as $attendeePart ) {                      // start foreach 1
+      if( empty( $attendeePart['value'] )) {
+        if( $this->getConfig( 'allowEmpty' ))
+          $output .= $this->_createElement( 'ATTENDEE' );
+        continue;
+      }
+      $attendee1 = $attendee2 = null;
+      foreach( $attendeePart as $paramlabel => $paramvalue ) {         // start foreach 2
+        if( 'value' == $paramlabel )
+          $attendee2     .= $paramvalue;
+        elseif(( 'params' == $paramlabel ) && ( is_array( $paramvalue ))) { // start elseif
+        // set attenddee parameters in rfc2445 order
+          if( isset( $paramvalue['CUTYPE'] ))
+            $attendee1   .= $this->intAttrDelimiter.'CUTYPE='.$paramvalue['CUTYPE'];
+          if( isset( $paramvalue['MEMBER'] )) {
+            $attendee1   .= $this->intAttrDelimiter.'MEMBER=';
+            foreach( $paramvalue['MEMBER'] as $cix => $opv )
+              $attendee1 .= ( $cix ) ? ', "'.$opv.'"' : '"'.$opv.'"' ;
+          }
+          if( isset( $paramvalue['ROLE'] ))
+            $attendee1   .= $this->intAttrDelimiter.'ROLE='.$paramvalue['ROLE'];
+          if( isset( $paramvalue['PARTSTAT'] ))
+            $attendee1   .= $this->intAttrDelimiter.'PARTSTAT='.$paramvalue['PARTSTAT'];
+          if( isset( $paramvalue['RSVP'] ))
+            $attendee1   .= $this->intAttrDelimiter.'RSVP='.$paramvalue['RSVP'];
+          if( isset( $paramvalue['DELEGATED-TO'] )) {
+            $attendee1   .= $this->intAttrDelimiter.'DELEGATED-TO=';
+            foreach( $paramvalue['DELEGATED-TO'] as $cix => $opv )
+              $attendee1 .= ( $cix ) ? ', "'.$opv.'"' : '"'.$opv.'"' ;
+          }
+          if( isset( $paramvalue['DELEGATED-FROM'] )) {
+            $attendee1   .= $this->intAttrDelimiter.'DELEGATED-FROM=';
+            foreach( $paramvalue['DELEGATED-FROM'] as $cix => $opv )
+              $attendee1 .= ( $cix ) ? ', "'.$opv.'"' : '"'.$opv.'"' ;
+          }
+          if( isset( $paramvalue['SENT-BY'] ))
+            $attendee1   .= $this->intAttrDelimiter.'SENT-BY="'.$paramvalue['SENT-BY'].'"';
+          if( isset( $paramvalue['CN'] ))
+            $attendee1   .= $this->intAttrDelimiter.'CN="'.$paramvalue['CN'].'"';
+          if( isset( $paramvalue['DIR'] ))
+            $attendee1   .= $this->intAttrDelimiter.'DIR="'.$paramvalue['DIR'].'"';
+          if( isset( $paramvalue['LANGUAGE'] ))
+            $attendee1   .= $this->intAttrDelimiter.'LANGUAGE='.$paramvalue['LANGUAGE'];
+          $xparams = array();
+          foreach( $paramvalue as $optparamlabel => $optparamvalue ) { // start foreach 3
+            if( ctype_digit( (string) $optparamlabel )) {
+              $xparams[]  = $optparamvalue;
+              continue;
+            }
+            if( !in_array( $optparamlabel, array( 'CUTYPE', 'MEMBER', 'ROLE', 'PARTSTAT', 'RSVP', 'DELEGATED-TO', 'DELEGATED-FROM', 'SENT-BY', 'CN', 'DIR', 'LANGUAGE' )))
+              $xparams[$optparamlabel] = $optparamvalue;
+          } // end foreach 3
+          ksort( $xparams, SORT_STRING );
+          foreach( $xparams as $paramKey => $paramValue ) {
+            if( ctype_digit( (string) $paramKey ))
+              $attendee1 .= $this->intAttrDelimiter.$paramValue;
+            else
+              $attendee1 .= $this->intAttrDelimiter."$paramKey=$paramValue";
+          }      // end foreach 3
+        }        // end elseif(( 'params' == $paramlabel ) && ( is_array( $paramvalue )))
+      }          // end foreach 2
+      $output .= $this->_createElement( 'ATTENDEE', $attendee1, $attendee2 );
+    }              // end foreach 1
+    return $output;
+  }
+/**
+ * set calendar component property attach
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.6.34 - 2010-12-18
+ * @param string $value
+ * @param array $params, optional
+ * @param integer $index, optional
+ * @return bool
+ */
+  function setAttendee( $value, $params=FALSE, $index=FALSE ) {
+    if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
+          // ftp://, http://, mailto:, file://, gopher://, news:, nntp://, telnet://, wais://, prospero://  may exist.. . also in params
+    if( FALSE !== ( $pos = strpos( substr( $value, 0, 9 ), ':' )))
+      $value = strtoupper( substr( $value, 0, $pos )).substr( $value, $pos );
+    elseif( !empty( $value ))
+      $value = 'MAILTO:'.$value;
+    $params2 = array();
+    if( is_array($params )) {
+      $optarrays = array();
+      foreach( $params as $optparamlabel => $optparamvalue ) {
+        $optparamlabel = strtoupper( $optparamlabel );
+        switch( $optparamlabel ) {
+          case 'MEMBER':
+          case 'DELEGATED-TO':
+          case 'DELEGATED-FROM':
+            if( !is_array( $optparamvalue ))
+              $optparamvalue = array( $optparamvalue );
+            foreach( $optparamvalue as $part ) {
+              $part = trim( $part );
+              if(( '"' == substr( $part, 0, 1 )) &&
+                 ( '"' == substr( $part, -1 )))
+                $part = substr( $part, 1, ( strlen( $part ) - 2 ));
+              if( 'mailto:' != strtolower( substr( $part, 0, 7 )))
+                $part = "MAILTO:$part";
+              else
+                $part = 'MAILTO:'.substr( $part, 7 );
+              $optarrays[$optparamlabel][] = $part;
+            }
+            break;
+          default:
+            if(( '"' == substr( $optparamvalue, 0, 1 )) &&
+               ( '"' == substr( $optparamvalue, -1 )))
+              $optparamvalue = substr( $optparamvalue, 1, ( strlen( $optparamvalue ) - 2 ));
+            if( 'SENT-BY' ==  $optparamlabel ) {
+              if( 'mailto:' != strtolower( substr( $optparamvalue, 0, 7 )))
+                $optparamvalue = "MAILTO:$optparamvalue";
+              else
+                $optparamvalue = 'MAILTO:'.substr( $optparamvalue, 7 );
+            }
+            $params2[$optparamlabel] = $optparamvalue;
+            break;
+        } // end switch( $optparamlabel.. .
+      } // end foreach( $optparam.. .
+      foreach( $optarrays as $optparamlabel => $optparams )
+        $params2[$optparamlabel] = $optparams;
+    }
+        // remove defaults
+    iCalUtilityFunctions::_existRem( $params2, 'CUTYPE',   'INDIVIDUAL' );
+    iCalUtilityFunctions::_existRem( $params2, 'PARTSTAT', 'NEEDS-ACTION' );
+    iCalUtilityFunctions::_existRem( $params2, 'ROLE',     'REQ-PARTICIPANT' );
+    iCalUtilityFunctions::_existRem( $params2, 'RSVP',     'FALSE' );
+        // check language setting
+    if( isset( $params2['CN' ] )) {
+      $lang = $this->getConfig( 'language' );
+      if( !isset( $params2['LANGUAGE' ] ) && !empty( $lang ))
+        $params2['LANGUAGE' ] = $lang;
+    }
+    iCalUtilityFunctions::_setMval( $this->attendee, $value, $params2, FALSE, $index );
+    return TRUE;
+  }
+/*********************************************************************************/
+/**
+ * Property Name: CATEGORIES
+ */
+/**
+ * creates formatted output for calendar component property categories
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-10-22
+ * @return string
+ */
+  function createCategories() {
+    if( empty( $this->categories )) return FALSE;
+    $output = null;
+    foreach( $this->categories as $category ) {
+      if( empty( $category['value'] )) {
+        if ( $this->getConfig( 'allowEmpty' ))
+          $output .= $this->_createElement( 'CATEGORIES' );
+        continue;
+      }
+      $attributes = $this->_createParams( $category['params'], array( 'LANGUAGE' ));
+      if( is_array( $category['value'] )) {
+        foreach( $category['value'] as $cix => $categoryPart )
+          $category['value'][$cix] = $this->_strrep( $categoryPart );
+        $content  = implode( ',', $category['value'] );
+      }
+      else
+        $content  = $this->_strrep( $category['value'] );
+      $output    .= $this->_createElement( 'CATEGORIES', $attributes, $content );
+    }
+    return $output;
+  }
+/**
+ * set calendar component property categories
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.5.1 - 2008-11-06
+ * @param mixed $value
+ * @param array $params, optional
+ * @param integer $index, optional
+ * @return bool
+ */
+  function setCategories( $value, $params=FALSE, $index=FALSE ) {
+    if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
+    iCalUtilityFunctions::_setMval( $this->categories, $value, $params, FALSE, $index );
+    return TRUE;
+ }
+/*********************************************************************************/
+/**
+ * Property Name: CLASS
+ */
+/**
+ * creates formatted output for calendar component property class
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 0.9.7 - 2006-11-20
+ * @return string
+ */
+  function createClass() {
+    if( empty( $this->class )) return FALSE;
+    if( empty( $this->class['value'] ))
+      return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'CLASS' ) : FALSE;
+    $attributes = $this->_createParams( $this->class['params'] );
+    return $this->_createElement( 'CLASS', $attributes, $this->class['value'] );
+  }
+/**
+ * set calendar component property class
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-11-04
+ * @param string $value "PUBLIC" / "PRIVATE" / "CONFIDENTIAL" / iana-token / x-name
+ * @param array $params optional
+ * @return bool
+ */
+  function setClass( $value, $params=FALSE ) {
+    if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
+    $this->class = array( 'value' => $value, 'params' => iCalUtilityFunctions::_setParams( $params ));
+    return TRUE;
+  }
+/*********************************************************************************/
+/**
+ * Property Name: COMMENT
+ */
+/**
+ * creates formatted output for calendar component property comment
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-10-22
+ * @return string
+ */
+  function createComment() {
+    if( empty( $this->comment )) return FALSE;
+    $output = null;
+    foreach( $this->comment as $commentPart ) {
+      if( empty( $commentPart['value'] )) {
+        if( $this->getConfig( 'allowEmpty' )) $output .= $this->_createElement( 'COMMENT' );
+        continue;
+      }
+      $attributes = $this->_createParams( $commentPart['params'], array( 'ALTREP', 'LANGUAGE' ));
+      $content    = $this->_strrep( $commentPart['value'] );
+      $output    .= $this->_createElement( 'COMMENT', $attributes, $content );
+    }
+    return $output;
+  }
+/**
+ * set calendar component property comment
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.5.1 - 2008-11-06
+ * @param string $value
+ * @param array $params, optional
+ * @param integer $index, optional
+ * @return bool
+ */
+  function setComment( $value, $params=FALSE, $index=FALSE ) {
+    if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
+    iCalUtilityFunctions::_setMval( $this->comment, $value, $params, FALSE, $index );
+    return TRUE;
+  }
+/*********************************************************************************/
+/**
+ * Property Name: COMPLETED
+ */
+/**
+ * creates formatted output for calendar component property completed
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-10-22
+ * @return string
+ */
+  function createCompleted( ) {
+    if( empty( $this->completed )) return FALSE;
+    if( !isset( $this->completed['value']['year'] )  &&
+        !isset( $this->completed['value']['month'] ) &&
+        !isset( $this->completed['value']['day'] )   &&
+        !isset( $this->completed['value']['hour'] )  &&
+        !isset( $this->completed['value']['min'] )   &&
+        !isset( $this->completed['value']['sec'] ))
+      if( $this->getConfig( 'allowEmpty' ))
+        return $this->_createElement( 'COMPLETED' );
+      else return FALSE;
+    $formatted  = iCalUtilityFunctions::_format_date_time( $this->completed['value'], 7 );
+    $attributes = $this->_createParams( $this->completed['params'] );
+    return $this->_createElement( 'COMPLETED', $attributes, $formatted );
+  }
+/**
+ * set calendar component property completed
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-10-23
+ * @param mixed $year
+ * @param mixed $month optional
+ * @param int $day optional
+ * @param int $hour optional
+ * @param int $min optional
+ * @param int $sec optional
+ * @param array $params optional
+ * @return bool
+ */
+  function setCompleted( $year, $month=FALSE, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $params=FALSE ) {
+    if( empty( $year )) {
+      if( $this->getConfig( 'allowEmpty' )) {
+        $this->completed = array( 'value' => null, 'params' => iCalUtilityFunctions::_setParams( $params ));
+        return TRUE;
+      }
+      else
+        return FALSE;
+    }
+    $this->completed = iCalUtilityFunctions::_setDate2( $year, $month, $day, $hour, $min, $sec, $params );
+    return TRUE;
+  }
+/*********************************************************************************/
+/**
+ * Property Name: CONTACT
+ */
+/**
+ * creates formatted output for calendar component property contact
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-10-23
+ * @return string
+ */
+  function createContact() {
+    if( empty( $this->contact )) return FALSE;
+    $output = null;
+    foreach( $this->contact as $contact ) {
+      if( !empty( $contact['value'] )) {
+        $attributes = $this->_createParams( $contact['params'], array( 'ALTREP', 'LANGUAGE' ));
+        $content    = $this->_strrep( $contact['value'] );
+        $output    .= $this->_createElement( 'CONTACT', $attributes, $content );
+      }
+      elseif( $this->getConfig( 'allowEmpty' )) $output .= $this->_createElement( 'CONTACT' );
+    }
+    return $output;
+  }
+/**
+ * set calendar component property contact
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.5.1 - 2008-11-05
+ * @param string $value
+ * @param array $params, optional
+ * @param integer $index, optional
+ * @return bool
+ */
+  function setContact( $value, $params=FALSE, $index=FALSE ) {
+    if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
+    iCalUtilityFunctions::_setMval( $this->contact, $value, $params, FALSE, $index );
+    return TRUE;
+  }
+/*********************************************************************************/
+/**
+ * Property Name: CREATED
+ */
+/**
+ * creates formatted output for calendar component property created
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-10-21
+ * @return string
+ */
+  function createCreated() {
+    if( empty( $this->created )) return FALSE;
+    $formatted  = iCalUtilityFunctions::_format_date_time( $this->created['value'], 7 );
+    $attributes = $this->_createParams( $this->created['params'] );
+    return $this->_createElement( 'CREATED', $attributes, $formatted );
+  }
+/**
+ * set calendar component property created
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-10-23
+ * @param mixed $year optional
+ * @param mixed $month optional
+ * @param int $day optional
+ * @param int $hour optional
+ * @param int $min optional
+ * @param int $sec optional
+ * @param mixed $params optional
+ * @return bool
+ */
+  function setCreated( $year=FALSE, $month=FALSE, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $params=FALSE ) {
+    if( !isset( $year )) {
+      $year = date('Ymd\THis', mktime( date( 'H' ), date( 'i' ), date( 's' ) - date( 'Z'), date( 'm' ), date( 'd' ), date( 'Y' )));
+    }
+    $this->created = iCalUtilityFunctions::_setDate2( $year, $month, $day, $hour, $min, $sec, $params );
+    return TRUE;
+  }
+/*********************************************************************************/
+/**
+ * Property Name: DESCRIPTION
+ */
+/**
+ * creates formatted output for calendar component property description
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-10-22
+ * @return string
+ */
+  function createDescription() {
+    if( empty( $this->description )) return FALSE;
+    $output       = null;
+    foreach( $this->description as $description ) {
+      if( !empty( $description['value'] )) {
+        $attributes = $this->_createParams( $description['params'], array( 'ALTREP', 'LANGUAGE' ));
+        $content    = $this->_strrep( $description['value'] );
+        $output    .= $this->_createElement( 'DESCRIPTION', $attributes, $content );
+      }
+      elseif( $this->getConfig( 'allowEmpty' )) $output .= $this->_createElement( 'DESCRIPTION' );
+    }
+    return $output;
+  }
+/**
+ * set calendar component property description
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.6.24 - 2010-11-06
+ * @param string $value
+ * @param array $params, optional
+ * @param integer $index, optional
+ * @return bool
+ */
+  function setDescription( $value, $params=FALSE, $index=FALSE ) {
+    if( empty( $value )) { if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE; }
+    if( 'vjournal' != $this->objName )
+      $index = 1;
+    iCalUtilityFunctions::_setMval( $this->description, $value, $params, FALSE, $index );
+    return TRUE;
+  }
+/*********************************************************************************/
+/**
+ * Property Name: DTEND
+ */
+/**
+ * creates formatted output for calendar component property dtend
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.9.6 - 2011-05-14
+ * @return string
+ */
+  function createDtend() {
+    if( empty( $this->dtend )) return FALSE;
+    if( !isset( $this->dtend['value']['year'] )  &&
+        !isset( $this->dtend['value']['month'] ) &&
+        !isset( $this->dtend['value']['day'] )   &&
+        !isset( $this->dtend['value']['hour'] )  &&
+        !isset( $this->dtend['value']['min'] )   &&
+        !isset( $this->dtend['value']['sec'] ))
+      if( $this->getConfig( 'allowEmpty' ))
+        return $this->_createElement( 'DTEND' );
+      else return FALSE;
+    $formatted  = iCalUtilityFunctions::_format_date_time( $this->dtend['value'] );
+    if(( FALSE !== ( $tzid = $this->getConfig( 'TZID' ))) &&
+       ( !isset( $this->dtend['params']['VALUE'] )        || ( $this->dtend['params']['VALUE'] != 'DATE' )) &&
+         !isset( $this->dtend['params']['TZID'] ))
+      $this->dtend['params']['TZID'] = $tzid;
+    $attributes = $this->_createParams( $this->dtend['params'] );
+    return $this->_createElement( 'DTEND', $attributes, $formatted );
+  }
+/**
+ * set calendar component property dtend
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.9.6 - 2011-05-14
+ * @param mixed $year
+ * @param mixed $month optional
+ * @param int $day optional
+ * @param int $hour optional
+ * @param int $min optional
+ * @param int $sec optional
+ * @param string $tz optional
+ * @param array params optional
+ * @return bool
+ */
+  function setDtend( $year, $month=FALSE, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $tz=FALSE, $params=FALSE ) {
+    if( empty( $year )) {
+      if( $this->getConfig( 'allowEmpty' )) {
+        $this->dtend = array( 'value' => null, 'params' => iCalUtilityFunctions::_setParams( $params ));
+        return TRUE;
+      }
+      else
+        return FALSE;
+    }
+    $this->dtend = iCalUtilityFunctions::_setDate( $year, $month, $day, $hour, $min, $sec, $tz, $params, null, null, $this->getConfig( 'TZID' ));
+    return TRUE;
+  }
+/*********************************************************************************/
+/**
+ * Property Name: DTSTAMP
+ */
+/**
+ * creates formatted output for calendar component property dtstamp
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.4 - 2008-03-07
+ * @return string
+ */
+  function createDtstamp() {
+    if( !isset( $this->dtstamp['value']['year'] )  &&
+        !isset( $this->dtstamp['value']['month'] ) &&
+        !isset( $this->dtstamp['value']['day'] )   &&
+        !isset( $this->dtstamp['value']['hour'] )  &&
+        !isset( $this->dtstamp['value']['min'] )   &&
+        !isset( $this->dtstamp['value']['sec'] ))
+      $this->_makeDtstamp();
+    $formatted  = iCalUtilityFunctions::_format_date_time( $this->dtstamp['value'], 7 );
+    $attributes = $this->_createParams( $this->dtstamp['params'] );
+    return $this->_createElement( 'DTSTAMP', $attributes, $formatted );
+  }
+/**
+ * computes datestamp for calendar component object instance dtstamp
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.6.25 - 2010-11-09
+ * @return void
+ */
+  function _makeDtstamp() {
+    $d = mktime( date('H'), date('m'), (date('s') - date( 'Z' )), date('m'), date('d'), date('Y'));
+    $this->dtstamp['value'] = array( 'year'  => date( 'Y', $d )
+                                   , 'month' => date( 'm', $d )
+                                   , 'day'   => date( 'd', $d )
+                                   , 'hour'  => date( 'H', $d )
+                                   , 'min'   => date( 'i', $d )
+                                   , 'sec'   => date( 's', $d ));
+    $this->dtstamp['params'] = null;
+  }
+/**
+ * set calendar component property dtstamp
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-10-23
+ * @param mixed $year
+ * @param mixed $month optional
+ * @param int $day optional
+ * @param int $hour optional
+ * @param int $min optional
+ * @param int $sec optional
+ * @param array $params optional
+ * @return TRUE
+ */
+  function setDtstamp( $year, $month=FALSE, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $params=FALSE ) {
+    if( empty( $year ))
+      $this->_makeDtstamp();
+    else
+      $this->dtstamp = iCalUtilityFunctions::_setDate2( $year, $month, $day, $hour, $min, $sec, $params );
+    return TRUE;
+  }
+/*********************************************************************************/
+/**
+ * Property Name: DTSTART
+ */
+/**
+ * creates formatted output for calendar component property dtstart
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.9.6 - 2011-05-15
+ * @return string
+ */
+  function createDtstart() {
+    if( empty( $this->dtstart )) return FALSE;
+    if( !isset( $this->dtstart['value']['year'] )  &&
+        !isset( $this->dtstart['value']['month'] ) &&
+        !isset( $this->dtstart['value']['day'] )   &&
+        !isset( $this->dtstart['value']['hour'] )  &&
+        !isset( $this->dtstart['value']['min'] )   &&
+        !isset( $this->dtstart['value']['sec'] )) {
+      if( $this->getConfig( 'allowEmpty' ))
+        return $this->_createElement( 'DTSTART' );
+      else return FALSE;
+    }
+    if( in_array( $this->objName, array( 'vtimezone', 'standard', 'daylight' )))
+      unset( $this->dtstart['value']['tz'], $this->dtstart['params']['TZID'] );
+    elseif(( FALSE !== ( $tzid = $this->getConfig( 'TZID' ))) &&
+       ( !isset( $this->dtstart['params']['VALUE'] ) || ( $this->dtstart['params']['VALUE'] != 'DATE' ))  &&
+         !isset( $this->dtstart['params']['TZID'] ))
+      $this->dtstart['params']['TZID'] = $tzid;
+    $formatted  = iCalUtilityFunctions::_format_date_time( $this->dtstart['value'] );
+    $attributes = $this->_createParams( $this->dtstart['params'] );
+    return $this->_createElement( 'DTSTART', $attributes, $formatted );
+  }
+/**
+ * set calendar component property dtstart
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.6.22 - 2010-09-22
+ * @param mixed $year
+ * @param mixed $month optional
+ * @param int $day optional
+ * @param int $hour optional
+ * @param int $min optional
+ * @param int $sec optional
+ * @param string $tz optional
+ * @param array $params optional
+ * @return bool
+ */
+  function setDtstart( $year, $month=FALSE, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $tz=FALSE, $params=FALSE ) {
+    if( empty( $year )) {
+      if( $this->getConfig( 'allowEmpty' )) {
+        $this->dtstart = array( 'value' => null, 'params' => iCalUtilityFunctions::_setParams( $params ));
+        return TRUE;
+      }
+      else
+        return FALSE;
+    }
+    $this->dtstart = iCalUtilityFunctions::_setDate( $year, $month, $day, $hour, $min, $sec, $tz, $params, 'dtstart', $this->objName, $this->getConfig( 'TZID' ));
+    return TRUE;
+  }
+/*********************************************************************************/
+/**
+ * Property Name: DUE
+ */
+/**
+ * creates formatted output for calendar component property due
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-10-22
+ * @return string
+ */
+  function createDue() {
+    if( empty( $this->due )) return FALSE;
+    if( !isset( $this->due['value']['year'] )  &&
+        !isset( $this->due['value']['month'] ) &&
+        !isset( $this->due['value']['day'] )   &&
+        !isset( $this->due['value']['hour'] )  &&
+        !isset( $this->due['value']['min'] )   &&
+        !isset( $this->due['value']['sec'] )) {
+      if( $this->getConfig( 'allowEmpty' ))
+        return $this->_createElement( 'DUE' );
+      else
+       return FALSE;
+    }
+    $formatted  = iCalUtilityFunctions::_format_date_time( $this->due['value'] );
+    if(( FALSE !== ( $tzid = $this->getConfig( 'TZID' ))) &&
+       ( !isset( $this->due['params']['VALUE'] ) || ( $this->due['params']['VALUE'] != 'DATE' ))  &&
+         !isset( $this->due['params']['TZID'] ))
+      $this->due['params']['TZID'] = $tzid;
+    $attributes = $this->_createParams( $this->due['params'] );
+    return $this->_createElement( 'DUE', $attributes, $formatted );
+  }
+/**
+ * set calendar component property due
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-11-04
+ * @param mixed $year
+ * @param mixed $month optional
+ * @param int $day optional
+ * @param int $hour optional
+ * @param int $min optional
+ * @param int $sec optional
+ * @param array $params optional
+ * @return bool
+ */
+  function setDue( $year, $month=FALSE, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $tz=FALSE, $params=FALSE ) {
+    if( empty( $year )) {
+      if( $this->getConfig( 'allowEmpty' )) {
+        $this->due = array( 'value' => null, 'params' => iCalUtilityFunctions::_setParams( $params ));
+        return TRUE;
+      }
+      else
+        return FALSE;
+    }
+    $this->due = iCalUtilityFunctions::_setDate( $year, $month, $day, $hour, $min, $sec, $tz, $params, null, null, $this->getConfig( 'TZID' ));
+    return TRUE;
+  }
+/*********************************************************************************/
+/**
+ * Property Name: DURATION
+ */
+/**
+ * creates formatted output for calendar component property duration
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-10-21
+ * @return string
+ */
+  function createDuration() {
+    if( empty( $this->duration )) return FALSE;
+    if( !isset( $this->duration['value']['week'] ) &&
+        !isset( $this->duration['value']['day'] )  &&
+        !isset( $this->duration['value']['hour'] ) &&
+        !isset( $this->duration['value']['min'] )  &&
+        !isset( $this->duration['value']['sec'] ))
+      if( $this->getConfig( 'allowEmpty' ))
+        return $this->_createElement( 'DURATION', array(), null );
+      else return FALSE;
+    $attributes = $this->_createParams( $this->duration['params'] );
+    return $this->_createElement( 'DURATION', $attributes, iCalUtilityFunctions::_format_duration( $this->duration['value'] ));
+  }
+/**
+ * set calendar component property duration
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-11-04
+ * @param mixed $week
+ * @param mixed $day optional
+ * @param int $hour optional
+ * @param int $min optional
+ * @param int $sec optional
+ * @param array $params optional
+ * @return bool
+ */
+  function setDuration( $week, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $params=FALSE ) {
+    if( empty( $week )) if( $this->getConfig( 'allowEmpty' )) $week = null; else return FALSE;
+    if( is_array( $week ) && ( 1 <= count( $week )))
+      $this->duration = array( 'value' => iCalUtilityFunctions::_duration_array( $week ), 'params' => iCalUtilityFunctions::_setParams( $day ));
+    elseif( is_string( $week ) && ( 3 <= strlen( trim( $week )))) {
+      $week = trim( $week );
+      if( in_array( substr( $week, 0, 1 ), array( '+', '-' )))
+        $week = substr( $week, 1 );
+      $this->duration = array( 'value' => iCalUtilityFunctions::_duration_string( $week ), 'params' => iCalUtilityFunctions::_setParams( $day ));
+    }
+    elseif( empty( $week ) && empty( $day ) && empty( $hour ) && empty( $min ) && empty( $sec ))
+      return FALSE;
+    else
+      $this->duration = array( 'value' => iCalUtilityFunctions::_duration_array( array( $week, $day, $hour, $min, $sec )), 'params' => iCalUtilityFunctions::_setParams( $params ));
+    return TRUE;
+  }
+/*********************************************************************************/
+/**
+ * Property Name: EXDATE
+ */
+/**
+ * creates formatted output for calendar component property exdate
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-10-22
+ * @return string
+ */
+  function createExdate() {
+    if( empty( $this->exdate )) return FALSE;
+    $output = null;
+    foreach( $this->exdate as $ex => $theExdate ) {
+      if( empty( $theExdate['value'] )) {
+        if( $this->getConfig( 'allowEmpty' )) $output .= $this->_createElement( 'EXDATE' );
+        continue;
+      }
+      $content = $attributes = null;
+      foreach( $theExdate['value'] as $eix => $exdatePart ) {
+        $parno = count( $exdatePart );
+        $formatted = iCalUtilityFunctions::_format_date_time( $exdatePart, $parno );
+        if( isset( $theExdate['params']['TZID'] ))
+          $formatted = str_replace( 'Z', '', $formatted);
+        if( 0 < $eix ) {
+          if( isset( $theExdate['value'][0]['tz'] )) {
+            if( ctype_digit( substr( $theExdate['value'][0]['tz'], -4 )) ||
+               ( 'Z' == $theExdate['value'][0]['tz'] )) {
+              if( 'Z' != substr( $formatted, -1 ))
+                $formatted .= 'Z';
+            }
+            else
+              $formatted = str_replace( 'Z', '', $formatted );
+          }
+          else
+            $formatted = str_replace( 'Z', '', $formatted );
+        }
+        $content .= ( 0 < $eix ) ? ','.$formatted : $formatted;
+      }
+      $attributes .= $this->_createParams( $theExdate['params'] );
+      $output .= $this->_createElement( 'EXDATE', $attributes, $content );
+    }
+    return $output;
+  }
+/**
+ * set calendar component property exdate
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.5.1 - 2008-11-05
+ * @param array exdates
+ * @param array $params, optional
+ * @param integer $index, optional
+ * @return bool
+ */
+  function setExdate( $exdates, $params=FALSE, $index=FALSE ) {
+    if( empty( $exdates )) {
+      if( $this->getConfig( 'allowEmpty' )) {
+        iCalUtilityFunctions::_setMval( $this->exdate, null, $params, FALSE, $index );
+        return TRUE;
+      }
+      else
+        return FALSE;
+    }
+    $input  = array( 'params' => iCalUtilityFunctions::_setParams( $params, array( 'VALUE' => 'DATE-TIME' )));
+            /* ev. check 1:st date and save ev. timezone **/
+    iCalUtilityFunctions::_chkdatecfg( reset( $exdates ), $parno, $input['params'] );
+    iCalUtilityFunctions::_existRem( $input['params'], 'VALUE', 'DATE-TIME' ); // remove default parameter
+    foreach( $exdates as $eix => $theExdate ) {
+      if( iCalUtilityFunctions::_isArrayTimestampDate( $theExdate ))
+        $exdatea = iCalUtilityFunctions::_timestamp2date( $theExdate, $parno );
+      elseif(  is_array( $theExdate ))
+        $exdatea = iCalUtilityFunctions::_date_time_array( $theExdate, $parno );
+      elseif( 8 <= strlen( trim( $theExdate ))) // ex. 2006-08-03 10:12:18
+        $exdatea = iCalUtilityFunctions::_date_time_string( $theExdate, $parno );
+      if( 3 == $parno )
+        unset( $exdatea['hour'], $exdatea['min'], $exdatea['sec'], $exdatea['tz'] );
+      elseif( isset( $exdatea['tz'] ))
+        $exdatea['tz'] = (string) $exdatea['tz'];
+      if(  isset( $input['params']['TZID'] ) ||
+         ( isset( $exdatea['tz'] ) && !iCalUtilityFunctions::_isOffset( $exdatea['tz'] )) ||
+         ( isset( $input['value'][0] ) && ( !isset( $input['value'][0]['tz'] ))) ||
+         ( isset( $input['value'][0]['tz'] ) && !iCalUtilityFunctions::_isOffset( $input['value'][0]['tz'] )))
+        unset( $exdatea['tz'] );
+      $input['value'][] = $exdatea;
+    }
+    if( 0 >= count( $input['value'] ))
+      return FALSE;
+    if( 3 == $parno ) {
+      $input['params']['VALUE'] = 'DATE';
+      unset( $input['params']['TZID'] );
+    }
+    iCalUtilityFunctions::_setMval( $this->exdate, $input['value'], $input['params'], FALSE, $index );
+    return TRUE;
+  }
+/*********************************************************************************/
+/**
+ * Property Name: EXRULE
+ */
+/**
+ * creates formatted output for calendar component property exrule
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-10-22
+ * @return string
+ */
+  function createExrule() {
+    if( empty( $this->exrule )) return FALSE;
+    return $this->_format_recur( 'EXRULE', $this->exrule );
+  }
+/**
+ * set calendar component property exdate
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.5.1 - 2008-11-05
+ * @param array $exruleset
+ * @param array $params, optional
+ * @param integer $index, optional
+ * @return bool
+ */
+  function setExrule( $exruleset, $params=FALSE, $index=FALSE ) {
+    if( empty( $exruleset )) if( $this->getConfig( 'allowEmpty' )) $exruleset = null; else return FALSE;
+    iCalUtilityFunctions::_setMval( $this->exrule, iCalUtilityFunctions::_setRexrule( $exruleset ), $params, FALSE, $index );
+    return TRUE;
+  }
+/*********************************************************************************/
+/**
+ * Property Name: FREEBUSY
+ */
+/**
+ * creates formatted output for calendar component property freebusy
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-10-22
+ * @return string
+ */
+  function createFreebusy() {
+    if( empty( $this->freebusy )) return FALSE;
+    $output = null;
+    foreach( $this->freebusy as $freebusyPart ) {
+      if( empty( $freebusyPart['value'] )) {
+        if( $this->getConfig( 'allowEmpty' )) $output .= $this->_createElement( 'FREEBUSY' );
+        continue;
+      }
+      $attributes = $content = null;
+      if( isset( $freebusyPart['value']['fbtype'] )) {
+        $attributes .= $this->intAttrDelimiter.'FBTYPE='.$freebusyPart['value']['fbtype'];
+        unset( $freebusyPart['value']['fbtype'] );
+        $freebusyPart['value'] = array_values( $freebusyPart['value'] );
+      }
+      else
+        $attributes .= $this->intAttrDelimiter.'FBTYPE=BUSY';
+      $attributes .= $this->_createParams( $freebusyPart['params'] );
+      $fno = 1;
+      $cnt = count( $freebusyPart['value']);
+      foreach( $freebusyPart['value'] as $periodix => $freebusyPeriod ) {
+        $formatted   = iCalUtilityFunctions::_format_date_time( $freebusyPeriod[0] );
+        $content .= $formatted;
+        $content .= '/';
+        $cnt2 = count( $freebusyPeriod[1]);
+        if( array_key_exists( 'year', $freebusyPeriod[1] ))      // date-time
+          $cnt2 = 7;
+        elseif( array_key_exists( 'week', $freebusyPeriod[1] ))  // duration
+          $cnt2 = 5;
+        if(( 7 == $cnt2 )   &&    // period=  -> date-time
+            isset( $freebusyPeriod[1]['year'] )  &&
+            isset( $freebusyPeriod[1]['month'] ) &&
+            isset( $freebusyPeriod[1]['day'] )) {
+          $content .= iCalUtilityFunctions::_format_date_time( $freebusyPeriod[1] );
+        }
+        else {                                  // period=  -> dur-time
+          $content .= iCalUtilityFunctions::_format_duration( $freebusyPeriod[1] );
+        }
+        if( $fno < $cnt )
+          $content .= ',';
+        $fno++;
+      }
+      $output .= $this->_createElement( 'FREEBUSY', $attributes, $content );
+    }
+    return $output;
+  }
+/**
+ * set calendar component property freebusy
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.8.10 - 2011-03-24
+ * @param string $fbType
+ * @param array $fbValues
+ * @param array $params, optional
+ * @param integer $index, optional
+ * @return bool
+ */
+  function setFreebusy( $fbType, $fbValues, $params=FALSE, $index=FALSE ) {
+    if( empty( $fbValues )) {
+      if( $this->getConfig( 'allowEmpty' )) {
+        iCalUtilityFunctions::_setMval( $this->freebusy, null, $params, FALSE, $index );
+        return TRUE;
+      }
+      else
+        return FALSE;
+    }
+    $fbType = strtoupper( $fbType );
+    if(( !in_array( $fbType, array( 'FREE', 'BUSY', 'BUSY-UNAVAILABLE', 'BUSY-TENTATIVE' ))) &&
+       ( 'X-' != substr( $fbType, 0, 2 )))
+      $fbType = 'BUSY';
+    $input = array( 'fbtype' => $fbType );
+    foreach( $fbValues as $fbPeriod ) {   // periods => period
+      if( empty( $fbPeriod ))
+        continue;
+      $freebusyPeriod = array();
+      foreach( $fbPeriod as $fbMember ) { // pairs => singlepart
+        $freebusyPairMember = array();
+        if( is_array( $fbMember )) {
+          if( iCalUtilityFunctions::_isArrayDate( $fbMember )) { // date-time value
+            $freebusyPairMember       = iCalUtilityFunctions::_date_time_array( $fbMember, 7 );
+            $freebusyPairMember['tz'] = 'Z';
+          }
+          elseif( iCalUtilityFunctions::_isArrayTimestampDate( $fbMember )) { // timestamp value
+            $freebusyPairMember       = iCalUtilityFunctions::_timestamp2date( $fbMember['timestamp'], 7 );
+            $freebusyPairMember['tz'] = 'Z';
+          }
+          else {                                         // array format duration
+            $freebusyPairMember = iCalUtilityFunctions::_duration_array( $fbMember );
+          }
+        }
+        elseif(( 3 <= strlen( trim( $fbMember ))) &&    // string format duration
+               ( in_array( $fbMember{0}, array( 'P', '+', '-' )))) {
+          if( 'P' != $fbMember{0} )
+            $fbmember = substr( $fbMember, 1 );
+          $freebusyPairMember = iCalUtilityFunctions::_duration_string( $fbMember );
+        }
+        elseif( 8 <= strlen( trim( $fbMember ))) { // text date ex. 2006-08-03 10:12:18
+          $freebusyPairMember       = iCalUtilityFunctions::_date_time_string( $fbMember, 7 );
+          $freebusyPairMember['tz'] = 'Z';
+        }
+        $freebusyPeriod[]   = $freebusyPairMember;
+      }
+      $input[]              = $freebusyPeriod;
+    }
+    iCalUtilityFunctions::_setMval( $this->freebusy, $input, $params, FALSE, $index );
+    return TRUE;
+  }
+/*********************************************************************************/
+/**
+ * Property Name: GEO
+ */
+/**
+ * creates formatted output for calendar component property geo
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-10-21
+ * @return string
+ */
+  function createGeo() {
+    if( empty( $this->geo )) return FALSE;
+    if( empty( $this->geo['value'] ))
+      return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'GEO' ) : FALSE;
+    $attributes = $this->_createParams( $this->geo['params'] );
+    $content    = null;
+    $content   .= number_format( (float) $this->geo['value']['latitude'], 6, '.', '');
+    $content   .= ';';
+    $content   .= number_format( (float) $this->geo['value']['longitude'], 6, '.', '');
+    return $this->_createElement( 'GEO', $attributes, $content );
+  }
+/**
+ * set calendar component property geo
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-11-04
+ * @param float $latitude
+ * @param float $longitude
+ * @param array $params optional
+ * @return bool
+ */
+  function setGeo( $latitude, $longitude, $params=FALSE ) {
+    if( !empty( $latitude ) && !empty( $longitude )) {
+      if( !is_array( $this->geo )) $this->geo = array();
+      $this->geo['value']['latitude']  = $latitude;
+      $this->geo['value']['longitude'] = $longitude;
+      $this->geo['params'] = iCalUtilityFunctions::_setParams( $params );
+    }
+    elseif( $this->getConfig( 'allowEmpty' ))
+      $this->geo = array( 'value' => null, 'params' => iCalUtilityFunctions::_setParams( $params ) );
+    else
+      return FALSE;
+    return TRUE;
+  }
+/*********************************************************************************/
+/**
+ * Property Name: LAST-MODIFIED
+ */
+/**
+ * creates formatted output for calendar component property last-modified
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-10-21
+ * @return string
+ */
+  function createLastModified() {
+    if( empty( $this->lastmodified )) return FALSE;
+    $attributes = $this->_createParams( $this->lastmodified['params'] );
+    $formatted  = iCalUtilityFunctions::_format_date_time( $this->lastmodified['value'], 7 );
+    return $this->_createElement( 'LAST-MODIFIED', $attributes, $formatted );
+  }
+/**
+ * set calendar component property completed
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-10-23
+ * @param mixed $year optional
+ * @param mixed $month optional
+ * @param int $day optional
+ * @param int $hour optional
+ * @param int $min optional
+ * @param int $sec optional
+ * @param array $params optional
+ * @return boll
+ */
+  function setLastModified( $year=FALSE, $month=FALSE, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $params=FALSE ) {
+    if( empty( $year ))
+      $year = date('Ymd\THis', mktime( date( 'H' ), date( 'i' ), date( 's' ) - date( 'Z'), date( 'm' ), date( 'd' ), date( 'Y' )));
+    $this->lastmodified = iCalUtilityFunctions::_setDate2( $year, $month, $day, $hour, $min, $sec, $params );
+    return TRUE;
+  }
+/*********************************************************************************/
+/**
+ * Property Name: LOCATION
+ */
+/**
+ * creates formatted output for calendar component property location
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-10-22
+ * @return string
+ */
+  function createLocation() {
+    if( empty( $this->location )) return FALSE;
+    if( empty( $this->location['value'] ))
+      return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'LOCATION' ) : FALSE;
+    $attributes = $this->_createParams( $this->location['params'], array( 'ALTREP', 'LANGUAGE' ));
+    $content    = $this->_strrep( $this->location['value'] );
+    return $this->_createElement( 'LOCATION', $attributes, $content );
+  }
+/**
+ * set calendar component property location
+ '
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-11-04
+ * @param string $value
+ * @param array params optional
+ * @return bool
+ */
+  function setLocation( $value, $params=FALSE ) {
+    if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
+    $this->location = array( 'value' => $value, 'params' => iCalUtilityFunctions::_setParams( $params ));
+    return TRUE;
+  }
+/*********************************************************************************/
+/**
+ * Property Name: ORGANIZER
+ */
+/**
+ * creates formatted output for calendar component property organizer
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.6.33 - 2010-12-17
+ * @return string
+ */
+  function createOrganizer() {
+    if( empty( $this->organizer )) return FALSE;
+    if( empty( $this->organizer['value'] ))
+      return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'ORGANIZER' ) : FALSE;
+    $attributes = $this->_createParams( $this->organizer['params']
+                                      , array( 'CN', 'DIR', 'SENT-BY', 'LANGUAGE' ));
+    return $this->_createElement( 'ORGANIZER', $attributes, $this->organizer['value'] );
+  }
+/**
+ * set calendar component property organizer
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.6.27 - 2010-11-29
+ * @param string $value
+ * @param array params optional
+ * @return bool
+ */
+  function setOrganizer( $value, $params=FALSE ) {
+    if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
+    if( FALSE === ( $pos = strpos( substr( $value, 0, 9 ), ':' )))
+      $value = 'MAILTO:'.$value;
+    else
+      $value = strtolower( substr( $value, 0, $pos )).substr( $value, $pos );
+    $value = str_replace( 'mailto:', 'MAILTO:', $value );
+    $this->organizer = array( 'value' => $value, 'params' => iCalUtilityFunctions::_setParams( $params ));
+    if( isset( $this->organizer['params']['SENT-BY'] )){
+      if( 'mailto:' !== strtolower( substr( $this->organizer['params']['SENT-BY'], 0, 7 )))
+        $this->organizer['params']['SENT-BY'] = 'MAILTO:'.$this->organizer['params']['SENT-BY'];
+      else
+        $this->organizer['params']['SENT-BY'] = 'MAILTO:'.substr( $this->organizer['params']['SENT-BY'], 7 );
+    }
+    return TRUE;
+  }
+/*********************************************************************************/
+/**
+ * Property Name: PERCENT-COMPLETE
+ */
+/**
+ * creates formatted output for calendar component property percent-complete
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.9.3 - 2011-05-14
+ * @return string
+ */
+  function createPercentComplete() {
+    if( !isset($this->percentcomplete) || ( empty( $this->percentcomplete ) && !is_numeric( $this->percentcomplete ))) return FALSE;
+    if( !isset( $this->percentcomplete['value'] ) || ( empty( $this->percentcomplete['value'] ) && !is_numeric( $this->percentcomplete['value'] )))
+      return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'PERCENT-COMPLETE' ) : FALSE;
+    $attributes = $this->_createParams( $this->percentcomplete['params'] );
+    return $this->_createElement( 'PERCENT-COMPLETE', $attributes, $this->percentcomplete['value'] );
+  }
+/**
+ * set calendar component property percent-complete
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.9.3 - 2011-05-14
+ * @param int $value
+ * @param array $params optional
+ * @return bool
+ */
+  function setPercentComplete( $value, $params=FALSE ) {
+    if( empty( $value ) && !is_numeric( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
+    $this->percentcomplete = array( 'value' => $value, 'params' => iCalUtilityFunctions::_setParams( $params ));
+    return TRUE;
+  }
+/*********************************************************************************/
+/**
+ * Property Name: PRIORITY
+ */
+/**
+ * creates formatted output for calendar component property priority
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.9.3 - 2011-05-14
+ * @return string
+ */
+  function createPriority() {
+    if( !isset($this->priority) || ( empty( $this->priority ) && !is_numeric( $this->priority ))) return FALSE;
+    if( !isset( $this->priority['value'] ) || ( empty( $this->priority['value'] ) && !is_numeric( $this->priority['value'] )))
+      return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'PRIORITY' ) : FALSE;
+    $attributes = $this->_createParams( $this->priority['params'] );
+    return $this->_createElement( 'PRIORITY', $attributes, $this->priority['value'] );
+  }
+/**
+ * set calendar component property priority
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.9.3 - 2011-05-14
+ * @param int $value
+ * @param array $params optional
+ * @return bool
+ */
+  function setPriority( $value, $params=FALSE  ) {
+    if( empty( $value ) && !is_numeric( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
+    $this->priority = array( 'value' => $value, 'params' => iCalUtilityFunctions::_setParams( $params ));
+    return TRUE;
+  }
+/*********************************************************************************/
+/**
+ * Property Name: RDATE
+ */
+/**
+ * creates formatted output for calendar component property rdate
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.16 - 2008-10-26
+ * @return string
+ */
+  function createRdate() {
+    if( empty( $this->rdate )) return FALSE;
+    $utctime = ( in_array( $this->objName, array( 'vtimezone', 'standard', 'daylight' ))) ? TRUE : FALSE;
+    $output = null;
+    if( $utctime  )
+      unset( $this->rdate['params']['TZID'] );
+    foreach( $this->rdate as $theRdate ) {
+      if( empty( $theRdate['value'] )) {
+        if( $this->getConfig( 'allowEmpty' )) $output .= $this->_createElement( 'RDATE' );
+        continue;
+      }
+      if( $utctime  )
+        unset( $theRdate['params']['TZID'] );
+      $attributes = $this->_createParams( $theRdate['params'] );
+      $cnt = count( $theRdate['value'] );
+      $content = null;
+      $rno = 1;
+      foreach( $theRdate['value'] as $rpix => $rdatePart ) {
+        $contentPart = null;
+        if( is_array( $rdatePart ) &&
+            isset( $theRdate['params']['VALUE'] ) && ( 'PERIOD' == $theRdate['params']['VALUE'] )) { // PERIOD
+          if( $utctime )
+            unset( $rdatePart[0]['tz'] );
+          $formatted = iCalUtilityFunctions::_format_date_time( $rdatePart[0]); // PERIOD part 1
+          if( $utctime || !empty( $theRdate['params']['TZID'] ))
+            $formatted = str_replace( 'Z', '', $formatted);
+          if( 0 < $rpix ) {
+            if( !empty( $rdatePart[0]['tz'] ) && iCalUtilityFunctions::_isOffset( $rdatePart[0]['tz'] )) {
+              if( 'Z' != substr( $formatted, -1 )) $formatted .= 'Z';
+            }
+            else
+              $formatted = str_replace( 'Z', '', $formatted );
+          }
+          $contentPart .= $formatted;
+          $contentPart .= '/';
+          $cnt2 = count( $rdatePart[1]);
+          if( array_key_exists( 'year', $rdatePart[1] )) {
+            if( array_key_exists( 'hour', $rdatePart[1] ))
+              $cnt2 = 7;                                      // date-time
+            else
+              $cnt2 = 3;                                      // date
+          }
+          elseif( array_key_exists( 'week', $rdatePart[1] ))  // duration
+            $cnt2 = 5;
+          if(( 7 == $cnt2 )   &&    // period=  -> date-time
+              isset( $rdatePart[1]['year'] )  &&
+              isset( $rdatePart[1]['month'] ) &&
+              isset( $rdatePart[1]['day'] )) {
+            if( $utctime )
+              unset( $rdatePart[1]['tz'] );
+            $formatted = iCalUtilityFunctions::_format_date_time( $rdatePart[1] ); // PERIOD part 2
+            if( $utctime || !empty( $theRdate['params']['TZID'] ))
+              $formatted = str_replace( 'Z', '', $formatted);
+            if( !empty( $rdatePart[0]['tz'] ) && iCalUtilityFunctions::_isOffset( $rdatePart[0]['tz'] )) {
+              if( 'Z' != substr( $formatted, -1 )) $formatted .= 'Z';
+            }
+            else
+              $formatted = str_replace( 'Z', '', $formatted );
+           $contentPart .= $formatted;
+          }
+          else {                                  // period=  -> dur-time
+            $contentPart .= iCalUtilityFunctions::_format_duration( $rdatePart[1] );
+          }
+        } // PERIOD end
+        else { // SINGLE date start
+          if( $utctime )
+            unset( $rdatePart['tz'] );
+          $formatted = iCalUtilityFunctions::_format_date_time( $rdatePart);
+          if( $utctime || !empty( $theRdate['params']['TZID'] ))
+            $formatted = str_replace( 'Z', '', $formatted);
+          if( !$utctime && ( 0 < $rpix )) {
+            if( !empty( $theRdate['value'][0]['tz'] ) && iCalUtilityFunctions::_isOffset( $theRdate['value'][0]['tz'] )) {
+              if( 'Z' != substr( $formatted, -1 ))
+                $formatted .= 'Z';
+            }
+            else
+              $formatted = str_replace( 'Z', '', $formatted );
+          }
+          $contentPart .= $formatted;
+        }
+        $content .= $contentPart;
+        if( $rno < $cnt )
+          $content .= ',';
+        $rno++;
+      }
+      $output    .= $this->_createElement( 'RDATE', $attributes, $content );
+    }
+    return $output;
+  }
+/**
+ * set calendar component property rdate
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.5.1 - 2008-11-07
+ * @param array $rdates
+ * @param array $params, optional
+ * @param integer $index, optional
+ * @return bool
+ */
+  function setRdate( $rdates, $params=FALSE, $index=FALSE ) {
+    if( empty( $rdates )) {
+      if( $this->getConfig( 'allowEmpty' )) {
+        iCalUtilityFunctions::_setMval( $this->rdate, null, $params, FALSE, $index );
+        return TRUE;
+      }
+      else
+        return FALSE;
+    }
+    $input = array( 'params' => iCalUtilityFunctions::_setParams( $params, array( 'VALUE' => 'DATE-TIME' )));
+    if( in_array( $this->objName, array( 'vtimezone', 'standard', 'daylight' ))) {
+      unset( $input['params']['TZID'] );
+      $input['params']['VALUE'] = 'DATE-TIME';
+    }
+            /*  check if PERIOD, if not set */
+    if((!isset( $input['params']['VALUE'] ) || !in_array( $input['params']['VALUE'], array( 'DATE', 'PERIOD' ))) &&
+          isset( $rdates[0] )    && is_array( $rdates[0] ) && ( 2 == count( $rdates[0] )) &&
+          isset( $rdates[0][0] ) &&    isset( $rdates[0][1] ) && !isset( $rdates[0]['timestamp'] ) &&
+    (( is_array( $rdates[0][0] ) && ( isset( $rdates[0][0]['timestamp'] ) ||
+                                      iCalUtilityFunctions::_isArrayDate( $rdates[0][0] ))) ||
+                                    ( is_string( $rdates[0][0] ) && ( 8 <= strlen( trim( $rdates[0][0] )))))  &&
+     ( is_array( $rdates[0][1] ) || ( is_string( $rdates[0][1] ) && ( 3 <= strlen( trim( $rdates[0][1] ))))))
+      $input['params']['VALUE'] = 'PERIOD';
+            /* check 1:st date, upd. $parno (opt) and save ev. timezone **/
+    $date  = reset( $rdates );
+    if( isset( $input['params']['VALUE'] ) && ( 'PERIOD' == $input['params']['VALUE'] )) // PERIOD
+      $date  = reset( $date );
+    iCalUtilityFunctions::_chkdatecfg( $date, $parno, $input['params'] );
+    if( in_array( $this->objName, array( 'vtimezone', 'standard', 'daylight' )))
+      unset( $input['params']['TZID'] );
+    iCalUtilityFunctions::_existRem( $input['params'], 'VALUE', 'DATE-TIME' ); // remove default
+    foreach( $rdates as $rpix => $theRdate ) {
+      $inputa = null;
+      if( is_array( $theRdate )) {
+        if( isset( $input['params']['VALUE'] ) && ( 'PERIOD' == $input['params']['VALUE'] )) { // PERIOD
+          foreach( $theRdate as $rix => $rPeriod ) {
+            if( is_array( $rPeriod )) {
+              if( iCalUtilityFunctions::_isArrayTimestampDate( $rPeriod ))      // timestamp
+                $inputab  = ( isset( $rPeriod['tz'] )) ? iCalUtilityFunctions::_timestamp2date( $rPeriod, $parno ) : iCalUtilityFunctions::_timestamp2date( $rPeriod, 6 );
+              elseif( iCalUtilityFunctions::_isArrayDate( $rPeriod ))
+                $inputab  = ( 3 < count ( $rPeriod )) ? iCalUtilityFunctions::_date_time_array( $rPeriod, $parno ) : iCalUtilityFunctions::_date_time_array( $rPeriod, 6 );
+              elseif (( 1 == count( $rPeriod )) && ( 8 <= strlen( reset( $rPeriod ))))  // text-date
+                $inputab  = iCalUtilityFunctions::_date_time_string( reset( $rPeriod ), $parno );
+              else                                               // array format duration
+                $inputab  = iCalUtilityFunctions::_duration_array( $rPeriod );
+            }
+            elseif(( 3 <= strlen( trim( $rPeriod ))) &&          // string format duration
+                   ( in_array( $rPeriod[0], array( 'P', '+', '-' )))) {
+              if( 'P' != $rPeriod[0] )
+                $rPeriod  = substr( $rPeriod, 1 );
+              $inputab    = iCalUtilityFunctions::_duration_string( $rPeriod );
+            }
+            elseif( 8 <= strlen( trim( $rPeriod )))              // text date ex. 2006-08-03 10:12:18
+              $inputab    = iCalUtilityFunctions::_date_time_string( $rPeriod, $parno );
+            if(  isset( $input['params']['TZID'] ) ||
+               ( isset( $inputab['tz'] )   && !iCalUtilityFunctions::_isOffset( $inputab['tz'] )) ||
+               ( isset( $inputa[0] )       && ( !isset( $inputa[0]['tz'] )))       ||
+               ( isset( $inputa[0]['tz'] ) && !iCalUtilityFunctions::_isOffset( $inputa[0]['tz'] )))
+              unset( $inputab['tz'] );
+            $inputa[]     = $inputab;
+          }
+        } // PERIOD end
+        elseif ( iCalUtilityFunctions::_isArrayTimestampDate( $theRdate ))      // timestamp
+          $inputa = iCalUtilityFunctions::_timestamp2date( $theRdate, $parno );
+        else                                                                    // date[-time]
+          $inputa = iCalUtilityFunctions::_date_time_array( $theRdate, $parno );
+      }
+      elseif( 8 <= strlen( trim( $theRdate )))                   // text date ex. 2006-08-03 10:12:18
+        $inputa       = iCalUtilityFunctions::_date_time_string( $theRdate, $parno );
+      if( !isset( $input['params']['VALUE'] ) || ( 'PERIOD' != $input['params']['VALUE'] )) { // no PERIOD
+        if( 3 == $parno )
+          unset( $inputa['hour'], $inputa['min'], $inputa['sec'], $inputa['tz'] );
+        elseif( isset( $inputa['tz'] ))
+          $inputa['tz'] = (string) $inputa['tz'];
+        if(  isset( $input['params']['TZID'] ) ||
+           ( isset( $inputa['tz'] )            && !iCalUtilityFunctions::_isOffset( $inputa['tz'] ))     ||
+           ( isset( $input['value'][0] )       && ( !isset( $input['value'][0]['tz'] )))  ||
+           ( isset( $input['value'][0]['tz'] ) && !iCalUtilityFunctions::_isOffset( $input['value'][0]['tz'] )))
+          unset( $inputa['tz'] );
+      }
+      $input['value'][] = $inputa;
+    }
+    if( 3 == $parno ) {
+      $input['params']['VALUE'] = 'DATE';
+      unset( $input['params']['TZID'] );
+    }
+    iCalUtilityFunctions::_setMval( $this->rdate, $input['value'], $input['params'], FALSE, $index );
+    return TRUE;
+  }
+/*********************************************************************************/
+/**
+ * Property Name: RECURRENCE-ID
+ */
+/**
+ * creates formatted output for calendar component property recurrence-id
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.9.6 - 2011-05-15
+ * @return string
+ */
+  function createRecurrenceid() {
+    if( empty( $this->recurrenceid )) return FALSE;
+    if( empty( $this->recurrenceid['value'] ))
+      return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'RECURRENCE-ID' ) : FALSE;
+    $formatted  = iCalUtilityFunctions::_format_date_time( $this->recurrenceid['value'] );
+    if(( FALSE !== ( $tzid = $this->getConfig( 'TZID' ))) &&
+       ( !isset( $this->recurrenceid['params']['VALUE'] ) || ( $this->recurrenceid['params']['VALUE'] != 'DATE' ))  &&
+         !isset( $this->recurrenceid['params']['TZID'] ))
+      $this->recurrenceid['params']['TZID'] = $tzid;
+    $attributes = $this->_createParams( $this->recurrenceid['params'] );
+    return $this->_createElement( 'RECURRENCE-ID', $attributes, $formatted );
+  }
+/**
+ * set calendar component property recurrence-id
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.9.6 - 2011-05-15
+ * @param mixed $year
+ * @param mixed $month optional
+ * @param int $day optional
+ * @param int $hour optional
+ * @param int $min optional
+ * @param int $sec optional
+ * @param array $params optional
+ * @return bool
+ */
+  function setRecurrenceid( $year, $month=FALSE, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $tz=FALSE, $params=FALSE ) {
+    if( empty( $year )) {
+      if( $this->getConfig( 'allowEmpty' )) {
+        $this->recurrenceid = array( 'value' => null, 'params' => null );
+        return TRUE;
+      }
+      else
+        return FALSE;
+    }
+    $this->recurrenceid = iCalUtilityFunctions::_setDate( $year, $month, $day, $hour, $min, $sec, $tz, $params, null, null, $this->getConfig( 'TZID' ));
+    return TRUE;
+  }
+/*********************************************************************************/
+/**
+ * Property Name: RELATED-TO
+ */
+/**
+ * creates formatted output for calendar component property related-to
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-10-23
+ * @return string
+ */
+  function createRelatedTo() {
+    if( empty( $this->relatedto )) return FALSE;
+    $output = null;
+    foreach( $this->relatedto as $relation ) {
+      if( empty( $relation['value'] )) {
+        if( $this->getConfig( 'allowEmpty' )) $output.= $this->_createElement( 'RELATED-TO', $this->_createParams( $relation['params'] ));
+        continue;
+      }
+      $attributes = $this->_createParams( $relation['params'] );
+      $content    = ( 'xcal' != $this->format ) ? '<' : '';
+      $content   .= $this->_strrep( $relation['value'] );
+      $content   .= ( 'xcal' != $this->format ) ? '>' : '';
+      $output    .= $this->_createElement( 'RELATED-TO', $attributes, $content );
+    }
+    return $output;
+  }
+/**
+ * set calendar component property related-to
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.5.1 - 2008-11-07
+ * @param float $relid
+ * @param array $params, optional
+ * @param index $index, optional
+ * @return bool
+ */
+  function setRelatedTo( $value, $params=FALSE, $index=FALSE ) {
+    if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
+    if(( '<' == substr( $value, 0, 1 )) && ( '>' == substr( $value, -1 )))
+      $value = substr( $value, 1, ( strlen( $value ) - 2 ));
+    iCalUtilityFunctions::_existRem( $params, 'RELTYPE', 'PARENT', TRUE ); // remove default
+    iCalUtilityFunctions::_setMval( $this->relatedto, $value, $params, FALSE, $index );
+    return TRUE;
+  }
+/*********************************************************************************/
+/**
+ * Property Name: REPEAT
+ */
+/**
+ * creates formatted output for calendar component property repeat
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.9.3 - 2011-05-14
+ * @return string
+ */
+  function createRepeat() {
+    if( !isset( $this->repeat ) || ( empty( $this->repeat ) && !is_numeric( $this->repeat ))) return FALSE;
+    if( !isset( $this->repeat['value']) || ( empty( $this->repeat['value'] ) && !is_numeric( $this->repeat['value'] )))
+      return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'REPEAT' ) : FALSE;
+    $attributes = $this->_createParams( $this->repeat['params'] );
+    return $this->_createElement( 'REPEAT', $attributes, $this->repeat['value'] );
+  }
+/**
+ * set calendar component property transp
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.9.3 - 2011-05-14
+ * @param string $value
+ * @param array $params optional
+ * @return void
+ */
+  function setRepeat( $value, $params=FALSE ) {
+    if( empty( $value ) && !is_numeric( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
+    $this->repeat = array( 'value' => $value, 'params' => iCalUtilityFunctions::_setParams( $params ));
+    return TRUE;
+  }
+/*********************************************************************************/
+/**
+ * Property Name: REQUEST-STATUS
+ */
+/**
+ * creates formatted output for calendar component property request-status
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-10-23
+ * @return string
+ */
+  function createRequestStatus() {
+    if( empty( $this->requeststatus )) return FALSE;
+    $output = null;
+    foreach( $this->requeststatus as $rstat ) {
+      if( empty( $rstat['value']['statcode'] )) {
+        if( $this->getConfig( 'allowEmpty' )) $output .= $this->_createElement( 'REQUEST-STATUS' );
+        continue;
+      }
+      $attributes  = $this->_createParams( $rstat['params'], array( 'LANGUAGE' ));
+      $content     = number_format( (float) $rstat['value']['statcode'], 2, '.', '');
+      $content    .= ';'.$this->_strrep( $rstat['value']['text'] );
+      if( isset( $rstat['value']['extdata'] ))
+        $content  .= ';'.$this->_strrep( $rstat['value']['extdata'] );
+      $output     .= $this->_createElement( 'REQUEST-STATUS', $attributes, $content );
+    }
+    return $output;
+  }
+/**
+ * set calendar component property request-status
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.5.1 - 2008-11-05
+ * @param float $statcode
+ * @param string $text
+ * @param string $extdata, optional
+ * @param array $params, optional
+ * @param integer $index, optional
+ * @return bool
+ */
+  function setRequestStatus( $statcode, $text, $extdata=FALSE, $params=FALSE, $index=FALSE ) {
+    if( empty( $statcode ) || empty( $text )) if( $this->getConfig( 'allowEmpty' )) $statcode = $text = null; else return FALSE;
+    $input              = array( 'statcode' => $statcode, 'text' => $text );
+    if( $extdata )
+      $input['extdata'] = $extdata;
+    iCalUtilityFunctions::_setMval( $this->requeststatus, $input, $params, FALSE, $index );
+    return TRUE;
+  }
+/*********************************************************************************/
+/**
+ * Property Name: RESOURCES
+ */
+/**
+ * creates formatted output for calendar component property resources
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-10-23
+ * @return string
+ */
+  function createResources() {
+    if( empty( $this->resources )) return FALSE;
+    $output = null;
+    foreach( $this->resources as $resource ) {
+      if( empty( $resource['value'] )) {
+        if( $this->getConfig( 'allowEmpty' )) $output .= $this->_createElement( 'RESOURCES' );
+        continue;
+      }
+      $attributes  = $this->_createParams( $resource['params'], array( 'ALTREP', 'LANGUAGE' ));
+      if( is_array( $resource['value'] )) {
+        foreach( $resource['value'] as $rix => $resourcePart )
+          $resource['value'][$rix] = $this->_strrep( $resourcePart );
+        $content   = implode( ',', $resource['value'] );
+      }
+      else
+        $content   = $this->_strrep( $resource['value'] );
+      $output     .= $this->_createElement( 'RESOURCES', $attributes, $content );
+    }
+    return $output;
+  }
+/**
+ * set calendar component property recources
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.5.1 - 2008-11-05
+ * @param mixed $value
+ * @param array $params, optional
+ * @param integer $index, optional
+ * @return bool
+ */
+  function setResources( $value, $params=FALSE, $index=FALSE ) {
+    if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
+    iCalUtilityFunctions::_setMval( $this->resources, $value, $params, FALSE, $index );
+    return TRUE;
+  }
+/*********************************************************************************/
+/**
+ * Property Name: RRULE
+ */
+/**
+ * creates formatted output for calendar component property rrule
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-10-21
+ * @return string
+ */
+  function createRrule() {
+    if( empty( $this->rrule )) return FALSE;
+    return $this->_format_recur( 'RRULE', $this->rrule );
+  }
+/**
+ * set calendar component property rrule
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.5.1 - 2008-11-05
+ * @param array $rruleset
+ * @param array $params, optional
+ * @param integer $index, optional
+ * @return void
+ */
+  function setRrule( $rruleset, $params=FALSE, $index=FALSE ) {
+    if( empty( $rruleset )) if( $this->getConfig( 'allowEmpty' )) $rruleset = null; else return FALSE;
+    iCalUtilityFunctions::_setMval( $this->rrule, iCalUtilityFunctions::_setRexrule( $rruleset ), $params, FALSE, $index );
+    return TRUE;
+  }
+/*********************************************************************************/
+/**
+ * Property Name: SEQUENCE
+ */
+/**
+ * creates formatted output for calendar component property sequence
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.9.3 - 2011-05-14
+ * @return string
+ */
+  function createSequence() {
+    if( !isset( $this->sequence ) || ( empty( $this->sequence ) && !is_numeric( $this->sequence ))) return FALSE;
+    if(( !isset($this->sequence['value'] ) || ( empty( $this->sequence['value'] ) && !is_numeric( $this->sequence['value'] ))) &&
+       ( '0' != $this->sequence['value'] ))
+      return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'SEQUENCE' ) : FALSE;
+    $attributes = $this->_createParams( $this->sequence['params'] );
+    return $this->_createElement( 'SEQUENCE', $attributes, $this->sequence['value'] );
+  }
+/**
+ * set calendar component property sequence
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.9.3 - 2011-05-14
+ * @param int $value optional
+ * @param array $params optional
+ * @return bool
+ */
+  function setSequence( $value=FALSE, $params=FALSE ) {
+    if(( empty( $value ) && !is_numeric( $value )) && ( '0' != $value ))
+      $value = ( isset( $this->sequence['value'] ) && ( 0 < $this->sequence['value'] )) ? $this->sequence['value'] + 1 : 1;
+    $this->sequence = array( 'value' => $value, 'params' => iCalUtilityFunctions::_setParams( $params ));
+    return TRUE;
+  }
+/*********************************************************************************/
+/**
+ * Property Name: STATUS
+ */
+/**
+ * creates formatted output for calendar component property status
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-10-21
+ * @return string
+ */
+  function createStatus() {
+    if( empty( $this->status )) return FALSE;
+    if( empty( $this->status['value'] ))
+      return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'STATUS' ) : FALSE;
+    $attributes = $this->_createParams( $this->status['params'] );
+    return $this->_createElement( 'STATUS', $attributes, $this->status['value'] );
+  }
+/**
+ * set calendar component property status
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-11-04
+ * @param string $value
+ * @param array $params optional
+ * @return bool
+ */
+  function setStatus( $value, $params=FALSE ) {
+    if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
+    $this->status = array( 'value' => $value, 'params' => iCalUtilityFunctions::_setParams( $params ));
+    return TRUE;
+  }
+/*********************************************************************************/
+/**
+ * Property Name: SUMMARY
+ */
+/**
+ * creates formatted output for calendar component property summary
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-10-21
+ * @return string
+ */
+  function createSummary() {
+    if( empty( $this->summary )) return FALSE;
+    if( empty( $this->summary['value'] ))
+      return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'SUMMARY' ) : FALSE;
+    $attributes = $this->_createParams( $this->summary['params'], array( 'ALTREP', 'LANGUAGE' ));
+    $content    = $this->_strrep( $this->summary['value'] );
+    return $this->_createElement( 'SUMMARY', $attributes, $content );
+  }
+/**
+ * set calendar component property summary
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-11-04
+ * @param string $value
+ * @param string $params optional
+ * @return bool
+ */
+  function setSummary( $value, $params=FALSE ) {
+    if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
+    $this->summary = array( 'value' => $value, 'params' => iCalUtilityFunctions::_setParams( $params ));
+    return TRUE;
+  }
+/*********************************************************************************/
+/**
+ * Property Name: TRANSP
+ */
+/**
+ * creates formatted output for calendar component property transp
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-10-21
+ * @return string
+ */
+  function createTransp() {
+    if( empty( $this->transp )) return FALSE;
+    if( empty( $this->transp['value'] ))
+      return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'TRANSP' ) : FALSE;
+    $attributes = $this->_createParams( $this->transp['params'] );
+    return $this->_createElement( 'TRANSP', $attributes, $this->transp['value'] );
+  }
+/**
+ * set calendar component property transp
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-11-04
+ * @param string $value
+ * @param string $params optional
+ * @return bool
+ */
+  function setTransp( $value, $params=FALSE ) {
+    if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
+    $this->transp = array( 'value' => $value, 'params' => iCalUtilityFunctions::_setParams( $params ));
+    return TRUE;
+  }
+/*********************************************************************************/
+/**
+ * Property Name: TRIGGER
+ */
+/**
+ * creates formatted output for calendar component property trigger
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.16 - 2008-10-21
+ * @return string
+ */
+  function createTrigger() {
+    if( empty( $this->trigger )) return FALSE;
+    if( empty( $this->trigger['value'] ))
+      return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'TRIGGER' ) : FALSE;
+    $content = $attributes = null;
+    if( isset( $this->trigger['value']['year'] )   &&
+        isset( $this->trigger['value']['month'] )  &&
+        isset( $this->trigger['value']['day'] ))
+      $content      .= iCalUtilityFunctions::_format_date_time( $this->trigger['value'] );
+    else {
+      if( TRUE !== $this->trigger['value']['relatedStart'] )
+        $attributes .= $this->intAttrDelimiter.'RELATED=END';
+      if( $this->trigger['value']['before'] )
+        $content    .= '-';
+      $content      .= iCalUtilityFunctions::_format_duration( $this->trigger['value'] );
+    }
+    $attributes     .= $this->_createParams( $this->trigger['params'] );
+    return $this->_createElement( 'TRIGGER', $attributes, $content );
+  }
+/**
+ * set calendar component property trigger
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.9.9 - 2011-06-17
+ * @param mixed $year
+ * @param mixed $month optional
+ * @param int $day optional
+ * @param int $week optional
+ * @param int $hour optional
+ * @param int $min optional
+ * @param int $sec optional
+ * @param bool $relatedStart optional
+ * @param bool $before optional
+ * @param array $params optional
+ * @return bool
+ */
+  function setTrigger( $year, $month=null, $day=null, $week=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $relatedStart=TRUE, $before=TRUE, $params=FALSE ) {
+    if( empty( $year ) && empty( $month ) && empty( $day ) && empty( $week ) && empty( $hour ) && empty( $min ) && empty( $sec ))
+      if( $this->getConfig( 'allowEmpty' )) {
+        $this->trigger = array( 'value' => null, 'params' => iCalUtilityFunctions::_setParams( $params ) );
+        return TRUE;
+      }
+      else
+        return FALSE;
+    if( iCalUtilityFunctions::_isArrayTimestampDate( $year )) { // timestamp
+      $params = iCalUtilityFunctions::_setParams( $month );
+      $date   = iCalUtilityFunctions::_timestamp2date( $year, 7 );
+      foreach( $date as $k => $v )
+        $$k = $v;
+    }
+    elseif( is_array( $year ) && ( is_array( $month ) || empty( $month ))) {
+      $params = iCalUtilityFunctions::_setParams( $month );
+      if(!(array_key_exists( 'year',  $year ) &&   // exclude date-time
+           array_key_exists( 'month', $year ) &&
+           array_key_exists( 'day',   $year ))) {  // when this must be a duration
+        if( isset( $params['RELATED'] ) && ( 'END' == strtoupper( $params['RELATED'] )))
+          $relatedStart = FALSE;
+        else
+          $relatedStart = ( array_key_exists( 'relatedStart', $year ) && ( TRUE !== $year['relatedStart'] )) ? FALSE : TRUE;
+        $before         = ( array_key_exists( 'before', $year )       && ( TRUE !== $year['before'] ))       ? FALSE : TRUE;
+      }
+      $SSYY  = ( array_key_exists( 'year',  $year )) ? $year['year']  : null;
+      $month = ( array_key_exists( 'month', $year )) ? $year['month'] : null;
+      $day   = ( array_key_exists( 'day',   $year )) ? $year['day']   : null;
+      $week  = ( array_key_exists( 'week',  $year )) ? $year['week']  : null;
+      $hour  = ( array_key_exists( 'hour',  $year )) ? $year['hour']  : 0; //null;
+      $min   = ( array_key_exists( 'min',   $year )) ? $year['min']   : 0; //null;
+      $sec   = ( array_key_exists( 'sec',   $year )) ? $year['sec']   : 0; //null;
+      $year  = $SSYY;
+    }
+    elseif(is_string( $year ) && ( is_array( $month ) || empty( $month ))) {  // duration or date in a string
+      $params = iCalUtilityFunctions::_setParams( $month );
+      if( in_array( $year[0], array( 'P', '+', '-' ))) { // duration
+        $relatedStart = ( isset( $params['RELATED'] ) && ( 'END' == strtoupper( $params['RELATED'] ))) ? FALSE : TRUE;
+        $before       = ( '-'  == $year[0] ) ? TRUE : FALSE;
+        if(     'P'  != $year[0] )
+          $year       = substr( $year, 1 );
+        $date         = iCalUtilityFunctions::_duration_string( $year);
+      }
+      else   // date
+        $date    = iCalUtilityFunctions::_date_time_string( $year, 7 );
+      unset( $year, $month, $day );
+      if( empty( $date ))
+        $sec = 0;
+      else
+        foreach( $date as $k => $v )
+          $$k = $v;
+    }
+    else // single values in function input parameters
+      $params = iCalUtilityFunctions::_setParams( $params );
+    if( !empty( $year ) && !empty( $month ) && !empty( $day )) { // date
+      $params['VALUE'] = 'DATE-TIME';
+      $hour = ( $hour ) ? $hour : 0;
+      $min  = ( $min  ) ? $min  : 0;
+      $sec  = ( $sec  ) ? $sec  : 0;
+      $this->trigger = array( 'params' => $params );
+      $this->trigger['value'] = array( 'year'  => $year
+                                     , 'month' => $month
+                                     , 'day'   => $day
+                                     , 'hour'  => $hour
+                                     , 'min'   => $min
+                                     , 'sec'   => $sec
+                                     , 'tz'    => 'Z' );
+      return TRUE;
+    }
+    elseif(( empty( $year ) && empty( $month )) &&    // duration
+           (( !empty( $week ) || ( 0 == $week )) ||
+            ( !empty( $day )  || ( 0 == $day  )) ||
+            ( !empty( $hour ) || ( 0 == $hour )) ||
+            ( !empty( $min )  || ( 0 == $min  )) ||
+            ( !empty( $sec )  || ( 0 == $sec  )))) {
+      unset( $params['RELATED'] ); // set at output creation (END only)
+      unset( $params['VALUE'] );   // 'DURATION' default
+      $this->trigger = array( 'params' => $params );
+      $this->trigger['value']  = array();
+      if( !empty( $week )) $this->trigger['value']['week'] = $week;
+      if( !empty( $day  )) $this->trigger['value']['day']  = $day;
+      if( !empty( $hour )) $this->trigger['value']['hour'] = $hour;
+      if( !empty( $min  )) $this->trigger['value']['min']  = $min;
+      if( !empty( $sec  )) $this->trigger['value']['sec']  = $sec;
+      if( empty( $this->trigger['value'] )) {
+        $this->trigger['value']['sec'] = 0;
+        $before                        = FALSE;
+      }
+      $relatedStart = ( FALSE !== $relatedStart ) ? TRUE : FALSE;
+      $before       = ( FALSE !== $before )       ? TRUE : FALSE;
+      $this->trigger['value']['relatedStart'] = $relatedStart;
+      $this->trigger['value']['before']       = $before;
+      return TRUE;
+    }
+    return FALSE;
+  }
+/*********************************************************************************/
+/**
+ * Property Name: TZID
+ */
+/**
+ * creates formatted output for calendar component property tzid
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-10-21
+ * @return string
+ */
+  function createTzid() {
+    if( empty( $this->tzid )) return FALSE;
+    if( empty( $this->tzid['value'] ))
+      return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'TZID' ) : FALSE;
+    $attributes = $this->_createParams( $this->tzid['params'] );
+    return $this->_createElement( 'TZID', $attributes, $this->_strrep( $this->tzid['value'] ));
+  }
+/**
+ * set calendar component property tzid
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-11-04
+ * @param string $value
+ * @param array $params optional
+ * @return bool
+ */
+  function setTzid( $value, $params=FALSE ) {
+    if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
+    $this->tzid = array( 'value' => $value, 'params' => iCalUtilityFunctions::_setParams( $params ));
+    return TRUE;
+  }
+/*********************************************************************************/
+/**
+ * .. .
+ * Property Name: TZNAME
+ */
+/**
+ * creates formatted output for calendar component property tzname
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-10-21
+ * @return string
+ */
+  function createTzname() {
+    if( empty( $this->tzname )) return FALSE;
+    $output = null;
+    foreach( $this->tzname as $theName ) {
+      if( !empty( $theName['value'] )) {
+        $attributes = $this->_createParams( $theName['params'], array( 'LANGUAGE' ));
+        $output    .= $this->_createElement( 'TZNAME', $attributes, $this->_strrep( $theName['value'] ));
+      }
+      elseif( $this->getConfig( 'allowEmpty' )) $output .= $this->_createElement( 'TZNAME' );
+    }
+    return $output;
+  }
+/**
+ * set calendar component property tzname
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.5.1 - 2008-11-05
+ * @param string $value
+ * @param string $params, optional
+ * @param integer $index, optional
+ * @return bool
+ */
+  function setTzname( $value, $params=FALSE, $index=FALSE ) {
+    if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
+    iCalUtilityFunctions::_setMval( $this->tzname, $value, $params, FALSE, $index );
+    return TRUE;
+  }
+/*********************************************************************************/
+/**
+ * Property Name: TZOFFSETFROM
+ */
+/**
+ * creates formatted output for calendar component property tzoffsetfrom
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-10-21
+ * @return string
+ */
+  function createTzoffsetfrom() {
+    if( empty( $this->tzoffsetfrom )) return FALSE;
+    if( empty( $this->tzoffsetfrom['value'] ))
+      return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'TZOFFSETFROM' ) : FALSE;
+    $attributes = $this->_createParams( $this->tzoffsetfrom['params'] );
+    return $this->_createElement( 'TZOFFSETFROM', $attributes, $this->tzoffsetfrom['value'] );
+  }
+/**
+ * set calendar component property tzoffsetfrom
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-11-04
+ * @param string $value
+ * @param string $params optional
+ * @return bool
+ */
+  function setTzoffsetfrom( $value, $params=FALSE ) {
+    if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
+    $this->tzoffsetfrom = array( 'value' => $value, 'params' => iCalUtilityFunctions::_setParams( $params ));
+    return TRUE;
+  }
+/*********************************************************************************/
+/**
+ * Property Name: TZOFFSETTO
+ */
+/**
+ * creates formatted output for calendar component property tzoffsetto
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-10-21
+ * @return string
+ */
+  function createTzoffsetto() {
+    if( empty( $this->tzoffsetto )) return FALSE;
+    if( empty( $this->tzoffsetto['value'] ))
+      return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'TZOFFSETTO' ) : FALSE;
+    $attributes = $this->_createParams( $this->tzoffsetto['params'] );
+    return $this->_createElement( 'TZOFFSETTO', $attributes, $this->tzoffsetto['value'] );
+  }
+/**
+ * set calendar component property tzoffsetto
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-11-04
+ * @param string $value
+ * @param string $params optional
+ * @return bool
+ */
+  function setTzoffsetto( $value, $params=FALSE ) {
+    if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
+    $this->tzoffsetto = array( 'value' => $value, 'params' => iCalUtilityFunctions::_setParams( $params ));
+    return TRUE;
+  }
+/*********************************************************************************/
+/**
+ * Property Name: TZURL
+ */
+/**
+ * creates formatted output for calendar component property tzurl
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-10-21
+ * @return string
+ */
+  function createTzurl() {
+    if( empty( $this->tzurl )) return FALSE;
+    if( empty( $this->tzurl['value'] ))
+      return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'TZURL' ) : FALSE;
+    $attributes = $this->_createParams( $this->tzurl['params'] );
+    return $this->_createElement( 'TZURL', $attributes, $this->tzurl['value'] );
+  }
+/**
+ * set calendar component property tzurl
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-11-04
+ * @param string $value
+ * @param string $params optional
+ * @return boll
+ */
+  function setTzurl( $value, $params=FALSE ) {
+    if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
+    $this->tzurl = array( 'value' => $value, 'params' => iCalUtilityFunctions::_setParams( $params ));
+    return TRUE;
+  }
+/*********************************************************************************/
+/**
+ * Property Name: UID
+ */
+/**
+ * creates formatted output for calendar component property uid
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 0.9.7 - 2006-11-20
+ * @return string
+ */
+  function createUid() {
+    if( 0 >= count( $this->uid ))
+      $this->_makeuid();
+    $attributes = $this->_createParams( $this->uid['params'] );
+    return $this->_createElement( 'UID', $attributes, $this->uid['value'] );
+  }
+/**
+ * create an unique id for this calendar component object instance
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.2.7 - 2007-09-04
+ * @return void
+ */
+  function _makeUid() {
+    $date   = date('Ymd\THisT');
+    $unique = substr(microtime(), 2, 4);
+    $base   = 'aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPrRsStTuUvVxXuUvVwWzZ1234567890';
+    $start  = 0;
+    $end    = strlen( $base ) - 1;
+    $length = 6;
+    $str    = null;
+    for( $p = 0; $p < $length; $p++ )
+      $unique .= $base{mt_rand( $start, $end )};
+    $this->uid = array( 'params' => null );
+    $this->uid['value']  = $date.'-'.$unique.'@'.$this->getConfig( 'unique_id' );
+  }
+/**
+ * set calendar component property uid
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-11-04
+ * @param string $value
+ * @param string $params optional
+ * @return bool
+ */
+  function setUid( $value, $params=FALSE ) {
+    if( empty( $value )) return FALSE; // no allowEmpty check here !!!!
+    $this->uid = array( 'value' => $value, 'params' => iCalUtilityFunctions::_setParams( $params ));
+    return TRUE;
+  }
+/*********************************************************************************/
+/**
+ * Property Name: URL
+ */
+/**
+ * creates formatted output for calendar component property url
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-10-21
+ * @return string
+ */
+  function createUrl() {
+    if( empty( $this->url )) return FALSE;
+    if( empty( $this->url['value'] ))
+      return ( $this->getConfig( 'allowEmpty' )) ? $this->_createElement( 'URL' ) : FALSE;
+    $attributes = $this->_createParams( $this->url['params'] );
+    return $this->_createElement( 'URL', $attributes, $this->url['value'] );
+  }
+/**
+ * set calendar component property url
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-11-04
+ * @param string $value
+ * @param string $params optional
+ * @return bool
+ */
+  function setUrl( $value, $params=FALSE ) {
+    if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
+    $this->url = array( 'value' => $value, 'params' => iCalUtilityFunctions::_setParams( $params ));
+    return TRUE;
+  }
+/*********************************************************************************/
+/**
+ * Property Name: x-prop
+ */
+/**
+ * creates formatted output for calendar component property x-prop
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.9.3 - 2011-05-14
+ * @return string
+ */
+  function createXprop() {
+    if( empty( $this->xprop )) return FALSE;
+    $output = null;
+    foreach( $this->xprop as $label => $xpropPart ) {
+      if( !isset($xpropPart['value']) || ( empty( $xpropPart['value'] ) && !is_numeric( $xpropPart['value'] ))) {
+        if( $this->getConfig( 'allowEmpty' )) $output .= $this->_createElement( $label );
+        continue;
+      }
+      $attributes = $this->_createParams( $xpropPart['params'], array( 'LANGUAGE' ));
+      if( is_array( $xpropPart['value'] )) {
+        foreach( $xpropPart['value'] as $pix => $theXpart )
+          $xpropPart['value'][$pix] = $this->_strrep( $theXpart );
+        $xpropPart['value']  = implode( ',', $xpropPart['value'] );
+      }
+      else
+        $xpropPart['value'] = $this->_strrep( $xpropPart['value'] );
+      $output    .= $this->_createElement( $label, $attributes, $xpropPart['value'] );
+    }
+    return $output;
+  }
+/**
+ * set calendar component property x-prop
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.9.3 - 2011-05-14
+ * @param string $label
+ * @param mixed $value
+ * @param array $params optional
+ * @return bool
+ */
+  function setXprop( $label, $value, $params=FALSE ) {
+    if( empty( $label )) return;
+    if( empty( $value ) && !is_numeric( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE;
+    $xprop           = array( 'value' => $value );
+    $xprop['params'] = iCalUtilityFunctions::_setParams( $params );
+    if( !is_array( $this->xprop )) $this->xprop = array();
+    $this->xprop[strtoupper( $label )] = $xprop;
+    return TRUE;
+  }
+/*********************************************************************************/
+/*********************************************************************************/
+/**
+ * create element format parts
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.0.6 - 2006-06-20
+ * @return string
+ */
+  function _createFormat() {
+    $objectname                   = null;
+    switch( $this->format ) {
+      case 'xcal':
+        $objectname               = ( isset( $this->timezonetype )) ?
+                                 strtolower( $this->timezonetype )  :  strtolower( $this->objName );
+        $this->componentStart1    = $this->elementStart1 = '<';
+        $this->componentStart2    = $this->elementStart2 = '>';
+        $this->componentEnd1      = $this->elementEnd1   = '</';
+        $this->componentEnd2      = $this->elementEnd2   = '>'.$this->nl;
+        $this->intAttrDelimiter   = '<!-- -->';
+        $this->attributeDelimiter = $this->nl;
+        $this->valueInit          = null;
+        break;
+      default:
+        $objectname               = ( isset( $this->timezonetype )) ?
+                                 strtoupper( $this->timezonetype )  :  strtoupper( $this->objName );
+        $this->componentStart1    = 'BEGIN:';
+        $this->componentStart2    = null;
+        $this->componentEnd1      = 'END:';
+        $this->componentEnd2      = $this->nl;
+        $this->elementStart1      = null;
+        $this->elementStart2      = null;
+        $this->elementEnd1        = null;
+        $this->elementEnd2        = $this->nl;
+        $this->intAttrDelimiter   = '<!-- -->';
+        $this->attributeDelimiter = ';';
+        $this->valueInit          = ':';
+        break;
+    }
+    return $objectname;
+  }
+/**
+ * creates formatted output for calendar component property
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.6.22 - 2010-12-06
+ * @param string $label property name
+ * @param string $attributes property attributes
+ * @param string $content property content (optional)
+ * @return string
+ */
+  function _createElement( $label, $attributes=null, $content=FALSE ) {
+    switch( $this->format ) {
+      case 'xcal':
+        $label = strtolower( $label );
+        break;
+      default:
+        $label = strtoupper( $label );
+        break;
+    }
+    $output = $this->elementStart1.$label;
+    $categoriesAttrLang = null;
+    $attachInlineBinary = FALSE;
+    $attachfmttype      = null;
+    if( !empty( $attributes ))  {
+      $attributes  = trim( $attributes );
+      if ( 'xcal' == $this->format) {
+        $attributes2 = explode( $this->intAttrDelimiter, $attributes );
+        $attributes  = null;
+        foreach( $attributes2 as $attribute ) {
+          $attrKVarr = explode( '=', $attribute );
+          if( empty( $attrKVarr[0] ))
+            continue;
+          if( !isset( $attrKVarr[1] )) {
+            $attrValue = $attrKVarr[0];
+            $attrKey   = null;
+          }
+          elseif( 2 == count( $attrKVarr)) {
+            $attrKey   = strtolower( $attrKVarr[0] );
+            $attrValue = $attrKVarr[1];
+          }
+          else {
+            $attrKey   = strtolower( $attrKVarr[0] );
+            unset( $attrKVarr[0] );
+            $attrValue = implode( '=', $attrKVarr );
+          }
+          if(( 'attach' == $label ) && ( in_array( $attrKey, array( 'fmttype', 'encoding', 'value' )))) {
+            $attachInlineBinary = TRUE;
+            if( 'fmttype' == $attrKey )
+              $attachfmttype = $attrKey.'='.$attrValue;
+            continue;
+          }
+          elseif(( 'categories' == $label ) && ( 'language' == $attrKey ))
+            $categoriesAttrLang = $attrKey.'='.$attrValue;
+          else {
+            $attributes .= ( empty( $attributes )) ? ' ' : $this->attributeDelimiter.' ';
+            $attributes .= ( !empty( $attrKey )) ? $attrKey.'=' : null;
+            if(( '"' == substr( $attrValue, 0, 1 )) && ( '"' == substr( $attrValue, -1 ))) {
+              $attrValue = substr( $attrValue, 1, ( strlen( $attrValue ) - 2 ));
+              $attrValue = str_replace( '"', '', $attrValue );
+            }
+            $attributes .= '"'.htmlspecialchars( $attrValue ).'"';
+          }
+        }
+      }
+      else {
+        $attributes = str_replace( $this->intAttrDelimiter, $this->attributeDelimiter, $attributes );
+      }
+    }
+    if(((( 'attach' == $label ) && !$attachInlineBinary ) ||
+         ( in_array( $label, array( 'tzurl', 'url' ))))      && ( 'xcal' == $this->format)) {
+      $pos = strrpos($content, "/");
+      $docname = ( $pos !== false) ? substr( $content, (1 - strlen( $content ) + $pos )) : $content;
+      $this->xcaldecl[] = array( 'xmldecl'  => 'ENTITY'
+                               , 'uri'      => $docname
+                               , 'ref'      => 'SYSTEM'
+                               , 'external' => $content
+                               , 'type'     => 'NDATA'
+                               , 'type2'    => 'BINERY' );
+      $attributes .= ( empty( $attributes )) ? ' ' : $this->attributeDelimiter.' ';
+      $attributes .= 'uri="'.$docname.'"';
+      $content = null;
+      if( 'attach' == $label ) {
+        $attributes = str_replace( $this->attributeDelimiter, $this->intAttrDelimiter, $attributes );
+        $content = $this->_createElement( 'extref', $attributes, null );
+        $attributes = null;
+      }
+    }
+    elseif(( 'attach' == $label ) && $attachInlineBinary && ( 'xcal' == $this->format)) {
+      $content = $this->nl.$this->_createElement( 'b64bin', $attachfmttype, $content ); // max one attribute
+    }
+    $output .= $attributes;
+    if( !$content && ( '0' != $content )) {
+      switch( $this->format ) {
+        case 'xcal':
+          $output .= ' /';
+          $output .= $this->elementStart2;
+          return $output;
+          break;
+        default:
+          $output .= $this->elementStart2.$this->valueInit;
+          return $this->_size75( $output );
+          break;
+      }
+    }
+    $output .= $this->elementStart2;
+    $output .= $this->valueInit.$content;
+    switch( $this->format ) {
+      case 'xcal':
+        return $output.$this->elementEnd1.$label.$this->elementEnd2;
+        break;
+      default:
+        return $this->_size75( $output );
+        break;
+    }
+  }
+/**
+ * creates formatted output for calendar component property parameters
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.6.33 - 2010-12-18
+ * @param array $params  optional
+ * @param array $ctrKeys optional
+ * @return string
+ */
+  function _createParams( $params=array(), $ctrKeys=array() ) {
+    if( !is_array( $params ) || empty( $params ))
+      $params = array();
+    $attrLANG = $attr1 = $attr2 = $lang = null;
+    $CNattrKey   = ( in_array( 'CN',       $ctrKeys )) ? TRUE : FALSE ;
+    $LANGattrKey = ( in_array( 'LANGUAGE', $ctrKeys )) ? TRUE : FALSE ;
+    $CNattrExist = $LANGattrExist = FALSE;
+    $xparams = array();
+    foreach( $params as $paramKey => $paramValue ) {
+      if( ctype_digit( (string) $paramKey )) {
+        $xparams[]          = $paramValue;
+        continue;
+      }
+      $paramKey             = strtoupper( $paramKey );
+      if( !in_array( $paramKey, array( 'ALTREP', 'CN', 'DIR', 'ENCODING', 'FMTTYPE', 'LANGUAGE', 'RANGE', 'RELTYPE', 'SENT-BY', 'TZID', 'VALUE' )))
+        $xparams[$paramKey] = $paramValue;
+      else
+        $params[$paramKey]  = $paramValue;
+    }
+    ksort( $xparams, SORT_STRING );
+    foreach( $xparams as $paramKey => $paramValue ) {
+      if( ctype_digit( (string) $paramKey ))
+        $attr2             .= $this->intAttrDelimiter.$paramValue;
+      else
+        $attr2             .= $this->intAttrDelimiter."$paramKey=$paramValue";
+    }
+    if( isset( $params['FMTTYPE'] )  && !in_array( 'FMTTYPE', $ctrKeys )) {
+      $attr1               .= $this->intAttrDelimiter.'FMTTYPE='.$params['FMTTYPE'].$attr2;
+      $attr2                = null;
+    }
+    if( isset( $params['ENCODING'] ) && !in_array( 'ENCODING',   $ctrKeys )) {
+      if( !empty( $attr2 )) {
+        $attr1             .= $attr2;
+        $attr2              = null;
+      }
+      $attr1               .= $this->intAttrDelimiter.'ENCODING='.$params['ENCODING'];
+    }
+    if( isset( $params['VALUE'] )    && !in_array( 'VALUE',   $ctrKeys ))
+      $attr1               .= $this->intAttrDelimiter.'VALUE='.$params['VALUE'];
+    if( isset( $params['TZID'] )     && !in_array( 'TZID',    $ctrKeys ))
+      $attr1               .= $this->intAttrDelimiter.'TZID='.$params['TZID'];
+    if( isset( $params['RANGE'] )    && !in_array( 'RANGE',   $ctrKeys ))
+      $attr1               .= $this->intAttrDelimiter.'RANGE='.$params['RANGE'];
+    if( isset( $params['RELTYPE'] )  && !in_array( 'RELTYPE', $ctrKeys ))
+      $attr1               .= $this->intAttrDelimiter.'RELTYPE='.$params['RELTYPE'];
+    if( isset( $params['CN'] )       && $CNattrKey ) {
+      $attr1                = $this->intAttrDelimiter.'CN="'.$params['CN'].'"';
+      $CNattrExist          = TRUE;
+    }
+    if( isset( $params['DIR'] )      && in_array( 'DIR',      $ctrKeys ))
+      $attr1               .= $this->intAttrDelimiter.'DIR="'.$params['DIR'].'"';
+    if( isset( $params['SENT-BY'] )  && in_array( 'SENT-BY',  $ctrKeys ))
+      $attr1               .= $this->intAttrDelimiter.'SENT-BY="'.$params['SENT-BY'].'"';
+    if( isset( $params['ALTREP'] )   && in_array( 'ALTREP',   $ctrKeys ))
+      $attr1               .= $this->intAttrDelimiter.'ALTREP="'.$params['ALTREP'].'"';
+    if( isset( $params['LANGUAGE'] ) && $LANGattrKey ) {
+      $attrLANG            .= $this->intAttrDelimiter.'LANGUAGE='.$params['LANGUAGE'];
+      $LANGattrExist        = TRUE;
+    }
+    if( !$LANGattrExist ) {
+      $lang = $this->getConfig( 'language' );
+      if(( $CNattrExist || $LANGattrKey ) && $lang )
+        $attrLANG .= $this->intAttrDelimiter.'LANGUAGE='.$lang;
+    }
+    return $attr1.$attrLANG.$attr2;
+  }
+/**
+ * creates formatted output for calendar component property data value type recur
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.4.8 - 2008-10-22
+ * @param array $recurlabel
+ * @param array $recurdata
+ * @return string
+ */
+  function _format_recur( $recurlabel, $recurdata ) {
+    $output = null;
+    foreach( $recurdata as $therule ) {
+      if( empty( $therule['value'] )) {
+        if( $this->getConfig( 'allowEmpty' )) $output .= $this->_createElement( $recurlabel );
+        continue;
+      }
+      $attributes = ( isset( $therule['params'] )) ? $this->_createParams( $therule['params'] ) : null;
+      $content1  = $content2  = null;
+      foreach( $therule['value'] as $rulelabel => $rulevalue ) {
+        switch( $rulelabel ) {
+          case 'FREQ': {
+            $content1 .= "FREQ=$rulevalue";
+            break;
+          }
+          case 'UNTIL': {
+            $content2 .= ";UNTIL=";
+            $content2 .= iCalUtilityFunctions::_format_date_time( $rulevalue );
+            break;
+          }
+          case 'COUNT':
+          case 'INTERVAL':
+          case 'WKST': {
+            $content2 .= ";$rulelabel=$rulevalue";
+            break;
+          }
+          case 'BYSECOND':
+          case 'BYMINUTE':
+          case 'BYHOUR':
+          case 'BYMONTHDAY':
+          case 'BYYEARDAY':
+          case 'BYWEEKNO':
+          case 'BYMONTH':
+          case 'BYSETPOS': {
+            $content2 .= ";$rulelabel=";
+            if( is_array( $rulevalue )) {
+              foreach( $rulevalue as $vix => $valuePart ) {
+                $content2 .= ( $vix ) ? ',' : null;
+                $content2 .= $valuePart;
+              }
+            }
+            else
+             $content2 .= $rulevalue;
+            break;
+          }
+          case 'BYDAY': {
+            $content2 .= ";$rulelabel=";
+            $bydaycnt = 0;
+            foreach( $rulevalue as $vix => $valuePart ) {
+              $content21 = $content22 = null;
+              if( is_array( $valuePart )) {
+                $content2 .= ( $bydaycnt ) ? ',' : null;
+                foreach( $valuePart as $vix2 => $valuePart2 ) {
+                  if( 'DAY' != strtoupper( $vix2 ))
+                      $content21 .= $valuePart2;
+                  else
+                    $content22 .= $valuePart2;
+                }
+                $content2 .= $content21.$content22;
+                $bydaycnt++;
+              }
+              else {
+                $content2 .= ( $bydaycnt ) ? ',' : null;
+                if( 'DAY' != strtoupper( $vix ))
+                    $content21 .= $valuePart;
+                else {
+                  $content22 .= $valuePart;
+                  $bydaycnt++;
+                }
+                $content2 .= $content21.$content22;
+              }
+            }
+            break;
+          }
+          default: {
+            $content2 .= ";$rulelabel=$rulevalue";
+            break;
+          }
+        }
+      }
+      $output .= $this->_createElement( $recurlabel, $attributes, $content1.$content2 );
+    }
+    return $output;
+  }
+/**
+ * check if property not exists within component
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.5.1 - 2008-10-15
+ * @param string $propName
+ * @return bool
+ */
+  function _notExistProp( $propName ) {
+    if( empty( $propName )) return FALSE; // when deleting x-prop, an empty propName may be used=allowed
+    $propName = strtolower( $propName );
+    if(     'last-modified'    == $propName )  { if( !isset( $this->lastmodified ))    return TRUE; }
+    elseif( 'percent-complete' == $propName )  { if( !isset( $this->percentcomplete )) return TRUE; }
+    elseif( 'recurrence-id'    == $propName )  { if( !isset( $this->recurrenceid ))    return TRUE; }
+    elseif( 'related-to'       == $propName )  { if( !isset( $this->relatedto ))       return TRUE; }
+    elseif( 'request-status'   == $propName )  { if( !isset( $this->requeststatus ))   return TRUE; }
+    elseif((       'x-' != substr($propName,0,2)) && !isset( $this->$propName ))       return TRUE;
+    return FALSE;
+  }
+/*********************************************************************************/
+/*********************************************************************************/
+/**
+ * get general component config variables or info about subcomponents
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.9.6 - 2011-05-14
+ * @param mixed $config
+ * @return value
+ */
+  function getConfig( $config = FALSE) {
+    if( !$config ) {
+      $return = array();
+      $return['ALLOWEMPTY']  = $this->getConfig( 'ALLOWEMPTY' );
+      $return['FORMAT']      = $this->getConfig( 'FORMAT' );
+      if( FALSE !== ( $lang  = $this->getConfig( 'LANGUAGE' )))
+        $return['LANGUAGE']  = $lang;
+      $return['NEWLINECHAR'] = $this->getConfig( 'NEWLINECHAR' );
+      $return['TZTD']        = $this->getConfig( 'TZID' );
+      $return['UNIQUE_ID']   = $this->getConfig( 'UNIQUE_ID' );
+      return $return;
+    }
+    switch( strtoupper( $config )) {
+      case 'ALLOWEMPTY':
+        return $this->allowEmpty;
+        break;
+      case 'COMPSINFO':
+        unset( $this->compix );
+        $info = array();
+        if( isset( $this->components )) {
+          foreach( $this->components as $cix => $component ) {
+            if( empty( $component )) continue;
+            $info[$cix]['ordno'] = $cix + 1;
+            $info[$cix]['type']  = $component->objName;
+            $info[$cix]['uid']   = $component->getProperty( 'uid' );
+            $info[$cix]['props'] = $component->getConfig( 'propinfo' );
+            $info[$cix]['sub']   = $component->getConfig( 'compsinfo' );
+          }
+        }
+        return $info;
+        break;
+      case 'FORMAT':
+        return $this->format;
+        break;
+      case 'LANGUAGE':
+         // get language for calendar component as defined in [RFC 1766]
+        return $this->language;
+        break;
+      case 'NL':
+      case 'NEWLINECHAR':
+        return $this->nl;
+        break;
+      case 'PROPINFO':
+        $output = array();
+        if( !in_array( $this->objName, array( 'valarm', 'vtimezone', 'standard', 'daylight' ))) {
+          if( empty( $this->uid['value'] )) $this->_makeuid();
+                                              $output['UID']              = 1;
+        }
+        if( !empty( $this->dtstamp ))         $output['DTSTAMP']          = 1;
+        if( !empty( $this->summary ))         $output['SUMMARY']          = 1;
+        if( !empty( $this->description ))     $output['DESCRIPTION']      = count( $this->description );
+        if( !empty( $this->dtstart ))         $output['DTSTART']          = 1;
+        if( !empty( $this->dtend ))           $output['DTEND']            = 1;
+        if( !empty( $this->due ))             $output['DUE']              = 1;
+        if( !empty( $this->duration ))        $output['DURATION']         = 1;
+        if( !empty( $this->rrule ))           $output['RRULE']            = count( $this->rrule );
+        if( !empty( $this->rdate ))           $output['RDATE']            = count( $this->rdate );
+        if( !empty( $this->exdate ))          $output['EXDATE']           = count( $this->exdate );
+        if( !empty( $this->exrule ))          $output['EXRULE']           = count( $this->exrule );
+        if( !empty( $this->action ))          $output['ACTION']           = 1;
+        if( !empty( $this->attach ))          $output['ATTACH']           = count( $this->attach );
+        if( !empty( $this->attendee ))        $output['ATTENDEE']         = count( $this->attendee );
+        if( !empty( $this->categories ))      $output['CATEGORIES']       = count( $this->categories );
+        if( !empty( $this->class ))           $output['CLASS']            = 1;
+        if( !empty( $this->comment ))         $output['COMMENT']          = count( $this->comment );
+        if( !empty( $this->completed ))       $output['COMPLETED']        = 1;
+        if( !empty( $this->contact ))         $output['CONTACT']          = count( $this->contact );
+        if( !empty( $this->created ))         $output['CREATED']          = 1;
+        if( !empty( $this->freebusy ))        $output['FREEBUSY']         = count( $this->freebusy );
+        if( !empty( $this->geo ))             $output['GEO']              = 1;
+        if( !empty( $this->lastmodified ))    $output['LAST-MODIFIED']    = 1;
+        if( !empty( $this->location ))        $output['LOCATION']         = 1;
+        if( !empty( $this->organizer ))       $output['ORGANIZER']        = 1;
+        if( !empty( $this->percentcomplete )) $output['PERCENT-COMPLETE'] = 1;
+        if( !empty( $this->priority ))        $output['PRIORITY']         = 1;
+        if( !empty( $this->recurrenceid ))    $output['RECURRENCE-ID']    = 1;
+        if( !empty( $this->relatedto ))       $output['RELATED-TO']       = count( $this->relatedto );
+        if( !empty( $this->repeat ))          $output['REPEAT']           = 1;
+        if( !empty( $this->requeststatus ))   $output['REQUEST-STATUS']   = count( $this->requeststatus );
+        if( !empty( $this->resources ))       $output['RESOURCES']        = count( $this->resources );
+        if( !empty( $this->sequence ))        $output['SEQUENCE']         = 1;
+        if( !empty( $this->sequence ))        $output['SEQUENCE']         = 1;
+        if( !empty( $this->status ))          $output['STATUS']           = 1;
+        if( !empty( $this->transp ))          $output['TRANSP']           = 1;
+        if( !empty( $this->trigger ))         $output['TRIGGER']          = 1;
+        if( !empty( $this->tzid ))            $output['TZID']             = 1;
+        if( !empty( $this->tzname ))          $output['TZNAME']           = count( $this->tzname );
+        if( !empty( $this->tzoffsetfrom ))    $output['TZOFFSETFROM']     = 1;
+        if( !empty( $this->tzoffsetto ))      $output['TZOFFSETTO']       = 1;
+        if( !empty( $this->tzurl ))           $output['TZURL']            = 1;
+        if( !empty( $this->url ))             $output['URL']              = 1;
+        if( !empty( $this->xprop ))           $output['X-PROP']           = count( $this->xprop );
+        return $output;
+        break;
+      case 'TZID':
+        return $this->dtzid;
+        break;
+      case 'UNIQUE_ID':
+        if( empty( $this->unique_id ))
+          $this->unique_id  = ( isset( $_SERVER['SERVER_NAME'] )) ? gethostbyname( $_SERVER['SERVER_NAME'] ) : 'localhost';
+        return $this->unique_id;
+        break;
+    }
+  }
+/**
+ * general component config setting
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.9.6 - 2011-05-14
+ * @param mixed  $config
+ * @param string $value
+ * @param bool   $softUpdate
+ * @return void
+ */
+  function setConfig( $config, $value = FALSE, $softUpdate = FALSE ) {
+    if( is_array( $config )) {
+      foreach( $config as $cKey => $cValue ) {
+        if( FALSE === $this->setConfig( $cKey, $cValue, $softUpdate ))
+          return FALSE;
+      }
+      return TRUE;
+    }
+    $res = FALSE;
+    switch( strtoupper( $config )) {
+      case 'ALLOWEMPTY':
+        $this->allowEmpty = $value;
+        $subcfg = array( 'ALLOWEMPTY' => $value );
+        $res    = TRUE;
+        break;
+      case 'FORMAT':
+        $value  = trim( strtolower( $value ));
+        $this->format = $value;
+        $this->_createFormat();
+        $subcfg = array( 'FORMAT' => $value );
+        $res    = TRUE;
+        break;
+      case 'LANGUAGE':
+         // set language for calendar component as defined in [RFC 1766]
+        $value  = trim( $value );
+        if( empty( $this->language ) || !$softUpdate )
+          $this->language = $value;
+        $subcfg = array( 'LANGUAGE' => $value );
+        $res    = TRUE;
+        break;
+      case 'NL':
+      case 'NEWLINECHAR':
+        $this->nl = $value;
+        $subcfg = array( 'NL' => $value );
+        $res    = TRUE;
+        break;
+      case 'TZID':
+        $this->dtzid = $value;
+        $subcfg = array( 'TZID' => $value );
+        $res    = TRUE;
+        break;
+      case 'UNIQUE_ID':
+        $value  = trim( $value );
+        $this->unique_id = $value;
+        $subcfg = array( 'UNIQUE_ID' => $value );
+        $res    = TRUE;
+        break;
+      default:  // any unvalid config key.. .
+        return TRUE;
+    }
+    if( !$res ) return FALSE;
+    if( isset( $subcfg ) && !empty( $this->components )) {
+      foreach( $subcfg as $cfgkey => $cfgvalue ) {
+        foreach( $this->components as $cix => $component ) {
+          $res = $component->setConfig( $cfgkey, $cfgvalue, $softUpdate );
+          if( !$res )
+            break 2;
+          $this->components[$cix] = $component->copy(); // PHP4 compliant
+        }
+      }
+    }
+    return $res;
+  }
+/*********************************************************************************/
+/**
+ * delete component property value
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.8.8 - 2011-03-15
+ * @param mixed $propName, bool FALSE => X-property
+ * @param int   $propix, optional, if specific property is wanted in case of multiply occurences
+ * @return bool, if successfull delete TRUE
+ */
+  function deleteProperty( $propName=FALSE, $propix=FALSE ) {
+    if( $this->_notExistProp( $propName )) return FALSE;
+    $propName = strtoupper( $propName );
+    if( in_array( $propName, array( 'ATTACH',   'ATTENDEE', 'CATEGORIES', 'COMMENT',   'CONTACT', 'DESCRIPTION',    'EXDATE', 'EXRULE',
+                                    'FREEBUSY', 'RDATE',    'RELATED-TO', 'RESOURCES', 'RRULE',   'REQUEST-STATUS', 'TZNAME', 'X-PROP'  ))) {
+      if( !$propix )
+        $propix = ( isset( $this->propdelix[$propName] ) && ( 'X-PROP' != $propName )) ? $this->propdelix[$propName] + 2 : 1;
+      $this->propdelix[$propName] = --$propix;
+    }
+    $return = FALSE;
+    switch( $propName ) {
+      case 'ACTION':
+        if( !empty( $this->action )) {
+          $this->action = '';
+          $return = TRUE;
+        }
+        break;
+      case 'ATTACH':
+        return $this->deletePropertyM( $this->attach, $this->propdelix[$propName] );
+        break;
+      case 'ATTENDEE':
+        return $this->deletePropertyM( $this->attendee, $this->propdelix[$propName] );
+        break;
+      case 'CATEGORIES':
+        return $this->deletePropertyM( $this->categories, $this->propdelix[$propName] );
+        break;
+      case 'CLASS':
+        if( !empty( $this->class )) {
+          $this->class = '';
+          $return = TRUE;
+        }
+        break;
+      case 'COMMENT':
+        return $this->deletePropertyM( $this->comment, $this->propdelix[$propName] );
+        break;
+      case 'COMPLETED':
+        if( !empty( $this->completed )) {
+          $this->completed = '';
+          $return = TRUE;
+        }
+        break;
+      case 'CONTACT':
+        return $this->deletePropertyM( $this->contact, $this->propdelix[$propName] );
+        break;
+      case 'CREATED':
+        if( !empty( $this->created )) {
+          $this->created = '';
+          $return = TRUE;
+        }
+        break;
+      case 'DESCRIPTION':
+        return $this->deletePropertyM( $this->description, $this->propdelix[$propName] );
+        break;
+      case 'DTEND':
+        if( !empty( $this->dtend )) {
+          $this->dtend = '';
+          $return = TRUE;
+        }
+        break;
+      case 'DTSTAMP':
+        if( in_array( $this->objName, array( 'valarm', 'vtimezone', 'standard', 'daylight' )))
+          return FALSE;
+        if( !empty( $this->dtstamp )) {
+          $this->dtstamp = '';
+          $return = TRUE;
+        }
+        break;
+      case 'DTSTART':
+        if( !empty( $this->dtstart )) {
+          $this->dtstart = '';
+          $return = TRUE;
+        }
+        break;
+      case 'DUE':
+        if( !empty( $this->due )) {
+          $this->due = '';
+          $return = TRUE;
+        }
+        break;
+      case 'DURATION':
+        if( !empty( $this->duration )) {
+          $this->duration = '';
+          $return = TRUE;
+        }
+        break;
+      case 'EXDATE':
+        return $this->deletePropertyM( $this->exdate, $this->propdelix[$propName] );
+        break;
+      case 'EXRULE':
+        return $this->deletePropertyM( $this->exrule, $this->propdelix[$propName] );
+        break;
+      case 'FREEBUSY':
+        return $this->deletePropertyM( $this->freebusy, $this->propdelix[$propName] );
+        break;
+      case 'GEO':
+        if( !empty( $this->geo )) {
+          $this->geo = '';
+          $return = TRUE;
+        }
+        break;
+      case 'LAST-MODIFIED':
+        if( !empty( $this->lastmodified )) {
+          $this->lastmodified = '';
+          $return = TRUE;
+        }
+        break;
+      case 'LOCATION':
+        if( !empty( $this->location )) {
+          $this->location = '';
+          $return = TRUE;
+        }
+        break;
+      case 'ORGANIZER':
+        if( !empty( $this->organizer )) {
+          $this->organizer = '';
+          $return = TRUE;
+        }
+        break;
+      case 'PERCENT-COMPLETE':
+        if( !empty( $this->percentcomplete )) {
+          $this->percentcomplete = '';
+          $return = TRUE;
+        }
+        break;
+      case 'PRIORITY':
+        if( !empty( $this->priority )) {
+          $this->priority = '';
+          $return = TRUE;
+        }
+        break;
+      case 'RDATE':
+        return $this->deletePropertyM( $this->rdate, $this->propdelix[$propName] );
+        break;
+      case 'RECURRENCE-ID':
+        if( !empty( $this->recurrenceid )) {
+          $this->recurrenceid = '';
+          $return = TRUE;
+        }
+        break;
+      case 'RELATED-TO':
+        return $this->deletePropertyM( $this->relatedto, $this->propdelix[$propName] );
+        break;
+      case 'REPEAT':
+        if( !empty( $this->repeat )) {
+          $this->repeat = '';
+          $return = TRUE;
+        }
+        break;
+      case 'REQUEST-STATUS':
+        return $this->deletePropertyM( $this->requeststatus, $this->propdelix[$propName] );
+        break;
+      case 'RESOURCES':
+        return $this->deletePropertyM( $this->resources, $this->propdelix[$propName] );
+        break;
+      case 'RRULE':
+        return $this->deletePropertyM( $this->rrule, $this->propdelix[$propName] );
+        break;
+      case 'SEQUENCE':
+        if( !empty( $this->sequence )) {
+          $this->sequence = '';
+          $return = TRUE;
+        }
+        break;
+      case 'STATUS':
+        if( !empty( $this->status )) {
+          $this->status = '';
+          $return = TRUE;
+        }
+        break;
+      case 'SUMMARY':
+        if( !empty( $this->summary )) {
+          $this->summary = '';
+          $return = TRUE;
+        }
+        break;
+      case 'TRANSP':
+        if( !empty( $this->transp )) {
+          $this->transp = '';
+          $return = TRUE;
+        }
+        break;
+      case 'TRIGGER':
+        if( !empty( $this->trigger )) {
+          $this->trigger = '';
+          $return = TRUE;
+        }
+        break;
+      case 'TZID':
+        if( !empty( $this->tzid )) {
+          $this->tzid = '';
+          $return = TRUE;
+        }
+        break;
+      case 'TZNAME':
+        return $this->deletePropertyM( $this->tzname, $this->propdelix[$propName] );
+        break;
+      case 'TZOFFSETFROM':
+        if( !empty( $this->tzoffsetfrom )) {
+          $this->tzoffsetfrom = '';
+          $return = TRUE;
+        }
+        break;
+      case 'TZOFFSETTO':
+        if( !empty( $this->tzoffsetto )) {
+          $this->tzoffsetto = '';
+          $return = TRUE;
+        }
+        break;
+      case 'TZURL':
+        if( !empty( $this->tzurl )) {
+          $this->tzurl = '';
+          $return = TRUE;
+        }
+        break;
+      case 'UID':
+        if( in_array( $this->objName, array( 'valarm', 'vtimezone', 'standard', 'daylight' )))
+          return FALSE;
+        if( !empty( $this->uid )) {
+          $this->uid = '';
+          $return = TRUE;
+        }
+        break;
+      case 'URL':
+        if( !empty( $this->url )) {
+          $this->url = '';
+          $return = TRUE;
+        }
+        break;
+      default:
+        $reduced = '';
+        if( $propName != 'X-PROP' ) {
+          if( !isset( $this->xprop[$propName] )) return FALSE;
+          foreach( $this->xprop as $k => $a ) {
+            if(( $k != $propName ) && !empty( $a ))
+              $reduced[$k] = $a;
+          }
+        }
+        else {
+          if( count( $this->xprop ) <= $propix ) { unset( $this->propdelix[$propName] ); return FALSE; }
+          $xpropno = 0;
+          foreach( $this->xprop as $xpropkey => $xpropvalue ) {
+            if( $propix != $xpropno )
+              $reduced[$xpropkey] = $xpropvalue;
+            $xpropno++;
+          }
+        }
+        $this->xprop = $reduced;
+        if( empty( $this->xprop )) {
+          unset( $this->propdelix[$propName] );
+          return FALSE;
+        }
+        return TRUE;
+    }
+    return $return;
+  }
+/*********************************************************************************/
+/**
+ * delete component property value, fixing components with multiple occurencies
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.8.8 - 2011-03-15
+ * @param array $multiprop, reference to a component property
+ * @param int   $propix, reference to removal counter
+ * @return bool TRUE
+ */
+  function deletePropertyM( & $multiprop, & $propix ) {
+    if( isset( $multiprop[$propix] ))
+      unset( $multiprop[$propix] );
+    if( empty( $multiprop )) {
+      $multiprop = '';
+      unset( $propix );
+      return FALSE;
+    }
+    else
+      return TRUE;
+  }
+/**
+ * get component property value/params
+ *
+ * if property has multiply values, consequtive function calls are needed
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.10.1 - 2011-07-16
+ * @param string $propName, optional
+ * @param int @propix, optional, if specific property is wanted in case of multiply occurences
+ * @param bool $inclParam=FALSE
+ * @param bool $specform=FALSE
+ * @return mixed
+ */
+  function getProperty( $propName=FALSE, $propix=FALSE, $inclParam=FALSE, $specform=FALSE ) {
+    if( $this->_notExistProp( $propName )) return FALSE;
+    $propName = ( $propName ) ? strtoupper( $propName ) : 'X-PROP';
+    if( in_array( $propName, array( 'ATTACH',   'ATTENDEE', 'CATEGORIES', 'COMMENT',   'CONTACT', 'DESCRIPTION',    'EXDATE', 'EXRULE',
+                                    'FREEBUSY', 'RDATE',    'RELATED-TO', 'RESOURCES', 'RRULE',   'REQUEST-STATUS', 'TZNAME', 'X-PROP'  ))) {
+      if( !$propix )
+        $propix = ( isset( $this->propix[$propName] )) ? $this->propix[$propName] + 2 : 1;
+      $this->propix[$propName] = --$propix;
+    }
+    switch( $propName ) {
+      case 'ACTION':
+        if( !empty( $this->action['value'] )) return ( $inclParam ) ? $this->action : $this->action['value'];
+        break;
+      case 'ATTACH':
+        $ak = ( is_array( $this->attach )) ? array_keys( $this->attach ) : array();
+        while( is_array( $this->attach ) && !isset( $this->attach[$propix] ) && ( 0 < count( $this->attach )) && ( $propix < end( $ak )))
+          $propix++;
+        if( !isset( $this->attach[$propix] )) { unset( $this->propix[$propName] ); return FALSE; }
+        return ( $inclParam ) ? $this->attach[$propix] : $this->attach[$propix]['value'];
+        break;
+      case 'ATTENDEE':
+        $ak = ( is_array( $this->attendee )) ? array_keys( $this->attendee ) : array();
+        while( is_array( $this->attendee ) && !isset( $this->attendee[$propix] ) && ( 0 < count( $this->attendee )) && ( $propix < end( $ak )))
+          $propix++;
+        if( !isset( $this->attendee[$propix] )) { unset( $this->propix[$propName] ); return FALSE; }
+        return ( $inclParam ) ? $this->attendee[$propix] : $this->attendee[$propix]['value'];
+        break;
+      case 'CATEGORIES':
+        $ak = ( is_array( $this->categories )) ? array_keys( $this->categories ) : array();
+        while( is_array( $this->categories ) && !isset( $this->categories[$propix] ) && ( 0 < count( $this->categories )) && ( $propix < end( $ak )))
+          $propix++;
+        if( !isset( $this->categories[$propix] )) { unset( $this->propix[$propName] ); return FALSE; }
+        return ( $inclParam ) ? $this->categories[$propix] : $this->categories[$propix]['value'];
+        break;
+      case 'CLASS':
+        if( !empty( $this->class['value'] )) return ( $inclParam ) ? $this->class : $this->class['value'];
+        break;
+      case 'COMMENT':
+        $ak = ( is_array( $this->comment )) ? array_keys( $this->comment ) : array();
+        while( is_array( $this->comment ) && !isset( $this->comment[$propix] ) && ( 0 < count( $this->comment )) && ( $propix < end( $ak )))
+          $propix++;
+        if( !isset( $this->comment[$propix] )) { unset( $this->propix[$propName] ); return FALSE; }
+        return ( $inclParam ) ? $this->comment[$propix] : $this->comment[$propix]['value'];
+        break;
+      case 'COMPLETED':
+        if( !empty( $this->completed['value'] )) return ( $inclParam ) ? $this->completed : $this->completed['value'];
+        break;
+      case 'CONTACT':
+        $ak = ( is_array( $this->contact )) ? array_keys( $this->contact ) : array();
+        while( is_array( $this->contact ) && !isset( $this->contact[$propix] ) && ( 0 < count( $this->contact )) && ( $propix < end( $ak )))
+          $propix++;
+        if( !isset( $this->contact[$propix] )) { unset( $this->propix[$propName] ); return FALSE; }
+        return ( $inclParam ) ? $this->contact[$propix] : $this->contact[$propix]['value'];
+        break;
+      case 'CREATED':
+        if( !empty( $this->created['value'] )) return ( $inclParam ) ? $this->created : $this->created['value'];
+        break;
+      case 'DESCRIPTION':
+        $ak = ( is_array( $this->description )) ? array_keys( $this->description ) : array();
+        while( is_array( $this->description ) && !isset( $this->description[$propix] ) && ( 0 < count( $this->description )) && ( $propix < end( $ak )))
+          $propix++;
+        if( !isset( $this->description[$propix] )) { unset( $this->propix[$propName] ); return FALSE; }
+        return ( $inclParam ) ? $this->description[$propix] : $this->description[$propix]['value'];
+        break;
+      case 'DTEND':
+        if( !empty( $this->dtend['value'] )) return ( $inclParam ) ? $this->dtend : $this->dtend['value'];
+        break;
+      case 'DTSTAMP':
+        if( in_array( $this->objName, array( 'valarm', 'vtimezone', 'standard', 'daylight' )))
+          return;
+        if( !isset( $this->dtstamp['value'] ))
+          $this->_makeDtstamp();
+        return ( $inclParam ) ? $this->dtstamp : $this->dtstamp['value'];
+        break;
+      case 'DTSTART':
+        if( !empty( $this->dtstart['value'] )) return ( $inclParam ) ? $this->dtstart : $this->dtstart['value'];
+        break;
+      case 'DUE':
+        if( !empty( $this->due['value'] )) return ( $inclParam ) ? $this->due : $this->due['value'];
+        break;
+      case 'DURATION':
+        if( !isset( $this->duration['value'] )) return FALSE;
+        $value = ( $specform && isset( $this->dtstart['value'] ) && isset( $this->duration['value'] )) ? iCalUtilityFunctions::_duration2date( $this->dtstart['value'], $this->duration['value'] ) : $this->duration['value'];
+        return ( $inclParam ) ? array( 'value' => $value, 'params' =>  $this->duration['params'] ) : $value;
+        break;
+      case 'EXDATE':
+        $ak = ( is_array( $this->exdate )) ? array_keys( $this->exdate ) : array();
+        while( is_array( $this->exdate ) && !isset( $this->exdate[$propix] ) && ( 0 < count( $this->exdate )) && ( $propix < end( $ak )))
+          $propix++;
+        if( !isset( $this->exdate[$propix] )) { unset( $this->propix[$propName] ); return FALSE; }
+        return ( $inclParam ) ? $this->exdate[$propix] : $this->exdate[$propix]['value'];
+        break;
+      case 'EXRULE':
+        $ak = ( is_array( $this->exrule )) ? array_keys( $this->exrule ) : array();
+        while( is_array( $this->exrule ) && !isset( $this->exrule[$propix] ) && ( 0 < count( $this->exrule )) && ( $propix < end( $ak )))
+          $propix++;
+        if( !isset( $this->exrule[$propix] )) { unset( $this->propix[$propName] ); return FALSE; }
+        return ( $inclParam ) ? $this->exrule[$propix] : $this->exrule[$propix]['value'];
+        break;
+      case 'FREEBUSY':
+        $ak = ( is_array( $this->freebusy )) ? array_keys( $this->freebusy ) : array();
+        while( is_array( $this->freebusy ) && !isset( $this->freebusy[$propix] ) && ( 0 < count( $this->freebusy )) && ( $propix < end( $ak )))
+          $propix++;
+        if( !isset( $this->freebusy[$propix] )) { unset( $this->propix[$propName] ); return FALSE; }
+        return ( $inclParam ) ? $this->freebusy[$propix] : $this->freebusy[$propix]['value'];
+        break;
+      case 'GEO':
+        if( !empty( $this->geo['value'] )) return ( $inclParam ) ? $this->geo : $this->geo['value'];
+        break;
+      case 'LAST-MODIFIED':
+        if( !empty( $this->lastmodified['value'] )) return ( $inclParam ) ? $this->lastmodified : $this->lastmodified['value'];
+        break;
+      case 'LOCATION':
+        if( !empty( $this->location['value'] )) return ( $inclParam ) ? $this->location : $this->location['value'];
+        break;
+      case 'ORGANIZER':
+        if( !empty( $this->organizer['value'] )) return ( $inclParam ) ? $this->organizer : $this->organizer['value'];
+        break;
+      case 'PERCENT-COMPLETE':
+        if( !empty( $this->percentcomplete['value'] ) || ( isset( $this->percentcomplete['value'] ) && ( '0' == $this->percentcomplete['value'] ))) return ( $inclParam ) ? $this->percentcomplete : $this->percentcomplete['value'];
+        break;
+      case 'PRIORITY':
+        if( !empty( $this->priority['value'] ) || ( isset( $this->priority['value'] ) && ('0' == $this->priority['value'] ))) return ( $inclParam ) ? $this->priority : $this->priority['value'];
+        break;
+      case 'RDATE':
+        $ak = ( is_array( $this->rdate )) ? array_keys( $this->rdate ) : array();
+        while( is_array( $this->rdate ) && !isset( $this->rdate[$propix] ) && ( 0 < count( $this->rdate )) && ( $propix < end( $ak )))
+          $propix++;
+        if( !isset( $this->rdate[$propix] )) { unset( $this->propix[$propName] ); return FALSE; }
+        return ( $inclParam ) ? $this->rdate[$propix] : $this->rdate[$propix]['value'];
+        break;
+      case 'RECURRENCE-ID':
+        if( !empty( $this->recurrenceid['value'] )) return ( $inclParam ) ? $this->recurrenceid : $this->recurrenceid['value'];
+        break;
+      case 'RELATED-TO':
+        $ak = ( is_array( $this->relatedto )) ? array_keys( $this->relatedto ) : array();
+        while( is_array( $this->relatedto ) && !isset( $this->relatedto[$propix] ) && ( 0 < count( $this->relatedto )) && ( $propix < end( $ak )))
+          $propix++;
+        if( !isset( $this->relatedto[$propix] )) { unset( $this->propix[$propName] ); return FALSE; }
+        return ( $inclParam ) ? $this->relatedto[$propix] : $this->relatedto[$propix]['value'];
+        break;
+      case 'REPEAT':
+        if( !empty( $this->repeat['value'] ) || ( isset( $this->repeat['value'] ) && ( '0' == $this->repeat['value'] ))) return ( $inclParam ) ? $this->repeat : $this->repeat['value'];
+        break;
+      case 'REQUEST-STATUS':
+        $ak = ( is_array( $this->requeststatus )) ? array_keys( $this->requeststatus ) : array();
+        while( is_array( $this->requeststatus ) && !isset( $this->requeststatus[$propix] ) && ( 0 < count( $this->requeststatus )) && ( $propix < end( $ak )))
+          $propix++;
+        if( !isset( $this->requeststatus[$propix] )) { unset( $this->propix[$propName] ); return FALSE; }
+        return ( $inclParam ) ? $this->requeststatus[$propix] : $this->requeststatus[$propix]['value'];
+        break;
+      case 'RESOURCES':
+        $ak = ( is_array( $this->resources )) ? array_keys( $this->resources ) : array();
+        while( is_array( $this->resources ) && !isset( $this->resources[$propix] ) && ( 0 < count( $this->resources )) && ( $propix < end( $ak )))
+          $propix++;
+        if( !isset( $this->resources[$propix] )) { unset( $this->propix[$propName] ); return FALSE; }
+        return ( $inclParam ) ? $this->resources[$propix] : $this->resources[$propix]['value'];
+        break;
+      case 'RRULE':
+        $ak = ( is_array( $this->rrule )) ? array_keys( $this->rrule ) : array();
+        while( is_array( $this->rrule ) && !isset( $this->rrule[$propix] ) && ( 0 < count( $this->rrule )) && ( $propix < end( $ak )))
+          $propix++;
+        if( !isset( $this->rrule[$propix] )) { unset( $this->propix[$propName] ); return FALSE; }
+        return ( $inclParam ) ? $this->rrule[$propix] : $this->rrule[$propix]['value'];
+        break;
+      case 'SEQUENCE':
+        if( isset( $this->sequence['value'] ) && ( isset( $this->sequence['value'] ) && ( '0' <= $this->sequence['value'] ))) return ( $inclParam ) ? $this->sequence : $this->sequence['value'];
+        break;
+      case 'STATUS':
+        if( !empty( $this->status['value'] )) return ( $inclParam ) ? $this->status : $this->status['value'];
+        break;
+      case 'SUMMARY':
+        if( !empty( $this->summary['value'] )) return ( $inclParam ) ? $this->summary : $this->summary['value'];
+        break;
+      case 'TRANSP':
+        if( !empty( $this->transp['value'] )) return ( $inclParam ) ? $this->transp : $this->transp['value'];
+        break;
+      case 'TRIGGER':
+        if( !empty( $this->trigger['value'] )) return ( $inclParam ) ? $this->trigger : $this->trigger['value'];
+        break;
+      case 'TZID':
+        if( !empty( $this->tzid['value'] )) return ( $inclParam ) ? $this->tzid : $this->tzid['value'];
+        break;
+      case 'TZNAME':
+        $ak = ( is_array( $this->tzname )) ? array_keys( $this->tzname ) : array();
+        while( is_array( $this->tzname ) && !isset( $this->tzname[$propix] ) && ( 0 < count( $this->tzname )) && ( $propix < end( $ak )))
+          $propix++;
+        if( !isset( $this->tzname[$propix] )) { unset( $this->propix[$propName] ); return FALSE; }
+        return ( $inclParam ) ? $this->tzname[$propix] : $this->tzname[$propix]['value'];
+        break;
+      case 'TZOFFSETFROM':
+        if( !empty( $this->tzoffsetfrom['value'] )) return ( $inclParam ) ? $this->tzoffsetfrom : $this->tzoffsetfrom['value'];
+        break;
+      case 'TZOFFSETTO':
+        if( !empty( $this->tzoffsetto['value'] )) return ( $inclParam ) ? $this->tzoffsetto : $this->tzoffsetto['value'];
+        break;
+      case 'TZURL':
+        if( !empty( $this->tzurl['value'] )) return ( $inclParam ) ? $this->tzurl : $this->tzurl['value'];
+        break;
+      case 'UID':
+        if( in_array( $this->objName, array( 'valarm', 'vtimezone', 'standard', 'daylight' )))
+          return FALSE;
+        if( empty( $this->uid['value'] ))
+          $this->_makeuid();
+        return ( $inclParam ) ? $this->uid : $this->uid['value'];
+        break;
+      case 'URL':
+        if( !empty( $this->url['value'] )) return ( $inclParam ) ? $this->url : $this->url['value'];
+        break;
+      default:
+        if( $propName != 'X-PROP' ) {
+          if( !isset( $this->xprop[$propName] )) return FALSE;
+          return ( $inclParam ) ? array( $propName, $this->xprop[$propName] )
+                                : array( $propName, $this->xprop[$propName]['value'] );
+        }
+        else {
+          if( empty( $this->xprop )) return FALSE;
+          $xpropno = 0;
+          foreach( $this->xprop as $xpropkey => $xpropvalue ) {
+            if( $propix == $xpropno )
+              return ( $inclParam ) ? array( $xpropkey, $this->xprop[$xpropkey] )
+                                    : array( $xpropkey, $this->xprop[$xpropkey]['value'] );
+            else
+              $xpropno++;
+          }
+          return FALSE; // not found ??
+        }
+    }
+    return FALSE;
+  }
+/**
+ * returns calendar property unique values for 'CATEGORIES', 'RESOURCES' or 'ATTENDEE' and each number of ocurrence
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.8.8 - 2011-04-13
+ * @param string $propName
+ * @param array  $output, incremented result array
+ */
+  function _getProperties( $propName, & $output ) {
+    if( !in_array( strtoupper( $propName ), array( 'ATTENDEE', 'CATEGORIES', 'RESOURCES' )))
+      return output;
+    while( FALSE !== ( $content = $this->getProperty( $propName ))) {
+      if( is_array( $content )) {
+        foreach( $content as $part ) {
+          if( FALSE !== strpos( $part, ',' )) {
+            $part = explode( ',', $part );
+            foreach( $part as $thePart ) {
+              $thePart = trim( $thePart );
+              if( !empty( $thePart )) {
+                if( !isset( $output[$thePart] ))
+                  $output[$thePart] = 1;
+                else
+                  $output[$thePart] += 1;
+              }
+            }
+          }
+          else {
+            $part = trim( $part );
+            if( !isset( $output[$part] ))
+              $output[$part] = 1;
+            else
+              $output[$part] += 1;
+          }
+        }
+      }
+      elseif( FALSE !== strpos( $content, ',' )) {
+        $content = explode( ',', $content );
+        foreach( $content as $thePart ) {
+          $thePart = trim( $thePart );
+          if( !empty( $thePart )) {
+            if( !isset( $output[$thePart] ))
+              $output[$thePart] = 1;
+            else
+              $output[$thePart] += 1;
+          }
+        }
+      }
+      else {
+        $content = trim( $content );
+        if( !empty( $content )) {
+          if( !isset( $output[$content] ))
+            $output[$content] = 1;
+          else
+            $output[$content] += 1;
+        }
+      }
+    }
+    ksort( $output );
+    return $output;
+  }
+/**
+ * general component property setting
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.5.1 - 2008-11-05
+ * @param mixed $args variable number of function arguments,
+ *                    first argument is ALWAYS component name,
+ *                    second ALWAYS component value!
+ * @return void
+ */
+  function setProperty() {
+    $numargs    = func_num_args();
+    if( 1 > $numargs ) return FALSE;
+    $arglist    = func_get_args();
+    if( $this->_notExistProp( $arglist[0] )) return FALSE;
+    if( !$this->getConfig( 'allowEmpty' ) && ( !isset( $arglist[1] ) || empty( $arglist[1] )))
+      return FALSE;
+    $arglist[0] = strtoupper( $arglist[0] );
+    for( $argix=$numargs; $argix < 12; $argix++ ) {
+      if( !isset( $arglist[$argix] ))
+        $arglist[$argix] = null;
+    }
+    switch( $arglist[0] ) {
+      case 'ACTION':
+        return $this->setAction( $arglist[1], $arglist[2] );
+      case 'ATTACH':
+        return $this->setAttach( $arglist[1], $arglist[2], $arglist[3] );
+      case 'ATTENDEE':
+        return $this->setAttendee( $arglist[1], $arglist[2], $arglist[3] );
+      case 'CATEGORIES':
+        return $this->setCategories( $arglist[1], $arglist[2], $arglist[3] );
+      case 'CLASS':
+        return $this->setClass( $arglist[1], $arglist[2] );
+      case 'COMMENT':
+        return $this->setComment( $arglist[1], $arglist[2], $arglist[3] );
+      case 'COMPLETED':
+        return $this->setCompleted( $arglist[1], $arglist[2], $arglist[3], $arglist[4], $arglist[5], $arglist[6], $arglist[7] );
+      case 'CONTACT':
+        return $this->setContact( $arglist[1], $arglist[2], $arglist[3] );
+      case 'CREATED':
+        return $this->setCreated( $arglist[1], $arglist[2], $arglist[3], $arglist[4], $arglist[5], $arglist[6], $arglist[7] );
+      case 'DESCRIPTION':
+        return $this->setDescription( $arglist[1], $arglist[2], $arglist[3] );
+      case 'DTEND':
+        return $this->setDtend( $arglist[1], $arglist[2], $arglist[3], $arglist[4], $arglist[5], $arglist[6], $arglist[7], $arglist[8] );
+      case 'DTSTAMP':
+        return $this->setDtstamp( $arglist[1], $arglist[2], $arglist[3], $arglist[4], $arglist[5], $arglist[6], $arglist[7] );
+      case 'DTSTART':
+        return $this->setDtstart( $arglist[1], $arglist[2], $arglist[3], $arglist[4], $arglist[5], $arglist[6], $arglist[7], $arglist[8] );
+      case 'DUE':
+        return $this->setDue( $arglist[1], $arglist[2], $arglist[3], $arglist[4], $arglist[5], $arglist[6], $arglist[7], $arglist[8] );
+      case 'DURATION':
+        return $this->setDuration( $arglist[1], $arglist[2], $arglist[3], $arglist[4], $arglist[5], $arglist[6] );
+      case 'EXDATE':
+        return $this->setExdate( $arglist[1], $arglist[2], $arglist[3] );
+      case 'EXRULE':
+        return $this->setExrule( $arglist[1], $arglist[2], $arglist[3] );
+      case 'FREEBUSY':
+        return $this->setFreebusy( $arglist[1], $arglist[2], $arglist[3], $arglist[4] );
+      case 'GEO':
+        return $this->setGeo( $arglist[1], $arglist[2], $arglist[3] );
+      case 'LAST-MODIFIED':
+        return $this->setLastModified( $arglist[1], $arglist[2], $arglist[3], $arglist[4], $arglist[5], $arglist[6], $arglist[7] );
+      case 'LOCATION':
+        return $this->setLocation( $arglist[1], $arglist[2] );
+      case 'ORGANIZER':
+        return $this->setOrganizer( $arglist[1], $arglist[2] );
+      case 'PERCENT-COMPLETE':
+        return $this->setPercentComplete( $arglist[1], $arglist[2] );
+      case 'PRIORITY':
+        return $this->setPriority( $arglist[1], $arglist[2] );
+      case 'RDATE':
+        return $this->setRdate( $arglist[1], $arglist[2], $arglist[3] );
+      case 'RECURRENCE-ID':
+       return $this->setRecurrenceid( $arglist[1], $arglist[2], $arglist[3], $arglist[4], $arglist[5], $arglist[6], $arglist[7], $arglist[8] );
+      case 'RELATED-TO':
+        return $this->setRelatedTo( $arglist[1], $arglist[2], $arglist[3] );
+      case 'REPEAT':
+        return $this->setRepeat( $arglist[1], $arglist[2] );
+      case 'REQUEST-STATUS':
+        return $this->setRequestStatus( $arglist[1], $arglist[2], $arglist[3], $arglist[4], $arglist[5] );
+      case 'RESOURCES':
+        return $this->setResources( $arglist[1], $arglist[2], $arglist[3] );
+      case 'RRULE':
+        return $this->setRrule( $arglist[1], $arglist[2], $arglist[3] );
+      case 'SEQUENCE':
+        return $this->setSequence( $arglist[1], $arglist[2] );
+      case 'STATUS':
+        return $this->setStatus( $arglist[1], $arglist[2] );
+      case 'SUMMARY':
+        return $this->setSummary( $arglist[1], $arglist[2] );
+      case 'TRANSP':
+        return $this->setTransp( $arglist[1], $arglist[2] );
+      case 'TRIGGER':
+        return $this->setTrigger( $arglist[1], $arglist[2], $arglist[3], $arglist[4], $arglist[5], $arglist[6], $arglist[7], $arglist[8], $arglist[9], $arglist[10], $arglist[11] );
+      case 'TZID':
+        return $this->setTzid( $arglist[1], $arglist[2] );
+      case 'TZNAME':
+        return $this->setTzname( $arglist[1], $arglist[2], $arglist[3] );
+      case 'TZOFFSETFROM':
+        return $this->setTzoffsetfrom( $arglist[1], $arglist[2] );
+      case 'TZOFFSETTO':
+        return $this->setTzoffsetto( $arglist[1], $arglist[2] );
+      case 'TZURL':
+        return $this->setTzurl( $arglist[1], $arglist[2] );
+      case 'UID':
+        return $this->setUid( $arglist[1], $arglist[2] );
+      case 'URL':
+        return $this->setUrl( $arglist[1], $arglist[2] );
+      default:
+        return $this->setXprop( $arglist[0], $arglist[1], $arglist[2] );
+    }
+    return FALSE;
+  }
+/*********************************************************************************/
+/**
+ * parse component unparsed data into properties
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.10.2 - 2011-07-17
+ * @param mixed $unparsedtext, optional, strict rfc2445 formatted, single property string or array of strings
+ * @return bool FALSE if error occurs during parsing
+ *
+ */
+  function parse( $unparsedtext=null ) {
+    if( !empty( $unparsedtext )) {
+      $nl = $this->getConfig( 'nl' );
+      if( is_array( $unparsedtext ))
+        $unparsedtext = implode( '\n'.$nl, $unparsedtext );
+            /* fix line folding */
+      $eolchars = array( "\r\n", "\n\r", "\n", "\r" ); // check all line endings
+      $EOLmark = FALSE;
+      foreach( $eolchars as $eolchar ) {
+        if( !$EOLmark  && ( FALSE !== strpos( $unparsedtext, $eolchar ))) {
+          $unparsedtext = str_replace( $eolchar." ",  '',  $unparsedtext );
+          $unparsedtext = str_replace( $eolchar."\t", '',  $unparsedtext );
+          if( $eolchar != $nl )
+            $unparsedtext = str_replace( $eolchar,    $nl, $unparsedtext );
+          $EOLmark = TRUE;
+        }
+      }
+      $tmp = explode( $nl, $unparsedtext );
+      $unparsedtext = array();
+      foreach( $tmp as $tmpr )
+        if( !empty( $tmpr ))
+          $unparsedtext[] = $tmpr;
+    }
+    elseif( !isset( $this->unparsed ))
+      $unparsedtext = array();
+    else
+      $unparsedtext = $this->unparsed;
+    $this->unparsed = array();
+    $comp = & $this;
+    $config = $this->getConfig();
+    foreach ( $unparsedtext as $line ) {
+ // echo $comp->objName.": $line<br />"; // test ###
+      if( in_array( strtoupper( substr( $line, 0, 6 )), array( 'END:VA', 'END:DA' )))
+        $this->components[] = $comp->copy();
+      elseif( 'END:ST' == strtoupper( substr( $line, 0, 6 )))
+        array_unshift( $this->components, $comp->copy());
+      elseif( 'END:' == strtoupper( substr( $line, 0, 4 )))
+        break;
+      elseif( 'BEGIN:VALARM'   == strtoupper( substr( $line, 0, 12 )))
+        $comp = new valarm( $config);
+      elseif( 'BEGIN:STANDARD' == strtoupper( substr( $line, 0, 14 )))
+        $comp = new vtimezone( 'standard', $config );
+      elseif( 'BEGIN:DAYLIGHT' == strtoupper( substr( $line, 0, 14 )))
+        $comp = new vtimezone( 'daylight', $config );
+      elseif( 'BEGIN:'         == strtoupper( substr( $line, 0, 6 )))
+        continue;
+      else {
+        $comp->unparsed[] = $line;
+// echo $comp->objName.": $line<br />\n"; // test ###
+      }
+    }
+    unset( $config );
+// echo $this->objName.'<br />'.var_export( $this->unparsed, TRUE )."<br />\n"; // test ###
+            /* concatenate property values spread over several lines */
+    $lastix    = -1;
+    $propnames = array( 'action', 'attach', 'attendee', 'categories', 'comment', 'completed'
+                      , 'contact', 'class', 'created', 'description', 'dtend', 'dtstart'
+                      , 'dtstamp', 'due', 'duration', 'exdate', 'exrule', 'freebusy', 'geo'
+                      , 'last-modified', 'location', 'organizer', 'percent-complete'
+                      , 'priority', 'rdate', 'recurrence-id', 'related-to', 'repeat'
+                      , 'request-status', 'resources', 'rrule', 'sequence', 'status'
+                      , 'summary', 'transp', 'trigger', 'tzid', 'tzname', 'tzoffsetfrom'
+                      , 'tzoffsetto', 'tzurl', 'uid', 'url', 'x-' );
+    $proprows  = array();
+    foreach( $this->unparsed as $line ) {
+      $newProp = FALSE;
+      foreach ( $propnames as $propname ) {
+        if( $propname == strtolower( substr( $line, 0, strlen( $propname )))) {
+          $newProp = TRUE;
+          break;
+        }
+      }
+      if( $newProp ) {
+        if( -1 < $lastix )
+          $proprows[$lastix] = $proprows[$lastix];
+        $newProp = FALSE;
+        $lastix++;
+        $proprows[$lastix]  = $line;
+      }
+      else
+        $proprows[$lastix] .= '!"#Â€%&/()=?'.$line;
+    }
+            /* parse each property 'line' */
+    foreach( $proprows as $line ) {
+      $line = str_replace( '!"#Â€%&/()=? ', '', $line );
+      $line = str_replace( '!"#Â€%&/()=?', '', $line );
+      if( '\n' == substr( $line, -2 ))
+        $line = substr( $line, 0, strlen( $line ) - 2 );
+            /* get propname, (problem with x-properties, otherwise in previous loop) */
+      $cix = $propname = null;
+      for( $cix=0, $clen = strlen( $line ); $cix < $clen; $cix++ ) {
+        if( in_array( $line[$cix], array( ':', ';' )))
+          break;
+        else {
+          $propname .= $line[$cix];
+        }
+      }
+      if(( 'x-' == substr( $propname, 0, 2 )) || ( 'X-' == substr( $propname, 0, 2 ))) {
+        $propname2 = $propname;
+        $propname  = 'X-';
+      }
+            /* rest of the line is opt.params and value */
+      $line = substr( $line, $cix );
+            /* separate attributes from value */
+      $attr   = array();
+      $attrix = -1;
+      $clen = strlen( $line );
+      for( $cix=0; $cix < $clen; $cix++ ) {
+        if((       ':'   == $line[$cix] )             &&
+                 ( '://' != substr( $line, $cix, 3 )) &&
+             ( !in_array( strtolower( substr( $line, $cix - 3, 4 )), array( 'fax:', 'cid:', 'sms:', 'tel:', 'urn:' ))) &&
+             ( !in_array( strtolower( substr( $line, $cix - 4, 5 )), array( 'crid:', 'news:', 'pres:' ))) &&
+           ( 'mailto:'   != strtolower( substr( $line, $cix - 6, 7 )))) {
+          $attrEnd = TRUE;
+          if(( $cix < ( $clen - 4 )) &&
+               ctype_digit( substr( $line, $cix+1, 4 ))) { // an URI with a (4pos) portnr??
+            for( $c2ix = $cix; 3 < $c2ix; $c2ix-- ) {
+              if( '://' == substr( $line, $c2ix - 2, 3 )) {
+                $attrEnd = FALSE;
+                break; // an URI with a portnr!!
+              }
+            }
+          }
+          if( $attrEnd) {
+            $line = substr( $line, $cix + 1 );
+            break;
+          }
+        }
+        if( ';' == $line[$cix] )
+          $attr[++$attrix] = null;
+        else
+          $attr[$attrix] .= $line[$cix];
+      }
+            /* make attributes in array format */
+      $propattr = array();
+      foreach( $attr as $attribute ) {
+        $attrsplit = explode( '=', $attribute, 2 );
+        if( 1 < count( $attrsplit ))
+          $propattr[$attrsplit[0]] = $attrsplit[1];
+        else
+          $propattr[] = $attribute;
+      }
+            /* call setProperty( $propname.. . */
+      switch( strtoupper( $propname )) {
+        case 'ATTENDEE':
+          foreach( $propattr as $pix => $attr ) {
+            $attr2 = explode( ',', $attr );
+              if( 1 < count( $attr2 ))
+                $propattr[$pix] = $attr2;
+          }
+          $this->setProperty( $propname, $line, $propattr );
+          break;
+        case 'CATEGORIES':
+        case 'RESOURCES':
+          if( FALSE !== strpos( $line, ',' )) {
+            $content  = explode( ',', $line );
+            $clen     = count( $content );
+            for( $cix = 0; $cix < $clen; $cix++ ) {
+              if( "\\" == substr($content[$cix], -1)) {
+                $content[$cix] .= ','.$content[$cix + 1];
+                unset($content[$cix + 1]);
+                $cix++;
+              }
+            }
+            if( 1 < count( $content )) {
+              $content = array_values( $content );
+              foreach( $content as $cix => $contentPart )
+                $content[$cix] = calendarComponent::_strunrep( $contentPart );
+              $this->setProperty( $propname, $content, $propattr );
+              break;
+            }
+            else
+              $line = reset( $content );
+          }
+        case 'X-':
+          $propname = ( isset( $propname2 )) ? $propname2 : $propname;
+        case 'COMMENT':
+        case 'CONTACT':
+        case 'DESCRIPTION':
+        case 'LOCATION':
+        case 'SUMMARY':
+          if( empty( $line ))
+            $propattr = null;
+          $this->setProperty( $propname, calendarComponent::_strunrep( $line ), $propattr );
+          unset( $propname2 );
+          break;
+        case 'REQUEST-STATUS':
+          $values    = explode( ';', $line, 3 );
+          $values[1] = ( !isset( $values[1] )) ? null : calendarComponent::_strunrep( $values[1] );
+          $values[2] = ( !isset( $values[2] )) ? null : calendarComponent::_strunrep( $values[2] );
+          $this->setProperty( $propname
+                            , $values[0]  // statcode
+                            , $values[1]  // statdesc
+                            , $values[2]  // extdata
+                            , $propattr );
+          break;
+        case 'FREEBUSY':
+          $fbtype = ( isset( $propattr['FBTYPE'] )) ? $propattr['FBTYPE'] : ''; // force setting default, if missing
+          unset( $propattr['FBTYPE'] );
+          $values = explode( ',', $line );
+          foreach( $values as $vix => $value ) {
+            $value2 = explode( '/', $value );
+            if( 1 < count( $value2 ))
+              $values[$vix] = $value2;
+          }
+          $this->setProperty( $propname, $fbtype, $values, $propattr );
+          break;
+        case 'GEO':
+          $value = explode( ';', $line, 2 );
+          if( 2 > count( $value ))
+            $value[1] = null;
+          $this->setProperty( $propname, $value[0], $value[1], $propattr );
+          break;
+        case 'EXDATE':
+          $values = ( !empty( $line )) ? explode( ',', $line ) : null;
+          $this->setProperty( $propname, $values, $propattr );
+          break;
+        case 'RDATE':
+          if( empty( $line )) {
+            $this->setProperty( $propname, $line, $propattr );
+            break;
+          }
+          $values = explode( ',', $line );
+          foreach( $values as $vix => $value ) {
+            $value2 = explode( '/', $value );
+            if( 1 < count( $value2 ))
+              $values[$vix] = $value2;
+          }
+          $this->setProperty( $propname, $values, $propattr );
+          break;
+        case 'EXRULE':
+        case 'RRULE':
+          $values = explode( ';', $line );
+          $recur = array();
+          foreach( $values as $value2 ) {
+            if( empty( $value2 ))
+              continue; // ;-char in ending position ???
+            $value3 = explode( '=', $value2, 2 );
+            $rulelabel = strtoupper( $value3[0] );
+            switch( $rulelabel ) {
+              case 'BYDAY': {
+                $value4 = explode( ',', $value3[1] );
+                if( 1 < count( $value4 )) {
+                  foreach( $value4 as $v5ix => $value5 ) {
+                    $value6 = array();
+                    $dayno = $dayname = null;
+                    $value5 = trim( (string) $value5 );
+                    if(( ctype_alpha( substr( $value5, -1 ))) &&
+                       ( ctype_alpha( substr( $value5, -2, 1 )))) {
+                      $dayname = substr( $value5, -2, 2 );
+                      if( 2 < strlen( $value5 ))
+                        $dayno = substr( $value5, 0, ( strlen( $value5 ) - 2 ));
+                    }
+                    if( $dayno )
+                      $value6[] = $dayno;
+                    if( $dayname )
+                      $value6['DAY'] = $dayname;
+                    $value4[$v5ix] = $value6;
+                  }
+                }
+                else {
+                  $value4 = array();
+                  $dayno  = $dayname = null;
+                  $value5 = trim( (string) $value3[1] );
+                  if(( ctype_alpha( substr( $value5, -1 ))) &&
+                     ( ctype_alpha( substr( $value5, -2, 1 )))) {
+                      $dayname = substr( $value5, -2, 2 );
+                    if( 2 < strlen( $value5 ))
+                      $dayno = substr( $value5, 0, ( strlen( $value5 ) - 2 ));
+                  }
+                  if( $dayno )
+                    $value4[] = $dayno;
+                  if( $dayname )
+                    $value4['DAY'] = $dayname;
+                }
+                $recur[$rulelabel] = $value4;
+                break;
+              }
+              default: {
+                $value4 = explode( ',', $value3[1] );
+                if( 1 < count( $value4 ))
+                  $value3[1] = $value4;
+                $recur[$rulelabel] = $value3[1];
+                break;
+              }
+            } // end - switch $rulelabel
+          } // end - foreach( $values.. .
+          $this->setProperty( $propname, $recur, $propattr );
+          break;
+        case 'ACTION':
+        case 'CLASSIFICATION':
+        case 'STATUS':
+        case 'TRANSP':
+        case 'UID':
+        case 'TZID':
+        case 'RELATED-TO':
+        case 'TZNAME':
+          $line = calendarComponent::_strunrep( $line );
+        default:
+          $this->setProperty( $propname, $line, $propattr );
+          break;
+      } // end  switch( $propname.. .
+    } // end - foreach( $proprows.. .
+    unset( $unparsedtext, $this->unparsed, $proprows );
+    if( isset( $this->components ) && is_array( $this->components ) && ( 0 < count( $this->components ))) {
+      $ckeys = array_keys( $this->components );
+      foreach( $ckeys as $ckey ) {
+        if( !empty( $this->components[$ckey] ) && !empty( $this->components[$ckey]->unparsed )) {
+          $this->components[$ckey]->parse();
+        }
+      }
+    }
+    return TRUE;
+  }
+/*********************************************************************************/
+/*********************************************************************************/
+/**
+ * return a copy of this component
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.8.8 - 2011-03-15
+ * @return object
+ */
+  function copy() {
+    $serialized_contents = serialize( $this );
+    $copy = unserialize( $serialized_contents );
+    return $copy;
+ }
+/*********************************************************************************/
+/*********************************************************************************/
+/**
+ * delete calendar subcomponent from component container
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.8.8 - 2011-03-15
+ * @param mixed $arg1 ordno / component type / component uid
+ * @param mixed $arg2 optional, ordno if arg1 = component type
+ * @return void
+ */
+  function deleteComponent( $arg1, $arg2=FALSE  ) {
+    if( !isset( $this->components )) return FALSE;
+    $argType = $index = null;
+    if ( ctype_digit( (string) $arg1 )) {
+      $argType = 'INDEX';
+      $index   = (int) $arg1 - 1;
+    }
+    elseif(( strlen( $arg1 ) <= strlen( 'vfreebusy' )) && ( FALSE === strpos( $arg1, '@' ))) {
+      $argType = strtolower( $arg1 );
+      $index   = ( !empty( $arg2 ) && ctype_digit( (string) $arg2 )) ? (( int ) $arg2 - 1 ) : 0;
+    }
+    $cix2dC = 0;
+    foreach ( $this->components as $cix => $component) {
+      if( empty( $component )) continue;
+      if(( 'INDEX' == $argType ) && ( $index == $cix )) {
+        unset( $this->components[$cix] );
+        return TRUE;
+      }
+      elseif( $argType == $component->objName ) {
+        if( $index == $cix2dC ) {
+          unset( $this->components[$cix] );
+          return TRUE;
+        }
+        $cix2dC++;
+      }
+      elseif( !$argType && ($arg1 == $component->getProperty( 'uid' ))) {
+        unset( $this->components[$cix] );
+        return TRUE;
+      }
+    }
+    return FALSE;
+  }
+/**
+ * get calendar component subcomponent from component container
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.8.8 - 2011-03-15
+ * @param mixed $arg1 optional, ordno/component type/ component uid
+ * @param mixed $arg2 optional, ordno if arg1 = component type
+ * @return object
+ */
+  function getComponent ( $arg1=FALSE, $arg2=FALSE ) {
+    if( !isset( $this->components )) return FALSE;
+    $index = $argType = null;
+    if ( !$arg1 ) {
+      $argType = 'INDEX';
+      $index   = $this->compix['INDEX'] =
+        ( isset( $this->compix['INDEX'] )) ? $this->compix['INDEX'] + 1 : 1;
+    }
+    elseif ( ctype_digit( (string) $arg1 )) {
+      $argType = 'INDEX';
+      $index   = (int) $arg1;
+      unset( $this->compix );
+    }
+    elseif(( strlen( $arg1 ) <= strlen( 'vfreebusy' )) && ( FALSE === strpos( $arg1, '@' ))) {
+      unset( $this->compix['INDEX'] );
+      $argType = strtolower( $arg1 );
+      if( !$arg2 )
+        $index = $this->compix[$argType] = ( isset( $this->compix[$argType] )) ? $this->compix[$argType] + 1 : 1;
+      else
+        $index = (int) $arg2;
+    }
+    $index  -= 1;
+    $ckeys = array_keys( $this->components );
+    if( !empty( $index) && ( $index > end( $ckeys )))
+      return FALSE;
+    $cix2gC = 0;
+    foreach( $this->components as $cix => $component ) {
+      if( empty( $component )) continue;
+      if(( 'INDEX' == $argType ) && ( $index == $cix ))
+        return $component->copy();
+      elseif( $argType == $component->objName ) {
+         if( $index == $cix2gC )
+           return $component->copy();
+         $cix2gC++;
+      }
+      elseif( !$argType && ( $arg1 == $component->getProperty( 'uid' )))
+        return $component->copy();
+    }
+            /* not found.. . */
+    unset( $this->compix );
+    return false;
+  }
+/**
+ * add calendar component as subcomponent to container for subcomponents
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 1.x.x - 2007-04-24
+ * @param object $component calendar component
+ * @return void
+ */
+  function addSubComponent ( $component ) {
+    $this->setComponent( $component );
+  }
+/**
+ * create new calendar component subcomponent, already included within component
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.6.33 - 2011-01-03
+ * @param string $compType subcomponent type
+ * @return object (reference)
+ */
+  function & newComponent( $compType ) {
+    $config = $this->getConfig();
+    $keys   = array_keys( $this->components );
+    $ix     = end( $keys) + 1;
+    switch( strtoupper( $compType )) {
+      case 'ALARM':
+      case 'VALARM':
+        $this->components[$ix] = new valarm( $config );
+        break;
+      case 'STANDARD':
+        array_unshift( $this->components, new vtimezone( 'STANDARD', $config ));
+        $ix = 0;
+        break;
+      case 'DAYLIGHT':
+        $this->components[$ix] = new vtimezone( 'DAYLIGHT', $config );
+        break;
+      default:
+        return FALSE;
+    }
+    return $this->components[$ix];
+  }
+/**
+ * add calendar component as subcomponent to container for subcomponents
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.8.8 - 2011-03-15
+ * @param object $component calendar component
+ * @param mixed $arg1 optional, ordno/component type/ component uid
+ * @param mixed $arg2 optional, ordno if arg1 = component type
+ * @return bool
+ */
+  function setComponent( $component, $arg1=FALSE, $arg2=FALSE  ) {
+    if( !isset( $this->components )) return FALSE;
+    $component->setConfig( $this->getConfig(), FALSE, TRUE );
+    if( !in_array( $component->objName, array( 'valarm', 'vtimezone', 'standard', 'daylight' ))) {
+            /* make sure dtstamp and uid is set */
+      $dummy = $component->getProperty( 'dtstamp' );
+      $dummy = $component->getProperty( 'uid' );
+    }
+    if( !$arg1 ) { // plain insert, last in chain
+      $this->components[] = $component->copy();
+      return TRUE;
+    }
+    $argType = $index = null;
+    if ( ctype_digit( (string) $arg1 )) { // index insert/replace
+      $argType = 'INDEX';
+      $index   = (int) $arg1 - 1;
+    }
+    elseif( in_array( strtolower( $arg1 ), array( 'vevent', 'vtodo', 'vjournal', 'vfreebusy', 'valarm', 'vtimezone' ))) {
+      $argType = strtolower( $arg1 );
+      $index = ( ctype_digit( (string) $arg2 )) ? ((int) $arg2) - 1 : 0;
+    }
+    // else if arg1 is set, arg1 must be an UID
+    $cix2sC = 0;
+    foreach ( $this->components as $cix => $component2 ) {
+      if( empty( $component2 )) continue;
+      if(( 'INDEX' == $argType ) && ( $index == $cix )) { // index insert/replace
+        $this->components[$cix] = $component->copy();
+        return TRUE;
+      }
+      elseif( $argType == $component2->objName ) { // component Type index insert/replace
+        if( $index == $cix2sC ) {
+          $this->components[$cix] = $component->copy();
+          return TRUE;
+        }
+        $cix2sC++;
+      }
+      elseif( !$argType && ( $arg1 == $component2->getProperty( 'uid' ))) { // UID insert/replace
+        $this->components[$cix] = $component->copy();
+        return TRUE;
+      }
+    }
+            /* arg1=index and not found.. . insert at index .. .*/
+    if( 'INDEX' == $argType ) {
+      $this->components[$index] = $component->copy();
+      ksort( $this->components, SORT_NUMERIC );
+    }
+    else    /* not found.. . insert last in chain anyway .. .*/
+    $this->components[] = $component->copy();
+    return TRUE;
+  }
+/**
+ * creates formatted output for subcomponents
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.6.27 - 2010-12-12
+ * @return string
+ */
+  function createSubComponent() {
+    $output = null;
+    foreach( $this->components as $component ) {
+      if( empty( $component )) continue;
+      $component->setConfig( $this->getConfig(), FALSE, TRUE );
+      $output .= $component->createComponent( $this->xcaldecl );
+    }
+    return $output;
+  }
+/********************************************************************************/
+/**
+ * break lines at pos 75
+ *
+ * Lines of text SHOULD NOT be longer than 75 octets, excluding the line
+ * break. Long content lines SHOULD be split into a multiple line
+ * representations using a line "folding" technique. That is, a long
+ * line can be split between any two characters by inserting a CRLF
+ * immediately followed by a single linear white space character (i.e.,
+ * SPACE, US-ASCII decimal 32 or HTAB, US-ASCII decimal 9). Any sequence
+ * of CRLF followed immediately by a single linear white space character
+ * is ignored (i.e., removed) when processing the content type.
+ *
+ * Edited 2007-08-26 by Anders Litzell, anders@litzell.se to fix bug where
+ * the reserved expression "\n" in the arg $string could be broken up by the
+ * folding of lines, causing ambiguity in the return string.
+ * Fix uses var $breakAtChar=75 and breaks the line at $breakAtChar-1 if need be.
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.6.13 - 2010-12-06
+ * @param string $value
+ * @return string
+ */
+  function _size75( $string ) {
+    $tmp    = $string;
+    $string = null;
+            /* if PHP is config with  mb_string.. . */
+    if( defined( MB_OVERLOAD_STRING )) {
+      $strlen  = mb_strlen( $tmp );
+      while( $strlen > 75 ) {
+        $breakAtChar = 75;
+        if( substr( $tmp, ( $breakAtChar - 1 ), strlen( '\n' )) == '\n' )
+          $breakAtChar = $breakAtChar - 1;
+        $string .= mb_substr( $tmp, 0, $breakAtChar );
+        if( '\n' == substr( $string, ( 0 - strlen( '\n' ))))
+          $string = substr( $string, 0, ( strlen( $string ) - strlen( '\n' )));
+        if( $this->nl != mb_substr( $string, ( 0 - strlen( $this->nl ))))
+          $string .= $this->nl;
+        $tmp     = ' '.mb_substr( $tmp, $breakAtChar );
+        $strlen  = mb_strlen( $tmp );
+      } // end while
+      if( 0 < $strlen ) {
+        $string .= $tmp; // the rest
+        if( '\n' == substr( $string, ( 0 - strlen( '\n' ))))
+          $string = substr( $string, 0, ( strlen( $string ) - strlen( '\n' )));
+        if( $this->nl != mb_substr( $string, ( 0 - strlen( $this->nl ))))
+          $string .= $this->nl;
+      }
+      return $string;
+    }
+            /* if PHP is not config with  mb_string.. . */
+    $eolcharlen = strlen( '\n' );
+    while( TRUE ) {
+      $bytecnt = strlen( $tmp );
+      $charCnt = $ix = 0;
+      for( $ix = 0; $ix < $bytecnt; $ix++ ) {
+        if(( 73 < $charCnt ) && ( '\n' == substr( $tmp, $ix, $eolcharlen ))) {
+          $ix += $eolcharlen;
+          break;                                    // break when '\n' and eol
+        }
+        elseif( 74 < $charCnt )
+          break;                                    // always break for-loop here
+        else {
+          $byte = ord( $tmp[$ix] );
+          if ($byte <= 127) {                       // add a one byte character
+            $string .= substr( $tmp, $ix, 1 );
+            $charCnt += 1;
+          }
+          else if ($byte >= 194 && $byte <= 223) {  // start byte in two byte character
+            $string .= substr( $tmp, $ix, 2 );      // add a two bytes character
+            $charCnt += 1;
+          }
+          else if ($byte >= 224 && $byte <= 239) {  // start byte in three bytes character
+            $string .= substr( $tmp, $ix, 3 );      // add a three bytes character
+            $charCnt += 1;
+          }
+          else if ($byte >= 240 && $byte <= 244) {  // start byte in four bytes character
+            $string .= substr( $tmp, $ix, 4 );      // add a four bytes character
+            $charCnt += 1;
+          }
+        }
+      } // end for
+      if( '\n' == substr( $string, ( 0 - strlen( '\n' ))))
+        $string = substr( $string, 0, ( strlen( $string ) - strlen( '\n' )));
+      if( $this->nl != substr( $string, ( 0 - strlen( $this->nl ))))
+        $string .= $this->nl;
+      $tmp     = substr( $tmp, $ix );
+      if( empty( $tmp ))
+        break; // while-loop breakes here
+      else
+        $tmp  = ' '.$tmp;
+    } // end while
+    if( !empty( $tmp )) {
+      if( '\n' == substr( $string, ( 0 - strlen( '\n' ))))
+        $string = substr( $string, 0, ( strlen( $string ) - strlen( '\n' ))).$this->nl;
+      if( $this->nl != substr( $string, ( 0 - strlen( $this->nl ))))
+        $string .= $this->nl;
+    }
+    return $string;
+  }
+/**
+ * special characters management output
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.6.15 - 2010-09-24
+ * @param string $string
+ * @return string
+ */
+  function _strrep( $string ) {
+    switch( $this->format ) {
+      case 'xcal':
+        $string = str_replace( '\n',  $this->nl, $string);
+        $string = htmlspecialchars( strip_tags( stripslashes( urldecode ( $string ))));
+        break;
+      default:
+        $pos = 0;
+        $specChars = array( 'n', 'N', 'r', ',', ';' );
+        while( $pos <= strlen( $string )) {
+          $pos = strpos( $string, "\\", $pos );
+          if( FALSE === $pos )
+            break;
+          if( !in_array( substr( $string, $pos, 1 ), $specChars )) {
+            $string = substr( $string, 0, $pos )."\\".substr( $string, ( $pos + 1 ));
+            $pos += 1;
+          }
+          $pos += 1;
+        }
+        if( FALSE !== strpos( $string, '"' ))
+          $string = str_replace('"',   "'",       $string);
+        if( FALSE !== strpos( $string, ',' ))
+          $string = str_replace(',',   '\,',      $string);
+        if( FALSE !== strpos( $string, ';' ))
+          $string = str_replace(';',   '\;',      $string);
+
+        if( FALSE !== strpos( $string, "\r\n" ))
+          $string = str_replace( "\r\n", '\n',    $string);
+        elseif( FALSE !== strpos( $string, "\r" ))
+          $string = str_replace( "\r", '\n',      $string);
+
+        elseif( FALSE !== strpos( $string, "\n" ))
+          $string = str_replace( "\n", '\n',      $string);
+
+        if( FALSE !== strpos( $string, '\N' ))
+          $string = str_replace( '\N', '\n',      $string);
+//        if( FALSE !== strpos( $string, $this->nl ))
+          $string = str_replace( $this->nl, '\n', $string);
+        break;
+    }
+    return $string;
+  }
+/**
+ * special characters management input (from iCal file)
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.6.22 - 2010-10-17
+ * @param string $string
+ * @return string
+ */
+  static function _strunrep( $string ) {
+    $string = str_replace( '\\\\', '\\',     $string);
+    $string = str_replace( '\,',   ',',      $string);
+    $string = str_replace( '\;',   ';',      $string);
+//    $string = str_replace( '\n',  $this->nl, $string); // ??
+    return $string;
+  }
+}
+/*********************************************************************************/
+/*********************************************************************************/
+/**
+ * class for calendar component VEVENT
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.5.1 - 2008-10-12
+ */
+class vevent extends calendarComponent {
+  var $attach;
+  var $attendee;
+  var $categories;
+  var $comment;
+  var $contact;
+  var $class;
+  var $created;
+  var $description;
+  var $dtend;
+  var $dtstart;
+  var $duration;
+  var $exdate;
+  var $exrule;
+  var $geo;
+  var $lastmodified;
+  var $location;
+  var $organizer;
+  var $priority;
+  var $rdate;
+  var $recurrenceid;
+  var $relatedto;
+  var $requeststatus;
+  var $resources;
+  var $rrule;
+  var $sequence;
+  var $status;
+  var $summary;
+  var $transp;
+  var $url;
+  var $xprop;
+            //  component subcomponents container
+  var $components;
+/**
+ * constructor for calendar component VEVENT object
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.8.2 - 2011-05-01
+ * @param  array $config
+ * @return void
+ */
+  function vevent( $config = array()) {
+    $this->calendarComponent();
+
+    $this->attach          = '';
+    $this->attendee        = '';
+    $this->categories      = '';
+    $this->class           = '';
+    $this->comment         = '';
+    $this->contact         = '';
+    $this->created         = '';
+    $this->description     = '';
+    $this->dtstart         = '';
+    $this->dtend           = '';
+    $this->duration        = '';
+    $this->exdate          = '';
+    $this->exrule          = '';
+    $this->geo             = '';
+    $this->lastmodified    = '';
+    $this->location        = '';
+    $this->organizer       = '';
+    $this->priority        = '';
+    $this->rdate           = '';
+    $this->recurrenceid    = '';
+    $this->relatedto       = '';
+    $this->requeststatus   = '';
+    $this->resources       = '';
+    $this->rrule           = '';
+    $this->sequence        = '';
+    $this->status          = '';
+    $this->summary         = '';
+    $this->transp          = '';
+    $this->url             = '';
+    $this->xprop           = '';
+
+    $this->components      = array();
+
+    if( defined( 'ICAL_LANG' ) && !isset( $config['language'] ))
+                                          $config['language']   = ICAL_LANG;
+    if( !isset( $config['allowEmpty'] ))  $config['allowEmpty'] = TRUE;
+    if( !isset( $config['nl'] ))          $config['nl']         = "\r\n";
+    if( !isset( $config['format'] ))      $config['format']     = 'iCal';
+    if( !isset( $config['delimiter'] ))   $config['delimiter']  = DIRECTORY_SEPARATOR;
+    $this->setConfig( $config );
+
+  }
+/**
+ * create formatted output for calendar component VEVENT object instance
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.5.1 - 2008-11-07
+ * @param array $xcaldecl
+ * @return string
+ */
+  function createComponent( &$xcaldecl ) {
+    $objectname    = $this->_createFormat();
+    $component     = $this->componentStart1.$objectname.$this->componentStart2.$this->nl;
+    $component    .= $this->createUid();
+    $component    .= $this->createDtstamp();
+    $component    .= $this->createAttach();
+    $component    .= $this->createAttendee();
+    $component    .= $this->createCategories();
+    $component    .= $this->createComment();
+    $component    .= $this->createContact();
+    $component    .= $this->createClass();
+    $component    .= $this->createCreated();
+    $component    .= $this->createDescription();
+    $component    .= $this->createDtstart();
+    $component    .= $this->createDtend();
+    $component    .= $this->createDuration();
+    $component    .= $this->createExdate();
+    $component    .= $this->createExrule();
+    $component    .= $this->createGeo();
+    $component    .= $this->createLastModified();
+    $component    .= $this->createLocation();
+    $component    .= $this->createOrganizer();
+    $component    .= $this->createPriority();
+    $component    .= $this->createRdate();
+    $component    .= $this->createRrule();
+    $component    .= $this->createRelatedTo();
+    $component    .= $this->createRequestStatus();
+    $component    .= $this->createRecurrenceid();
+    $component    .= $this->createResources();
+    $component    .= $this->createSequence();
+    $component    .= $this->createStatus();
+    $component    .= $this->createSummary();
+    $component    .= $this->createTransp();
+    $component    .= $this->createUrl();
+    $component    .= $this->createXprop();
+    $component    .= $this->createSubComponent();
+    $component    .= $this->componentEnd1.$objectname.$this->componentEnd2;
+    if( is_array( $this->xcaldecl ) && ( 0 < count( $this->xcaldecl ))) {
+      foreach( $this->xcaldecl as $localxcaldecl )
+        $xcaldecl[] = $localxcaldecl;
+    }
+    return $component;
+  }
+}
+/*********************************************************************************/
+/*********************************************************************************/
+/**
+ * class for calendar component VTODO
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.5.1 - 2008-10-12
+ */
+class vtodo extends calendarComponent {
+  var $attach;
+  var $attendee;
+  var $categories;
+  var $comment;
+  var $completed;
+  var $contact;
+  var $class;
+  var $created;
+  var $description;
+  var $dtstart;
+  var $due;
+  var $duration;
+  var $exdate;
+  var $exrule;
+  var $geo;
+  var $lastmodified;
+  var $location;
+  var $organizer;
+  var $percentcomplete;
+  var $priority;
+  var $rdate;
+  var $recurrenceid;
+  var $relatedto;
+  var $requeststatus;
+  var $resources;
+  var $rrule;
+  var $sequence;
+  var $status;
+  var $summary;
+  var $url;
+  var $xprop;
+            //  component subcomponents container
+  var $components;
+/**
+ * constructor for calendar component VTODO object
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.8.2 - 2011-05-01
+ * @param array $config
+ * @return void
+ */
+  function vtodo( $config = array()) {
+    $this->calendarComponent();
+
+    $this->attach          = '';
+    $this->attendee        = '';
+    $this->categories      = '';
+    $this->class           = '';
+    $this->comment         = '';
+    $this->completed       = '';
+    $this->contact         = '';
+    $this->created         = '';
+    $this->description     = '';
+    $this->dtstart         = '';
+    $this->due             = '';
+    $this->duration        = '';
+    $this->exdate          = '';
+    $this->exrule          = '';
+    $this->geo             = '';
+    $this->lastmodified    = '';
+    $this->location        = '';
+    $this->organizer       = '';
+    $this->percentcomplete = '';
+    $this->priority        = '';
+    $this->rdate           = '';
+    $this->recurrenceid    = '';
+    $this->relatedto       = '';
+    $this->requeststatus   = '';
+    $this->resources       = '';
+    $this->rrule           = '';
+    $this->sequence        = '';
+    $this->status          = '';
+    $this->summary         = '';
+    $this->url             = '';
+    $this->xprop           = '';
+
+    $this->components      = array();
+
+    if( defined( 'ICAL_LANG' ) && !isset( $config['language'] ))
+                                          $config['language']   = ICAL_LANG;
+    if( !isset( $config['allowEmpty'] ))  $config['allowEmpty'] = TRUE;
+    if( !isset( $config['nl'] ))          $config['nl']         = "\r\n";
+    if( !isset( $config['format'] ))      $config['format']     = 'iCal';
+    if( !isset( $config['delimiter'] ))   $config['delimiter']  = DIRECTORY_SEPARATOR;
+    $this->setConfig( $config );
+
+  }
+/**
+ * create formatted output for calendar component VTODO object instance
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.5.1 - 2008-11-07
+ * @param array $xcaldecl
+ * @return string
+ */
+  function createComponent( &$xcaldecl ) {
+    $objectname    = $this->_createFormat();
+    $component     = $this->componentStart1.$objectname.$this->componentStart2.$this->nl;
+    $component    .= $this->createUid();
+    $component    .= $this->createDtstamp();
+    $component    .= $this->createAttach();
+    $component    .= $this->createAttendee();
+    $component    .= $this->createCategories();
+    $component    .= $this->createClass();
+    $component    .= $this->createComment();
+    $component    .= $this->createCompleted();
+    $component    .= $this->createContact();
+    $component    .= $this->createCreated();
+    $component    .= $this->createDescription();
+    $component    .= $this->createDtstart();
+    $component    .= $this->createDue();
+    $component    .= $this->createDuration();
+    $component    .= $this->createExdate();
+    $component    .= $this->createExrule();
+    $component    .= $this->createGeo();
+    $component    .= $this->createLastModified();
+    $component    .= $this->createLocation();
+    $component    .= $this->createOrganizer();
+    $component    .= $this->createPercentComplete();
+    $component    .= $this->createPriority();
+    $component    .= $this->createRdate();
+    $component    .= $this->createRelatedTo();
+    $component    .= $this->createRequestStatus();
+    $component    .= $this->createRecurrenceid();
+    $component    .= $this->createResources();
+    $component    .= $this->createRrule();
+    $component    .= $this->createSequence();
+    $component    .= $this->createStatus();
+    $component    .= $this->createSummary();
+    $component    .= $this->createUrl();
+    $component    .= $this->createXprop();
+    $component    .= $this->createSubComponent();
+    $component    .= $this->componentEnd1.$objectname.$this->componentEnd2;
+    if( is_array( $this->xcaldecl ) && ( 0 < count( $this->xcaldecl ))) {
+      foreach( $this->xcaldecl as $localxcaldecl )
+        $xcaldecl[] = $localxcaldecl;
+    }
+    return $component;
+  }
+}
+/*********************************************************************************/
+/*********************************************************************************/
+/**
+ * class for calendar component VJOURNAL
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.5.1 - 2008-10-12
+ */
+class vjournal extends calendarComponent {
+  var $attach;
+  var $attendee;
+  var $categories;
+  var $comment;
+  var $contact;
+  var $class;
+  var $created;
+  var $description;
+  var $dtstart;
+  var $exdate;
+  var $exrule;
+  var $lastmodified;
+  var $organizer;
+  var $rdate;
+  var $recurrenceid;
+  var $relatedto;
+  var $requeststatus;
+  var $rrule;
+  var $sequence;
+  var $status;
+  var $summary;
+  var $url;
+  var $xprop;
+/**
+ * constructor for calendar component VJOURNAL object
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.8.2 - 2011-05-01
+ * @param array $config
+ * @return void
+ */
+  function vjournal( $config = array()) {
+    $this->calendarComponent();
+
+    $this->attach          = '';
+    $this->attendee        = '';
+    $this->categories      = '';
+    $this->class           = '';
+    $this->comment         = '';
+    $this->contact         = '';
+    $this->created         = '';
+    $this->description     = '';
+    $this->dtstart         = '';
+    $this->exdate          = '';
+    $this->exrule          = '';
+    $this->lastmodified    = '';
+    $this->organizer       = '';
+    $this->rdate           = '';
+    $this->recurrenceid    = '';
+    $this->relatedto       = '';
+    $this->requeststatus   = '';
+    $this->rrule           = '';
+    $this->sequence        = '';
+    $this->status          = '';
+    $this->summary         = '';
+    $this->url             = '';
+    $this->xprop           = '';
+
+    if( defined( 'ICAL_LANG' ) && !isset( $config['language'] ))
+                                          $config['language']   = ICAL_LANG;
+    if( !isset( $config['allowEmpty'] ))  $config['allowEmpty'] = TRUE;
+    if( !isset( $config['nl'] ))          $config['nl']         = "\r\n";
+    if( !isset( $config['format'] ))      $config['format']     = 'iCal';
+    if( !isset( $config['delimiter'] ))   $config['delimiter']  = DIRECTORY_SEPARATOR;
+    $this->setConfig( $config );
+
+  }
+/**
+ * create formatted output for calendar component VJOURNAL object instance
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.5.1 - 2008-10-12
+ * @param array $xcaldecl
+ * @return string
+ */
+  function createComponent( &$xcaldecl ) {
+    $objectname = $this->_createFormat();
+    $component  = $this->componentStart1.$objectname.$this->componentStart2.$this->nl;
+    $component .= $this->createUid();
+    $component .= $this->createDtstamp();
+    $component .= $this->createAttach();
+    $component .= $this->createAttendee();
+    $component .= $this->createCategories();
+    $component .= $this->createClass();
+    $component .= $this->createComment();
+    $component .= $this->createContact();
+    $component .= $this->createCreated();
+    $component .= $this->createDescription();
+    $component .= $this->createDtstart();
+    $component .= $this->createExdate();
+    $component .= $this->createExrule();
+    $component .= $this->createLastModified();
+    $component .= $this->createOrganizer();
+    $component .= $this->createRdate();
+    $component .= $this->createRequestStatus();
+    $component .= $this->createRecurrenceid();
+    $component .= $this->createRelatedTo();
+    $component .= $this->createRrule();
+    $component .= $this->createSequence();
+    $component .= $this->createStatus();
+    $component .= $this->createSummary();
+    $component .= $this->createUrl();
+    $component .= $this->createXprop();
+    $component .= $this->componentEnd1.$objectname.$this->componentEnd2;
+    if( is_array( $this->xcaldecl ) && ( 0 < count( $this->xcaldecl ))) {
+      foreach( $this->xcaldecl as $localxcaldecl )
+        $xcaldecl[] = $localxcaldecl;
+    }
+    return $component;
+  }
+}
+/*********************************************************************************/
+/*********************************************************************************/
+/**
+ * class for calendar component VFREEBUSY
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.5.1 - 2008-10-12
+ */
+class vfreebusy extends calendarComponent {
+  var $attendee;
+  var $comment;
+  var $contact;
+  var $dtend;
+  var $dtstart;
+  var $duration;
+  var $freebusy;
+  var $organizer;
+  var $requeststatus;
+  var $url;
+  var $xprop;
+            //  component subcomponents container
+  var $components;
+/**
+ * constructor for calendar component VFREEBUSY object
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.8.2 - 2011-05-01
+ * @param array $config
+ * @return void
+ */
+  function vfreebusy( $config = array()) {
+    $this->calendarComponent();
+
+    $this->attendee        = '';
+    $this->comment         = '';
+    $this->contact         = '';
+    $this->dtend           = '';
+    $this->dtstart         = '';
+    $this->duration        = '';
+    $this->freebusy        = '';
+    $this->organizer       = '';
+    $this->requeststatus   = '';
+    $this->url             = '';
+    $this->xprop           = '';
+
+    if( defined( 'ICAL_LANG' ) && !isset( $config['language'] ))
+                                          $config['language']   = ICAL_LANG;
+    if( !isset( $config['allowEmpty'] ))  $config['allowEmpty'] = TRUE;
+    if( !isset( $config['nl'] ))          $config['nl']         = "\r\n";
+    if( !isset( $config['format'] ))      $config['format']     = 'iCal';
+    if( !isset( $config['delimiter'] ))   $config['delimiter']  = DIRECTORY_SEPARATOR;
+    $this->setConfig( $config );
+
+  }
+/**
+ * create formatted output for calendar component VFREEBUSY object instance
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.3.1 - 2007-11-19
+ * @param array $xcaldecl
+ * @return string
+ */
+  function createComponent( &$xcaldecl ) {
+    $objectname = $this->_createFormat();
+    $component  = $this->componentStart1.$objectname.$this->componentStart2.$this->nl;
+    $component .= $this->createUid();
+    $component .= $this->createDtstamp();
+    $component .= $this->createAttendee();
+    $component .= $this->createComment();
+    $component .= $this->createContact();
+    $component .= $this->createDtstart();
+    $component .= $this->createDtend();
+    $component .= $this->createDuration();
+    $component .= $this->createFreebusy();
+    $component .= $this->createOrganizer();
+    $component .= $this->createRequestStatus();
+    $component .= $this->createUrl();
+    $component .= $this->createXprop();
+    $component .= $this->componentEnd1.$objectname.$this->componentEnd2;
+    if( is_array( $this->xcaldecl ) && ( 0 < count( $this->xcaldecl ))) {
+      foreach( $this->xcaldecl as $localxcaldecl )
+        $xcaldecl[] = $localxcaldecl;
+    }
+    return $component;
+  }
+}
+/*********************************************************************************/
+/*********************************************************************************/
+/**
+ * class for calendar component VALARM
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.5.1 - 2008-10-12
+ */
+class valarm extends calendarComponent {
+  var $action;
+  var $attach;
+  var $attendee;
+  var $description;
+  var $duration;
+  var $repeat;
+  var $summary;
+  var $trigger;
+  var $xprop;
+/**
+ * constructor for calendar component VALARM object
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.8.2 - 2011-05-01
+ * @param array $config
+ * @return void
+ */
+  function valarm( $config = array()) {
+    $this->calendarComponent();
+
+    $this->action          = '';
+    $this->attach          = '';
+    $this->attendee        = '';
+    $this->description     = '';
+    $this->duration        = '';
+    $this->repeat          = '';
+    $this->summary         = '';
+    $this->trigger         = '';
+    $this->xprop           = '';
+
+    if( defined( 'ICAL_LANG' ) && !isset( $config['language'] ))
+                                          $config['language']   = ICAL_LANG;
+    if( !isset( $config['allowEmpty'] ))  $config['allowEmpty'] = TRUE;
+    if( !isset( $config['nl'] ))          $config['nl']         = "\r\n";
+    if( !isset( $config['format'] ))      $config['format']     = 'iCal';
+    if( !isset( $config['delimiter'] ))   $config['delimiter']  = DIRECTORY_SEPARATOR;
+    $this->setConfig( $config );
+
+  }
+/**
+ * create formatted output for calendar component VALARM object instance
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.5.1 - 2008-10-22
+ * @param array $xcaldecl
+ * @return string
+ */
+  function createComponent( &$xcaldecl ) {
+    $objectname    = $this->_createFormat();
+    $component     = $this->componentStart1.$objectname.$this->componentStart2.$this->nl;
+    $component    .= $this->createAction();
+    $component    .= $this->createAttach();
+    $component    .= $this->createAttendee();
+    $component    .= $this->createDescription();
+    $component    .= $this->createDuration();
+    $component    .= $this->createRepeat();
+    $component    .= $this->createSummary();
+    $component    .= $this->createTrigger();
+    $component    .= $this->createXprop();
+    $component    .= $this->componentEnd1.$objectname.$this->componentEnd2;
+    return $component;
+  }
+}
+/**********************************************************************************
+/*********************************************************************************/
+/**
+ * class for calendar component VTIMEZONE
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.5.1 - 2008-10-12
+ */
+class vtimezone extends calendarComponent {
+  var $timezonetype;
+
+  var $comment;
+  var $dtstart;
+  var $lastmodified;
+  var $rdate;
+  var $rrule;
+  var $tzid;
+  var $tzname;
+  var $tzoffsetfrom;
+  var $tzoffsetto;
+  var $tzurl;
+  var $xprop;
+            //  component subcomponents container
+  var $components;
+/**
+ * constructor for calendar component VTIMEZONE object
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.8.2 - 2011-05-01
+ * @param mixed $timezonetype optional, default FALSE ( STANDARD / DAYLIGHT )
+ * @param array $config
+ * @return void
+ */
+  function vtimezone( $timezonetype=FALSE, $config = array()) {
+    if( is_array( $timezonetype )) {
+      $config       = $timezonetype;
+      $timezonetype = FALSE;
+    }
+    if( !$timezonetype )
+      $this->timezonetype = 'VTIMEZONE';
+    else
+      $this->timezonetype = strtoupper( $timezonetype );
+    $this->calendarComponent();
+
+    $this->comment         = '';
+    $this->dtstart         = '';
+    $this->lastmodified    = '';
+    $this->rdate           = '';
+    $this->rrule           = '';
+    $this->tzid            = '';
+    $this->tzname          = '';
+    $this->tzoffsetfrom    = '';
+    $this->tzoffsetto      = '';
+    $this->tzurl           = '';
+    $this->xprop           = '';
+
+    $this->components      = array();
+
+    if( defined( 'ICAL_LANG' ) && !isset( $config['language'] ))
+                                          $config['language']   = ICAL_LANG;
+    if( !isset( $config['allowEmpty'] ))  $config['allowEmpty'] = TRUE;
+    if( !isset( $config['nl'] ))          $config['nl']         = "\r\n";
+    if( !isset( $config['format'] ))      $config['format']     = 'iCal';
+    if( !isset( $config['delimiter'] ))   $config['delimiter']  = DIRECTORY_SEPARATOR;
+    $this->setConfig( $config );
+
+  }
+/**
+ * create formatted output for calendar component VTIMEZONE object instance
+ *
+ * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
+ * @since 2.5.1 - 2008-10-25
+ * @param array $xcaldecl
+ * @return string
+ */
+  function createComponent( &$xcaldecl ) {
+    $objectname    = $this->_createFormat();
+    $component     = $this->componentStart1.$objectname.$this->componentStart2.$this->nl;
+    $component    .= $this->createTzid();
+    $component    .= $this->createLastModified();
+    $component    .= $this->createTzurl();
+    $component    .= $this->createDtstart();
+    $component    .= $this->createTzoffsetfrom();
+    $component    .= $this->createTzoffsetto();
+    $component    .= $this->createComment();
+    $component    .= $this->createRdate();
+    $component    .= $this->createRrule();
+    $component    .= $this->createTzname();
+    $component    .= $this->createXprop();
+    $component    .= $this->createSubComponent();
+    $component    .= $this->componentEnd1.$objectname.$this->componentEnd2;
+    if( is_array( $this->xcaldecl ) && ( 0 < count( $this->xcaldecl ))) {
+      foreach( $this->xcaldecl as $localxcaldecl )
+        $xcaldecl[] = $localxcaldecl;
+    }
+    return $component;
+  }
+}
+?>
Index: trunk/prototype/plugins/icalcreator/lgpl.txt
===================================================================
--- trunk/prototype/plugins/icalcreator/lgpl.txt	(revision 5341)
+++ trunk/prototype/plugins/icalcreator/lgpl.txt	(revision 5341)
@@ -0,0 +1,504 @@
+		  GNU LESSER GENERAL PUBLIC LICENSE
+		       Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL.  It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+  This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it.  You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+  When we speak of free software, we are referring to freedom of use,
+not price.  Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+  To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights.  These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+  For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you.  You must make sure that they, too, receive or can get the source
+code.  If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it.  And you must show them these terms so they know their rights.
+
+  We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+  To protect each distributor, we want to make it very clear that
+there is no warranty for the free library.  Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+  Finally, software patents pose a constant threat to the existence of
+any free program.  We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder.  Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+  Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License.  This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License.  We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+  When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library.  The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom.  The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+  We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License.  It also provides other free software developers Less
+of an advantage over competing non-free programs.  These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries.  However, the Lesser license provides advantages in certain
+special circumstances.
+
+  For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard.  To achieve this, non-free programs must be
+allowed to use the library.  A more frequent case is that a free
+library does the same job as widely used non-free libraries.  In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+  In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software.  For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+  Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.  Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library".  The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+		  GNU LESSER GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+  A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+  The "Library", below, refers to any such software library or work
+which has been distributed under these terms.  A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language.  (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+  "Source code" for a work means the preferred form of the work for
+making modifications to it.  For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+  Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it).  Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+  
+  1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+  You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+  2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) The modified work must itself be a software library.
+
+    b) You must cause the files modified to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    c) You must cause the whole of the work to be licensed at no
+    charge to all third parties under the terms of this License.
+
+    d) If a facility in the modified Library refers to a function or a
+    table of data to be supplied by an application program that uses
+    the facility, other than as an argument passed when the facility
+    is invoked, then you must make a good faith effort to ensure that,
+    in the event an application does not supply such function or
+    table, the facility still operates, and performs whatever part of
+    its purpose remains meaningful.
+
+    (For example, a function in a library to compute square roots has
+    a purpose that is entirely well-defined independent of the
+    application.  Therefore, Subsection 2d requires that any
+    application-supplied function or table used by this function must
+    be optional: if the application does not supply it, the square
+    root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library.  To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License.  (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.)  Do not make any other change in
+these notices.
+
+  Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+  This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+  4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+  If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library".  Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+  However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library".  The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+  When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library.  The
+threshold for this to be true is not precisely defined by law.
+
+  If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work.  (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+  Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+  6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+  You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License.  You must supply a copy of this License.  If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License.  Also, you must do one
+of these things:
+
+    a) Accompany the work with the complete corresponding
+    machine-readable source code for the Library including whatever
+    changes were used in the work (which must be distributed under
+    Sections 1 and 2 above); and, if the work is an executable linked
+    with the Library, with the complete machine-readable "work that
+    uses the Library", as object code and/or source code, so that the
+    user can modify the Library and then relink to produce a modified
+    executable containing the modified Library.  (It is understood
+    that the user who changes the contents of definitions files in the
+    Library will not necessarily be able to recompile the application
+    to use the modified definitions.)
+
+    b) Use a suitable shared library mechanism for linking with the
+    Library.  A suitable mechanism is one that (1) uses at run time a
+    copy of the library already present on the user's computer system,
+    rather than copying library functions into the executable, and (2)
+    will operate properly with a modified version of the library, if
+    the user installs one, as long as the modified version is
+    interface-compatible with the version that the work was made with.
+
+    c) Accompany the work with a written offer, valid for at
+    least three years, to give the same user the materials
+    specified in Subsection 6a, above, for a charge no more
+    than the cost of performing this distribution.
+
+    d) If distribution of the work is made by offering access to copy
+    from a designated place, offer equivalent access to copy the above
+    specified materials from the same place.
+
+    e) Verify that the user has already received a copy of these
+    materials or that you have already sent this user a copy.
+
+  For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it.  However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+  It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system.  Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+  7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+    a) Accompany the combined library with a copy of the same work
+    based on the Library, uncombined with any other library
+    facilities.  This must be distributed under the terms of the
+    Sections above.
+
+    b) Give prominent notice with the combined library of the fact
+    that part of it is a work based on the Library, and explaining
+    where to find the accompanying uncombined form of the same work.
+
+  8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License.  Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License.  However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+  9. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Library or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+  10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+  11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded.  In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+  13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation.  If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+  14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission.  For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this.  Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+			    NO WARRANTY
+
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+           How to Apply These Terms to Your New Libraries
+
+  If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change.  You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+  To apply these terms, attach the following notices to the library.  It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the library's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the
+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+  <signature of Ty Coon>, 1 April 1990
+  Ty Coon, President of Vice
+
+That's all there is to it!
+
+
Index: trunk/prototype/plugins/treeview/jquery.treeview.async.js
===================================================================
--- trunk/prototype/plugins/treeview/jquery.treeview.async.js	(revision 5136)
+++ trunk/prototype/plugins/treeview/jquery.treeview.async.js	(revision 5136)
@@ -0,0 +1,110 @@
+/*
+ * Async Treeview 0.1 - Lazy-loading extension for Treeview
+ * 
+ * http://bassistance.de/jquery-plugins/jquery-plugin-treeview/
+ *
+ * Copyright (c) 2007 JÃ¶rn Zaefferer
+ *
+ * Dual licensed under the MIT and GPL licenses:
+ *   http://www.opensource.org/licenses/mit-license.php
+ *   http://www.gnu.org/licenses/gpl.html
+ *
+ * Revision: $Id$
+ *
+ */
+
+;(function($) {
+
+function load(settings, root, child, container) {
+	function createNode(parent) {
+		var current = $("<li/>").attr("id", this.id || "").html("<span>" + this.text + "</span>").appendTo(parent);
+		if (this.classes) {
+			current.children("span").addClass(this.classes);
+		}
+		if (this.expanded) {
+			current.addClass("open");
+		}
+		if (this.hasChildren || this.children && this.children.length) {
+			var branch = $("<ul/>").appendTo(current);
+			if (this.hasChildren) {
+				current.addClass("hasChildren");
+				createNode.call({
+					classes: "placeholder",
+					text: "&nbsp;",
+					children:[]
+				}, branch);
+			}
+			if (this.children && this.children.length) {
+				$.each(this.children, createNode, [branch])
+			}
+		}
+	}
+	$.ajax($.extend(true, {
+		url: settings.url,
+		dataType: "json",
+		data: {
+			root: root
+		},
+		success: function(response) {
+			child.empty();
+			$.each(response, createNode, [child]);
+	        $(container).treeview({add: child});
+	    }
+	}, settings.ajax));
+	/*
+	$.getJSON(settings.url, {root: root}, function(response) {
+		function createNode(parent) {
+			var current = $("<li/>").attr("id", this.id || "").html("<span>" + this.text + "</span>").appendTo(parent);
+			if (this.classes) {
+				current.children("span").addClass(this.classes);
+			}
+			if (this.expanded) {
+				current.addClass("open");
+			}
+			if (this.hasChildren || this.children && this.children.length) {
+				var branch = $("<ul/>").appendTo(current);
+				if (this.hasChildren) {
+					current.addClass("hasChildren");
+					createNode.call({
+						classes: "placeholder",
+						text: "&nbsp;",
+						children:[]
+					}, branch);
+				}
+				if (this.children && this.children.length) {
+					$.each(this.children, createNode, [branch])
+				}
+			}
+		}
+		child.empty();
+		$.each(response, createNode, [child]);
+        $(container).treeview({add: child});
+    });
+    */
+}
+
+var proxied = $.fn.treeview;
+$.fn.treeview = function(settings) {
+	if (!settings.url) {
+		return proxied.apply(this, arguments);
+	}
+	var container = this;
+	if (!container.children().size())
+		load(settings, "source", this, container);
+	var userToggle = settings.toggle;
+	return proxied.call(this, $.extend({}, settings, {
+		collapsed: true,
+		toggle: function() {
+			var $this = $(this);
+			if ($this.hasClass("hasChildren")) {
+				var childList = $this.removeClass("hasChildren").find("ul");
+				load(settings, this.id, childList, container);
+			}
+			if (userToggle) {
+				userToggle.apply(this, arguments);
+			}
+		}
+	}));
+};
+
+})(jQuery);
Index: trunk/prototype/plugins/treeview/jquery.treeview.css
===================================================================
--- trunk/prototype/plugins/treeview/jquery.treeview.css	(revision 5172)
+++ trunk/prototype/plugins/treeview/jquery.treeview.css	(revision 5172)
@@ -0,0 +1,76 @@
+.treeview, .treeview ul { 
+	padding: 0;
+	margin: 0;
+	list-style: none;
+}
+
+.treeview ul {
+	background-color: white;
+	margin-top: 4px;
+}
+
+.treeview .hitarea {
+	background: url(images/treeview-default.gif) -64px -25px no-repeat;
+	height: 16px;
+	width: 16px;
+	margin-left: -16px;
+	float: left;
+	cursor: pointer;
+}
+/* fix for IE6 */
+* html .hitarea {
+	display: inline;
+	float:none;
+}
+
+.treeview li { 
+	margin: 0;
+	padding: 3px 0pt 3px 16px;
+}
+
+.treeview a.selected {
+	background-color: #eee;
+}
+
+#treecontrol { margin: 1em 0; display: none; }
+
+.treeview .hover { color: red; cursor: pointer; }
+
+.treeview li { background: url(images/treeview-default-line.gif) 0 0 no-repeat; }
+.treeview li.collapsable, .treeview li.expandable { background-position: 0 -176px; }
+
+.treeview .expandable-hitarea { background-position: -80px -3px; }
+
+.treeview li.last { background-position: 0 -1766px }
+.treeview li.lastCollapsable, .treeview li.lastExpandable { background-image: url(images/treeview-default.gif); }  
+.treeview li.lastCollapsable { background-position: 0 -111px }
+.treeview li.lastExpandable { background-position: -32px -67px }
+
+.treeview div.lastCollapsable-hitarea, .treeview div.lastExpandable-hitarea { background-position: 0; }
+
+.treeview-red li { background-image: url(images/treeview-red-line.gif); }
+.treeview-red .hitarea, .treeview-red li.lastCollapsable, .treeview-red li.lastExpandable { background-image: url(images/treeview-red.gif); } 
+
+.treeview-black li { background-image: url(images/treeview-black-line.gif); }
+.treeview-black .hitarea, .treeview-black li.lastCollapsable, .treeview-black li.lastExpandable { background-image: url(images/treeview-black.gif); }  
+
+.treeview-gray li { background-image: url(images/treeview-gray-line.gif); }
+.treeview-gray .hitarea, .treeview-gray li.lastCollapsable, .treeview-gray li.lastExpandable { background-image: url(images/treeview-gray.gif); } 
+
+.treeview-famfamfam li { background-image: url(images/treeview-famfamfam-line.gif); }
+.treeview-famfamfam .hitarea, .treeview-famfamfam li.lastCollapsable, .treeview-famfamfam li.lastExpandable { background-image: url(images/treeview-famfamfam.gif); } 
+
+.treeview .placeholder {
+	background: url(images/ajax-loader.gif) 0 0 no-repeat;
+	height: 16px;
+	width: 16px;
+	display: block;
+}
+
+.filetree li { padding: 3px 0 2px 16px; }
+.filetree span.folder, .filetree span.file { padding: 1px 0 1px 16px; display: block; }
+.filetree span.folder { background: url(images/folder.gif) 0 0 no-repeat; cursor: pointer;}
+.filetree span.folder:hover {color: red; cursor: pointer;}
+.filetree span.folder.selected {font-weight: bold; cursor: pointer; }
+.filetree li.expandable span.folder { background: url(images/folder-closed.gif) 0 0 no-repeat; }
+.filetree span.file { background: url(images/file.gif) 0 0 no-repeat; }
Index: trunk/prototype/plugins/treeview/jquery.treeview.js
===================================================================
--- trunk/prototype/plugins/treeview/jquery.treeview.js	(revision 5136)
+++ trunk/prototype/plugins/treeview/jquery.treeview.js	(revision 5136)
@@ -0,0 +1,256 @@
+/*
+ * Treeview 1.5pre - jQuery plugin to hide and show branches of a tree
+ * 
+ * http://bassistance.de/jquery-plugins/jquery-plugin-treeview/
+ * http://docs.jquery.com/Plugins/Treeview
+ *
+ * Copyright (c) 2007 JÃ¶rn Zaefferer
+ *
+ * Dual licensed under the MIT and GPL licenses:
+ *   http://www.opensource.org/licenses/mit-license.php
+ *   http://www.gnu.org/licenses/gpl.html
+ *
+ * Revision: $Id: jquery.treeview.js 5759 2008-07-01 07:50:28Z joern.zaefferer $
+ *
+ */
+
+;(function($) {
+
+	// TODO rewrite as a widget, removing all the extra plugins
+	$.extend($.fn, {
+		swapClass: function(c1, c2) {
+			var c1Elements = this.filter('.' + c1);
+			this.filter('.' + c2).removeClass(c2).addClass(c1);
+			c1Elements.removeClass(c1).addClass(c2);
+			return this;
+		},
+		replaceClass: function(c1, c2) {
+			return this.filter('.' + c1).removeClass(c1).addClass(c2).end();
+		},
+		hoverClass: function(className) {
+			className = className || "hover";
+			return this.hover(function() {
+				$(this).addClass(className);
+			}, function() {
+				$(this).removeClass(className);
+			});
+		},
+		heightToggle: function(animated, callback) {
+			animated ?
+				this.animate({ height: "toggle" }, animated, callback) :
+				this.each(function(){
+					jQuery(this)[ jQuery(this).is(":hidden") ? "show" : "hide" ]();
+					if(callback)
+						callback.apply(this, arguments);
+				});
+		},
+		heightHide: function(animated, callback) {
+			if (animated) {
+				this.animate({ height: "hide" }, animated, callback);
+			} else {
+				this.hide();
+				if (callback)
+					this.each(callback);				
+			}
+		},
+		prepareBranches: function(settings) {
+			if (!settings.prerendered) {
+				// mark last tree items
+				this.filter(":last-child:not(ul)").addClass(CLASSES.last);
+				// collapse whole tree, or only those marked as closed, anyway except those marked as open
+				this.filter((settings.collapsed ? "" : "." + CLASSES.closed) + ":not(." + CLASSES.open + ")").find(">ul").hide();
+			}
+			// return all items with sublists
+			return this.filter(":has(>ul)");
+		},
+		applyClasses: function(settings, toggler) {
+			// TODO use event delegation
+			this.filter(":has(>ul):not(:has(>a))").find(">span").unbind("click.treeview").bind("click.treeview", function(event) {
+				// don't handle click events on children, eg. checkboxes
+				if ( this == event.target )
+					toggler.apply($(this).next());
+			}).add( $("a", this) ).hoverClass();
+			
+			if (!settings.prerendered) {
+				// handle closed ones first
+				this.filter(":has(>ul:hidden)")
+						.addClass(CLASSES.expandable)
+						.replaceClass(CLASSES.last, CLASSES.lastExpandable);
+						
+				// handle open ones
+				this.not(":has(>ul:hidden)")
+						.addClass(CLASSES.collapsable)
+						.replaceClass(CLASSES.last, CLASSES.lastCollapsable);
+						
+	            // create hitarea if not present
+				var hitarea = this.find("div." + CLASSES.hitarea);
+				if (!hitarea.length)
+					hitarea = this.prepend("<div class=\"" + CLASSES.hitarea + "\"/>").find("div." + CLASSES.hitarea);
+				hitarea.removeClass().addClass(CLASSES.hitarea).each(function() {
+					var classes = "";
+					$.each($(this).parent().attr("class").split(" "), function() {
+						classes += this + "-hitarea ";
+					});
+					$(this).addClass( classes );
+				})
+			}
+			
+			// apply event to hitarea
+			this.find("div." + CLASSES.hitarea).click( toggler );
+		},
+		treeview: function(settings) {
+			
+			settings = $.extend({
+				cookieId: "treeview"
+			}, settings);
+			
+			if ( settings.toggle ) {
+				var callback = settings.toggle;
+				settings.toggle = function() {
+					return callback.apply($(this).parent()[0], arguments);
+				};
+			}
+		
+			// factory for treecontroller
+			function treeController(tree, control) {
+				// factory for click handlers
+				function handler(filter) {
+					return function() {
+						// reuse toggle event handler, applying the elements to toggle
+						// start searching for all hitareas
+						toggler.apply( $("div." + CLASSES.hitarea, tree).filter(function() {
+							// for plain toggle, no filter is provided, otherwise we need to check the parent element
+							return filter ? $(this).parent("." + filter).length : true;
+						}) );
+						return false;
+					};
+				}
+				// click on first element to collapse tree
+				$("a:eq(0)", control).click( handler(CLASSES.collapsable) );
+				// click on second to expand tree
+				$("a:eq(1)", control).click( handler(CLASSES.expandable) );
+				// click on third to toggle tree
+				$("a:eq(2)", control).click( handler() ); 
+			}
+		
+			// handle toggle event
+			function toggler() {
+				$(this)
+					.parent()
+					// swap classes for hitarea
+					.find(">.hitarea")
+						.swapClass( CLASSES.collapsableHitarea, CLASSES.expandableHitarea )
+						.swapClass( CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea )
+					.end()
+					// swap classes for parent li
+					.swapClass( CLASSES.collapsable, CLASSES.expandable )
+					.swapClass( CLASSES.lastCollapsable, CLASSES.lastExpandable )
+					// find child lists
+					.find( ">ul" )
+					// toggle them
+					.heightToggle( settings.animated, settings.toggle );
+				if ( settings.unique ) {
+					$(this).parent()
+						.siblings()
+						// swap classes for hitarea
+						.find(">.hitarea")
+							.replaceClass( CLASSES.collapsableHitarea, CLASSES.expandableHitarea )
+							.replaceClass( CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea )
+						.end()
+						.replaceClass( CLASSES.collapsable, CLASSES.expandable )
+						.replaceClass( CLASSES.lastCollapsable, CLASSES.lastExpandable )
+						.find( ">ul" )
+						.heightHide( settings.animated, settings.toggle );
+				}
+			}
+			this.data("toggler", toggler);
+			
+			function serialize() {
+				function binary(arg) {
+					return arg ? 1 : 0;
+				}
+				var data = [];
+				branches.each(function(i, e) {
+					data[i] = $(e).is(":has(>ul:visible)") ? 1 : 0;
+				});
+				$.cookie(settings.cookieId, data.join(""), settings.cookieOptions );
+			}
+			
+			function deserialize() {
+				var stored = $.cookie(settings.cookieId);
+				if ( stored ) {
+					var data = stored.split("");
+					branches.each(function(i, e) {
+						$(e).find(">ul")[ parseInt(data[i]) ? "show" : "hide" ]();
+					});
+				}
+			}
+			
+			// add treeview class to activate styles
+			this.addClass("treeview");
+			
+			// prepare branches and find all tree items with child lists
+			var branches = this.find("li").prepareBranches(settings);
+			
+			switch(settings.persist) {
+			case "cookie":
+				var toggleCallback = settings.toggle;
+				settings.toggle = function() {
+					serialize();
+					if (toggleCallback) {
+						toggleCallback.apply(this, arguments);
+					}
+				};
+				deserialize();
+				break;
+			case "location":
+				var current = this.find("a").filter(function() {
+					return this.href.toLowerCase() == location.href.toLowerCase();
+				});
+				if ( current.length ) {
+					// TODO update the open/closed classes
+					var items = current.addClass("selected").parents("ul, li").add( current.next() ).show();
+					if (settings.prerendered) {
+						// if prerendered is on, replicate the basic class swapping
+						items.filter("li")
+							.swapClass( CLASSES.collapsable, CLASSES.expandable )
+							.swapClass( CLASSES.lastCollapsable, CLASSES.lastExpandable )
+							.find(">.hitarea")
+								.swapClass( CLASSES.collapsableHitarea, CLASSES.expandableHitarea )
+								.swapClass( CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea );
+					}
+				}
+				break;
+			}
+			
+			branches.applyClasses(settings, toggler);
+				
+			// if control option is set, create the treecontroller and show it
+			if ( settings.control ) {
+				treeController(this, settings.control);
+				$(settings.control).show();
+			}
+			
+			return this;
+		}
+	});
+	
+	// classes used by the plugin
+	// need to be styled via external stylesheet, see first example
+	$.treeview = {};
+	var CLASSES = ($.treeview.classes = {
+		open: "open",
+		closed: "closed",
+		expandable: "expandable",
+		expandableHitarea: "expandable-hitarea",
+		lastExpandableHitarea: "lastExpandable-hitarea",
+		collapsable: "collapsable",
+		collapsableHitarea: "collapsable-hitarea",
+		lastCollapsableHitarea: "lastCollapsable-hitarea",
+		lastCollapsable: "lastCollapsable",
+		lastExpandable: "lastExpandable",
+		last: "last",
+		hitarea: "hitarea"
+	});
+	
+})(jQuery);
Index: trunk/prototype/plugins/treeview/.project
===================================================================
--- trunk/prototype/plugins/treeview/.project	(revision 5136)
+++ trunk/prototype/plugins/treeview/.project	(revision 5136)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>jquery-treeview</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+	</buildSpec>
+	<natures>
+	</natures>
+</projectDescription>
Index: trunk/prototype/plugins/treeview/.gitignore
===================================================================
--- trunk/prototype/plugins/treeview/.gitignore	(revision 5136)
+++ trunk/prototype/plugins/treeview/.gitignore	(revision 5136)
@@ -0,0 +1,7 @@
+build/dist
+docs
+.project
+*~
+*.diff
+*.patch
+.DS_Store
Index: trunk/prototype/plugins/treeview/lib/jquery.cookie.js
===================================================================
--- trunk/prototype/plugins/treeview/lib/jquery.cookie.js	(revision 5136)
+++ trunk/prototype/plugins/treeview/lib/jquery.cookie.js	(revision 5136)
@@ -0,0 +1,92 @@
+/**
+ * Cookie plugin
+ *
+ * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+ *
+ */
+
+/**
+ * Create a cookie with the given name and value and other optional parameters.
+ *
+ * @example $.cookie('the_cookie', 'the_value');
+ * @desc Set the value of a cookie.
+ * @example $.cookie('the_cookie', 'the_value', {expires: 7, path: '/', domain: 'jquery.com', secure: true});
+ * @desc Create a cookie with all available options.
+ * @example $.cookie('the_cookie', 'the_value');
+ * @desc Create a session cookie.
+ * @example $.cookie('the_cookie', null);
+ * @desc Delete a cookie by passing null as value.
+ *
+ * @param String name The name of the cookie.
+ * @param String value The value of the cookie.
+ * @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
+ * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
+ *                             If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
+ *                             If set to null or omitted, the cookie will be a session cookie and will not be retained
+ *                             when the the browser exits.
+ * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
+ * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
+ * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
+ *                        require a secure protocol (like HTTPS).
+ * @type undefined
+ *
+ * @name $.cookie
+ * @cat Plugins/Cookie
+ * @author Klaus Hartl/klaus.hartl@stilbuero.de
+ */
+
+/**
+ * Get the value of a cookie with the given name.
+ *
+ * @example $.cookie('the_cookie');
+ * @desc Get the value of a cookie.
+ *
+ * @param String name The name of the cookie.
+ * @return The value of the cookie.
+ * @type String
+ *
+ * @name $.cookie
+ * @cat Plugins/Cookie
+ * @author Klaus Hartl/klaus.hartl@stilbuero.de
+ */
+jQuery.cookie = function(name, value, options) {
+    if (typeof value != 'undefined') { // name and value given, set cookie
+        options = options || {};
+        if (value === null) {
+            value = '';
+            options.expires = -1;
+        }
+        var expires = '';
+        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
+            var date;
+            if (typeof options.expires == 'number') {
+                date = new Date();
+                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
+            } else {
+                date = options.expires;
+            }
+            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
+        }
+        var path = options.path ? '; path=' + options.path : '';
+        var domain = options.domain ? '; domain=' + options.domain : '';
+        var secure = options.secure ? '; secure' : '';
+        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
+    } else { // only name given, get cookie
+        var cookieValue = null;
+        if (document.cookie && document.cookie != '') {
+            var cookies = document.cookie.split(';');
+            for (var i = 0; i < cookies.length; i++) {
+                var cookie = jQuery.trim(cookies[i]);
+                // Does this cookie string begin with the name we want?
+                if (cookie.substring(0, name.length + 1) == (name + '=')) {
+                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
+                    break;
+                }
+            }
+        }
+        return cookieValue;
+    }
+};
Index: trunk/prototype/plugins/treeview/jquery.treeview.edit.js
===================================================================
--- trunk/prototype/plugins/treeview/jquery.treeview.edit.js	(revision 5136)
+++ trunk/prototype/plugins/treeview/jquery.treeview.edit.js	(revision 5136)
@@ -0,0 +1,37 @@
+(function($) {
+	var CLASSES = $.treeview.classes;
+	var proxied = $.fn.treeview;
+	$.fn.treeview = function(settings) {
+		settings = $.extend({}, settings);
+		if (settings.add) {
+			return this.trigger("add", [settings.add]);
+		}
+		if (settings.remove) {
+			return this.trigger("remove", [settings.remove]);
+		}
+		return proxied.apply(this, arguments).bind("add", function(event, branches) {
+			$(branches).prev()
+				.removeClass(CLASSES.last)
+				.removeClass(CLASSES.lastCollapsable)
+				.removeClass(CLASSES.lastExpandable)
+			.find(">.hitarea")
+				.removeClass(CLASSES.lastCollapsableHitarea)
+				.removeClass(CLASSES.lastExpandableHitarea);
+			$(branches).find("li").andSelf().prepareBranches(settings).applyClasses(settings, $(this).data("toggler"));
+		}).bind("remove", function(event, branches) {
+			var prev = $(branches).prev();
+			var parent = $(branches).parent();
+			$(branches).remove();
+			prev.filter(":last-child").addClass(CLASSES.last)
+				.filter("." + CLASSES.expandable).replaceClass(CLASSES.last, CLASSES.lastExpandable).end()
+				.find(">.hitarea").replaceClass(CLASSES.expandableHitarea, CLASSES.lastExpandableHitarea).end()
+				.filter("." + CLASSES.collapsable).replaceClass(CLASSES.last, CLASSES.lastCollapsable).end()
+				.find(">.hitarea").replaceClass(CLASSES.collapsableHitarea, CLASSES.lastCollapsableHitarea);
+			if (parent.is(":not(:has(>))") && parent[0] != this) {
+				parent.parent().removeClass(CLASSES.collapsable).removeClass(CLASSES.expandable)
+				parent.siblings(".hitarea").andSelf().remove();
+			}
+		});
+	};
+	
+})(jQuery);
Index: trunk/prototype/plugins/treeview/jquery.treeview.sortable.js
===================================================================
--- trunk/prototype/plugins/treeview/jquery.treeview.sortable.js	(revision 5136)
+++ trunk/prototype/plugins/treeview/jquery.treeview.sortable.js	(revision 5136)
@@ -0,0 +1,378 @@
+/*
+ * jQuery UI Sortable
+ *
+ * Copyright (c) 2008 Paul Bakaus
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ * 
+ * http://docs.jquery.com/UI/Sortables
+ *
+ * Depends:
+ *   ui.base.js
+ *
+ * Revision: $Id: ui.sortable.js 5262 2008-04-17 13:13:51Z paul.bakaus $
+ */
+;(function($) {
+
+	if (window.Node && Node.prototype && !Node.prototype.contains) {
+		Node.prototype.contains = function (arg) {
+			return !!(this.compareDocumentPosition(arg) & 16);
+		};
+	}
+
+
+	$.widget("ui.sortableTree", $.extend($.ui.mouse, {
+		init: function() {
+
+			//Initialize needed constants
+			var self = this, o = this.options;
+			this.containerCache = {};
+			this.element.addClass("ui-sortableTree");
+			
+			//Get the items
+			this.refresh();
+			
+			//Let's determine the parent's offset
+			if(!(/(relative|absolute|fixed)/).test(this.element.css('position'))) this.element.css('position', 'relative');
+			this.offset = this.element.offset();
+	
+			//Initialize mouse events for interaction
+			this.mouseInit();
+			
+			//Prepare cursorAt
+			if(o.cursorAt && o.cursorAt.constructor == Array)
+				o.cursorAt = { left: o.cursorAt[0], top: o.cursorAt[1] };
+
+		},
+		plugins: {},
+		ui: function(inst) {
+			return {
+				helper: (inst || this)["helper"],
+				position: (inst || this)["position"].current,
+				absolutePosition: (inst || this)["position"].absolute,
+				instance: this,
+				options: this.options,
+				element: this.element,
+				item: (inst || this)["currentItem"],
+				sender: inst ? inst.element : null
+			};		
+		},
+		propagate: function(n,e,inst) {
+			$.ui.plugin.call(this, n, [e, this.ui(inst)]);
+			this.element.triggerHandler(n == "sort" ? n : "sort"+n, [e, this.ui(inst)], this.options[n]);
+		},
+		serialize: function(o) {
+			
+			var items = $(this.options.items, this.element).not('.ui-sortableTree-helper'); //Only the items of the sortable itself
+			var str = []; o = o || {};
+			
+			items.each(function() {
+				var res = ($(this).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/));
+				if(res) str.push((o.key || res[1])+'[]='+(o.key ? res[1] : res[2]));
+			});
+			
+			return str.join('&');
+			
+		},
+		toArray: function(attr) {
+			var items = $(this.options.items, this.element).not('.ui-sortableTree-helper'); //Only the items of the sortable itself
+			var ret = [];
+
+			items.each(function() { ret.push($(this).attr(attr || 'id')); });
+			return ret;
+		},
+		enable: function() {
+			this.element.removeClass("ui-sortableTree-disabled");
+			this.options.disabled = false;
+		},
+		disable: function() {
+			this.element.addClass("ui-sortableTree-disabled");
+			this.options.disabled = true;
+		},
+		/* Be careful with the following core functions */
+		intersectsWith: function(item) {
+					
+			var x1 = this.position.absolute.left - 10, x2 = x1 + 10,
+			    y1 = this.position.absolute.top - 10, y2 = y1 + 10;
+			var l = item.left, r = l + item.width, 
+			    t = item.top,  b = t + item.height;
+			
+			return (   l < x1 + (this.helperProportions.width  / 2)    // Right Half
+				&&     x2 - (this.helperProportions.width  / 2) < r    // Left Half
+				&& t < y1 + (this.helperProportions.height / 2)        // Bottom Half
+				&&     y2 - (this.helperProportions.height / 2) < b ); // Top Half
+			
+		},
+		intersectsWithEdge: function(item) {	
+			var y1 = this.position.absolute.top - 10, y2 = y1 + 10;
+			var t = item.top,  b = t + item.height;
+
+			if(!this.intersectsWith(item.item.parents(".ui-sortableTree").data("sortableTree").containerCache)) return false;
+
+			if (!( t < y1 + (this.helperProportions.height / 2)        // Bottom Half
+				&&     y2 - (this.helperProportions.height / 2) < b )) return false; // Top Half
+
+			if(y2 > t && y1 < t) return 1; //Crosses top edge
+			if(y1 < b && y2 > b) return 2; //Crosses bottom edge
+			
+			return false;
+			
+		},
+		refresh: function() {
+			this.refreshItems();
+			this.refreshPositions();
+		},
+		refreshItems: function() {
+			
+			this.items = [];
+			this.containers = [this];
+			var items = this.items;
+			var queries = [$(this.options.items, this.element)];
+			
+			if(this.options.connectWith) {
+				for (var i = this.options.connectWith.length - 1; i >= 0; i--){
+					var cur = $(this.options.connectWith[i]);
+					for (var j = cur.length - 1; j >= 0; j--){
+						var inst = $.data(cur[j], 'sortableTree');
+						if(inst && !inst.options.disabled) {
+							queries.push($(inst.options.items, inst.element));
+							this.containers.push(inst);
+						}
+					};
+				};
+			}
+
+			for (var i = queries.length - 1; i >= 0; i--){
+				queries[i].each(function() {
+					$.data(this, 'sortableTree-item', true); // Data for target checking (mouse manager)
+					items.push({
+						item: $(this),
+						width: 0, height: 0,
+						left: 0, top: 0
+					});
+				});
+			};
+
+		},
+		refreshPositions: function(fast) {
+			for (var i = this.items.length - 1; i >= 0; i--){
+				if(!fast) this.items[i].height 			= this.items[i].item.outerHeight();
+				this.items[i].top 						= this.items[i].item.offset().top;
+			};
+			for (var i = this.containers.length - 1; i >= 0; i--){
+				var p =this.containers[i].element.offset();
+				this.containers[i].containerCache.left 	= p.left;
+				this.containers[i].containerCache.top 	= p.top;
+				this.containers[i].containerCache.width	= this.containers[i].element.outerWidth();
+				this.containers[i].containerCache.height= this.containers[i].element.outerHeight();
+			};
+		},
+		destroy: function() {
+
+			this.element
+				.removeClass("ui-sortableTree ui-sortableTree-disabled")
+				.removeData("sortableTree")
+				.unbind(".sortableTree");
+			this.mouseDestroy();
+			
+			for ( var i = this.items.length - 1; i >= 0; i-- )
+				this.items[i].item.removeData("sortableTree-item");
+				
+		},
+		contactContainers: function(e) {
+			for (var i = this.containers.length - 1; i >= 0; i--){
+
+				if(this.intersectsWith(this.containers[i].containerCache)) {
+					if(!this.containers[i].containerCache.over) {
+						
+						if(this.currentContainer != this.containers[i]) {
+							
+							//When entering a new container, we will find the item with the least distance and append our item near it
+							var dist = 10000; var itemWithLeastDistance = null; var base = this.position.absolute.top;
+							for (var j = this.items.length - 1; j >= 0; j--) {
+								if(!this.containers[i].element[0].contains(this.items[j].item[0])) continue;
+								var cur = this.items[j].top;
+								if(Math.abs(cur - base) < dist) {
+									dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j];
+								}
+							}
+							
+							itemWithLeastDistance ? this.rearrange(e, itemWithLeastDistance) : this.rearrange(e, null, this.containers[i].element);
+							this.propagate("change", e); //Call plugins and callbacks
+							this.containers[i].propagate("change", e, this); //Call plugins and callbacks
+							this.currentContainer = this.containers[i];
+
+						}
+						
+						this.containers[i].propagate("over", e, this);
+						this.containers[i].containerCache.over = 1;
+					}
+				} else {
+					if(this.containers[i].containerCache.over) {
+						this.containers[i].propagate("out", e, this);
+						this.containers[i].containerCache.over = 0;
+					}
+				}
+				
+			};			
+		},
+		mouseStart: function(e,el) {
+
+			if(this.options.disabled || this.options.type == 'static') return false;
+
+			//Find out if the clicked node (or one of its parents) is a actual item in this.items
+			var currentItem = null, nodes = $(e.target).parents().each(function() {	
+				if($.data(this, 'sortableTree-item')) {
+					currentItem = $(this);
+					return false;
+				}
+			});
+			if($.data(e.target, 'sortableTree-item')) currentItem = $(e.target);
+			
+			if(!currentItem) return false;	
+			if(this.options.handle) {
+				var validHandle = false;
+				$(this.options.handle, currentItem).each(function() { if(this == e.target) validHandle = true; });
+				if(!validHandle) return false;
+			}
+				
+			this.currentItem = currentItem;
+			
+			var o = this.options;
+			this.currentContainer = this;
+			this.refresh();
+
+			//Create and append the visible helper
+			this.helper = typeof o.helper == 'function' ? $(o.helper.apply(this.element[0], [e, this.currentItem])) : this.currentItem.clone();
+			if(!this.helper.parents('body').length) this.helper.appendTo("body"); //Add the helper to the DOM if that didn't happen already
+			this.helper.css({ position: 'absolute', clear: 'both' }).addClass('ui-sortableTree-helper'); //Position it absolutely and add a helper class
+			
+			//Prepare variables for position generation
+			$.extend(this, {
+				offsetParent: this.helper.offsetParent(),
+				offsets: { absolute: this.currentItem.offset() }
+			});
+
+			//Save the first time position
+			$.extend(this, {
+				position: {
+					current: { left: e.pageX, top: e.pageY },
+					absolute: { left: e.pageX, top: e.pageY },
+					dom: this.currentItem.prev()[0]
+				},
+				clickOffset: { left: -5, top: -5 }
+			});
+
+			this.propagate("start", e); //Call plugins and callbacks
+			this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight() }; //Save and store the helper proportions
+
+			for (var i = this.containers.length - 1; i >= 0; i--) {
+				this.containers[i].propagate("activate", e, this);
+			} //Post 'activate' events to possible containers
+			
+			//Prepare possible droppables
+			if($.ui.ddmanager) $.ui.ddmanager.current = this;
+			if ($.ui.ddmanager && !o.dropBehaviour) $.ui.ddmanager.prepareOffsets(this, e);
+
+			this.dragging = true;
+			return true;
+			
+		},
+		mouseStop: function(e) {
+
+			if(this.newPositionAt) this.options.sortIndication.remove.call(this.currentItem, this.newPositionAt); //remove sort indicator
+			this.propagate("stop", e); //Call plugins and trigger callbacks
+
+			//If we are using droppables, inform the manager about the drop
+			var dropped = ($.ui.ddmanager && !this.options.dropBehaviour) ? $.ui.ddmanager.drop(this, e) : false;
+			if(!dropped && this.newPositionAt) this.newPositionAt[this.direction == 'down' ? 'before' : 'after'](this.currentItem); //Append to element to its new position
+			
+			if(this.position.dom != this.currentItem.prev()[0]) this.propagate("update", e); //Trigger update callback if the DOM position has changed
+			if(!this.element[0].contains(this.currentItem[0])) { //Node was moved out of the current element
+				this.propagate("remove", e);
+				for (var i = this.containers.length - 1; i >= 0; i--){
+					if(this.containers[i].element[0].contains(this.currentItem[0])) {
+						this.containers[i].propagate("update", e, this);
+						this.containers[i].propagate("receive", e, this);
+					}
+				};
+			};
+			
+			//Post events to containers
+			for (var i = this.containers.length - 1; i >= 0; i--){
+				this.containers[i].propagate("deactivate", e, this);
+				if(this.containers[i].containerCache.over) {
+					this.containers[i].propagate("out", e, this);
+					this.containers[i].containerCache.over = 0;
+				}
+			}
+			
+			this.dragging = false;
+			if(this.cancelHelperRemoval) return false;
+			this.helper.remove();
+
+			return false;
+			
+		},
+		mouseDrag: function(e) {
+
+			//Compute the helpers position
+			this.position.current = { top: e.pageY + 5, left: e.pageX + 5 };
+			this.position.absolute = { left: e.pageX + 5, top: e.pageY + 5 };
+
+			//Interconnect with droppables
+			if($.ui.ddmanager) $.ui.ddmanager.drag(this, e);
+			var intersectsWithDroppable = false;
+			$.each($.ui.ddmanager.droppables, function() {
+				if(this.isover) intersectsWithDroppable = true;
+			});
+
+			//Rearrange
+			if(intersectsWithDroppable) {
+				if(this.newPositionAt) this.options.sortIndication.remove.call(this.currentItem, this.newPositionAt);
+			} else {
+				for (var i = this.items.length - 1; i >= 0; i--) {
+					
+					if(this.currentItem[0].contains(this.items[i].item[0])) continue;
+					
+					var intersection = this.intersectsWithEdge(this.items[i]);
+					if(!intersection) continue;
+	
+					this.direction = intersection == 1 ? "down" : "up";
+					this.rearrange(e, this.items[i]);
+					this.propagate("change", e); //Call plugins and callbacks
+					break;
+				}
+			}
+			
+			//Post events to containers
+			this.contactContainers(e);
+
+			this.propagate("sort", e); //Call plugins and callbacks
+			this.helper.css({ left: this.position.current.left+'px', top: this.position.current.top+'px' }); // Stick the helper to the cursor
+			return false;
+			
+		},
+		rearrange: function(e, i, a) {
+			if(i) {
+				if(this.newPositionAt) this.options.sortIndication.remove.call(this.currentItem, this.newPositionAt);
+				this.newPositionAt = i.item;
+				this.options.sortIndication[this.direction].call(this.currentItem, this.newPositionAt);
+			} else {
+				//Append
+			}
+		}
+	}));
+	
+	$.extend($.ui.sortableTree, {
+		defaults: {
+			items: '> *',
+			zIndex: 1000,
+			distance: 1
+		},
+		getter: "serialize toArray"
+	});
+
+
+
+})(jQuery);
Index: trunk/prototype/plugins/block/jquery.blockUI.js
===================================================================
--- trunk/prototype/plugins/block/jquery.blockUI.js	(revision 5136)
+++ trunk/prototype/plugins/block/jquery.blockUI.js	(revision 5136)
@@ -0,0 +1,499 @@
+/*!
+ * jQuery blockUI plugin
+ * Version 2.39 (23-MAY-2011)
+ * @requires jQuery v1.2.3 or later
+ *
+ * Examples at: http://malsup.com/jquery/block/
+ * Copyright (c) 2007-2010 M. Alsup
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+ *
+ * Thanks to Amir-Hossein Sobhi for some excellent contributions!
+ */
+
+;(function($) {
+
+if (/1\.(0|1|2)\.(0|1|2)/.test($.fn.jquery) || /^1.1/.test($.fn.jquery)) {
+	alert('blockUI requires jQuery v1.2.3 or later!  You are using v' + $.fn.jquery);
+	return;
+}
+
+$.fn._fadeIn = $.fn.fadeIn;
+
+var noOp = function() {};
+
+// this bit is to ensure we don't call setExpression when we shouldn't (with extra muscle to handle
+// retarded userAgent strings on Vista)
+var mode = document.documentMode || 0;
+var setExpr = $.browser.msie && (($.browser.version < 8 && !mode) || mode < 8);
+var ie6 = $.browser.msie && /MSIE 6.0/.test(navigator.userAgent) && !mode;
+
+// global $ methods for blocking/unblocking the entire page
+$.blockUI   = function(opts) { install(window, opts); };
+$.unblockUI = function(opts) { remove(window, opts); };
+
+// convenience method for quick growl-like notifications  (http://www.google.com/search?q=growl)
+$.growlUI = function(title, message, timeout, onClose) {
+	var $m = $('<div class="growlUI"></div>');
+	if (title) $m.append('<h1>'+title+'</h1>');
+	if (message) $m.append('<h2>'+message+'</h2>');
+	if (timeout == undefined) timeout = 3000;
+	$.blockUI({
+		message: $m, fadeIn: 700, fadeOut: 1000, centerY: false,
+		timeout: timeout, showOverlay: false,
+		onUnblock: onClose, 
+		css: $.blockUI.defaults.growlCSS
+	});
+};
+
+// plugin method for blocking element content
+$.fn.block = function(opts) {
+	return this.unblock({ fadeOut: 0 }).each(function() {
+		if ($.css(this,'position') == 'static')
+			this.style.position = 'relative';
+		if ($.browser.msie)
+			this.style.zoom = 1; // force 'hasLayout'
+		install(this, opts);
+	});
+};
+
+// plugin method for unblocking element content
+$.fn.unblock = function(opts) {
+	return this.each(function() {
+		remove(this, opts);
+	});
+};
+
+$.blockUI.version = 2.39; // 2nd generation blocking at no extra cost!
+
+// override these in your code to change the default behavior and style
+$.blockUI.defaults = {
+	// message displayed when blocking (use null for no message)
+	message:  '<h1>Please wait...</h1>',
+
+	title: null,	  // title string; only used when theme == true
+	draggable: true,  // only used when theme == true (requires jquery-ui.js to be loaded)
+	
+	theme: false, // set to true to use with jQuery UI themes
+	
+	// styles for the message when blocking; if you wish to disable
+	// these and use an external stylesheet then do this in your code:
+	// $.blockUI.defaults.css = {};
+	css: {
+		padding:	0,
+		margin:		0,
+		width:		'30%',
+		top:		'40%',
+		left:		'35%',
+		textAlign:	'center',
+		color:		'#000',
+		border:		'3px solid #aaa',
+		backgroundColor:'#fff',
+		cursor:		'wait'
+	},
+	
+	// minimal style set used when themes are used
+	themedCSS: {
+		width:	'30%',
+		top:	'40%',
+		left:	'35%'
+	},
+
+	// styles for the overlay
+	overlayCSS:  {
+		backgroundColor: '#000',
+		opacity:	  	 0.6,
+		cursor:		  	 'wait'
+	},
+
+	// styles applied when using $.growlUI
+	growlCSS: {
+		width:  	'350px',
+		top:		'10px',
+		left:   	'',
+		right:  	'10px',
+		border: 	'none',
+		padding:	'5px',
+		opacity:	0.6,
+		cursor: 	'default',
+		color:		'#fff',
+		backgroundColor: '#000',
+		'-webkit-border-radius': '10px',
+		'-moz-border-radius':	 '10px',
+		'border-radius': 		 '10px'
+	},
+	
+	// IE issues: 'about:blank' fails on HTTPS and javascript:false is s-l-o-w
+	// (hat tip to Jorge H. N. de Vasconcelos)
+	iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank',
+
+	// force usage of iframe in non-IE browsers (handy for blocking applets)
+	forceIframe: false,
+
+	// z-index for the blocking overlay
+	baseZ: 1000,
+
+	// set these to true to have the message automatically centered
+	centerX: true, // <-- only effects element blocking (page block controlled via css above)
+	centerY: true,
+
+	// allow body element to be stetched in ie6; this makes blocking look better
+	// on "short" pages.  disable if you wish to prevent changes to the body height
+	allowBodyStretch: true,
+
+	// enable if you want key and mouse events to be disabled for content that is blocked
+	bindEvents: true,
+
+	// be default blockUI will supress tab navigation from leaving blocking content
+	// (if bindEvents is true)
+	constrainTabKey: true,
+
+	// fadeIn time in millis; set to 0 to disable fadeIn on block
+	fadeIn:  200,
+
+	// fadeOut time in millis; set to 0 to disable fadeOut on unblock
+	fadeOut:  400,
+
+	// time in millis to wait before auto-unblocking; set to 0 to disable auto-unblock
+	timeout: 0,
+
+	// disable if you don't want to show the overlay
+	showOverlay: true,
+
+	// if true, focus will be placed in the first available input field when
+	// page blocking
+	focusInput: true,
+
+	// suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity)
+	applyPlatformOpacityRules: true,
+	
+	// callback method invoked when fadeIn has completed and blocking message is visible
+	onBlock: null,
+
+	// callback method invoked when unblocking has completed; the callback is
+	// passed the element that has been unblocked (which is the window object for page
+	// blocks) and the options that were passed to the unblock call:
+	//	 onUnblock(element, options)
+	onUnblock: null,
+
+	// don't ask; if you really must know: http://groups.google.com/group/jquery-en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493
+	quirksmodeOffsetHack: 4,
+
+	// class name of the message block
+	blockMsgClass: 'blockMsg'
+};
+
+// private data and functions follow...
+
+var pageBlock = null;
+var pageBlockEls = [];
+
+function install(el, opts) {
+	var full = (el == window);
+	var msg = opts && opts.message !== undefined ? opts.message : undefined;
+	opts = $.extend({}, $.blockUI.defaults, opts || {});
+	opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {});
+	var css = $.extend({}, $.blockUI.defaults.css, opts.css || {});
+	var themedCSS = $.extend({}, $.blockUI.defaults.themedCSS, opts.themedCSS || {});
+	msg = msg === undefined ? opts.message : msg;
+
+	// remove the current block (if there is one)
+	if (full && pageBlock)
+		remove(window, {fadeOut:0});
+
+	// if an existing element is being used as the blocking content then we capture
+	// its current place in the DOM (and current display style) so we can restore
+	// it when we unblock
+	if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) {
+		var node = msg.jquery ? msg[0] : msg;
+		var data = {};
+		$(el).data('blockUI.history', data);
+		data.el = node;
+		data.parent = node.parentNode;
+		data.display = node.style.display;
+		data.position = node.style.position;
+		if (data.parent)
+			data.parent.removeChild(node);
+	}
+
+	$(el).data('blockUI.onUnblock', opts.onUnblock);
+	var z = opts.baseZ;
+
+	// blockUI uses 3 layers for blocking, for simplicity they are all used on every platform;
+	// layer1 is the iframe layer which is used to supress bleed through of underlying content
+	// layer2 is the overlay layer which has opacity and a wait cursor (by default)
+	// layer3 is the message content that is displayed while blocking
+
+	var lyr1 = ($.browser.msie || opts.forceIframe) 
+		? $('<iframe class="blockUI" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+opts.iframeSrc+'"></iframe>')
+		: $('<div class="blockUI" style="display:none"></div>');
+	
+	var lyr2 = opts.theme 
+	 	? $('<div class="blockUI blockOverlay ui-widget-overlay" style="z-index:'+ (z++) +';display:none"></div>')
+	 	: $('<div class="blockUI blockOverlay" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');
+
+	var lyr3, s;
+	if (opts.theme && full) {
+		s = '<div class="blockUI ' + opts.blockMsgClass + ' blockPage ui-dialog ui-widget ui-corner-all" style="z-index:'+(z+10)+';display:none;position:fixed">' +
+				'<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(opts.title || '&nbsp;')+'</div>' +
+				'<div class="ui-widget-content ui-dialog-content"></div>' +
+			'</div>';
+	}
+	else if (opts.theme) {
+		s = '<div class="blockUI ' + opts.blockMsgClass + ' blockElement ui-dialog ui-widget ui-corner-all" style="z-index:'+(z+10)+';display:none;position:absolute">' +
+				'<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(opts.title || '&nbsp;')+'</div>' +
+				'<div class="ui-widget-content ui-dialog-content"></div>' +
+			'</div>';
+	}
+	else if (full) {
+		s = '<div class="blockUI ' + opts.blockMsgClass + ' blockPage" style="z-index:'+(z+10)+';display:none;position:fixed"></div>';
+	}			 
+	else {
+		s = '<div class="blockUI ' + opts.blockMsgClass + ' blockElement" style="z-index:'+(z+10)+';display:none;position:absolute"></div>';
+	}
+	lyr3 = $(s);
+
+	// if we have a message, style it
+	if (msg) {
+		if (opts.theme) {
+			lyr3.css(themedCSS);
+			lyr3.addClass('ui-widget-content');
+		}
+		else 
+			lyr3.css(css);
+	}
+
+	// style the overlay
+	if (!opts.theme && (!opts.applyPlatformOpacityRules || !($.browser.mozilla && /Linux/.test(navigator.platform))))
+		lyr2.css(opts.overlayCSS);
+	lyr2.css('position', full ? 'fixed' : 'absolute');
+
+	// make iframe layer transparent in IE
+	if ($.browser.msie || opts.forceIframe)
+		lyr1.css('opacity',0.0);
+
+	//$([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full ? 'body' : el);
+	var layers = [lyr1,lyr2,lyr3], $par = full ? $('body') : $(el);
+	$.each(layers, function() {
+		this.appendTo($par);
+	});
+	
+	if (opts.theme && opts.draggable && $.fn.draggable) {
+		lyr3.draggable({
+			handle: '.ui-dialog-titlebar',
+			cancel: 'li'
+		});
+	}
+
+	// ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling)
+	var expr = setExpr && (!$.boxModel || $('object,embed', full ? null : el).length > 0);
+	if (ie6 || expr) {
+		// give body 100% height
+		if (full && opts.allowBodyStretch && $.boxModel)
+			$('html,body').css('height','100%');
+
+		// fix ie6 issue when blocked element has a border width
+		if ((ie6 || !$.boxModel) && !full) {
+			var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth');
+			var fixT = t ? '(0 - '+t+')' : 0;
+			var fixL = l ? '(0 - '+l+')' : 0;
+		}
+
+		// simulate fixed position
+		$.each([lyr1,lyr2,lyr3], function(i,o) {
+			var s = o[0].style;
+			s.position = 'absolute';
+			if (i < 2) {
+				full ? s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"')
+					 : s.setExpression('height','this.parentNode.offsetHeight + "px"');
+				full ? s.setExpression('width','jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"')
+					 : s.setExpression('width','this.parentNode.offsetWidth + "px"');
+				if (fixL) s.setExpression('left', fixL);
+				if (fixT) s.setExpression('top', fixT);
+			}
+			else if (opts.centerY) {
+				if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"');
+				s.marginTop = 0;
+			}
+			else if (!opts.centerY && full) {
+				var top = (opts.css && opts.css.top) ? parseInt(opts.css.top) : 0;
+				var expression = '((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"';
+				s.setExpression('top',expression);
+			}
+		});
+	}
+
+	// show the message
+	if (msg) {
+		if (opts.theme)
+			lyr3.find('.ui-widget-content').append(msg);
+		else
+			lyr3.append(msg);
+		if (msg.jquery || msg.nodeType)
+			$(msg).show();
+	}
+
+	if (($.browser.msie || opts.forceIframe) && opts.showOverlay)
+		lyr1.show(); // opacity is zero
+	if (opts.fadeIn) {
+		var cb = opts.onBlock ? opts.onBlock : noOp;
+		var cb1 = (opts.showOverlay && !msg) ? cb : noOp;
+		var cb2 = msg ? cb : noOp;
+		if (opts.showOverlay)
+			lyr2._fadeIn(opts.fadeIn, cb1);
+		if (msg)
+			lyr3._fadeIn(opts.fadeIn, cb2);
+	}
+	else {
+		if (opts.showOverlay)
+			lyr2.show();
+		if (msg)
+			lyr3.show();
+		if (opts.onBlock)
+			opts.onBlock();
+	}
+
+	// bind key and mouse events
+	bind(1, el, opts);
+
+	if (full) {
+		pageBlock = lyr3[0];
+		pageBlockEls = $(':input:enabled:visible',pageBlock);
+		if (opts.focusInput)
+			setTimeout(focus, 20);
+	}
+	else
+		center(lyr3[0], opts.centerX, opts.centerY);
+
+	if (opts.timeout) {
+		// auto-unblock
+		var to = setTimeout(function() {
+			full ? $.unblockUI(opts) : $(el).unblock(opts);
+		}, opts.timeout);
+		$(el).data('blockUI.timeout', to);
+	}
+};
+
+// remove the block
+function remove(el, opts) {
+	var full = (el == window);
+	var $el = $(el);
+	var data = $el.data('blockUI.history');
+	var to = $el.data('blockUI.timeout');
+	if (to) {
+		clearTimeout(to);
+		$el.removeData('blockUI.timeout');
+	}
+	opts = $.extend({}, $.blockUI.defaults, opts || {});
+	bind(0, el, opts); // unbind events
+
+	if (opts.onUnblock === null) {
+		opts.onUnblock = $el.data('blockUI.onUnblock');
+		$el.removeData('blockUI.onUnblock');
+	}
+
+	var els;
+	if (full) // crazy selector to handle odd field errors in ie6/7
+		els = $('body').children().filter('.blockUI').add('body > .blockUI');
+	else
+		els = $('.blockUI', el);
+
+	if (full)
+		pageBlock = pageBlockEls = null;
+
+	if (opts.fadeOut) {
+		els.fadeOut(opts.fadeOut);
+		setTimeout(function() { reset(els,data,opts,el); }, opts.fadeOut);
+	}
+	else
+		reset(els, data, opts, el);
+};
+
+// move blocking element back into the DOM where it started
+function reset(els,data,opts,el) {
+	els.each(function(i,o) {
+		// remove via DOM calls so we don't lose event handlers
+		if (this.parentNode)
+			this.parentNode.removeChild(this);
+	});
+
+	if (data && data.el) {
+		data.el.style.display = data.display;
+		data.el.style.position = data.position;
+		if (data.parent)
+			data.parent.appendChild(data.el);
+		$(el).removeData('blockUI.history');
+	}
+
+	if (typeof opts.onUnblock == 'function')
+		opts.onUnblock(el,opts);
+};
+
+// bind/unbind the handler
+function bind(b, el, opts) {
+	var full = el == window, $el = $(el);
+
+	// don't bother unbinding if there is nothing to unbind
+	if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked')))
+		return;
+	if (!full)
+		$el.data('blockUI.isBlocked', b);
+
+	// don't bind events when overlay is not in use or if bindEvents is false
+	if (!opts.bindEvents || (b && !opts.showOverlay)) 
+		return;
+
+	// bind anchors and inputs for mouse and key events
+	var events = 'mousedown mouseup keydown keypress';
+	b ? $(document).bind(events, opts, handler) : $(document).unbind(events, handler);
+
+// former impl...
+//	   var $e = $('a,:input');
+//	   b ? $e.bind(events, opts, handler) : $e.unbind(events, handler);
+};
+
+// event handler to suppress keyboard/mouse events when blocking
+function handler(e) {
+	// allow tab navigation (conditionally)
+	if (e.keyCode && e.keyCode == 9) {
+		if (pageBlock && e.data.constrainTabKey) {
+			var els = pageBlockEls;
+			var fwd = !e.shiftKey && e.target === els[els.length-1];
+			var back = e.shiftKey && e.target === els[0];
+			if (fwd || back) {
+				setTimeout(function(){focus(back)},10);
+				return false;
+			}
+		}
+	}
+	var opts = e.data;
+	// allow events within the message content
+	if ($(e.target).parents('div.' + opts.blockMsgClass).length > 0)
+		return true;
+
+	// allow events for content that is not being blocked
+	return $(e.target).parents().children().filter('div.blockUI').length == 0;
+};
+
+function focus(back) {
+	if (!pageBlockEls)
+		return;
+	var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0];
+	if (e)
+		e.focus();
+};
+
+function center(el, x, y) {
+	var p = el.parentNode, s = el.style;
+	var l = ((p.offsetWidth - el.offsetWidth)/2) - sz(p,'borderLeftWidth');
+	var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth');
+	if (x) s.left = l > 0 ? (l+'px') : '0';
+	if (y) s.top  = t > 0 ? (t+'px') : '0';
+};
+
+function sz(el, p) {
+	return parseInt($.css(el,p))||0;
+};
+
+})(jQuery);
Index: trunk/prototype/plugins/json2/json2.js
===================================================================
--- trunk/prototype/plugins/json2/json2.js	(revision 5283)
+++ trunk/prototype/plugins/json2/json2.js	(revision 5283)
@@ -0,0 +1,326 @@
+// origin: http://www.json.org/json2.js
+
+// Create a JSON object only if one does not already exist. We create the
+// methods in a closure to avoid creating global variables.
+
+if (!this.JSON) {
+    this.JSON = {};
+}
+
+(function () {
+
+    function f(n) {
+        // Format integers to have at least two digits.
+        return n < 10 ? '0' + n : n;
+    }
+
+    if (typeof Date.prototype.toJSON !== 'function') {
+
+        Date.prototype.toJSON = function (key) {
+
+            return isFinite(this.valueOf()) ?
+                   this.getUTCFullYear()   + '-' +
+                 f(this.getUTCMonth() + 1) + '-' +
+                 f(this.getUTCDate())      + 'T' +
+                 f(this.getUTCHours())     + ':' +
+                 f(this.getUTCMinutes())   + ':' +
+                 f(this.getUTCSeconds())   + 'Z' : null;
+        };
+
+        String.prototype.toJSON =
+        Number.prototype.toJSON =
+        Boolean.prototype.toJSON = function (key) {
+            return this.valueOf();
+        };
+    }
+
+    var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
+        escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
+        gap,
+        indent,
+        meta = {    // table of character substitutions
+            '\b': '\\b',
+            '\t': '\\t',
+            '\n': '\\n',
+            '\f': '\\f',
+            '\r': '\\r',
+            '"' : '\\"',
+            '\\': '\\\\'
+        },
+        rep;
+
+
+    function quote(string) {
+
+// If the string contains no control characters, no quote characters, and no
+// backslash characters, then we can safely slap some quotes around it.
+// Otherwise we must also replace the offending characters with safe escape
+// sequences.
+
+        escapable.lastIndex = 0;
+        return escapable.test(string) ?
+            '"' + string.replace(escapable, function (a) {
+                var c = meta[a];
+                return typeof c === 'string' ? c :
+                    '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
+            }) + '"' :
+            '"' + string + '"';
+    }
+
+
+    function str(key, holder) {
+
+// Produce a string from holder[key].
+
+        var i,          // The loop counter.
+            k,          // The member key.
+            v,          // The member value.
+            length,
+            mind = gap,
+            partial,
+            value = holder[key];
+
+// If the value has a toJSON method, call it to obtain a replacement value.
+
+        if (value && typeof value === 'object' &&
+                typeof value.toJSON === 'function') {
+            value = value.toJSON(key);
+        }
+
+// If we were called with a replacer function, then call the replacer to
+// obtain a replacement value.
+
+        if (typeof rep === 'function') {
+            value = rep.call(holder, key, value);
+        }
+
+// What happens next depends on the value's type.
+
+        switch (typeof value) {
+        case 'string':
+            return quote(value);
+
+        case 'number':
+
+// JSON numbers must be finite. Encode non-finite numbers as null.
+
+            return isFinite(value) ? String(value) : 'null';
+
+        case 'boolean':
+        case 'null':
+
+// If the value is a boolean or null, convert it to a string. Note:
+// typeof null does not produce 'null'. The case is included here in
+// the remote chance that this gets fixed someday.
+
+            return String(value);
+
+// If the type is 'object', we might be dealing with an object or an array or
+// null.
+
+        case 'object':
+
+// Due to a specification blunder in ECMAScript, typeof null is 'object',
+// so watch out for that case.
+
+            if (!value) {
+                return 'null';
+            }
+
+// Make an array to hold the partial results of stringifying this object value.
+
+            gap += indent;
+            partial = [];
+
+// Is the value an array?
+
+            if (Object.prototype.toString.apply(value) === '[object Array]') {
+
+// The value is an array. Stringify every element. Use null as a placeholder
+// for non-JSON values.
+
+                length = value.length;
+                for (i = 0; i < length; i += 1) {
+                    partial[i] = str(i, value) || 'null';
+                }
+
+// Join all of the elements together, separated with commas, and wrap them in
+// brackets.
+
+                v = partial.length === 0 ? '[]' :
+                    gap ? '[\n' + gap +
+                            partial.join(',\n' + gap) + '\n' +
+                                mind + ']' :
+                          '[' + partial.join(',') + ']';
+                gap = mind;
+                return v;
+            }
+
+// If the replacer is an array, use it to select the members to be stringified.
+
+            if (rep && typeof rep === 'object') {
+                length = rep.length;
+                for (i = 0; i < length; i += 1) {
+                    k = rep[i];
+                    if (typeof k === 'string') {
+                        v = str(k, value);
+                        if (v) {
+                            partial.push(quote(k) + (gap ? ': ' : ':') + v);
+                        }
+                    }
+                }
+            } else {
+
+// Otherwise, iterate through all of the keys in the object.
+
+                for (k in value) {
+                    if (Object.hasOwnProperty.call(value, k)) {
+                        v = str(k, value);
+                        if (v) {
+                            partial.push(quote(k) + (gap ? ': ' : ':') + v);
+                        }
+                    }
+                }
+            }
+
+// Join all of the member texts together, separated with commas,
+// and wrap them in braces.
+
+            v = partial.length === 0 ? '{}' :
+                gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' +
+                        mind + '}' : '{' + partial.join(',') + '}';
+            gap = mind;
+            return v;
+        }
+    }
+
+// If the JSON object does not yet have a stringify method, give it one.
+
+    if (typeof JSON.stringify !== 'function') {
+        JSON.stringify = function (value, replacer, space) {
+
+// The stringify method takes a value and an optional replacer, and an optional
+// space parameter, and returns a JSON text. The replacer can be a function
+// that can replace values, or an array of strings that will select the keys.
+// A default replacer method can be provided. Use of the space parameter can
+// produce text that is more easily readable.
+
+            var i;
+            gap = '';
+            indent = '';
+
+// If the space parameter is a number, make an indent string containing that
+// many spaces.
+
+            if (typeof space === 'number') {
+                for (i = 0; i < space; i += 1) {
+                    indent += ' ';
+                }
+
+// If the space parameter is a string, it will be used as the indent string.
+
+            } else if (typeof space === 'string') {
+                indent = space;
+            }
+
+// If there is a replacer, it must be a function or an array.
+// Otherwise, throw an error.
+
+            rep = replacer;
+            if (replacer && typeof replacer !== 'function' &&
+                    (typeof replacer !== 'object' ||
+                     typeof replacer.length !== 'number')) {
+                throw new Error('JSON.stringify');
+            }
+
+// Make a fake root object containing our value under the key of ''.
+// Return the result of stringifying the value.
+
+            return str('', {'': value});
+        };
+    }
+
+
+// If the JSON object does not yet have a parse method, give it one.
+
+    if (typeof JSON.parse !== 'function') {
+        JSON.parse = function (text, reviver) {
+
+// The parse method takes a text and an optional reviver function, and returns
+// a JavaScript value if the text is a valid JSON text.
+
+            var j;
+
+            function walk(holder, key) {
+
+// The walk method is used to recursively walk the resulting structure so
+// that modifications can be made.
+
+                var k, v, value = holder[key];
+                if (value && typeof value === 'object') {
+                    for (k in value) {
+                        if (Object.hasOwnProperty.call(value, k)) {
+                            v = walk(value, k);
+                            if (v !== undefined) {
+                                value[k] = v;
+                            } else {
+                                delete value[k];
+                            }
+                        }
+                    }
+                }
+                return reviver.call(holder, key, value);
+            }
+
+
+// Parsing happens in four stages. In the first stage, we replace certain
+// Unicode characters with escape sequences. JavaScript handles many characters
+// incorrectly, either silently deleting them, or treating them as line endings.
+
+            text = String(text);
+            cx.lastIndex = 0;
+            if (cx.test(text)) {
+                text = text.replace(cx, function (a) {
+                    return '\\u' +
+                        ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
+                });
+            }
+
+// In the second stage, we run the text against regular expressions that look
+// for non-JSON patterns. We are especially concerned with '()' and 'new'
+// because they can cause invocation, and '=' because it can cause mutation.
+// But just to be safe, we want to reject all unexpected forms.
+
+// We split the second stage into 4 regexp operations in order to work around
+// crippling inefficiencies in IE's and Safari's regexp engines. First we
+// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
+// replace all simple value tokens with ']' characters. Third, we delete all
+// open brackets that follow a colon or comma or that begin the text. Finally,
+// we look to see that the remaining characters are only whitespace or ']' or
+// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
+
+            if (/^[\],:{}\s]*$/
+.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
+.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
+.replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
+
+// In the third stage we use the eval function to compile the text into a
+// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
+// in JavaScript: it can begin a block or an object literal. We wrap the text
+// in parens to eliminate the ambiguity.
+
+                j = eval('(' + text + ')');
+
+// In the optional fourth stage, we recursively walk the new structure, passing
+// each name/value pair to a reviver function for possible transformation.
+
+                return typeof reviver === 'function' ?
+                    walk({'': j}, '') : j;
+            }
+
+// If the text is not JSON parseable, then a SyntaxError is thrown.
+
+            throw new SyntaxError('JSON.parse');
+        };
+    }
+}());
Index: trunk/prototype/plugins/mask/jquery.maskedinput.js
===================================================================
--- trunk/prototype/plugins/mask/jquery.maskedinput.js	(revision 5341)
+++ trunk/prototype/plugins/mask/jquery.maskedinput.js	(revision 5341)
@@ -0,0 +1,7 @@
+/*
+	Masked Input plugin for jQuery
+	Copyright (c) 2007-2011 Josh Bush (digitalbush.com)
+	Licensed under the MIT license (http://digitalbush.com/projects/masked-input-plugin/#license) 
+	Version: 1.3
+*/
+(function(a){var b=(a.browser.msie?"paste":"input")+".mask",c=window.orientation!=undefined;a.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},dataName:"rawMaskFn"},a.fn.extend({caret:function(a,b){if(this.length!=0){if(typeof a=="number"){b=typeof b=="number"?b:a;return this.each(function(){if(this.setSelectionRange)this.setSelectionRange(a,b);else if(this.createTextRange){var c=this.createTextRange();c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",a),c.select()}})}if(this[0].setSelectionRange)a=this[0].selectionStart,b=this[0].selectionEnd;else if(document.selection&&document.selection.createRange){var c=document.selection.createRange();a=0-c.duplicate().moveStart("character",-1e5),b=a+c.text.length}return{begin:a,end:b}}},unmask:function(){return this.trigger("unmask")},mask:function(d,e){if(!d&&this.length>0){var f=a(this[0]);return f.data(a.mask.dataName)()}e=a.extend({placeholder:"_",completed:null},e);var g=a.mask.definitions,h=[],i=d.length,j=null,k=d.length;a.each(d.split(""),function(a,b){b=="?"?(k--,i=a):g[b]?(h.push(new RegExp(g[b])),j==null&&(j=h.length-1)):h.push(null)});return this.trigger("unmask").each(function(){function v(a){var b=f.val(),c=-1;for(var d=0,g=0;d<k;d++)if(h[d]){l[d]=e.placeholder;while(g++<b.length){var m=b.charAt(g-1);if(h[d].test(m)){l[d]=m,c=d;break}}if(g>b.length)break}else l[d]==b.charAt(g)&&d!=i&&(g++,c=d);if(!a&&c+1<i)f.val(""),t(0,k);else if(a||c+1>=i)u(),a||f.val(f.val().substring(0,c+1));return i?d:j}function u(){return f.val(l.join("")).val()}function t(a,b){for(var c=a;c<b&&c<k;c++)h[c]&&(l[c]=e.placeholder)}function s(a){var b=a.which,c=f.caret();if(a.ctrlKey||a.altKey||a.metaKey||b<32)return!0;if(b){c.end-c.begin!=0&&(t(c.begin,c.end),p(c.begin,c.end-1));var d=n(c.begin-1);if(d<k){var g=String.fromCharCode(b);if(h[d].test(g)){q(d),l[d]=g,u();var i=n(d);f.caret(i),e.completed&&i>=k&&e.completed.call(f)}}return!1}}function r(a){var b=a.which;if(b==8||b==46||c&&b==127){var d=f.caret(),e=d.begin,g=d.end;g-e==0&&(e=b!=46?o(e):g=n(e-1),g=b==46?n(g):g),t(e,g),p(e,g-1);return!1}if(b==27){f.val(m),f.caret(0,v());return!1}}function q(a){for(var b=a,c=e.placeholder;b<k;b++)if(h[b]){var d=n(b),f=l[b];l[b]=c;if(d<k&&h[d].test(f))c=f;else break}}function p(a,b){if(!(a<0)){for(var c=a,d=n(b);c<k;c++)if(h[c]){if(d<k&&h[c].test(l[d]))l[c]=l[d],l[d]=e.placeholder;else break;d=n(d)}u(),f.caret(Math.max(j,a))}}function o(a){while(--a>=0&&!h[a]);return a}function n(a){while(++a<=k&&!h[a]);return a}var f=a(this),l=a.map(d.split(""),function(a,b){if(a!="?")return g[a]?e.placeholder:a}),m=f.val();f.data(a.mask.dataName,function(){return a.map(l,function(a,b){return h[b]&&a!=e.placeholder?a:null}).join("")}),f.attr("readonly")||f.one("unmask",function(){f.unbind(".mask").removeData(a.mask.dataName)}).bind("focus.mask",function(){m=f.val();var b=v();u();var c=function(){b==d.length?f.caret(0,b):f.caret(b)};(a.browser.msie?c:function(){setTimeout(c,0)})()}).bind("blur.mask",function(){v(),f.val()!=m&&f.change()}).bind("keydown.mask",r).bind("keypress.mask",s).bind(b,function(){setTimeout(function(){f.caret(v(!0))},0)}),v()})}})})(jQuery)
Index: trunk/prototype/plugins/fullcalendar/gcal.js
===================================================================
--- trunk/prototype/plugins/fullcalendar/gcal.js	(revision 5341)
+++ trunk/prototype/plugins/fullcalendar/gcal.js	(revision 5341)
@@ -0,0 +1,112 @@
+/*
+ * FullCalendar v1.5.2 Google Calendar Plugin
+ *
+ * Copyright (c) 2011 Adam Shaw
+ * Dual licensed under the MIT and GPL licenses, located in
+ * MIT-LICENSE.txt and GPL-LICENSE.txt respectively.
+ *
+ * Date: Sun Aug 21 22:06:09 2011 -0700
+ *
+ */
+ 
+(function($) {
+
+
+var fc = $.fullCalendar;
+var formatDate = fc.formatDate;
+var parseISO8601 = fc.parseISO8601;
+var addDays = fc.addDays;
+var applyAll = fc.applyAll;
+
+
+fc.sourceNormalizers.push(function(sourceOptions) {
+	if (sourceOptions.dataType == 'gcal' ||
+		sourceOptions.dataType === undefined &&
+		(sourceOptions.url || '').match(/^(http|https):\/\/www.google.com\/calendar\/feeds\//)) {
+			sourceOptions.dataType = 'gcal';
+			if (sourceOptions.editable === undefined) {
+				sourceOptions.editable = false;
+			}
+		}
+});
+
+
+fc.sourceFetchers.push(function(sourceOptions, start, end) {
+	if (sourceOptions.dataType == 'gcal') {
+		return transformOptions(sourceOptions, start, end);
+	}
+});
+
+
+function transformOptions(sourceOptions, start, end) {
+
+	var success = sourceOptions.success;
+	var data = $.extend({}, sourceOptions.data || {}, {
+		'start-min': formatDate(start, 'u'),
+		'start-max': formatDate(end, 'u'),
+		'singleevents': true,
+		'max-results': 9999
+	});
+	
+	var ctz = sourceOptions.currentTimezone;
+	if (ctz) {
+		data.ctz = ctz = ctz.replace(' ', '_');
+	}
+
+	return $.extend({}, sourceOptions, {
+		url: sourceOptions.url.replace(/\/basic$/, '/full') + '?alt=json-in-script&callback=?',
+		dataType: 'jsonp',
+		data: data,
+		startParam: false,
+		endParam: false,
+		success: function(data) {
+			var events = [];
+			if (data.feed.entry) {
+				$.each(data.feed.entry, function(i, entry) {
+					var startStr = entry['gd$when'][0]['startTime'];
+					var start = parseISO8601(startStr, true);
+					var end = parseISO8601(entry['gd$when'][0]['endTime'], true);
+					var allDay = startStr.indexOf('T') == -1;
+					var url;
+					$.each(entry.link, function(i, link) {
+						if (link.type == 'text/html') {
+							url = link.href;
+							if (ctz) {
+								url += (url.indexOf('?') == -1 ? '?' : '&') + 'ctz=' + ctz;
+							}
+						}
+					});
+					if (allDay) {
+						addDays(end, -1); // make inclusive
+					}
+					events.push({
+						id: entry['gCal$uid']['value'],
+						title: entry['title']['$t'],
+						url: url,
+						start: start,
+						end: end,
+						allDay: allDay,
+						location: entry['gd$where'][0]['valueString'],
+						description: entry['content']['$t']
+					});
+				});
+			}
+			var args = [events].concat(Array.prototype.slice.call(arguments, 1));
+			var res = applyAll(success, this, args);
+			if ($.isArray(res)) {
+				return res;
+			}
+			return events;
+		}
+	});
+	
+}
+
+
+// legacy
+fc.gcalFeed = function(url, sourceOptions) {
+	return $.extend({}, sourceOptions, { url: url, dataType: 'gcal' });
+};
+
+
+})(jQuery);
Index: trunk/prototype/plugins/fullcalendar/fullcalendar.css
===================================================================
--- trunk/prototype/plugins/fullcalendar/fullcalendar.css	(revision 5341)
+++ trunk/prototype/plugins/fullcalendar/fullcalendar.css	(revision 5341)
@@ -0,0 +1,645 @@
+/*
+ * FullCalendar v1.5 Stylesheet
+ *
+ * Copyright (c) 2011 Adam Shaw
+ * Dual licensed under the MIT and GPL licenses, located in
+ * MIT-LICENSE.txt and GPL-LICENSE.txt respectively.
+ *
+ * Date: Sat Mar 19 18:59:37 2011 -0700
+ *
+ */
+
+
+.fc {
+	direction: ltr;
+	text-align: left;
+	}
+	
+.fc table {
+	border-collapse: collapse;
+	border-spacing: 0;
+	}
+	
+html .fc,
+.fc table {
+	font-size: 1em;
+	}
+	
+.fc td,
+.fc th {
+	padding: 0;
+	vertical-align: top;
+	}
+
+
+
+/* Header
+------------------------------------------------------------------------*/
+
+.fc-header td {
+	white-space: nowrap;
+	}
+
+.fc-header-left {
+	width: 25%;
+	text-align: left;
+	}
+	
+.fc-header-center {
+	text-align: center;
+	}
+	
+.fc-header-right {
+	width: 25%;
+	text-align: right;
+	}
+	
+.fc-header-title {
+	display: inline-block;
+	vertical-align: top;
+	}
+	
+.fc-header-title h2 {
+	margin-top: 0;
+	white-space: nowrap;
+	}
+	
+.fc .fc-header-space {
+	padding-left: 10px;
+	}
+	
+.fc-header .fc-button {
+	margin-bottom: 1em;
+	vertical-align: top;
+	}
+	
+/* buttons edges butting together */
+
+.fc-header .fc-button {
+	margin-right: -1px;
+	}
+	
+.fc-header .fc-corner-right {
+	margin-right: 1px; /* back to normal */
+	}
+	
+.fc-header .ui-corner-right {
+	margin-right: 0; /* back to normal */
+	}
+	
+/* button layering (for border precedence) */
+	
+.fc-header .fc-state-hover,
+.fc-header .ui-state-hover {
+	z-index: 2;
+	}
+	
+.fc-header .fc-state-down {
+	z-index: 3;
+	}
+
+.fc-header .fc-state-active,
+.fc-header .ui-state-active {
+	z-index: 4;
+	}
+	
+	
+	
+/* Content
+------------------------------------------------------------------------*/
+	
+.fc-content {
+	clear: both;
+	}
+	
+.fc-view {
+	width: 100%; /* needed for view switching (when view is absolute) */
+	overflow: hidden;
+	}
+	
+	
+
+/* Cell Styles
+------------------------------------------------------------------------*/
+
+.fc-widget-header,    /* <th>, usually */
+.fc-widget-content {  /* <td>, usually */
+	border: 1px solid #ccc;
+	}
+/* k - for year-type display */ 
+.fc-year-main-table .fc-widget-content {
+	border: none;
+}
+	
+.fc-state-highlight { /* <td> today cell */ /* TODO: add .fc-today to <th> */
+	background: #ffc;
+	}
+	
+.fc-cell-overlay { /* semi-transparent rectangle while dragging */
+	background: #9cf;
+	opacity: .2;
+	filter: alpha(opacity=20); /* for IE */
+	}
+	
+
+
+/* Buttons
+------------------------------------------------------------------------*/
+
+.fc-button {
+	position: relative;
+	display: inline-block;
+	cursor: pointer;
+	}
+	
+.fc-state-default { /* non-theme */
+	border-style: solid;
+	border-width: 1px 0;
+	}
+	
+.fc-button-inner {
+	position: relative;
+	float: left;
+	overflow: hidden;
+	}
+	
+.fc-state-default .fc-button-inner { /* non-theme */
+	border-style: solid;
+	border-width: 0 1px;
+	}
+	
+.fc-button-content {
+	position: relative;
+	float: left;
+	height: 1.9em;
+	line-height: 1.9em;
+	padding: 0 .6em;
+	white-space: nowrap;
+	}
+	
+/* icon (for jquery ui) */
+	
+.fc-button-content .fc-icon-wrap {
+	position: relative;
+	float: left;
+	top: 50%;
+	}
+	
+.fc-button-content .ui-icon {
+	position: relative;
+	float: left;
+	margin-top: -50%;
+	*margin-top: 0;
+	*top: -50%;
+	}
+	
+/* gloss effect */
+	
+.fc-state-default .fc-button-effect {
+	position: absolute;
+	top: 50%;
+	left: 0;
+	}
+	
+.fc-state-default .fc-button-effect span {
+	position: absolute;
+	top: -100px;
+	left: 0;
+	width: 500px;
+	height: 100px;
+	border-width: 100px 0 0 1px;
+	border-style: solid;
+	border-color: #fff;
+	background: #444;
+	opacity: .09;
+	filter: alpha(opacity=9);
+	}
+	
+/* button states (determines colors)  */
+	
+.fc-state-default,
+.fc-state-default .fc-button-inner {
+	border-style: solid;
+	border-color: #ccc #bbb #aaa;
+	background: #F3F3F3;
+	color: #000;
+	}
+	
+.fc-state-hover,
+.fc-state-hover .fc-button-inner {
+	border-color: #999;
+	}
+	
+.fc-state-down,
+.fc-state-down .fc-button-inner {
+	border-color: #555;
+	background: #777;
+	}
+	
+.fc-state-active,
+.fc-state-active .fc-button-inner {
+	border-color: #555;
+	background: #777;
+	color: #fff;
+	}
+	
+.fc-state-disabled,
+.fc-state-disabled .fc-button-inner {
+	color: #999;
+	border-color: #ddd;
+	}
+	
+.fc-state-disabled .fc-button-effect {
+	display: none;
+	}
+	
+	
+
+/* Global Event Styles
+------------------------------------------------------------------------*/
+	 
+.fc-event {
+	border-style: solid;
+	border-width: 0;
+	font-size: .85em;
+	cursor: default;
+	}
+	
+a.fc-event,
+.fc-event-draggable {
+	cursor: pointer;
+	}
+	
+a.fc-event {
+	text-decoration: none;
+	}
+	
+.fc-rtl .fc-event {
+	text-align: right;
+	}
+	
+.fc-event-skin {
+	border-color: #36c;     /* default BORDER color */
+	background-color: #36c; /* default BACKGROUND color */
+	color: #fff;            /* default TEXT color */
+	}
+	
+.fc-event-inner {
+	position: relative;
+	width: 100%;
+	height: 100%;
+	border-style: solid;
+	border-width: 0;
+	}
+	
+.fc-event-time,
+.fc-event-title {
+	padding: 0 1px;
+	}
+	
+.fc .ui-resizable-handle { /*** TODO: don't use ui-resizable anymore, change class ***/
+	display: block;
+	position: absolute;
+	z-index: 99999;
+	overflow: hidden; /* hacky spaces (IE6/7) */
+	font-size: 300%;  /* */
+	line-height: 50%; /* */
+	}
+	
+	
+	
+/* Horizontal Events
+------------------------------------------------------------------------*/
+
+.fc-event-hori {
+	border-width: 1px 0;
+	margin-bottom: 1px;
+	}
+	
+/* resizable */
+	
+.fc-event-hori .ui-resizable-e {
+	top: 0           !important; /* importants override pre jquery ui 1.7 styles */
+	right: -3px      !important;
+	width: 7px       !important;
+	height: 100%     !important;
+	cursor: e-resize;
+	}
+	
+.fc-event-hori .ui-resizable-w {
+	top: 0           !important;
+	left: -3px       !important;
+	width: 7px       !important;
+	height: 100%     !important;
+	cursor: w-resize;
+	}
+	
+.fc-event-hori .ui-resizable-handle {
+	_padding-bottom: 14px; /* IE6 had 0 height */
+	}
+	
+	
+	
+/* Fake Rounded Corners (for buttons and events)
+------------------------------------------------------------*/
+	
+.fc-corner-left {
+	margin-left: 1px;
+	}
+	
+.fc-corner-left .fc-button-inner,
+.fc-corner-left .fc-event-inner {
+	margin-left: -1px;
+	}
+	
+.fc-corner-right {
+	margin-right: 1px;
+	}
+	
+.fc-corner-right .fc-button-inner,
+.fc-corner-right .fc-event-inner {
+	margin-right: -1px;
+	}
+	
+.fc-corner-top {
+	margin-top: 1px;
+	}
+	
+.fc-corner-top .fc-event-inner {
+	margin-top: -1px;
+	}
+	
+.fc-corner-bottom {
+	margin-bottom: 1px;
+	}
+	
+.fc-corner-bottom .fc-event-inner {
+	margin-bottom: -1px;
+	}
+	
+	
+	
+/* Fake Rounded Corners SPECIFICALLY FOR EVENTS
+-----------------------------------------------------------------*/
+	
+.fc-corner-left .fc-event-inner {
+	border-left-width: 1px;
+	}
+	
+.fc-corner-right .fc-event-inner {
+	border-right-width: 1px;
+	}
+	
+.fc-corner-top .fc-event-inner {
+	border-top-width: 1px;
+	}
+	
+.fc-corner-bottom .fc-event-inner {
+	border-bottom-width: 1px;
+	}
+	
+	
+	
+/* Reusable Separate-border Table
+------------------------------------------------------------*/
+
+table.fc-border-separate {
+	border-collapse: separate;
+	}
+	
+.fc-border-separate th,
+.fc-border-separate td {
+	border-width: 1px 0 0 1px;
+	}
+	
+.fc-border-separate th.fc-last,
+.fc-border-separate td.fc-last {
+	border-right-width: 1px;
+	}
+	
+.fc-border-separate tr.fc-last th,
+.fc-border-separate tr.fc-last td {
+	border-bottom-width: 1px;
+	}
+	
+.fc-border-separate tbody tr.fc-first td,
+.fc-border-separate tbody tr.fc-first th {
+	border-top-width: 0;
+	}
+	
+	
+
+/* Month View, Basic Week View, Basic Day View
+------------------------------------------------------------------------*/
+
+.fc-grid th {
+	text-align: center;
+	}
+	
+.fc-grid .fc-day-number {
+	float: right;
+	padding: 0 2px;
+	}
+	
+.fc-grid .fc-other-month .fc-day-number {
+	opacity: 0.3;
+	filter: alpha(opacity=30); /* for IE */
+	/* opacity with small font can sometimes look too faded
+	   might want to set the 'color' property instead
+	   making day-numbers bold also fixes the problem */
+	}
+	
+.fc-grid .fc-day-content {
+	clear: both;
+	padding: 2px 2px 1px; /* distance between events and day edges */
+	}
+	
+/* event styles */
+	
+.fc-grid .fc-event-time {
+	font-weight: bold;
+	}
+	
+/* right-to-left */
+	
+.fc-rtl .fc-grid .fc-day-number {
+	float: left;
+	}
+	
+.fc-rtl .fc-grid .fc-event-time {
+	float: right;
+	}
+	
+	
+
+/* Agenda Week View, Agenda Day View
+------------------------------------------------------------------------*/
+
+.fc-agenda table {
+	border-collapse: separate;
+	}
+	
+.fc-agenda-days th {
+	text-align: center;
+	}
+	
+.fc-agenda .fc-agenda-axis {
+	width: 50px;
+	padding: 0 4px;
+	vertical-align: middle;
+	text-align: right;
+	white-space: nowrap;
+	font-weight: normal;
+	}
+	
+.fc-agenda .fc-day-content {
+	padding: 2px 2px 1px;
+	}
+	
+/* make axis border take precedence */
+	
+.fc-agenda-days .fc-agenda-axis {
+	border-right-width: 1px;
+	}
+	
+.fc-agenda-days .fc-col0 {
+	border-left-width: 0;
+	}
+	
+/* all-day area */
+	
+.fc-agenda-allday th {
+	border-width: 0 1px;
+	}
+	
+.fc-agenda-allday .fc-day-content {
+	min-height: 34px; /* TODO: doesnt work well in quirksmode */
+	_height: 34px;
+	}
+	
+/* divider (between all-day and slots) */
+	
+.fc-agenda-divider-inner {
+	height: 2px;
+	overflow: hidden;
+	}
+	
+.fc-widget-header .fc-agenda-divider-inner {
+	background: #eee;
+	}
+	
+/* slot rows */
+	
+.fc-agenda-slots th {
+	border-width: 1px 1px 0;
+	}
+	
+.fc-agenda-slots td {
+	border-width: 1px 0 0;
+	background: none;
+	}
+	
+.fc-agenda-slots td div {
+	height: 20px;
+	}
+	
+.fc-agenda-slots tr.fc-slot0 th,
+.fc-agenda-slots tr.fc-slot0 td {
+	border-top-width: 0;
+	}
+
+.fc-agenda-slots tr.fc-minor th,
+.fc-agenda-slots tr.fc-minor td {
+	border-top-style: dotted;
+	}
+	
+.fc-agenda-slots tr.fc-minor th.ui-widget-header {
+	*border-top-style: solid; /* doesn't work with background in IE6/7 */
+	}
+	
+
+
+/* Vertical Events
+------------------------------------------------------------------------*/
+
+.fc-event-vert {
+	border-width: 0 1px;
+	}
+	
+.fc-event-vert .fc-event-head,
+.fc-event-vert .fc-event-content {
+	position: relative;
+	z-index: 2;
+	width: 100%;
+	overflow: hidden;
+	}
+	
+.fc-event-vert .fc-event-time {
+	white-space: nowrap;
+	font-size: 10px;
+	}
+	
+.fc-event-vert .fc-event-bg { /* makes the event lighter w/ a semi-transparent overlay  */
+	position: absolute;
+	z-index: 1;
+	top: 0;
+	left: 0;
+	width: 100%;
+	height: 100%;
+	background: #fff;
+	opacity: .3;
+	filter: alpha(opacity=30);
+	}
+	
+.fc .ui-draggable-dragging .fc-event-bg, /* TODO: something nicer like .fc-opacity */
+.fc-select-helper .fc-event-bg {
+	display: none\9; /* for IE6/7/8. nested opacity filters while dragging don't work */
+	}
+	
+/* resizable */
+	
+.fc-event-vert .ui-resizable-s {
+	bottom: 0        !important; /* importants override pre jquery ui 1.7 styles */
+	width: 100%      !important;
+	height: 8px      !important;
+	overflow: hidden !important;
+	line-height: 8px !important;
+	font-size: 11px  !important;
+	font-family: monospace;
+	text-align: center;
+	cursor: s-resize;
+	}
+	
+.fc-agenda .ui-resizable-resizing { /* TODO: better selector */
+	_overflow: hidden;
+	}
+	
+.ui-widget-overlay { background-color: #666666 /*url(images/ui-bg_diagonals-thick_20_666666_40x40.png) 50% 50% repeat*/; opacity: .50;filter:Alpha(Opacity=50); height: 100%; width: 100%; position: absolute; top: 0; left: 0; }
+
+
+/*year view*/
+.fc-year-main-table{
+	border-spacing: 5px !important;
+}
+/* k */
+/*.fc-year-monthly-td
+{
+	border: thin #0f0f0f solid !important;
+}*/
+.fc-year-monthly-header{
+	border: thin #f0f0f0 solid !important;
+}
+.fc-year-have-event{
+	background: #9cf;
+}
+
+.fc-year-monthly-td table {
+	padding:10px;
+}
+/* k */
+
+
+.fc-year-monthly-td table .fc-day {
+	opacity:0;
+	filter:alpha(opacity=0); /* For IE8 and earlier */
+}
Index: trunk/prototype/plugins/fullcalendar/fullcalendar.year.js
===================================================================
--- trunk/prototype/plugins/fullcalendar/fullcalendar.year.js	(revision 5341)
+++ trunk/prototype/plugins/fullcalendar/fullcalendar.year.js	(revision 5341)
@@ -0,0 +1,658 @@
+//Year View Start ----------------------------------------------------------------------------------
+//add by kebin --> 6
+fcViews.year = YearView;
+
+function YearView(element, calendar) {
+	var t = this;
+	// exports
+	t.render = render;
+	
+	
+	// imports
+	BasicYearView.call(t, element, calendar, 'year');
+	var opt = t.opt;
+	var renderYear = t.renderYear;
+	var formatDate = calendar.formatDate;
+	function render(date, delta) {
+		if (delta) {
+			addYears(date, delta);
+		}
+		var start = cloneDate(date, true);		
+		start.setFullYear(start.getFullYear(),0,1);
+		var end = cloneDate(start);
+		end.setFullYear(end.getFullYear(), 11,31);
+		var visStart = cloneDate(start); //set startDay
+		var visEnd = cloneDate(end);
+		var firstDay = opt('firstDay');
+		var nwe = opt('weekends') ? 0 : 1;
+		rowCnt = 54;
+		t.title = formatDate(start, opt('titleFormat'));
+		t.start = start;
+		t.end = end;
+		t.visStart = visStart;
+		t.visEnd = visEnd;
+		renderYear(rowCnt, nwe ? 5 : 7, true);
+	}
+}
+
+function BasicYearView(element, calendar, viewName) {
+	var t = this;
+	
+	// exports
+	t.renderYear = renderYear;
+	t.setHeight = setHeight;
+	t.setWidth = setWidth;
+	t.renderDayOverlay = renderDayOverlay;
+	t.defaultSelectionEnd = defaultSelectionEnd;
+	t.renderSelection = renderSelection;
+	t.clearSelection = clearSelection;
+	t.reportDayClick = reportDayClick; // for selection (kinda hacky)
+	t.dragStart = dragStart;
+	t.dragStop = dragStop;
+	t.defaultEventEnd = defaultEventEnd;
+	t.getHoverListener = function() { return hoverListener };
+	t.colContentLeft = colContentLeft;
+	t.colContentRight = colContentRight;
+	t.dayOfWeekCol = dayOfWeekCol;
+	t.dateCell = dateCell;
+	t.cellDate = cellDate;
+	t.cellIsAllDay = function() { return true };
+	t.allDayRow = allDayRow;
+	t.allDayBounds = allDayBounds;
+	t.getRowCnt = function() { return rowCnt };
+	t.getColCnt = function() { return colCnt };
+	t.getColWidth = function() { return colWidth };
+	t.getDaySegmentContainer = function() { return daySegmentContainer };
+	
+	
+	// imports
+	View.call(t, element, calendar, viewName);
+	OverlayManager.call(t);
+	SelectionManager.call(t);
+	BasicYearEventRenderer.call(t);
+	var opt = t.opt;
+	var trigger = t.trigger;
+	var clearEvents = t.clearEvents;
+	var renderOverlay = t.renderOverlay;
+	var clearOverlays = t.clearOverlays;
+	var daySelectionMousedown = t.daySelectionMousedown;
+	var formatDate = calendar.formatDate;
+	
+	
+	// locals
+	
+	var head;
+	var headCells;
+	var body;
+	var bodyRows;
+	var bodyCells;
+	var bodyFirstCells;
+	var bodyCellTopInners;
+	var daySegmentContainer;
+	
+	var viewWidth;
+	var viewHeight;
+	var colWidth;
+	
+	var rowCnt, colCnt;
+	var coordinateGrid;
+	var hoverListener;
+	var colContentPositions;
+	
+	var rtl, dis, dit;
+	var firstDay;
+	var nwe;
+	var tm;
+	var colFormat;
+	
+	
+	
+	/* Rendering
+	------------------------------------------------------------*/
+	
+	
+	disableTextSelection(element.addClass('fc-grid'));
+	
+	
+	function renderYear(maxr, r, c, showNumbers) {
+		rowCnt = r;
+		colCnt = c;
+		updateOptions();
+		var firstTime = !body;
+		if (firstTime) {
+			buildSkeleton(maxr, showNumbers);
+		}else{
+			clearEvents();
+		}
+		updateCells(firstTime);
+	}
+	
+	
+	
+	function updateOptions() {
+		rtl = opt('isRTL');
+		if (rtl) {
+			dis = -1;
+			dit = colCnt - 1;
+		}else{
+			dis = 1;
+			dit = 0;
+		}
+		firstDay = opt('firstDay');
+		nwe = opt('weekends') ? 0 : 1;
+		tm = opt('theme') ? 'ui' : 'fc';
+		colFormat = opt('columnFormat');
+	}
+	
+	
+	
+	function buildSkeleton(maxRowCnt, showNumbers) {
+		var s;
+		var headerClass = tm + "-widget-header";
+		var contentClass = tm + "-widget-content";
+		var i, j;
+		var table;
+		
+		s =
+			"<table class='fc-border-separate' style='width:100%' cellspacing='0'>" +
+			"<thead>" +
+			"<tr>";
+		for (i=0; i<colCnt; i++) {
+			s +=
+				"<th class='fc- " + headerClass + "'/>"; // need fc- for setDayID
+		}
+		s +=
+			"</tr>" +
+			"</thead>" +
+			"<tbody>";
+		for (i=0; i<maxRowCnt; i++) {
+			s +=
+				"<tr class='fc-week" + i + "'>";
+			for (j=0; j<colCnt; j++) {
+				s +=
+					"<td class='fc- " + contentClass + " fc-day" + (i*colCnt+j) + "'>" + // need fc- for setDayID
+					"<div>" +
+					(showNumbers ?
+						"<div class='fc-day-number'/>" :
+						''
+						) +
+					"<div class='fc-day-content'>" +
+					"<div style='position:relative'>&nbsp;</div>" +
+					"</div>" +
+					"</div>" +
+					"</td>";
+			}
+			s +=
+				"</tr>";
+		}
+		s +=
+			"</tbody>" +
+			"</table>";
+		table = $(s).appendTo(element);
+		
+		head = table.find('thead');
+		headCells = head.find('th');
+		body = table.find('tbody');
+		bodyRows = body.find('tr');
+		bodyCells = body.find('td');
+		bodyFirstCells = bodyCells.filter(':first-child');
+		bodyCellTopInners = bodyRows.eq(0).find('div.fc-day-content div');
+		
+		markFirstLast(head.add(head.find('tr'))); // marks first+last tr/th's
+		markFirstLast(bodyRows); // marks first+last td's
+		bodyRows.eq(0).addClass('fc-first'); // fc-last is done in updateCells
+		
+		dayBind(bodyCells);
+		
+		daySegmentContainer =
+			$("<div style='position:absolute;z-index:8;top:0;left:0'/>")
+				.appendTo(element);
+	}
+	
+	
+	
+	function updateCells(firstTime) {
+		var dowDirty = firstTime || rowCnt == 1; // could the cells' day-of-weeks need updating?
+		var month = t.start.getMonth();
+		var today = clearTime(new Date());
+		var cell;
+		var date;
+		var row;
+	
+		if (dowDirty) {
+			headCells.each(function(i, _cell) {
+				cell = $(_cell);
+				date = indexDate(i);
+				cell.html(formatDate(date, colFormat));
+				setDayID(cell, date);
+			});
+		}
+		
+		bodyCells.each(function(i, _cell) {
+			cell = $(_cell);
+			date = indexDate(i);
+			if (date.getMonth() == month) {
+				cell.removeClass('fc-other-month');
+			}else{
+				cell.addClass('fc-other-month');
+			}
+			if (+date == +today) {
+				cell.addClass(tm + '-state-highlight fc-today');
+			}else{
+				cell.removeClass(tm + '-state-highlight fc-today');
+			}
+			cell.find('div.fc-day-number').text(date.getDate());
+			if (dowDirty) {
+				setDayID(cell, date);
+			}
+		});
+		
+		bodyRows.each(function(i, _row) {
+			row = $(_row);
+			if (i < rowCnt) {
+				row.show();
+				if (i == rowCnt-1) {
+					row.addClass('fc-last');
+				}else{
+					row.removeClass('fc-last');
+				}
+			}else{
+				row.hide();
+			}
+		});
+	}
+	
+	
+	
+	function setHeight(height) {
+		viewHeight = height;
+		
+		var bodyHeight = viewHeight - head.height();
+		var rowHeight;
+		var rowHeightLast;
+		var cell;
+			
+		if (opt('weekMode') == 'variable') {
+			rowHeight = rowHeightLast = Math.floor(bodyHeight / (rowCnt==1 ? 2 : 6));
+		}else{
+			rowHeight = Math.floor(bodyHeight / rowCnt);
+			rowHeightLast = bodyHeight - rowHeight * (rowCnt-1);
+		}
+		
+		bodyFirstCells.each(function(i, _cell) {
+			if (i < rowCnt) {
+				cell = $(_cell);
+				setMinHeight(
+					cell.find('> div'),
+					(i==rowCnt-1 ? rowHeightLast : rowHeight) - vsides(cell)
+				);
+			}
+		});
+		
+	}
+	
+	
+	function setWidth(width) {
+		viewWidth = width;
+		colContentPositions.clear();
+		colWidth = Math.floor(viewWidth / colCnt);
+		setOuterWidth(headCells.slice(0, -1), colWidth);
+	}
+	
+	
+	
+	/* Day clicking and binding
+	-----------------------------------------------------------*/
+	
+	
+	function dayBind(days) {
+		days.click(dayClick)
+			.mousedown(daySelectionMousedown);
+	}
+	
+	
+	function dayClick(ev) {
+		if (!opt('selectable')) { // if selectable, SelectionManager will worry about dayClick
+			var index = parseInt(this.className.match(/fc\-day(\d+)/)[1]); // TODO: maybe use .data
+			var date = indexDate(index);
+			trigger('dayClick', this, date, true, ev);
+		}
+	}
+	
+	
+	
+	/* Semi-transparent Overlay Helpers
+	------------------------------------------------------*/
+	
+	
+	function renderDayOverlay(overlayStart, overlayEnd, refreshCoordinateGrid) { // overlayEnd is exclusive
+		if (refreshCoordinateGrid) {
+			coordinateGrid.build();
+		}
+		var rowStart = cloneDate(t.visStart);
+		var rowEnd = addDays(cloneDate(rowStart), colCnt);
+		for (var i=0; i<rowCnt; i++) {
+			var stretchStart = new Date(Math.max(rowStart, overlayStart));
+			var stretchEnd = new Date(Math.min(rowEnd, overlayEnd));
+			if (stretchStart < stretchEnd) {
+				var colStart, colEnd;
+				if (rtl) {
+					colStart = dayDiff(stretchEnd, rowStart)*dis+dit+1;
+					colEnd = dayDiff(stretchStart, rowStart)*dis+dit+1;
+				}else{
+					colStart = dayDiff(stretchStart, rowStart);
+					colEnd = dayDiff(stretchEnd, rowStart);
+				}
+				dayBind(
+					renderCellOverlay(i, colStart, i, colEnd-1)
+				);
+			}
+			addDays(rowStart, 7);
+			addDays(rowEnd, 7);
+		}
+	}
+	
+	
+	function renderCellOverlay(row0, col0, row1, col1) { // row1,col1 is inclusive
+		var rect = coordinateGrid.rect(row0, col0, row1, col1, element);
+		return renderOverlay(rect, element);
+	}
+	
+	
+	
+	/* Selection
+	-----------------------------------------------------------------------*/
+	
+	
+	function defaultSelectionEnd(startDate, allDay) {
+		return cloneDate(startDate);
+	}
+	
+	
+	function renderSelection(startDate, endDate, allDay) {
+		renderDayOverlay(startDate, addDays(cloneDate(endDate), 1), true); // rebuild every time???
+	}
+	
+	
+	function clearSelection() {
+		clearOverlays();
+	}
+	
+	
+	function reportDayClick(date, allDay, ev) {
+		var cell = dateCell(date);
+		var _element = bodyCells[cell.row*colCnt + cell.col];
+		trigger('dayClick', _element, date, allDay, ev);
+	}
+	
+	
+	
+	/* External Dragging
+	-----------------------------------------------------------------------*/
+	
+	
+	function dragStart(_dragElement, ev, ui) {
+		hoverListener.start(function(cell) {
+			clearOverlays();
+			if (cell) {
+				renderCellOverlay(cell.row, cell.col, cell.row, cell.col);
+			}
+		}, ev);
+	}
+	
+	
+	function dragStop(_dragElement, ev, ui) {
+		var cell = hoverListener.stop();
+		clearOverlays();
+		if (cell) {
+			var d = cellDate(cell);
+			trigger('drop', _dragElement, d, true, ev, ui);
+		}
+	}
+	
+	
+	
+	/* Utilities
+	--------------------------------------------------------*/
+	
+	
+	function defaultEventEnd(event) {
+		return cloneDate(event.start);
+	}
+	
+	
+	coordinateGrid = new CoordinateGrid(function(rows, cols) {
+		var e, n, p;
+		headCells.each(function(i, _e) {
+			e = $(_e);
+			n = e.offset().left;
+			if (i) {
+				p[1] = n;
+			}
+			p = [n];
+			cols[i] = p;
+		});
+		p[1] = n + e.outerWidth();
+		bodyRows.each(function(i, _e) {
+			if (i < rowCnt) {
+				e = $(_e);
+				n = e.offset().top;
+				if (i) {
+					p[1] = n;
+				}
+				p = [n];
+				rows[i] = p;
+			}
+		});
+		p[1] = n + e.outerHeight();
+	});
+	
+	
+	hoverListener = new HoverListener(coordinateGrid);
+	
+	
+	colContentPositions = new HorizontalPositionCache(function(col) {
+		return bodyCellTopInners.eq(col);
+	});
+	
+	
+	function colContentLeft(col) {
+		return colContentPositions.left(col);
+	}
+	
+	
+	function colContentRight(col) {
+		return colContentPositions.right(col);
+	}
+	
+	
+	
+	
+	function dateCell(date) {
+		return {
+			row: Math.floor(dayDiff(date, t.visStart) / 7),
+			col: dayOfWeekCol(date.getDay())
+		};
+	}
+	
+	
+	function cellDate(cell) {
+		return _cellDate(cell.row, cell.col);
+	}
+	
+	
+	function _cellDate(row, col) {
+		return addDays(cloneDate(t.visStart), row*7 + col*dis+dit);
+		// what about weekends in middle of week?
+	}
+	
+	
+	function indexDate(index) {
+		return _cellDate(Math.floor(index/colCnt), index%colCnt);
+	}
+	
+	
+	function dayOfWeekCol(dayOfWeek) {
+		return ((dayOfWeek - Math.max(firstDay, nwe) + colCnt) % colCnt) * dis + dit;
+	}
+	
+	
+	
+	
+	function allDayRow(i) {
+		return bodyRows.eq(i);
+	}
+	
+	
+	function allDayBounds(i) {
+		return {
+			left: 0,
+			right: viewWidth
+		};
+	}
+	
+	
+}
+
+function BasicYearEventRenderer() {
+	var t = this;
+	
+	
+	// exports
+	t.renderEvents = renderEvents;
+	t.compileDaySegs = compileSegs; // for DayEventRenderer
+	t.clearEvents = clearEvents;
+	t.bindDaySeg = bindDaySeg;
+	
+	
+	// imports
+	DayEventRenderer.call(t);
+	var opt = t.opt;
+	var trigger = t.trigger;
+	//var setOverflowHidden = t.setOverflowHidden;
+	var isEventDraggable = t.isEventDraggable;
+	var isEventResizable = t.isEventResizable;
+	var reportEvents = t.reportEvents;
+	var reportEventClear = t.reportEventClear;
+	var eventElementHandlers = t.eventElementHandlers;
+	var showEvents = t.showEvents;
+	var hideEvents = t.hideEvents;
+	var eventDrop = t.eventDrop;
+	var getDaySegmentContainer = t.getDaySegmentContainer;
+	var getHoverListener = t.getHoverListener;
+	var renderDayOverlay = t.renderDayOverlay;
+	var clearOverlays = t.clearOverlays;
+	var getRowCnt = t.getRowCnt;
+	var getColCnt = t.getColCnt;
+	var renderDaySegs = t.renderDaySegs;
+	var resizableDayEvent = t.resizableDayEvent;
+	
+	
+	
+	/* Rendering
+	--------------------------------------------------------------------*/
+	
+	
+	function renderEvents(events, modifiedEventId) {
+		reportEvents(events);
+		renderDaySegs(compileSegs(events), modifiedEventId);
+	}
+	
+	
+	function clearEvents() {
+		reportEventClear();
+		getDaySegmentContainer().empty();
+	}
+	
+	
+	function compileSegs(events) {
+		var rowCnt = getRowCnt(),
+			colCnt = getColCnt(),
+			d1 = cloneDate(t.visStart),
+			d2 = addDays(cloneDate(d1), colCnt),
+			visEventsEnds = $.map(events, exclEndDay),
+			i, row,
+			j, level,
+			k, seg,
+			segs=[];
+		for (i=0; i<rowCnt; i++) {
+			row = stackSegs(sliceSegs(events, visEventsEnds, d1, d2));
+			for (j=0; j<row.length; j++) {
+				level = row[j];
+				for (k=0; k<level.length; k++) {
+					seg = level[k];
+					seg.row = i;
+					seg.level = j; // not needed anymore
+					segs.push(seg);
+				}
+			}
+			addDays(d1, 7);
+			addDays(d2, 7);
+		}
+		return segs;
+	}
+	
+	
+	function bindDaySeg(event, eventElement, seg) {
+		if (isEventDraggable(event)) {
+			draggableDayEvent(event, eventElement);
+		}
+		if (seg.isEnd && isEventResizable(event)) {
+			resizableDayEvent(event, eventElement, seg);
+		}
+		eventElementHandlers(event, eventElement);
+			// needs to be after, because resizableDayEvent might stopImmediatePropagation on click
+	}
+	
+	
+	
+	/* Dragging
+	----------------------------------------------------------------------------*/
+	
+	
+	function draggableDayEvent(event, eventElement) {
+		var hoverListener = getHoverListener();
+		var dayDelta;
+		eventElement.draggable({
+			zIndex: 9,
+			delay: 50,
+			opacity: opt('dragOpacity'),
+			revertDuration: opt('dragRevertDuration'),
+			start: function(ev, ui) {
+				trigger('eventDragStart', eventElement, event, ev, ui);
+				hideEvents(event, eventElement);
+				hoverListener.start(function(cell, origCell, rowDelta, colDelta) {
+					eventElement.draggable('option', 'revert', !cell || !rowDelta && !colDelta);
+					clearOverlays();
+					if (cell) {
+						//setOverflowHidden(true);
+						dayDelta = rowDelta*7 + colDelta * (opt('isRTL') ? -1 : 1);
+						renderDayOverlay(
+							addDays(cloneDate(event.start), dayDelta),
+							addDays(exclEndDay(event), dayDelta)
+						);
+					}else{
+						//setOverflowHidden(false);
+						dayDelta = 0;
+					}
+				}, ev, 'drag');
+			},
+			stop: function(ev, ui) {
+				hoverListener.stop();
+				clearOverlays();
+				trigger('eventDragStop', eventElement, event, ev, ui);
+				if (dayDelta) {
+					eventDrop(this, event, dayDelta, 0, event.allDay, ev, ui);
+				}else{
+					eventElement.css('filter', ''); // clear IE opacity side-effects
+					showEvents(event, eventElement);
+				}
+				//setOverflowHidden(false);
+			}
+		});
+	}
+
+
+}
+
+// Year View END ----------------------------------------------------------------------------------
Index: trunk/prototype/plugins/fullcalendar/fullcalendar.js
===================================================================
--- trunk/prototype/plugins/fullcalendar/fullcalendar.js	(revision 5341)
+++ trunk/prototype/plugins/fullcalendar/fullcalendar.js	(revision 5341)
@@ -0,0 +1,5971 @@
+/**
+ * @preserve
+ * FullCalendar v1.5
+ * http://arshaw.com/fullcalendar/
+ *
+ * Use fullcalendar.css for basic styling.
+ * For event drag & drop, requires jQuery UI draggable.
+ * For event resizing, requires jQuery UI resizable.
+ *
+ * Copyright (c) 2011 Adam Shaw
+ * Dual licensed under the MIT and GPL licenses, located in
+ * MIT-LICENSE.txt and GPL-LICENSE.txt respectively.
+ *
+ * Date: Sat Mar 19 18:59:37 2011 -0700
+ *
+ */
+ 
+(function($, undefined) {
+
+
+var defaults = {
+
+	// display
+	defaultView: 'month',
+	aspectRatio: 1.35,
+	header: {
+		left: 'title',
+		center: '',
+		right: 'today prev,next'
+	},
+	weekends: true,
+	
+	// editing
+	//editable: false,
+	//disableDragging: false,
+	//disableResizing: false,
+	
+	allDayDefault: true,
+	ignoreTimezone: true,
+	
+	// event ajax
+	lazyFetching: true,
+	startParam: 'start',
+	endParam: 'end',
+	
+	// time formats
+	titleFormat: {
+		year:'yyyy', // add by Kebin ---> 1 
+		month: 'MMMM yyyy',
+		week: "MMM d[ yyyy]{ '&#8212;'[ MMM] d yyyy}",
+		day: 'dddd, MMM d, yyyy'
+	},
+	columnFormat: {
+		year:'MMMM', //add by kebin --> 2
+		month: 'ddd',
+		week: 'ddd M/d',
+		day: 'dddd M/d'
+	},
+	timeFormat: { // for event elements
+		'': 'h(:mm)t' // default
+	},
+	
+	// locale
+	isRTL: false,
+	firstDay: 0,
+	monthNames: ['January','February','March','April','May','June','July','August','September','October','November','December'],
+	monthNamesShort: ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],
+	dayNames: ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],
+	dayNamesShort: ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],
+	dayNamesShortest: ['S','M','T','W','T','F','S'],	//add by Kebin --> 3
+	buttonText: {
+		prev: '&nbsp;&#9668;&nbsp;',
+		next: '&nbsp;&#9658;&nbsp;',
+		prevYear: '&nbsp;&lt;&lt;&nbsp;',
+		nextYear: '&nbsp;&gt;&gt;&nbsp;',
+		today: 'today',
+		year:'year', //add by kebin --> 4
+		month: 'month',
+		week: 'week',
+		day: 'day'
+	},
+	
+	// jquery-ui theming
+	theme: false,
+	buttonIcons: {
+		prev: 'circle-triangle-w',
+		next: 'circle-triangle-e'
+	},
+	
+	//selectable: false,
+	unselectAuto: true,
+	
+	dropAccept: '*'
+	
+};
+
+// right-to-left defaults
+var rtlDefaults = {
+	header: {
+		left: 'next,prev today',
+		center: '',
+		right: 'title'
+	},
+	buttonText: {
+		prev: '&nbsp;&#9658;&nbsp;',
+		next: '&nbsp;&#9668;&nbsp;',
+		prevYear: '&nbsp;&gt;&gt;&nbsp;',
+		nextYear: '&nbsp;&lt;&lt;&nbsp;'
+	},
+	buttonIcons: {
+		prev: 'circle-triangle-e',
+		next: 'circle-triangle-w'
+	}
+};
+
+
+
+var fc = $.fullCalendar = { version: "1.5" };
+var fcViews = fc.views = {};
+
+
+$.fn.fullCalendar = function(options) {
+
+
+	// method calling
+	if (typeof options == 'string') {
+		var args = Array.prototype.slice.call(arguments, 1);
+		var res;
+		this.each(function() {
+			var calendar = $.data(this, 'fullCalendar');
+			if (calendar && $.isFunction(calendar[options])) {
+				var r = calendar[options].apply(calendar, args);
+				if (res === undefined) {
+					res = r;
+				}
+				if (options == 'destroy') {
+					$.removeData(this, 'fullCalendar');
+				}
+			}
+		});
+		if (res !== undefined) {
+			return res;
+		}
+		return this;
+	}
+	
+	
+	// would like to have this logic in EventManager, but needs to happen before options are recursively extended
+	var eventSources = options.eventSources || [];
+	delete options.eventSources;
+	if (options.events) {
+		eventSources.push(options.events);
+		delete options.events;
+	}
+	
+
+	options = $.extend(true, {},
+		defaults,
+		(options.isRTL || options.isRTL===undefined && defaults.isRTL) ? rtlDefaults : {},
+		options
+	);
+	
+	
+	this.each(function(i, _element) {
+		var element = $(_element);
+		var calendar = new Calendar(element, options, eventSources);
+		element.data('fullCalendar', calendar); // TODO: look into memory leak implications
+		calendar.render();
+	});
+	
+	
+	return this;
+	
+};
+
+
+// function for adding/overriding defaults
+function setDefaults(d) {
+	$.extend(true, defaults, d);
+}
+
+
+
+ 
+function Calendar(element, options, eventSources) {
+	var t = this;
+	
+	
+	// exports
+	t.options = options;
+	t.render = render;
+	t.destroy = destroy;
+	t.refetchEvents = refetchEvents;
+	t.reportEvents = reportEvents;
+	t.reportEventChange = reportEventChange;
+	t.rerenderEvents = rerenderEvents;
+	t.changeView = changeView;
+	t.select = select;
+	t.unselect = unselect;
+	t.prev = prev;
+	t.next = next;
+	t.prevYear = prevYear;
+	t.nextYear = nextYear;
+	t.today = today;
+	t.gotoDate = gotoDate;
+	t.incrementDate = incrementDate;
+	t.formatDate = function(format, date) { return formatDate(format, date, options) };
+	t.formatDates = function(format, date1, date2) { return formatDates(format, date1, date2, options) };
+	t.getDate = getDate;
+	t.getView = getView;
+	t.option = option;
+	t.trigger = trigger;
+	
+	
+	// imports
+	EventManager.call(t, options, eventSources);
+	var isFetchNeeded = t.isFetchNeeded;
+	var fetchEvents = t.fetchEvents;
+	
+	
+	// locals
+	var _element = element[0];
+	var header;
+	var headerElement;
+	var content;
+	var tm; // for making theme classes
+	var currentView;
+	var viewInstances = {};
+	var elementOuterWidth;
+	var suggestedViewHeight;
+	var absoluteViewElement;
+	var resizeUID = 0;
+	var ignoreWindowResize = 0;
+	var date = new Date();
+	var events = [];
+	var _dragElement;
+	
+	
+	
+	/* Main Rendering
+	-----------------------------------------------------------------------------*/
+	
+	
+	setYMD(date, options.year, options.month, options.date);
+	
+	
+	function render(inc) {
+		if (!content) {
+			initialRender();
+		}else{
+			calcSize();
+			markSizesDirty();
+			markEventsDirty();
+			renderView(inc);
+		}
+	}
+	
+	
+	function initialRender() {
+		tm = options.theme ? 'ui' : 'fc';
+		element.addClass('fc');
+		if (options.isRTL) {
+			element.addClass('fc-rtl');
+		}
+		if (options.theme) {
+			element.addClass('ui-widget');
+		}
+		content = $("<div class='fc-content' style='position:relative'/>")
+			.prependTo(element);
+		header = new Header(t, options);
+		headerElement = header.render();
+		if (headerElement) {
+			element.prepend(headerElement);
+		}
+		changeView(options.defaultView);
+		$(window).resize(windowResize);
+		// needed for IE in a 0x0 iframe, b/c when it is resized, never triggers a windowResize
+		if (!bodyVisible()) {
+			lateRender();
+		}
+	}
+	
+	
+	// called when we know the calendar couldn't be rendered when it was initialized,
+	// but we think it's ready now
+	function lateRender() {
+		setTimeout(function() { // IE7 needs this so dimensions are calculated correctly
+			if (!currentView.start && bodyVisible()) { // !currentView.start makes sure this never happens more than once
+				renderView();
+			}
+		},0);
+	}
+	
+	
+	function destroy() {
+		$(window).unbind('resize', windowResize);
+		header.destroy();
+		content.remove();
+		element.removeClass('fc fc-rtl ui-widget');
+	}
+	
+	
+	
+	function elementVisible() {
+		return _element.offsetWidth !== 0;
+	}
+	
+	
+	function bodyVisible() {
+		return $('body')[0].offsetWidth !== 0;
+	}
+	
+	
+	
+	/* View Rendering
+	-----------------------------------------------------------------------------*/
+	
+	// TODO: improve view switching (still weird transition in IE, and FF has whiteout problem)
+	
+	function changeView(newViewName) {
+		if (!currentView || newViewName != currentView.name) {
+			ignoreWindowResize++; // because setMinHeight might change the height before render (and subsequently setSize) is reached
+
+			unselect();
+			
+			var oldView = currentView;
+			var newViewElement;
+				
+			if (oldView) {
+				(oldView.beforeHide || noop)(); // called before changing min-height. if called after, scroll state is reset (in Opera)
+				setMinHeight(content, content.height());
+				oldView.element.hide();
+			}else{
+				setMinHeight(content, 1); // needs to be 1 (not 0) for IE7, or else view dimensions miscalculated
+			}
+			content.css('overflow', 'hidden');
+			
+			currentView = viewInstances[newViewName];
+			if (currentView) {
+				currentView.element.show();
+			}else{
+				currentView = viewInstances[newViewName] = new fcViews[newViewName](
+					newViewElement = absoluteViewElement =
+						$("<div class='fc-view fc-view-" + newViewName + "' style='position:absolute'/>")
+							.appendTo(content),
+					t // the calendar object
+				);
+			}
+			
+			if (oldView) {
+				header.deactivateButton(oldView.name);
+			}
+			header.activateButton(newViewName);
+			
+			renderView(); // after height has been set, will make absoluteViewElement's position=relative, then set to null
+			
+			content.css('overflow', '');
+			if (oldView) {
+				setMinHeight(content, 1);
+			}
+			
+			if (!newViewElement) {
+				(currentView.afterShow || noop)(); // called after setting min-height/overflow, so in final scroll state (for Opera)
+			}
+			
+			ignoreWindowResize--;
+		}
+	}
+	
+	
+	
+	function renderView(inc) {
+		if (elementVisible()) {
+			ignoreWindowResize++; // because renderEvents might temporarily change the height before setSize is reached
+
+			unselect();
+			
+			if (suggestedViewHeight === undefined) {
+				calcSize();
+			}
+			
+			var forceEventRender = false;
+			if (!currentView.start || inc || date < currentView.start || date >= currentView.end) {
+				// view must render an entire new date range (and refetch/render events)
+				currentView.render(date, inc || 0); // responsible for clearing events
+				setSize(true);
+				forceEventRender = true;
+			}
+			else if (currentView.sizeDirty) {
+				// view must resize (and rerender events)
+				currentView.clearEvents();
+				setSize();
+				forceEventRender = true;
+			}
+			else if (currentView.eventsDirty) {
+				currentView.clearEvents();
+				forceEventRender = true;
+			}
+			currentView.sizeDirty = false;
+			currentView.eventsDirty = false;
+			updateEvents(forceEventRender);
+			
+			elementOuterWidth = element.outerWidth();
+			
+			header.updateTitle(currentView.title);
+			var today = new Date();
+			if (today >= currentView.start && today < currentView.end) {
+				header.disableButton('today');
+			}else{
+				header.enableButton('today');
+			}
+			
+			ignoreWindowResize--;
+			currentView.trigger('viewDisplay', _element);
+		}
+	}
+	
+	
+	
+	/* Resizing
+	-----------------------------------------------------------------------------*/
+	
+	
+	function updateSize() {
+		markSizesDirty();
+		if (elementVisible()) {
+			calcSize();
+			setSize();
+			unselect();
+			currentView.clearEvents();
+			currentView.renderEvents(events);
+			currentView.sizeDirty = false;
+		}
+	}
+	
+	
+	function markSizesDirty() {
+		$.each(viewInstances, function(i, inst) {
+			inst.sizeDirty = true;
+		});
+	}
+	
+	
+	function calcSize() {
+		if (options.contentHeight) {
+			suggestedViewHeight = options.contentHeight;
+		}
+		else if (options.height) {
+			suggestedViewHeight = options.height - (headerElement ? headerElement.height() : 0) - vsides(content);
+		}
+		else {
+			suggestedViewHeight = Math.round(content.width() / Math.max(options.aspectRatio, .5));
+		}
+	}
+	
+	
+	function setSize(dateChanged) { // todo: dateChanged?
+		ignoreWindowResize++;
+		currentView.setHeight(suggestedViewHeight, dateChanged);
+		if (absoluteViewElement) {
+			absoluteViewElement.css('position', 'relative');
+			absoluteViewElement = null;
+		}
+		currentView.setWidth(content.width(), dateChanged);
+		ignoreWindowResize--;
+	}
+	
+	
+	function windowResize() {
+		if (!ignoreWindowResize) {
+			if (currentView.start) { // view has already been rendered
+				var uid = ++resizeUID;
+				setTimeout(function() { // add a delay
+					if (uid == resizeUID && !ignoreWindowResize && elementVisible()) {
+						if (elementOuterWidth != (elementOuterWidth = element.outerWidth())) {
+							ignoreWindowResize++; // in case the windowResize callback changes the height
+							updateSize();
+							currentView.trigger('windowResize', _element);
+							ignoreWindowResize--;
+						}
+					}
+				}, 200);
+			}else{
+				// calendar must have been initialized in a 0x0 iframe that has just been resized
+				lateRender();
+			}
+		}
+	}
+	
+	
+	
+	/* Event Fetching/Rendering
+	-----------------------------------------------------------------------------*/
+	
+	
+	// fetches events if necessary, rerenders events if necessary (or if forced)
+	function updateEvents(forceRender) {
+		if (!options.lazyFetching || isFetchNeeded(currentView.visStart, currentView.visEnd)) {
+			refetchEvents();
+		}
+		else if (forceRender) {
+			rerenderEvents();
+		}
+	}
+	
+	
+	function refetchEvents() {
+		fetchEvents(currentView.visStart, currentView.visEnd); // will call reportEvents
+	}
+	
+	
+	// called when event data arrives
+	function reportEvents(_events) {
+		events = _events;
+		rerenderEvents();
+	}
+	
+	
+	// called when a single event's data has been changed
+	function reportEventChange(eventID) {
+		rerenderEvents(eventID);
+	}
+	
+	
+	// attempts to rerenderEvents
+	function rerenderEvents(modifiedEventID) {
+		markEventsDirty();
+		if (elementVisible()) {
+			currentView.clearEvents();
+			currentView.renderEvents(events, modifiedEventID);
+			currentView.eventsDirty = false;
+		}
+	}
+	
+	
+	function markEventsDirty() {
+		$.each(viewInstances, function(i, inst) {
+			inst.eventsDirty = true;
+		});
+	}
+	
+
+
+	/* Selection
+	-----------------------------------------------------------------------------*/
+	
+
+	function select(start, end, allDay) {
+		currentView.select(start, end, allDay===undefined ? true : allDay);
+	}
+	
+
+	function unselect() { // safe to be called before renderView
+		if (currentView) {
+			currentView.unselect();
+		}
+	}
+	
+	
+	
+	/* Date
+	-----------------------------------------------------------------------------*/
+	
+	
+	function prev() {
+		renderView(-1);
+	}
+	
+	
+	function next() {
+		renderView(1);
+	}
+	
+	
+	function prevYear() {
+		addYears(date, -1);
+		renderView();
+	}
+	
+	
+	function nextYear() {
+		addYears(date, 1);
+		renderView();
+	}
+	
+	
+	function today() {
+		date = new Date();
+		renderView();
+	}
+	
+	
+	function gotoDate(year, month, dateOfMonth) {
+		if (year instanceof Date) {
+			date = cloneDate(year); // provided 1 argument, a Date
+		}else{
+			setYMD(date, year, month, dateOfMonth);
+		}
+		renderView();
+	}
+	
+	
+	function incrementDate(years, months, days) {
+		if (years !== undefined) {
+			addYears(date, years);
+		}
+		if (months !== undefined) {
+			addMonths(date, months);
+		}
+		if (days !== undefined) {
+			addDays(date, days);
+		}
+		renderView();
+	}
+	
+	
+	function getDate() {
+		return cloneDate(date);
+	}
+	
+	
+	
+	/* Misc
+	-----------------------------------------------------------------------------*/
+	
+	
+	function getView() {
+		return currentView;
+	}
+	
+	
+	function option(name, value) {
+		if (value === undefined) {
+			return options[name];
+		}
+		if (name == 'height' || name == 'contentHeight' || name == 'aspectRatio') {
+			options[name] = value;
+			updateSize();
+		}
+	}
+	
+	
+	function trigger(name, thisObj) {
+		if (options[name]) {
+			return options[name].apply(
+				thisObj || _element,
+				Array.prototype.slice.call(arguments, 2)
+			);
+		}
+	}
+	
+	
+	
+	/* External Dragging
+	------------------------------------------------------------------------*/
+	
+	if (options.droppable) {
+		$(document)
+			.bind('dragstart', function(ev, ui) {
+				var _e = ev.target;
+				var e = $(_e);
+				if (!e.parents('.fc').length) { // not already inside a calendar
+					var accept = options.dropAccept;
+					if ($.isFunction(accept) ? accept.call(_e, e) : e.is(accept)) {
+						_dragElement = _e;
+						currentView.dragStart(_dragElement, ev, ui);
+					}
+				}
+			})
+			.bind('dragstop', function(ev, ui) {
+				if (_dragElement) {
+					currentView.dragStop(_dragElement, ev, ui);
+					_dragElement = null;
+				}
+			});
+	}
+	
+
+}
+
+function Header(calendar, options) {
+	var t = this;
+	
+	
+	// exports
+	t.render = render;
+	t.destroy = destroy;
+	t.updateTitle = updateTitle;
+	t.activateButton = activateButton;
+	t.deactivateButton = deactivateButton;
+	t.disableButton = disableButton;
+	t.enableButton = enableButton;
+	
+	
+	// locals
+	var element = $([]);
+	var tm;
+	
+
+
+	function render() {
+		tm = options.theme ? 'ui' : 'fc';
+		var sections = options.header;
+		if (sections) {
+			element = $("<table class='fc-header' style='width:100%'/>")
+				.append(
+					$("<tr/>")
+						.append(renderSection('left'))
+						.append(renderSection('center'))
+						.append(renderSection('right'))
+				);
+			return element;
+		}
+	}
+	
+	
+	function destroy() {
+		element.remove();
+	}
+	
+	
+	function renderSection(position) {
+		var e = $("<td class='fc-header-" + position + "'/>");
+		var buttonStr = options.header[position];
+		if (buttonStr) {
+			$.each(buttonStr.split(' '), function(i) {
+				if (i > 0) {
+					e.append("<span class='fc-header-space'/>");
+				}
+				var prevButton;
+				$.each(this.split(','), function(j, buttonName) {
+					if (buttonName == 'title') {
+						e.append("<span class='fc-header-title'><h2>&nbsp;</h2></span>");
+						if (prevButton) {
+							prevButton.addClass(tm + '-corner-right');
+						}
+						prevButton = null;
+					}else{
+						var buttonClick;
+						if (calendar[buttonName]) {
+							buttonClick = calendar[buttonName]; // calendar method
+						}
+						else if (fcViews[buttonName]) {
+							buttonClick = function() {
+								button.removeClass(tm + '-state-hover'); // forget why
+								calendar.changeView(buttonName);
+							};
+						}
+						if (buttonClick) {
+							var icon = options.theme ? smartProperty(options.buttonIcons, buttonName) : null;
+							var text = smartProperty(options.buttonText, buttonName);
+							var button = $(
+								"<span class='fc-button fc-button-" + buttonName + " " + tm + "-state-default'>" +
+									"<span class='fc-button-inner'>" +
+										"<span class='fc-button-content'>" +
+											(icon ?
+												"<span class='fc-icon-wrap'>" +
+													"<span class='ui-icon ui-icon-" + icon + "'/>" +
+												"</span>" :
+												text
+												) +
+										"</span>" +
+										"<span class='fc-button-effect'><span></span></span>" +
+									"</span>" +
+								"</span>"
+							);
+							if (button) {
+								button
+									.click(function() {
+										if (!button.hasClass(tm + '-state-disabled')) {
+											buttonClick();
+										}
+									})
+									.mousedown(function() {
+										button
+											.not('.' + tm + '-state-active')
+											.not('.' + tm + '-state-disabled')
+											.addClass(tm + '-state-down');
+									})
+									.mouseup(function() {
+										button.removeClass(tm + '-state-down');
+									})
+									.hover(
+										function() {
+											button
+												.not('.' + tm + '-state-active')
+												.not('.' + tm + '-state-disabled')
+												.addClass(tm + '-state-hover');
+										},
+										function() {
+											button
+												.removeClass(tm + '-state-hover')
+												.removeClass(tm + '-state-down');
+										}
+									)
+									.appendTo(e);
+								if (!prevButton) {
+									button.addClass(tm + '-corner-left');
+								}
+								prevButton = button;
+							}
+						}
+					}
+				});
+				if (prevButton) {
+					prevButton.addClass(tm + '-corner-right');
+				}
+			});
+		}
+		return e;
+	}
+	
+	
+	function updateTitle(html) {
+		element.find('h2')
+			.html(html);
+	}
+	
+	
+	function activateButton(buttonName) {
+		element.find('span.fc-button-' + buttonName)
+			.addClass(tm + '-state-active');
+	}
+	
+	
+	function deactivateButton(buttonName) {
+		element.find('span.fc-button-' + buttonName)
+			.removeClass(tm + '-state-active');
+	}
+	
+	
+	function disableButton(buttonName) {
+		element.find('span.fc-button-' + buttonName)
+			.addClass(tm + '-state-disabled');
+	}
+	
+	
+	function enableButton(buttonName) {
+		element.find('span.fc-button-' + buttonName)
+			.removeClass(tm + '-state-disabled');
+	}
+
+
+}
+
+fc.sourceNormalizers = [];
+fc.sourceFetchers = [];
+
+var ajaxDefaults = {
+	dataType: 'json',
+	cache: false
+};
+
+var eventGUID = 1;
+
+
+function EventManager(options, _sources) {
+	var t = this;
+	
+	
+	// exports
+	t.isFetchNeeded = isFetchNeeded;
+	t.fetchEvents = fetchEvents;
+	t.addEventSource = addEventSource;
+	t.removeEventSource = removeEventSource;
+	t.updateEvent = updateEvent;
+	t.renderEvent = renderEvent;
+	t.removeEvents = removeEvents;
+	t.clientEvents = clientEvents;
+	t.normalizeEvent = normalizeEvent;
+	
+	
+	// imports
+	var trigger = t.trigger;
+	var getView = t.getView;
+	var reportEvents = t.reportEvents;
+	
+	
+	// locals
+	var stickySource = { events: [] };
+	var sources = [ stickySource ];
+	var rangeStart, rangeEnd;
+	var currentFetchID = 0;
+	var pendingSourceCnt = 0;
+	var loadingLevel = 0;
+	var cache = [];
+	
+	
+	for (var i=0; i<_sources.length; i++) {
+		_addEventSource(_sources[i]);
+	}
+	
+	
+	
+	/* Fetching
+	-----------------------------------------------------------------------------*/
+	
+	
+	function isFetchNeeded(start, end) {
+		return !rangeStart || start < rangeStart || end > rangeEnd;
+	}
+	
+	
+	function fetchEvents(start, end) {
+		rangeStart = start;
+		rangeEnd = end;
+		cache = [];
+		var fetchID = ++currentFetchID;
+		var len = sources.length;
+		pendingSourceCnt = len;
+		for (var i=0; i<len; i++) {
+			fetchEventSource(sources[i], fetchID);
+		}
+	}
+	
+	
+	function fetchEventSource(source, fetchID) {
+		_fetchEventSource(source, function(events) {
+			if (fetchID == currentFetchID) {
+				if (events) {
+					for (var i=0; i<events.length; i++) {
+						events[i].source = source;
+						normalizeEvent(events[i]);
+					}
+					cache = cache.concat(events);
+				}
+				pendingSourceCnt--;
+				if (!pendingSourceCnt) {
+					reportEvents(cache);
+				}
+			}
+		});
+	}
+	
+	
+	function _fetchEventSource(source, callback) {
+		var i;
+		var fetchers = fc.sourceFetchers;
+		var res;
+		for (i=0; i<fetchers.length; i++) {
+			res = fetchers[i](source, rangeStart, rangeEnd, callback);
+			if (res === true) {
+				// the fetcher is in charge. made its own async request
+				return;
+			}
+			else if (typeof res == 'object') {
+				// the fetcher returned a new source. process it
+				_fetchEventSource(res, callback);
+				return;
+			}
+		}
+		var events = source.events;
+		if (events) {
+			if ($.isFunction(events)) {
+				pushLoading();
+				events(cloneDate(rangeStart), cloneDate(rangeEnd), function(events) {
+					callback(events);
+					popLoading();
+				});
+			}
+			else if ($.isArray(events)) {
+				callback(events);
+			}
+			else {
+				callback();
+			}
+		}else{
+			var url = source.url;
+			if (url) {
+				var success = source.success;
+				var error = source.error;
+				var complete = source.complete;
+				var data = $.extend({}, source.data || {});
+				var startParam = firstDefined(source.startParam, options.startParam);
+				var endParam = firstDefined(source.endParam, options.endParam);
+				if (startParam) {
+					data[startParam] = Math.round(+rangeStart / 1000);
+				}
+				if (endParam) {
+					data[endParam] = Math.round(+rangeEnd / 1000);
+				}
+				pushLoading();
+				$.ajax($.extend({}, ajaxDefaults, source, {
+					data: data,
+					success: function(events) {
+						events = events || [];
+						var res = applyAll(success, this, arguments);
+						if ($.isArray(res)) {
+							events = res;
+						}
+						callback(events);
+					},
+					error: function() {
+						applyAll(error, this, arguments);
+						callback();
+					},
+					complete: function() {
+						applyAll(complete, this, arguments);
+						popLoading();
+					}
+				}));
+			}else{
+				callback();
+			}
+		}
+	}
+	
+	
+	
+	/* Sources
+	-----------------------------------------------------------------------------*/
+	
+
+	function addEventSource(source) {
+		source = _addEventSource(source);
+		if (source) {
+			pendingSourceCnt++;
+			fetchEventSource(source, currentFetchID); // will eventually call reportEvents
+		}
+	}
+	
+	
+	function _addEventSource(source) {
+		if ($.isFunction(source) || $.isArray(source)) {
+			source = { events: source };
+		}
+		else if (typeof source == 'string') {
+			source = { url: source };
+		}
+		if (typeof source == 'object') {
+			normalizeSource(source);
+			sources.push(source);
+			return source;
+		}
+	}
+	
+
+	function removeEventSource(source) {
+		sources = $.grep(sources, function(src) {
+			return !isSourcesEqual(src, source);
+		});
+		// remove all client events from that source
+		cache = $.grep(cache, function(e) {
+			return !isSourcesEqual(e.source, source);
+		});
+		reportEvents(cache);
+	}
+	
+	
+	
+	/* Manipulation
+	-----------------------------------------------------------------------------*/
+	
+	
+	function updateEvent(event) { // update an existing event
+		var i, len = cache.length, e,
+			defaultEventEnd = getView().defaultEventEnd, // getView???
+			startDelta = event.start - event._start,
+			endDelta = event.end ?
+				(event.end - (event._end || defaultEventEnd(event))) // event._end would be null if event.end
+				: 0;                                                      // was null and event was just resized
+		for (i=0; i<len; i++) {
+			e = cache[i];
+			if (e._id == event._id && e != event) {
+				e.start = new Date(+e.start + startDelta);
+				if (event.end) {
+					if (e.end) {
+						e.end = new Date(+e.end + endDelta);
+					}else{
+						e.end = new Date(+defaultEventEnd(e) + endDelta);
+					}
+				}else{
+					e.end = null;
+				}
+				e.title = event.title;
+				e.url = event.url;
+				e.allDay = event.allDay;
+				e.className = event.className;
+				e.editable = event.editable;
+				e.color = event.color;
+				e.backgroudColor = event.backgroudColor;
+				e.borderColor = event.borderColor;
+				e.textColor = event.textColor;
+				normalizeEvent(e);
+			}
+		}
+		normalizeEvent(event);
+		reportEvents(cache);
+	}
+	
+	
+	function renderEvent(event, stick) {
+		normalizeEvent(event);
+		if (!event.source) {
+			if (stick) {
+				stickySource.events.push(event);
+				event.source = stickySource;
+			}
+			cache.push(event);
+		}
+		reportEvents(cache);
+	}
+	
+	
+	function removeEvents(filter) {
+		if (!filter) { // remove all
+			cache = [];
+			// clear all array sources
+			for (var i=0; i<sources.length; i++) {
+				if ($.isArray(sources[i].events)) {
+					sources[i].events = [];
+				}
+			}
+		}else{
+			if (!$.isFunction(filter)) { // an event ID
+				var id = filter + '';
+				filter = function(e) {
+					return e._id == id;
+				};
+			}
+			cache = $.grep(cache, filter, true);
+			// remove events from array sources
+			for (var i=0; i<sources.length; i++) {
+				if ($.isArray(sources[i].events)) {
+					sources[i].events = $.grep(sources[i].events, filter, true);
+				}
+			}
+		}
+		reportEvents(cache);
+	}
+	
+	
+	function clientEvents(filter) {
+		if ($.isFunction(filter)) {
+			return $.grep(cache, filter);
+		}
+		else if (filter) { // an event ID
+			filter += '';
+			return $.grep(cache, function(e) {
+				return e._id == filter;
+			});
+		}
+		return cache; // else, return all
+	}
+	
+	
+	
+	/* Loading State
+	-----------------------------------------------------------------------------*/
+	
+	
+	function pushLoading() {
+		if (!loadingLevel++) {
+			trigger('loading', null, true);
+		}
+	}
+	
+	
+	function popLoading() {
+		if (!--loadingLevel) {
+			trigger('loading', null, false);
+		}
+	}
+	
+	
+	
+	/* Event Normalization
+	-----------------------------------------------------------------------------*/
+	
+	
+	function normalizeEvent(event) {
+		var source = event.source || {};
+		var ignoreTimezone = firstDefined(source.ignoreTimezone, options.ignoreTimezone);
+		event._id = event._id || (event.id === undefined ? '_fc' + eventGUID++ : event.id + '');
+		if (event.date) {
+			if (!event.start) {
+				event.start = event.date;
+			}
+			delete event.date;
+		}
+		event._start = cloneDate(event.start = parseDate(event.start, ignoreTimezone));
+		event.end = parseDate(event.end, ignoreTimezone);
+		if (event.end && event.end <= event.start) {
+			event.end = null;
+		}
+		event._end = event.end ? cloneDate(event.end) : null;
+		if (event.allDay === undefined) {
+			event.allDay = firstDefined(source.allDayDefault, options.allDayDefault);
+		}
+		if (event.className) {
+			if (typeof event.className == 'string') {
+				event.className = event.className.split(/\s+/);
+			}
+		}else{
+			event.className = [];
+		}
+		// TODO: if there is no start date, return false to indicate an invalid event
+	}
+	
+	
+	
+	/* Utils
+	------------------------------------------------------------------------------*/
+	
+	
+	function normalizeSource(source) {
+		if (source.className) {
+			// TODO: repeat code, same code for event classNames
+			if (typeof source.className == 'string') {
+				source.className = source.className.split(/\s+/);
+			}
+		}else{
+			source.className = [];
+		}
+		var normalizers = fc.sourceNormalizers;
+		for (var i=0; i<normalizers.length; i++) {
+			normalizers[i](source);
+		}
+	}
+	
+	
+	function isSourcesEqual(source1, source2) {
+		return source1 && source2 && getSourcePrimitive(source1) == getSourcePrimitive(source2);
+	}
+	
+	
+	function getSourcePrimitive(source) {
+		return ((typeof source == 'object') ? (source.events || source.url) : '') || source;
+	}
+
+
+}
+
+
+fc.addDays = addDays;
+fc.cloneDate = cloneDate;
+fc.parseDate = parseDate;
+fc.parseISO8601 = parseISO8601;
+fc.parseTime = parseTime;
+fc.formatDate = formatDate;
+fc.formatDates = formatDates;
+
+
+
+/* Date Math
+-----------------------------------------------------------------------------*/
+
+var dayIDs = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'],
+	DAY_MS = 86400000,
+	HOUR_MS = 3600000,
+	MINUTE_MS = 60000;
+	
+
+function addYears(d, n, keepTime) {
+	d.setFullYear(d.getFullYear() + n);
+	if (!keepTime) {
+		clearTime(d);
+	}
+	return d;
+}
+
+
+function addMonths(d, n, keepTime) { // prevents day overflow/underflow
+	if (+d) { // prevent infinite looping on invalid dates
+		var m = d.getMonth() + n,
+			check = cloneDate(d);
+		check.setDate(1);
+		check.setMonth(m);
+		d.setMonth(m);
+		if (!keepTime) {
+			clearTime(d);
+		}
+		while (d.getMonth() != check.getMonth()) {
+			d.setDate(d.getDate() + (d < check ? 1 : -1));
+		}
+	}
+	return d;
+}
+
+
+function addDays(d, n, keepTime) { // deals with daylight savings
+	if (+d) {
+		var dd = d.getDate() + n,
+			check = cloneDate(d);
+		check.setHours(9); // set to middle of day
+		check.setDate(dd);
+		d.setDate(dd);
+		if (!keepTime) {
+			clearTime(d);
+		}
+		fixDate(d, check);
+	}
+	return d;
+}
+
+
+function fixDate(d, check) { // force d to be on check's YMD, for daylight savings purposes
+	if (+d) { // prevent infinite looping on invalid dates
+		while (d.getDate() != check.getDate()) {
+			d.setTime(+d + (d < check ? 1 : -1) * HOUR_MS);
+		}
+	}
+}
+
+
+function addMinutes(d, n) {
+	d.setMinutes(d.getMinutes() + n);
+	return d;
+}
+
+
+function clearTime(d) {
+	d.setHours(0);
+	d.setMinutes(0);
+	d.setSeconds(0); 
+	d.setMilliseconds(0);
+	return d;
+}
+
+
+function cloneDate(d, dontKeepTime) {
+	if (dontKeepTime) {
+		return clearTime(new Date(+d));
+	}
+	return new Date(+d);
+}
+
+
+function zeroDate() { // returns a Date with time 00:00:00 and dateOfMonth=1
+	var i=0, d;
+	do {
+		d = new Date(1970, i++, 1);
+	} while (d.getHours()); // != 0
+	return d;
+}
+
+
+function skipWeekend(date, inc, excl) {
+	inc = inc || 1;
+	while (!date.getDay() || (excl && date.getDay()==1 || !excl && date.getDay()==6)) {
+		addDays(date, inc);
+	}
+	return date;
+}
+
+
+function dayDiff(d1, d2) { // d1 - d2
+	return Math.round((cloneDate(d1, true) - cloneDate(d2, true)) / DAY_MS);
+}
+
+
+function setYMD(date, y, m, d) {
+	if (y !== undefined && y != date.getFullYear()) {
+		date.setDate(1);
+		date.setMonth(0);
+		date.setFullYear(y);
+	}
+	if (m !== undefined && m != date.getMonth()) {
+		date.setDate(1);
+		date.setMonth(m);
+	}
+	if (d !== undefined) {
+		date.setDate(d);
+	}
+}
+
+
+
+/* Date Parsing
+-----------------------------------------------------------------------------*/
+
+
+function parseDate(s, ignoreTimezone) { // ignoreTimezone defaults to true
+	if (typeof s == 'object') { // already a Date object
+		return s;
+	}
+	if (typeof s == 'number') { // a UNIX timestamp
+		return new Date(s * 1000);
+	}
+	if (typeof s == 'string') {
+		if (s.match(/^\d+$/)) { // a UNIX timestamp
+			return new Date(parseInt(s, 10) * 1000);
+		}
+		if (ignoreTimezone === undefined) {
+			ignoreTimezone = true;
+		}
+		return parseISO8601(s, ignoreTimezone) || (s ? new Date(s) : null);
+	}
+	// TODO: never return invalid dates (like from new Date(<string>)), return null instead
+	return null;
+}
+
+
+function parseISO8601(s, ignoreTimezone) { // ignoreTimezone defaults to false
+	// derived from http://delete.me.uk/2005/03/iso8601.html
+	// TODO: for a know glitch/feature, read tests/issue_206_parseDate_dst.html
+	var m = s.match(/^([0-9]{4})(-([0-9]{2})(-([0-9]{2})([T ]([0-9]{2}):([0-9]{2})(:([0-9]{2})(\.([0-9]+))?)?(Z|(([-+])([0-9]{2}):([0-9]{2})))?)?)?)?$/);
+	if (!m) {
+		return null;
+	}
+	var date = new Date(m[1], 0, 1);
+	if (ignoreTimezone || !m[14]) {
+		var check = new Date(m[1], 0, 1, 9, 0);
+		if (m[3]) {
+			date.setMonth(m[3] - 1);
+			check.setMonth(m[3] - 1);
+		}
+		if (m[5]) {
+			date.setDate(m[5]);
+			check.setDate(m[5]);
+		}
+		fixDate(date, check);
+		if (m[7]) {
+			date.setHours(m[7]);
+		}
+		if (m[8]) {
+			date.setMinutes(m[8]);
+		}
+		if (m[10]) {
+			date.setSeconds(m[10]);
+		}
+		if (m[12]) {
+			date.setMilliseconds(Number("0." + m[12]) * 1000);
+		}
+		fixDate(date, check);
+	}else{
+		date.setUTCFullYear(
+			m[1],
+			m[3] ? m[3] - 1 : 0,
+			m[5] || 1
+		);
+		date.setUTCHours(
+			m[7] || 0,
+			m[8] || 0,
+			m[10] || 0,
+			m[12] ? Number("0." + m[12]) * 1000 : 0
+		);
+		var offset = Number(m[16]) * 60 + Number(m[17]);
+		offset *= m[15] == '-' ? 1 : -1;
+		date = new Date(+date + (offset * 60 * 1000));
+	}
+	return date;
+}
+
+
+function parseTime(s) { // returns minutes since start of day
+	if (typeof s == 'number') { // an hour
+		return s * 60;
+	}
+	if (typeof s == 'object') { // a Date object
+		return s.getHours() * 60 + s.getMinutes();
+	}
+	var m = s.match(/(\d+)(?::(\d+))?\s*(\w+)?/);
+	if (m) {
+		var h = parseInt(m[1], 10);
+		if (m[3]) {
+			h %= 12;
+			if (m[3].toLowerCase().charAt(0) == 'p') {
+				h += 12;
+			}
+		}
+		return h * 60 + (m[2] ? parseInt(m[2], 10) : 0);
+	}
+}
+
+
+
+/* Date Formatting
+-----------------------------------------------------------------------------*/
+// TODO: use same function formatDate(date, [date2], format, [options])
+
+
+function formatDate(date, format, options) {
+	return formatDates(date, null, format, options);
+}
+
+
+function formatDates(date1, date2, format, options) {
+	options = options || defaults;
+	var date = date1,
+		otherDate = date2,
+		i, len = format.length, c,
+		i2, formatter,
+		res = '';
+	for (i=0; i<len; i++) {
+		c = format.charAt(i);
+		if (c == "'") {
+			for (i2=i+1; i2<len; i2++) {
+				if (format.charAt(i2) == "'") {
+					if (date) {
+						if (i2 == i+1) {
+							res += "'";
+						}else{
+							res += format.substring(i+1, i2);
+						}
+						i = i2;
+					}
+					break;
+				}
+			}
+		}
+		else if (c == '(') {
+			for (i2=i+1; i2<len; i2++) {
+				if (format.charAt(i2) == ')') {
+					var subres = formatDate(date, format.substring(i+1, i2), options);
+					if (parseInt(subres.replace(/\D/, ''), 10)) {
+						res += subres;
+					}
+					i = i2;
+					break;
+				}
+			}
+		}
+		else if (c == '[') {
+			for (i2=i+1; i2<len; i2++) {
+				if (format.charAt(i2) == ']') {
+					var subformat = format.substring(i+1, i2);
+					var subres = formatDate(date, subformat, options);
+					if (subres != formatDate(otherDate, subformat, options)) {
+						res += subres;
+					}
+					i = i2;
+					break;
+				}
+			}
+		}
+		else if (c == '{') {
+			date = date2;
+			otherDate = date1;
+		}
+		else if (c == '}') {
+			date = date1;
+			otherDate = date2;
+		}
+		else {
+			for (i2=len; i2>i; i2--) {
+				if (formatter = dateFormatters[format.substring(i, i2)]) {
+					if (date) {
+						res += formatter(date, options);
+					}
+					i = i2 - 1;
+					break;
+				}
+			}
+			if (i2 == i) {
+				if (date) {
+					res += c;
+				}
+			}
+		}
+	}
+	return res;
+};
+
+
+var dateFormatters = {
+	s	: function(d)	{ return d.getSeconds() },
+	ss	: function(d)	{ return zeroPad(d.getSeconds()) },
+	m	: function(d)	{ return d.getMinutes() },
+	mm	: function(d)	{ return zeroPad(d.getMinutes()) },
+	h	: function(d)	{ return d.getHours() % 12 || 12 },
+	hh	: function(d)	{ return zeroPad(d.getHours() % 12 || 12) },
+	H	: function(d)	{ return d.getHours() },
+	HH	: function(d)	{ return zeroPad(d.getHours()) },
+	d	: function(d)	{ return d.getDate() },
+	dd	: function(d)	{ return zeroPad(d.getDate()) },
+	ddd	: function(d,o)	{ return o.dayNamesShort[d.getDay()] },
+	e   : function(d,o)	{ return o.dayNamesShortest[d.getDay()] }, //add by Kebin ----> 5
+	dddd: function(d,o)	{ return o.dayNames[d.getDay()] },
+	M	: function(d)	{ return d.getMonth() + 1 },
+	MM	: function(d)	{ return zeroPad(d.getMonth() + 1) },
+	MMM	: function(d,o)	{ return o.monthNamesShort[d.getMonth()] },
+	MMMM: function(d,o)	{ return o.monthNames[d.getMonth()] },
+	yy	: function(d)	{ return (d.getFullYear()+'').substring(2) },
+	yyyy: function(d)	{ return d.getFullYear() },
+	t	: function(d)	{ return d.getHours() < 12 ? 'a' : 'p' },
+	tt	: function(d)	{ return d.getHours() < 12 ? 'am' : 'pm' },
+	T	: function(d)	{ return d.getHours() < 12 ? 'A' : 'P' },
+	TT	: function(d)	{ return d.getHours() < 12 ? 'AM' : 'PM' },
+	u	: function(d)	{ return formatDate(d, "yyyy-MM-dd'T'HH:mm:ss'Z'") },
+	S	: function(d)	{
+		var date = d.getDate();
+		if (date > 10 && date < 20) {
+			return 'th';
+		}
+		return ['st', 'nd', 'rd'][date%10-1] || 'th';
+	}
+};
+
+
+
+fc.applyAll = applyAll;
+
+
+/* Event Date Math
+-----------------------------------------------------------------------------*/
+
+
+function exclEndDay(event) {
+	if (event.end) {
+		return _exclEndDay(event.end, event.allDay);
+	}else{
+		return addDays(cloneDate(event.start), 1);
+	}
+}
+
+
+function _exclEndDay(end, allDay) {
+	end = cloneDate(end);
+	return allDay || end.getHours() || end.getMinutes() ? addDays(end, 1) : clearTime(end);
+}
+
+
+function segCmp(a, b) {
+	return (b.msLength - a.msLength) * 100 + (a.event.start - b.event.start);
+}
+
+
+function segsCollide(seg1, seg2) {
+	return seg1.end > seg2.start && seg1.start < seg2.end;
+}
+
+
+
+/* Event Sorting
+-----------------------------------------------------------------------------*/
+
+
+// event rendering utilities
+function sliceSegs(events, visEventEnds, start, end) {
+	var segs = [],
+		i, len=events.length, event,
+		eventStart, eventEnd,
+		segStart, segEnd,
+		isStart, isEnd;
+	for (i=0; i<len; i++) {
+		event = events[i];
+		eventStart = event.start;
+		eventEnd = visEventEnds[i];
+		if (eventEnd > start && eventStart < end) {
+			if (eventStart < start) {
+				segStart = cloneDate(start);
+				isStart = false;
+			}else{
+				segStart = eventStart;
+				isStart = true;
+			}
+			if (eventEnd > end) {
+				segEnd = cloneDate(end);
+				isEnd = false;
+			}else{
+				segEnd = eventEnd;
+				isEnd = true;
+			}
+			segs.push({
+				event: event,
+				start: segStart,
+				end: segEnd,
+				isStart: isStart,
+				isEnd: isEnd,
+				msLength: segEnd - segStart
+			});
+		}
+	} 
+	return segs.sort(segCmp);
+}
+
+
+// event rendering calculation utilities
+function stackSegs(segs) {
+	var levels = [],
+		i, len = segs.length, seg,
+		j, collide, k;
+	for (i=0; i<len; i++) {
+		seg = segs[i];
+		j = 0; // the level index where seg should belong
+		while (true) {
+			collide = false;
+			if (levels[j]) {
+				for (k=0; k<levels[j].length; k++) {
+					if (segsCollide(levels[j][k], seg)) {
+						collide = true;
+						break;
+					}
+				}
+			}
+			if (collide) {
+				j++;
+			}else{
+				break;
+			}
+		}
+		if (levels[j]) {
+			levels[j].push(seg);
+		}else{
+			levels[j] = [seg];
+		}
+	}
+	return levels;
+}
+
+
+
+/* Event Element Binding
+-----------------------------------------------------------------------------*/
+
+
+function lazySegBind(container, segs, bindHandlers) {
+	container.unbind('mouseover').mouseover(function(ev) {
+		var parent=ev.target, e,
+			i, seg;
+		while (parent != this) {
+			e = parent;
+			parent = parent.parentNode;
+		}
+		if ((i = e._fci) !== undefined) {
+			e._fci = undefined;
+			seg = segs[i];
+			bindHandlers(seg.event, seg.element, seg);
+			$(ev.target).trigger(ev);
+		}
+		ev.stopPropagation();
+	});
+}
+
+
+
+/* Element Dimensions
+-----------------------------------------------------------------------------*/
+
+
+function setOuterWidth(element, width, includeMargins) {
+	for (var i=0, e; i<element.length; i++) {
+		e = $(element[i]);
+		e.width(Math.max(0, width - hsides(e, includeMargins)));
+	}
+}
+
+
+function setOuterHeight(element, height, includeMargins) {
+	for (var i=0, e; i<element.length; i++) {
+		e = $(element[i]);
+		e.height(Math.max(0, height - vsides(e, includeMargins)));
+	}
+}
+
+
+// TODO: curCSS has been deprecated (jQuery 1.4.3 - 10/16/2010)
+
+
+function hsides(element, includeMargins) {
+	return hpadding(element) + hborders(element) + (includeMargins ? hmargins(element) : 0);
+}
+
+
+function hpadding(element) {
+	return (parseFloat($.curCSS(element[0], 'paddingLeft', true)) || 0) +
+	       (parseFloat($.curCSS(element[0], 'paddingRight', true)) || 0);
+}
+
+
+function hmargins(element) {
+	return (parseFloat($.curCSS(element[0], 'marginLeft', true)) || 0) +
+	       (parseFloat($.curCSS(element[0], 'marginRight', true)) || 0);
+}
+
+
+function hborders(element) {
+	return (parseFloat($.curCSS(element[0], 'borderLeftWidth', true)) || 0) +
+	       (parseFloat($.curCSS(element[0], 'borderRightWidth', true)) || 0);
+}
+
+
+function vsides(element, includeMargins) {
+	return vpadding(element) +  vborders(element) + (includeMargins ? vmargins(element) : 0);
+}
+
+
+function vpadding(element) {
+	return (parseFloat($.curCSS(element[0], 'paddingTop', true)) || 0) +
+	       (parseFloat($.curCSS(element[0], 'paddingBottom', true)) || 0);
+}
+
+
+function vmargins(element) {
+	return (parseFloat($.curCSS(element[0], 'marginTop', true)) || 0) +
+	       (parseFloat($.curCSS(element[0], 'marginBottom', true)) || 0);
+}
+
+
+function vborders(element) {
+	return (parseFloat($.curCSS(element[0], 'borderTopWidth', true)) || 0) +
+	       (parseFloat($.curCSS(element[0], 'borderBottomWidth', true)) || 0);
+}
+
+
+function setMinHeight(element, height) {
+	height = (typeof height == 'number' ? height + 'px' : height);
+	element.each(function(i, _element) {
+		_element.style.cssText += ';min-height:' + height + ';_height:' + height;
+		// why can't we just use .css() ? i forget
+	});
+}
+
+
+
+/* Misc Utils
+-----------------------------------------------------------------------------*/
+
+
+//TODO: arraySlice
+//TODO: isFunction, grep ?
+
+
+function noop() { }
+
+
+function cmp(a, b) {
+	return a - b;
+}
+
+
+function arrayMax(a) {
+	return Math.max.apply(Math, a);
+}
+
+
+function zeroPad(n) {
+	return (n < 10 ? '0' : '') + n;
+}
+
+
+function smartProperty(obj, name) { // get a camel-cased/namespaced property of an object
+	if (obj[name] !== undefined) {
+		return obj[name];
+	}
+	var parts = name.split(/(?=[A-Z])/),
+		i=parts.length-1, res;
+	for (; i>=0; i--) {
+		res = obj[parts[i].toLowerCase()];
+		if (res !== undefined) {
+			return res;
+		}
+	}
+	return obj[''];
+}
+
+
+function htmlEscape(s) {
+	return s.replace(/&/g, '&amp;')
+		.replace(/</g, '&lt;')
+		.replace(/>/g, '&gt;')
+		.replace(/'/g, '&#039;')
+		.replace(/"/g, '&quot;')
+		.replace(/\n/g, '<br />');
+}
+
+
+function cssKey(_element) {
+	return _element.id + '/' + _element.className + '/' + _element.style.cssText.replace(/(^|;)\s*(top|left|width|height)\s*:[^;]*/ig, '');
+}
+
+
+function disableTextSelection(element) {
+	element
+		.attr('unselectable', 'on')
+		.css('MozUserSelect', 'none')
+		.bind('selectstart.ui', function() { return false; });
+}
+
+
+/*
+function enableTextSelection(element) {
+	element
+		.attr('unselectable', 'off')
+		.css('MozUserSelect', '')
+		.unbind('selectstart.ui');
+}
+*/
+
+
+function markFirstLast(e) {
+	e.children()
+		.removeClass('fc-first fc-last')
+		.filter(':first-child')
+			.addClass('fc-first')
+		.end()
+		.filter(':last-child')
+			.addClass('fc-last');
+}
+
+
+function setDayID(cell, date) {
+	cell.each(function(i, _cell) {
+		_cell.className = _cell.className.replace(/^fc-\w*/, 'fc-' + dayIDs[date.getDay()]);
+		// TODO: make a way that doesn't rely on order of classes
+	});
+}
+
+
+function getSkinCss(event, opt) {
+	var source = event.source || {};
+	var eventColor = event.color;
+	var sourceColor = source.color;
+	var optionColor = opt('eventColor');
+	var backgroundColor =
+		event.backgroundColor ||
+		eventColor ||
+		source.backgroundColor ||
+		sourceColor ||
+		opt('eventBackgroundColor') ||
+		optionColor;
+	var borderColor =
+		event.borderColor ||
+		eventColor ||
+		source.borderColor ||
+		sourceColor ||
+		opt('eventBorderColor') ||
+		optionColor;
+	var textColor =
+		event.textColor ||
+		source.textColor ||
+		opt('eventTextColor');
+	var statements = [];
+	if (backgroundColor) {
+		statements.push('background-color:' + backgroundColor);
+	}
+	if (borderColor) {
+		statements.push('border-color:' + borderColor);
+	}
+	if (textColor) {
+		statements.push('color:' + textColor);
+	}
+	return statements.join(';');
+}
+
+
+function applyAll(functions, thisObj, args) {
+	if ($.isFunction(functions)) {
+		functions = [ functions ];
+	}
+	if (functions) {
+		var i;
+		var ret;
+		for (i=0; i<functions.length; i++) {
+			ret = functions[i].apply(thisObj, args) || ret;
+		}
+		return ret;
+	}
+}
+
+
+function firstDefined() {
+	for (var i=0; i<arguments.length; i++) {
+		if (arguments[i] !== undefined) {
+			return arguments[i];
+		}
+	}
+}
+
+//Year View Start ----------------------------------------------------------------------------------
+//add by kebin --> 6
+fcViews.year = YearView;
+
+function YearView(element, calendar) {
+	var t = this;
+	// exports
+	t.render = render;
+	
+	// imports
+	BasicYearView.call(t, element, calendar, 'year');
+	var opt = t.opt;
+	var renderYear = t.renderYear;
+	var formatDate = calendar.formatDate;
+	
+	function render(date, delta) {
+		if (delta) {
+			t.curYear = addYears(date, delta);
+		}
+		var start = cloneDate(date, true);		
+		//start.setDate(1);
+		start.setFullYear(start.getFullYear(),0,1);
+		var end = cloneDate(date);
+		end.setFullYear(end.getFullYear(), 11,31);
+		
+		var visStart = cloneDate(start); //set startDay
+		var visEnd = cloneDate(end);
+		var nwe = opt('weekends') ? 0 : 1;
+		colAndRow = '4x3'; //'2x6', '3x4', '4x3' 3 types
+		t.title = formatDate(start, opt('titleFormat'));
+		t.start = start;
+		t.end = end;
+		t.visStart = visStart;
+		t.visEnd = visEnd;
+		renderYear(colAndRow, 6, nwe ? 5 : 7, true);
+	}
+}
+
+function BasicYearView(element, calendar, viewName) {
+	var t = this;
+	
+	// exports
+	t.renderYear = renderYear;
+	t.setHeight = setHeight;
+	t.setWidth = setWidth;
+	t.renderDayOverlay = renderDayOverlay;
+	t.defaultSelectionEnd = defaultSelectionEnd;
+	t.renderSelection = renderSelection;
+	t.clearSelection = clearSelection;
+	t.reportDayClick = reportDayClick; // for selection (kinda hacky)
+	t.dragStart = dragStart;
+	t.dragStop = dragStop;
+	t.defaultEventEnd = defaultEventEnd;
+	t.getHoverListener = function() { return hoverListener };
+	t.colContentLeft = colContentLeft;
+	t.colContentRight = colContentRight;
+	t.dayOfWeekCol = dayOfWeekCol;
+	t.dateCell = dateCell;
+	t.cellDate = cellDate;
+	t.cellIsAllDay = function() { return true };
+	t.allDayRow = allDayRow;
+	t.allDayBounds = allDayBounds;
+	t.getRowCnt = function() {return rowCnt };
+	t.getColCnt = function() { return colCnt };
+	t.getColWidth = function() { return colWidth };
+	t.getBodyRows = function(){return bodyRows};
+	t.getDaySegmentContainer = function() { return daySegmentContainer };
+	
+	
+	// imports
+	View.call(t, element, calendar, viewName);
+	OverlayManager.call(t);
+	SelectionManager.call(t);
+	BasicYearEventRenderer.call(t);
+	var opt = t.opt;
+	var trigger = t.trigger;
+	var clearEvents = t.clearEvents;
+	var renderOverlay = t.renderOverlay;
+	var clearOverlays = t.clearOverlays;
+	var daySelectionMousedown = t.daySelectionMousedown;
+	var formatDate = calendar.formatDate;
+	
+	
+	// locals
+	var table;
+	//var head;
+	//var headCells;
+	var body;
+	var bodyRows;
+	
+	var mainBody;
+	var subTables;
+	
+	var bodyCells;
+	//var bodyFirstCells;
+	//var bodyCellTopInners;
+	var daySegmentContainer;
+	
+	var viewWidth;
+	var viewHeight;
+	var colWidth;
+	
+	var rowCnt, colCnt;
+	var coordinateGrid;
+	var hoverListener;
+	var colContentPositions;
+	
+	var rtl, dis, dit;
+	var firstDay;
+	var nwe;
+	var tm;
+	var colFormat;
+	
+	
+	
+	/* Rendering
+	------------------------------------------------------------*/
+	
+	
+	disableTextSelection(element.addClass('fc-grid'));
+	
+	
+	function renderYear(maxr, r, c, showNumbers) {
+		rowCnt = r;
+		colCnt = c;
+		updateOptions();
+		var firstTime = !table;
+		if (firstTime) {
+			buildSkeleton(maxr, showNumbers);
+		}else{
+			clearEvents();
+		}
+			updateCells(firstTime);
+	}
+	
+	
+	
+	function updateOptions() {
+		rtl = opt('isRTL');
+		if (rtl) {
+			dis = -1;
+			dit = colCnt - 1;
+		}else{
+			dis = 1;
+			dit = 0;
+		}
+		firstDay = opt('firstDay');
+		nwe = opt('weekends') ? 0 : 1;
+		tm = opt('theme') ? 'ui' : 'fc';
+		colFormat = opt('columnFormat');
+	}
+	
+	
+	
+	function buildSkeleton(maxRowCnt, showNumbers) {
+		var s;
+		var headerClass = tm + "-widget-header";
+		var contentClass = tm + "-widget-content";
+		var i, j;
+		var dayStr;
+		var di = cloneDate(t.start);
+		
+		s ="<table class='fc-border-separate fc-year-main-table' style='width:100%'><tr >";
+		for(var mi=0; mi<12; mi++){
+			di.setFullYear(di.getFullYear(),mi,1);
+			di.setFullYear(di.getFullYear(),mi,1-di.getDay());
+			if(mi%4==0 && mi > 0) s+="</tr><tr>";
+			
+			s +="<td class='fc-year-monthly-td'>";
+			s+="<table class='fc-border-separate' style='width:100%' cellspacing='0'>"+
+				"<thead>"+
+				"<tr><th colspan='7' class='fc-year-monthly-header' >"+opt('monthNames', mi)+"</th></tr>"+ // !k
+				"<tr>";
+		for (i=0; i<colCnt; i++) {
+			s +="<th class='fc-year-month-weekly-head'>"+ opt('dayNamesShortest', i) +"</th>"; // need fc- for setDayID
+		}
+		s +="</tr>" +
+			"</thead>" +
+			"<tbody>";
+		for (i=0; i<6; i++) {
+			s +="<tr class='fc-week" + i + "'>";
+			for (j=0; j<colCnt; j++) {
+				if(di.getMonth()== mi){
+					dayStr=formatDate(di, '-yyyy-MM-dd');
+				}else{
+					dayStr="";
+				}
+				s +="<td class='fc- " + contentClass + " fc-day" + dayStr + "'>" + // need fc- for setDayID
+					"<div>" +
+					(showNumbers ?
+						"<div class='fc-day-number'/>" :
+						''
+						) +
+					"<div class='fc-day-content'>" +
+					"</div>" +
+					"</div>" +
+					"</td>";
+				addDays(di, 1);	
+			}
+			s +="</tr>";
+			
+		}
+		s +="</tbody>" +
+			"</table>";
+		s+="</td>";
+		}
+		s+="</tr></table>";
+		table = $(s).appendTo(element);
+		//head = table.find('thead');
+		//headCells = head.find('th');
+		//mainBody = table.find('tbody table');
+		subTables = table.find('table');
+		//subTables.each( function(x, _sub){
+		//   });
+		
+		
+		bodyRows = table.find('table tr td');
+		//bodyCells = body.find('td');
+		//bodyFirstCells = bodyCells.filter(':first-child');
+		//bodyCellTopInners = bodyRows.eq(0).find('div.fc-day-content div');
+		
+		//markFirstLast(head.add(head.find('tr'))); // marks first+last tr/th's
+		//markFirstLast(bodyRows); // marks first+last td's
+		//bodyRows.eq(0).addClass('fc-first'); // fc-last is done in updateCells
+		
+		//dayBind(bodyCells);
+		daySegmentContainer =$("<div style='position:absolute;z-index:8;top:0;left:0'/>").appendTo(element);
+	}
+	
+	
+	
+	function updateCells(firstTime) {
+		var startYear = t.start.getFullYear();
+		var today = clearTime(new Date());
+		var cell;
+		var date;
+		var row;
+		subTables.each(function(i, _sub){
+		var d = cloneDate(t.start);
+		
+		if ( !t.curYear ) t.curYear = t.start;
+		var d = cloneDate(t.curYear);
+		
+		d.setFullYear(d.getFullYear(),i,1);
+		d.setFullYear(d.getFullYear(),i,1-d.getDay());
+		$(_sub).find('td').each(function(ii, _cell) {
+			
+			var dayStr;
+			cell = $(_cell);
+			if (d.getMonth() == i) {
+				cell.removeClass('fc-other-month');
+				dayStr=formatDate(d, '-yyyy-MM-dd');
+			}else{
+				cell.addClass('fc-other-month');
+				dayStr="";
+			}
+			if (+d == +today && d.getMonth() == i) {
+				cell.addClass(tm + '-state-highlight fc-today');
+			}else{
+				cell.removeClass(tm + '-state-highlight fc-today');
+			}
+			var $div = cell.find('div.fc-day-number');
+ 			$div.text(d.getDate()); 
+ 			$div.parent().parent().attr('class', "fc-widget-content fc-day" + dayStr);
+			addDays(d, 1);
+		});
+		});
+		bodyRows.filter('.fc-year-have-event').removeClass('fc-year-have-event');
+	}
+	
+	
+	
+	function setHeight(height) {
+		/*
+		viewHeight = height;
+		
+		var bodyHeight = viewHeight - head.height();
+		var rowHeight;
+		var rowHeightLast;
+		var cell;
+			
+		if (opt('weekMode') == 'variable') {
+			rowHeight = rowHeightLast = Math.floor(bodyHeight / (rowCnt==1 ? 2 : 6));
+		}else{
+			rowHeight = Math.floor(bodyHeight / rowCnt);
+			rowHeightLast = bodyHeight - rowHeight * (rowCnt-1);
+		}
+		
+		bodyFirstCells.each(function(i, _cell) {
+			if (i < rowCnt) {
+				cell = $(_cell);
+				setMinHeight(
+					cell.find('> div'),
+					(i==rowCnt-1 ? rowHeightLast : rowHeight) - vsides(cell)
+				);
+			}
+		});
+		*/
+	}
+	
+	
+	function setWidth(width) {
+		/*
+		viewWidth = width;
+		colContentPositions.clear();
+		colWidth = Math.floor(viewWidth / colCnt);
+		setOuterWidth(headCells.slice(0, -1), colWidth);
+		*/
+	}
+	
+	
+	
+	/* Day clicking and binding
+	-----------------------------------------------------------*/
+	
+	
+	function dayBind(days) {
+		days.click(dayClick).mousedown(daySelectionMousedown);
+	}
+	
+	
+	function dayClick(ev) {
+		if (!opt('selectable')) { // if selectable, SelectionManager will worry about dayClick
+			var index = parseInt(this.className.match(/fc\-day(\d+)/)[1]); // TODO: maybe use .data
+			var date = indexDate(index);
+			trigger('dayClick', this, date, true, ev);
+		}
+	}
+	
+	
+	
+	/* Semi-transparent Overlay Helpers
+	------------------------------------------------------*/
+	
+	
+	function renderDayOverlay(overlayStart, overlayEnd, refreshCoordinateGrid) { // overlayEnd is exclusive
+		if (refreshCoordinateGrid) {
+			coordinateGrid.build();
+		}
+		var rowStart = cloneDate(t.visStart);
+		var rowEnd = addDays(cloneDate(rowStart), colCnt);
+		for (var i=0; i<rowCnt; i++) {
+			var stretchStart = new Date(Math.max(rowStart, overlayStart));
+			var stretchEnd = new Date(Math.min(rowEnd, overlayEnd));
+			if (stretchStart < stretchEnd) {
+				var colStart, colEnd;
+				if (rtl) {
+					colStart = dayDiff(stretchEnd, rowStart)*dis+dit+1;
+					colEnd = dayDiff(stretchStart, rowStart)*dis+dit+1;
+				}else{
+					colStart = dayDiff(stretchStart, rowStart);
+					colEnd = dayDiff(stretchEnd, rowStart);
+				}
+				dayBind(
+					renderCellOverlay(i, colStart, i, colEnd-1)
+				);
+			}
+			addDays(rowStart, 7);
+			addDays(rowEnd, 7);
+		}
+	}
+	
+	
+	function renderCellOverlay(row0, col0, row1, col1) { // row1,col1 is inclusive
+		var rect = coordinateGrid.rect(row0, col0, row1, col1, element);
+		return renderOverlay(rect, element);
+	}
+	
+	
+	/* Selection
+	-----------------------------------------------------------------------*/
+	
+	
+	function defaultSelectionEnd(startDate, allDay) {
+		return cloneDate(startDate);
+	}
+	
+	
+	function renderSelection(startDate, endDate, allDay) {
+		renderDayOverlay(startDate, addDays(cloneDate(endDate), 1), true); // rebuild every time???
+	}
+	
+	
+	function clearSelection() {
+		clearOverlays();
+	}
+	
+	
+	function reportDayClick(date, allDay, ev) {
+		var cell = dateCell(date);
+		var _element = bodyCells[cell.row*colCnt + cell.col];
+		trigger('dayClick', _element, date, allDay, ev);
+	}
+	
+	
+	
+	/* External Dragging
+	-----------------------------------------------------------------------*/
+	
+	
+	function dragStart(_dragElement, ev, ui) {
+		hoverListener.start(function(cell) {
+			clearOverlays();
+			if (cell) {
+				renderCellOverlay(cell.row, cell.col, cell.row, cell.col);
+			}
+		}, ev);
+	}
+	
+	
+	function dragStop(_dragElement, ev, ui) {
+		var cell = hoverListener.stop();
+		clearOverlays();
+		if (cell) {
+			var d = cellDate(cell);
+			trigger('drop', _dragElement, d, true, ev, ui);
+		}
+	}
+	
+	
+	
+	/* Utilities
+	--------------------------------------------------------*/
+	
+	
+	function defaultEventEnd(event) {
+		return cloneDate(event.start);
+	}
+	
+	
+	coordinateGrid = new CoordinateGrid(function(rows, cols) {
+		var e, n, p;
+		headCells.each(function(i, _e) {
+			e = $(_e);
+			n = e.offset().left;
+			if (i) {
+				p[1] = n;
+			}
+			p = [n];
+			cols[i] = p;
+		});
+		p[1] = n + e.outerWidth();
+		bodyRows.each(function(i, _e) {
+			if (i < rowCnt) {
+				e = $(_e);
+				n = e.offset().top;
+				if (i) {
+					p[1] = n;
+				}
+				p = [n];
+				rows[i] = p;
+			}
+		});
+		p[1] = n + e.outerHeight();
+	});
+	
+	
+	hoverListener = new HoverListener(coordinateGrid);
+	
+	
+	colContentPositions = new HorizontalPositionCache(function(col) {
+		return bodyCellTopInners.eq(col);
+	});
+	
+	
+	function colContentLeft(col) {
+		return colContentPositions.left(col);
+	}
+	
+	
+	function colContentRight(col) {
+		return colContentPositions.right(col);
+	}
+	
+	
+	
+	
+	function dateCell(date) {
+		return {
+			row: Math.floor(dayDiff(date, t.visStart) / 7),
+			col: dayOfWeekCol(date.getDay())
+		};
+	}
+	
+	
+	function cellDate(cell) {
+		return _cellDate(cell.row, cell.col);
+	}
+	
+	
+	function _cellDate(row, col) {
+		return addDays(cloneDate(t.visStart), row*7 + col*dis+dit);
+		// what about weekends in middle of week?
+	}
+	
+	
+	function indexDate(index) {
+		return _cellDate(Math.floor(index/colCnt), index%colCnt);
+	}
+	
+	
+	function dayOfWeekCol(dayOfWeek) {
+		return ((dayOfWeek - Math.max(firstDay, nwe) + colCnt) % colCnt) * dis + dit;
+	}
+	
+	
+	
+	
+	function allDayRow(i) {
+		return bodyRows.eq(i);
+	}
+	
+	
+	function allDayBounds(i) {
+		return {
+			left: 0,
+			right: viewWidth
+		};
+	}
+	
+	
+}
+
+function BasicYearEventRenderer() {
+	var t = this;
+	
+	// exports
+	t.renderEvents = renderEvents;
+	t.compileDaySegs = compileSegs; // for DayEventRenderer
+	t.clearEvents = clearEvents;
+	t.bindDaySeg = bindDaySeg;
+	
+	
+	// imports
+	DayEventRenderer.call(t);
+	var opt = t.opt;
+	var trigger = t.trigger;
+	//var setOverflowHidden = t.setOverflowHidden;
+	var isEventDraggable = t.isEventDraggable;
+	var isEventResizable = t.isEventResizable;
+	var reportEvents = t.reportEvents;
+	var reportEventClear = t.reportEventClear;
+	var eventElementHandlers = t.eventElementHandlers;
+	var showEvents = t.showEvents;
+	var hideEvents = t.hideEvents;
+	var eventDrop = t.eventDrop;
+	var getDaySegmentContainer = t.getDaySegmentContainer;
+	var getHoverListener = t.getHoverListener;
+	var renderDayOverlay = t.renderDayOverlay;
+	var clearOverlays = t.clearOverlays;
+	var getRowCnt = t.getRowCnt;
+	var getColCnt = t.getColCnt;
+	var getBodyRows = t.getBodyRows;
+	//var renderDaySegs = t.renderDaySegs;
+	var resizableDayEvent = t.resizableDayEvent;
+	
+	
+	
+	/* Rendering
+	--------------------------------------------------------------------*/
+	
+	
+	function renderEvents(events, modifiedEventId) {
+		reportEvents(events);
+		renderDaySegs(compileSegs(events), modifiedEventId);
+	}
+	
+	
+	function clearEvents() {
+		reportEventClear();
+		getDaySegmentContainer().empty();
+	}
+	
+	
+	function compileSegs(events) {
+		var rowCnt = getRowCnt(),
+			colCnt = getColCnt(),
+			d1 = cloneDate(t.visStart),
+			d2 = cloneDate(t.visEnd),
+			visEventsEnds = $.map(events, exclEndDay),
+			i, row,
+			j, level,
+			k, seg,
+			segs=[];
+			row = stackSegs(sliceSegs(events, visEventsEnds, d1, d2));
+			for (j=0; j<row.length; j++) {
+				level = row[j];
+				for (k=0; k<level.length; k++) {
+					seg = level[k];
+					seg.row = i;
+					seg.level = j; // not needed anymore
+					segs.push(seg);
+				}
+			}
+		return segs;
+	}
+	
+	function sliceSegs(events, visEventEnds, start, end) {
+	var segs = [],
+		i, len=events.length, event,
+		eventStart, eventEnd,
+		segStart, segEnd,
+		isStart, isEnd;
+	for (i=0; i<len; i++) {
+		event = events[i];
+		eventStart = event.start;
+		eventEnd = visEventEnds[i];
+		if (eventEnd > start && eventStart < end) {
+			if (eventStart < start) {
+				segStart = cloneDate(start);
+				isStart = false;
+			}else{
+				segStart = eventStart;
+				isStart = true;
+			}
+			if (eventEnd > end) {
+				segEnd = cloneDate(end);
+				isEnd = false;
+			}else{
+				segEnd = eventEnd;
+				isEnd = true;
+			}
+			segs.push({
+				event: event,
+				start: segStart,
+				end: segEnd,
+				isStart: isStart,
+				isEnd: isEnd,
+				msLength: segEnd - segStart
+			});
+		}
+	} 
+	return segs.sort(segCmp);
+}
+
+
+// event rendering calculation utilities
+function stackSegs(segs) {
+	var levels = [],
+		i, len = segs.length, seg,
+		j, collide, k;
+	for (i=0; i<len; i++) {
+		seg = segs[i];
+		j = 0; // the level index where seg should belong
+		while (true) {
+			collide = false;
+			if (levels[j]) {
+				for (k=0; k<levels[j].length; k++) {
+					if (segsCollide(levels[j][k], seg)) {
+						collide = true;
+						break;
+					}
+				}
+			}
+			if (collide) {
+				j++;
+			}else{
+				break;
+			}
+		}
+		if (levels[j]) {
+			levels[j].push(seg);
+		}else{
+			levels[j] = [seg];
+		}
+	}
+	return levels;
+}
+	
+	function bindDaySeg(event, eventElement, seg) {
+		if (isEventDraggable(event)) {
+			draggableDayEvent(event, eventElement);
+		}
+		if (seg.isEnd && isEventResizable(event)) {
+			resizableDayEvent(event, eventElement, seg);
+		}
+		eventElementHandlers(event, eventElement);
+			// needs to be after, because resizableDayEvent might stopImmediatePropagation on click
+	}
+	
+	function renderDaySegs(segs, modifiedEventId) {
+		try{
+			var segCnt = segs.length;
+			var rowsTd = getBodyRows();
+			//alert(rowsTd.find('td.fc-day-1-1'));
+			//rowsTd.find('td.fc-day-1-1').addClass('fc-year-have-event');
+			/*
+			rowsTd.each(function(i,_td){
+				alert(_td.className.match('\\d{4}-\\d{2}-\\d{2}'));
+				$(_td).css();
+			});
+			*/
+			for(var i=0;i<segs.length;i++){
+				var sd = cloneDate(segs[i].start);
+				while(sd.getTime() < segs[i].end.getTime()){
+					rowsTd.filter('.fc-day-'+formatDate(sd, 'yyyy-MM-dd')).addClass('fc-year-have-event');
+					addDays(sd,1);
+				}
+			}
+			
+			
+		}catch(e){
+			alert("MyrenderDaySegs:"+e);
+		}
+	}
+	
+	/* Dragging
+	----------------------------------------------------------------------------*/
+	
+	
+	function draggableDayEvent(event, eventElement) {
+		var hoverListener = getHoverListener();
+		var dayDelta;
+		eventElement.draggable({
+			zIndex: 9,
+			delay: 50,
+			opacity: opt('dragOpacity'),
+			revertDuration: opt('dragRevertDuration'),
+			start: function(ev, ui) {
+				trigger('eventDragStart', eventElement, event, ev, ui);
+				hideEvents(event, eventElement);
+				hoverListener.start(function(cell, origCell, rowDelta, colDelta) {
+					eventElement.draggable('option', 'revert', !cell || !rowDelta && !colDelta);
+					clearOverlays();
+					if (cell) {
+						//setOverflowHidden(true);
+						dayDelta = rowDelta*7 + colDelta * (opt('isRTL') ? -1 : 1);
+						renderDayOverlay(
+							addDays(cloneDate(event.start), dayDelta),
+							addDays(exclEndDay(event), dayDelta)
+						);
+					}else{
+						//setOverflowHidden(false);
+						dayDelta = 0;
+					}
+				}, ev, 'drag');
+			},
+			stop: function(ev, ui) {
+				hoverListener.stop();
+				clearOverlays();
+				trigger('eventDragStop', eventElement, event, ev, ui);
+				if (dayDelta) {
+					eventDrop(this, event, dayDelta, 0, event.allDay, ev, ui);
+				}else{
+					eventElement.css('filter', ''); // clear IE opacity side-effects
+					showEvents(event, eventElement);
+				}
+				//setOverflowHidden(false);
+			}
+		});
+	}
+
+
+}
+
+// Year View END ----------------------------------------------------------------------------------
+
+fcViews.month = MonthView;
+
+function MonthView(element, calendar) {
+	var t = this;
+	
+	
+	// exports
+	t.render = render;
+	
+	
+	// imports
+	BasicView.call(t, element, calendar, 'month');
+	var opt = t.opt;
+	var renderBasic = t.renderBasic;
+	var formatDate = calendar.formatDate;
+	
+	
+	
+	function render(date, delta) {
+		if (delta) {
+			addMonths(date, delta);
+			date.setDate(1);
+		}
+		var start = cloneDate(date, true);
+		start.setDate(1);
+		var end = addMonths(cloneDate(start), 1);
+		var visStart = cloneDate(start);
+		var visEnd = cloneDate(end);
+		var firstDay = opt('firstDay');
+		var nwe = opt('weekends') ? 0 : 1;
+		if (nwe) {
+			skipWeekend(visStart);
+			skipWeekend(visEnd, -1, true);
+		}
+		addDays(visStart, -((visStart.getDay() - Math.max(firstDay, nwe) + 7) % 7));
+		addDays(visEnd, (7 - visEnd.getDay() + Math.max(firstDay, nwe)) % 7);
+		var rowCnt = Math.round((visEnd - visStart) / (DAY_MS * 7));
+		if (opt('weekMode') == 'fixed') {
+			addDays(visEnd, (6 - rowCnt) * 7);
+			rowCnt = 6;
+		}
+		t.title = formatDate(start, opt('titleFormat'));
+		t.start = start;
+		t.end = end;
+		t.visStart = visStart;
+		t.visEnd = visEnd;
+		renderBasic(6, rowCnt, nwe ? 5 : 7, true);
+	}
+	
+	
+}
+
+fcViews.basicWeek = BasicWeekView;
+
+function BasicWeekView(element, calendar) {
+	var t = this;
+	
+	
+	// exports
+	t.render = render;
+	
+	
+	// imports
+	BasicView.call(t, element, calendar, 'basicWeek');
+	var opt = t.opt;
+	var renderBasic = t.renderBasic;
+	var formatDates = calendar.formatDates;
+	
+	
+	
+	function render(date, delta) {
+		if (delta) {
+			addDays(date, delta * 7);
+		}
+		var start = addDays(cloneDate(date), -((date.getDay() - opt('firstDay') + 7) % 7));
+		var end = addDays(cloneDate(start), 7);
+		var visStart = cloneDate(start);
+		var visEnd = cloneDate(end);
+		var weekends = opt('weekends');
+		if (!weekends) {
+			skipWeekend(visStart);
+			skipWeekend(visEnd, -1, true);
+		}
+		t.title = formatDates(
+			visStart,
+			addDays(cloneDate(visEnd), -1),
+			opt('titleFormat')
+		);
+		t.start = start;
+		t.end = end;
+		t.visStart = visStart;
+		t.visEnd = visEnd;
+		renderBasic(1, 1, weekends ? 7 : 5, false);
+	}
+	
+	
+}
+
+fcViews.basicDay = BasicDayView;
+
+//TODO: when calendar's date starts out on a weekend, shouldn't happen
+
+
+function BasicDayView(element, calendar) {
+	var t = this;
+	
+	
+	// exports
+	t.render = render;
+	
+	
+	// imports
+	BasicView.call(t, element, calendar, 'basicDay');
+	var opt = t.opt;
+	var renderBasic = t.renderBasic;
+	var formatDate = calendar.formatDate;
+	
+	
+	
+	function render(date, delta) {
+		if (delta) {
+			addDays(date, delta);
+			if (!opt('weekends')) {
+				skipWeekend(date, delta < 0 ? -1 : 1);
+			}
+		}
+		t.title = formatDate(date, opt('titleFormat'));
+		t.start = t.visStart = cloneDate(date, true);
+		t.end = t.visEnd = addDays(cloneDate(t.start), 1);
+		renderBasic(1, 1, 1, false);
+	}
+	
+	
+}
+
+setDefaults({
+	weekMode: 'fixed'
+});
+
+
+function BasicView(element, calendar, viewName) {
+	var t = this;
+	
+	
+	// exports
+	t.renderBasic = renderBasic;
+	t.setHeight = setHeight;
+	t.setWidth = setWidth;
+	t.renderDayOverlay = renderDayOverlay;
+	t.defaultSelectionEnd = defaultSelectionEnd;
+	t.renderSelection = renderSelection;
+	t.clearSelection = clearSelection;
+	t.reportDayClick = reportDayClick; // for selection (kinda hacky)
+	t.dragStart = dragStart;
+	t.dragStop = dragStop;
+	t.defaultEventEnd = defaultEventEnd;
+	t.getHoverListener = function() { return hoverListener };
+	t.colContentLeft = colContentLeft;
+	t.colContentRight = colContentRight;
+	t.dayOfWeekCol = dayOfWeekCol;
+	t.dateCell = dateCell;
+	t.cellDate = cellDate;
+	t.cellIsAllDay = function() { return true };
+	t.allDayRow = allDayRow;
+	t.allDayBounds = allDayBounds;
+	t.getRowCnt = function() { return rowCnt };
+	t.getColCnt = function() { return colCnt };
+	t.getColWidth = function() { return colWidth };
+	t.getDaySegmentContainer = function() { return daySegmentContainer };
+	
+	
+	// imports
+	View.call(t, element, calendar, viewName);
+	OverlayManager.call(t);
+	SelectionManager.call(t);
+	BasicEventRenderer.call(t);
+	var opt = t.opt;
+	var trigger = t.trigger;
+	var clearEvents = t.clearEvents;
+	var renderOverlay = t.renderOverlay;
+	var clearOverlays = t.clearOverlays;
+	var daySelectionMousedown = t.daySelectionMousedown;
+	var formatDate = calendar.formatDate;
+	
+	
+	// locals
+	
+	var head;
+	var headCells;
+	var body;
+	var bodyRows;
+	var bodyCells;
+	var bodyFirstCells;
+	var bodyCellTopInners;
+	var daySegmentContainer;
+	
+	var viewWidth;
+	var viewHeight;
+	var colWidth;
+	
+	var rowCnt, colCnt;
+	var coordinateGrid;
+	var hoverListener;
+	var colContentPositions;
+	
+	var rtl, dis, dit;
+	var firstDay;
+	var nwe;
+	var tm;
+	var colFormat;
+	
+	
+	
+	/* Rendering
+	------------------------------------------------------------*/
+	
+	
+	disableTextSelection(element.addClass('fc-grid'));
+	
+	
+	function renderBasic(maxr, r, c, showNumbers) {
+		rowCnt = r;
+		colCnt = c;
+		updateOptions();
+		var firstTime = !body;
+		if (firstTime) {
+			buildSkeleton(maxr, showNumbers);
+		}else{
+			clearEvents();
+		}
+		updateCells(firstTime);
+	}
+	
+	
+	
+	function updateOptions() {
+		rtl = opt('isRTL');
+		if (rtl) {
+			dis = -1;
+			dit = colCnt - 1;
+		}else{
+			dis = 1;
+			dit = 0;
+		}
+		firstDay = opt('firstDay');
+		nwe = opt('weekends') ? 0 : 1;
+		tm = opt('theme') ? 'ui' : 'fc';
+		colFormat = opt('columnFormat');
+	}
+	
+	
+	
+	function buildSkeleton(maxRowCnt, showNumbers) {
+		var s;
+		var headerClass = tm + "-widget-header";
+		var contentClass = tm + "-widget-content";
+		var i, j;
+		var table;
+		
+		s =
+			"<table class='fc-border-separate' style='width:100%' cellspacing='0'>" +
+			"<thead>" +
+			"<tr>";
+		for (i=0; i<colCnt; i++) {
+			s +=
+				"<th class='fc- " + headerClass + "'/>"; // need fc- for setDayID
+		}
+		s +=
+			"</tr>" +
+			"</thead>" +
+			"<tbody>";
+		for (i=0; i<maxRowCnt; i++) {
+			s +=
+				"<tr class='fc-week" + i + "'>";
+			for (j=0; j<colCnt; j++) {
+				s +=
+					"<td class='fc- " + contentClass + " fc-day" + (i*colCnt+j) + "'>" + // need fc- for setDayID
+					"<div>" +
+					(showNumbers ?
+						"<div class='fc-day-number'/>" :
+						''
+						) +
+					"<div class='fc-day-content'>" +
+					"<div style='position:relative'>&nbsp;</div>" +
+					"</div>" +
+					"</div>" +
+					"</td>";
+			}
+			s +=
+				"</tr>";
+		}
+		s +=
+			"</tbody>" +
+			"</table>";
+		table = $(s).appendTo(element);
+		
+		head = table.find('thead');
+		headCells = head.find('th');
+		body = table.find('tbody');
+		bodyRows = body.find('tr');
+		bodyCells = body.find('td');
+		bodyFirstCells = bodyCells.filter(':first-child');
+		bodyCellTopInners = bodyRows.eq(0).find('div.fc-day-content div');
+		
+		markFirstLast(head.add(head.find('tr'))); // marks first+last tr/th's
+		markFirstLast(bodyRows); // marks first+last td's
+		bodyRows.eq(0).addClass('fc-first'); // fc-last is done in updateCells
+		
+		dayBind(bodyCells);
+		
+		daySegmentContainer =
+			$("<div style='position:absolute;z-index:8;top:0;left:0'/>")
+				.appendTo(element);
+	}
+	
+	
+	
+	function updateCells(firstTime) {
+		var dowDirty = firstTime || rowCnt == 1; // could the cells' day-of-weeks need updating?
+		var month = t.start.getMonth();
+		var today = clearTime(new Date());
+		var cell;
+		var date;
+		var row;
+	
+		if (dowDirty) {
+			headCells.each(function(i, _cell) {
+				cell = $(_cell);
+				date = indexDate(i);
+				cell.html(formatDate(date, colFormat));
+				setDayID(cell, date);
+			});
+		}
+		
+		bodyCells.each(function(i, _cell) {
+			cell = $(_cell);
+			date = indexDate(i);
+			if (date.getMonth() == month) {
+				cell.removeClass('fc-other-month');
+			}else{
+				cell.addClass('fc-other-month');
+			}
+			if (+date == +today) {
+				cell.addClass(tm + '-state-highlight fc-today');
+			}else{
+				cell.removeClass(tm + '-state-highlight fc-today');
+			}
+			cell.find('div.fc-day-number').text(date.getDate());
+			if (dowDirty) {
+				setDayID(cell, date);
+			}
+		});
+		
+		bodyRows.each(function(i, _row) {
+			row = $(_row);
+			if (i < rowCnt) {
+				row.show();
+				if (i == rowCnt-1) {
+					row.addClass('fc-last');
+				}else{
+					row.removeClass('fc-last');
+				}
+			}else{
+				row.hide();
+			}
+		});
+	}
+	
+	
+	
+	function setHeight(height) {
+		viewHeight = height;
+		
+		var bodyHeight = viewHeight - head.height();
+		var rowHeight;
+		var rowHeightLast;
+		var cell;
+			
+		if (opt('weekMode') == 'variable') {
+			rowHeight = rowHeightLast = Math.floor(bodyHeight / (rowCnt==1 ? 2 : 6));
+		}else{
+			rowHeight = Math.floor(bodyHeight / rowCnt);
+			rowHeightLast = bodyHeight - rowHeight * (rowCnt-1);
+		}
+		
+		bodyFirstCells.each(function(i, _cell) {
+			if (i < rowCnt) {
+				cell = $(_cell);
+				setMinHeight(
+					cell.find('> div'),
+					(i==rowCnt-1 ? rowHeightLast : rowHeight) - vsides(cell)
+				);
+			}
+		});
+		
+	}
+	
+	
+	function setWidth(width) {
+		viewWidth = width;
+		colContentPositions.clear();
+		colWidth = Math.floor(viewWidth / colCnt);
+		setOuterWidth(headCells.slice(0, -1), colWidth);
+	}
+	
+	
+	
+	/* Day clicking and binding
+	-----------------------------------------------------------*/
+	
+	
+	function dayBind(days) {
+		days.click(dayClick)
+			.mousedown(daySelectionMousedown);
+	}
+	
+	
+	function dayClick(ev) {
+		if (!opt('selectable')) { // if selectable, SelectionManager will worry about dayClick
+			var index = parseInt(this.className.match(/fc\-day(\d+)/)[1]); // TODO: maybe use .data
+			var date = indexDate(index);
+			trigger('dayClick', this, date, true, ev);
+		}
+	}
+	
+	
+	
+	/* Semi-transparent Overlay Helpers
+	------------------------------------------------------*/
+	
+	
+	function renderDayOverlay(overlayStart, overlayEnd, refreshCoordinateGrid) { // overlayEnd is exclusive
+		if (refreshCoordinateGrid) {
+			coordinateGrid.build();
+		}
+		var rowStart = cloneDate(t.visStart);
+		var rowEnd = addDays(cloneDate(rowStart), colCnt);
+		for (var i=0; i<rowCnt; i++) {
+			var stretchStart = new Date(Math.max(rowStart, overlayStart));
+			var stretchEnd = new Date(Math.min(rowEnd, overlayEnd));
+			if (stretchStart < stretchEnd) {
+				var colStart, colEnd;
+				if (rtl) {
+					colStart = dayDiff(stretchEnd, rowStart)*dis+dit+1;
+					colEnd = dayDiff(stretchStart, rowStart)*dis+dit+1;
+				}else{
+					colStart = dayDiff(stretchStart, rowStart);
+					colEnd = dayDiff(stretchEnd, rowStart);
+				}
+				dayBind(
+					renderCellOverlay(i, colStart, i, colEnd-1)
+				);
+			}
+			addDays(rowStart, 7);
+			addDays(rowEnd, 7);
+		}
+	}
+	
+	
+	function renderCellOverlay(row0, col0, row1, col1) { // row1,col1 is inclusive
+		var rect = coordinateGrid.rect(row0, col0, row1, col1, element);
+		return renderOverlay(rect, element);
+	}
+	
+	
+	
+	/* Selection
+	-----------------------------------------------------------------------*/
+	
+	
+	function defaultSelectionEnd(startDate, allDay) {
+		return cloneDate(startDate);
+	}
+	
+	
+	function renderSelection(startDate, endDate, allDay) {
+		renderDayOverlay(startDate, addDays(cloneDate(endDate), 1), true); // rebuild every time???
+	}
+	
+	
+	function clearSelection() {
+		clearOverlays();
+	}
+	
+	
+	function reportDayClick(date, allDay, ev) {
+		var cell = dateCell(date);
+		var _element = bodyCells[cell.row*colCnt + cell.col];
+		trigger('dayClick', _element, date, allDay, ev);
+	}
+	
+	
+	
+	/* External Dragging
+	-----------------------------------------------------------------------*/
+	
+	
+	function dragStart(_dragElement, ev, ui) {
+		hoverListener.start(function(cell) {
+			clearOverlays();
+			if (cell) {
+				renderCellOverlay(cell.row, cell.col, cell.row, cell.col);
+			}
+		}, ev);
+	}
+	
+	
+	function dragStop(_dragElement, ev, ui) {
+		var cell = hoverListener.stop();
+		clearOverlays();
+		if (cell) {
+			var d = cellDate(cell);
+			trigger('drop', _dragElement, d, true, ev, ui);
+		}
+	}
+	
+	
+	
+	/* Utilities
+	--------------------------------------------------------*/
+	
+	
+	function defaultEventEnd(event) {
+		return cloneDate(event.start);
+	}
+	
+	
+	coordinateGrid = new CoordinateGrid(function(rows, cols) {
+		var e, n, p;
+		headCells.each(function(i, _e) {
+			e = $(_e);
+			n = e.offset().left;
+			if (i) {
+				p[1] = n;
+			}
+			p = [n];
+			cols[i] = p;
+		});
+		p[1] = n + e.outerWidth();
+		bodyRows.each(function(i, _e) {
+			if (i < rowCnt) {
+				e = $(_e);
+				n = e.offset().top;
+				if (i) {
+					p[1] = n;
+				}
+				p = [n];
+				rows[i] = p;
+			}
+		});
+		p[1] = n + e.outerHeight();
+	});
+	
+	
+	hoverListener = new HoverListener(coordinateGrid);
+	
+	
+	colContentPositions = new HorizontalPositionCache(function(col) {
+		return bodyCellTopInners.eq(col);
+	});
+	
+	
+	function colContentLeft(col) {
+		return colContentPositions.left(col);
+	}
+	
+	
+	function colContentRight(col) {
+		return colContentPositions.right(col);
+	}
+	
+	
+	
+	
+	function dateCell(date) {
+		return {
+			row: Math.floor(dayDiff(date, t.visStart) / 7),
+			col: dayOfWeekCol(date.getDay())
+		};
+	}
+	
+	
+	function cellDate(cell) {
+		return _cellDate(cell.row, cell.col);
+	}
+	
+	
+	function _cellDate(row, col) {
+		return addDays(cloneDate(t.visStart), row*7 + col*dis+dit);
+		// what about weekends in middle of week?
+	}
+	
+	
+	function indexDate(index) {
+		return _cellDate(Math.floor(index/colCnt), index%colCnt);
+	}
+	
+	
+	function dayOfWeekCol(dayOfWeek) {
+		return ((dayOfWeek - Math.max(firstDay, nwe) + colCnt) % colCnt) * dis + dit;
+	}
+	
+	
+	
+	
+	function allDayRow(i) {
+		return bodyRows.eq(i);
+	}
+	
+	
+	function allDayBounds(i) {
+		return {
+			left: 0,
+			right: viewWidth
+		};
+	}
+	
+	
+}
+
+function BasicEventRenderer() {
+	var t = this;
+	
+	
+	// exports
+	t.renderEvents = renderEvents;
+	t.compileDaySegs = compileSegs; // for DayEventRenderer
+	t.clearEvents = clearEvents;
+	t.bindDaySeg = bindDaySeg;
+	
+	
+	// imports
+	DayEventRenderer.call(t);
+	var opt = t.opt;
+	var trigger = t.trigger;
+	//var setOverflowHidden = t.setOverflowHidden;
+	var isEventDraggable = t.isEventDraggable;
+	var isEventResizable = t.isEventResizable;
+	var reportEvents = t.reportEvents;
+	var reportEventClear = t.reportEventClear;
+	var eventElementHandlers = t.eventElementHandlers;
+	var showEvents = t.showEvents;
+	var hideEvents = t.hideEvents;
+	var eventDrop = t.eventDrop;
+	var getDaySegmentContainer = t.getDaySegmentContainer;
+	var getHoverListener = t.getHoverListener;
+	var renderDayOverlay = t.renderDayOverlay;
+	var clearOverlays = t.clearOverlays;
+	var getRowCnt = t.getRowCnt;
+	var getColCnt = t.getColCnt;
+	var renderDaySegs = t.renderDaySegs;
+	var resizableDayEvent = t.resizableDayEvent;
+	
+	
+	
+	/* Rendering
+	--------------------------------------------------------------------*/
+	
+	
+	function renderEvents(events, modifiedEventId) {
+		reportEvents(events);
+		renderDaySegs(compileSegs(events), modifiedEventId);
+	}
+	
+	
+	function clearEvents() {
+		reportEventClear();
+		getDaySegmentContainer().empty();
+	}
+	
+	
+	function compileSegs(events) {
+		var rowCnt = getRowCnt(),
+			colCnt = getColCnt(),
+			d1 = cloneDate(t.visStart),
+			d2 = addDays(cloneDate(d1), colCnt),
+			visEventsEnds = $.map(events, exclEndDay),
+			i, row,
+			j, level,
+			k, seg,
+			segs=[];
+		for (i=0; i<rowCnt; i++) {
+			row = stackSegs(sliceSegs(events, visEventsEnds, d1, d2));
+			for (j=0; j<row.length; j++) {
+				level = row[j];
+				for (k=0; k<level.length; k++) {
+					seg = level[k];
+					seg.row = i;
+					seg.level = j; // not needed anymore
+					segs.push(seg);
+				}
+			}
+			addDays(d1, 7);
+			addDays(d2, 7);
+		}
+		return segs;
+	}
+	
+	
+	function bindDaySeg(event, eventElement, seg) {
+		if (isEventDraggable(event)) {
+			draggableDayEvent(event, eventElement);
+		}
+		if (seg.isEnd && isEventResizable(event)) {
+			resizableDayEvent(event, eventElement, seg);
+		}
+		eventElementHandlers(event, eventElement);
+			// needs to be after, because resizableDayEvent might stopImmediatePropagation on click
+	}
+	
+	
+	
+	/* Dragging
+	----------------------------------------------------------------------------*/
+	
+	
+	function draggableDayEvent(event, eventElement) {
+		var hoverListener = getHoverListener();
+		var dayDelta;
+		eventElement.draggable({
+			zIndex: 9,
+			delay: 50,
+			opacity: opt('dragOpacity'),
+			revertDuration: opt('dragRevertDuration'),
+			start: function(ev, ui) {
+				trigger('eventDragStart', eventElement, event, ev, ui);
+				hideEvents(event, eventElement);
+				hoverListener.start(function(cell, origCell, rowDelta, colDelta) {
+					eventElement.draggable('option', 'revert', !cell || !rowDelta && !colDelta);
+					clearOverlays();
+					if (cell) {
+						//setOverflowHidden(true);
+						dayDelta = rowDelta*7 + colDelta * (opt('isRTL') ? -1 : 1);
+						renderDayOverlay(
+							addDays(cloneDate(event.start), dayDelta),
+							addDays(exclEndDay(event), dayDelta)
+						);
+					}else{
+						//setOverflowHidden(false);
+						dayDelta = 0;
+					}
+				}, ev, 'drag');
+			},
+			stop: function(ev, ui) {
+				hoverListener.stop();
+				clearOverlays();
+				trigger('eventDragStop', eventElement, event, ev, ui);
+				if (dayDelta) {
+					eventDrop(this, event, dayDelta, 0, event.allDay, ev, ui);
+				}else{
+					eventElement.css('filter', ''); // clear IE opacity side-effects
+					showEvents(event, eventElement);
+				}
+				//setOverflowHidden(false);
+			}
+		});
+	}
+
+
+}
+
+fcViews.agendaWeek = AgendaWeekView;
+
+function AgendaWeekView(element, calendar) {
+	var t = this;
+	
+	
+	// exports
+	t.render = render;
+	
+	
+	// imports
+	AgendaView.call(t, element, calendar, 'agendaWeek');
+	var opt = t.opt;
+	var renderAgenda = t.renderAgenda;
+	var formatDates = calendar.formatDates;
+	
+	
+	
+	function render(date, delta) {
+		if (delta) {
+			addDays(date, delta * 7);
+		}
+		var start = addDays(cloneDate(date), -((date.getDay() - opt('firstDay') + 7) % 7));
+		var end = addDays(cloneDate(start), 7);
+		var visStart = cloneDate(start);
+		var visEnd = cloneDate(end);
+		var weekends = opt('weekends');
+		if (!weekends) {
+			skipWeekend(visStart);
+			skipWeekend(visEnd, -1, true);
+		}
+		t.title = formatDates(
+			visStart,
+			addDays(cloneDate(visEnd), -1),
+			opt('titleFormat')
+		);
+		t.start = start;
+		t.end = end;
+		t.visStart = visStart;
+		t.visEnd = visEnd;
+		renderAgenda(weekends ? 7 : 5);
+	}
+	
+
+}
+
+fcViews.agendaDay = AgendaDayView;
+
+function AgendaDayView(element, calendar) {
+	var t = this;
+	
+	
+	// exports
+	t.render = render;
+	
+	
+	// imports
+	AgendaView.call(t, element, calendar, 'agendaDay');
+	var opt = t.opt;
+	var renderAgenda = t.renderAgenda;
+	var formatDate = calendar.formatDate;
+	
+	
+	
+	function render(date, delta) {
+		if (delta) {
+			addDays(date, delta);
+			if (!opt('weekends')) {
+				skipWeekend(date, delta < 0 ? -1 : 1);
+			}
+		}
+		var start = cloneDate(date, true);
+		var end = addDays(cloneDate(start), 1);
+		t.title = formatDate(date, opt('titleFormat'));
+		t.start = t.visStart = start;
+		t.end = t.visEnd = end;
+		renderAgenda(1);
+	}
+	
+
+}
+
+setDefaults({
+	allDaySlot: true,
+	allDayText: 'all-day',
+	firstHour: 6,
+	slotMinutes: 30,
+	defaultEventMinutes: 120,
+	axisFormat: 'h(:mm)tt',
+	timeFormat: {
+		agenda: 'h:mm{ - h:mm}'
+	},
+	dragOpacity: {
+		agenda: .5
+	},
+	minTime: 0,
+	maxTime: 24
+});
+
+
+// TODO: make it work in quirks mode (event corners, all-day height)
+// TODO: test liquid width, especially in IE6
+
+
+function AgendaView(element, calendar, viewName) {
+	var t = this;
+	
+	
+	// exports
+	t.renderAgenda = renderAgenda;
+	t.setWidth = setWidth;
+	t.setHeight = setHeight;
+	t.beforeHide = beforeHide;
+	t.afterShow = afterShow;
+	t.defaultEventEnd = defaultEventEnd;
+	t.timePosition = timePosition;
+	t.dayOfWeekCol = dayOfWeekCol;
+	t.dateCell = dateCell;
+	t.cellDate = cellDate;
+	t.cellIsAllDay = cellIsAllDay;
+	t.allDayRow = getAllDayRow;
+	t.allDayBounds = allDayBounds;
+	t.getHoverListener = function() { return hoverListener };
+	t.colContentLeft = colContentLeft;
+	t.colContentRight = colContentRight;
+	t.getDaySegmentContainer = function() { return daySegmentContainer };
+	t.getSlotSegmentContainer = function() { return slotSegmentContainer };
+	t.getMinMinute = function() { return minMinute };
+	t.getMaxMinute = function() { return maxMinute };
+	t.getBodyContent = function() { return slotContent }; // !!??
+	t.getRowCnt = function() { return 1 };
+	t.getColCnt = function() { return colCnt };
+	t.getColWidth = function() { return colWidth };
+	t.getSlotHeight = function() { return slotHeight };
+	t.defaultSelectionEnd = defaultSelectionEnd;
+	t.renderDayOverlay = renderDayOverlay;
+	t.renderSelection = renderSelection;
+	t.clearSelection = clearSelection;
+	t.reportDayClick = reportDayClick; // selection mousedown hack
+	t.dragStart = dragStart;
+	t.dragStop = dragStop;
+	
+	
+	// imports
+	View.call(t, element, calendar, viewName);
+	OverlayManager.call(t);
+	SelectionManager.call(t);
+	AgendaEventRenderer.call(t);
+	var opt = t.opt;
+	var trigger = t.trigger;
+	var clearEvents = t.clearEvents;
+	var renderOverlay = t.renderOverlay;
+	var clearOverlays = t.clearOverlays;
+	var reportSelection = t.reportSelection;
+	var unselect = t.unselect;
+	var daySelectionMousedown = t.daySelectionMousedown;
+	var slotSegHtml = t.slotSegHtml;
+	var formatDate = calendar.formatDate;
+	
+	
+	// locals
+	
+	var dayTable;
+	var dayHead;
+	var dayHeadCells;
+	var dayBody;
+	var dayBodyCells;
+	var dayBodyCellInners;
+	var dayBodyFirstCell;
+	var dayBodyFirstCellStretcher;
+	var slotLayer;
+	var daySegmentContainer;
+	var allDayTable;
+	var allDayRow;
+	var slotScroller;
+	var slotContent;
+	var slotSegmentContainer;
+	var slotTable;
+	var slotTableFirstInner;
+	var axisFirstCells;
+	var gutterCells;
+	var selectionHelper;
+	
+	var viewWidth;
+	var viewHeight;
+	var axisWidth;
+	var colWidth;
+	var gutterWidth;
+	var slotHeight; // TODO: what if slotHeight changes? (see issue 650)
+	var savedScrollTop;
+	
+	var colCnt;
+	var slotCnt;
+	var coordinateGrid;
+	var hoverListener;
+	var colContentPositions;
+	var slotTopCache = {};
+	
+	var tm;
+	var firstDay;
+	var nwe;            // no weekends (int)
+	var rtl, dis, dit;  // day index sign / translate
+	var minMinute, maxMinute;
+	var colFormat;
+	
+
+	
+	/* Rendering
+	-----------------------------------------------------------------------------*/
+	
+	
+	disableTextSelection(element.addClass('fc-agenda'));
+	
+	
+	function renderAgenda(c) {
+		colCnt = c;
+		updateOptions();
+		if (!dayTable) {
+			buildSkeleton();
+		}else{
+			clearEvents();
+		}
+		updateCells();
+	}
+	
+	
+	
+	function updateOptions() {
+		tm = opt('theme') ? 'ui' : 'fc';
+		nwe = opt('weekends') ? 0 : 1;
+		firstDay = opt('firstDay');
+		if (rtl = opt('isRTL')) {
+			dis = -1;
+			dit = colCnt - 1;
+		}else{
+			dis = 1;
+			dit = 0;
+		}
+		minMinute = parseTime(opt('minTime'));
+		maxMinute = parseTime(opt('maxTime'));
+		colFormat = opt('columnFormat');
+	}
+	
+	
+	
+	function buildSkeleton() {
+		var headerClass = tm + "-widget-header";
+		var contentClass = tm + "-widget-content";
+		var s;
+		var i;
+		var d;
+		var maxd;
+		var minutes;
+		var slotNormal = opt('slotMinutes') % 15 == 0;
+		
+		s =
+			"<table style='width:100%' class='fc-agenda-days fc-border-separate' cellspacing='0'>" +
+			"<thead>" +
+			"<tr>" +
+			"<th class='fc-agenda-axis " + headerClass + "'>&nbsp;</th>";
+		for (i=0; i<colCnt; i++) {
+			s +=
+				"<th class='fc- fc-col" + i + ' ' + headerClass + "'/>"; // fc- needed for setDayID
+		}
+		s +=
+			"<th class='fc-agenda-gutter " + headerClass + "'>&nbsp;</th>" +
+			"</tr>" +
+			"</thead>" +
+			"<tbody>" +
+			"<tr>" +
+			"<th class='fc-agenda-axis " + headerClass + "'>&nbsp;</th>";
+		for (i=0; i<colCnt; i++) {
+			s +=
+				"<td class='fc- fc-col" + i + ' ' + contentClass + "'>" + // fc- needed for setDayID
+				"<div>" +
+				"<div class='fc-day-content'>" +
+				"<div style='position:relative'>&nbsp;</div>" +
+				"</div>" +
+				"</div>" +
+				"</td>";
+		}
+		s +=
+			"<td class='fc-agenda-gutter " + contentClass + "'>&nbsp;</td>" +
+			"</tr>" +
+			"</tbody>" +
+			"</table>";
+		dayTable = $(s).appendTo(element);
+		dayHead = dayTable.find('thead');
+		dayHeadCells = dayHead.find('th').slice(1, -1);
+		dayBody = dayTable.find('tbody');
+		dayBodyCells = dayBody.find('td').slice(0, -1);
+		dayBodyCellInners = dayBodyCells.find('div.fc-day-content div');
+		dayBodyFirstCell = dayBodyCells.eq(0);
+		dayBodyFirstCellStretcher = dayBodyFirstCell.find('> div');
+		
+		markFirstLast(dayHead.add(dayHead.find('tr')));
+		markFirstLast(dayBody.add(dayBody.find('tr')));
+		
+		axisFirstCells = dayHead.find('th:first');
+		gutterCells = dayTable.find('.fc-agenda-gutter');
+		
+		slotLayer =
+			$("<div style='position:absolute;z-index:2;left:0;width:100%'/>")
+				.appendTo(element);
+				
+		if (opt('allDaySlot')) {
+		
+			daySegmentContainer =
+				$("<div style='position:absolute;z-index:8;top:0;left:0'/>")
+					.appendTo(slotLayer);
+		
+			s =
+				"<table style='width:100%' class='fc-agenda-allday' cellspacing='0'>" +
+				"<tr>" +
+				"<th class='" + headerClass + " fc-agenda-axis'>" + opt('allDayText') + "</th>" +
+				"<td>" +
+				"<div class='fc-day-content'><div style='position:relative'/></div>" +
+				"</td>" +
+				"<th class='" + headerClass + " fc-agenda-gutter'>&nbsp;</th>" +
+				"</tr>" +
+				"</table>";
+			allDayTable = $(s).appendTo(slotLayer);
+			allDayRow = allDayTable.find('tr');
+			
+			dayBind(allDayRow.find('td'));
+			
+			axisFirstCells = axisFirstCells.add(allDayTable.find('th:first'));
+			gutterCells = gutterCells.add(allDayTable.find('th.fc-agenda-gutter'));
+			
+			slotLayer.append(
+				"<div class='fc-agenda-divider " + headerClass + "'>" +
+				"<div class='fc-agenda-divider-inner'/>" +
+				"</div>"
+			);
+			
+		}else{
+		
+			daySegmentContainer = $([]); // in jQuery 1.4, we can just do $()
+		
+		}
+		
+		slotScroller =
+			$("<div style='position:absolute;width:100%;overflow-x:hidden;overflow-y:auto'/>")
+				.appendTo(slotLayer);
+				
+		slotContent =
+			$("<div style='position:relative;width:100%;overflow:hidden'/>")
+				.appendTo(slotScroller);
+				
+		slotSegmentContainer =
+			$("<div style='position:absolute;z-index:8;top:0;left:0'/>")
+				.appendTo(slotContent);
+		
+		s =
+			"<table class='fc-agenda-slots' style='width:100%' cellspacing='0'>" +
+			"<tbody>";
+		d = zeroDate();
+		maxd = addMinutes(cloneDate(d), maxMinute);
+		addMinutes(d, minMinute);
+		slotCnt = 0;
+		for (i=0; d < maxd; i++) {
+			minutes = d.getMinutes();
+			s +=
+				"<tr class='fc-slot" + i + ' ' + (!minutes ? '' : 'fc-minor') + "'>" +
+				"<th class='fc-agenda-axis " + headerClass + "'>" +
+				((!slotNormal || !minutes) ? formatDate(d, opt('axisFormat')) : '&nbsp;') +
+				"</th>" +
+				"<td class='" + contentClass + "'>" +
+				"<div style='position:relative'>&nbsp;</div>" +
+				"</td>" +
+				"</tr>";
+			addMinutes(d, opt('slotMinutes'));
+			slotCnt++;
+		}
+		s +=
+			"</tbody>" +
+			"</table>";
+		slotTable = $(s).appendTo(slotContent);
+		slotTableFirstInner = slotTable.find('div:first');
+		
+		slotBind(slotTable.find('td'));
+		
+		axisFirstCells = axisFirstCells.add(slotTable.find('th:first'));
+	}
+	
+	
+	
+	function updateCells() {
+		var i;
+		var headCell;
+		var bodyCell;
+		var date;
+		var today = clearTime(new Date());
+		for (i=0; i<colCnt; i++) {
+			date = colDate(i);
+			headCell = dayHeadCells.eq(i);
+			headCell.html(formatDate(date, colFormat));
+			bodyCell = dayBodyCells.eq(i);
+			if (+date == +today) {
+				bodyCell.addClass(tm + '-state-highlight fc-today');
+			}else{
+				bodyCell.removeClass(tm + '-state-highlight fc-today');
+			}
+			setDayID(headCell.add(bodyCell), date);
+		}
+	}
+	
+	
+	
+	function setHeight(height, dateChanged) {
+		if (height === undefined) {
+			height = viewHeight;
+		}
+		viewHeight = height;
+		slotTopCache = {};
+	
+		var headHeight = dayBody.position().top;
+		var allDayHeight = slotScroller.position().top; // including divider
+		var bodyHeight = Math.min( // total body height, including borders
+			height - headHeight,   // when scrollbars
+			slotTable.height() + allDayHeight + 1 // when no scrollbars. +1 for bottom border
+		);
+		
+		dayBodyFirstCellStretcher
+			.height(bodyHeight - vsides(dayBodyFirstCell));
+		
+		slotLayer.css('top', headHeight);
+		
+		slotScroller.height(bodyHeight - allDayHeight - 1);
+		
+		slotHeight = slotTableFirstInner.height() + 1; // +1 for border
+		
+		if (dateChanged) {
+			resetScroll();
+		}
+	}
+	
+	
+	
+	function setWidth(width) {
+		viewWidth = width;
+		colContentPositions.clear();
+		
+		axisWidth = 0;
+		setOuterWidth(
+			axisFirstCells
+				.width('')
+				.each(function(i, _cell) {
+					axisWidth = Math.max(axisWidth, $(_cell).outerWidth());
+				}),
+			axisWidth
+		);
+		
+		var slotTableWidth = slotScroller[0].clientWidth; // needs to be done after axisWidth (for IE7)
+		//slotTable.width(slotTableWidth);
+		
+		gutterWidth = slotScroller.width() - slotTableWidth;
+		if (gutterWidth) {
+			setOuterWidth(gutterCells, gutterWidth);
+			gutterCells
+				.show()
+				.prev()
+				.removeClass('fc-last');
+		}else{
+			gutterCells
+				.hide()
+				.prev()
+				.addClass('fc-last');
+		}
+		
+		colWidth = Math.floor((slotTableWidth - axisWidth) / colCnt);
+		setOuterWidth(dayHeadCells.slice(0, -1), colWidth);
+	}
+	
+
+
+	function resetScroll() {
+		var d0 = zeroDate();
+		var scrollDate = cloneDate(d0);
+		scrollDate.setHours(opt('firstHour'));
+		var top = timePosition(d0, scrollDate) + 1; // +1 for the border
+		function scroll() {
+			slotScroller.scrollTop(top);
+		}
+		scroll();
+		setTimeout(scroll, 0); // overrides any previous scroll state made by the browser
+	}
+	
+	
+	function beforeHide() {
+		savedScrollTop = slotScroller.scrollTop();
+	}
+	
+	
+	function afterShow() {
+		slotScroller.scrollTop(savedScrollTop);
+	}
+	
+	
+	
+	/* Slot/Day clicking and binding
+	-----------------------------------------------------------------------*/
+	
+
+	function dayBind(cells) {
+		cells.click(slotClick)
+			.mousedown(daySelectionMousedown);
+	}
+
+
+	function slotBind(cells) {
+		cells.click(slotClick)
+			.mousedown(slotSelectionMousedown);
+	}
+	
+	
+	function slotClick(ev) {
+		if (!opt('selectable')) { // if selectable, SelectionManager will worry about dayClick
+			var col = Math.min(colCnt-1, Math.floor((ev.pageX - dayTable.offset().left - axisWidth) / colWidth));
+			var date = colDate(col);
+			var rowMatch = this.parentNode.className.match(/fc-slot(\d+)/); // TODO: maybe use data
+			if (rowMatch) {
+				var mins = parseInt(rowMatch[1]) * opt('slotMinutes');
+				var hours = Math.floor(mins/60);
+				date.setHours(hours);
+				date.setMinutes(mins%60 + minMinute);
+				trigger('dayClick', dayBodyCells[col], date, false, ev);
+			}else{
+				trigger('dayClick', dayBodyCells[col], date, true, ev);
+			}
+		}
+	}
+	
+	
+	
+	/* Semi-transparent Overlay Helpers
+	-----------------------------------------------------*/
+	
+
+	function renderDayOverlay(startDate, endDate, refreshCoordinateGrid) { // endDate is exclusive
+		if (refreshCoordinateGrid) {
+			coordinateGrid.build();
+		}
+		var visStart = cloneDate(t.visStart);
+		var startCol, endCol;
+		if (rtl) {
+			startCol = dayDiff(endDate, visStart)*dis+dit+1;
+			endCol = dayDiff(startDate, visStart)*dis+dit+1;
+		}else{
+			startCol = dayDiff(startDate, visStart);
+			endCol = dayDiff(endDate, visStart);
+		}
+		startCol = Math.max(0, startCol);
+		endCol = Math.min(colCnt, endCol);
+		if (startCol < endCol) {
+			dayBind(
+				renderCellOverlay(0, startCol, 0, endCol-1)
+			);
+		}
+	}
+	
+	
+	function renderCellOverlay(row0, col0, row1, col1) { // only for all-day?
+		var rect = coordinateGrid.rect(row0, col0, row1, col1, slotLayer);
+		return renderOverlay(rect, slotLayer);
+	}
+	
+
+	function renderSlotOverlay(overlayStart, overlayEnd) {
+		var dayStart = cloneDate(t.visStart);
+		var dayEnd = addDays(cloneDate(dayStart), 1);
+		for (var i=0; i<colCnt; i++) {
+			var stretchStart = new Date(Math.max(dayStart, overlayStart));
+			var stretchEnd = new Date(Math.min(dayEnd, overlayEnd));
+			if (stretchStart < stretchEnd) {
+				var col = i*dis+dit;
+				var rect = coordinateGrid.rect(0, col, 0, col, slotContent); // only use it for horizontal coords
+				var top = timePosition(dayStart, stretchStart);
+				var bottom = timePosition(dayStart, stretchEnd);
+				rect.top = top;
+				rect.height = bottom - top;
+				slotBind(
+					renderOverlay(rect, slotContent)
+				);
+			}
+			addDays(dayStart, 1);
+			addDays(dayEnd, 1);
+		}
+	}
+	
+	
+	
+	/* Coordinate Utilities
+	-----------------------------------------------------------------------------*/
+	
+	
+	coordinateGrid = new CoordinateGrid(function(rows, cols) {
+		var e, n, p;
+		dayHeadCells.each(function(i, _e) {
+			e = $(_e);
+			n = e.offset().left;
+			if (i) {
+				p[1] = n;
+			}
+			p = [n];
+			cols[i] = p;
+		});
+		p[1] = n + e.outerWidth();
+		if (opt('allDaySlot')) {
+			e = allDayRow;
+			n = e.offset().top;
+			rows[0] = [n, n+e.outerHeight()];
+		}
+		var slotTableTop = slotContent.offset().top;
+		var slotScrollerTop = slotScroller.offset().top;
+		var slotScrollerBottom = slotScrollerTop + slotScroller.outerHeight();
+		function constrain(n) {
+			return Math.max(slotScrollerTop, Math.min(slotScrollerBottom, n));
+		}
+		for (var i=0; i<slotCnt; i++) {
+			rows.push([
+				constrain(slotTableTop + slotHeight*i),
+				constrain(slotTableTop + slotHeight*(i+1))
+			]);
+		}
+	});
+	
+	
+	hoverListener = new HoverListener(coordinateGrid);
+	
+	
+	colContentPositions = new HorizontalPositionCache(function(col) {
+		return dayBodyCellInners.eq(col);
+	});
+	
+	
+	function colContentLeft(col) {
+		return colContentPositions.left(col);
+	}
+	
+	
+	function colContentRight(col) {
+		return colContentPositions.right(col);
+	}
+	
+	
+	
+	
+	function dateCell(date) { // "cell" terminology is now confusing
+		return {
+			row: Math.floor(dayDiff(date, t.visStart) / 7),
+			col: dayOfWeekCol(date.getDay())
+		};
+	}
+	
+	
+	function cellDate(cell) {
+		var d = colDate(cell.col);
+		var slotIndex = cell.row;
+		if (opt('allDaySlot')) {
+			slotIndex--;
+		}
+		if (slotIndex >= 0) {
+			addMinutes(d, minMinute + slotIndex * opt('slotMinutes'));
+		}
+		return d;
+	}
+	
+	
+	function colDate(col) { // returns dates with 00:00:00
+		return addDays(cloneDate(t.visStart), col*dis+dit);
+	}
+	
+	
+	function cellIsAllDay(cell) {
+		return opt('allDaySlot') && !cell.row;
+	}
+	
+	
+	function dayOfWeekCol(dayOfWeek) {
+		return ((dayOfWeek - Math.max(firstDay, nwe) + colCnt) % colCnt)*dis+dit;
+	}
+	
+	
+	
+	
+	// get the Y coordinate of the given time on the given day (both Date objects)
+	function timePosition(day, time) { // both date objects. day holds 00:00 of current day
+		day = cloneDate(day, true);
+		if (time < addMinutes(cloneDate(day), minMinute)) {
+			return 0;
+		}
+		if (time >= addMinutes(cloneDate(day), maxMinute)) {
+			return slotTable.height();
+		}
+		var slotMinutes = opt('slotMinutes'),
+			minutes = time.getHours()*60 + time.getMinutes() - minMinute,
+			slotI = Math.floor(minutes / slotMinutes),
+			slotTop = slotTopCache[slotI];
+		if (slotTop === undefined) {
+			slotTop = slotTopCache[slotI] = slotTable.find('tr:eq(' + slotI + ') td div')[0].offsetTop; //.position().top; // need this optimization???
+		}
+		return Math.max(0, Math.round(
+			slotTop - 1 + slotHeight * ((minutes % slotMinutes) / slotMinutes)
+		));
+	}
+	
+	
+	function allDayBounds() {
+		return {
+			left: axisWidth,
+			right: viewWidth - gutterWidth
+		}
+	}
+	
+	
+	function getAllDayRow(index) {
+		return allDayRow;
+	}
+	
+	
+	function defaultEventEnd(event) {
+		var start = cloneDate(event.start);
+		if (event.allDay) {
+			return start;
+		}
+		return addMinutes(start, opt('defaultEventMinutes'));
+	}
+	
+	
+	
+	/* Selection
+	---------------------------------------------------------------------------------*/
+	
+	
+	function defaultSelectionEnd(startDate, allDay) {
+		if (allDay) {
+			return cloneDate(startDate);
+		}
+		return addMinutes(cloneDate(startDate), opt('slotMinutes'));
+	}
+	
+	
+	function renderSelection(startDate, endDate, allDay) { // only for all-day
+		if (allDay) {
+			if (opt('allDaySlot')) {
+				renderDayOverlay(startDate, addDays(cloneDate(endDate), 1), true);
+			}
+		}else{
+			renderSlotSelection(startDate, endDate);
+		}
+	}
+	
+	
+	function renderSlotSelection(startDate, endDate) {
+		var helperOption = opt('selectHelper');
+		coordinateGrid.build();
+		if (helperOption) {
+			var col = dayDiff(startDate, t.visStart) * dis + dit;
+			if (col >= 0 && col < colCnt) { // only works when times are on same day
+				var rect = coordinateGrid.rect(0, col, 0, col, slotContent); // only for horizontal coords
+				var top = timePosition(startDate, startDate);
+				var bottom = timePosition(startDate, endDate);
+				if (bottom > top) { // protect against selections that are entirely before or after visible range
+					rect.top = top;
+					rect.height = bottom - top;
+					rect.left += 2;
+					rect.width -= 5;
+					if ($.isFunction(helperOption)) {
+						var helperRes = helperOption(startDate, endDate);
+						if (helperRes) {
+							rect.position = 'absolute';
+							rect.zIndex = 8;
+							selectionHelper = $(helperRes)
+								.css(rect)
+								.appendTo(slotContent);
+						}
+					}else{
+						rect.isStart = true; // conside rect a "seg" now
+						rect.isEnd = true;   //
+						selectionHelper = $(slotSegHtml(
+							{
+								title: '',
+								start: startDate,
+								end: endDate,
+								className: ['fc-select-helper'],
+								editable: false
+							},
+							rect
+						));
+						selectionHelper.css('opacity', opt('dragOpacity'));
+					}
+					if (selectionHelper) {
+						slotBind(selectionHelper);
+						slotContent.append(selectionHelper);
+						setOuterWidth(selectionHelper, rect.width, true); // needs to be after appended
+						setOuterHeight(selectionHelper, rect.height, true);
+					}
+				}
+			}
+		}else{
+			renderSlotOverlay(startDate, endDate);
+		}
+	}
+	
+	
+	function clearSelection() {
+		clearOverlays();
+		if (selectionHelper) {
+			selectionHelper.remove();
+			selectionHelper = null;
+		}
+	}
+	
+	
+	function slotSelectionMousedown(ev) {
+		if (ev.which == 1 && opt('selectable')) { // ev.which==1 means left mouse button
+			unselect(ev);
+			var dates;
+			hoverListener.start(function(cell, origCell) {
+				clearSelection();
+				if (cell && cell.col == origCell.col && !cellIsAllDay(cell)) {
+					var d1 = cellDate(origCell);
+					var d2 = cellDate(cell);
+					dates = [
+						d1,
+						addMinutes(cloneDate(d1), opt('slotMinutes')),
+						d2,
+						addMinutes(cloneDate(d2), opt('slotMinutes'))
+					].sort(cmp);
+					renderSlotSelection(dates[0], dates[3]);
+				}else{
+					dates = null;
+				}
+			}, ev);
+			$(document).one('mouseup', function(ev) {
+				hoverListener.stop();
+				if (dates) {
+					if (+dates[0] == +dates[1]) {
+						reportDayClick(dates[0], false, ev);
+					}
+					reportSelection(dates[0], dates[3], false, ev);
+				}
+			});
+		}
+	}
+	
+	
+	function reportDayClick(date, allDay, ev) {
+		trigger('dayClick', dayBodyCells[dayOfWeekCol(date.getDay())], date, allDay, ev);
+	}
+	
+	
+	
+	/* External Dragging
+	--------------------------------------------------------------------------------*/
+	
+	
+	function dragStart(_dragElement, ev, ui) {
+		hoverListener.start(function(cell) {
+			clearOverlays();
+			if (cell) {
+				if (cellIsAllDay(cell)) {
+					renderCellOverlay(cell.row, cell.col, cell.row, cell.col);
+				}else{
+					var d1 = cellDate(cell);
+					var d2 = addMinutes(cloneDate(d1), opt('defaultEventMinutes'));
+					renderSlotOverlay(d1, d2);
+				}
+			}
+		}, ev);
+	}
+	
+	
+	function dragStop(_dragElement, ev, ui) {
+		var cell = hoverListener.stop();
+		clearOverlays();
+		if (cell) {
+			trigger('drop', _dragElement, cellDate(cell), cellIsAllDay(cell), ev, ui);
+		}
+	}
+
+
+}
+
+function AgendaEventRenderer() {
+	var t = this;
+	
+	
+	// exports
+	t.renderEvents = renderEvents;
+	t.compileDaySegs = compileDaySegs; // for DayEventRenderer
+	t.clearEvents = clearEvents;
+	t.slotSegHtml = slotSegHtml;
+	t.bindDaySeg = bindDaySeg;
+	
+	
+	// imports
+	DayEventRenderer.call(t);
+	var opt = t.opt;
+	var trigger = t.trigger;
+	//var setOverflowHidden = t.setOverflowHidden;
+	var isEventDraggable = t.isEventDraggable;
+	var isEventResizable = t.isEventResizable;
+	var eventEnd = t.eventEnd;
+	var reportEvents = t.reportEvents;
+	var reportEventClear = t.reportEventClear;
+	var eventElementHandlers = t.eventElementHandlers;
+	var setHeight = t.setHeight;
+	var getDaySegmentContainer = t.getDaySegmentContainer;
+	var getSlotSegmentContainer = t.getSlotSegmentContainer;
+	var getHoverListener = t.getHoverListener;
+	var getMaxMinute = t.getMaxMinute;
+	var getMinMinute = t.getMinMinute;
+	var timePosition = t.timePosition;
+	var colContentLeft = t.colContentLeft;
+	var colContentRight = t.colContentRight;
+	var renderDaySegs = t.renderDaySegs;
+	var resizableDayEvent = t.resizableDayEvent; // TODO: streamline binding architecture
+	var getColCnt = t.getColCnt;
+	var getColWidth = t.getColWidth;
+	var getSlotHeight = t.getSlotHeight;
+	var getBodyContent = t.getBodyContent;
+	var reportEventElement = t.reportEventElement;
+	var showEvents = t.showEvents;
+	var hideEvents = t.hideEvents;
+	var eventDrop = t.eventDrop;
+	var eventResize = t.eventResize;
+	var renderDayOverlay = t.renderDayOverlay;
+	var clearOverlays = t.clearOverlays;
+	var calendar = t.calendar;
+	var formatDate = calendar.formatDate;
+	var formatDates = calendar.formatDates;
+	
+	
+	
+	/* Rendering
+	----------------------------------------------------------------------------*/
+	
+
+	function renderEvents(events, modifiedEventId) {
+		reportEvents(events);
+		var i, len=events.length,
+			dayEvents=[],
+			slotEvents=[];
+		for (i=0; i<len; i++) {
+			if (events[i].allDay) {
+				dayEvents.push(events[i]);
+			}else{
+				slotEvents.push(events[i]);
+			}
+		}
+		if (opt('allDaySlot')) {
+			renderDaySegs(compileDaySegs(dayEvents), modifiedEventId);
+			setHeight(); // no params means set to viewHeight
+		}
+		renderSlotSegs(compileSlotSegs(slotEvents), modifiedEventId);
+	}
+	
+	
+	function clearEvents() {
+		reportEventClear();
+		getDaySegmentContainer().empty();
+		getSlotSegmentContainer().empty();
+	}
+	
+	
+	function compileDaySegs(events) {
+		var levels = stackSegs(sliceSegs(events, $.map(events, exclEndDay), t.visStart, t.visEnd)),
+			i, levelCnt=levels.length, level,
+			j, seg,
+			segs=[];
+		for (i=0; i<levelCnt; i++) {
+			level = levels[i];
+			for (j=0; j<level.length; j++) {
+				seg = level[j];
+				seg.row = 0;
+				seg.level = i; // not needed anymore
+				segs.push(seg);
+			}
+		}
+		return segs;
+	}
+	
+	
+	function compileSlotSegs(events) {
+		var colCnt = getColCnt(),
+			minMinute = getMinMinute(),
+			maxMinute = getMaxMinute(),
+			d = addMinutes(cloneDate(t.visStart), minMinute),
+			visEventEnds = $.map(events, slotEventEnd),
+			i, col,
+			j, level,
+			k, seg,
+			segs=[];
+		for (i=0; i<colCnt; i++) {
+			col = stackSegs(sliceSegs(events, visEventEnds, d, addMinutes(cloneDate(d), maxMinute-minMinute)));
+			countForwardSegs(col);
+			for (j=0; j<col.length; j++) {
+				level = col[j];
+				for (k=0; k<level.length; k++) {
+					seg = level[k];
+					seg.col = i;
+					seg.level = j;
+					segs.push(seg);
+				}
+			}
+			addDays(d, 1, true);
+		}
+		return segs;
+	}
+	
+	
+	function slotEventEnd(event) {
+		if (event.end) {
+			return cloneDate(event.end);
+		}else{
+			return addMinutes(cloneDate(event.start), opt('defaultEventMinutes'));
+		}
+	}
+	
+	
+	// renders events in the 'time slots' at the bottom
+	
+	function renderSlotSegs(segs, modifiedEventId) {
+	
+		var i, segCnt=segs.length, seg,
+			event,
+			classes,
+			top, bottom,
+			colI, levelI, forward,
+			leftmost,
+			availWidth,
+			outerWidth,
+			left,
+			html='',
+			eventElements,
+			eventElement,
+			triggerRes,
+			vsideCache={},
+			hsideCache={},
+			key, val,
+			contentElement,
+			height,
+			slotSegmentContainer = getSlotSegmentContainer(),
+			rtl, dis, dit,
+			colCnt = getColCnt();
+			
+		if (rtl = opt('isRTL')) {
+			dis = -1;
+			dit = colCnt - 1;
+		}else{
+			dis = 1;
+			dit = 0;
+		}
+			
+		// calculate position/dimensions, create html
+		for (i=0; i<segCnt; i++) {
+			seg = segs[i];
+			event = seg.event;
+			top = timePosition(seg.start, seg.start);
+			bottom = timePosition(seg.start, seg.end);
+			colI = seg.col;
+			levelI = seg.level;
+			forward = seg.forward || 0;
+			leftmost = colContentLeft(colI*dis + dit);
+			availWidth = colContentRight(colI*dis + dit) - leftmost;
+			availWidth = Math.min(availWidth-6, availWidth*.95); // TODO: move this to CSS
+			if (levelI) {
+				// indented and thin
+				outerWidth = availWidth / (levelI + forward + 1);
+			}else{
+				if (forward) {
+					// moderately wide, aligned left still
+					outerWidth = ((availWidth / (forward + 1)) - (12/2)) * 2; // 12 is the predicted width of resizer =
+				}else{
+					// can be entire width, aligned left
+					outerWidth = availWidth;
+				}
+			}
+			left = leftmost +                                  // leftmost possible
+				(availWidth / (levelI + forward + 1) * levelI) // indentation
+				* dis + (rtl ? availWidth - outerWidth : 0);   // rtl
+			seg.top = top;
+			seg.left = left;
+			seg.outerWidth = outerWidth;
+			seg.outerHeight = bottom - top;
+			html += slotSegHtml(event, seg);
+		}
+		slotSegmentContainer[0].innerHTML = html; // faster than html()
+		eventElements = slotSegmentContainer.children();
+		
+		// retrieve elements, run through eventRender callback, bind event handlers
+		for (i=0; i<segCnt; i++) {
+			seg = segs[i];
+			event = seg.event;
+			eventElement = $(eventElements[i]); // faster than eq()
+			triggerRes = trigger('eventRender', event, event, eventElement);
+			if (triggerRes === false) {
+				eventElement.remove();
+			}else{
+				if (triggerRes && triggerRes !== true) {
+					eventElement.remove();
+					eventElement = $(triggerRes)
+						.css({
+							position: 'absolute',
+							top: seg.top,
+							left: seg.left
+						})
+						.appendTo(slotSegmentContainer);
+				}
+				seg.element = eventElement;
+				if (event._id === modifiedEventId) {
+					bindSlotSeg(event, eventElement, seg);
+				}else{
+					eventElement[0]._fci = i; // for lazySegBind
+				}
+				reportEventElement(event, eventElement);
+			}
+		}
+		
+		lazySegBind(slotSegmentContainer, segs, bindSlotSeg);
+		
+		// record event sides and title positions
+		for (i=0; i<segCnt; i++) {
+			seg = segs[i];
+			if (eventElement = seg.element) {
+				val = vsideCache[key = seg.key = cssKey(eventElement[0])];
+				seg.vsides = val === undefined ? (vsideCache[key] = vsides(eventElement, true)) : val;
+				val = hsideCache[key];
+				seg.hsides = val === undefined ? (hsideCache[key] = hsides(eventElement, true)) : val;
+				contentElement = eventElement.find('div.fc-event-content');
+				if (contentElement.length) {
+					seg.contentTop = contentElement[0].offsetTop;
+				}
+			}
+		}
+		
+		// set all positions/dimensions at once
+		for (i=0; i<segCnt; i++) {
+			seg = segs[i];
+			if (eventElement = seg.element) {
+				eventElement[0].style.width = Math.max(0, seg.outerWidth - seg.hsides) + 'px';
+				height = Math.max(0, seg.outerHeight - seg.vsides);
+				eventElement[0].style.height = height + 'px';
+				event = seg.event;
+				if (seg.contentTop !== undefined && height - seg.contentTop < 10) {
+					// not enough room for title, put it in the time header
+					eventElement.find('div.fc-event-time')
+						.text(formatDate(event.start, opt('timeFormat')) + ' - ' + event.title);
+					eventElement.find('div.fc-event-title')
+						.remove();
+				}
+				trigger('eventAfterRender', event, event, eventElement);
+			}
+		}
+					
+	}
+	
+	
+	function slotSegHtml(event, seg) {
+		var html = "<";
+		var url = event.url;
+		var skinCss = getSkinCss(event, opt);
+		var skinCssAttr = (skinCss ? " style='" + skinCss + "'" : '');
+		var classes = ['fc-event', 'fc-event-skin', 'fc-event-vert'];
+		if (isEventDraggable(event)) {
+			classes.push('fc-event-draggable');
+		}
+		if (seg.isStart) {
+			classes.push('fc-corner-top');
+		}
+		if (seg.isEnd) {
+			classes.push('fc-corner-bottom');
+		}
+		classes = classes.concat(event.className);
+		if (event.source) {
+			classes = classes.concat(event.source.className || []);
+		}
+		if (url) {
+			html += "a href='" + htmlEscape(event.url) + "'";
+		}else{
+			html += "div";
+		}
+		html +=
+			" class='" + classes.join(' ') + "'" +
+			" style='position:absolute;z-index:8;top:" + seg.top + "px;left:" + seg.left + "px;" + skinCss + "'" +
+			">" +
+			"<div class='fc-event-inner fc-event-skin'" + skinCssAttr + ">" +
+			"<div class='fc-event-head fc-event-skin'" + skinCssAttr + ">" +
+			"<div class='fc-event-time'>" +
+			htmlEscape(formatDates(event.start, event.end, opt('timeFormat'))) +
+			"</div>" +
+			"</div>" +
+			"<div class='fc-event-content'>" +
+			"<div class='fc-event-title'>" +
+			htmlEscape(event.title) +
+			"</div>" +
+			"</div>" +
+			"<div class='fc-event-bg'></div>" +
+			"</div>"; // close inner
+		if (seg.isEnd && isEventResizable(event)) {
+			html +=
+				"<div class='ui-resizable-handle ui-resizable-s'>=</div>";
+		}
+		html +=
+			"</" + (url ? "a" : "div") + ">";
+		return html;
+	}
+	
+	
+	function bindDaySeg(event, eventElement, seg) {
+		if (isEventDraggable(event)) {
+			draggableDayEvent(event, eventElement, seg.isStart);
+		}
+		if (seg.isEnd && isEventResizable(event)) {
+			resizableDayEvent(event, eventElement, seg);
+		}
+		eventElementHandlers(event, eventElement);
+			// needs to be after, because resizableDayEvent might stopImmediatePropagation on click
+	}
+	
+	
+	function bindSlotSeg(event, eventElement, seg) {
+		var timeElement = eventElement.find('div.fc-event-time');
+		if (isEventDraggable(event)) {
+			draggableSlotEvent(event, eventElement, timeElement);
+		}
+		if (seg.isEnd && isEventResizable(event)) {
+			resizableSlotEvent(event, eventElement, timeElement);
+		}
+		eventElementHandlers(event, eventElement);
+	}
+	
+	
+	
+	/* Dragging
+	-----------------------------------------------------------------------------------*/
+	
+	
+	// when event starts out FULL-DAY
+	
+	function draggableDayEvent(event, eventElement, isStart) {
+		var origWidth;
+		var revert;
+		var allDay=true;
+		var dayDelta;
+		var dis = opt('isRTL') ? -1 : 1;
+		var hoverListener = getHoverListener();
+		var colWidth = getColWidth();
+		var slotHeight = getSlotHeight();
+		var minMinute = getMinMinute();
+		eventElement.draggable({
+			zIndex: 9,
+			opacity: opt('dragOpacity', 'month'), // use whatever the month view was using
+			revertDuration: opt('dragRevertDuration'),
+			start: function(ev, ui) {
+				trigger('eventDragStart', eventElement, event, ev, ui);
+				hideEvents(event, eventElement);
+				origWidth = eventElement.width();
+				hoverListener.start(function(cell, origCell, rowDelta, colDelta) {
+					clearOverlays();
+					if (cell) {
+						//setOverflowHidden(true);
+						revert = false;
+						dayDelta = colDelta * dis;
+						if (!cell.row) {
+							// on full-days
+							renderDayOverlay(
+								addDays(cloneDate(event.start), dayDelta),
+								addDays(exclEndDay(event), dayDelta)
+							);
+							resetElement();
+						}else{
+							// mouse is over bottom slots
+							if (isStart) {
+								if (allDay) {
+									// convert event to temporary slot-event
+									eventElement.width(colWidth - 10); // don't use entire width
+									setOuterHeight(
+										eventElement,
+										slotHeight * Math.round(
+											(event.end ? ((event.end - event.start) / MINUTE_MS) : opt('defaultEventMinutes'))
+											/ opt('slotMinutes')
+										)
+									);
+									eventElement.draggable('option', 'grid', [colWidth, 1]);
+									allDay = false;
+								}
+							}else{
+								revert = true;
+							}
+						}
+						revert = revert || (allDay && !dayDelta);
+					}else{
+						resetElement();
+						//setOverflowHidden(false);
+						revert = true;
+					}
+					eventElement.draggable('option', 'revert', revert);
+				}, ev, 'drag');
+			},
+			stop: function(ev, ui) {
+				hoverListener.stop();
+				clearOverlays();
+				trigger('eventDragStop', eventElement, event, ev, ui);
+				if (revert) {
+					// hasn't moved or is out of bounds (draggable has already reverted)
+					resetElement();
+					eventElement.css('filter', ''); // clear IE opacity side-effects
+					showEvents(event, eventElement);
+				}else{
+					// changed!
+					var minuteDelta = 0;
+					if (!allDay) {
+						minuteDelta = Math.round((eventElement.offset().top - getBodyContent().offset().top) / slotHeight)
+							* opt('slotMinutes')
+							+ minMinute
+							- (event.start.getHours() * 60 + event.start.getMinutes());
+					}
+					eventDrop(this, event, dayDelta, minuteDelta, allDay, ev, ui);
+				}
+				//setOverflowHidden(false);
+			}
+		});
+		function resetElement() {
+			if (!allDay) {
+				eventElement
+					.width(origWidth)
+					.height('')
+					.draggable('option', 'grid', null);
+				allDay = true;
+			}
+		}
+	}
+	
+	
+	// when event starts out IN TIMESLOTS
+	
+	function draggableSlotEvent(event, eventElement, timeElement) {
+		var origPosition;
+		var allDay=false;
+		var dayDelta;
+		var minuteDelta;
+		var prevMinuteDelta;
+		var dis = opt('isRTL') ? -1 : 1;
+		var hoverListener = getHoverListener();
+		var colCnt = getColCnt();
+		var colWidth = getColWidth();
+		var slotHeight = getSlotHeight();
+		eventElement.draggable({
+			zIndex: 9,
+			scroll: false,
+			grid: [colWidth, slotHeight],
+			axis: colCnt==1 ? 'y' : false,
+			opacity: opt('dragOpacity'),
+			revertDuration: opt('dragRevertDuration'),
+			start: function(ev, ui) {
+				trigger('eventDragStart', eventElement, event, ev, ui);
+				hideEvents(event, eventElement);
+				origPosition = eventElement.position();
+				minuteDelta = prevMinuteDelta = 0;
+				hoverListener.start(function(cell, origCell, rowDelta, colDelta) {
+					eventElement.draggable('option', 'revert', !cell);
+					clearOverlays();
+					if (cell) {
+						dayDelta = colDelta * dis;
+						if (opt('allDaySlot') && !cell.row) {
+							// over full days
+							if (!allDay) {
+								// convert to temporary all-day event
+								allDay = true;
+								timeElement.hide();
+								eventElement.draggable('option', 'grid', null);
+							}
+							renderDayOverlay(
+								addDays(cloneDate(event.start), dayDelta),
+								addDays(exclEndDay(event), dayDelta)
+							);
+						}else{
+							// on slots
+							resetElement();
+						}
+					}
+				}, ev, 'drag');
+			},
+			drag: function(ev, ui) {
+				minuteDelta = Math.round((ui.position.top - origPosition.top) / slotHeight) * opt('slotMinutes');
+				if (minuteDelta != prevMinuteDelta) {
+					if (!allDay) {
+						updateTimeText(minuteDelta);
+					}
+					prevMinuteDelta = minuteDelta;
+				}
+			},
+			stop: function(ev, ui) {
+				var cell = hoverListener.stop();
+				clearOverlays();
+				trigger('eventDragStop', eventElement, event, ev, ui);
+				if (cell && (dayDelta || minuteDelta || allDay)) {
+					// changed!
+					eventDrop(this, event, dayDelta, allDay ? 0 : minuteDelta, allDay, ev, ui);
+				}else{
+					// either no change or out-of-bounds (draggable has already reverted)
+					resetElement();
+					eventElement.css('filter', ''); // clear IE opacity side-effects
+					eventElement.css(origPosition); // sometimes fast drags make event revert to wrong position
+					updateTimeText(0);
+					showEvents(event, eventElement);
+				}
+			}
+		});
+		function updateTimeText(minuteDelta) {
+			var newStart = addMinutes(cloneDate(event.start), minuteDelta);
+			var newEnd;
+			if (event.end) {
+				newEnd = addMinutes(cloneDate(event.end), minuteDelta);
+			}
+			timeElement.text(formatDates(newStart, newEnd, opt('timeFormat')));
+		}
+		function resetElement() {
+			// convert back to original slot-event
+			if (allDay) {
+				timeElement.css('display', ''); // show() was causing display=inline
+				eventElement.draggable('option', 'grid', [colWidth, slotHeight]);
+				allDay = false;
+			}
+		}
+	}
+	
+	
+	
+	/* Resizing
+	--------------------------------------------------------------------------------------*/
+	
+	
+	function resizableSlotEvent(event, eventElement, timeElement) {
+		var slotDelta, prevSlotDelta;
+		var slotHeight = getSlotHeight();
+		eventElement.resizable({
+			handles: {
+				s: 'div.ui-resizable-s'
+			},
+			grid: slotHeight,
+			start: function(ev, ui) {
+				slotDelta = prevSlotDelta = 0;
+				hideEvents(event, eventElement);
+				eventElement.css('z-index', 9);
+				trigger('eventResizeStart', this, event, ev, ui);
+			},
+			resize: function(ev, ui) {
+				// don't rely on ui.size.height, doesn't take grid into account
+				slotDelta = Math.round((Math.max(slotHeight, eventElement.height()) - ui.originalSize.height) / slotHeight);
+				if (slotDelta != prevSlotDelta) {
+					timeElement.text(
+						formatDates(
+							event.start,
+							(!slotDelta && !event.end) ? null : // no change, so don't display time range
+								addMinutes(eventEnd(event), opt('slotMinutes')*slotDelta),
+							opt('timeFormat')
+						)
+					);
+					prevSlotDelta = slotDelta;
+				}
+			},
+			stop: function(ev, ui) {
+				trigger('eventResizeStop', this, event, ev, ui);
+				if (slotDelta) {
+					eventResize(this, event, 0, opt('slotMinutes')*slotDelta, ev, ui);
+				}else{
+					eventElement.css('z-index', 8);
+					showEvents(event, eventElement);
+					// BUG: if event was really short, need to put title back in span
+				}
+			}
+		});
+	}
+	
+
+}
+
+
+function countForwardSegs(levels) {
+	var i, j, k, level, segForward, segBack;
+	for (i=levels.length-1; i>0; i--) {
+		level = levels[i];
+		for (j=0; j<level.length; j++) {
+			segForward = level[j];
+			for (k=0; k<levels[i-1].length; k++) {
+				segBack = levels[i-1][k];
+				if (segsCollide(segForward, segBack)) {
+					segBack.forward = Math.max(segBack.forward||0, (segForward.forward||0)+1);
+				}
+			}
+		}
+	}
+}
+
+
+
+
+function View(element, calendar, viewName) {
+	var t = this;
+	
+	
+	// exports
+	t.element = element;
+	t.calendar = calendar;
+	t.name = viewName;
+	t.opt = opt;
+	t.trigger = trigger;
+	//t.setOverflowHidden = setOverflowHidden;
+	t.isEventDraggable = isEventDraggable;
+	t.isEventResizable = isEventResizable;
+	t.reportEvents = reportEvents;
+	t.eventEnd = eventEnd;
+	t.reportEventElement = reportEventElement;
+	t.reportEventClear = reportEventClear;
+	t.eventElementHandlers = eventElementHandlers;
+	t.showEvents = showEvents;
+	t.hideEvents = hideEvents;
+	t.eventDrop = eventDrop;
+	t.eventResize = eventResize;
+	// t.title
+	// t.start, t.end
+	// t.visStart, t.visEnd
+	
+	
+	// imports
+	var defaultEventEnd = t.defaultEventEnd;
+	var normalizeEvent = calendar.normalizeEvent; // in EventManager
+	var reportEventChange = calendar.reportEventChange;
+	
+	
+	// locals
+	var eventsByID = {};
+	var eventElements = [];
+	var eventElementsByID = {};
+	var options = calendar.options;
+	
+	
+	
+	function opt(name, viewNameOverride) {
+		var v = options[name];
+		if (typeof v == 'object') {
+                        if ((typeof viewNameOverride != 'undefined') || (viewNameOverride) || (viewNameOverride === 0))
+                            return smartProperty(v, viewNameOverride);
+                        else
+                            return smartProperty(v, viewName);
+		}
+		return v;
+	}
+
+	
+	function trigger(name, thisObj) {
+		return calendar.trigger.apply(
+			calendar,
+			[name, thisObj || t].concat(Array.prototype.slice.call(arguments, 2), [t])
+		);
+	}
+	
+	
+	/*
+	function setOverflowHidden(bool) {
+		element.css('overflow', bool ? 'hidden' : '');
+	}
+	*/
+	
+	
+	function isEventDraggable(event) {
+		return isEventEditable(event) && !opt('disableDragging');
+	}
+	
+	
+	function isEventResizable(event) { // but also need to make sure the seg.isEnd == true
+		return isEventEditable(event) && !opt('disableResizing');
+	}
+	
+	
+	function isEventEditable(event) {
+		return firstDefined(event.editable, (event.source || {}).editable, opt('editable'));
+	}
+	
+	
+	
+	/* Event Data
+	------------------------------------------------------------------------------*/
+	
+	
+	// report when view receives new events
+	function reportEvents(events) { // events are already normalized at this point
+		eventsByID = {};
+		var i, len=events.length, event;
+		for (i=0; i<len; i++) {
+			event = events[i];
+			if (eventsByID[event._id]) {
+				eventsByID[event._id].push(event);
+			}else{
+				eventsByID[event._id] = [event];
+			}
+		}
+	}
+	
+	
+	// returns a Date object for an event's end
+	function eventEnd(event) {
+		return event.end ? cloneDate(event.end) : defaultEventEnd(event);
+	}
+	
+	
+	
+	/* Event Elements
+	------------------------------------------------------------------------------*/
+	
+	
+	// report when view creates an element for an event
+	function reportEventElement(event, element) {
+		eventElements.push(element);
+		if (eventElementsByID[event._id]) {
+			eventElementsByID[event._id].push(element);
+		}else{
+			eventElementsByID[event._id] = [element];
+		}
+	}
+	
+	
+	function reportEventClear() {
+		eventElements = [];
+		eventElementsByID = {};
+	}
+	
+	
+	// attaches eventClick, eventMouseover, eventMouseout
+	function eventElementHandlers(event, eventElement) {
+		eventElement
+			.click(function(ev) {
+				if (!eventElement.hasClass('ui-draggable-dragging') &&
+					!eventElement.hasClass('ui-resizable-resizing')) {
+						return trigger('eventClick', this, event, ev);
+					}
+			})
+			.hover(
+				function(ev) {
+					trigger('eventMouseover', this, event, ev);
+				},
+				function(ev) {
+					trigger('eventMouseout', this, event, ev);
+				}
+			);
+		// TODO: don't fire eventMouseover/eventMouseout *while* dragging is occuring (on subject element)
+		// TODO: same for resizing
+	}
+	
+	
+	function showEvents(event, exceptElement) {
+		eachEventElement(event, exceptElement, 'show');
+	}
+	
+	
+	function hideEvents(event, exceptElement) {
+		eachEventElement(event, exceptElement, 'hide');
+	}
+	
+	
+	function eachEventElement(event, exceptElement, funcName) {
+		var elements = eventElementsByID[event._id],
+			i, len = elements.length;
+		for (i=0; i<len; i++) {
+			if (!exceptElement || elements[i][0] != exceptElement[0]) {
+				elements[i][funcName]();
+			}
+		}
+	}
+	
+	
+	
+	/* Event Modification Reporting
+	---------------------------------------------------------------------------------*/
+	
+	
+	function eventDrop(e, event, dayDelta, minuteDelta, allDay, ev, ui) {
+		var oldAllDay = event.allDay;
+		var eventId = event._id;
+		moveEvents(eventsByID[eventId], dayDelta, minuteDelta, allDay);
+		trigger(
+			'eventDrop',
+			e,
+			event,
+			dayDelta,
+			minuteDelta,
+			allDay,
+			function() {
+				// TODO: investigate cases where this inverse technique might not work
+				moveEvents(eventsByID[eventId], -dayDelta, -minuteDelta, oldAllDay);
+				reportEventChange(eventId);
+			},
+			ev,
+			ui
+		);
+		reportEventChange(eventId);
+	}
+	
+	
+	function eventResize(e, event, dayDelta, minuteDelta, ev, ui) {
+		var eventId = event._id;
+		elongateEvents(eventsByID[eventId], dayDelta, minuteDelta);
+		trigger(
+			'eventResize',
+			e,
+			event,
+			dayDelta,
+			minuteDelta,
+			function() {
+				// TODO: investigate cases where this inverse technique might not work
+				elongateEvents(eventsByID[eventId], -dayDelta, -minuteDelta);
+				reportEventChange(eventId);
+			},
+			ev,
+			ui
+		);
+		reportEventChange(eventId);
+	}
+	
+	
+	
+	/* Event Modification Math
+	---------------------------------------------------------------------------------*/
+	
+	
+	function moveEvents(events, dayDelta, minuteDelta, allDay) {
+		minuteDelta = minuteDelta || 0;
+		for (var e, len=events.length, i=0; i<len; i++) {
+			e = events[i];
+			if (allDay !== undefined) {
+				e.allDay = allDay;
+			}
+			addMinutes(addDays(e.start, dayDelta, true), minuteDelta);
+			if (e.end) {
+				e.end = addMinutes(addDays(e.end, dayDelta, true), minuteDelta);
+			}
+			normalizeEvent(e, options);
+		}
+	}
+	
+	
+	function elongateEvents(events, dayDelta, minuteDelta) {
+		minuteDelta = minuteDelta || 0;
+		for (var e, len=events.length, i=0; i<len; i++) {
+			e = events[i];
+			e.end = addMinutes(addDays(eventEnd(e), dayDelta, true), minuteDelta);
+			normalizeEvent(e, options);
+		}
+	}
+	
+
+}
+
+function DayEventRenderer() {
+	var t = this;
+
+	
+	// exports
+	t.renderDaySegs = renderDaySegs;
+	t.resizableDayEvent = resizableDayEvent;
+	
+	
+	// imports
+	var opt = t.opt;
+	var trigger = t.trigger;
+	var isEventDraggable = t.isEventDraggable;
+	var isEventResizable = t.isEventResizable;
+	var eventEnd = t.eventEnd;
+	var reportEventElement = t.reportEventElement;
+	var showEvents = t.showEvents;
+	var hideEvents = t.hideEvents;
+	var eventResize = t.eventResize;
+	var getRowCnt = t.getRowCnt;
+	var getColCnt = t.getColCnt;
+	var getColWidth = t.getColWidth;
+	var allDayRow = t.allDayRow;
+	var allDayBounds = t.allDayBounds;
+	var colContentLeft = t.colContentLeft;
+	var colContentRight = t.colContentRight;
+	var dayOfWeekCol = t.dayOfWeekCol;
+	var dateCell = t.dateCell;
+	var compileDaySegs = t.compileDaySegs;
+	var getDaySegmentContainer = t.getDaySegmentContainer;
+	var bindDaySeg = t.bindDaySeg; //TODO: streamline this
+	var formatDates = t.calendar.formatDates;
+	var renderDayOverlay = t.renderDayOverlay;
+	var clearOverlays = t.clearOverlays;
+	var clearSelection = t.clearSelection;
+	
+	
+	
+	/* Rendering
+	-----------------------------------------------------------------------------*/
+	
+	
+	function renderDaySegs(segs, modifiedEventId) {
+		var segmentContainer = getDaySegmentContainer();
+		var rowDivs;
+		var rowCnt = getRowCnt();
+		var colCnt = getColCnt();
+		var i = 0;
+		var rowI;
+		var levelI;
+		var colHeights;
+		var j;
+		var segCnt = segs.length;
+		var seg;
+		var top;
+		var k;
+		segmentContainer[0].innerHTML = daySegHTML(segs); // faster than .html()
+		daySegElementResolve(segs, segmentContainer.children());
+		daySegElementReport(segs);
+		daySegHandlers(segs, segmentContainer, modifiedEventId);
+		daySegCalcHSides(segs);
+		daySegSetWidths(segs);
+		daySegCalcHeights(segs);
+		rowDivs = getRowDivs();
+		// set row heights, calculate event tops (in relation to row top)
+		for (rowI=0; rowI<rowCnt; rowI++) {
+			levelI = 0;
+			colHeights = [];
+			for (j=0; j<colCnt; j++) {
+				colHeights[j] = 0;
+			}
+			while (i<segCnt && (seg = segs[i]).row == rowI) {
+				// loop through segs in a row
+				top = arrayMax(colHeights.slice(seg.startCol, seg.endCol));
+				seg.top = top;
+				top += seg.outerHeight;
+				for (k=seg.startCol; k<seg.endCol; k++) {
+					colHeights[k] = top;
+				}
+				i++;
+			}
+			rowDivs[rowI].height(arrayMax(colHeights));
+		}
+		daySegSetTops(segs, getRowTops(rowDivs));
+	}
+	
+	
+	function renderTempDaySegs(segs, adjustRow, adjustTop) {
+		var tempContainer = $("<div/>");
+		var elements;
+		var segmentContainer = getDaySegmentContainer();
+		var i;
+		var segCnt = segs.length;
+		var element;
+		tempContainer[0].innerHTML = daySegHTML(segs); // faster than .html()
+		elements = tempContainer.children();
+		segmentContainer.append(elements);
+		daySegElementResolve(segs, elements);
+		daySegCalcHSides(segs);
+		daySegSetWidths(segs);
+		daySegCalcHeights(segs);
+		daySegSetTops(segs, getRowTops(getRowDivs()));
+		elements = [];
+		for (i=0; i<segCnt; i++) {
+			element = segs[i].element;
+			if (element) {
+				if (segs[i].row === adjustRow) {
+					element.css('top', adjustTop);
+				}
+				elements.push(element[0]);
+			}
+		}
+		return $(elements);
+	}
+	
+	
+	function daySegHTML(segs) { // also sets seg.left and seg.outerWidth
+		var rtl = opt('isRTL');
+		var i;
+		var segCnt=segs.length;
+		var seg;
+		var event;
+		var url;
+		var classes;
+		var bounds = allDayBounds();
+		var minLeft = bounds.left;
+		var maxLeft = bounds.right;
+		var leftCol;
+		var rightCol;
+		var left;
+		var right;
+		var skinCss;
+		var html = '';
+		// calculate desired position/dimensions, create html
+		for (i=0; i<segCnt; i++) {
+			seg = segs[i];
+			event = seg.event;
+			classes = ['fc-event', 'fc-event-skin', 'fc-event-hori'];
+			if (isEventDraggable(event)) {
+				classes.push('fc-event-draggable');
+			}
+			if (rtl) {
+				if (seg.isStart) {
+					classes.push('fc-corner-right');
+				}
+				if (seg.isEnd) {
+					classes.push('fc-corner-left');
+				}
+				leftCol = dayOfWeekCol(seg.end.getDay()-1);
+				rightCol = dayOfWeekCol(seg.start.getDay());
+				left = seg.isEnd ? colContentLeft(leftCol) : minLeft;
+				right = seg.isStart ? colContentRight(rightCol) : maxLeft;
+			}else{
+				if (seg.isStart) {
+					classes.push('fc-corner-left');
+				}
+				if (seg.isEnd) {
+					classes.push('fc-corner-right');
+				}
+				leftCol = dayOfWeekCol(seg.start.getDay());
+				rightCol = dayOfWeekCol(seg.end.getDay()-1);
+				left = seg.isStart ? colContentLeft(leftCol) : minLeft;
+				right = seg.isEnd ? colContentRight(rightCol) : maxLeft;
+			}
+			classes = classes.concat(event.className);
+			if (event.source) {
+				classes = classes.concat(event.source.className || []);
+			}
+			url = event.url;
+			skinCss = getSkinCss(event, opt);
+			if (url) {
+				html += "<a href='" + htmlEscape(url) + "'";
+			}else{
+				html += "<div";
+			}
+			html +=
+				" class='" + classes.join(' ') + "'" +
+				" style='position:absolute;z-index:8;left:"+left+"px;" + skinCss + "'" +
+				">" +
+				"<div" +
+				" class='fc-event-inner fc-event-skin'" +
+				(skinCss ? " style='" + skinCss + "'" : '') +
+				">";
+			if (!event.allDay && seg.isStart) {
+				html +=
+					"<span class='fc-event-time'>" +
+					htmlEscape(formatDates(event.start, event.end, opt('timeFormat'))) +
+					"</span>";
+			}
+			html +=
+				"<span class='fc-event-title'>" + htmlEscape(event.title) + "</span>" +
+				"</div>";
+			if (seg.isEnd && isEventResizable(event)) {
+				html +=
+					"<div class='ui-resizable-handle ui-resizable-" + (rtl ? 'w' : 'e') + "'>" +
+					"&nbsp;&nbsp;&nbsp;" + // makes hit area a lot better for IE6/7
+					"</div>";
+			}
+			html +=
+				"</" + (url ? "a" : "div" ) + ">";
+			seg.left = left;
+			seg.outerWidth = right - left;
+			seg.startCol = leftCol;
+			seg.endCol = rightCol + 1; // needs to be exclusive
+		}
+		return html;
+	}
+	
+	
+	function daySegElementResolve(segs, elements) { // sets seg.element
+		var i;
+		var segCnt = segs.length;
+		var seg;
+		var event;
+		var element;
+		var triggerRes;
+		for (i=0; i<segCnt; i++) {
+			seg = segs[i];
+			event = seg.event;
+			element = $(elements[i]); // faster than .eq()
+			triggerRes = trigger('eventRender', event, event, element);
+			if (triggerRes === false) {
+				element.remove();
+			}else{
+				if (triggerRes && triggerRes !== true) {
+					triggerRes = $(triggerRes)
+						.css({
+							position: 'absolute',
+							left: seg.left
+						});
+					element.replaceWith(triggerRes);
+					element = triggerRes;
+				}
+				seg.element = element;
+			}
+		}
+	}
+	
+	
+	function daySegElementReport(segs) {
+		var i;
+		var segCnt = segs.length;
+		var seg;
+		var element;
+		for (i=0; i<segCnt; i++) {
+			seg = segs[i];
+			element = seg.element;
+			if (element) {
+				reportEventElement(seg.event, element);
+			}
+		}
+	}
+	
+	
+	function daySegHandlers(segs, segmentContainer, modifiedEventId) {
+		var i;
+		var segCnt = segs.length;
+		var seg;
+		var element;
+		var event;
+		// retrieve elements, run through eventRender callback, bind handlers
+		for (i=0; i<segCnt; i++) {
+			seg = segs[i];
+			element = seg.element;
+			if (element) {
+				event = seg.event;
+				if (event._id === modifiedEventId) {
+					bindDaySeg(event, element, seg);
+				}else{
+					element[0]._fci = i; // for lazySegBind
+				}
+			}
+		}
+		lazySegBind(segmentContainer, segs, bindDaySeg);
+	}
+	
+	
+	function daySegCalcHSides(segs) { // also sets seg.key
+		var i;
+		var segCnt = segs.length;
+		var seg;
+		var element;
+		var key, val;
+		var hsideCache = {};
+		// record event horizontal sides
+		for (i=0; i<segCnt; i++) {
+			seg = segs[i];
+			element = seg.element;
+			if (element) {
+				key = seg.key = cssKey(element[0]);
+				val = hsideCache[key];
+				if (val === undefined) {
+					val = hsideCache[key] = hsides(element, true);
+				}
+				seg.hsides = val;
+			}
+		}
+	}
+	
+	
+	function daySegSetWidths(segs) {
+		var i;
+		var segCnt = segs.length;
+		var seg;
+		var element;
+		for (i=0; i<segCnt; i++) {
+			seg = segs[i];
+			element = seg.element;
+			if (element) {
+				element[0].style.width = Math.max(0, seg.outerWidth - seg.hsides) + 'px';
+			}
+		}
+	}
+	
+	
+	function daySegCalcHeights(segs) {
+		var i;
+		var segCnt = segs.length;
+		var seg;
+		var element;
+		var key, val;
+		var vmarginCache = {};
+		// record event heights
+		for (i=0; i<segCnt; i++) {
+			seg = segs[i];
+			element = seg.element;
+			if (element) {
+				key = seg.key; // created in daySegCalcHSides
+				val = vmarginCache[key];
+				if (val === undefined) {
+					val = vmarginCache[key] = vmargins(element);
+				}
+				seg.outerHeight = element[0].offsetHeight + val;
+			}
+		}
+	}
+	
+	
+	function getRowDivs() {
+		var i;
+		var rowCnt = getRowCnt();
+		var rowDivs = [];
+		for (i=0; i<rowCnt; i++) {
+			rowDivs[i] = allDayRow(i)
+				.find('td:first div.fc-day-content > div'); // optimal selector?
+		}
+		return rowDivs;
+	}
+	
+	
+	function getRowTops(rowDivs) {
+		var i;
+		var rowCnt = rowDivs.length;
+		var tops = [];
+		for (i=0; i<rowCnt; i++) {
+			tops[i] = rowDivs[i][0].offsetTop; // !!?? but this means the element needs position:relative if in a table cell!!!!
+		}
+		return tops;
+	}
+	
+	
+	function daySegSetTops(segs, rowTops) { // also triggers eventAfterRender
+		var i;
+		var segCnt = segs.length;
+		var seg;
+		var element;
+		var event;
+		for (i=0; i<segCnt; i++) {
+			seg = segs[i];
+			element = seg.element;
+			if (element) {
+				element[0].style.top = rowTops[seg.row] + (seg.top||0) + 'px';
+				event = seg.event;
+				trigger('eventAfterRender', event, event, element);
+			}
+		}
+	}
+	
+	
+	
+	/* Resizing
+	-----------------------------------------------------------------------------------*/
+	
+	
+	function resizableDayEvent(event, element, seg) {
+		var rtl = opt('isRTL');
+		var direction = rtl ? 'w' : 'e';
+		var handle = element.find('div.ui-resizable-' + direction);
+		var isResizing = false;
+		
+		// TODO: look into using jquery-ui mouse widget for this stuff
+		disableTextSelection(element); // prevent native <a> selection for IE
+		element
+			.mousedown(function(ev) { // prevent native <a> selection for others
+				ev.preventDefault();
+			})
+			.click(function(ev) {
+				if (isResizing) {
+					ev.preventDefault(); // prevent link from being visited (only method that worked in IE6)
+					ev.stopImmediatePropagation(); // prevent fullcalendar eventClick handler from being called
+					                               // (eventElementHandlers needs to be bound after resizableDayEvent)
+				}
+			});
+		
+		handle.mousedown(function(ev) {
+			if (ev.which != 1) {
+				return; // needs to be left mouse button
+			}
+			isResizing = true;
+			var hoverListener = t.getHoverListener();
+			var rowCnt = getRowCnt();
+			var colCnt = getColCnt();
+			var dis = rtl ? -1 : 1;
+			var dit = rtl ? colCnt-1 : 0;
+			var elementTop = element.css('top');
+			var dayDelta;
+			var helpers;
+			var eventCopy = $.extend({}, event);
+			var minCell = dateCell(event.start);
+			clearSelection();
+			$('body')
+				.css('cursor', direction + '-resize')
+				.one('mouseup', mouseup);
+			trigger('eventResizeStart', this, event, ev);
+			hoverListener.start(function(cell, origCell) {
+				if (cell) {
+					var r = Math.max(minCell.row, cell.row);
+					var c = cell.col;
+					if (rowCnt == 1) {
+						r = 0; // hack for all-day area in agenda views
+					}
+					if (r == minCell.row) {
+						if (rtl) {
+							c = Math.min(minCell.col, c);
+						}else{
+							c = Math.max(minCell.col, c);
+						}
+					}
+					dayDelta = (r*7 + c*dis+dit) - (origCell.row*7 + origCell.col*dis+dit);
+					var newEnd = addDays(eventEnd(event), dayDelta, true);
+					if (dayDelta) {
+						eventCopy.end = newEnd;
+						var oldHelpers = helpers;
+						helpers = renderTempDaySegs(compileDaySegs([eventCopy]), seg.row, elementTop);
+						helpers.find('*').css('cursor', direction + '-resize');
+						if (oldHelpers) {
+							oldHelpers.remove();
+						}
+						hideEvents(event);
+					}else{
+						if (helpers) {
+							showEvents(event);
+							helpers.remove();
+							helpers = null;
+						}
+					}
+					clearOverlays();
+					renderDayOverlay(event.start, addDays(cloneDate(newEnd), 1)); // coordinate grid already rebuild at hoverListener.start
+				}
+			}, ev);
+			
+			function mouseup(ev) {
+				trigger('eventResizeStop', this, event, ev);
+				$('body').css('cursor', '');
+				hoverListener.stop();
+				clearOverlays();
+				if (dayDelta) {
+					eventResize(this, event, dayDelta, 0, ev);
+					// event redraw will clear helpers
+				}
+				// otherwise, the drag handler already restored the old events
+				
+				setTimeout(function() { // make this happen after the element's click event
+					isResizing = false;
+				},0);
+			}
+			
+		});
+	}
+	
+
+}
+
+//BUG: unselect needs to be triggered when events are dragged+dropped
+
+function SelectionManager() {
+	var t = this;
+	
+	
+	// exports
+	t.select = select;
+	t.unselect = unselect;
+	t.reportSelection = reportSelection;
+	t.daySelectionMousedown = daySelectionMousedown;
+	
+	
+	// imports
+	var opt = t.opt;
+	var trigger = t.trigger;
+	var defaultSelectionEnd = t.defaultSelectionEnd;
+	var renderSelection = t.renderSelection;
+	var clearSelection = t.clearSelection;
+	
+	
+	// locals
+	var selected = false;
+
+
+
+	// unselectAuto
+	if (opt('selectable') && opt('unselectAuto')) {
+		$(document).mousedown(function(ev) {
+			var ignore = opt('unselectCancel');
+			if (ignore) {
+				if ($(ev.target).parents(ignore).length) { // could be optimized to stop after first match
+					return;
+				}
+			}
+			unselect(ev);
+		});
+	}
+	
+
+	function select(startDate, endDate, allDay) {
+		unselect();
+		if (!endDate) {
+			endDate = defaultSelectionEnd(startDate, allDay);
+		}
+		renderSelection(startDate, endDate, allDay);
+		reportSelection(startDate, endDate, allDay);
+	}
+	
+	
+	function unselect(ev) {
+		if (selected) {
+			selected = false;
+			clearSelection();
+			trigger('unselect', null, ev);
+		}
+	}
+	
+	
+	function reportSelection(startDate, endDate, allDay, ev) {
+		selected = true;
+		trigger('select', null, startDate, endDate, allDay, ev);
+	}
+	
+	
+	function daySelectionMousedown(ev) { // not really a generic manager method, oh well
+		var cellDate = t.cellDate;
+		var cellIsAllDay = t.cellIsAllDay;
+		var hoverListener = t.getHoverListener();
+		var reportDayClick = t.reportDayClick; // this is hacky and sort of weird
+		if (ev.which == 1 && opt('selectable')) { // which==1 means left mouse button
+			unselect(ev);
+			var _mousedownElement = this;
+			var dates;
+			hoverListener.start(function(cell, origCell) { // TODO: maybe put cellDate/cellIsAllDay info in cell
+				clearSelection();
+				if (cell && cellIsAllDay(cell)) {
+					dates = [ cellDate(origCell), cellDate(cell) ].sort(cmp);
+					renderSelection(dates[0], dates[1], true);
+				}else{
+					dates = null;
+				}
+			}, ev);
+			$(document).one('mouseup', function(ev) {
+				hoverListener.stop();
+				if (dates) {
+					if (+dates[0] == +dates[1]) {
+						reportDayClick(dates[0], true, ev);
+					}
+					reportSelection(dates[0], dates[1], true, ev);
+				}
+			});
+		}
+	}
+
+
+}
+ 
+function OverlayManager() {
+	var t = this;
+	
+	
+	// exports
+	t.renderOverlay = renderOverlay;
+	t.clearOverlays = clearOverlays;
+	
+	
+	// locals
+	var usedOverlays = [];
+	var unusedOverlays = [];
+	
+	
+	function renderOverlay(rect, parent) {
+		var e = unusedOverlays.shift();
+		if (!e) {
+			e = $("<div class='fc-cell-overlay' style='position:absolute;z-index:3'/>");
+		}
+		if (e[0].parentNode != parent[0]) {
+			e.appendTo(parent);
+		}
+		usedOverlays.push(e.css(rect).show());
+		return e;
+	}
+	
+
+	function clearOverlays() {
+		var e;
+		while (e = usedOverlays.shift()) {
+			unusedOverlays.push(e.hide().unbind());
+		}
+	}
+
+
+}
+
+function CoordinateGrid(buildFunc) {
+
+	var t = this;
+	var rows;
+	var cols;
+	
+	
+	t.build = function() {
+		rows = [];
+		cols = [];
+		buildFunc(rows, cols);
+	};
+	
+	
+	t.cell = function(x, y) {
+		var rowCnt = rows.length;
+		var colCnt = cols.length;
+		var i, r=-1, c=-1;
+		for (i=0; i<rowCnt; i++) {
+			if (y >= rows[i][0] && y < rows[i][1]) {
+				r = i;
+				break;
+			}
+		}
+		for (i=0; i<colCnt; i++) {
+			if (x >= cols[i][0] && x < cols[i][1]) {
+				c = i;
+				break;
+			}
+		}
+		return (r>=0 && c>=0) ? { row:r, col:c } : null;
+	};
+	
+	
+	t.rect = function(row0, col0, row1, col1, originElement) { // row1,col1 is inclusive
+		var origin = originElement.offset();
+		return {
+			top: rows[row0][0] - origin.top,
+			left: cols[col0][0] - origin.left,
+			width: cols[col1][1] - cols[col0][0],
+			height: rows[row1][1] - rows[row0][0]
+		};
+	};
+
+}
+
+function HoverListener(coordinateGrid) {
+
+
+	var t = this;
+	var bindType;
+	var change;
+	var firstCell;
+	var cell;
+	
+	
+	t.start = function(_change, ev, _bindType) {
+		change = _change;
+		firstCell = cell = null;
+		coordinateGrid.build();
+		mouse(ev);
+		bindType = _bindType || 'mousemove';
+		$(document).bind(bindType, mouse);
+	};
+	
+	
+	function mouse(ev) {
+		var newCell = coordinateGrid.cell(ev.pageX, ev.pageY);
+		if (!newCell != !cell || newCell && (newCell.row != cell.row || newCell.col != cell.col)) {
+			if (newCell) {
+				if (!firstCell) {
+					firstCell = newCell;
+				}
+				change(newCell, firstCell, newCell.row-firstCell.row, newCell.col-firstCell.col);
+			}else{
+				change(newCell, firstCell);
+			}
+			cell = newCell;
+		}
+	}
+	
+	
+	t.stop = function() {
+		$(document).unbind(bindType, mouse);
+		return cell;
+	};
+	
+	
+}
+
+function HorizontalPositionCache(getElement) {
+
+	var t = this,
+		elements = {},
+		lefts = {},
+		rights = {};
+		
+	function e(i) {
+		return elements[i] = elements[i] || getElement(i);
+	}
+	
+	t.left = function(i) {
+		return lefts[i] = lefts[i] === undefined ? e(i).position().left : lefts[i];
+	};
+	
+	t.right = function(i) {
+		return rights[i] = rights[i] === undefined ? t.left(i) + e(i).width() : rights[i];
+	};
+	
+	t.clear = function() {
+		elements = {};
+		lefts = {};
+		rights = {};
+	};
+	
+}
+
+})(jQuery);
Index: trunk/prototype/plugins/fullcalendar/fullcalendar.min.js
===================================================================
--- trunk/prototype/plugins/fullcalendar/fullcalendar.min.js	(revision 5341)
+++ trunk/prototype/plugins/fullcalendar/fullcalendar.min.js	(revision 5341)
@@ -0,0 +1,113 @@
+/*
+
+ FullCalendar v1.5.2
+ http://arshaw.com/fullcalendar/
+
+ Use fullcalendar.css for basic styling.
+ For event drag & drop, requires jQuery UI draggable.
+ For event resizing, requires jQuery UI resizable.
+
+ Copyright (c) 2011 Adam Shaw
+ Dual licensed under the MIT and GPL licenses, located in
+ MIT-LICENSE.txt and GPL-LICENSE.txt respectively.
+
+ Date: Sun Aug 21 22:06:09 2011 -0700
+
+*/
+(function(m,oa){function wb(a){m.extend(true,Ya,a)}function Yb(a,b,e){function d(k){if(E){u();q();ma();S(k)}else f()}function f(){B=b.theme?"ui":"fc";a.addClass("fc");b.isRTL&&a.addClass("fc-rtl");b.theme&&a.addClass("ui-widget");E=m("<div class='fc-content' style='position:relative'/>").prependTo(a);C=new Zb(X,b);(P=C.render())&&a.prepend(P);y(b.defaultView);m(window).resize(na);t()||g()}function g(){setTimeout(function(){!n.start&&t()&&S()},0)}function l(){m(window).unbind("resize",na);C.destroy();
+E.remove();a.removeClass("fc fc-rtl ui-widget")}function j(){return i.offsetWidth!==0}function t(){return m("body")[0].offsetWidth!==0}function y(k){if(!n||k!=n.name){F++;pa();var D=n,Z;if(D){(D.beforeHide||xb)();Za(E,E.height());D.element.hide()}else Za(E,1);E.css("overflow","hidden");if(n=Y[k])n.element.show();else n=Y[k]=new Ja[k](Z=s=m("<div class='fc-view fc-view-"+k+"' style='position:absolute'/>").appendTo(E),X);D&&C.deactivateButton(D.name);C.activateButton(k);S();E.css("overflow","");D&&
+Za(E,1);Z||(n.afterShow||xb)();F--}}function S(k){if(j()){F++;pa();o===oa&&u();var D=false;if(!n.start||k||r<n.start||r>=n.end){n.render(r,k||0);fa(true);D=true}else if(n.sizeDirty){n.clearEvents();fa();D=true}else if(n.eventsDirty){n.clearEvents();D=true}n.sizeDirty=false;n.eventsDirty=false;ga(D);W=a.outerWidth();C.updateTitle(n.title);k=new Date;k>=n.start&&k<n.end?C.disableButton("today"):C.enableButton("today");F--;n.trigger("viewDisplay",i)}}function Q(){q();if(j()){u();fa();pa();n.clearEvents();
+n.renderEvents(J);n.sizeDirty=false}}function q(){m.each(Y,function(k,D){D.sizeDirty=true})}function u(){o=b.contentHeight?b.contentHeight:b.height?b.height-(P?P.height():0)-Sa(E):Math.round(E.width()/Math.max(b.aspectRatio,0.5))}function fa(k){F++;n.setHeight(o,k);if(s){s.css("position","relative");s=null}n.setWidth(E.width(),k);F--}function na(){if(!F)if(n.start){var k=++v;setTimeout(function(){if(k==v&&!F&&j())if(W!=(W=a.outerWidth())){F++;Q();n.trigger("windowResize",i);F--}},200)}else g()}function ga(k){if(!b.lazyFetching||
+ya(n.visStart,n.visEnd))ra();else k&&da()}function ra(){K(n.visStart,n.visEnd)}function sa(k){J=k;da()}function ha(k){da(k)}function da(k){ma();if(j()){n.clearEvents();n.renderEvents(J,k);n.eventsDirty=false}}function ma(){m.each(Y,function(k,D){D.eventsDirty=true})}function ua(k,D,Z){n.select(k,D,Z===oa?true:Z)}function pa(){n&&n.unselect()}function U(){S(-1)}function ca(){S(1)}function ka(){gb(r,-1);S()}function qa(){gb(r,1);S()}function G(){r=new Date;S()}function p(k,D,Z){if(k instanceof Date)r=
+N(k);else yb(r,k,D,Z);S()}function L(k,D,Z){k!==oa&&gb(r,k);D!==oa&&hb(r,D);Z!==oa&&ba(r,Z);S()}function c(){return N(r)}function z(){return n}function H(k,D){if(D===oa)return b[k];if(k=="height"||k=="contentHeight"||k=="aspectRatio"){b[k]=D;Q()}}function T(k,D){if(b[k])return b[k].apply(D||i,Array.prototype.slice.call(arguments,2))}var X=this;X.options=b;X.render=d;X.destroy=l;X.refetchEvents=ra;X.reportEvents=sa;X.reportEventChange=ha;X.rerenderEvents=da;X.changeView=y;X.select=ua;X.unselect=pa;
+X.prev=U;X.next=ca;X.prevYear=ka;X.nextYear=qa;X.today=G;X.gotoDate=p;X.incrementDate=L;X.formatDate=function(k,D){return Oa(k,D,b)};X.formatDates=function(k,D,Z){return ib(k,D,Z,b)};X.getDate=c;X.getView=z;X.option=H;X.trigger=T;$b.call(X,b,e);var ya=X.isFetchNeeded,K=X.fetchEvents,i=a[0],C,P,E,B,n,Y={},W,o,s,v=0,F=0,r=new Date,J=[],M;yb(r,b.year,b.month,b.date);b.droppable&&m(document).bind("dragstart",function(k,D){var Z=k.target,ja=m(Z);if(!ja.parents(".fc").length){var ia=b.dropAccept;if(m.isFunction(ia)?
+ia.call(Z,ja):ja.is(ia)){M=Z;n.dragStart(M,k,D)}}}).bind("dragstop",function(k,D){if(M){n.dragStop(M,k,D);M=null}})}function Zb(a,b){function e(){q=b.theme?"ui":"fc";if(b.header)return Q=m("<table class='fc-header' style='width:100%'/>").append(m("<tr/>").append(f("left")).append(f("center")).append(f("right")))}function d(){Q.remove()}function f(u){var fa=m("<td class='fc-header-"+u+"'/>");(u=b.header[u])&&m.each(u.split(" "),function(na){na>0&&fa.append("<span class='fc-header-space'/>");var ga;
+m.each(this.split(","),function(ra,sa){if(sa=="title"){fa.append("<span class='fc-header-title'><h2>&nbsp;</h2></span>");ga&&ga.addClass(q+"-corner-right");ga=null}else{var ha;if(a[sa])ha=a[sa];else if(Ja[sa])ha=function(){ma.removeClass(q+"-state-hover");a.changeView(sa)};if(ha){ra=b.theme?jb(b.buttonIcons,sa):null;var da=jb(b.buttonText,sa),ma=m("<span class='fc-button fc-button-"+sa+" "+q+"-state-default'><span class='fc-button-inner'><span class='fc-button-content'>"+(ra?"<span class='fc-icon-wrap'><span class='ui-icon ui-icon-"+
+ra+"'/></span>":da)+"</span><span class='fc-button-effect'><span></span></span></span></span>");if(ma){ma.click(function(){ma.hasClass(q+"-state-disabled")||ha()}).mousedown(function(){ma.not("."+q+"-state-active").not("."+q+"-state-disabled").addClass(q+"-state-down")}).mouseup(function(){ma.removeClass(q+"-state-down")}).hover(function(){ma.not("."+q+"-state-active").not("."+q+"-state-disabled").addClass(q+"-state-hover")},function(){ma.removeClass(q+"-state-hover").removeClass(q+"-state-down")}).appendTo(fa);
+ga||ma.addClass(q+"-corner-left");ga=ma}}}});ga&&ga.addClass(q+"-corner-right")});return fa}function g(u){Q.find("h2").html(u)}function l(u){Q.find("span.fc-button-"+u).addClass(q+"-state-active")}function j(u){Q.find("span.fc-button-"+u).removeClass(q+"-state-active")}function t(u){Q.find("span.fc-button-"+u).addClass(q+"-state-disabled")}function y(u){Q.find("span.fc-button-"+u).removeClass(q+"-state-disabled")}var S=this;S.render=e;S.destroy=d;S.updateTitle=g;S.activateButton=l;S.deactivateButton=
+j;S.disableButton=t;S.enableButton=y;var Q=m([]),q}function $b(a,b){function e(c,z){return!ca||c<ca||z>ka}function d(c,z){ca=c;ka=z;L=[];c=++qa;G=z=U.length;for(var H=0;H<z;H++)f(U[H],c)}function f(c,z){g(c,function(H){if(z==qa){if(H){for(var T=0;T<H.length;T++){H[T].source=c;na(H[T])}L=L.concat(H)}G--;G||ua(L)}})}function g(c,z){var H,T=Aa.sourceFetchers,X;for(H=0;H<T.length;H++){X=T[H](c,ca,ka,z);if(X===true)return;else if(typeof X=="object"){g(X,z);return}}if(H=c.events)if(m.isFunction(H)){u();
+H(N(ca),N(ka),function(C){z(C);fa()})}else m.isArray(H)?z(H):z();else if(c.url){var ya=c.success,K=c.error,i=c.complete;H=m.extend({},c.data||{});T=Ta(c.startParam,a.startParam);X=Ta(c.endParam,a.endParam);if(T)H[T]=Math.round(+ca/1E3);if(X)H[X]=Math.round(+ka/1E3);u();m.ajax(m.extend({},ac,c,{data:H,success:function(C){C=C||[];var P=$a(ya,this,arguments);if(m.isArray(P))C=P;z(C)},error:function(){$a(K,this,arguments);z()},complete:function(){$a(i,this,arguments);fa()}}))}else z()}function l(c){if(c=
+j(c)){G++;f(c,qa)}}function j(c){if(m.isFunction(c)||m.isArray(c))c={events:c};else if(typeof c=="string")c={url:c};if(typeof c=="object"){ga(c);U.push(c);return c}}function t(c){U=m.grep(U,function(z){return!ra(z,c)});L=m.grep(L,function(z){return!ra(z.source,c)});ua(L)}function y(c){var z,H=L.length,T,X=ma().defaultEventEnd,ya=c.start-c._start,K=c.end?c.end-(c._end||X(c)):0;for(z=0;z<H;z++){T=L[z];if(T._id==c._id&&T!=c){T.start=new Date(+T.start+ya);T.end=c.end?T.end?new Date(+T.end+K):new Date(+X(T)+
+K):null;T.title=c.title;T.url=c.url;T.allDay=c.allDay;T.className=c.className;T.editable=c.editable;T.color=c.color;T.backgroudColor=c.backgroudColor;T.borderColor=c.borderColor;T.textColor=c.textColor;na(T)}}na(c);ua(L)}function S(c,z){na(c);if(!c.source){if(z){pa.events.push(c);c.source=pa}L.push(c)}ua(L)}function Q(c){if(c){if(!m.isFunction(c)){var z=c+"";c=function(T){return T._id==z}}L=m.grep(L,c,true);for(H=0;H<U.length;H++)if(m.isArray(U[H].events))U[H].events=m.grep(U[H].events,c,true)}else{L=
+[];for(var H=0;H<U.length;H++)if(m.isArray(U[H].events))U[H].events=[]}ua(L)}function q(c){if(m.isFunction(c))return m.grep(L,c);else if(c){c+="";return m.grep(L,function(z){return z._id==c})}return L}function u(){p++||da("loading",null,true)}function fa(){--p||da("loading",null,false)}function na(c){var z=c.source||{},H=Ta(z.ignoreTimezone,a.ignoreTimezone);c._id=c._id||(c.id===oa?"_fc"+bc++:c.id+"");if(c.date){if(!c.start)c.start=c.date;delete c.date}c._start=N(c.start=kb(c.start,H));c.end=kb(c.end,
+H);if(c.end&&c.end<=c.start)c.end=null;c._end=c.end?N(c.end):null;if(c.allDay===oa)c.allDay=Ta(z.allDayDefault,a.allDayDefault);if(c.className){if(typeof c.className=="string")c.className=c.className.split(/\s+/)}else c.className=[]}function ga(c){if(c.className){if(typeof c.className=="string")c.className=c.className.split(/\s+/)}else c.className=[];for(var z=Aa.sourceNormalizers,H=0;H<z.length;H++)z[H](c)}function ra(c,z){return c&&z&&sa(c)==sa(z)}function sa(c){return(typeof c=="object"?c.events||
+c.url:"")||c}var ha=this;ha.isFetchNeeded=e;ha.fetchEvents=d;ha.addEventSource=l;ha.removeEventSource=t;ha.updateEvent=y;ha.renderEvent=S;ha.removeEvents=Q;ha.clientEvents=q;ha.normalizeEvent=na;var da=ha.trigger,ma=ha.getView,ua=ha.reportEvents,pa={events:[]},U=[pa],ca,ka,qa=0,G=0,p=0,L=[];for(ha=0;ha<b.length;ha++)j(b[ha])}function gb(a,b,e){a.setFullYear(a.getFullYear()+b);e||Ka(a);return a}function hb(a,b,e){if(+a){b=a.getMonth()+b;var d=N(a);d.setDate(1);d.setMonth(b);a.setMonth(b);for(e||Ka(a);a.getMonth()!=
+d.getMonth();)a.setDate(a.getDate()+(a<d?1:-1))}return a}function ba(a,b,e){if(+a){b=a.getDate()+b;var d=N(a);d.setHours(9);d.setDate(b);a.setDate(b);e||Ka(a);lb(a,d)}return a}function lb(a,b){if(+a)for(;a.getDate()!=b.getDate();)a.setTime(+a+(a<b?1:-1)*cc)}function xa(a,b){a.setMinutes(a.getMinutes()+b);return a}function Ka(a){a.setHours(0);a.setMinutes(0);a.setSeconds(0);a.setMilliseconds(0);return a}function N(a,b){if(b)return Ka(new Date(+a));return new Date(+a)}function zb(){var a=0,b;do b=new Date(1970,
+a++,1);while(b.getHours());return b}function Fa(a,b,e){for(b=b||1;!a.getDay()||e&&a.getDay()==1||!e&&a.getDay()==6;)ba(a,b);return a}function Ca(a,b){return Math.round((N(a,true)-N(b,true))/Ab)}function yb(a,b,e,d){if(b!==oa&&b!=a.getFullYear()){a.setDate(1);a.setMonth(0);a.setFullYear(b)}if(e!==oa&&e!=a.getMonth()){a.setDate(1);a.setMonth(e)}d!==oa&&a.setDate(d)}function kb(a,b){if(typeof a=="object")return a;if(typeof a=="number")return new Date(a*1E3);if(typeof a=="string"){if(a.match(/^\d+(\.\d+)?$/))return new Date(parseFloat(a)*
+1E3);if(b===oa)b=true;return Bb(a,b)||(a?new Date(a):null)}return null}function Bb(a,b){a=a.match(/^([0-9]{4})(-([0-9]{2})(-([0-9]{2})([T ]([0-9]{2}):([0-9]{2})(:([0-9]{2})(\.([0-9]+))?)?(Z|(([-+])([0-9]{2})(:?([0-9]{2}))?))?)?)?)?$/);if(!a)return null;var e=new Date(a[1],0,1);if(b||!a[13]){b=new Date(a[1],0,1,9,0);if(a[3]){e.setMonth(a[3]-1);b.setMonth(a[3]-1)}if(a[5]){e.setDate(a[5]);b.setDate(a[5])}lb(e,b);a[7]&&e.setHours(a[7]);a[8]&&e.setMinutes(a[8]);a[10]&&e.setSeconds(a[10]);a[12]&&e.setMilliseconds(Number("0."+
+a[12])*1E3);lb(e,b)}else{e.setUTCFullYear(a[1],a[3]?a[3]-1:0,a[5]||1);e.setUTCHours(a[7]||0,a[8]||0,a[10]||0,a[12]?Number("0."+a[12])*1E3:0);if(a[14]){b=Number(a[16])*60+(a[18]?Number(a[18]):0);b*=a[15]=="-"?1:-1;e=new Date(+e+b*60*1E3)}}return e}function mb(a){if(typeof a=="number")return a*60;if(typeof a=="object")return a.getHours()*60+a.getMinutes();if(a=a.match(/(\d+)(?::(\d+))?\s*(\w+)?/)){var b=parseInt(a[1],10);if(a[3]){b%=12;if(a[3].toLowerCase().charAt(0)=="p")b+=12}return b*60+(a[2]?parseInt(a[2],
+10):0)}}function Oa(a,b,e){return ib(a,null,b,e)}function ib(a,b,e,d){d=d||Ya;var f=a,g=b,l,j=e.length,t,y,S,Q="";for(l=0;l<j;l++){t=e.charAt(l);if(t=="'")for(y=l+1;y<j;y++){if(e.charAt(y)=="'"){if(f){Q+=y==l+1?"'":e.substring(l+1,y);l=y}break}}else if(t=="(")for(y=l+1;y<j;y++){if(e.charAt(y)==")"){l=Oa(f,e.substring(l+1,y),d);if(parseInt(l.replace(/\D/,""),10))Q+=l;l=y;break}}else if(t=="[")for(y=l+1;y<j;y++){if(e.charAt(y)=="]"){t=e.substring(l+1,y);l=Oa(f,t,d);if(l!=Oa(g,t,d))Q+=l;l=y;break}}else if(t==
+"{"){f=b;g=a}else if(t=="}"){f=a;g=b}else{for(y=j;y>l;y--)if(S=dc[e.substring(l,y)]){if(f)Q+=S(f,d);l=y-1;break}if(y==l)if(f)Q+=t}}return Q}function Ua(a){return a.end?ec(a.end,a.allDay):ba(N(a.start),1)}function ec(a,b){a=N(a);return b||a.getHours()||a.getMinutes()?ba(a,1):Ka(a)}function fc(a,b){return(b.msLength-a.msLength)*100+(a.event.start-b.event.start)}function Cb(a,b){return a.end>b.start&&a.start<b.end}function nb(a,b,e,d){var f=[],g,l=a.length,j,t,y,S,Q;for(g=0;g<l;g++){j=a[g];t=j.start;
+y=b[g];if(y>e&&t<d){if(t<e){t=N(e);S=false}else{t=t;S=true}if(y>d){y=N(d);Q=false}else{y=y;Q=true}f.push({event:j,start:t,end:y,isStart:S,isEnd:Q,msLength:y-t})}}return f.sort(fc)}function ob(a){var b=[],e,d=a.length,f,g,l,j;for(e=0;e<d;e++){f=a[e];for(g=0;;){l=false;if(b[g])for(j=0;j<b[g].length;j++)if(Cb(b[g][j],f)){l=true;break}if(l)g++;else break}if(b[g])b[g].push(f);else b[g]=[f]}return b}function Db(a,b,e){a.unbind("mouseover").mouseover(function(d){for(var f=d.target,g;f!=this;){g=f;f=f.parentNode}if((f=
+g._fci)!==oa){g._fci=oa;g=b[f];e(g.event,g.element,g);m(d.target).trigger(d)}d.stopPropagation()})}function Va(a,b,e){for(var d=0,f;d<a.length;d++){f=m(a[d]);f.width(Math.max(0,b-pb(f,e)))}}function Eb(a,b,e){for(var d=0,f;d<a.length;d++){f=m(a[d]);f.height(Math.max(0,b-Sa(f,e)))}}function pb(a,b){return gc(a)+hc(a)+(b?ic(a):0)}function gc(a){return(parseFloat(m.curCSS(a[0],"paddingLeft",true))||0)+(parseFloat(m.curCSS(a[0],"paddingRight",true))||0)}function ic(a){return(parseFloat(m.curCSS(a[0],
+"marginLeft",true))||0)+(parseFloat(m.curCSS(a[0],"marginRight",true))||0)}function hc(a){return(parseFloat(m.curCSS(a[0],"borderLeftWidth",true))||0)+(parseFloat(m.curCSS(a[0],"borderRightWidth",true))||0)}function Sa(a,b){return jc(a)+kc(a)+(b?Fb(a):0)}function jc(a){return(parseFloat(m.curCSS(a[0],"paddingTop",true))||0)+(parseFloat(m.curCSS(a[0],"paddingBottom",true))||0)}function Fb(a){return(parseFloat(m.curCSS(a[0],"marginTop",true))||0)+(parseFloat(m.curCSS(a[0],"marginBottom",true))||0)}
+function kc(a){return(parseFloat(m.curCSS(a[0],"borderTopWidth",true))||0)+(parseFloat(m.curCSS(a[0],"borderBottomWidth",true))||0)}function Za(a,b){b=typeof b=="number"?b+"px":b;a.each(function(e,d){d.style.cssText+=";min-height:"+b+";_height:"+b})}function xb(){}function Gb(a,b){return a-b}function Hb(a){return Math.max.apply(Math,a)}function Pa(a){return(a<10?"0":"")+a}function jb(a,b){if(a[b]!==oa)return a[b];b=b.split(/(?=[A-Z])/);for(var e=b.length-1,d;e>=0;e--){d=a[b[e].toLowerCase()];if(d!==
+oa)return d}return a[""]}function Qa(a){return a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#039;").replace(/"/g,"&quot;").replace(/\n/g,"<br />")}function Ib(a){return a.id+"/"+a.className+"/"+a.style.cssText.replace(/(^|;)\s*(top|left|width|height)\s*:[^;]*/ig,"")}function qb(a){a.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})}function ab(a){a.children().removeClass("fc-first fc-last").filter(":first-child").addClass("fc-first").end().filter(":last-child").addClass("fc-last")}
+function rb(a,b){a.each(function(e,d){d.className=d.className.replace(/^fc-\w*/,"fc-"+lc[b.getDay()])})}function Jb(a,b){var e=a.source||{},d=a.color,f=e.color,g=b("eventColor"),l=a.backgroundColor||d||e.backgroundColor||f||b("eventBackgroundColor")||g;d=a.borderColor||d||e.borderColor||f||b("eventBorderColor")||g;a=a.textColor||e.textColor||b("eventTextColor");b=[];l&&b.push("background-color:"+l);d&&b.push("border-color:"+d);a&&b.push("color:"+a);return b.join(";")}function $a(a,b,e){if(m.isFunction(a))a=
+[a];if(a){var d,f;for(d=0;d<a.length;d++)f=a[d].apply(b,e)||f;return f}}function Ta(){for(var a=0;a<arguments.length;a++)if(arguments[a]!==oa)return arguments[a]}function mc(a,b){function e(j,t){if(t){hb(j,t);j.setDate(1)}j=N(j,true);j.setDate(1);t=hb(N(j),1);var y=N(j),S=N(t),Q=f("firstDay"),q=f("weekends")?0:1;if(q){Fa(y);Fa(S,-1,true)}ba(y,-((y.getDay()-Math.max(Q,q)+7)%7));ba(S,(7-S.getDay()+Math.max(Q,q))%7);Q=Math.round((S-y)/(Ab*7));if(f("weekMode")=="fixed"){ba(S,(6-Q)*7);Q=6}d.title=l(j,
+f("titleFormat"));d.start=j;d.end=t;d.visStart=y;d.visEnd=S;g(6,Q,q?5:7,true)}var d=this;d.render=e;sb.call(d,a,b,"month");var f=d.opt,g=d.renderBasic,l=b.formatDate}function nc(a,b){function e(j,t){t&&ba(j,t*7);j=ba(N(j),-((j.getDay()-f("firstDay")+7)%7));t=ba(N(j),7);var y=N(j),S=N(t),Q=f("weekends");if(!Q){Fa(y);Fa(S,-1,true)}d.title=l(y,ba(N(S),-1),f("titleFormat"));d.start=j;d.end=t;d.visStart=y;d.visEnd=S;g(1,1,Q?7:5,false)}var d=this;d.render=e;sb.call(d,a,b,"basicWeek");var f=d.opt,g=d.renderBasic,
+l=b.formatDates}function oc(a,b){function e(j,t){if(t){ba(j,t);f("weekends")||Fa(j,t<0?-1:1)}d.title=l(j,f("titleFormat"));d.start=d.visStart=N(j,true);d.end=d.visEnd=ba(N(d.start),1);g(1,1,1,false)}var d=this;d.render=e;sb.call(d,a,b,"basicDay");var f=d.opt,g=d.renderBasic,l=b.formatDate}function sb(a,b,e){function d(w,I,R,V){v=I;F=R;f();(I=!C)?g(w,V):z();l(I)}function f(){if(k=L("isRTL")){D=-1;Z=F-1}else{D=1;Z=0}ja=L("firstDay");ia=L("weekends")?0:1;la=L("theme")?"ui":"fc";$=L("columnFormat")}function g(w,
+I){var R,V=la+"-widget-header",ea=la+"-widget-content",aa;R="<table class='fc-border-separate' style='width:100%' cellspacing='0'><thead><tr>";for(aa=0;aa<F;aa++)R+="<th class='fc- "+V+"'/>";R+="</tr></thead><tbody>";for(aa=0;aa<w;aa++){R+="<tr class='fc-week"+aa+"'>";for(V=0;V<F;V++)R+="<td class='fc- "+ea+" fc-day"+(aa*F+V)+"'><div>"+(I?"<div class='fc-day-number'/>":"")+"<div class='fc-day-content'><div style='position:relative'>&nbsp;</div></div></div></td>";R+="</tr>"}R+="</tbody></table>";w=
+m(R).appendTo(a);K=w.find("thead");i=K.find("th");C=w.find("tbody");P=C.find("tr");E=C.find("td");B=E.filter(":first-child");n=P.eq(0).find("div.fc-day-content div");ab(K.add(K.find("tr")));ab(P);P.eq(0).addClass("fc-first");y(E);Y=m("<div style='position:absolute;z-index:8;top:0;left:0'/>").appendTo(a)}function l(w){var I=w||v==1,R=p.start.getMonth(),V=Ka(new Date),ea,aa,va;I&&i.each(function(wa,Ga){ea=m(Ga);aa=ca(wa);ea.html(ya(aa,$));rb(ea,aa)});E.each(function(wa,Ga){ea=m(Ga);aa=ca(wa);aa.getMonth()==
+R?ea.removeClass("fc-other-month"):ea.addClass("fc-other-month");+aa==+V?ea.addClass(la+"-state-highlight fc-today"):ea.removeClass(la+"-state-highlight fc-today");ea.find("div.fc-day-number").text(aa.getDate());I&&rb(ea,aa)});P.each(function(wa,Ga){va=m(Ga);if(wa<v){va.show();wa==v-1?va.addClass("fc-last"):va.removeClass("fc-last")}else va.hide()})}function j(w){o=w;w=o-K.height();var I,R,V;if(L("weekMode")=="variable")I=R=Math.floor(w/(v==1?2:6));else{I=Math.floor(w/v);R=w-I*(v-1)}B.each(function(ea,
+aa){if(ea<v){V=m(aa);Za(V.find("> div"),(ea==v-1?R:I)-Sa(V))}})}function t(w){W=w;M.clear();s=Math.floor(W/F);Va(i.slice(0,-1),s)}function y(w){w.click(S).mousedown(X)}function S(w){if(!L("selectable")){var I=parseInt(this.className.match(/fc\-day(\d+)/)[1]);I=ca(I);c("dayClick",this,I,true,w)}}function Q(w,I,R){R&&r.build();R=N(p.visStart);for(var V=ba(N(R),F),ea=0;ea<v;ea++){var aa=new Date(Math.max(R,w)),va=new Date(Math.min(V,I));if(aa<va){var wa;if(k){wa=Ca(va,R)*D+Z+1;aa=Ca(aa,R)*D+Z+1}else{wa=
+Ca(aa,R);aa=Ca(va,R)}y(q(ea,wa,ea,aa-1))}ba(R,7);ba(V,7)}}function q(w,I,R,V){w=r.rect(w,I,R,V,a);return H(w,a)}function u(w){return N(w)}function fa(w,I){Q(w,ba(N(I),1),true)}function na(){T()}function ga(w,I,R){var V=ua(w);c("dayClick",E[V.row*F+V.col],w,I,R)}function ra(w,I){J.start(function(R){T();R&&q(R.row,R.col,R.row,R.col)},I)}function sa(w,I,R){var V=J.stop();T();if(V){V=pa(V);c("drop",w,V,true,I,R)}}function ha(w){return N(w.start)}function da(w){return M.left(w)}function ma(w){return M.right(w)}
+function ua(w){return{row:Math.floor(Ca(w,p.visStart)/7),col:ka(w.getDay())}}function pa(w){return U(w.row,w.col)}function U(w,I){return ba(N(p.visStart),w*7+I*D+Z)}function ca(w){return U(Math.floor(w/F),w%F)}function ka(w){return(w-Math.max(ja,ia)+F)%F*D+Z}function qa(w){return P.eq(w)}function G(){return{left:0,right:W}}var p=this;p.renderBasic=d;p.setHeight=j;p.setWidth=t;p.renderDayOverlay=Q;p.defaultSelectionEnd=u;p.renderSelection=fa;p.clearSelection=na;p.reportDayClick=ga;p.dragStart=ra;p.dragStop=
+sa;p.defaultEventEnd=ha;p.getHoverListener=function(){return J};p.colContentLeft=da;p.colContentRight=ma;p.dayOfWeekCol=ka;p.dateCell=ua;p.cellDate=pa;p.cellIsAllDay=function(){return true};p.allDayRow=qa;p.allDayBounds=G;p.getRowCnt=function(){return v};p.getColCnt=function(){return F};p.getColWidth=function(){return s};p.getDaySegmentContainer=function(){return Y};Kb.call(p,a,b,e);Lb.call(p);Mb.call(p);pc.call(p);var L=p.opt,c=p.trigger,z=p.clearEvents,H=p.renderOverlay,T=p.clearOverlays,X=p.daySelectionMousedown,
+ya=b.formatDate,K,i,C,P,E,B,n,Y,W,o,s,v,F,r,J,M,k,D,Z,ja,ia,la,$;qb(a.addClass("fc-grid"));r=new Nb(function(w,I){var R,V,ea;i.each(function(aa,va){R=m(va);V=R.offset().left;if(aa)ea[1]=V;ea=[V];I[aa]=ea});ea[1]=V+R.outerWidth();P.each(function(aa,va){if(aa<v){R=m(va);V=R.offset().top;if(aa)ea[1]=V;ea=[V];w[aa]=ea}});ea[1]=V+R.outerHeight()});J=new Ob(r);M=new Pb(function(w){return n.eq(w)})}function pc(){function a(U,ca){S(U);ua(e(U),ca)}function b(){Q();ga().empty()}function e(U){var ca=da(),ka=
+ma(),qa=N(g.visStart);ka=ba(N(qa),ka);var G=m.map(U,Ua),p,L,c,z,H,T,X=[];for(p=0;p<ca;p++){L=ob(nb(U,G,qa,ka));for(c=0;c<L.length;c++){z=L[c];for(H=0;H<z.length;H++){T=z[H];T.row=p;T.level=c;X.push(T)}}ba(qa,7);ba(ka,7)}return X}function d(U,ca,ka){t(U)&&f(U,ca);ka.isEnd&&y(U)&&pa(U,ca,ka);q(U,ca)}function f(U,ca){var ka=ra(),qa;ca.draggable({zIndex:9,delay:50,opacity:l("dragOpacity"),revertDuration:l("dragRevertDuration"),start:function(G,p){j("eventDragStart",ca,U,G,p);fa(U,ca);ka.start(function(L,
+c,z,H){ca.draggable("option","revert",!L||!z&&!H);ha();if(L){qa=z*7+H*(l("isRTL")?-1:1);sa(ba(N(U.start),qa),ba(Ua(U),qa))}else qa=0},G,"drag")},stop:function(G,p){ka.stop();ha();j("eventDragStop",ca,U,G,p);if(qa)na(this,U,qa,0,U.allDay,G,p);else{ca.css("filter","");u(U,ca)}}})}var g=this;g.renderEvents=a;g.compileDaySegs=e;g.clearEvents=b;g.bindDaySeg=d;Qb.call(g);var l=g.opt,j=g.trigger,t=g.isEventDraggable,y=g.isEventResizable,S=g.reportEvents,Q=g.reportEventClear,q=g.eventElementHandlers,u=g.showEvents,
+fa=g.hideEvents,na=g.eventDrop,ga=g.getDaySegmentContainer,ra=g.getHoverListener,sa=g.renderDayOverlay,ha=g.clearOverlays,da=g.getRowCnt,ma=g.getColCnt,ua=g.renderDaySegs,pa=g.resizableDayEvent}function qc(a,b){function e(j,t){t&&ba(j,t*7);j=ba(N(j),-((j.getDay()-f("firstDay")+7)%7));t=ba(N(j),7);var y=N(j),S=N(t),Q=f("weekends");if(!Q){Fa(y);Fa(S,-1,true)}d.title=l(y,ba(N(S),-1),f("titleFormat"));d.start=j;d.end=t;d.visStart=y;d.visEnd=S;g(Q?7:5)}var d=this;d.render=e;Rb.call(d,a,b,"agendaWeek");
+var f=d.opt,g=d.renderAgenda,l=b.formatDates}function rc(a,b){function e(j,t){if(t){ba(j,t);f("weekends")||Fa(j,t<0?-1:1)}t=N(j,true);var y=ba(N(t),1);d.title=l(j,f("titleFormat"));d.start=d.visStart=t;d.end=d.visEnd=y;g(1)}var d=this;d.render=e;Rb.call(d,a,b,"agendaDay");var f=d.opt,g=d.renderAgenda,l=b.formatDate}function Rb(a,b,e){function d(h){Ba=h;f();v?P():g();l()}function f(){Wa=i("theme")?"ui":"fc";Sb=i("weekends")?0:1;Tb=i("firstDay");if(Ub=i("isRTL")){Ha=-1;Ia=Ba-1}else{Ha=1;Ia=0}La=mb(i("minTime"));
+bb=mb(i("maxTime"));Vb=i("columnFormat")}function g(){var h=Wa+"-widget-header",O=Wa+"-widget-content",x,A,ta,za,Da,Ea=i("slotMinutes")%15==0;x="<table style='width:100%' class='fc-agenda-days fc-border-separate' cellspacing='0'><thead><tr><th class='fc-agenda-axis "+h+"'>&nbsp;</th>";for(A=0;A<Ba;A++)x+="<th class='fc- fc-col"+A+" "+h+"'/>";x+="<th class='fc-agenda-gutter "+h+"'>&nbsp;</th></tr></thead><tbody><tr><th class='fc-agenda-axis "+h+"'>&nbsp;</th>";for(A=0;A<Ba;A++)x+="<td class='fc- fc-col"+
+A+" "+O+"'><div><div class='fc-day-content'><div style='position:relative'>&nbsp;</div></div></div></td>";x+="<td class='fc-agenda-gutter "+O+"'>&nbsp;</td></tr></tbody></table>";v=m(x).appendTo(a);F=v.find("thead");r=F.find("th").slice(1,-1);J=v.find("tbody");M=J.find("td").slice(0,-1);k=M.find("div.fc-day-content div");D=M.eq(0);Z=D.find("> div");ab(F.add(F.find("tr")));ab(J.add(J.find("tr")));aa=F.find("th:first");va=v.find(".fc-agenda-gutter");ja=m("<div style='position:absolute;z-index:2;left:0;width:100%'/>").appendTo(a);
+if(i("allDaySlot")){ia=m("<div style='position:absolute;z-index:8;top:0;left:0'/>").appendTo(ja);x="<table style='width:100%' class='fc-agenda-allday' cellspacing='0'><tr><th class='"+h+" fc-agenda-axis'>"+i("allDayText")+"</th><td><div class='fc-day-content'><div style='position:relative'/></div></td><th class='"+h+" fc-agenda-gutter'>&nbsp;</th></tr></table>";la=m(x).appendTo(ja);$=la.find("tr");q($.find("td"));aa=aa.add(la.find("th:first"));va=va.add(la.find("th.fc-agenda-gutter"));ja.append("<div class='fc-agenda-divider "+
+h+"'><div class='fc-agenda-divider-inner'/></div>")}else ia=m([]);w=m("<div style='position:absolute;width:100%;overflow-x:hidden;overflow-y:auto'/>").appendTo(ja);I=m("<div style='position:relative;width:100%;overflow:hidden'/>").appendTo(w);R=m("<div style='position:absolute;z-index:8;top:0;left:0'/>").appendTo(I);x="<table class='fc-agenda-slots' style='width:100%' cellspacing='0'><tbody>";ta=zb();za=xa(N(ta),bb);xa(ta,La);for(A=tb=0;ta<za;A++){Da=ta.getMinutes();x+="<tr class='fc-slot"+A+" "+
+(!Da?"":"fc-minor")+"'><th class='fc-agenda-axis "+h+"'>"+(!Ea||!Da?s(ta,i("axisFormat")):"&nbsp;")+"</th><td class='"+O+"'><div style='position:relative'>&nbsp;</div></td></tr>";xa(ta,i("slotMinutes"));tb++}x+="</tbody></table>";V=m(x).appendTo(I);ea=V.find("div:first");u(V.find("td"));aa=aa.add(V.find("th:first"))}function l(){var h,O,x,A,ta=Ka(new Date);for(h=0;h<Ba;h++){A=ua(h);O=r.eq(h);O.html(s(A,Vb));x=M.eq(h);+A==+ta?x.addClass(Wa+"-state-highlight fc-today"):x.removeClass(Wa+"-state-highlight fc-today");
+rb(O.add(x),A)}}function j(h,O){if(h===oa)h=Wb;Wb=h;ub={};var x=J.position().top,A=w.position().top;h=Math.min(h-x,V.height()+A+1);Z.height(h-Sa(D));ja.css("top",x);w.height(h-A-1);Xa=ea.height()+1;O&&y()}function t(h){Ga=h;cb.clear();Ma=0;Va(aa.width("").each(function(O,x){Ma=Math.max(Ma,m(x).outerWidth())}),Ma);h=w[0].clientWidth;if(vb=w.width()-h){Va(va,vb);va.show().prev().removeClass("fc-last")}else va.hide().prev().addClass("fc-last");db=Math.floor((h-Ma)/Ba);Va(r.slice(0,-1),db)}function y(){function h(){w.scrollTop(A)}
+var O=zb(),x=N(O);x.setHours(i("firstHour"));var A=ca(O,x)+1;h();setTimeout(h,0)}function S(){Xb=w.scrollTop()}function Q(){w.scrollTop(Xb)}function q(h){h.click(fa).mousedown(W)}function u(h){h.click(fa).mousedown(H)}function fa(h){if(!i("selectable")){var O=Math.min(Ba-1,Math.floor((h.pageX-v.offset().left-Ma)/db)),x=ua(O),A=this.parentNode.className.match(/fc-slot(\d+)/);if(A){A=parseInt(A[1])*i("slotMinutes");var ta=Math.floor(A/60);x.setHours(ta);x.setMinutes(A%60+La);C("dayClick",M[O],x,false,
+h)}else C("dayClick",M[O],x,true,h)}}function na(h,O,x){x&&Na.build();var A=N(K.visStart);if(Ub){x=Ca(O,A)*Ha+Ia+1;h=Ca(h,A)*Ha+Ia+1}else{x=Ca(h,A);h=Ca(O,A)}x=Math.max(0,x);h=Math.min(Ba,h);x<h&&q(ga(0,x,0,h-1))}function ga(h,O,x,A){h=Na.rect(h,O,x,A,ja);return E(h,ja)}function ra(h,O){for(var x=N(K.visStart),A=ba(N(x),1),ta=0;ta<Ba;ta++){var za=new Date(Math.max(x,h)),Da=new Date(Math.min(A,O));if(za<Da){var Ea=ta*Ha+Ia;Ea=Na.rect(0,Ea,0,Ea,I);za=ca(x,za);Da=ca(x,Da);Ea.top=za;Ea.height=Da-za;u(E(Ea,
+I))}ba(x,1);ba(A,1)}}function sa(h){return cb.left(h)}function ha(h){return cb.right(h)}function da(h){return{row:Math.floor(Ca(h,K.visStart)/7),col:U(h.getDay())}}function ma(h){var O=ua(h.col);h=h.row;i("allDaySlot")&&h--;h>=0&&xa(O,La+h*i("slotMinutes"));return O}function ua(h){return ba(N(K.visStart),h*Ha+Ia)}function pa(h){return i("allDaySlot")&&!h.row}function U(h){return(h-Math.max(Tb,Sb)+Ba)%Ba*Ha+Ia}function ca(h,O){h=N(h,true);if(O<xa(N(h),La))return 0;if(O>=xa(N(h),bb))return V.height();
+h=i("slotMinutes");O=O.getHours()*60+O.getMinutes()-La;var x=Math.floor(O/h),A=ub[x];if(A===oa)A=ub[x]=V.find("tr:eq("+x+") td div")[0].offsetTop;return Math.max(0,Math.round(A-1+Xa*(O%h/h)))}function ka(){return{left:Ma,right:Ga-vb}}function qa(){return $}function G(h){var O=N(h.start);if(h.allDay)return O;return xa(O,i("defaultEventMinutes"))}function p(h,O){if(O)return N(h);return xa(N(h),i("slotMinutes"))}function L(h,O,x){if(x)i("allDaySlot")&&na(h,ba(N(O),1),true);else c(h,O)}function c(h,O){var x=
+i("selectHelper");Na.build();if(x){var A=Ca(h,K.visStart)*Ha+Ia;if(A>=0&&A<Ba){A=Na.rect(0,A,0,A,I);var ta=ca(h,h),za=ca(h,O);if(za>ta){A.top=ta;A.height=za-ta;A.left+=2;A.width-=5;if(m.isFunction(x)){if(h=x(h,O)){A.position="absolute";A.zIndex=8;wa=m(h).css(A).appendTo(I)}}else{A.isStart=true;A.isEnd=true;wa=m(o({title:"",start:h,end:O,className:["fc-select-helper"],editable:false},A));wa.css("opacity",i("dragOpacity"))}if(wa){u(wa);I.append(wa);Va(wa,A.width,true);Eb(wa,A.height,true)}}}}else ra(h,
+O)}function z(){B();if(wa){wa.remove();wa=null}}function H(h){if(h.which==1&&i("selectable")){Y(h);var O;Ra.start(function(x,A){z();if(x&&x.col==A.col&&!pa(x)){A=ma(A);x=ma(x);O=[A,xa(N(A),i("slotMinutes")),x,xa(N(x),i("slotMinutes"))].sort(Gb);c(O[0],O[3])}else O=null},h);m(document).one("mouseup",function(x){Ra.stop();if(O){+O[0]==+O[1]&&T(O[0],false,x);n(O[0],O[3],false,x)}})}}function T(h,O,x){C("dayClick",M[U(h.getDay())],h,O,x)}function X(h,O){Ra.start(function(x){B();if(x)if(pa(x))ga(x.row,
+x.col,x.row,x.col);else{x=ma(x);var A=xa(N(x),i("defaultEventMinutes"));ra(x,A)}},O)}function ya(h,O,x){var A=Ra.stop();B();A&&C("drop",h,ma(A),pa(A),O,x)}var K=this;K.renderAgenda=d;K.setWidth=t;K.setHeight=j;K.beforeHide=S;K.afterShow=Q;K.defaultEventEnd=G;K.timePosition=ca;K.dayOfWeekCol=U;K.dateCell=da;K.cellDate=ma;K.cellIsAllDay=pa;K.allDayRow=qa;K.allDayBounds=ka;K.getHoverListener=function(){return Ra};K.colContentLeft=sa;K.colContentRight=ha;K.getDaySegmentContainer=function(){return ia};
+K.getSlotSegmentContainer=function(){return R};K.getMinMinute=function(){return La};K.getMaxMinute=function(){return bb};K.getBodyContent=function(){return I};K.getRowCnt=function(){return 1};K.getColCnt=function(){return Ba};K.getColWidth=function(){return db};K.getSlotHeight=function(){return Xa};K.defaultSelectionEnd=p;K.renderDayOverlay=na;K.renderSelection=L;K.clearSelection=z;K.reportDayClick=T;K.dragStart=X;K.dragStop=ya;Kb.call(K,a,b,e);Lb.call(K);Mb.call(K);sc.call(K);var i=K.opt,C=K.trigger,
+P=K.clearEvents,E=K.renderOverlay,B=K.clearOverlays,n=K.reportSelection,Y=K.unselect,W=K.daySelectionMousedown,o=K.slotSegHtml,s=b.formatDate,v,F,r,J,M,k,D,Z,ja,ia,la,$,w,I,R,V,ea,aa,va,wa,Ga,Wb,Ma,db,vb,Xa,Xb,Ba,tb,Na,Ra,cb,ub={},Wa,Tb,Sb,Ub,Ha,Ia,La,bb,Vb;qb(a.addClass("fc-agenda"));Na=new Nb(function(h,O){function x(eb){return Math.max(Ea,Math.min(tc,eb))}var A,ta,za;r.each(function(eb,uc){A=m(uc);ta=A.offset().left;if(eb)za[1]=ta;za=[ta];O[eb]=za});za[1]=ta+A.outerWidth();if(i("allDaySlot")){A=
+$;ta=A.offset().top;h[0]=[ta,ta+A.outerHeight()]}for(var Da=I.offset().top,Ea=w.offset().top,tc=Ea+w.outerHeight(),fb=0;fb<tb;fb++)h.push([x(Da+Xa*fb),x(Da+Xa*(fb+1))])});Ra=new Ob(Na);cb=new Pb(function(h){return k.eq(h)})}function sc(){function a(o,s){sa(o);var v,F=o.length,r=[],J=[];for(v=0;v<F;v++)o[v].allDay?r.push(o[v]):J.push(o[v]);if(u("allDaySlot")){L(e(r),s);ma()}g(d(J),s)}function b(){ha();ua().empty();pa().empty()}function e(o){o=ob(nb(o,m.map(o,Ua),q.visStart,q.visEnd));var s,v=o.length,
+F,r,J,M=[];for(s=0;s<v;s++){F=o[s];for(r=0;r<F.length;r++){J=F[r];J.row=0;J.level=s;M.push(J)}}return M}function d(o){var s=z(),v=ka(),F=ca(),r=xa(N(q.visStart),v),J=m.map(o,f),M,k,D,Z,ja,ia,la=[];for(M=0;M<s;M++){k=ob(nb(o,J,r,xa(N(r),F-v)));vc(k);for(D=0;D<k.length;D++){Z=k[D];for(ja=0;ja<Z.length;ja++){ia=Z[ja];ia.col=M;ia.level=D;la.push(ia)}}ba(r,1,true)}return la}function f(o){return o.end?N(o.end):xa(N(o.start),u("defaultEventMinutes"))}function g(o,s){var v,F=o.length,r,J,M,k,D,Z,ja,ia,la,
+$="",w,I,R={},V={},ea=pa(),aa;v=z();if(w=u("isRTL")){I=-1;aa=v-1}else{I=1;aa=0}for(v=0;v<F;v++){r=o[v];J=r.event;M=qa(r.start,r.start);k=qa(r.start,r.end);D=r.col;Z=r.level;ja=r.forward||0;ia=G(D*I+aa);la=p(D*I+aa)-ia;la=Math.min(la-6,la*0.95);D=Z?la/(Z+ja+1):ja?(la/(ja+1)-6)*2:la;Z=ia+la/(Z+ja+1)*Z*I+(w?la-D:0);r.top=M;r.left=Z;r.outerWidth=D;r.outerHeight=k-M;$+=l(J,r)}ea[0].innerHTML=$;w=ea.children();for(v=0;v<F;v++){r=o[v];J=r.event;$=m(w[v]);I=fa("eventRender",J,J,$);if(I===false)$.remove();
+else{if(I&&I!==true){$.remove();$=m(I).css({position:"absolute",top:r.top,left:r.left}).appendTo(ea)}r.element=$;if(J._id===s)t(J,$,r);else $[0]._fci=v;ya(J,$)}}Db(ea,o,t);for(v=0;v<F;v++){r=o[v];if($=r.element){J=R[s=r.key=Ib($[0])];r.vsides=J===oa?(R[s]=Sa($,true)):J;J=V[s];r.hsides=J===oa?(V[s]=pb($,true)):J;s=$.find("div.fc-event-content");if(s.length)r.contentTop=s[0].offsetTop}}for(v=0;v<F;v++){r=o[v];if($=r.element){$[0].style.width=Math.max(0,r.outerWidth-r.hsides)+"px";R=Math.max(0,r.outerHeight-
+r.vsides);$[0].style.height=R+"px";J=r.event;if(r.contentTop!==oa&&R-r.contentTop<10){$.find("div.fc-event-time").text(Y(J.start,u("timeFormat"))+" - "+J.title);$.find("div.fc-event-title").remove()}fa("eventAfterRender",J,J,$)}}}function l(o,s){var v="<",F=o.url,r=Jb(o,u),J=r?" style='"+r+"'":"",M=["fc-event","fc-event-skin","fc-event-vert"];na(o)&&M.push("fc-event-draggable");s.isStart&&M.push("fc-corner-top");s.isEnd&&M.push("fc-corner-bottom");M=M.concat(o.className);if(o.source)M=M.concat(o.source.className||
+[]);v+=F?"a href='"+Qa(o.url)+"'":"div";v+=" class='"+M.join(" ")+"' style='position:absolute;z-index:8;top:"+s.top+"px;left:"+s.left+"px;"+r+"'><div class='fc-event-inner fc-event-skin'"+J+"><div class='fc-event-head fc-event-skin'"+J+"><div class='fc-event-time'>"+Qa(W(o.start,o.end,u("timeFormat")))+"</div></div><div class='fc-event-content'><div class='fc-event-title'>"+Qa(o.title)+"</div></div><div class='fc-event-bg'></div></div>";if(s.isEnd&&ga(o))v+="<div class='ui-resizable-handle ui-resizable-s'>=</div>";
+v+="</"+(F?"a":"div")+">";return v}function j(o,s,v){na(o)&&y(o,s,v.isStart);v.isEnd&&ga(o)&&c(o,s,v);da(o,s)}function t(o,s,v){var F=s.find("div.fc-event-time");na(o)&&S(o,s,F);v.isEnd&&ga(o)&&Q(o,s,F);da(o,s)}function y(o,s,v){function F(){if(!M){s.width(r).height("").draggable("option","grid",null);M=true}}var r,J,M=true,k,D=u("isRTL")?-1:1,Z=U(),ja=H(),ia=T(),la=ka();s.draggable({zIndex:9,opacity:u("dragOpacity","month"),revertDuration:u("dragRevertDuration"),start:function($,w){fa("eventDragStart",
+s,o,$,w);i(o,s);r=s.width();Z.start(function(I,R,V,ea){B();if(I){J=false;k=ea*D;if(I.row)if(v){if(M){s.width(ja-10);Eb(s,ia*Math.round((o.end?(o.end-o.start)/wc:u("defaultEventMinutes"))/u("slotMinutes")));s.draggable("option","grid",[ja,1]);M=false}}else J=true;else{E(ba(N(o.start),k),ba(Ua(o),k));F()}J=J||M&&!k}else{F();J=true}s.draggable("option","revert",J)},$,"drag")},stop:function($,w){Z.stop();B();fa("eventDragStop",s,o,$,w);if(J){F();s.css("filter","");K(o,s)}else{var I=0;M||(I=Math.round((s.offset().top-
+X().offset().top)/ia)*u("slotMinutes")+la-(o.start.getHours()*60+o.start.getMinutes()));C(this,o,k,I,M,$,w)}}})}function S(o,s,v){function F(I){var R=xa(N(o.start),I),V;if(o.end)V=xa(N(o.end),I);v.text(W(R,V,u("timeFormat")))}function r(){if(M){v.css("display","");s.draggable("option","grid",[$,w]);M=false}}var J,M=false,k,D,Z,ja=u("isRTL")?-1:1,ia=U(),la=z(),$=H(),w=T();s.draggable({zIndex:9,scroll:false,grid:[$,w],axis:la==1?"y":false,opacity:u("dragOpacity"),revertDuration:u("dragRevertDuration"),
+start:function(I,R){fa("eventDragStart",s,o,I,R);i(o,s);J=s.position();D=Z=0;ia.start(function(V,ea,aa,va){s.draggable("option","revert",!V);B();if(V){k=va*ja;if(u("allDaySlot")&&!V.row){if(!M){M=true;v.hide();s.draggable("option","grid",null)}E(ba(N(o.start),k),ba(Ua(o),k))}else r()}},I,"drag")},drag:function(I,R){D=Math.round((R.position.top-J.top)/w)*u("slotMinutes");if(D!=Z){M||F(D);Z=D}},stop:function(I,R){var V=ia.stop();B();fa("eventDragStop",s,o,I,R);if(V&&(k||D||M))C(this,o,k,M?0:D,M,I,R);
+else{r();s.css("filter","");s.css(J);F(0);K(o,s)}}})}function Q(o,s,v){var F,r,J=T();s.resizable({handles:{s:"div.ui-resizable-s"},grid:J,start:function(M,k){F=r=0;i(o,s);s.css("z-index",9);fa("eventResizeStart",this,o,M,k)},resize:function(M,k){F=Math.round((Math.max(J,s.height())-k.originalSize.height)/J);if(F!=r){v.text(W(o.start,!F&&!o.end?null:xa(ra(o),u("slotMinutes")*F),u("timeFormat")));r=F}},stop:function(M,k){fa("eventResizeStop",this,o,M,k);if(F)P(this,o,0,u("slotMinutes")*F,M,k);else{s.css("z-index",
+8);K(o,s)}}})}var q=this;q.renderEvents=a;q.compileDaySegs=e;q.clearEvents=b;q.slotSegHtml=l;q.bindDaySeg=j;Qb.call(q);var u=q.opt,fa=q.trigger,na=q.isEventDraggable,ga=q.isEventResizable,ra=q.eventEnd,sa=q.reportEvents,ha=q.reportEventClear,da=q.eventElementHandlers,ma=q.setHeight,ua=q.getDaySegmentContainer,pa=q.getSlotSegmentContainer,U=q.getHoverListener,ca=q.getMaxMinute,ka=q.getMinMinute,qa=q.timePosition,G=q.colContentLeft,p=q.colContentRight,L=q.renderDaySegs,c=q.resizableDayEvent,z=q.getColCnt,
+H=q.getColWidth,T=q.getSlotHeight,X=q.getBodyContent,ya=q.reportEventElement,K=q.showEvents,i=q.hideEvents,C=q.eventDrop,P=q.eventResize,E=q.renderDayOverlay,B=q.clearOverlays,n=q.calendar,Y=n.formatDate,W=n.formatDates}function vc(a){var b,e,d,f,g,l;for(b=a.length-1;b>0;b--){f=a[b];for(e=0;e<f.length;e++){g=f[e];for(d=0;d<a[b-1].length;d++){l=a[b-1][d];if(Cb(g,l))l.forward=Math.max(l.forward||0,(g.forward||0)+1)}}}}function Kb(a,b,e){function d(G,p){G=qa[G];if(typeof G=="object")return jb(G,p||e);
+return G}function f(G,p){return b.trigger.apply(b,[G,p||da].concat(Array.prototype.slice.call(arguments,2),[da]))}function g(G){return j(G)&&!d("disableDragging")}function l(G){return j(G)&&!d("disableResizing")}function j(G){return Ta(G.editable,(G.source||{}).editable,d("editable"))}function t(G){U={};var p,L=G.length,c;for(p=0;p<L;p++){c=G[p];if(U[c._id])U[c._id].push(c);else U[c._id]=[c]}}function y(G){return G.end?N(G.end):ma(G)}function S(G,p){ca.push(p);if(ka[G._id])ka[G._id].push(p);else ka[G._id]=
+[p]}function Q(){ca=[];ka={}}function q(G,p){p.click(function(L){if(!p.hasClass("ui-draggable-dragging")&&!p.hasClass("ui-resizable-resizing"))return f("eventClick",this,G,L)}).hover(function(L){f("eventMouseover",this,G,L)},function(L){f("eventMouseout",this,G,L)})}function u(G,p){na(G,p,"show")}function fa(G,p){na(G,p,"hide")}function na(G,p,L){G=ka[G._id];var c,z=G.length;for(c=0;c<z;c++)if(!p||G[c][0]!=p[0])G[c][L]()}function ga(G,p,L,c,z,H,T){var X=p.allDay,ya=p._id;sa(U[ya],L,c,z);f("eventDrop",
+G,p,L,c,z,function(){sa(U[ya],-L,-c,X);pa(ya)},H,T);pa(ya)}function ra(G,p,L,c,z,H){var T=p._id;ha(U[T],L,c);f("eventResize",G,p,L,c,function(){ha(U[T],-L,-c);pa(T)},z,H);pa(T)}function sa(G,p,L,c){L=L||0;for(var z,H=G.length,T=0;T<H;T++){z=G[T];if(c!==oa)z.allDay=c;xa(ba(z.start,p,true),L);if(z.end)z.end=xa(ba(z.end,p,true),L);ua(z,qa)}}function ha(G,p,L){L=L||0;for(var c,z=G.length,H=0;H<z;H++){c=G[H];c.end=xa(ba(y(c),p,true),L);ua(c,qa)}}var da=this;da.element=a;da.calendar=b;da.name=e;da.opt=
+d;da.trigger=f;da.isEventDraggable=g;da.isEventResizable=l;da.reportEvents=t;da.eventEnd=y;da.reportEventElement=S;da.reportEventClear=Q;da.eventElementHandlers=q;da.showEvents=u;da.hideEvents=fa;da.eventDrop=ga;da.eventResize=ra;var ma=da.defaultEventEnd,ua=b.normalizeEvent,pa=b.reportEventChange,U={},ca=[],ka={},qa=b.options}function Qb(){function a(i,C){var P=z(),E=pa(),B=U(),n=0,Y,W,o=i.length,s,v;P[0].innerHTML=e(i);d(i,P.children());f(i);g(i,P,C);l(i);j(i);t(i);C=y();for(P=0;P<E;P++){Y=[];for(W=
+0;W<B;W++)Y[W]=0;for(;n<o&&(s=i[n]).row==P;){W=Hb(Y.slice(s.startCol,s.endCol));s.top=W;W+=s.outerHeight;for(v=s.startCol;v<s.endCol;v++)Y[v]=W;n++}C[P].height(Hb(Y))}Q(i,S(C))}function b(i,C,P){var E=m("<div/>"),B=z(),n=i.length,Y;E[0].innerHTML=e(i);E=E.children();B.append(E);d(i,E);l(i);j(i);t(i);Q(i,S(y()));E=[];for(B=0;B<n;B++)if(Y=i[B].element){i[B].row===C&&Y.css("top",P);E.push(Y[0])}return m(E)}function e(i){var C=fa("isRTL"),P,E=i.length,B,n,Y,W;P=ka();var o=P.left,s=P.right,v,F,r,J,M,k=
+"";for(P=0;P<E;P++){B=i[P];n=B.event;W=["fc-event","fc-event-skin","fc-event-hori"];ga(n)&&W.push("fc-event-draggable");if(C){B.isStart&&W.push("fc-corner-right");B.isEnd&&W.push("fc-corner-left");v=p(B.end.getDay()-1);F=p(B.start.getDay());r=B.isEnd?qa(v):o;J=B.isStart?G(F):s}else{B.isStart&&W.push("fc-corner-left");B.isEnd&&W.push("fc-corner-right");v=p(B.start.getDay());F=p(B.end.getDay()-1);r=B.isStart?qa(v):o;J=B.isEnd?G(F):s}W=W.concat(n.className);if(n.source)W=W.concat(n.source.className||
+[]);Y=n.url;M=Jb(n,fa);k+=Y?"<a href='"+Qa(Y)+"'":"<div";k+=" class='"+W.join(" ")+"' style='position:absolute;z-index:8;left:"+r+"px;"+M+"'><div class='fc-event-inner fc-event-skin'"+(M?" style='"+M+"'":"")+">";if(!n.allDay&&B.isStart)k+="<span class='fc-event-time'>"+Qa(T(n.start,n.end,fa("timeFormat")))+"</span>";k+="<span class='fc-event-title'>"+Qa(n.title)+"</span></div>";if(B.isEnd&&ra(n))k+="<div class='ui-resizable-handle ui-resizable-"+(C?"w":"e")+"'>&nbsp;&nbsp;&nbsp;</div>";k+="</"+(Y?
+"a":"div")+">";B.left=r;B.outerWidth=J-r;B.startCol=v;B.endCol=F+1}return k}function d(i,C){var P,E=i.length,B,n,Y;for(P=0;P<E;P++){B=i[P];n=B.event;Y=m(C[P]);n=na("eventRender",n,n,Y);if(n===false)Y.remove();else{if(n&&n!==true){n=m(n).css({position:"absolute",left:B.left});Y.replaceWith(n);Y=n}B.element=Y}}}function f(i){var C,P=i.length,E,B;for(C=0;C<P;C++){E=i[C];(B=E.element)&&ha(E.event,B)}}function g(i,C,P){var E,B=i.length,n,Y,W;for(E=0;E<B;E++){n=i[E];if(Y=n.element){W=n.event;if(W._id===
+P)H(W,Y,n);else Y[0]._fci=E}}Db(C,i,H)}function l(i){var C,P=i.length,E,B,n,Y,W={};for(C=0;C<P;C++){E=i[C];if(B=E.element){n=E.key=Ib(B[0]);Y=W[n];if(Y===oa)Y=W[n]=pb(B,true);E.hsides=Y}}}function j(i){var C,P=i.length,E,B;for(C=0;C<P;C++){E=i[C];if(B=E.element)B[0].style.width=Math.max(0,E.outerWidth-E.hsides)+"px"}}function t(i){var C,P=i.length,E,B,n,Y,W={};for(C=0;C<P;C++){E=i[C];if(B=E.element){n=E.key;Y=W[n];if(Y===oa)Y=W[n]=Fb(B);E.outerHeight=B[0].offsetHeight+Y}}}function y(){var i,C=pa(),
+P=[];for(i=0;i<C;i++)P[i]=ca(i).find("td:first div.fc-day-content > div");return P}function S(i){var C,P=i.length,E=[];for(C=0;C<P;C++)E[C]=i[C][0].offsetTop;return E}function Q(i,C){var P,E=i.length,B,n;for(P=0;P<E;P++){B=i[P];if(n=B.element){n[0].style.top=C[B.row]+(B.top||0)+"px";B=B.event;na("eventAfterRender",B,B,n)}}}function q(i,C,P){var E=fa("isRTL"),B=E?"w":"e",n=C.find("div.ui-resizable-"+B),Y=false;qb(C);C.mousedown(function(W){W.preventDefault()}).click(function(W){if(Y){W.preventDefault();
+W.stopImmediatePropagation()}});n.mousedown(function(W){function o(ia){na("eventResizeStop",this,i,ia);m("body").css("cursor","");s.stop();ya();k&&ua(this,i,k,0,ia);setTimeout(function(){Y=false},0)}if(W.which==1){Y=true;var s=u.getHoverListener(),v=pa(),F=U(),r=E?-1:1,J=E?F-1:0,M=C.css("top"),k,D,Z=m.extend({},i),ja=L(i.start);K();m("body").css("cursor",B+"-resize").one("mouseup",o);na("eventResizeStart",this,i,W);s.start(function(ia,la){if(ia){var $=Math.max(ja.row,ia.row);ia=ia.col;if(v==1)$=0;
+if($==ja.row)ia=E?Math.min(ja.col,ia):Math.max(ja.col,ia);k=$*7+ia*r+J-(la.row*7+la.col*r+J);la=ba(sa(i),k,true);if(k){Z.end=la;$=D;D=b(c([Z]),P.row,M);D.find("*").css("cursor",B+"-resize");$&&$.remove();ma(i)}else if(D){da(i);D.remove();D=null}ya();X(i.start,ba(N(la),1))}},W)}})}var u=this;u.renderDaySegs=a;u.resizableDayEvent=q;var fa=u.opt,na=u.trigger,ga=u.isEventDraggable,ra=u.isEventResizable,sa=u.eventEnd,ha=u.reportEventElement,da=u.showEvents,ma=u.hideEvents,ua=u.eventResize,pa=u.getRowCnt,
+U=u.getColCnt,ca=u.allDayRow,ka=u.allDayBounds,qa=u.colContentLeft,G=u.colContentRight,p=u.dayOfWeekCol,L=u.dateCell,c=u.compileDaySegs,z=u.getDaySegmentContainer,H=u.bindDaySeg,T=u.calendar.formatDates,X=u.renderDayOverlay,ya=u.clearOverlays,K=u.clearSelection}function Mb(){function a(Q,q,u){b();q||(q=j(Q,u));t(Q,q,u);e(Q,q,u)}function b(Q){if(S){S=false;y();l("unselect",null,Q)}}function e(Q,q,u,fa){S=true;l("select",null,Q,q,u,fa)}function d(Q){var q=f.cellDate,u=f.cellIsAllDay,fa=f.getHoverListener(),
+na=f.reportDayClick;if(Q.which==1&&g("selectable")){b(Q);var ga;fa.start(function(ra,sa){y();if(ra&&u(ra)){ga=[q(sa),q(ra)].sort(Gb);t(ga[0],ga[1],true)}else ga=null},Q);m(document).one("mouseup",function(ra){fa.stop();if(ga){+ga[0]==+ga[1]&&na(ga[0],true,ra);e(ga[0],ga[1],true,ra)}})}}var f=this;f.select=a;f.unselect=b;f.reportSelection=e;f.daySelectionMousedown=d;var g=f.opt,l=f.trigger,j=f.defaultSelectionEnd,t=f.renderSelection,y=f.clearSelection,S=false;g("selectable")&&g("unselectAuto")&&m(document).mousedown(function(Q){var q=
+g("unselectCancel");if(q)if(m(Q.target).parents(q).length)return;b(Q)})}function Lb(){function a(g,l){var j=f.shift();j||(j=m("<div class='fc-cell-overlay' style='position:absolute;z-index:3'/>"));j[0].parentNode!=l[0]&&j.appendTo(l);d.push(j.css(g).show());return j}function b(){for(var g;g=d.shift();)f.push(g.hide().unbind())}var e=this;e.renderOverlay=a;e.clearOverlays=b;var d=[],f=[]}function Nb(a){var b=this,e,d;b.build=function(){e=[];d=[];a(e,d)};b.cell=function(f,g){var l=e.length,j=d.length,
+t,y=-1,S=-1;for(t=0;t<l;t++)if(g>=e[t][0]&&g<e[t][1]){y=t;break}for(t=0;t<j;t++)if(f>=d[t][0]&&f<d[t][1]){S=t;break}return y>=0&&S>=0?{row:y,col:S}:null};b.rect=function(f,g,l,j,t){t=t.offset();return{top:e[f][0]-t.top,left:d[g][0]-t.left,width:d[j][1]-d[g][0],height:e[l][1]-e[f][0]}}}function Ob(a){function b(j){j=a.cell(j.pageX,j.pageY);if(!j!=!l||j&&(j.row!=l.row||j.col!=l.col)){if(j){g||(g=j);f(j,g,j.row-g.row,j.col-g.col)}else f(j,g);l=j}}var e=this,d,f,g,l;e.start=function(j,t,y){f=j;g=l=null;
+a.build();b(t);d=y||"mousemove";m(document).bind(d,b)};e.stop=function(){m(document).unbind(d,b);return l}}function Pb(a){function b(l){return d[l]=d[l]||a(l)}var e=this,d={},f={},g={};e.left=function(l){return f[l]=f[l]===oa?b(l).position().left:f[l]};e.right=function(l){return g[l]=g[l]===oa?e.left(l)+b(l).width():g[l]};e.clear=function(){d={};f={};g={}}}var Ya={defaultView:"month",aspectRatio:1.35,header:{left:"title",center:"",right:"today prev,next"},weekends:true,allDayDefault:true,ignoreTimezone:true,
+lazyFetching:true,startParam:"start",endParam:"end",titleFormat:{month:"MMMM yyyy",week:"MMM d[ yyyy]{ '&#8212;'[ MMM] d yyyy}",day:"dddd, MMM d, yyyy"},columnFormat:{month:"ddd",week:"ddd M/d",day:"dddd M/d"},timeFormat:{"":"h(:mm)t"},isRTL:false,firstDay:0,monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday",
+"Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],buttonText:{prev:"&nbsp;&#9668;&nbsp;",next:"&nbsp;&#9658;&nbsp;",prevYear:"&nbsp;&lt;&lt;&nbsp;",nextYear:"&nbsp;&gt;&gt;&nbsp;",today:"today",month:"month",week:"week",day:"day"},theme:false,buttonIcons:{prev:"circle-triangle-w",next:"circle-triangle-e"},unselectAuto:true,dropAccept:"*"},xc={header:{left:"next,prev today",center:"",right:"title"},buttonText:{prev:"&nbsp;&#9658;&nbsp;",next:"&nbsp;&#9668;&nbsp;",
+prevYear:"&nbsp;&gt;&gt;&nbsp;",nextYear:"&nbsp;&lt;&lt;&nbsp;"},buttonIcons:{prev:"circle-triangle-e",next:"circle-triangle-w"}},Aa=m.fullCalendar={version:"1.5.2"},Ja=Aa.views={};m.fn.fullCalendar=function(a){if(typeof a=="string"){var b=Array.prototype.slice.call(arguments,1),e;this.each(function(){var f=m.data(this,"fullCalendar");if(f&&m.isFunction(f[a])){f=f[a].apply(f,b);if(e===oa)e=f;a=="destroy"&&m.removeData(this,"fullCalendar")}});if(e!==oa)return e;return this}var d=a.eventSources||[];
+delete a.eventSources;if(a.events){d.push(a.events);delete a.events}a=m.extend(true,{},Ya,a.isRTL||a.isRTL===oa&&Ya.isRTL?xc:{},a);this.each(function(f,g){f=m(g);g=new Yb(f,a,d);f.data("fullCalendar",g);g.render()});return this};Aa.sourceNormalizers=[];Aa.sourceFetchers=[];var ac={dataType:"json",cache:false},bc=1;Aa.addDays=ba;Aa.cloneDate=N;Aa.parseDate=kb;Aa.parseISO8601=Bb;Aa.parseTime=mb;Aa.formatDate=Oa;Aa.formatDates=ib;var lc=["sun","mon","tue","wed","thu","fri","sat"],Ab=864E5,cc=36E5,wc=
+6E4,dc={s:function(a){return a.getSeconds()},ss:function(a){return Pa(a.getSeconds())},m:function(a){return a.getMinutes()},mm:function(a){return Pa(a.getMinutes())},h:function(a){return a.getHours()%12||12},hh:function(a){return Pa(a.getHours()%12||12)},H:function(a){return a.getHours()},HH:function(a){return Pa(a.getHours())},d:function(a){return a.getDate()},dd:function(a){return Pa(a.getDate())},ddd:function(a,b){return b.dayNamesShort[a.getDay()]},dddd:function(a,b){return b.dayNames[a.getDay()]},
+M:function(a){return a.getMonth()+1},MM:function(a){return Pa(a.getMonth()+1)},MMM:function(a,b){return b.monthNamesShort[a.getMonth()]},MMMM:function(a,b){return b.monthNames[a.getMonth()]},yy:function(a){return(a.getFullYear()+"").substring(2)},yyyy:function(a){return a.getFullYear()},t:function(a){return a.getHours()<12?"a":"p"},tt:function(a){return a.getHours()<12?"am":"pm"},T:function(a){return a.getHours()<12?"A":"P"},TT:function(a){return a.getHours()<12?"AM":"PM"},u:function(a){return Oa(a,
+"yyyy-MM-dd'T'HH:mm:ss'Z'")},S:function(a){a=a.getDate();if(a>10&&a<20)return"th";return["st","nd","rd"][a%10-1]||"th"}};Aa.applyAll=$a;Ja.month=mc;Ja.basicWeek=nc;Ja.basicDay=oc;wb({weekMode:"fixed"});Ja.agendaWeek=qc;Ja.agendaDay=rc;wb({allDaySlot:true,allDayText:"all-day",firstHour:6,slotMinutes:30,defaultEventMinutes:120,axisFormat:"h(:mm)tt",timeFormat:{agenda:"h:mm{ - h:mm}"},dragOpacity:{agenda:0.5},minTime:0,maxTime:24})})(jQuery);
Index: trunk/prototype/plugins/fullcalendar/fullcalendar.print.css
===================================================================
--- trunk/prototype/plugins/fullcalendar/fullcalendar.print.css	(revision 5341)
+++ trunk/prototype/plugins/fullcalendar/fullcalendar.print.css	(revision 5341)
@@ -0,0 +1,61 @@
+/*
+ * FullCalendar v1.5.2 Print Stylesheet
+ *
+ * Include this stylesheet on your page to get a more printer-friendly calendar.
+ * When including this stylesheet, use the media='print' attribute of the <link> tag.
+ * Make sure to include this stylesheet IN ADDITION to the regular fullcalendar.css.
+ *
+ * Copyright (c) 2011 Adam Shaw
+ * Dual licensed under the MIT and GPL licenses, located in
+ * MIT-LICENSE.txt and GPL-LICENSE.txt respectively.
+ *
+ * Date: Sun Aug 21 22:06:09 2011 -0700
+ *
+ */
+ 
+ 
+ /* Events
+-----------------------------------------------------*/
+ 
+.fc-event-skin {
+	background: none !important;
+	color: #000 !important;
+	}
+	
+/* horizontal events */
+	
+.fc-event-hori {
+	border-width: 0 0 1px 0 !important;
+	border-bottom-style: dotted !important;
+	border-bottom-color: #000 !important;
+	padding: 1px 0 0 0 !important;
+	}
+	
+.fc-event-hori .fc-event-inner {
+	border-width: 0 !important;
+	padding: 0 1px !important;
+	}
+	
+/* vertical events */
+	
+.fc-event-vert {
+	border-width: 0 0 0 1px !important;
+	border-left-style: dotted !important;
+	border-left-color: #000 !important;
+	padding: 0 1px 0 0 !important;
+	}
+	
+.fc-event-vert .fc-event-inner {
+	border-width: 0 !important;
+	padding: 1px 0 !important;
+	}
+	
+.fc-event-bg {
+	display: none !important;
+	}
+	
+.fc-event .ui-resizable-handle {
+	display: none !important;
+	}
+	
+	
Index: trunk/prototype/plugins/store/jquery.store.js
===================================================================
--- trunk/prototype/plugins/store/jquery.store.js	(revision 5295)
+++ trunk/prototype/plugins/store/jquery.store.js	(revision 5295)
@@ -0,0 +1,424 @@
+/*
+ * jQuery store - Plugin for persistent data storage using localStorage, userData (and window.name)
+ * 
+ * Authors: Rodney Rehm
+ * Web: http://medialize.github.com/jQuery-store/
+ * 
+ * Licensed under the MIT License:
+ *   http://www.opensource.org/licenses/mit-license.php
+ *
+ */
+
+/**********************************************************************************
+ * INITIALIZE EXAMPLES:
+ **********************************************************************************
+ * 	// automatically detect best suited storage driver and use default serializers
+ *	$.storage = new $.store();
+ *	// optionally initialize with specific driver and or serializers
+ *	$.storage = new $.store( [driver] [, serializers] );
+ *		driver		can be the key (e.g. "windowName") or the driver-object itself
+ *		serializers	can be a list of named serializers like $.store.serializers
+ **********************************************************************************
+ * USAGE EXAMPLES:
+ **********************************************************************************
+ *	$.storage.get( key );			// retrieves a value
+ *	$.storage.set( key, value );	// saves a value
+ *	$.storage.del( key );			// deletes a value
+ *	$.storage.flush();				// deletes aall values
+ **********************************************************************************
+ */
+
+(function($,undefined){
+
+/**********************************************************************************
+ * $.store base and convinience accessor
+ **********************************************************************************/
+
+$.store = function( driver, serializers )
+{
+	var that = this;
+	
+	if( typeof driver == 'string' )
+	{
+		if( $.store.drivers[ driver ] )
+			this.driver = $.store.drivers[ driver ];
+		else
+			throw new Error( 'Unknown driver '+ driver );
+	}
+	else if( typeof driver == 'object' )
+	{
+		var invalidAPI = !$.isFunction( driver.init )
+			|| !$.isFunction( driver.get )
+			|| !$.isFunction( driver.set )
+			|| !$.isFunction( driver.del )
+			|| !$.isFunction( driver.flush );
+			
+		if( invalidAPI )
+			throw new Error( 'The specified driver does not fulfill the API requirements' );
+		
+		this.driver = driver;
+	}
+	else
+	{
+		// detect and initialize storage driver
+		$.each( $.store.drivers, function()
+		{
+			// skip unavailable drivers
+			if( !$.isFunction( this.available ) || !this.available() )
+				return true; // continue;
+			
+			that.driver = this;
+			if( that.driver.init() === false )
+			{
+				that.driver = null;
+				return true; // continue;
+			}
+			
+			return false; // break;
+		});
+	}
+	
+	// use default serializers if not told otherwise
+	if( !serializers )
+		serializers = $.store.serializers;
+	
+	// intialize serializers
+	this.serializers = {};
+	$.each( serializers, function( key, serializer )
+	{
+		// skip invalid processors
+		if( !$.isFunction( this.init ) )
+			return true; // continue;
+		
+		that.serializers[ key ] = this;
+		that.serializers[ key ].init( that.encoders, that.decoders );
+	});
+};
+
+
+/**********************************************************************************
+ * $.store API
+ **********************************************************************************/
+
+$.extend( $.store.prototype, {
+	get: function( key )
+	{
+		var value = this.driver.get( key );
+		return this.driver.encodes ? value : this.unserialize( value );
+	},
+	set: function( key, value )
+	{
+		this.driver.set( key, this.driver.encodes ? value : this.serialize( value ) );
+	},
+	del: function( key )
+	{
+		this.driver.del( key );
+	},
+	flush: function()
+	{
+		this.driver.flush();
+	},
+	driver : undefined,
+	encoders : [],
+	decoders : [],
+	serialize: function( value )
+	{
+		var that = this;
+		
+		$.each( this.encoders, function()
+		{
+			var serializer = that.serializers[ this + "" ];
+			if( !serializer || !serializer.encode )
+				return true; // continue;
+			try
+			{
+				value = serializer.encode( value );
+			}
+			catch( e ){}
+		});
+
+		return value;
+	},
+	unserialize: function( value )
+	{
+		var that = this;
+		if( !value )
+			return value;
+		
+		$.each( this.decoders, function()
+		{
+			var serializer = that.serializers[ this + "" ];
+			if( !serializer || !serializer.decode )
+				return true; // continue;
+
+			value = serializer.decode( value );
+		});
+
+		return value;
+	}
+});
+
+
+/**********************************************************************************
+ * $.store drivers
+ **********************************************************************************/
+
+$.store.drivers = {
+	// Firefox 3.5, Safari 4.0, Chrome 5, Opera 10.5, IE8
+	'localStorage': {
+		// see https://developer.mozilla.org/en/dom/storage#localStorage
+		ident: "$.store.drivers.localStorage",
+		scope: 'browser',
+		available: function()
+		{
+			try
+			{
+				return !!window.localStorage;
+			}
+			catch(e)
+			{
+				// Firefox won't allow localStorage if cookies are disabled
+				return false;
+			}
+		},
+		init: $.noop,
+		get: function( key )
+		{
+			return window.localStorage.getItem( key );
+		},
+		set: function( key, value )
+		{
+			window.localStorage.setItem( key, value );
+		},
+		del: function( key )
+		{
+			window.localStorage.removeItem( key );
+		},
+		flush: function()
+		{
+			window.localStorage.clear();
+		}
+	},
+	
+	// IE6, IE7
+	'userData': {
+		// see http://msdn.microsoft.com/en-us/library/ms531424.aspx
+		ident: "$.store.drivers.userData",
+		element: null,
+		nodeName: 'userdatadriver',
+		scope: 'browser',
+		initialized: false,
+		available: function()
+		{
+			try
+			{
+				return !!( document.documentElement && document.documentElement.addBehavior );
+			}
+			catch(e)
+			{
+				return false;
+			}
+		},
+		init: function()
+		{
+			// $.store can only utilize one userData store at a time, thus avoid duplicate initialization
+			if( this.initialized )
+				return;
+			
+			try
+			{
+				// Create a non-existing element and append it to the root element (html)
+				this.element = document.createElement( this.nodeName );
+				document.documentElement.insertBefore( this.element, document.getElementsByTagName('title')[0] );
+				// Apply userData behavior
+				this.element.addBehavior( "#default#userData" );
+				this.initialized = true;
+			}
+			catch( e )
+			{
+				return false; 
+			}
+		},
+		get: function( key )
+		{
+			this.element.load( this.nodeName );
+			return this.element.getAttribute( key );
+		},
+		set: function( key, value )
+		{
+			this.element.setAttribute( key, value );
+			this.element.save( this.nodeName );
+		},
+		del: function( key )
+		{
+			this.element.removeAttribute( key );
+			this.element.save( this.nodeName );
+			
+		},
+		flush: function()
+		{
+			// flush by expiration
+			this.element.expires = (new Date).toUTCString();
+			this.element.save( this.nodeName );
+		}
+	},
+	
+	// most other browsers
+	'windowName': {
+		ident: "$.store.drivers.windowName",
+		scope: 'window',
+		cache: {},
+		encodes: true,
+		available: function()
+		{
+			return true;
+		},
+		init: function()
+		{
+			this.load();
+		},
+		save: function()
+		{
+			window.name = $.store.serializers.json.encode( this.cache );
+		},
+		load: function()
+		{
+			try
+			{
+				this.cache = $.store.serializers.json.decode( window.name + "" );
+				if( typeof this.cache != "object" )
+					this.cache = {};
+			}
+			catch(e)
+			{
+				this.cache = {};
+				window.name = "{}";
+			}
+		},
+		get: function( key )
+		{
+			return this.cache[ key ];
+		},
+		set: function( key, value )
+		{
+			this.cache[ key ] = value;
+			this.save();
+		},
+		del: function( key )
+		{
+			try
+			{
+				delete this.cache[ key ];
+			}
+			catch(e)
+			{
+				this.cache[ key ] = undefined;
+			}
+			
+			this.save();
+		},
+		flush: function()
+		{
+			window.name = "{}";
+		}
+	}
+};
+
+/**********************************************************************************
+ * $.store serializers
+ **********************************************************************************/
+
+$.store.serializers = {
+	
+	'json': {
+		ident: "$.store.serializers.json",
+		init: function( encoders, decoders )
+		{
+			encoders.push( "json" );
+			decoders.push( "json" );
+		},
+		encode: JSON.stringify,
+		decode: JSON.parse
+	},
+	
+	// TODO: html serializer
+	// 'html' : {},
+	
+	'xml': {
+		ident: "$.store.serializers.xml",
+		init: function( encoders, decoders )
+		{
+			encoders.unshift( "xml" );
+			decoders.push( "xml" );
+		},
+		
+		// wouldn't be necessary if jQuery exposed this function
+		isXML: function( value )
+		{
+			var documentElement = ( value ? value.ownerDocument || value : 0 ).documentElement;
+			return documentElement ? documentElement.nodeName.toLowerCase() !== "html" : false;
+		},
+
+		// encodes a XML node to string (taken from $.jStorage, MIT License)
+		encode: function( value )
+		{
+			if( !value || value._serialized || !this.isXML( value ) )
+				return value;
+
+			var _value = { _serialized: this.ident, value: value };
+			
+			try
+			{
+				// Mozilla, Webkit, Opera
+				_value.value = new XMLSerializer().serializeToString( value );
+				return _value;
+			}
+			catch(E1)
+			{
+				try
+				{
+					// Internet Explorer
+					_value.value = value.xml;
+					return _value;
+				}
+				catch(E2){}
+			}
+			
+			return value;
+		},
+		
+		// decodes a XML node from string (taken from $.jStorage, MIT License)
+		decode: function( value )
+		{
+			if( !value || !value._serialized || value._serialized != this.ident )
+				return value;
+
+			var dom_parser = ( "DOMParser" in window && (new DOMParser()).parseFromString );
+			if( !dom_parser && window.ActiveXObject )
+			{
+				dom_parser = function( _xmlString )
+				{
+					var xml_doc = new ActiveXObject( 'Microsoft.XMLDOM' );
+					xml_doc.async = 'false';
+					xml_doc.loadXML( _xmlString );
+					return xml_doc;
+				}
+			}
+
+			if( !dom_parser )
+			{
+				return undefined;
+			}
+			
+			value.value = dom_parser.call(
+				"DOMParser" in window && (new DOMParser()) || window, 
+				value.value, 
+				'text/xml'
+			);
+			
+			return this.isXML( value.value ) ? value.value : undefined;
+		}
+	}
+};
+
+})(jQuery);
Index: trunk/prototype/plugins/store/index.html
===================================================================
--- trunk/prototype/plugins/store/index.html	(revision 5283)
+++ trunk/prototype/plugins/store/index.html	(revision 5283)
@@ -0,0 +1,146 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+	<meta charset="utf-8" />
+	<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+
+	<title>$.store jQuery plugin</title>
+	<meta name="title" content="$.store() jQuery plugin" />
+	<meta name="description" content="Persistently storing data on the client side" />
+
+	<script type="text/javascript" src="json2.js"></script>
+	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
+	<script type="text/javascript" src="jquery.store.js"></script>
+	<script type="text/javascript">
+		(function($,undefined){
+			
+			// initialize storage API
+			$.storage = new $.store();
+			
+			// build some demo interface
+			var $buttons;
+
+			var log = function( m )
+			{
+				$('<p>'+ m +'</p>').insertAfter( $buttons );
+			}
+
+			var poll = function()
+			{
+				log( $.storage.get( 'event' ) );
+			}
+
+			var push = function()
+			{
+				$.storage.set( 'event', new Date() );
+			}
+
+			$(function()
+			{
+				$buttons = $( '<div></div>' ).prependTo( $( document.body ) );
+
+				$( '<button type="button">start writing</button>' ).appendTo( $buttons ).bind( 'click', function()
+				{
+					window.setInterval( push, 500 );
+				});
+
+				$( '<button type="button">start reading</button>' ).appendTo( $buttons ).bind( 'click', function()
+				{
+					window.setInterval( poll, 1000 );
+				});	
+			});
+
+		})(jQuery);
+	</script>
+	<script type="text/javascript" src="jquery.windowSync.js"></script>
+</head>
+<body>
+
+	<script type="text/javascript">
+		document.write( '<p>Initialized $.storage with driver ' + $.storage.driver.ident + '</p>' );
+	</script>
+	
+	<h1>$.store</h1>
+	
+	<p>
+		<code>$.store</code> is a simple, yet easily extensible, plugin to persistently store data on the client side of things.
+		It uses <code>window.localStore</code> where available. Older Internet Explorers will use <code>userData</code>.
+		If all fails <code>$.store</code> will save your data to <code>window.name</code>.
+	</p>
+	
+	<p>
+		Note: The <code>windowName</code> will only do JSON serialization. <code>windowName</code> 
+		is not persistent in the sense of making it accross a closed browser window. If you need
+		that ability you should check <code>$.storage.driver.scope == "browser"</code>.
+	</p>
+	
+	<h2>Usage</h2>
+	
+<pre>//initialize
+$.storage = new $.store();
+
+// save a value
+$.storage.set( key, value );
+
+// read a value
+$.storage.get( key );
+
+// deletes a value
+$.storage.del( key );
+
+// delete all values
+$.storage.flush();</pre>
+	
+	<h2>Adding Serializers</h2>
+	
+	<p>
+		You can easily add your own serializers to the stack.
+		Make sure to add them before initializing the <code>$.store</code>.
+		Note: Serializers do not apply to the <code>windowName</code> storage driver.
+	</p>
+<pre>$.store.serializers.yaddayadda = {
+  ident: "$.store.serializers.yaddayadda",
+  init: function( encoders, decoders )
+  {
+    // register your serializer with en/decoder stack
+    encoders.unshift( "yaddayadda" );
+    decoders.push( "yaddayadda" );
+  },
+  
+  isYaddaYadda: function( value )
+  {
+    // determine if value should be processed by this serializer
+    return true;
+  },
+
+  encode: function( value )
+  {
+    // check if the value can be encoded
+    if( !value || value._serialized || !this.isYaddaYadda( value ) )
+      return value;
+
+    // prepare serialized-data-wrapper
+    var _value = { _serialized: this.ident, value: value };
+    
+    // work your magic
+    _value.value = "serializedVersionOf data";
+    
+    return value;
+  },
+  
+  decode: function( value )
+  {
+    // check if the value can be decoded
+    if( !value || !value._serialized || value._serialized != this.ident )
+      return value;
+
+    // work your magic
+    value.value = "unserializedVersionOf data";
+    
+    return this.isYaddaYadda( value.value ) ? value.value : undefined;
+  }
+};</pre>
+
+
+</body>
+</html>
Index: trunk/prototype/plugins/store/README.md
===================================================================
--- trunk/prototype/plugins/store/README.md	(revision 5283)
+++ trunk/prototype/plugins/store/README.md	(revision 5283)
@@ -0,0 +1,28 @@
+# $.store jQuery plugin #
+
+<code>$.store</code> is a simple, yet easily extensible, plugin to persistently store data on the client side of things. It uses <code>window.localStore</code> where available. Older Internet Explorers will use <code>userData</code>. If all fails <code>$.store</code> will save your data to <code>window.name</code>.
+
+*Note*: The <code>windowName</code> will only do JSON serialization. <code>windowName</code> is not persistent in the sense of making it accross a closed browser window. If you need that ability you should check <code>$.storage.driver.scope == "browser"</code>.
+
+## Usage ##
+
+<pre><code>
+//initialize
+$.storage = new $.store();
+
+// save a value
+$.storage.set( key, value );
+
+// read a value
+$.storage.get( key );
+
+// deletes a value
+$.storage.del( key );
+
+// delete all values
+$.storage.flush();
+</code></pre>
+
+## License ##
+
+$.store is published under the [MIT license](http://www.opensource.org/licenses/mit-license.php).
Index: trunk/prototype/plugins/timepicker/jquery-ui-timepicker-addon.js
===================================================================
--- trunk/prototype/plugins/timepicker/jquery-ui-timepicker-addon.js	(revision 5341)
+++ trunk/prototype/plugins/timepicker/jquery-ui-timepicker-addon.js	(revision 5341)
@@ -0,0 +1,1299 @@
+/*
+* jQuery timepicker addon
+* By: Trent Richardson [http://trentrichardson.com]
+* Version 0.9.8
+* Last Modified: 12/03/2011
+* 
+* Copyright 2011 Trent Richardson
+* Dual licensed under the MIT and GPL licenses.
+* http://trentrichardson.com/Impromptu/GPL-LICENSE.txt
+* http://trentrichardson.com/Impromptu/MIT-LICENSE.txt
+* 
+* HERES THE CSS:
+* .ui-timepicker-div .ui-widget-header { margin-bottom: 8px; }
+* .ui-timepicker-div dl { text-align: left; }
+* .ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }
+* .ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }
+* .ui-timepicker-div td { font-size: 90%; }
+* .ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; }
+*/
+
+(function($) {
+
+$.extend($.ui, { timepicker: { version: "0.9.8" } });
+
+/* Time picker manager.
+   Use the singleton instance of this class, $.timepicker, to interact with the time picker.
+   Settings for (groups of) time pickers are maintained in an instance object,
+   allowing multiple different settings on the same page. */
+
+function Timepicker() {
+	this.regional = []; // Available regional settings, indexed by language code
+	this.regional[''] = { // Default regional settings
+		currentText: 'Now',
+		closeText: 'Done',
+		ampm: false,
+		amNames: ['AM', 'A'],
+		pmNames: ['PM', 'P'],
+		timeFormat: 'hh:mm tt',
+		timeSuffix: '',
+		timeOnlyTitle: 'Choose Time',
+		timeText: 'Time',
+		hourText: 'Hour',
+		minuteText: 'Minute',
+		secondText: 'Second',
+		millisecText: 'Millisecond',
+		timezoneText: 'Time Zone'
+	};
+	this._defaults = { // Global defaults for all the datetime picker instances
+		showButtonPanel: true,
+		timeOnly: false,
+		showHour: true,
+		showMinute: true,
+		showSecond: false,
+		showMillisec: false,
+		showTimezone: false,
+		showTime: true,
+		stepHour: 1,
+		stepMinute: 1,
+		stepSecond: 1,
+		stepMillisec: 1,
+		hour: 0,
+		minute: 0,
+		second: 0,
+		millisec: 0,
+		timezone: '+0000',
+		hourMin: 0,
+		minuteMin: 0,
+		secondMin: 0,
+		millisecMin: 0,
+		hourMax: 23,
+		minuteMax: 59,
+		secondMax: 59,
+		millisecMax: 999,
+		minDateTime: null,
+		maxDateTime: null,
+		onSelect: null,
+		hourGrid: 0,
+		minuteGrid: 0,
+		secondGrid: 0,
+		millisecGrid: 0,
+		alwaysSetTime: true,
+		separator: ' ',
+		altFieldTimeOnly: true,
+		showTimepicker: true,
+		timezoneIso8609: false,
+		timezoneList: null,
+		addSliderAccess: false,
+		sliderAccessArgs: null
+	};
+	$.extend(this._defaults, this.regional['']);
+}
+
+$.extend(Timepicker.prototype, {
+	$input: null,
+	$altInput: null,
+	$timeObj: null,
+	inst: null,
+	hour_slider: null,
+	minute_slider: null,
+	second_slider: null,
+	millisec_slider: null,
+	timezone_select: null,
+	hour: 0,
+	minute: 0,
+	second: 0,
+	millisec: 0,
+	timezone: '+0000',
+	hourMinOriginal: null,
+	minuteMinOriginal: null,
+	secondMinOriginal: null,
+	millisecMinOriginal: null,
+	hourMaxOriginal: null,
+	minuteMaxOriginal: null,
+	secondMaxOriginal: null,
+	millisecMaxOriginal: null,
+	ampm: '',
+	formattedDate: '',
+	formattedTime: '',
+	formattedDateTime: '',
+	timezoneList: null,
+
+	/* Override the default settings for all instances of the time picker.
+	   @param  settings  object - the new settings to use as defaults (anonymous object)
+	   @return the manager object */
+	setDefaults: function(settings) {
+		extendRemove(this._defaults, settings || {});
+		return this;
+	},
+
+	//########################################################################
+	// Create a new Timepicker instance
+	//########################################################################
+	_newInst: function($input, o) {
+		var tp_inst = new Timepicker(),
+			inlineSettings = {};
+			
+		for (var attrName in this._defaults) {
+			var attrValue = $input.attr('time:' + attrName);
+			if (attrValue) {
+				try {
+					inlineSettings[attrName] = eval(attrValue);
+				} catch (err) {
+					inlineSettings[attrName] = attrValue;
+				}
+			}
+		}
+		tp_inst._defaults = $.extend({}, this._defaults, inlineSettings, o, {
+			beforeShow: function(input, dp_inst) {
+				if ($.isFunction(o.beforeShow))
+					o.beforeShow(input, dp_inst, tp_inst);
+			},
+			onChangeMonthYear: function(year, month, dp_inst) {
+				// Update the time as well : this prevents the time from disappearing from the $input field.
+				tp_inst._updateDateTime(dp_inst);
+				if ($.isFunction(o.onChangeMonthYear))
+					o.onChangeMonthYear.call($input[0], year, month, dp_inst, tp_inst);
+			},
+			onClose: function(dateText, dp_inst) {
+				if (tp_inst.timeDefined === true && $input.val() != '')
+					tp_inst._updateDateTime(dp_inst);
+				if ($.isFunction(o.onClose))
+					o.onClose.call($input[0], dateText, dp_inst, tp_inst);
+			},
+			timepicker: tp_inst // add timepicker as a property of datepicker: $.datepicker._get(dp_inst, 'timepicker');
+		});
+		tp_inst.amNames = $.map(tp_inst._defaults.amNames, function(val) { return val.toUpperCase() });
+		tp_inst.pmNames = $.map(tp_inst._defaults.pmNames, function(val) { return val.toUpperCase() });
+
+		if (tp_inst._defaults.timezoneList === null) {
+			var timezoneList = [];
+			for (var i = -11; i <= 12; i++)
+				timezoneList.push((i >= 0 ? '+' : '-') + ('0' + Math.abs(i).toString()).slice(-2) + '00');
+			if (tp_inst._defaults.timezoneIso8609)
+				timezoneList = $.map(timezoneList, function(val) {
+					return val == '+0000' ? 'Z' : (val.substring(0, 3) + ':' + val.substring(3));
+				});
+			tp_inst._defaults.timezoneList = timezoneList;
+		}
+
+		tp_inst.hour = tp_inst._defaults.hour;
+		tp_inst.minute = tp_inst._defaults.minute;
+		tp_inst.second = tp_inst._defaults.second;
+		tp_inst.millisec = tp_inst._defaults.millisec;
+		tp_inst.ampm = '';
+		tp_inst.$input = $input;
+
+		if (o.altField)
+			tp_inst.$altInput = $(o.altField)
+				.css({ cursor: 'pointer' })
+				.focus(function(){ $input.trigger("focus"); });
+		
+		if(tp_inst._defaults.minDate==0 || tp_inst._defaults.minDateTime==0)
+		{
+			tp_inst._defaults.minDate=new Date();
+		}
+		if(tp_inst._defaults.maxDate==0 || tp_inst._defaults.maxDateTime==0)
+		{
+			tp_inst._defaults.maxDate=new Date();
+		}
+		
+		// datepicker needs minDate/maxDate, timepicker needs minDateTime/maxDateTime..
+		if(tp_inst._defaults.minDate !== undefined && tp_inst._defaults.minDate instanceof Date)
+			tp_inst._defaults.minDateTime = new Date(tp_inst._defaults.minDate.getTime());
+		if(tp_inst._defaults.minDateTime !== undefined && tp_inst._defaults.minDateTime instanceof Date)
+			tp_inst._defaults.minDate = new Date(tp_inst._defaults.minDateTime.getTime());
+		if(tp_inst._defaults.maxDate !== undefined && tp_inst._defaults.maxDate instanceof Date)
+			tp_inst._defaults.maxDateTime = new Date(tp_inst._defaults.maxDate.getTime());
+		if(tp_inst._defaults.maxDateTime !== undefined && tp_inst._defaults.maxDateTime instanceof Date)
+			tp_inst._defaults.maxDate = new Date(tp_inst._defaults.maxDateTime.getTime());
+		return tp_inst;
+	},
+
+	//########################################################################
+	// add our sliders to the calendar
+	//########################################################################
+	_addTimePicker: function(dp_inst) {
+		var currDT = (this.$altInput && this._defaults.altFieldTimeOnly) ?
+				this.$input.val() + ' ' + this.$altInput.val() : 
+				this.$input.val();
+
+		this.timeDefined = this._parseTime(currDT);
+		this._limitMinMaxDateTime(dp_inst, false);
+		this._injectTimePicker();
+	},
+
+	//########################################################################
+	// parse the time string from input value or _setTime
+	//########################################################################
+	_parseTime: function(timeString, withDate) {
+		var regstr = this._defaults.timeFormat.toString()
+				.replace(/h{1,2}/ig, '(\\d?\\d)')
+				.replace(/m{1,2}/ig, '(\\d?\\d)')
+				.replace(/s{1,2}/ig, '(\\d?\\d)')
+				.replace(/l{1}/ig, '(\\d?\\d?\\d)')
+				.replace(/t{1,2}/ig, this._getPatternAmpm())
+				.replace(/z{1}/ig, '(z|[-+]\\d\\d:?\\d\\d)?')
+				.replace(/\s/g, '\\s?') + this._defaults.timeSuffix + '$',
+			order = this._getFormatPositions(),
+			ampm = '',
+			treg;
+
+		if (!this.inst) this.inst = $.datepicker._getInst(this.$input[0]);
+
+		if (withDate || !this._defaults.timeOnly) {
+			// the time should come after x number of characters and a space.
+			// x = at least the length of text specified by the date format
+			var dp_dateFormat = $.datepicker._get(this.inst, 'dateFormat');
+			// escape special regex characters in the seperator
+			var specials = new RegExp("[.*+?|()\\[\\]{}\\\\]", "g");
+			regstr = '.{' + dp_dateFormat.length + ',}' + this._defaults.separator.replace(specials, "\\$&") + regstr;
+		}
+		
+		treg = timeString.match(new RegExp(regstr, 'i'));
+
+		if (treg) {
+			if (order.t !== -1) {
+				if (treg[order.t] === undefined || treg[order.t].length === 0) {
+					ampm = '';
+					this.ampm = '';
+				} else {
+					ampm = $.inArray(treg[order.t].toUpperCase(), this.amNames) !== -1 ? 'AM' : 'PM';
+					this.ampm = this._defaults[ampm == 'AM' ? 'amNames' : 'pmNames'][0];
+				}
+			}
+
+			if (order.h !== -1) {
+				if (ampm == 'AM' && treg[order.h] == '12')
+					this.hour = 0; // 12am = 0 hour
+				else if (ampm == 'PM' && treg[order.h] != '12')
+					this.hour = (parseFloat(treg[order.h]) + 12).toFixed(0); // 12pm = 12 hour, any other pm = hour + 12
+				else this.hour = Number(treg[order.h]);
+			}
+
+			if (order.m !== -1) this.minute = Number(treg[order.m]);
+			if (order.s !== -1) this.second = Number(treg[order.s]);
+			if (order.l !== -1) this.millisec = Number(treg[order.l]);
+			if (order.z !== -1 && treg[order.z] !== undefined) {
+				var tz = treg[order.z].toUpperCase();
+				switch (tz.length) {
+				case 1:	// Z
+					tz = this._defaults.timezoneIso8609 ? 'Z' : '+0000';
+					break;
+				case 5:	// +hhmm
+					if (this._defaults.timezoneIso8609)
+						tz = tz.substring(1) == '0000'
+						   ? 'Z'
+						   : tz.substring(0, 3) + ':' + tz.substring(3);
+					break;
+				case 6:	// +hh:mm
+					if (!this._defaults.timezoneIso8609)
+						tz = tz == 'Z' || tz.substring(1) == '00:00'
+						   ? '+0000'
+						   : tz.replace(/:/, '');
+					else if (tz.substring(1) == '00:00')
+						tz = 'Z';
+					break;
+				}
+				this.timezone = tz;
+			}
+			
+			return true;
+
+		}
+		return false;
+	},
+
+	//########################################################################
+	// pattern for standard and localized AM/PM markers
+	//########################################################################
+	_getPatternAmpm: function() {
+		var markers = [];
+			o = this._defaults;
+		if (o.amNames)
+			$.merge(markers, o.amNames);
+		if (o.pmNames)
+			$.merge(markers, o.pmNames);
+		markers = $.map(markers, function(val) { return val.replace(/[.*+?|()\[\]{}\\]/g, '\\$&') });
+		return '(' + markers.join('|') + ')?';
+	},
+
+	//########################################################################
+	// figure out position of time elements.. cause js cant do named captures
+	//########################################################################
+	_getFormatPositions: function() {
+		var finds = this._defaults.timeFormat.toLowerCase().match(/(h{1,2}|m{1,2}|s{1,2}|l{1}|t{1,2}|z)/g),
+			orders = { h: -1, m: -1, s: -1, l: -1, t: -1, z: -1 };
+
+		if (finds)
+			for (var i = 0; i < finds.length; i++)
+				if (orders[finds[i].toString().charAt(0)] == -1)
+					orders[finds[i].toString().charAt(0)] = i + 1;
+
+		return orders;
+	},
+
+	//########################################################################
+	// generate and inject html for timepicker into ui datepicker
+	//########################################################################
+	_injectTimePicker: function() {
+		var $dp = this.inst.dpDiv,
+			o = this._defaults,
+			tp_inst = this,
+			// Added by Peter Medeiros:
+			// - Figure out what the hour/minute/second max should be based on the step values.
+			// - Example: if stepMinute is 15, then minMax is 45.
+			hourMax = parseInt((o.hourMax - ((o.hourMax - o.hourMin) % o.stepHour)) ,10),
+			minMax  = parseInt((o.minuteMax - ((o.minuteMax - o.minuteMin) % o.stepMinute)) ,10),
+			secMax  = parseInt((o.secondMax - ((o.secondMax - o.secondMin) % o.stepSecond)) ,10),
+			millisecMax  = parseInt((o.millisecMax - ((o.millisecMax - o.millisecMin) % o.stepMillisec)) ,10),
+			dp_id = this.inst.id.toString().replace(/([^A-Za-z0-9_])/g, '');
+
+		// Prevent displaying twice
+		//if ($dp.find("div#ui-timepicker-div-"+ dp_id).length === 0) {
+		if ($dp.find("div#ui-timepicker-div-"+ dp_id).length === 0 && o.showTimepicker) {
+			var noDisplay = ' style="display:none;"',
+				html =	'<div class="ui-timepicker-div" id="ui-timepicker-div-' + dp_id + '"><dl>' +
+						'<dt class="ui_tpicker_time_label" id="ui_tpicker_time_label_' + dp_id + '"' +
+						((o.showTime) ? '' : noDisplay) + '>' + o.timeText + '</dt>' +
+						'<dd class="ui_tpicker_time" id="ui_tpicker_time_' + dp_id + '"' +
+						((o.showTime) ? '' : noDisplay) + '></dd>' +
+						'<dt class="ui_tpicker_hour_label" id="ui_tpicker_hour_label_' + dp_id + '"' +
+						((o.showHour) ? '' : noDisplay) + '>' + o.hourText + '</dt>',
+				hourGridSize = 0,
+				minuteGridSize = 0,
+				secondGridSize = 0,
+				millisecGridSize = 0,
+				size;
+
+ 			// Hours
+			html += '<dd class="ui_tpicker_hour"><div id="ui_tpicker_hour_' + dp_id + '"' +
+						((o.showHour) ? '' : noDisplay) + '></div>';
+			if (o.showHour && o.hourGrid > 0) {
+				html += '<div style="padding-left: 1px"><table class="ui-tpicker-grid-label"><tr>';
+
+				for (var h = o.hourMin; h <= hourMax; h += parseInt(o.hourGrid,10)) {
+					hourGridSize++;
+					var tmph = (o.ampm && h > 12) ? h-12 : h;
+					if (tmph < 10) tmph = '0' + tmph;
+					if (o.ampm) {
+						if (h == 0) tmph = 12 +'a';
+						else if (h < 12) tmph += 'a';
+						else tmph += 'p';
+					}
+					html += '<td>' + tmph + '</td>';
+				}
+
+				html += '</tr></table></div>';
+			}
+			html += '</dd>';
+
+			// Minutes
+			html += '<dt class="ui_tpicker_minute_label" id="ui_tpicker_minute_label_' + dp_id + '"' +
+					((o.showMinute) ? '' : noDisplay) + '>' + o.minuteText + '</dt>'+
+					'<dd class="ui_tpicker_minute"><div id="ui_tpicker_minute_' + dp_id + '"' +
+							((o.showMinute) ? '' : noDisplay) + '></div>';
+
+			if (o.showMinute && o.minuteGrid > 0) {
+				html += '<div style="padding-left: 1px"><table class="ui-tpicker-grid-label"><tr>';
+
+				for (var m = o.minuteMin; m <= minMax; m += parseInt(o.minuteGrid,10)) {
+					minuteGridSize++;
+					html += '<td>' + ((m < 10) ? '0' : '') + m + '</td>';
+				}
+
+				html += '</tr></table></div>';
+			}
+			html += '</dd>';
+
+			// Seconds
+			html += '<dt class="ui_tpicker_second_label" id="ui_tpicker_second_label_' + dp_id + '"' +
+					((o.showSecond) ? '' : noDisplay) + '>' + o.secondText + '</dt>'+
+					'<dd class="ui_tpicker_second"><div id="ui_tpicker_second_' + dp_id + '"'+
+							((o.showSecond) ? '' : noDisplay) + '></div>';
+
+			if (o.showSecond && o.secondGrid > 0) {
+				html += '<div style="padding-left: 1px"><table><tr>';
+
+				for (var s = o.secondMin; s <= secMax; s += parseInt(o.secondGrid,10)) {
+					secondGridSize++;
+					html += '<td>' + ((s < 10) ? '0' : '') + s + '</td>';
+				}
+
+				html += '</tr></table></div>';
+			}
+			html += '</dd>';
+
+			// Milliseconds
+			html += '<dt class="ui_tpicker_millisec_label" id="ui_tpicker_millisec_label_' + dp_id + '"' +
+					((o.showMillisec) ? '' : noDisplay) + '>' + o.millisecText + '</dt>'+
+					'<dd class="ui_tpicker_millisec"><div id="ui_tpicker_millisec_' + dp_id + '"'+
+							((o.showMillisec) ? '' : noDisplay) + '></div>';
+
+			if (o.showMillisec && o.millisecGrid > 0) {
+				html += '<div style="padding-left: 1px"><table><tr>';
+
+				for (var l = o.millisecMin; l <= millisecMax; l += parseInt(o.millisecGrid,10)) {
+					millisecGridSize++;
+					html += '<td>' + ((l < 10) ? '0' : '') + l + '</td>';
+				}
+
+				html += '</tr></table></div>';
+			}
+			html += '</dd>';
+
+			// Timezone
+			html += '<dt class="ui_tpicker_timezone_label" id="ui_tpicker_timezone_label_' + dp_id + '"' +
+					((o.showTimezone) ? '' : noDisplay) + '>' + o.timezoneText + '</dt>';
+			html += '<dd class="ui_tpicker_timezone" id="ui_tpicker_timezone_' + dp_id + '"'	+
+							((o.showTimezone) ? '' : noDisplay) + '></dd>';
+
+			html += '</dl></div>';
+			$tp = $(html);
+
+				// if we only want time picker...
+			if (o.timeOnly === true) {
+				$tp.prepend(
+					'<div class="ui-widget-header ui-helper-clearfix ui-corner-all">' +
+						'<div class="ui-datepicker-title">' + o.timeOnlyTitle + '</div>' +
+					'</div>');
+				$dp.find('.ui-datepicker-header, .ui-datepicker-calendar').hide();
+			}
+
+			this.hour_slider = $tp.find('#ui_tpicker_hour_'+ dp_id).slider({
+				orientation: "horizontal",
+				value: this.hour,
+				min: o.hourMin,
+				max: hourMax,
+				step: o.stepHour,
+				slide: function(event, ui) {
+					tp_inst.hour_slider.slider( "option", "value", ui.value);
+					tp_inst._onTimeChange();
+				}
+			});
+
+			
+			// Updated by Peter Medeiros:
+			// - Pass in Event and UI instance into slide function
+			this.minute_slider = $tp.find('#ui_tpicker_minute_'+ dp_id).slider({
+				orientation: "horizontal",
+				value: this.minute,
+				min: o.minuteMin,
+				max: minMax,
+				step: o.stepMinute,
+				slide: function(event, ui) {
+					tp_inst.minute_slider.slider( "option", "value", ui.value);
+					tp_inst._onTimeChange();
+				}
+			});
+
+			this.second_slider = $tp.find('#ui_tpicker_second_'+ dp_id).slider({
+				orientation: "horizontal",
+				value: this.second,
+				min: o.secondMin,
+				max: secMax,
+				step: o.stepSecond,
+				slide: function(event, ui) {
+					tp_inst.second_slider.slider( "option", "value", ui.value);
+					tp_inst._onTimeChange();
+				}
+			});
+
+			this.millisec_slider = $tp.find('#ui_tpicker_millisec_'+ dp_id).slider({
+				orientation: "horizontal",
+				value: this.millisec,
+				min: o.millisecMin,
+				max: millisecMax,
+				step: o.stepMillisec,
+				slide: function(event, ui) {
+					tp_inst.millisec_slider.slider( "option", "value", ui.value);
+					tp_inst._onTimeChange();
+				}
+			});
+
+			this.timezone_select = $tp.find('#ui_tpicker_timezone_'+ dp_id).append('<select></select>').find("select");
+			$.fn.append.apply(this.timezone_select,
+				$.map(o.timezoneList, function(val, idx) {
+					return $("<option />")
+						.val(typeof val == "object" ? val.value : val)
+						.text(typeof val == "object" ? val.label : val);
+				})
+			);
+			this.timezone_select.val((typeof this.timezone != "undefined" && this.timezone != null && this.timezone != "") ? this.timezone : o.timezone);
+			this.timezone_select.change(function() {
+				tp_inst._onTimeChange();
+			});
+
+			// Add grid functionality
+			if (o.showHour && o.hourGrid > 0) {
+				size = 100 * hourGridSize * o.hourGrid / (hourMax - o.hourMin);
+
+				$tp.find(".ui_tpicker_hour table").css({
+					width: size + "%",
+					marginLeft: (size / (-2 * hourGridSize)) + "%",
+					borderCollapse: 'collapse'
+				}).find("td").each( function(index) {
+					$(this).click(function() {
+						var h = $(this).html();
+						if(o.ampm)	{
+							var ap = h.substring(2).toLowerCase(),
+								aph = parseInt(h.substring(0,2), 10);
+							if (ap == 'a') {
+								if (aph == 12) h = 0;
+								else h = aph;
+							} else if (aph == 12) h = 12;
+							else h = aph + 12;
+						}
+						tp_inst.hour_slider.slider("option", "value", h);
+						tp_inst._onTimeChange();
+						tp_inst._onSelectHandler();
+					}).css({
+						cursor: 'pointer',
+						width: (100 / hourGridSize) + '%',
+						textAlign: 'center',
+						overflow: 'hidden'
+					});
+				});
+			}
+
+			if (o.showMinute && o.minuteGrid > 0) {
+				size = 100 * minuteGridSize * o.minuteGrid / (minMax - o.minuteMin);
+				$tp.find(".ui_tpicker_minute table").css({
+					width: size + "%",
+					marginLeft: (size / (-2 * minuteGridSize)) + "%",
+					borderCollapse: 'collapse'
+				}).find("td").each(function(index) {
+					$(this).click(function() {
+						tp_inst.minute_slider.slider("option", "value", $(this).html());
+						tp_inst._onTimeChange();
+						tp_inst._onSelectHandler();
+					}).css({
+						cursor: 'pointer',
+						width: (100 / minuteGridSize) + '%',
+						textAlign: 'center',
+						overflow: 'hidden'
+					});
+				});
+			}
+
+			if (o.showSecond && o.secondGrid > 0) {
+				$tp.find(".ui_tpicker_second table").css({
+					width: size + "%",
+					marginLeft: (size / (-2 * secondGridSize)) + "%",
+					borderCollapse: 'collapse'
+				}).find("td").each(function(index) {
+					$(this).click(function() {
+						tp_inst.second_slider.slider("option", "value", $(this).html());
+						tp_inst._onTimeChange();
+						tp_inst._onSelectHandler();
+					}).css({
+						cursor: 'pointer',
+						width: (100 / secondGridSize) + '%',
+						textAlign: 'center',
+						overflow: 'hidden'
+					});
+				});
+			}
+
+			if (o.showMillisec && o.millisecGrid > 0) {
+				$tp.find(".ui_tpicker_millisec table").css({
+					width: size + "%",
+					marginLeft: (size / (-2 * millisecGridSize)) + "%",
+					borderCollapse: 'collapse'
+				}).find("td").each(function(index) {
+					$(this).click(function() {
+						tp_inst.millisec_slider.slider("option", "value", $(this).html());
+						tp_inst._onTimeChange();
+						tp_inst._onSelectHandler();
+					}).css({
+						cursor: 'pointer',
+						width: (100 / millisecGridSize) + '%',
+						textAlign: 'center',
+						overflow: 'hidden'
+					});
+				});
+			}
+
+			var $buttonPanel = $dp.find('.ui-datepicker-buttonpane');
+			if ($buttonPanel.length) $buttonPanel.before($tp);
+			else $dp.append($tp);
+
+			this.$timeObj = $tp.find('#ui_tpicker_time_'+ dp_id);
+
+			if (this.inst !== null) {
+				var timeDefined = this.timeDefined;
+				this._onTimeChange();
+				this.timeDefined = timeDefined;
+			}
+
+			//Emulate datepicker onSelect behavior. Call on slidestop.
+			var onSelectDelegate = function() {
+				tp_inst._onSelectHandler();
+			};
+			this.hour_slider.bind('slidestop',onSelectDelegate);
+			this.minute_slider.bind('slidestop',onSelectDelegate);
+			this.second_slider.bind('slidestop',onSelectDelegate);
+			this.millisec_slider.bind('slidestop',onSelectDelegate);
+			
+			// slideAccess integration: http://trentrichardson.com/2011/11/11/jquery-ui-sliders-and-touch-accessibility/
+			if (this._defaults.addSliderAccess){
+				var sliderAccessArgs = this._defaults.sliderAccessArgs;
+				setTimeout(function(){ // fix for inline mode
+					if($tp.find('.ui-slider-access').length == 0){
+						$tp.find('.ui-slider:visible').sliderAccess(sliderAccessArgs);
+
+						// fix any grids since sliders are shorter
+						var sliderAccessWidth = $tp.find('.ui-slider-access:eq(0)').outerWidth(true);
+						if(sliderAccessWidth){
+							$tp.find('table:visible').each(function(){
+								var $g = $(this),
+									oldWidth = $g.outerWidth(),
+									oldMarginLeft = $g.css('marginLeft').toString().replace('%',''),
+									newWidth = oldWidth - sliderAccessWidth,
+									newMarginLeft = ((oldMarginLeft * newWidth)/oldWidth) + '%';
+						
+								$g.css({ width: newWidth, marginLeft: newMarginLeft });
+							});
+						}
+					}
+				},0);
+			}
+			// end slideAccess integration
+			
+		}
+	},
+
+	//########################################################################
+	// This function tries to limit the ability to go outside the
+	// min/max date range
+	//########################################################################
+	_limitMinMaxDateTime: function(dp_inst, adjustSliders){
+		var o = this._defaults,
+			dp_date = new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay);
+
+		if(!this._defaults.showTimepicker) return; // No time so nothing to check here
+
+		if($.datepicker._get(dp_inst, 'minDateTime') !== null && $.datepicker._get(dp_inst, 'minDateTime') !== undefined && dp_date){
+			var minDateTime = $.datepicker._get(dp_inst, 'minDateTime'),
+				minDateTimeDate = new Date(minDateTime.getFullYear(), minDateTime.getMonth(), minDateTime.getDate(), 0, 0, 0, 0);
+
+			if(this.hourMinOriginal === null || this.minuteMinOriginal === null || this.secondMinOriginal === null || this.millisecMinOriginal === null){
+				this.hourMinOriginal = o.hourMin;
+				this.minuteMinOriginal = o.minuteMin;
+				this.secondMinOriginal = o.secondMin;
+				this.millisecMinOriginal = o.millisecMin;
+			}
+
+			if(dp_inst.settings.timeOnly || minDateTimeDate.getTime() == dp_date.getTime()) {
+				this._defaults.hourMin = minDateTime.getHours();
+				if (this.hour <= this._defaults.hourMin) {
+					this.hour = this._defaults.hourMin;
+					this._defaults.minuteMin = minDateTime.getMinutes();
+					if (this.minute <= this._defaults.minuteMin) {
+						this.minute = this._defaults.minuteMin;
+						this._defaults.secondMin = minDateTime.getSeconds();
+					} else if (this.second <= this._defaults.secondMin){
+						this.second = this._defaults.secondMin;
+						this._defaults.millisecMin = minDateTime.getMilliseconds();
+					} else {
+						if(this.millisec < this._defaults.millisecMin)
+							this.millisec = this._defaults.millisecMin;
+						this._defaults.millisecMin = this.millisecMinOriginal;
+					}
+				} else {
+					this._defaults.minuteMin = this.minuteMinOriginal;
+					this._defaults.secondMin = this.secondMinOriginal;
+					this._defaults.millisecMin = this.millisecMinOriginal;
+				}
+			}else{
+				this._defaults.hourMin = this.hourMinOriginal;
+				this._defaults.minuteMin = this.minuteMinOriginal;
+				this._defaults.secondMin = this.secondMinOriginal;
+				this._defaults.millisecMin = this.millisecMinOriginal;
+			}
+		}
+
+		if($.datepicker._get(dp_inst, 'maxDateTime') !== null && $.datepicker._get(dp_inst, 'maxDateTime') !== undefined && dp_date){
+			var maxDateTime = $.datepicker._get(dp_inst, 'maxDateTime'),
+				maxDateTimeDate = new Date(maxDateTime.getFullYear(), maxDateTime.getMonth(), maxDateTime.getDate(), 0, 0, 0, 0);
+
+			if(this.hourMaxOriginal === null || this.minuteMaxOriginal === null || this.secondMaxOriginal === null){
+				this.hourMaxOriginal = o.hourMax;
+				this.minuteMaxOriginal = o.minuteMax;
+				this.secondMaxOriginal = o.secondMax;
+				this.millisecMaxOriginal = o.millisecMax;
+			}
+
+			if(dp_inst.settings.timeOnly || maxDateTimeDate.getTime() == dp_date.getTime()){
+				this._defaults.hourMax = maxDateTime.getHours();
+				if (this.hour >= this._defaults.hourMax) {
+					this.hour = this._defaults.hourMax;
+					this._defaults.minuteMax = maxDateTime.getMinutes();
+					if (this.minute >= this._defaults.minuteMax) {
+						this.minute = this._defaults.minuteMax;
+						this._defaults.secondMax = maxDateTime.getSeconds();
+					} else if (this.second >= this._defaults.secondMax) {
+						this.second = this._defaults.secondMax;
+						this._defaults.millisecMax = maxDateTime.getMilliseconds();
+					} else {
+						if(this.millisec > this._defaults.millisecMax) this.millisec = this._defaults.millisecMax;
+						this._defaults.millisecMax = this.millisecMaxOriginal;
+					}
+				} else {
+					this._defaults.minuteMax = this.minuteMaxOriginal;
+					this._defaults.secondMax = this.secondMaxOriginal;
+					this._defaults.millisecMax = this.millisecMaxOriginal;
+				}
+			}else{
+				this._defaults.hourMax = this.hourMaxOriginal;
+				this._defaults.minuteMax = this.minuteMaxOriginal;
+				this._defaults.secondMax = this.secondMaxOriginal;
+				this._defaults.millisecMax = this.millisecMaxOriginal;
+			}
+		}
+
+		if(adjustSliders !== undefined && adjustSliders === true){
+			var hourMax = parseInt((this._defaults.hourMax - ((this._defaults.hourMax - this._defaults.hourMin) % this._defaults.stepHour)) ,10),
+                minMax  = parseInt((this._defaults.minuteMax - ((this._defaults.minuteMax - this._defaults.minuteMin) % this._defaults.stepMinute)) ,10),
+                secMax  = parseInt((this._defaults.secondMax - ((this._defaults.secondMax - this._defaults.secondMin) % this._defaults.stepSecond)) ,10),
+				millisecMax  = parseInt((this._defaults.millisecMax - ((this._defaults.millisecMax - this._defaults.millisecMin) % this._defaults.stepMillisec)) ,10);
+
+			if(this.hour_slider)
+				this.hour_slider.slider("option", { min: this._defaults.hourMin, max: hourMax }).slider('value', this.hour);
+			if(this.minute_slider)
+				this.minute_slider.slider("option", { min: this._defaults.minuteMin, max: minMax }).slider('value', this.minute);
+			if(this.second_slider)
+				this.second_slider.slider("option", { min: this._defaults.secondMin, max: secMax }).slider('value', this.second);
+			if(this.millisec_slider)
+				this.millisec_slider.slider("option", { min: this._defaults.millisecMin, max: millisecMax }).slider('value', this.millisec);
+		}
+
+	},
+
+	
+	//########################################################################
+	// when a slider moves, set the internal time...
+	// on time change is also called when the time is updated in the text field
+	//########################################################################
+	_onTimeChange: function() {
+		var hour   = (this.hour_slider) ? this.hour_slider.slider('value') : false,
+			minute = (this.minute_slider) ? this.minute_slider.slider('value') : false,
+			second = (this.second_slider) ? this.second_slider.slider('value') : false,
+			millisec = (this.millisec_slider) ? this.millisec_slider.slider('value') : false,
+			timezone = (this.timezone_select) ? this.timezone_select.val() : false,
+			o = this._defaults;
+
+		if (typeof(hour) == 'object') hour = false;
+		if (typeof(minute) == 'object') minute = false;
+		if (typeof(second) == 'object') second = false;
+		if (typeof(millisec) == 'object') millisec = false;
+		if (typeof(timezone) == 'object') timezone = false;
+
+		if (hour !== false) hour = parseInt(hour,10);
+		if (minute !== false) minute = parseInt(minute,10);
+		if (second !== false) second = parseInt(second,10);
+		if (millisec !== false) millisec = parseInt(millisec,10);
+
+		var ampm = o[hour < 12 ? 'amNames' : 'pmNames'][0];
+
+		// If the update was done in the input field, the input field should not be updated.
+		// If the update was done using the sliders, update the input field.
+		var hasChanged = (hour != this.hour || minute != this.minute
+				|| second != this.second || millisec != this.millisec
+				|| (this.ampm.length > 0
+				    && (hour < 12) != ($.inArray(this.ampm.toUpperCase(), this.amNames) !== -1))
+				|| timezone != this.timezone);
+		
+		if (hasChanged) {
+
+			if (hour !== false)this.hour = hour;
+			if (minute !== false) this.minute = minute;
+			if (second !== false) this.second = second;
+			if (millisec !== false) this.millisec = millisec;
+			if (timezone !== false) this.timezone = timezone;
+			
+			if (!this.inst) this.inst = $.datepicker._getInst(this.$input[0]);
+			
+			this._limitMinMaxDateTime(this.inst, true);
+		}
+		if (o.ampm) this.ampm = ampm;
+		
+		this._formatTime();
+		if (this.$timeObj) this.$timeObj.text(this.formattedTime + o.timeSuffix);
+		this.timeDefined = true;
+		if (hasChanged) this._updateDateTime();
+	},
+    
+	//########################################################################
+	// call custom onSelect. 
+	// bind to sliders slidestop, and grid click.
+	//########################################################################
+	_onSelectHandler: function() {
+		var onSelect = this._defaults.onSelect;
+		var inputEl = this.$input ? this.$input[0] : null;
+		if (onSelect && inputEl) {
+			onSelect.apply(inputEl, [this.formattedDateTime, this]);
+		}
+	},
+
+	//########################################################################
+	// format the time all pretty...
+	//########################################################################
+	_formatTime: function(time, format, ampm) {
+		if (ampm == undefined) ampm = this._defaults.ampm;
+		time = time || { hour: this.hour, minute: this.minute, second: this.second, millisec: this.millisec, ampm: this.ampm, timezone: this.timezone };
+		var tmptime = (format || this._defaults.timeFormat).toString();
+
+		var hour = parseInt(time.hour, 10);
+		if (ampm) {
+			if (!$.inArray(time.ampm.toUpperCase(), this.amNames) !== -1)
+				hour = hour % 12;
+			if (hour === 0)
+				hour = 12;
+		}
+		tmptime = tmptime.replace(/(?:hh?|mm?|ss?|[tT]{1,2}|[lz])/g, function(match) {
+			switch (match.toLowerCase()) {
+				case 'hh': return ('0' + hour).slice(-2);
+				case 'h':  return hour;
+				case 'mm': return ('0' + time.minute).slice(-2);
+				case 'm':  return time.minute;
+				case 'ss': return ('0' + time.second).slice(-2);
+				case 's':  return time.second;
+				case 'l':  return ('00' + time.millisec).slice(-3);
+				case 'z':  return time.timezone;
+				case 't': case 'tt':
+					if (ampm) {
+						var _ampm = time.ampm;
+						if (match.length == 1)
+							_ampm = _ampm.charAt(0);
+						return match.charAt(0) == 'T' ? _ampm.toUpperCase() : _ampm.toLowerCase();
+					}
+					return '';
+			}
+		});
+
+		if (arguments.length) return tmptime;
+		else this.formattedTime = tmptime;
+	},
+
+	//########################################################################
+	// update our input with the new date time..
+	//########################################################################
+	_updateDateTime: function(dp_inst) {
+		dp_inst = this.inst || dp_inst;
+		var dt = $.datepicker._daylightSavingAdjust(new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay)),
+			dateFmt = $.datepicker._get(dp_inst, 'dateFormat'),
+			formatCfg = $.datepicker._getFormatConfig(dp_inst),
+			timeAvailable = dt !== null && this.timeDefined;
+		this.formattedDate = $.datepicker.formatDate(dateFmt, (dt === null ? new Date() : dt), formatCfg);
+		var formattedDateTime = this.formattedDate;
+		if (dp_inst.lastVal !== undefined && (dp_inst.lastVal.length > 0 && this.$input.val().length === 0))
+			return;
+
+		if (this._defaults.timeOnly === true) {
+			formattedDateTime = this.formattedTime;
+		} else if (this._defaults.timeOnly !== true && (this._defaults.alwaysSetTime || timeAvailable)) {
+			formattedDateTime += this._defaults.separator + this.formattedTime + this._defaults.timeSuffix;
+		}
+
+		this.formattedDateTime = formattedDateTime;
+
+		if(!this._defaults.showTimepicker) {
+			this.$input.val(this.formattedDate);
+		} else if (this.$altInput && this._defaults.altFieldTimeOnly === true) {
+			this.$altInput.val(this.formattedTime);
+			this.$input.val(this.formattedDate);
+		} else if(this.$altInput) {
+			this.$altInput.val(formattedDateTime);
+			this.$input.val(formattedDateTime);
+		} else {
+			this.$input.val(formattedDateTime);
+		}
+		
+		this.$input.trigger("change");
+	}
+
+});
+
+$.fn.extend({
+	//########################################################################
+	// shorthand just to use timepicker..
+	//########################################################################
+	timepicker: function(o) {
+		o = o || {};
+		var tmp_args = arguments;
+
+		if (typeof o == 'object') tmp_args[0] = $.extend(o, { timeOnly: true });
+
+		return $(this).each(function() {
+			$.fn.datetimepicker.apply($(this), tmp_args);
+		});
+	},
+
+	//########################################################################
+	// extend timepicker to datepicker
+	//########################################################################
+	datetimepicker: function(o) {
+		o = o || {};
+		var $input = this,
+		tmp_args = arguments;
+
+		if (typeof(o) == 'string'){
+			if(o == 'getDate') 
+				return $.fn.datepicker.apply($(this[0]), tmp_args);
+			else 
+				return this.each(function() {
+					var $t = $(this);
+					$t.datepicker.apply($t, tmp_args);
+				});
+		}
+		else
+			return this.each(function() {
+				var $t = $(this);
+				$t.datepicker($.timepicker._newInst($t, o)._defaults);
+			});
+	}
+});
+
+//########################################################################
+// the bad hack :/ override datepicker so it doesnt close on select
+// inspired: http://stackoverflow.com/questions/1252512/jquery-datepicker-prevent-closing-picker-when-clicking-a-date/1762378#1762378
+//########################################################################
+$.datepicker._base_selectDate = $.datepicker._selectDate;
+$.datepicker._selectDate = function (id, dateStr) {
+	var inst = this._getInst($(id)[0]),
+		tp_inst = this._get(inst, 'timepicker');
+
+	if (tp_inst) {
+		tp_inst._limitMinMaxDateTime(inst, true);
+		inst.inline = inst.stay_open = true;
+		//This way the onSelect handler called from calendarpicker get the full dateTime
+		this._base_selectDate(id, dateStr);
+		inst.inline = inst.stay_open = false;
+		this._notifyChange(inst);
+		this._updateDatepicker(inst);
+	}
+	else this._base_selectDate(id, dateStr);
+};
+
+//#############################################################################################
+// second bad hack :/ override datepicker so it triggers an event when changing the input field
+// and does not redraw the datepicker on every selectDate event
+//#############################################################################################
+$.datepicker._base_updateDatepicker = $.datepicker._updateDatepicker;
+$.datepicker._updateDatepicker = function(inst) {
+
+	// don't popup the datepicker if there is another instance already opened
+	var input = inst.input[0];
+	if($.datepicker._curInst &&
+	   $.datepicker._curInst != inst &&
+	   $.datepicker._datepickerShowing &&
+	   $.datepicker._lastInput != input) {
+		return;
+	}
+
+	if (typeof(inst.stay_open) !== 'boolean' || inst.stay_open === false) {
+				
+		this._base_updateDatepicker(inst);
+		
+		// Reload the time control when changing something in the input text field.
+		var tp_inst = this._get(inst, 'timepicker');
+		if(tp_inst) tp_inst._addTimePicker(inst);
+	}
+};
+
+//#######################################################################################
+// third bad hack :/ override datepicker so it allows spaces and colon in the input field
+//#######################################################################################
+$.datepicker._base_doKeyPress = $.datepicker._doKeyPress;
+$.datepicker._doKeyPress = function(event) {
+	var inst = $.datepicker._getInst(event.target),
+		tp_inst = $.datepicker._get(inst, 'timepicker');
+
+	if (tp_inst) {
+		if ($.datepicker._get(inst, 'constrainInput')) {
+			var ampm = tp_inst._defaults.ampm,
+				dateChars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat')),
+				datetimeChars = tp_inst._defaults.timeFormat.toString()
+								.replace(/[hms]/g, '')
+								.replace(/TT/g, ampm ? 'APM' : '')
+								.replace(/Tt/g, ampm ? 'AaPpMm' : '')
+								.replace(/tT/g, ampm ? 'AaPpMm' : '')
+								.replace(/T/g, ampm ? 'AP' : '')
+								.replace(/tt/g, ampm ? 'apm' : '')
+								.replace(/t/g, ampm ? 'ap' : '') +
+								" " +
+								tp_inst._defaults.separator +
+								tp_inst._defaults.timeSuffix +
+								(tp_inst._defaults.showTimezone ? tp_inst._defaults.timezoneList.join('') : '') +
+								(tp_inst._defaults.amNames.join('')) +
+								(tp_inst._defaults.pmNames.join('')) +
+								dateChars,
+				chr = String.fromCharCode(event.charCode === undefined ? event.keyCode : event.charCode);
+			return event.ctrlKey || (chr < ' ' || !dateChars || datetimeChars.indexOf(chr) > -1);
+		}
+	}
+	
+	return $.datepicker._base_doKeyPress(event);
+};
+
+//#######################################################################################
+// Override key up event to sync manual input changes.
+//#######################################################################################
+$.datepicker._base_doKeyUp = $.datepicker._doKeyUp;
+$.datepicker._doKeyUp = function (event) {
+	var inst = $.datepicker._getInst(event.target),
+		tp_inst = $.datepicker._get(inst, 'timepicker');
+
+	if (tp_inst) {
+		if (tp_inst._defaults.timeOnly && (inst.input.val() != inst.lastVal)) {
+			try {
+				$.datepicker._updateDatepicker(inst);
+			}
+			catch (err) {
+				$.datepicker.log(err);
+			}
+		}
+	}
+
+	return $.datepicker._base_doKeyUp(event);
+};
+
+//#######################################################################################
+// override "Today" button to also grab the time.
+//#######################################################################################
+$.datepicker._base_gotoToday = $.datepicker._gotoToday;
+$.datepicker._gotoToday = function(id) {
+	var inst = this._getInst($(id)[0]),
+		$dp = inst.dpDiv;
+	this._base_gotoToday(id);
+	var now = new Date();
+	var tp_inst = this._get(inst, 'timepicker');
+	if (tp_inst._defaults.showTimezone && tp_inst.timezone_select) {
+		var tzoffset = now.getTimezoneOffset(); // If +0100, returns -60
+		var tzsign = tzoffset > 0 ? '-' : '+';
+		tzoffset = Math.abs(tzoffset);
+		var tzmin = tzoffset % 60
+		tzoffset = tzsign + ('0' + (tzoffset - tzmin) / 60).slice(-2) + ('0' + tzmin).slice(-2);
+		if (tp_inst._defaults.timezoneIso8609)
+			tzoffset = tzoffset.substring(0, 3) + ':' + tzoffset.substring(3);
+		tp_inst.timezone_select.val(tzoffset);
+	}
+	this._setTime(inst, now);
+	$( '.ui-datepicker-today', $dp).click(); 
+};
+
+//#######################################################################################
+// Disable & enable the Time in the datetimepicker
+//#######################################################################################
+$.datepicker._disableTimepickerDatepicker = function(target, date, withDate) {
+	var inst = this._getInst(target),
+	tp_inst = this._get(inst, 'timepicker');
+	$(target).datepicker('getDate'); // Init selected[Year|Month|Day]
+	if (tp_inst) {
+		tp_inst._defaults.showTimepicker = false;
+		tp_inst._updateDateTime(inst);
+	}
+};
+
+$.datepicker._enableTimepickerDatepicker = function(target, date, withDate) {
+	var inst = this._getInst(target),
+	tp_inst = this._get(inst, 'timepicker');
+	$(target).datepicker('getDate'); // Init selected[Year|Month|Day]
+	if (tp_inst) {
+		tp_inst._defaults.showTimepicker = true;
+		tp_inst._addTimePicker(inst); // Could be disabled on page load
+		tp_inst._updateDateTime(inst);
+	}
+};
+
+//#######################################################################################
+// Create our own set time function
+//#######################################################################################
+$.datepicker._setTime = function(inst, date) {
+	var tp_inst = this._get(inst, 'timepicker');
+	if (tp_inst) {
+		var defaults = tp_inst._defaults,
+			// calling _setTime with no date sets time to defaults
+			hour = date ? date.getHours() : defaults.hour,
+			minute = date ? date.getMinutes() : defaults.minute,
+			second = date ? date.getSeconds() : defaults.second,
+			millisec = date ? date.getMilliseconds() : defaults.millisec;
+
+		//check if within min/max times..
+		if ((hour < defaults.hourMin || hour > defaults.hourMax) || (minute < defaults.minuteMin || minute > defaults.minuteMax) || (second < defaults.secondMin || second > defaults.secondMax) || (millisec < defaults.millisecMin || millisec > defaults.millisecMax)) {
+			hour = defaults.hourMin;
+			minute = defaults.minuteMin;
+			second = defaults.secondMin;
+			millisec = defaults.millisecMin;
+		}
+
+		tp_inst.hour = hour;
+		tp_inst.minute = minute;
+		tp_inst.second = second;
+		tp_inst.millisec = millisec;
+
+		if (tp_inst.hour_slider) tp_inst.hour_slider.slider('value', hour);
+		if (tp_inst.minute_slider) tp_inst.minute_slider.slider('value', minute);
+		if (tp_inst.second_slider) tp_inst.second_slider.slider('value', second);
+		if (tp_inst.millisec_slider) tp_inst.millisec_slider.slider('value', millisec);
+
+		tp_inst._onTimeChange();
+		tp_inst._updateDateTime(inst);
+	}
+};
+
+//#######################################################################################
+// Create new public method to set only time, callable as $().datepicker('setTime', date)
+//#######################################################################################
+$.datepicker._setTimeDatepicker = function(target, date, withDate) {
+	var inst = this._getInst(target),
+		tp_inst = this._get(inst, 'timepicker');
+
+	if (tp_inst) {
+		this._setDateFromField(inst);
+		var tp_date;
+		if (date) {
+			if (typeof date == "string") {
+				tp_inst._parseTime(date, withDate);
+				tp_date = new Date();
+				tp_date.setHours(tp_inst.hour, tp_inst.minute, tp_inst.second, tp_inst.millisec);
+			}
+			else tp_date = new Date(date.getTime());
+			if (tp_date.toString() == 'Invalid Date') tp_date = undefined;
+			this._setTime(inst, tp_date);
+		}
+	}
+
+};
+
+//#######################################################################################
+// override setDate() to allow setting time too within Date object
+//#######################################################################################
+$.datepicker._base_setDateDatepicker = $.datepicker._setDateDatepicker;
+$.datepicker._setDateDatepicker = function(target, date) {
+	var inst = this._getInst(target),
+	tp_date = (date instanceof Date) ? new Date(date.getTime()) : date;
+
+	this._updateDatepicker(inst);
+	this._base_setDateDatepicker.apply(this, arguments);
+	this._setTimeDatepicker(target, tp_date, true);
+};
+
+//#######################################################################################
+// override getDate() to allow getting time too within Date object
+//#######################################################################################
+$.datepicker._base_getDateDatepicker = $.datepicker._getDateDatepicker;
+$.datepicker._getDateDatepicker = function(target, noDefault) {
+	var inst = this._getInst(target),
+		tp_inst = this._get(inst, 'timepicker');
+
+	if (tp_inst) {
+		this._setDateFromField(inst, noDefault);
+		var date = this._getDate(inst);
+		if (date && tp_inst._parseTime($(target).val(), tp_inst.timeOnly)) date.setHours(tp_inst.hour, tp_inst.minute, tp_inst.second, tp_inst.millisec);
+		return date;
+	}
+	return this._base_getDateDatepicker(target, noDefault);
+};
+
+//#######################################################################################
+// override parseDate() because UI 1.8.14 throws an error about "Extra characters"
+// An option in datapicker to ignore extra format characters would be nicer.
+//#######################################################################################
+$.datepicker._base_parseDate = $.datepicker.parseDate;
+$.datepicker.parseDate = function(format, value, settings) {
+	var date;
+	try {
+		date = this._base_parseDate(format, value, settings);
+	} catch (err) {
+		// Hack!  The error message ends with a colon, a space, and
+		// the "extra" characters.  We rely on that instead of
+		// attempting to perfectly reproduce the parsing algorithm.
+		date = this._base_parseDate(format, value.substring(0,value.length-(err.length-err.indexOf(':')-2)), settings);
+	}
+	return date;
+};
+
+//#######################################################################################
+// override formatDate to set date with time to the input
+//#######################################################################################
+$.datepicker._base_formatDate=$.datepicker._formatDate;
+$.datepicker._formatDate = function(inst, day, month, year){
+	var tp_inst = this._get(inst, 'timepicker');
+	if(tp_inst)
+	{
+		if(day)
+			var b = this._base_formatDate(inst, day, month, year);
+		tp_inst._updateDateTime(inst);	
+		return tp_inst.$input.val();
+	}
+	return this._base_formatDate(inst);
+}
+
+//#######################################################################################
+// override options setter to add time to maxDate(Time) and minDate(Time). MaxDate
+//#######################################################################################
+$.datepicker._base_optionDatepicker = $.datepicker._optionDatepicker;
+$.datepicker._optionDatepicker = function(target, name, value) {
+	var inst = this._getInst(target),
+		tp_inst = this._get(inst, 'timepicker');
+	if (tp_inst) {
+		var min,max,onselect;
+		if (typeof name == 'string') { // if min/max was set with the string
+			if (name==='minDate' || name==='minDateTime' )
+				min = value;
+			else if (name==='maxDate' || name==='maxDateTime')
+				max = value;
+			else if (name==='onSelect')
+				onselect=value;
+		} else if (typeof name == 'object') { //if min/max was set with the JSON
+			if(name.minDate)
+				min = name.minDate;
+			else if (name.minDateTime)
+				min = name.minDateTime;
+			else if (name.maxDate)
+				max = name.maxDate;
+			else if (name.maxDateTime)
+				max = name.maxDateTime;
+		}
+		if(min){ //if min was set
+			if(min==0)
+				min=new Date();
+			else
+				min= new Date(min);
+			
+			tp_inst._defaults.minDate = min;
+			tp_inst._defaults.minDateTime = min;
+		} else if (max){ //if max was set
+			if(max==0)
+				max=new Date();
+			else
+				max= new Date(max);
+			tp_inst._defaults.maxDate = max;
+			tp_inst._defaults.maxDateTime = max;
+		}
+		else if (onselect)
+			tp_inst._defaults.onSelect=onselect;
+	}
+	if (value === undefined)
+		return this._base_optionDatepicker(target, name);
+	return this._base_optionDatepicker(target, name, value);
+};
+
+//#######################################################################################
+// jQuery extend now ignores nulls!
+//#######################################################################################
+function extendRemove(target, props) {
+	$.extend(target, props);
+	for (var name in props)
+		if (props[name] === null || props[name] === undefined)
+			target[name] = props[name];
+	return target;
+}
+
+$.timepicker = new Timepicker(); // singleton instance
+$.timepicker.version = "0.9.8";
+
+})(jQuery);
+
Index: trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-pt.js
===================================================================
--- trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-pt.js	(revision 5341)
+++ trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-pt.js	(revision 5341)
@@ -0,0 +1,20 @@
+/* Portuguese translation for the jQuery Timepicker Addon */
+/* Written by Luan Almeida */
+(function($) {
+	$.timepicker.regional['pt'] = {
+		timeOnlyTitle: 'Escolha uma hora',
+		timeText: 'Hora',
+		hourText: 'Horas',
+		minuteText: 'Minutos',
+		secondText: 'Segundos',
+		millisecText: 'Milissegundos',
+		timezoneText: 'Fuso horÃ¡rio',
+		currentText: 'Agora',
+		closeText: 'Fechar',
+		timeFormat: 'hh:mm',
+		amNames: ['a.m.', 'AM', 'A'],
+		pmNames: ['p.m.', 'PM', 'P'],
+		ampm: false
+	};
+	$.timepicker.setDefaults($.timepicker.regional['pt']);
+})(jQuery);
Index: trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-ca.js
===================================================================
--- trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-ca.js	(revision 5341)
+++ trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-ca.js	(revision 5341)
@@ -0,0 +1,20 @@
+/* Catalan translation for the jQuery Timepicker Addon */
+/* Written by Sergi Faber */
+(function($) {
+	$.timepicker.regional['ca'] = {
+		timeOnlyTitle: 'Escollir una hora',
+		timeText: 'Hora',
+		hourText: 'Hores',
+		minuteText: 'Minuts',
+		secondText: 'Segons',
+		millisecText: 'Milisegons',
+		timezoneText: 'Fus horari',
+		currentText: 'Ara',
+		closeText: 'Tancar',
+		timeFormat: 'hh:mm',
+		amNames: ['AM', 'A'],
+		pmNames: ['PM', 'P'],
+		ampm: false
+	};
+	$.timepicker.setDefaults($.timepicker.regional['ca']);
+})(jQuery);
Index: trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-pt-BR.js
===================================================================
--- trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-pt-BR.js	(revision 5341)
+++ trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-pt-BR.js	(revision 5341)
@@ -0,0 +1,20 @@
+/* Brazilian Portuguese translation for the jQuery Timepicker Addon */
+/* Written by Diogo Damiani (diogodamiani@gmail.com) */
+(function ($) {
+	$.timepicker.regional['pt-BR'] = {
+		timeOnlyTitle: 'Escolha a hora',
+		timeText: 'Hora',
+		hourText: 'Horas',
+		minuteText: 'Minutos',
+		secondText: 'Segundos',
+		millisecText: 'Milissegundos',
+		timezoneText: 'Fuso horário',
+		currentText: 'Agora',
+		closeText: 'Fechar',
+		timeFormat: 'hh:mm',
+		amNames: ['a.m.', 'AM', 'A'],
+		pmNames: ['p.m.', 'PM', 'P'],
+		ampm: false
+	};
+	$.timepicker.setDefaults($.timepicker.regional['pt-BR']);
+})(jQuery);
Index: trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-tr.js
===================================================================
--- trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-tr.js	(revision 5341)
+++ trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-tr.js	(revision 5341)
@@ -0,0 +1,20 @@
+/* Turkish translation for the jQuery Timepicker Addon */
+/* Written by Fehmi Can Saglam, Edited by Goktug Ozturk */
+(function($) {
+	$.timepicker.regional['tr'] = {
+		timeOnlyTitle: 'Zaman SeÃ§iniz',
+		timeText: 'Zaman',
+		hourText: 'Saat',
+		minuteText: 'Dakika',
+		secondText: 'Saniye',
+		millisecText: 'Milisaniye',
+		timezoneText: 'Zaman Dilimi',
+		currentText: 'Åu an',
+		closeText: 'Tamam',
+		timeFormat: 'hh:mm',
+		amNames: ['ÃÃ', 'Ã'],
+		pmNames: ['ÃS', 'S'],
+		ampm: false
+	};
+	$.timepicker.setDefaults($.timepicker.regional['tr']);
+})(jQuery);
Index: trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-ru.js
===================================================================
--- trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-ru.js	(revision 5341)
+++ trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-ru.js	(revision 5341)
@@ -0,0 +1,20 @@
+/* Russian translation for the jQuery Timepicker Addon */
+/* Written by Trent Richardson */
+(function($) {
+	$.timepicker.regional['ru'] = {
+		timeOnlyTitle: 'ÐÑÐ±ÐµÑÐžÑÐµ Ð²ÑÐµÐŒÑ',
+		timeText: 'ÐÑÐµÐŒÑ',
+		hourText: 'Ð§Ð°ÑÑ',
+		minuteText: 'ÐÐžÐœÑÑÑ',
+		secondText: 'Ð¡ÐµÐºÑÐœÐŽÑ',
+		millisecText: 'ÐÐžÐ»Ð»ÐžÑÐµÐºÑÐœÐŽÑ',
+		timezoneText: 'ÐÑÐµÐŒÑ Ð·ÐŸÐœÑ',
+		currentText: 'Ð¢ÐµÐ¿ÐµÑÑ',
+		closeText: 'ÐÐ°ÐºÑÑÑÑ',
+		timeFormat: 'hh:mm tt',
+		amNames: ['AM', 'A'],
+		pmNames: ['PM', 'P'],
+		ampm: false
+	};
+	$.timepicker.setDefaults($.timepicker.regional['ru']);
+})(jQuery);
Index: trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-sv.js
===================================================================
--- trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-sv.js	(revision 5341)
+++ trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-sv.js	(revision 5341)
@@ -0,0 +1,20 @@
+/* Swedish translation for the jQuery Timepicker Addon */
+/* Written by Nevon */
+(function($) {
+	$.timepicker.regional['sv'] = {
+		timeOnlyTitle: 'VÃ€lj en tid',
+		timeText: 'Timme',
+		hourText: 'Timmar',
+		minuteText: 'Minuter',
+		secondText: 'Sekunder',
+		millisecText: 'Millisekunder',
+		timezoneText: 'Tidszon',
+		currentText: 'Nu',
+		closeText: 'StÃ€ng',
+		timeFormat: 'hh:mm',
+		amNames: ['AM', 'A'],
+		pmNames: ['PM', 'P'],
+		ampm: false
+	};
+	$.timepicker.setDefaults($.timepicker.regional['sv']);
+})(jQuery);
Index: trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-de.js
===================================================================
--- trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-de.js	(revision 5341)
+++ trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-de.js	(revision 5341)
@@ -0,0 +1,20 @@
+/* German translation for the jQuery Timepicker Addon */
+/* Written by Marvin */
+(function($) {
+	$.timepicker.regional['de'] = {
+		timeOnlyTitle: 'Zeit WÃ€hlen',
+		timeText: 'Zeit',
+		hourText: 'Stunde',
+		minuteText: 'Minute',
+		secondText: 'Sekunde',
+		millisecText: 'Millisekunde',
+		timezoneText: 'Zeitzone',
+		currentText: 'Jetzt',
+		closeText: 'Fertig',
+		timeFormat: 'hh:mm tt',
+		amNames: ['vorm.', 'AM', 'A'],
+		pmNames: ['nachm.', 'PM', 'P'],
+		ampm: false
+	};
+	$.timepicker.setDefaults($.timepicker.regional['de']);
+})(jQuery);
Index: trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-ja.js
===================================================================
--- trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-ja.js	(revision 5341)
+++ trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-ja.js	(revision 5341)
@@ -0,0 +1,20 @@
+/* Japanese translation for the jQuery Timepicker Addon */
+/* Written by Jun Omae */
+(function($) {
+	$.timepicker.regional['ja'] = {
+		timeOnlyTitle: 'æéãéžæ',
+		timeText: 'æé',
+		hourText: 'æ',
+		minuteText: 'å',
+		secondText: 'ç§',
+		millisecText: 'ããªç§',
+		timezoneText: 'ã¿ã€ã ãŸãŒã³',
+		currentText: 'çŸæå»',
+		closeText: 'éãã',
+		timeFormat: 'hh:mm tt',
+		amNames: ['åå', 'AM', 'A'],
+		pmNames: ['ååŸ', 'PM', 'P'],
+		ampm: false
+	};
+	$.timepicker.setDefaults($.timepicker.regional['ja']);
+})(jQuery);
Index: trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-he.js
===================================================================
--- trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-he.js	(revision 5341)
+++ trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-he.js	(revision 5341)
@@ -0,0 +1,20 @@
+/* Hebrew translation for the jQuery Timepicker Addon */
+/* Written by Lior Lapid */
+(function($) {
+	$.timepicker.regional["he"] = {
+		timeOnlyTitle: "×××š××ª ×××",
+		timeText: "×©×¢×",
+		hourText: "×©×¢××ª",
+		minuteText: "××§××ª",
+		secondText: "×©× ×××ª",
+		millisecText: "×××€××ª ××©× ×××",
+		timezoneText: "××××š ×××",
+		currentText: "×¢××©××",
+		closeText:"×¡×××š",
+		timeFormat: "hh:mm tt",
+		amNames: ['××€× ×"×Š', 'AM', 'A'],
+		pmNames: ['×××"×Š', 'PM', 'P'],
+		ampm: false
+	};
+	$.timepicker.setDefaults($.timepicker.regional["he"]);
+})(jQuery);
Index: trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-id.js
===================================================================
--- trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-id.js	(revision 5341)
+++ trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-id.js	(revision 5341)
@@ -0,0 +1,20 @@
+/* Indonesian translation for the jQuery Timepicker Addon */
+/* Written by Nia */
+(function($) {
+	$.timepicker.regional['id'] = {
+		timeOnlyTitle: 'Pilih Waktu',
+		timeText: 'Waktu',
+		hourText: 'Pukul',
+		minuteText: 'Menit',
+		secondText: 'Detik',
+		millisecText: 'Milidetik',
+		timezoneText: 'Zona Waktu',
+		currentText: 'Sekarang',
+		closeText: 'OK',
+		timeFormat: 'hh:mm tt',
+		amNames: ['AM', 'A'],
+		pmNames: ['PM', 'P'],
+		ampm: false
+	};
+	$.timepicker.setDefaults($.timepicker.regional['id']);
+})(jQuery);
Index: trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-fi.js
===================================================================
--- trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-fi.js	(revision 5341)
+++ trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-fi.js	(revision 5341)
@@ -0,0 +1,20 @@
+/* Finnish translation for the jQuery Timepicker Addon */
+/* Written by Juga Paazmaya (http://github.com/paazmaya) */
+(function($) {
+	$.timepicker.regional['fi'] = {
+		timeOnlyTitle: 'Valitse aika',
+		timeText: 'Aika',
+		hourText: 'Tunti',
+		minuteText: 'Minuutti',
+		secondText: 'Sekunti',
+		millisecText: 'Millisekunnin',
+		timezoneText: 'AikavyÃ¶hyke',
+		currentText: 'Nyt',
+		closeText: 'Sulje',
+		timeFormat: 'hh:mm',
+		amNames: ['ap.', 'AM', 'A'],
+		pmNames: ['ip.', 'PM', 'P'],
+		ampm: false
+	};
+	$.timepicker.setDefaults($.timepicker.regional['fi']);
+})(jQuery);
Index: trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-el.js
===================================================================
--- trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-el.js	(revision 5341)
+++ trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-el.js	(revision 5341)
@@ -0,0 +1,22 @@
+/* Hellenic translation for the jQuery Timepicker Addon */
+/* Written by Christos Pontikis */
+(function($) {
+	$.timepicker.regional['el'] = {
+		timeOnlyTitle: 'ÎÏÎ¹Î»Î¿Î³Î® ÏÏÎ±Ï',
+		timeText: 'ÎÏÎ±',
+		hourText: 'ÎÏÎµÏ',
+		minuteText: 'ÎÎµÏÏÎ¬',
+		secondText: 'ÎÎµÏ
+ÏÎµÏÏÎ»ÎµÏÏÎ±',
+		millisecText: 'ÎŒÎ¹Î»Î¹ÎŽÎµÏ
+ÏÎµÏÏÎ»ÎµÏÏÎ¿',
+		timezoneText: 'ÎÏÎœÎ· ÏÏÎ±Ï',
+		currentText: 'Î€ÏÏÎ±',
+		closeText: 'ÎÎ»ÎµÎ¯ÏÎ¹ÎŒÎ¿',
+		timeFormat: 'hh:mm',
+		amNames: ['Ï.ÎŒ.', 'AM', 'A'],
+		pmNames: ['ÎŒ.ÎŒ.', 'PM', 'P'],
+		ampm: false
+	};
+	$.timepicker.setDefaults($.timepicker.regional['el']);
+})(jQuery);
Index: trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-gl.js
===================================================================
--- trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-gl.js	(revision 5341)
+++ trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-gl.js	(revision 5341)
@@ -0,0 +1,20 @@
+/* Galician translation for the jQuery Timepicker Addon */
+/* Written by David Barral */
+(function($) {
+	$.timepicker.regional['gl'] = {
+		timeOnlyTitle: 'Elixir unha hora',
+		timeText: 'Hora',
+		hourText: 'Horas',
+		minuteText: 'Minutos',
+		secondText: 'Segundos',
+		millisecText: 'Milisegundos',
+		timezoneText: 'Fuso horario',
+		currentText: 'Agora',
+		closeText: 'Pechar',
+		timeFormat: 'hh:mm',
+		amNames: ['a.m.', 'AM', 'A'],
+		pmNames: ['p.m.', 'PM', 'P'],
+		ampm: false
+	};
+	$.timepicker.setDefaults($.timepicker.regional['gl']);
+})(jQuery);
Index: trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-cs.js
===================================================================
--- trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-cs.js	(revision 5341)
+++ trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-cs.js	(revision 5341)
@@ -0,0 +1,20 @@
+/* Czech translation for the jQuery Timepicker Addon */
+/* Written by OndÅej VodÃ¡Äek */
+(function($) {
+	$.timepicker.regional['cs'] = {
+		timeOnlyTitle: 'Vyberte Äas',
+		timeText: 'Äas',
+		hourText: 'Hodiny',
+		minuteText: 'Minuty',
+		secondText: 'VteÅiny',
+		millisecText: 'Milisekundy',
+		timezoneText: 'ÄasovÃ© pÃ¡smo',
+		currentText: 'NynÃ­',
+		closeText: 'ZavÅÃ­t',
+		timeFormat: 'h:m',
+		amNames: ['dop.', 'AM', 'A'],
+		pmNames: ['odp.', 'PM', 'P'],
+		ampm: false
+	};
+	$.timepicker.setDefaults($.timepicker.regional['cs']);
+})(jQuery);
Index: trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-es.js
===================================================================
--- trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-es.js	(revision 5341)
+++ trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-es.js	(revision 5341)
@@ -0,0 +1,20 @@
+/* Spanish translation for the jQuery Timepicker Addon */
+/* Written by IanarÃ© SÃ©vi */
+(function($) {
+	$.timepicker.regional['es'] = {
+		timeOnlyTitle: 'Elegir una hora',
+		timeText: 'Hora',
+		hourText: 'Horas',
+		minuteText: 'Minutos',
+		secondText: 'Segundos',
+		millisecText: 'Milisegundos',
+		timezoneText: 'Huso horario',
+		currentText: 'Ahora',
+		closeText: 'Cerrar',
+		timeFormat: 'hh:mm',
+		amNames: ['a.m.', 'AM', 'A'],
+		pmNames: ['p.m.', 'PM', 'P'],
+		ampm: false
+	};
+	$.timepicker.setDefaults($.timepicker.regional['es']);
+})(jQuery);
Index: trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-fr.js
===================================================================
--- trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-fr.js	(revision 5341)
+++ trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-fr.js	(revision 5341)
@@ -0,0 +1,20 @@
+/* French translation for the jQuery Timepicker Addon */
+/* Written by Thomas LÃ©tÃ© */
+(function($) {
+	$.timepicker.regional['fr'] = {
+		timeOnlyTitle: 'Choisir une heure',
+		timeText: 'Heure',
+		hourText: 'Heures',
+		minuteText: 'Minutes',
+		secondText: 'Secondes',
+		millisecText: 'Millisecondes',
+		timezoneText: 'Fuseau horaire',
+		currentText: 'Maintenant',
+		closeText: 'TerminÃ©',
+		timeFormat: 'hh:mm',
+		amNames: ['AM', 'A'],
+		pmNames: ['PM', 'P'],
+		ampm: false
+	};
+	$.timepicker.setDefaults($.timepicker.regional['fr']);
+})(jQuery);
Index: trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-et.js
===================================================================
--- trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-et.js	(revision 5341)
+++ trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-et.js	(revision 5341)
@@ -0,0 +1,20 @@
+/* Estonian translation for the jQuery Timepicker Addon */
+/* Written by Karl Sutt (karl@sutt.ee) */
+(function($) {
+	$.timepicker.regional['et'] = {
+		timeOnlyTitle: 'Vali aeg',
+		timeText: 'Aeg',
+		hourText: 'Tund',
+		minuteText: 'Minut',
+		secondText: 'Sekund',
+		millisecText: 'Millisekundis',
+		timezoneText: 'AjavÃ¶Ã¶nd',
+		currentText: 'Praegu',
+		closeText: 'Valmis',
+		timeFormat: 'hh:mm tt',
+		amNames: ['AM', 'A'],
+		pmNames: ['PM', 'P'],
+		ampm: false
+	};
+	$.timepicker.setDefaults($.timepicker.regional['et']);
+})(jQuery);
Index: trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-nl.js
===================================================================
--- trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-nl.js	(revision 5341)
+++ trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-nl.js	(revision 5341)
@@ -0,0 +1,20 @@
+/* Dutch translation for the jQuery Timepicker Addon */
+/* Written by Martijn van der Lee */
+(function($) {
+	$.timepicker.regional['nl'] = {
+		timeOnlyTitle: 'Tijdstip',
+		timeText: 'Tijd',
+		hourText: 'Uur',
+		minuteText: 'Minuut',
+		secondText: 'Seconde',
+		millisecText: 'Milliseconde',
+		timezoneText: 'Tijdzone',
+		currentText: 'Vandaag',
+		closeText: 'Sluiten',
+		timeFormat: 'hh:mm tt',
+		amNames: ['AM', 'A'],
+		pmNames: ['PM', 'P'],
+		ampm: false
+	};
+	$.timepicker.setDefaults($.timepicker.regional['nl']);
+})(jQuery);
Index: trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-zh-TW.js
===================================================================
--- trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-zh-TW.js	(revision 5341)
+++ trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-zh-TW.js	(revision 5341)
@@ -0,0 +1,20 @@
+/* Chinese translation for the jQuery Timepicker Addon */
+/* Written by Alang.lin */
+(function($) {
+	$.timepicker.regional['zh-TW'] = {
+		timeOnlyTitle: 'éžææåç§',
+		timeText: 'æé',
+		hourText: 'æ',
+		minuteText: 'å',
+		secondText: 'ç§',
+		millisecText: 'æ¯«ç§',
+		timezoneText: 'æå',
+		currentText: 'çŸåšæé',
+		closeText: 'ç¢ºå®',
+		timeFormat: 'hh:mm tt',
+		amNames: ['äžå', 'AM', 'A'],
+		pmNames: ['äžå', 'PM', 'P'],
+		ampm: false
+	};
+	$.timepicker.setDefaults($.timepicker.regional['zh-TW']);
+})(jQuery);
Index: trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-pl.js
===================================================================
--- trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-pl.js	(revision 5341)
+++ trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-pl.js	(revision 5341)
@@ -0,0 +1,20 @@
+/* Polish translation for the jQuery Timepicker Addon */
+/* Written by MichaÅ Pena */
+(function($) {
+	$.timepicker.regional['pl'] = {
+		timeOnlyTitle: 'Wybierz godzinÄ',
+		timeText: 'Czas',
+		hourText: 'Godzina',
+		minuteText: 'Minuta',
+		secondText: 'Sekunda',
+		millisecText: 'Milisekunda',
+		timezoneText: 'Strefa czasowa',
+		currentText: 'Teraz',
+		closeText: 'Gotowe',
+		timeFormat: 'hh:mm tt',
+		amNames: ['AM', 'A'],
+		pmNames: ['PM', 'P'],
+		ampm: false
+	};
+	$.timepicker.setDefaults($.timepicker.regional['pl']);
+})(jQuery);
Index: trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-it.js
===================================================================
--- trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-it.js	(revision 5341)
+++ trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-it.js	(revision 5341)
@@ -0,0 +1,20 @@
+/* Italian translation for the jQuery Timepicker Addon */
+/* Written by Marco "logicoder" Del Tongo */
+(function($) {
+    $.timepicker.regional['it'] = {
+        timeOnlyTitle: 'Scegli orario',
+        timeText: 'Orario',
+        hourText: 'Ora',
+        minuteText: 'Minuto',
+        secondText: 'Secondo',
+        millisecText: 'Millisecondo',
+        timezoneText: 'Fuso orario',
+        currentText: 'Adesso',
+        closeText: 'Chiudi',
+        timeFormat: 'hh:mm',
+        amNames: ['m.', 'AM', 'A'],
+        pmNames: ['p.', 'PM', 'P'],
+        ampm: false
+    };
+    $.timepicker.setDefaults($.timepicker.regional['it']);
+})(jQuery);
Index: trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-hu.js
===================================================================
--- trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-hu.js	(revision 5341)
+++ trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-hu.js	(revision 5341)
@@ -0,0 +1,20 @@
+﻿/* Hungarian translation for the jQuery Timepicker Addon */
+/* Written by Vas Gábor */
+(function($) {
+	$.timepicker.regional['hu'] = {
+		timeOnlyTitle: 'Válasszon időpontot',
+		timeText: 'Idő',
+		hourText: 'Óra',
+		minuteText: 'Perc',
+		secondText: 'Másodperc',
+		millisecText: 'Milliszekundumos',
+		timezoneText: 'Időzóna',
+		currentText: 'Most',
+		closeText: 'Kész',
+		timeFormat: 'hh:mm tt',
+		amNames: ['de.', 'AM', 'A'],
+		pmNames: ['du.', 'PM', 'P'],
+		ampm: false
+	};
+	$.timepicker.setDefaults($.timepicker.regional['hu']);
+})(jQuery);
Index: trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-sk.js
===================================================================
--- trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-sk.js	(revision 5341)
+++ trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-sk.js	(revision 5341)
@@ -0,0 +1,20 @@
+/* Slovak translation for the jQuery Timepicker Addon */
+/* Written by David Vallner */
+(function($) {
+	$.timepicker.regional['sk'] = {
+		timeOnlyTitle: 'ZvoÄŸte Äas',
+		timeText: 'Äas',
+		hourText: 'Hodiny',
+		minuteText: 'MinÃºty',
+		secondText: 'Sekundy',
+		millisecText: 'Milisekundy',
+		timezoneText: 'ÄasovÃ© pÃ¡smo',
+		currentText: 'Teraz',
+		closeText: 'ZavrieÅ¥',
+		timeFormat: 'h:m',
+		amNames: ['dop.', 'AM', 'A'],
+		pmNames: ['pop.', 'PM', 'P'],
+		ampm: false
+	};
+	$.timepicker.setDefaults($.timepicker.regional['sk']);
+})(jQuery);
Index: trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-vi.js
===================================================================
--- trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-vi.js	(revision 5341)
+++ trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-vi.js	(revision 5341)
@@ -0,0 +1,20 @@
+/* Vietnamese translation for the jQuery Timepicker Addon */
+/* Written by Nguyen Dinh Trung */
+(function($) {
+	$.timepicker.regional['vi'] = {
+		timeOnlyTitle: 'Chá»n giá»',
+		timeText: 'Thá»i gian',
+		hourText: 'Giá»',
+		minuteText: 'PhÃºt',
+		secondText: 'GiÃ¢y',
+		millisecText: 'Pháº§n nghÃ¬n giÃ¢y',
+		timezoneText: 'MÃºi giá»',
+		currentText: 'Hiá»n thá»i',
+		closeText: 'ÄÃ³ng'
+		timeFormat: 'h:m',
+		amNames: ['SA', 'AM', 'A'],
+		pmNames: ['CH', 'PM', 'P'],
+		ampm: false
+	};
+	$.timepicker.setDefaults($.timepicker.regional['vi']);
+})(jQuery);
Index: trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-lt.js
===================================================================
--- trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-lt.js	(revision 5341)
+++ trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-lt.js	(revision 5341)
@@ -0,0 +1,21 @@
+/* Lithuanian translation for the jQuery Timepicker Addon */
+/* Written by Irmantas Å iupÅ¡inskas */
+(function($) {
+	$.timepicker.regional['lt'] = {
+		timeOnlyTitle: 'Pasirinkite laikÄ
+',
+		timeText: 'Laikas',
+		hourText: 'Valandos',
+		minuteText: 'MinutÄs',
+		secondText: 'SekundÄs',
+		millisecText: 'MilisekundÄs',
+		timezoneText: 'Laiko zona',
+		currentText: 'Dabar',
+		closeText: 'UÅŸdaryti',
+		timeFormat: 'hh:mm',
+		amNames: ['prieÅ¡piet', 'AM', 'A'],
+		pmNames: ['popiet', 'PM', 'P'],
+		ampm: false
+	};
+	$.timepicker.setDefaults($.timepicker.regional['lt']);
+})(jQuery);
Index: trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-zh-CN.js
===================================================================
--- trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-zh-CN.js	(revision 5341)
+++ trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-zh-CN.js	(revision 5341)
@@ -0,0 +1,21 @@
+/* Simplified Chinese translation for the jQuery Timepicker Addon /
+/ Written by Will Lu */
+(function($) {
+	$.timepicker.regional['zh-CN'] = {
+		timeOnlyTitle: 'éæ©æ¶éŽ',
+		timeText: 'æ¶éŽ',
+		hourText: 'å°æ¶',
+		minuteText: 'åé',
+		secondText: 'ç§é',
+		millisecText: 'åŸ®ç§',
+		timezoneText: 'æ¶åº',
+		currentText: 'ç°åšæ¶éŽ',
+		closeText: 'å
+³é­',
+		timeFormat: 'hh:mm',
+		amNames: ['AM', 'A'],
+		pmNames: ['PM', 'P'],
+		ampm: false
+	};
+	$.timepicker.setDefaults($.timepicker.regional['zh-CN']);
+})(jQuery);
Index: trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-ro.js
===================================================================
--- trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-ro.js	(revision 5341)
+++ trunk/prototype/plugins/timepicker/localization/jquery-ui-timepicker-ro.js	(revision 5341)
@@ -0,0 +1,20 @@
+/* Romanian translation for the jQuery Timepicker Addon */
+/* Written by Romeo Adrian Cioaba */
+(function($) {
+	$.timepicker.regional['ro'] = {
+		timeOnlyTitle: 'AlegeÅ£i o orÄ',
+		timeText: 'Timp',
+		hourText: 'Ore',
+		minuteText: 'Minute',
+		secondText: 'Secunde',
+		millisecText: 'Milisecunde',
+		timezoneText: 'Fus orar',
+		currentText: 'Acum',
+		closeText: 'Ãnchide',
+		timeFormat: 'hh:mm',
+		amNames: ['AM', 'A'],
+		pmNames: ['PM', 'P'],
+		ampm: false
+	};
+	$.timepicker.setDefaults($.timepicker.regional['ro']);
+})(jQuery);
Index: trunk/prototype/plugins/timepicker/README.md
===================================================================
--- trunk/prototype/plugins/timepicker/README.md	(revision 5341)
+++ trunk/prototype/plugins/timepicker/README.md	(revision 5341)
@@ -0,0 +1,12 @@
+jQuery Timepicker Addon
+=======================
+
+Use
+---
+- To use this plugin you must include jQuery and jQuery UI with datepicker and slider
+- Include timepicker-addon script
+- now use timepicker with $('#selector').datetimepicker() or $('#selector').timepicker()
+
+Contributing Code - Please Read!
+--------------------------------
+All code contributions and bug reports are much appreciated.  Please be sure to apply your fixes to the "dev" branch.
Index: trunk/prototype/plugins/timepicker/jquery-ui-timepicker-addon.css
===================================================================
--- trunk/prototype/plugins/timepicker/jquery-ui-timepicker-addon.css	(revision 5341)
+++ trunk/prototype/plugins/timepicker/jquery-ui-timepicker-addon.css	(revision 5341)
@@ -0,0 +1,6 @@
+.ui-timepicker-div .ui-widget-header { margin-bottom: 8px; }
+.ui-timepicker-div dl { text-align: left; }
+.ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }
+.ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }
+.ui-timepicker-div td { font-size: 90%; }
+.ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; }
Index: trunk/prototype/plugins/watermark/jquery.watermarkinput.js
===================================================================
--- trunk/prototype/plugins/watermark/jquery.watermarkinput.js	(revision 5341)
+++ trunk/prototype/plugins/watermark/jquery.watermarkinput.js	(revision 5341)
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2007 Josh Bush (digitalbush.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. 
+ */
+ 
+/*
+ * Version: Beta 1
+ * Release: 2007-06-01
+ */ 
+(function($) {
+	var map=new Array();
+	$.Watermark = {
+		ShowAll:function(){
+			for (var i=0;i<map.length;i++){
+				if(map[i].obj.val()==""){
+					map[i].obj.val(map[i].text);					
+					map[i].obj.css("color",map[i].WatermarkColor);
+				}else{
+				    map[i].obj.css("color",map[i].DefaultColor);
+				}
+			}
+		},
+		HideAll:function(){
+			for (var i=0;i<map.length;i++){
+				if(map[i].obj.val()==map[i].text)
+					map[i].obj.val("");					
+			}
+		}
+	}
+	
+	$.fn.Watermark = function(text,color) {
+		if(!color)
+			color="#aaa";
+		return this.each(
+			function(){		
+				var input=$(this);
+				var defaultColor=input.css("color");
+				map[map.length]={text:text,obj:input,DefaultColor:defaultColor,WatermarkColor:color};
+				function clearMessage(){
+					if(input.val()==text)
+						input.val("");
+					input.css("color",defaultColor);
+				}
+
+				function insertMessage(){
+					if(input.val().length==0 || input.val()==text){
+						input.val(text);
+						input.css("color",color);	
+					}else
+						input.css("color",defaultColor);				
+				}
+
+				input.focus(clearMessage);
+				input.blur(insertMessage);								
+				input.change(insertMessage);
+				
+				insertMessage();
+			}
+		);
+	};
+})(jQuery);
Index: trunk/prototype/plugins/scrollto/jquery.scrollTo.js
===================================================================
--- trunk/prototype/plugins/scrollto/jquery.scrollTo.js	(revision 5349)
+++ trunk/prototype/plugins/scrollto/jquery.scrollTo.js	(revision 5349)
@@ -0,0 +1,215 @@
+/**
+ * jQuery.ScrollTo
+ * Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
+ * Dual licensed under MIT and GPL.
+ * Date: 5/25/2009
+ *
+ * @projectDescription Easy element scrolling using jQuery.
+ * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
+ * Works with jQuery +1.2.6. Tested on FF 2/3, IE 6/7/8, Opera 9.5/6, Safari 3, Chrome 1 on WinXP.
+ *
+ * @author Ariel Flesler
+ * @version 1.4.2
+ *
+ * @id jQuery.scrollTo
+ * @id jQuery.fn.scrollTo
+ * @param {String, Number, DOMElement, jQuery, Object} target Where to scroll the matched elements.
+ *	  The different options for target are:
+ *		- A number position (will be applied to all axes).
+ *		- A string position ('44', '100px', '+=90', etc ) will be applied to all axes
+ *		- A jQuery/DOM element ( logically, child of the element to scroll )
+ *		- A string selector, that will be relative to the element to scroll ( 'li:eq(2)', etc )
+ *		- A hash { top:x, left:y }, x and y can be any kind of number/string like above.
+*		- A percentage of the container's dimension/s, for example: 50% to go to the middle.
+ *		- The string 'max' for go-to-end. 
+ * @param {Number} duration The OVERALL length of the animation, this argument can be the settings object instead.
+ * @param {Object,Function} settings Optional set of settings or the onAfter callback.
+ *	 @option {String} axis Which axis must be scrolled, use 'x', 'y', 'xy' or 'yx'.
+ *	 @option {Number} duration The OVERALL length of the animation.
+ *	 @option {String} easing The easing method for the animation.
+ *	 @option {Boolean} margin If true, the margin of the target element will be deducted from the final position.
+ *	 @option {Object, Number} offset Add/deduct from the end position. One number for both axes or { top:x, left:y }.
+ *	 @option {Object, Number} over Add/deduct the height/width multiplied by 'over', can be { top:x, left:y } when using both axes.
+ *	 @option {Boolean} queue If true, and both axis are given, the 2nd axis will only be animated after the first one ends.
+ *	 @option {Function} onAfter Function to be called after the scrolling ends. 
+ *	 @option {Function} onAfterFirst If queuing is activated, this function will be called after the first scrolling ends.
+ * @return {jQuery} Returns the same jQuery object, for chaining.
+ *
+ * @desc Scroll to a fixed position
+ * @example $('div').scrollTo( 340 );
+ *
+ * @desc Scroll relatively to the actual position
+ * @example $('div').scrollTo( '+=340px', { axis:'y' } );
+ *
+ * @dec Scroll using a selector (relative to the scrolled element)
+ * @example $('div').scrollTo( 'p.paragraph:eq(2)', 500, { easing:'swing', queue:true, axis:'xy' } );
+ *
+ * @ Scroll to a DOM element (same for jQuery object)
+ * @example var second_child = document.getElementById('container').firstChild.nextSibling;
+ *			$('#container').scrollTo( second_child, { duration:500, axis:'x', onAfter:function(){
+ *				alert('scrolled!!');																   
+ *			}});
+ *
+ * @desc Scroll on both axes, to different values
+ * @example $('div').scrollTo( { top: 300, left:'+=200' }, { axis:'xy', offset:-20 } );
+ */
+;(function( $ ){
+	
+	var $scrollTo = $.scrollTo = function( target, duration, settings ){
+		$(window).scrollTo( target, duration, settings );
+	};
+
+	$scrollTo.defaults = {
+		axis:'xy',
+		duration: parseFloat($.fn.jquery) >= 1.3 ? 0 : 1
+	};
+
+	// Returns the element that needs to be animated to scroll the window.
+	// Kept for backwards compatibility (specially for localScroll & serialScroll)
+	$scrollTo.window = function( scope ){
+		return $(window)._scrollable();
+	};
+
+	// Hack, hack, hack :)
+	// Returns the real elements to scroll (supports window/iframes, documents and regular nodes)
+	$.fn._scrollable = function(){
+		return this.map(function(){
+			var elem = this,
+				isWin = !elem.nodeName || $.inArray( elem.nodeName.toLowerCase(), ['iframe','#document','html','body'] ) != -1;
+
+				if( !isWin )
+					return elem;
+
+			var doc = (elem.contentWindow || elem).document || elem.ownerDocument || elem;
+			
+			return $.browser.safari || doc.compatMode == 'BackCompat' ?
+				doc.body : 
+				doc.documentElement;
+		});
+	};
+
+	$.fn.scrollTo = function( target, duration, settings ){
+		if( typeof duration == 'object' ){
+			settings = duration;
+			duration = 0;
+		}
+		if( typeof settings == 'function' )
+			settings = { onAfter:settings };
+			
+		if( target == 'max' )
+			target = 9e9;
+			
+		settings = $.extend( {}, $scrollTo.defaults, settings );
+		// Speed is still recognized for backwards compatibility
+		duration = duration || settings.speed || settings.duration;
+		// Make sure the settings are given right
+		settings.queue = settings.queue && settings.axis.length > 1;
+		
+		if( settings.queue )
+			// Let's keep the overall duration
+			duration /= 2;
+		settings.offset = both( settings.offset );
+		settings.over = both( settings.over );
+
+		return this._scrollable().each(function(){
+			var elem = this,
+				$elem = $(elem),
+				targ = target, toff, attr = {},
+				win = $elem.is('html,body');
+
+			switch( typeof targ ){
+				// A number will pass the regex
+				case 'number':
+				case 'string':
+					if( /^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(targ) ){
+						targ = both( targ );
+						// We are done
+						break;
+					}
+					// Relative selector, no break!
+					targ = $(targ,this);
+				case 'object':
+					// DOMElement / jQuery
+					if( targ.is || targ.style )
+						// Get the real position of the target 
+						toff = (targ = $(targ)).offset();
+			}
+			$.each( settings.axis.split(''), function( i, axis ){
+				var Pos	= axis == 'x' ? 'Left' : 'Top',
+					pos = Pos.toLowerCase(),
+					key = 'scroll' + Pos,
+					old = elem[key],
+					max = $scrollTo.max(elem, axis);
+
+				if( toff ){// jQuery / DOMElement
+					attr[key] = toff[pos] + ( win ? 0 : old - $elem.offset()[pos] );
+
+					// If it's a dom element, reduce the margin
+					if( settings.margin ){
+						attr[key] -= parseInt(targ.css('margin'+Pos)) || 0;
+						attr[key] -= parseInt(targ.css('border'+Pos+'Width')) || 0;
+					}
+					
+					attr[key] += settings.offset[pos] || 0;
+					
+					if( settings.over[pos] )
+						// Scroll to a fraction of its width/height
+						attr[key] += targ[axis=='x'?'width':'height']() * settings.over[pos];
+				}else{ 
+					var val = targ[pos];
+					// Handle percentage values
+					attr[key] = val.slice && val.slice(-1) == '%' ? 
+						parseFloat(val) / 100 * max
+						: val;
+				}
+
+				// Number or 'number'
+				if( /^\d+$/.test(attr[key]) )
+					// Check the limits
+					attr[key] = attr[key] <= 0 ? 0 : Math.min( attr[key], max );
+
+				// Queueing axes
+				if( !i && settings.queue ){
+					// Don't waste time animating, if there's no need.
+					if( old != attr[key] )
+						// Intermediate animation
+						animate( settings.onAfterFirst );
+					// Don't animate this axis again in the next iteration.
+					delete attr[key];
+				}
+			});
+
+			animate( settings.onAfter );			
+
+			function animate( callback ){
+				$elem.animate( attr, duration, settings.easing, callback && function(){
+					callback.call(this, target, settings);
+				});
+			};
+
+		}).end();
+	};
+	
+	// Max scrolling position, works on quirks mode
+	// It only fails (not too badly) on IE, quirks mode.
+	$scrollTo.max = function( elem, axis ){
+		var Dim = axis == 'x' ? 'Width' : 'Height',
+			scroll = 'scroll'+Dim;
+		
+		if( !$(elem).is('html,body') )
+			return elem[scroll] - $(elem)[Dim.toLowerCase()]();
+		
+		var size = 'client' + Dim,
+			html = elem.ownerDocument.documentElement,
+			body = elem.ownerDocument.body;
+
+		return Math.max( html[scroll], body[scroll] ) 
+			 - Math.min( html[size]  , body[size]   );
+			
+	};
+
+	function both( val ){
+		return typeof val == 'object' ? val : { top:val, left:val };
+	};
+
+})( jQuery );
Index: trunk/prototype/plugins/scrollto/jquery.scrollTo-min.js
===================================================================
--- trunk/prototype/plugins/scrollto/jquery.scrollTo-min.js	(revision 5349)
+++ trunk/prototype/plugins/scrollto/jquery.scrollTo-min.js	(revision 5349)
@@ -0,0 +1,11 @@
+/**
+ * jQuery.ScrollTo - Easy element scrolling using jQuery.
+ * Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
+ * Dual licensed under MIT and GPL.
+ * Date: 5/25/2009
+ * @author Ariel Flesler
+ * @version 1.4.2
+ *
+ * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
+ */
+;(function(d){var k=d.scrollTo=function(a,i,e){d(window).scrollTo(a,i,e)};k.defaults={axis:'xy',duration:parseFloat(d.fn.jquery)>=1.3?0:1};k.window=function(a){return d(window)._scrollable()};d.fn._scrollable=function(){return this.map(function(){var a=this,i=!a.nodeName||d.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!i)return a;var e=(a.contentWindow||a).document||a.ownerDocument||a;return d.browser.safari||e.compatMode=='BackCompat'?e.body:e.documentElement})};d.fn.scrollTo=function(n,j,b){if(typeof j=='object'){b=j;j=0}if(typeof b=='function')b={onAfter:b};if(n=='max')n=9e9;b=d.extend({},k.defaults,b);j=j||b.speed||b.duration;b.queue=b.queue&&b.axis.length>1;if(b.queue)j/=2;b.offset=p(b.offset);b.over=p(b.over);return this._scrollable().each(function(){var q=this,r=d(q),f=n,s,g={},u=r.is('html,body');switch(typeof f){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){f=p(f);break}f=d(f,this);case'object':if(f.is||f.style)s=(f=d(f)).offset()}d.each(b.axis.split(''),function(a,i){var e=i=='x'?'Left':'Top',h=e.toLowerCase(),c='scroll'+e,l=q[c],m=k.max(q,i);if(s){g[c]=s[h]+(u?0:l-r.offset()[h]);if(b.margin){g[c]-=parseInt(f.css('margin'+e))||0;g[c]-=parseInt(f.css('border'+e+'Width'))||0}g[c]+=b.offset[h]||0;if(b.over[h])g[c]+=f[i=='x'?'width':'height']()*b.over[h]}else{var o=f[h];g[c]=o.slice&&o.slice(-1)=='%'?parseFloat(o)/100*m:o}if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],m);if(!a&&b.queue){if(l!=g[c])t(b.onAfterFirst);delete g[c]}});t(b.onAfter);function t(a){r.animate(g,j,b.easing,a&&function(){a.call(this,n,b)})}}).end()};k.max=function(a,i){var e=i=='x'?'Width':'Height',h='scroll'+e;if(!d(a).is('html,body'))return a[h]-d(a)[e.toLowerCase()]();var c='client'+e,l=a.ownerDocument.documentElement,m=a.ownerDocument.body;return Math.max(l[h],m[h])-Math.min(l[c],m[c])};function p(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);
Index: trunk/prototype/plugins/when/When_Iterator.php
===================================================================
--- trunk/prototype/plugins/when/When_Iterator.php	(revision 5341)
+++ trunk/prototype/plugins/when/When_Iterator.php	(revision 5341)
@@ -0,0 +1,112 @@
+<?php
+/**
+ * Name: When_Iterator
+ * Author: Thomas Planer <tplaner@gmail.com>
+ * Location: http://github.com/tplaner/When
+ * Created: November 2010
+ * Description: Implements PHP's Object Iteration Interface (http://us.php.net/Iterator & http://php.net/manual/en/class.iterator.php) so you can use the object within a foreach loop.
+ * 
+ * Thanks to Andrew Collington for suggesting the implementation of an Iterator and supplying the base code for it.
+ */
+
+require_once('When.php');
+
+class When_Iterator extends When implements Iterator 
+{
+	// store the current position in the array
+	protected $position = 0;
+
+	// store an individual result if caching is disabled
+	protected $result;
+
+	// store all of the results
+	protected $results = array();
+
+	protected $cache = false;
+
+	// caching the results will cause the script to
+	// use more memory but less cpu (should also perform quicker)
+	// 
+	// results should always be the same regardless of cache
+	public function __construct($cache = false) 
+	{
+		parent::__construct();
+
+		$this->position = 0;
+		$this->results = array();
+		$this->cache = $cache;
+	}
+
+	public function rewind()
+	{
+		if($this->cache)
+		{
+			$this->position = 0;
+		}
+		else
+		{
+			// reset the counter and try_date in the parent class
+			$this->counter = 0;
+			$this->try_date = clone $this->start_date;
+		}
+	}
+
+	public function current()
+	{
+		if($this->cache === true)
+		{
+			return $this->results[$this->position];
+		}
+		else
+		{
+			return $this->result;
+		}
+	}
+
+	// only used if caching is enabled
+	public function key()
+	{
+		return $this->position;
+	}
+
+	// only used of caching is enabled
+	public function next()
+	{
+		++$this->position;
+	}
+
+	public function valid()
+	{
+		if($this->cache === true)
+		{
+			// check to see if the current position has already been stored
+			if(!empty($this->results[$this->position]))
+			{
+				return isset($this->results[$this->position]);
+			}
+			// if it hasn't been found, check to see if there are more dates
+			elseif($next_date = parent::next())
+			{
+				$this->results[] = $next_date;
+				return isset($next_date);
+			}
+		}
+		else
+		{
+			// check to see if there is another result and set that as the result
+			if($next_date = parent::next())
+			{
+				$this->result = $next_date;
+				return isset($this->result);
+			}
+		}
+
+		// end the foreach loop when all options are exhausted
+		return false;
+	}
+
+	public function enable_cache($cache)
+	{
+		$this->cache = $cache;
+	}
+}
Index: trunk/prototype/plugins/when/When.php
===================================================================
--- trunk/prototype/plugins/when/When.php	(revision 5341)
+++ trunk/prototype/plugins/when/When.php	(revision 5341)
@@ -0,0 +1,725 @@
+<?php
+/**
+ * Name: When
+ * Author: Thomas Planer <tplaner@gmail.com>
+ * Location: http://github.com/tplaner/When
+ * Created: September 2010
+ * Description: Determines the next date of recursion given an iCalendar "rrule" like pattern.
+ * Requirements: PHP 5.3+ - makes extensive use of the Date and Time library (http://us2.php.net/manual/en/book.datetime.php)
+ */
+class When
+{
+	protected $frequency;
+	
+	protected $start_date;
+	protected $try_date;
+	
+	protected $end_date;
+	
+	protected $gobymonth;
+	protected $bymonth;
+	
+	protected $gobyweekno;
+	protected $byweekno;
+	
+	protected $gobyyearday;
+	protected $byyearday;
+	
+	protected $gobymonthday;
+	protected $bymonthday;
+	
+	protected $gobyday;
+	protected $byday;
+	
+	protected $gobysetpos;
+	protected $bysetpos;
+		
+	protected $suggestions;
+	
+	protected $count;
+	protected $counter;
+	
+	protected $goenddate;
+	
+	protected $interval;
+	
+	protected $wkst;
+	
+	protected $valid_week_days;
+	protected $valid_frequency;
+		
+	/**
+	 * __construct
+	 */
+	public function __construct()
+	{
+		$this->frequency = null;
+		
+		$this->gobymonth = false;
+		$this->bymonth = range(1,12);
+		
+		$this->gobymonthday = false;
+		$this->bymonthday = range(1,31);
+		
+		$this->gobyday = false;
+		// setup the valid week days (0 = sunday)
+		$this->byday = range(0,6);
+		
+		$this->gobyyearday = false;
+		$this->byyearday = range(0,366);
+		
+		$this->gobysetpos = false;
+		$this->bysetpos = range(1,366);
+		
+		$this->gobyweekno = false;
+		// setup the range for valid weeks
+		$this->byweekno = range(0,54);
+		
+		$this->suggestions = array();
+		
+		// this will be set if a count() is specified
+		$this->count = 0;
+		// how many *valid* results we returned
+		$this->counter = 0;
+		
+		// max date we'll return
+		$this->end_date = new DateTime('9999-12-31');
+		
+		// the interval to increase the pattern by
+		$this->interval = 1;
+		
+		// what day does the week start on? (0 = sunday)
+		$this->wkst = 0;
+		
+		$this->valid_week_days = array('SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA');
+		
+		$this->valid_frequency = array('SECONDLY', 'MINUTELY', 'HOURLY', 'DAILY', 'WEEKLY', 'MONTHLY', 'YEARLY');
+	}
+	
+	/**
+	 * @param DateTime|string $start_date of the recursion - also is the first return value.
+	 * @param string $frequency of the recrusion, valid frequencies: secondly, minutely, hourly, daily, weekly, monthly, yearly
+	 */
+	public function recur($start_date, $frequency = "daily")
+	{
+		try
+		{
+			if(is_object($start_date))
+			{
+				$this->start_date = clone $start_date;
+			}
+			else
+			{
+				// timestamps within the RFC have a 'Z' at the end of them, remove this.
+				$start_date = trim($start_date, 'Z');
+				$this->start_date = new DateTime($start_date);
+			}
+			
+			$this->try_date = clone $this->start_date;
+		}
+		catch(Exception $e)
+		{
+			throw new InvalidArgumentException('Invalid start date DateTime: ' . $e);
+		}
+		
+		$this->freq($frequency);
+		
+		return $this;
+	}
+
+	public function freq($frequency)
+	{
+		if(in_array(strtoupper($frequency), $this->valid_frequency))
+		{
+			$this->frequency = strtoupper($frequency);
+		}
+		else
+		{
+			throw new InvalidArgumentException('Invalid frequency type.');
+		}
+
+		return $this;
+	}
+
+	// accepts an rrule directly
+	public function rrule($rrule)
+	{
+		// strip off a trailing semi-colon
+		$rrule = trim($rrule, ";");
+		
+		$parts = explode(";", $rrule);
+
+		foreach($parts as $part)
+		{
+			list($rule, $param) = explode("=", $part);
+
+			$rule = strtoupper($rule);
+			$param = strtoupper($param);
+
+			switch($rule)
+			{
+				case "FREQ":
+					$this->frequency = $param;
+					break;
+				case "UNTIL":
+					$this->until($param);
+					break;
+				case "COUNT":
+					$this->count($param);
+					break;
+				case "INTERVAL":
+					$this->interval($param);
+					break;
+				case "BYDAY":
+					$params = explode(",", $param);
+					$this->byday($params);
+					break;
+				case "BYMONTHDAY":
+					$params = explode(",", $param);
+					$this->bymonthday($params);
+					break;
+				case "BYYEARDAY":
+					$params = explode(",", $param);
+					$this->byyearday($params);
+					break;
+				case "BYWEEKNO":
+					$params = explode(",", $param);
+					$this->byweekno($params);
+					break;
+				case "BYMONTH":
+					$params = explode(",", $param);
+					$this->bymonth($params);
+					break;
+				case "BYSETPOS":
+					$params = explode(",", $param);
+					$this->bysetpos($params);
+					break;
+				case "WKST":
+					$this->wkst($param);
+					break;
+			}
+		}
+
+		return $this;
+	}
+	
+	//max number of items to return based on the pattern
+	public function count($count)
+	{
+		$this->count = (int)$count;
+		
+		return $this;
+	}
+	
+	// how often the recurrence rule repeats
+	public function interval($interval)
+	{
+		$this->interval = (int)$interval;
+		
+		return $this;
+	}
+	
+	// starting day of the week
+	public function wkst($day)
+	{
+		switch($day)
+		{
+			case 'SU':
+				$this->wkst = 0;
+				break;
+			case 'MO':
+				$this->wkst = 1;
+				break;
+			case 'TU':
+				$this->wkst = 2;
+				break;
+			case 'WE':
+				$this->wkst = 3;
+				break;
+			case 'TH':
+				$this->wkst = 4;
+				break;
+			case 'FR':
+				$this->wkst = 5;
+				break;
+			case 'SA':
+				$this->wkst = 6;
+				break;
+		}
+		
+		return $this;
+	}
+	
+	// max date
+	public function until($end_date)
+	{		
+		try
+		{
+			if(is_object($end_date))
+			{
+				$this->end_date = clone $end_date;
+			}
+			else
+			{
+				// timestamps within the RFC have a 'Z' at the end of them, remove this.
+				$end_date = trim($end_date, 'Z');
+				$this->end_date = new DateTime($end_date);
+			}
+		}
+		catch(Exception $e)
+		{
+			throw new InvalidArgumentException('Invalid end date DateTime: ' . $e);
+		}
+		
+		return $this;
+	}
+
+	public function bymonth($months)
+	{	
+		if(is_array($months))
+		{
+			$this->gobymonth = true;
+			$this->bymonth = $months;
+		}
+		
+		return $this;
+	}
+	
+	public function bymonthday($days)
+	{	
+		if(is_array($days))
+		{
+			$this->gobymonthday = true;
+			$this->bymonthday = $days;
+		}
+		
+		return $this;
+	}
+	
+	public function byweekno($weeks)
+	{
+		$this->gobyweekno = true;
+		
+		if(is_array($weeks))
+		{
+			$this->byweekno = $weeks;
+		}
+		
+		return $this;
+	}
+	
+	public function bysetpos($days)
+	{
+		$this->gobysetpos = true;
+		
+		if(is_array($days))
+		{
+			$this->bysetpos = $days;
+		}
+		
+		return $this;
+	}
+	
+	public function byday($days)
+	{		
+		$this->gobyday = true;
+		
+		if(is_array($days))
+		{
+			$this->byday = array();
+			foreach($days as $day)
+			{
+				$len = strlen($day);
+				
+				$as = '+';
+				
+				// 0 mean no occurence is set
+				$occ = 0;
+				
+				if($len == 3)
+				{
+					$occ = substr($day, 0, 1);
+				}
+				if($len == 4)
+				{
+					$as = substr($day, 0, 1);
+					$occ = substr($day, 1, 1);
+				}
+				
+				if($as == '-')
+				{
+					$occ = '-' . $occ;
+				}
+				else
+				{
+					$occ = '+' . $occ;
+				}
+				
+				$day = substr($day, -2, 2);
+				switch($day)
+				{
+					case 'SU':
+						$this->byday[] = $occ . 'SU';
+						break;
+					case 'MO':
+						$this->byday[] = $occ . 'MO';
+						break;
+					case 'TU':
+						$this->byday[] = $occ . 'TU';
+						break;
+					case 'WE':
+						$this->byday[] = $occ . 'WE';
+						break;
+					case 'TH':
+						$this->byday[] = $occ . 'TH';
+						break;
+					case 'FR':
+						$this->byday[] = $occ . 'FR';
+						break;
+					case 'SA':
+						$this->byday[] = $occ . 'SA';
+						break;
+				}
+			}
+		}
+		
+		return $this;
+	}
+	
+	public function byyearday($days)
+	{
+		$this->gobyyearday = true;
+		
+		if(is_array($days))
+		{
+			$this->byyearday = $days;
+		}
+		
+		return $this;
+	}
+	
+	// this creates a basic list of dates to "try"
+	protected function create_suggestions()
+	{
+		switch($this->frequency)
+		{
+			case "YEARLY":
+				$interval = 'year';
+				break;
+			case "MONTHLY":
+				$interval = 'month';
+				break;
+			case "WEEKLY":
+				$interval = 'week';
+				break;
+			case "DAILY":
+				$interval = 'day';
+				break;
+			case "HOURLY":
+				$interval = 'hour';
+				break;
+			case "MINUTELY":
+				$interval = 'minute';
+				break;
+			case "SECONDLY":
+				$interval = 'second';
+				break;
+		}
+					
+		$month_day = $this->try_date->format('j');
+		$month = $this->try_date->format('n');
+		$year = $this->try_date->format('Y');
+		
+		$timestamp = $this->try_date->format('H:i:s');
+					
+		if($this->gobysetpos)
+		{				
+			if($this->try_date == $this->start_date)
+			{
+				$this->suggestions[] = clone $this->try_date;
+			}
+			else
+			{
+				if($this->gobyday)
+				{
+					foreach($this->bysetpos as $_pos)
+					{
+						$tmp_array = array();
+						$_mdays = range(1, date('t',mktime(0,0,0,$month,1,$year)));
+						foreach($_mdays as $_mday)
+						{
+							$date_time = new DateTime($year . '-' . $month . '-' . $_mday . ' ' . $timestamp);
+							
+							$occur = ceil($_mday / 7);
+							
+							$day_of_week = $date_time->format('l');
+							$dow_abr = strtoupper(substr($day_of_week, 0, 2));
+							
+							// set the day of the month + (positive)
+							$occur = '+' . $occur . $dow_abr;
+							$occur_zero = '+0' . $dow_abr;
+							
+							// set the day of the month - (negative)
+							$total_days = $date_time->format('t') - $date_time->format('j');
+							$occur_neg = '-' . ceil(($total_days + 1)/7) . $dow_abr;
+							
+							$day_from_end_of_month = $date_time->format('t') + 1 - $_mday;
+							
+							if(in_array($occur, $this->byday) || in_array($occur_zero, $this->byday) || in_array($occur_neg, $this->byday))
+							{								
+								$tmp_array[] = clone $date_time;
+							}
+						}
+						
+						if($_pos > 0)
+						{
+							$this->suggestions[] = clone $tmp_array[$_pos - 1];
+						}
+						else
+						{
+							$this->suggestions[] = clone $tmp_array[count($tmp_array) + $_pos];
+						}
+						
+					}
+				}
+			}
+		}
+		elseif($this->gobyyearday)
+		{
+			foreach($this->byyearday as $_day)
+			{
+				if($_day >= 0)
+				{
+					$_day--;
+					
+					$_time = strtotime('+' . $_day . ' days', mktime(0, 0, 0, 1, 1, $year));
+					$this->suggestions[] = new Datetime(date('Y-m-d', $_time) . ' ' . $timestamp);
+				}
+				else
+				{
+					$year_day_neg = 365 + $_day;
+					$leap_year = $this->try_date->format('L');
+					if($leap_year == 1)
+					{
+						$year_day_neg = 366 + $_day;
+					}
+					
+					$_time = strtotime('+' . $year_day_neg . ' days', mktime(0, 0, 0, 1, 1, $year));
+					$this->suggestions[] = new Datetime(date('Y-m-d', $_time) . ' ' . $timestamp);
+				}					
+			}
+		}
+		// special case because for years you need to loop through the months too
+		elseif($this->gobyday && $interval == "year")
+		{
+			foreach($this->bymonth as $_month)
+			{
+				// this creates an array of days of the month
+				$_mdays = range(1, date('t',mktime(0,0,0,$_month,1,$year)));
+				foreach($_mdays as $_mday)
+				{
+					$date_time = new DateTime($year . '-' . $_month . '-' . $_mday . ' ' . $timestamp);
+					
+					// get the week of the month (1, 2, 3, 4, 5, etc)
+					$week = $date_time->format('W');
+					
+					if($date_time >= $this->start_date && in_array($week, $this->byweekno))
+					{
+						$this->suggestions[] = clone $date_time;
+					}
+				}
+			}
+		}
+		elseif($interval == "day")
+		{
+			$this->suggestions[] = clone $this->try_date;
+		}
+		elseif($interval == "week")
+		{
+			$this->suggestions[] = clone $this->try_date;
+			
+			if($this->gobyday)
+			{
+				$week_day = $this->try_date->format('w');
+				
+				$days_in_month = $this->try_date->format('t');
+				
+				$overflow_count = 1;
+				$_day = $month_day;
+				
+				$run = true;
+				while($run)
+				{
+					$_day++;
+					if($_day <= $days_in_month)
+					{
+						$tmp_date = new DateTime($year . '-' . $month . '-' . $_day . ' ' . $timestamp);
+					}
+					else
+					{
+						//$tmp_month = $month+1;
+						$tmp_date = new DateTime($year . '-' . $month . '-' . $overflow_count . ' ' . $timestamp);
+						$tmp_date->modify('+1 month');
+						$overflow_count++;
+					}
+					
+					$week_day = $tmp_date->format('w');
+					
+					if($this->try_date == $this->start_date)
+					{
+						if($week_day == $this->wkst)
+						{
+							$this->try_date = clone $tmp_date;
+							$this->try_date->modify('-7 days');
+							$run = false;
+						}
+					}
+
+					if($week_day != $this->wkst)
+					{
+						$this->suggestions[] = clone $tmp_date;
+					}
+					else
+					{
+						$run = false;
+					}
+				}
+			}
+		}
+		elseif($this->gobyday || $interval == "month")
+		{
+			$_mdays = range(1, date('t',mktime(0,0,0,$month,1,$year)));
+			foreach($_mdays as $_mday)
+			{
+				$date_time = new DateTime($year . '-' . $month . '-' . $_mday . ' ' . $timestamp);
+				
+				// get the week of the month (1, 2, 3, 4, 5, etc)
+				$week = $date_time->format('W');
+				
+				if($date_time >= $this->start_date && in_array($week, $this->byweekno))
+				{
+					$this->suggestions[] = clone $date_time;
+				}
+			}
+		}
+		elseif($this->gobymonth)
+		{
+			foreach($this->bymonth as $_month)
+			{
+				$date_time = new DateTime($year . '-' . $_month . '-' . $month_day . ' ' . $timestamp);
+				
+				if($date_time >= $this->start_date)
+				{
+					$this->suggestions[] = clone $date_time;
+				}
+			}
+		} 
+		else 
+		{
+			$this->suggestions[] = clone $this->try_date;
+		}
+		
+		if($interval == "month")
+		{
+			$this->try_date->modify('last day of ' . $this->interval . ' ' . $interval);
+		}
+		else
+		{
+			$this->try_date->modify($this->interval . ' ' . $interval);
+		}
+	}
+	
+	protected function valid_date($date)
+	{
+		$year = $date->format('Y');
+		$month = $date->format('n');
+		$day = $date->format('j');
+		
+		$year_day = $date->format('z') + 1;
+		
+		$year_day_neg = -366 + $year_day;
+		$leap_year = $date->format('L');
+		if($leap_year == 1)
+		{
+			$year_day_neg = -367 + $year_day;
+		}
+		
+		// this is the nth occurence of the date
+		$occur = ceil($day / 7);
+		
+		$week = $date->format('W');
+		
+		$day_of_week = $date->format('l');
+		$dow_abr = strtoupper(substr($day_of_week, 0, 2));
+		
+		// set the day of the month + (positive)
+		$occur = '+' . $occur . $dow_abr;
+		$occur_zero = '+0' . $dow_abr;
+		
+		// set the day of the month - (negative)
+		$total_days = $date->format('t') - $date->format('j');
+		$occur_neg = '-' . ceil(($total_days + 1)/7) . $dow_abr;
+		
+		$day_from_end_of_month = $date->format('t') + 1 - $day;
+		
+		if(in_array($month, $this->bymonth) && 
+		   (in_array($occur, $this->byday) || in_array($occur_zero, $this->byday) || in_array($occur_neg, $this->byday)) && 
+		   in_array($week, $this->byweekno) &&
+		   (in_array($day, $this->bymonthday) || in_array(-$day_from_end_of_month, $this->bymonthday)) &&
+		   (in_array($year_day, $this->byyearday) || in_array($year_day_neg, $this->byyearday)))
+		{
+			return true;
+		}
+		else
+		{
+			return false;
+		}
+	}
+
+	// return the next valid DateTime object which matches the pattern and follows the rules
+	public function next()
+	{		
+		// check the counter is set
+		if($this->count !== 0)
+		{
+			if($this->counter >= $this->count)
+			{
+				return false;
+			}
+		}
+		
+		// create initial set of suggested dates
+		if(count($this->suggestions) === 0)
+		{
+			$this->create_suggestions();
+		}
+		
+		// loop through the suggested dates
+		while(count($this->suggestions) > 0)
+		{
+			// get the first one on the array
+			$try_date = array_shift($this->suggestions);
+			
+			// make sure the date doesn't exceed the max date
+			if($try_date > $this->end_date)
+			{
+				return false;
+			}
+			
+			// make sure it falls within the allowed days
+			if($this->valid_date($try_date) === true)
+			{
+				$this->counter++;
+				return $try_date;
+			}
+			else
+			{
+				// we might be out of suggested days, so load some more
+				if(count($this->suggestions) === 0)
+				{
+					$this->create_suggestions();
+				}
+			}
+		}
+	}
+}
Index: trunk/prototype/plugins/jquery.dateFormat/jquery.dateFormat.js
===================================================================
--- trunk/prototype/plugins/jquery.dateFormat/jquery.dateFormat.js	(revision 5341)
+++ trunk/prototype/plugins/jquery.dateFormat/jquery.dateFormat.js	(revision 5341)
@@ -0,0 +1,263 @@
+(function ($) {
+		
+		var daysInWeek = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
+		var shortMonthsInYear = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
+		var longMonthsInYear = ["January", "February", "March", "April", "May", "June", 
+														"July", "August", "September", "October", "November", "December"];
+		var shortMonthsToNumber = [];
+		shortMonthsToNumber["Jan"] = "01";
+		shortMonthsToNumber["Feb"] = "02";
+		shortMonthsToNumber["Mar"] = "03";
+		shortMonthsToNumber["Apr"] = "04";
+		shortMonthsToNumber["May"] = "05";
+		shortMonthsToNumber["Jun"] = "06";
+		shortMonthsToNumber["Jul"] = "07";
+		shortMonthsToNumber["Aug"] = "08";
+		shortMonthsToNumber["Sep"] = "09";
+		shortMonthsToNumber["Oct"] = "10";
+		shortMonthsToNumber["Nov"] = "11";
+		shortMonthsToNumber["Dec"] = "12";
+	
+    $.format = (function () {
+        function strDay(value) {
+ 						return daysInWeek[parseInt(value, 10)] || value;
+        }
+
+        function strMonth(value) {
+						var monthArrayIndex = parseInt(value, 10) - 1;
+ 						return shortMonthsInYear[monthArrayIndex] || value;
+        }
+
+        function strLongMonth(value) {
+					var monthArrayIndex = parseInt(value, 10) - 1;
+					return longMonthsInYear[monthArrayIndex] || value;					
+        }
+
+        var parseMonth = function (value) {
+					return shortMonthsToNumber[value] || value;
+        };
+
+        var parseTime = function (value) {
+                var retValue = value;
+                var millis = "";
+                if (retValue.indexOf(".") !== -1) {
+                    var delimited = retValue.split('.');
+                    retValue = delimited[0];
+                    millis = delimited[1];
+                }
+
+                var values3 = retValue.split(":");
+
+                if (values3.length === 3) {
+                    hour = values3[0];
+                    minute = values3[1];
+                    second = values3[2];
+
+                    return {
+                        time: retValue,
+                        hour: hour,
+                        minute: minute,
+                        second: second,
+                        millis: millis
+                    };
+                } else {
+                    return {
+                        time: "",
+                        hour: "",
+                        minute: "",
+                        second: "",
+                        millis: ""
+                    };
+                }
+            };
+
+        return {
+            date: function (value, format) {
+                /* 
+					value = new java.util.Date()
+                 	2009-12-18 10:54:50.546 
+				*/
+                try {
+                    var date = null;
+                    var year = null;
+                    var month = null;
+                    var dayOfMonth = null;
+                    var dayOfWeek = null;
+                    var time = null;
+                    if (typeof value.getFullYear === "function") {
+                        year = value.getFullYear();
+                        month = value.getMonth() + 1;
+                        dayOfMonth = value.getDate();
+                        dayOfWeek = value.getDay();
+                        time = parseTime(value.toTimeString());
+										} else if (value.search(/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.?\d{0,3}[-+]?\d{2}:\d{2}/) != -1) { /* 2009-04-19T16:11:05+02:00 */
+                        var values = value.split(/[T\+-]/);
+                        year = values[0];
+                        month = values[1];
+                        dayOfMonth = values[2];
+                        time = parseTime(values[3].split(".")[0]);
+                        date = new Date(year, month - 1, dayOfMonth);
+                        dayOfWeek = date.getDay();
+                    } else {
+                        var values = value.split(" ");
+                        switch (values.length) {
+                        case 6:
+                            /* Wed Jan 13 10:43:41 CET 2010 */
+                            year = values[5];
+                            month = parseMonth(values[1]);
+                            dayOfMonth = values[2];
+                            time = parseTime(values[3]);
+                            date = new Date(year, month - 1, dayOfMonth);
+                            dayOfWeek = date.getDay();
+                            break;
+                        case 2:
+                            /* 2009-12-18 10:54:50.546 */
+                            var values2 = values[0].split("-");
+                            year = values2[0];
+                            month = values2[1];
+                            dayOfMonth = values2[2];
+                            time = parseTime(values[1]);
+                            date = new Date(year, month - 1, dayOfMonth);
+                            dayOfWeek = date.getDay();
+                            break;
+                        case 7:
+                            /* Tue Mar 01 2011 12:01:42 GMT-0800 (PST) */
+                        case 9:
+                            /*added by Larry, for Fri Apr 08 2011 00:00:00 GMT+0800 (China Standard Time) */
+                        case 10:
+                            /* added by Larry, for Fri Apr 08 2011 00:00:00 GMT+0200 (W. Europe Daylight Time) */
+                            year = values[3];
+                            month = parseMonth(values[1]);
+                            dayOfMonth = values[2];
+                            time = parseTime(values[4]);
+                            date = new Date(year, month - 1, dayOfMonth);
+                            dayOfWeek = date.getDay();
+                            break;
+                        default:
+                            return value;
+                        }
+                    }
+
+                    var pattern = "";
+                    var retValue = "";
+                    /*
+						Issue 1 - variable scope issue in format.date 
+                    	Thanks jakemonO
+					*/
+                    for (var i = 0; i < format.length; i++) {
+                        var currentPattern = format.charAt(i);
+                        pattern += currentPattern;
+                        switch (pattern) {
+                        case "ddd":
+                            retValue += strDay(dayOfWeek);
+                            pattern = "";
+                            break;
+                        case "dd":
+                            if (format.charAt(i + 1) == "d") {
+                                break;
+                            }
+                            if (String(dayOfMonth).length === 1) {
+                                dayOfMonth = '0' + dayOfMonth;
+                            }
+                            retValue += dayOfMonth;
+                            pattern = "";
+                            break;
+                        case "MMMM":
+                            retValue += strLongMonth(month);
+                            pattern = "";
+                            break;
+                        case "MMM":
+                            if (format.charAt(i + 1) === "M") {
+                                break;
+                            }
+                            retValue += strMonth(month);
+                            pattern = "";
+                            break;
+                        case "MM":
+                            if (format.charAt(i + 1) == "M") {
+                                break;
+                            }
+                            if (String(month).length === 1) {
+                                month = '0' + month;
+                            }
+                            retValue += month;
+                            pattern = "";
+                            break;
+                        case "yyyy":
+                            retValue += year;
+                            pattern = "";
+                            break;
+                        case "HH":
+                            retValue += time.hour;
+                            pattern = "";
+                            break;
+                        case "hh":
+                            /* time.hour is "00" as string == is used instead of === */
+                            retValue += (time.hour == 0 ? 12 : time.hour < 13 ? time.hour : time.hour - 12);
+                            pattern = "";
+                            break;
+                        case "mm":
+                            retValue += time.minute;
+                            pattern = "";
+                            break;
+                        case "ss":
+                            /* ensure only seconds are added to the return string */
+                            retValue += time.second.substring(0, 2);
+                            pattern = "";
+                            break;
+                        case "SSS":
+                            retValue += time.millis.substring(0, 3);
+                            pattern = "";
+                            break;
+                        case "a":
+                            retValue += time.hour >= 12 ? "PM" : "AM";
+                            pattern = "";
+                            break;
+                        case " ":
+                            retValue += currentPattern;
+                            pattern = "";
+                            break;
+                        case "/":
+                            retValue += currentPattern;
+                            pattern = "";
+                            break;
+                        case ":":
+                            retValue += currentPattern;
+                            pattern = "";
+                            break;
+                        default:
+                            if (pattern.length === 2 && pattern.indexOf("y") !== 0 && pattern != "SS") {
+                                retValue += pattern.substring(0, 1);
+                                pattern = pattern.substring(1, 2);
+                            } else if ((pattern.length === 3 && pattern.indexOf("yyy") === -1)) {
+                                pattern = "";
+                            }
+                        }
+                    }
+                    return retValue;
+                } catch (e) {
+                    console.log(e);
+                    return value;
+                }
+            }
+        };
+    }());
+}(jQuery));
+
+
+$(document).ready(function () {
+    $(".shortDateFormat").each(function (idx, elem) {
+        if ($(elem).is(":input")) {
+            $(elem).val($.format.date($(elem).val(), "dd/MM/yyyy"));
+        } else {
+            $(elem).text($.format.date($(elem).text(), "dd/MM/yyyy"));
+        }
+    });
+    $(".longDateFormat").each(function (idx, elem) {
+        if ($(elem).is(":input")) {
+            $(elem).val($.format.date($(elem).val(), "dd/MM/yyyy hh:mm:ss"));
+        } else {
+            $(elem).text($.format.date($(elem).text(), "dd/MM/yyyy hh:mm:ss"));
+        }
+    });
+});
Index: trunk/prototype/plugins/davicalCliente/XMLElement.php
===================================================================
--- trunk/prototype/plugins/davicalCliente/XMLElement.php	(revision 5399)
+++ trunk/prototype/plugins/davicalCliente/XMLElement.php	(revision 5399)
@@ -0,0 +1,344 @@
+<?php
+/**
+* A class to assist with construction of XML documents
+*
+* @package   awl
+* @subpackage   XMLElement
+* @author    Andrew McMillan <andrew@mcmillan.net.nz>
+* @copyright Catalyst .Net Ltd, Morphoss Ltd <http://www.morphoss.com/>
+* @license   http://www.gnu.org/licenses/lgpl-3.0.txt  GNU LGPL version 3 or later
+*/
+require_once ROOTPATH.'/plugins/davicalCliente/AWLUtilities.php';
+
+/**
+* A class for XML elements which may have attributes, or contain
+* other XML sub-elements
+*
+* @package   awl
+*/
+class XMLElement {
+  protected $tagname;
+  protected $xmlns;
+  protected $attributes;
+  protected $content;
+  protected $_parent;
+
+  /**
+  * Constructor - nothing fancy as yet.
+  *
+  * @param string $tagname The tag name of the new element
+  * @param mixed $content Either a string of content, or an array of sub-elements
+  * @param array $attributes An array of attribute name/value pairs
+  * @param string $xmlns An XML namespace specifier
+  */
+  function __construct( $tagname, $content=false, $attributes=false, $xmlns=null ) {
+    $this->tagname=$tagname;
+    if ( gettype($content) == "object" ) {
+      // Subtree to be parented here
+      $this->content = array(&$content);
+    }
+    else {
+      // Array or text
+      $this->content = $content;
+    }
+    $this->attributes = $attributes;
+    if ( isset($this->attributes['xmlns']) ) {  // Oversimplification to be removed
+      $this->xmlns = $this->attributes['xmlns'];
+    }
+    if ( isset($xmlns) ) {
+      $this->xmlns = $xmlns;
+    }
+  }
+
+
+  /**
+  * Count the number of elements
+  * @return int The number of elements
+  */
+  function CountElements( ) {
+    if ( $this->content === false ) return 0;
+    if ( is_array($this->content) ) return count($this->content);
+    if ( $this->content == '' ) return 0;
+    return 1;
+  }
+
+  /**
+  * Set an element attribute to a value
+  *
+  * @param string The attribute name
+  * @param string The attribute value
+  */
+  function SetAttribute($k,$v) {
+    if ( gettype($this->attributes) != "array" ) $this->attributes = array();
+    $this->attributes[$k] = $v;
+    if ( strtolower($k) == 'xmlns' ) {
+      $this->xmlns = $v;
+    }
+  }
+
+  /**
+  * Set the whole content to a value
+  *
+  * @param mixed The element content, which may be text, or an array of sub-elements
+  */
+  function SetContent($v) {
+    $this->content = $v;
+  }
+
+  /**
+  * Accessor for the tag name
+  *
+  * @return string The tag name of the element
+  */
+  function GetTag() {
+    return $this->tagname;
+  }
+
+  /**
+  * Accessor for the full-namespaced tag name
+  *
+  * @return string The tag name of the element, prefixed by the namespace
+  */
+  function GetNSTag() {
+    return $this->xmlns . ':' . $this->tagname;
+  }
+
+  /**
+  * Accessor for a single attribute
+  * @param string $attr The name of the attribute.
+  * @return string The value of that attribute of the element
+  */
+  function GetAttribute( $attr ) {
+    if ( $attr == 'xmlns' ) return $this->xmlns;
+    if ( isset($this->attributes[$attr]) ) return $this->attributes[$attr];
+    return null;
+  }
+
+  /**
+  * Accessor for the attributes
+  *
+  * @return array The attributes of this element
+  */
+  function GetAttributes() {
+    return $this->attributes;
+  }
+
+  /**
+  * Accessor for the content
+  *
+  * @return array The content of this element
+  */
+  function GetContent() {
+    return $this->content;
+  }
+
+  /**
+  * Return an array of elements matching the specified tag, or all elements if no tag is supplied.
+  * Unlike GetContent() this will always return an array.
+  *
+  * @return array The XMLElements within the tree which match this tag
+  */
+  function GetElements( $tag=null, $recursive=false ) {
+    $elements = array();
+    if ( gettype($this->content) == "array" ) {
+      foreach( $this->content AS $k => $v ) {
+        if ( !isset($tag) || (isset($v->tagname) && $v->tagname == $tag) ) {
+          $elements[] = $v;
+        }
+        if ( $recursive ) {
+          $elements = $elements + $v->GetElements($tag,true);
+        }
+      }
+    }
+    else if ( !isset($tag) || (isset($v->content->tagname) && $this->content->tagname == $tag) ) {
+      $elements[] = $this->content;
+    }
+    return $elements;
+  }
+
+
+  /**
+  * Return an array of elements matching the specified path
+  *
+  * @return array The XMLElements within the tree which match this tag
+  */
+  function GetPath( $path ) {
+    $elements = array();
+    // printf( "Querying within '%s' for path '%s'\n", $this->tagname, $path );
+    if ( !preg_match( '#(/)?([^/]+)(/?.*)$#', $path, $matches ) ) return $elements;
+    // printf( "Matches: %s -- %s -- %s\n", $matches[1], $matches[2], $matches[3] );
+    if ( $matches[2] == '*' || strtolower($matches[2]) == strtolower($this->tagname) ) {
+      if ( $matches[3] == '' ) {
+        /**
+        * That is the full path
+        */
+        $elements[] = $this;
+      }
+      else if ( gettype($this->content) == "array" ) {
+        /**
+        * There is more to the path, so we recurse into that sub-part
+        */
+        foreach( $this->content AS $k => $v ) {
+          $elements = array_merge( $elements, $v->GetPath($matches[3]) );
+        }
+      }
+    }
+
+    if ( $matches[1] != '/' && gettype($this->content) == "array" ) {
+      /**
+      * If our input $path was not rooted, we recurse further
+      */
+      foreach( $this->content AS $k => $v ) {
+        $elements = array_merge( $elements, $v->GetPath($path) );
+      }
+    }
+    // printf( "Found %d within '%s' for path '%s'\n", count($elements), $this->tagname, $path );
+    return $elements;
+  }
+
+
+  /**
+  * Add a sub-element
+  *
+  * @param object An XMLElement to be appended to the array of sub-elements
+  */
+  function AddSubTag(&$v) {
+    if ( gettype($this->content) != "array" ) $this->content = array();
+    $this->content[] =& $v;
+    return count($this->content);
+  }
+
+  /**
+  * Add a new sub-element
+  *
+  * @param string The tag name of the new element
+  * @param mixed Either a string of content, or an array of sub-elements
+  * @param array An array of attribute name/value pairs
+  *
+  * @return objectref A reference to the new XMLElement
+  */
+  function &NewElement( $tagname, $content=false, $attributes=false, $xmlns=null ) {
+    if ( gettype($this->content) != "array" ) $this->content = array();
+    $element = new XMLElement($tagname,$content,$attributes,$xmlns);
+    $this->content[] =& $element;
+    return $element;
+  }
+
+
+  /**
+  * Render just the internal content
+  *
+  * @return string The content of this element, as a string without this element wrapping it.
+  */
+  function RenderContent($indent=0, $nslist=null ) {
+    $r = "";
+    if ( is_array($this->content) ) {
+      /**
+      * Render the sub-elements with a deeper indent level
+      */
+      $r .= "\n";
+      foreach( $this->content AS $k => $v ) {
+        if ( is_object($v) ) {
+          $r .= $v->Render($indent+1, "", $nslist);
+        }
+      }
+      $r .= substr("                        ",0,$indent);
+    }
+    else {
+      /**
+      * Render the content, with special characters escaped
+      *
+      */
+      $r .= htmlspecialchars($this->content, ENT_NOQUOTES );
+    }
+    return $r;
+  }
+
+
+  /**
+  * Render the document tree into (nicely formatted) XML
+  *
+  * @param int The indenting level for the pretty formatting of the element
+  */
+  function Render($indent=0, $xmldef="", $nslist=null) {
+    $r = ( $xmldef == "" ? "" : $xmldef."\n");
+
+    $attr = "";
+    $tagname = $this->tagname;
+    if ( gettype($this->attributes) == "array" ) {
+      /**
+      * Render the element attribute values
+      */
+      foreach( $this->attributes AS $k => $v ) {
+        if ( preg_match('#^xmlns(:?(.+))?$#', $k, $matches ) ) {
+          if ( !isset($nslist) ) $nslist = array();
+          $prefix = (isset($matches[2]) ? $matches[2] : '');
+          if ( isset($nslist[$v]) && $nslist[$v] == $prefix ) continue; // No need to include in list as it's in a wrapping element
+          $nslist[$v] = $prefix;
+          if ( !isset($this->xmlns) ) $this->xmlns = $v;
+        }
+        $attr .= sprintf( ' %s="%s"', $k, htmlspecialchars($v) );
+      }
+    }
+    if ( isset($this->xmlns) && isset($nslist[$this->xmlns]) && $nslist[$this->xmlns] != '' ) {
+      $tagname = $nslist[$this->xmlns] . ':' . $tagname;
+    }
+
+    $r .= substr("                        ",0,$indent) . '<' . $tagname . $attr;
+
+    if ( (is_array($this->content) && count($this->content) > 0) || (!is_array($this->content) && strlen($this->content) > 0) ) {
+      $r .= ">";
+      $r .= $this->RenderContent($indent,$nslist);
+      $r .= '</' . $tagname.">\n";
+    }
+    else {
+      $r .= "/>\n";
+    }
+    return $r;
+  }
+
+
+  function __tostring() {
+    return $this->Render();
+  }
+}
+
+
+/**
+* Rebuild an XML tree in our own style from the parsed XML tags using
+* a tail-recursive approach.
+*
+* @param array $xmltags An array of XML tags we get from using the PHP XML parser
+* @param intref &$start_from A pointer to our current integer offset into $xmltags
+* @return mixed Either a single XMLElement, or an array of XMLElement objects.
+*/
+function BuildXMLTree( $xmltags, &$start_from ) {
+  $content = array();
+
+  if ( !isset($start_from) ) $start_from = 0;
+
+  for( $i=0; $i < 50000 && isset($xmltags[$start_from]); $i++) {
+    $tagdata = $xmltags[$start_from++];
+    if ( !isset($tagdata) || !isset($tagdata['tag']) || !isset($tagdata['type']) ) break;
+    if ( $tagdata['type'] == "close" ) break;
+    $attributes = ( isset($tagdata['attributes']) ? $tagdata['attributes'] : false );
+    if ( $tagdata['type'] == "open" ) {
+      $subtree = BuildXMLTree( $xmltags, $start_from );
+      $content[] = new XMLElement($tagdata['tag'], $subtree, $attributes );
+    }
+    else if ( $tagdata['type'] == "complete" ) {
+      $value = ( isset($tagdata['value']) ? $tagdata['value'] : false );
+      $content[] = new XMLElement($tagdata['tag'], $value, $attributes );
+    }
+  }
+
+  /**
+  * If there is only one element, return it directly, otherwise return the
+  * array of them
+  */
+  if ( count($content) == 1 ) {
+    return $content[0];
+  }
+  return $content;
+}
+
Index: trunk/prototype/plugins/davicalCliente/caldav-client-v2.php
===================================================================
--- trunk/prototype/plugins/davicalCliente/caldav-client-v2.php	(revision 5399)
+++ trunk/prototype/plugins/davicalCliente/caldav-client-v2.php	(revision 5399)
@@ -0,0 +1,1050 @@
+<?php
+/**
+* A Class for connecting to a caldav server
+*
+* @package   awl
+*
+* @subpackage   caldav
+* @author Andrew McMillan <andrew@mcmillan.net.nz>
+* @copyright Andrew McMillan
+* @license   http://www.gnu.org/licenses/lgpl-3.0.txt  GNU LGPL version 3 or later
+*/
+ 
+require_once ROOTPATH.'/plugins/davicalCliente/XMLDocument.php';
+
+/**
+* A class for holding basic calendar information
+* @package awl
+*/
+class CalendarInfo {
+  public $url, $displayname, $getctag;
+
+  function __construct( $url, $displayname = null, $getctag = null ) {
+    $this->url = $url;
+    $this->displayname = $displayname;
+    $this->getctag = $getctag;
+  }
+
+  function __toString() {
+    return( '(URL: '.$this->url.'   Ctag: '.$this->getctag.'   Displayname: '.$this->displayname .')'. "\n" );
+  }
+}
+
+
+/**
+* A class for accessing DAViCal via CalDAV, as a client
+*
+* @package   awl
+*/
+class CalDAVClient {
+  /**
+  * Server, username, password, calendar
+  *
+  * @var string
+  */
+  protected $base_url, $user, $pass, $entry, $protocol, $server, $port;
+
+  /**
+  * The principal-URL we're using
+  */
+  protected $principal_url;
+
+  /**
+  * The calendar-URL we're using
+  */
+  protected $calendar_url;
+
+  /**
+  * The calendar-home-set we're using
+  */
+  protected $calendar_home_set;
+
+  /**
+  * The calendar_urls we have discovered
+  */
+  protected $calendar_urls;
+
+  /**
+  * The useragent which is send to the caldav server
+  *
+  * @var string
+  */
+  public $user_agent = 'DAViCalClient ExpressoLivre';
+
+  protected $headers = array();
+  protected $body = "";
+  protected $requestMethod = "GET";
+  protected $httpRequest = "";  // for debugging http headers sent
+  protected $xmlRequest = "";   // for debugging xml sent
+  protected $httpResponse = ""; // http headers received
+  protected $xmlResponse = "";  // xml received
+
+  protected $parser; // our XML parser object
+
+  /**
+  * Constructor, initialises the class
+  *
+  * @param string $base_url  The URL for the calendar server
+  * @param string $user      The name of the user logging in
+  * @param string $pass      The password for that user
+  */
+  function __construct( $base_url, $user, $pass ) {
+    $this->user = $user;
+    $this->pass = $pass;
+    $this->headers = array();
+
+    if ( preg_match( '#^(https?)://([a-z0-9.-]+)(:([0-9]+))?(/.*)$#', $base_url, $matches ) ) {
+      $this->server = $matches[2];
+      $this->base_url = $matches[5];
+      if ( $matches[1] == 'https' ) {
+        $this->protocol = 'ssl';
+        $this->port = 443;
+      }
+      else {
+        $this->protocol = 'tcp';
+        $this->port = 80;
+      }
+      if ( $matches[4] != '' ) {
+        $this->port = intval($matches[4]);
+      }
+    }
+    else {
+      trigger_error("Invalid URL: '".$base_url."'", E_USER_ERROR);
+    }
+  }
+
+  /**
+  * Adds an If-Match or If-None-Match header
+  *
+  * @param bool $match to Match or Not to Match, that is the question!
+  * @param string $etag The etag to match / not match against.
+  */
+  function SetMatch( $match, $etag = '*' ) {
+    $this->headers['match'] = sprintf( "%s-Match: %s", ($match ? "If" : "If-None"), $etag);
+  }
+
+  /**
+  * Add a Depth: header.  Valid values are 0, 1 or infinity
+  *
+  * @param int $depth  The depth, default to infinity
+  */
+  function SetDepth( $depth = '0' ) {
+    $this->headers['depth'] = 'Depth: '. ($depth == '1' ? "1" : ($depth == 'infinity' ? $depth : "0") );
+  }
+
+  /**
+  * Add a Depth: header.  Valid values are 1 or infinity
+  *
+  * @param int $depth  The depth, default to infinity
+  */
+  function SetUserAgent( $user_agent = null ) {
+    if ( !isset($user_agent) ) $user_agent = $this->user_agent;
+    $this->user_agent = $user_agent;
+  }
+
+  /**
+  * Add a Content-type: header.
+  *
+  * @param string $type  The content type
+  */
+  function SetContentType( $type ) {
+    $this->headers['content-type'] = "Content-type: $type";
+  }
+
+  /**
+  * Set the calendar_url we will be using for a while.
+  *
+  * @param string $url The calendar_url
+  */
+  function SetCalendar( $url ) {
+    $this->calendar_url = $url;
+  }
+
+  /**
+  * Split response into httpResponse and xmlResponse
+  *
+  * @param string Response from server
+   */
+  function ParseResponse( $response ) {
+    $pos = strpos($response, '<?xml');
+    if ($pos === false) {
+      $this->httpResponse = trim($response);
+    }
+    else {
+      $this->httpResponse = trim(substr($response, 0, $pos));
+      $this->xmlResponse = trim(substr($response, $pos));
+      $this->xmlResponse = preg_replace('{>[^>]*$}s', '>',$this->xmlResponse );
+      $parser = xml_parser_create_ns('UTF-8');
+      xml_parser_set_option ( $parser, XML_OPTION_SKIP_WHITE, 1 );
+      xml_parser_set_option ( $parser, XML_OPTION_CASE_FOLDING, 0 );
+
+      if ( xml_parse_into_struct( $parser, $this->xmlResponse, $this->xmlnodes, $this->xmltags ) === 0 ) {
+        printf( "XML parsing error: %s - %s\n", xml_get_error_code($parser), xml_error_string(xml_get_error_code($parser)) );
+//        debug_print_backtrace();
+//        echo "\nNodes array............................................................\n"; print_r( $this->xmlnodes );
+//        echo "\nTags array............................................................\n";  print_r( $this->xmltags );
+        printf( "\nXML Reponse:\n%s\n", $this->xmlResponse );
+      }
+
+      xml_parser_free($parser);
+    }
+  }
+
+  /**
+   * Output http request headers
+   *
+   * @return HTTP headers
+   */
+  function GetHttpRequest() {
+      return $this->httpRequest;
+  }
+  /**
+   * Output http response headers
+   *
+   * @return HTTP headers
+   */
+  function GetResponseHeaders() {
+      return $this->httpResponseHeaders;
+  }
+  /**
+   * Output http response body
+   *
+   * @return HTTP body
+   */
+  function GetResponseBody() {
+      return $this->httpResponseBody;
+  }
+  /**
+   * Output xml request
+   *
+   * @return raw xml
+   */
+  function GetXmlRequest() {
+      return $this->xmlRequest;
+  }
+  /**
+   * Output xml response
+   *
+   * @return raw xml
+   */
+  function GetXmlResponse() {
+      return $this->xmlResponse;
+  }
+
+  /**
+  * Send a request to the server
+  *
+  * @param string $url The URL to make the request to
+  *
+  * @return string The content of the response from the server
+  */
+  function DoRequest( $url = null ) {
+    if(!defined("_FSOCK_TIMEOUT")){ define("_FSOCK_TIMEOUT", 10); }
+    $headers = array();
+
+    if ( !isset($url) ) $url = $this->base_url;
+    $this->request_url = $url;
+    $url = preg_replace('{^https?://[^/]+}', '', $url);
+    // URLencode if it isn't already
+    if ( preg_match( '{[^%?&=+,.-_/a-z0-9]}', $url ) ) {
+      $url = str_replace(rawurlencode('/'),'/',rawurlencode($url));
+      $url = str_replace(rawurlencode('?'),'?',$url);
+      $url = str_replace(rawurlencode('&'),'&',$url);
+      $url = str_replace(rawurlencode('='),'=',$url);
+      $url = str_replace(rawurlencode('+'),'+',$url);
+      $url = str_replace(rawurlencode(','),',',$url);
+    }
+    $headers[] = $this->requestMethod." ". $url . " HTTP/1.1";
+    $headers[] = "Authorization: Basic ".base64_encode($this->user .":". $this->pass );
+    $headers[] = "Host: ".$this->server .":".$this->port;
+
+    if ( !isset($this->headers['content-type']) ) $this->headers['content-type'] = "Content-type: text/plain";
+    foreach( $this->headers as $ii => $head ) {
+      $headers[] = $head;
+    }
+    $headers[] = "Content-Length: " . strlen($this->body);
+    $headers[] = "User-Agent: " . $this->user_agent;
+    $headers[] = 'Connection: close';
+    $this->httpRequest = join("\r\n",$headers);
+    $this->xmlRequest = $this->body;
+
+    $this->httpResponse = '';
+    $this->xmlResponse = '';
+
+    $fip = fsockopen( $this->protocol . '://' . $this->server, $this->port, $errno, $errstr, _FSOCK_TIMEOUT); //error handling?
+    if ( !(get_resource_type($fip) == 'stream') ) return false;
+    if ( !fwrite($fip, $this->httpRequest."\r\n\r\n".$this->body) ) { fclose($fip); return false; }
+    $response = "";
+    while( !feof($fip) ) { $response .= fgets($fip,8192); }
+    fclose($fip);
+
+    list( $this->httpResponseHeaders, $this->httpResponseBody ) = preg_split( '{\r?\n\r?\n}s', $response, 2 );
+    if ( preg_match( '{Transfer-Encoding: chunked}i', $this->httpResponseHeaders ) ) $this->Unchunk();
+
+    $this->headers = array();  // reset the headers array for our next request
+    $this->ParseResponse($this->httpResponseBody);
+    return $response;
+  }
+
+
+  /**
+  * Unchunk a chunked response
+  */
+  function Unchunk() {
+    $content = '';
+    $chunks = $this->httpResponseBody;
+    // printf( "\n================================\n%s\n================================\n", $chunks );
+    do {
+      $bytes = 0;
+      if ( preg_match('{^((\r\n)?\s*([ 0-9a-fA-F]+)(;[^\n]*)?\r?\n)}', $chunks, $matches ) ) {
+        $octets = $matches[3];
+        $bytes = hexdec($octets);
+        $pos = strlen($matches[1]);
+        // printf( "Chunk size 0x%s (%d)\n", $octets, $bytes );
+        if ( $bytes > 0 ) {
+          // printf( "---------------------------------\n%s\n---------------------------------\n", substr($chunks,$pos,$bytes) );
+          $content .= substr($chunks,$pos,$bytes);
+          $chunks = substr($chunks,$pos + $bytes + 2);
+          // printf( "+++++++++++++++++++++++++++++++++\n%s\n+++++++++++++++++++++++++++++++++\n", $chunks );
+        }
+      }
+      else {
+        $content .= $chunks;
+      }
+    }
+    while( $bytes > 0 );
+    $this->httpResponseBody = $content;
+    // printf( "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n%s\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n", $content );
+  }
+
+
+  /**
+  * Send an OPTIONS request to the server
+  *
+  * @param string $url The URL to make the request to
+  *
+  * @return array The allowed options
+  */
+  function DoOptionsRequest( $url = null ) {
+    $this->requestMethod = "OPTIONS";
+    $this->body = "";
+    $headers = $this->DoRequest($url);
+    $options_header = preg_replace( '/^.*Allow: ([a-z, ]+)\r?\n.*/is', '$1', $headers );
+    $options = array_flip( preg_split( '/[, ]+/', $options_header ));
+    return $options;
+  }
+
+
+
+  /**
+  * Send an XML request to the server (e.g. PROPFIND, REPORT, MKCALENDAR)
+  *
+  * @param string $method The method (PROPFIND, REPORT, etc) to use with the request
+  * @param string $xml The XML to send along with the request
+  * @param string $url The URL to make the request to
+  *
+  * @return array An array of the allowed methods
+  */
+  function DoXMLRequest( $request_method, $xml, $url = null ) {
+    $this->body = $xml;
+    $this->requestMethod = $request_method;
+    $this->SetContentType("text/xml");
+    return $this->DoRequest($url);
+  }
+
+  /**
+  * Send an MOVE request to the server
+  * Exp: (Move collection) $cal->DoMOVERequest( colloection1/ , collection2/ );
+  * @param string $method origem
+  * @param string $destination destination
+  *
+  * @return string The content of the response from the server
+  */
+  function DoMOVERequest( $origem, $destination) {
+    $this->requestMethod = 'MOVE';
+    $this->headers[] = 'Destination: '.$this->base_url.$destination;
+    return $this->DoRequest($this->base_url.urlencode($origem));
+  }
+
+
+  /**
+  * Get a single item from the server.
+  *
+  * @param string $url The URL to GET
+  */
+  function DoGETRequest( $url ) {
+    $this->body = "";
+    $this->requestMethod = "GET";
+    return $this->DoRequest( $url );
+  }
+
+
+  /**
+  * Get the HEAD of a single item from the server.
+  *
+  * @param string $url The URL to HEAD
+  */
+  function DoHEADRequest( $url ) {
+    $this->body = "";
+    $this->requestMethod = "HEAD";
+    return $this->DoRequest( $url );
+  }
+
+
+  /**
+  * PUT a text/icalendar resource, returning the etag
+  *
+  * @param string $url The URL to make the request to
+  * @param string $icalendar The iCalendar resource to send to the server
+  * @param string $etag The etag of an existing resource to be overwritten, or '*' for a new resource.
+  *
+  * @return string The content of the response from the server
+  */
+  function DoPUTRequest( $url, $icalendar, $etag = null ) {
+    $this->body = $icalendar;
+
+    $this->requestMethod = "PUT";
+    if ( $etag != null ) {
+      $this->SetMatch( ($etag != '*'), $etag );
+    }
+    $this->SetContentType('text/calendar; encoding="utf-8"');
+    $this->DoRequest($url);
+    
+    var_dump( $this->httpResponseHeaders);
+    
+    $etag = null;
+    if ( preg_match( '{^ETag:\s+"([^"]*)"\s*$}im', $this->httpResponseHeaders, $matches ) ) $etag = $matches[1];
+    if ( !isset($etag) || $etag == '' ) {
+      printf( "No etag in:\n%s\n", $this->httpResponseHeaders );
+      $save_request = $this->httpRequest;
+      $save_response_headers = $this->httpResponseHeaders;
+      $this->DoHEADRequest( $url );
+      if ( preg_match( '{^Etag:\s+"([^"]*)"\s*$}im', $this->httpResponseHeaders, $matches ) ) $etag = $matches[1];
+      if ( !isset($etag) || $etag == '' ) {
+        printf( "Still No etag in:\n%s\n", $this->httpResponseHeaders );
+      }
+      $this->httpRequest = $save_request;
+      $this->httpResponseHeaders = $save_response_headers;
+    }
+    return $etag;
+  }
+
+
+  /**
+  * DELETE a text/icalendar resource
+  *
+  * @param string $url The URL to make the request to
+  * @param string $etag The etag of an existing resource to be deleted, or '*' for any resource at that URL.
+  *
+  * @return int The HTTP Result Code for the DELETE
+  */
+  function DoDELETERequest( $url, $etag = null ) {
+    $this->body = "";
+
+    $this->requestMethod = "DELETE";
+    if ( $etag != null ) {
+      $this->SetMatch( true, $etag );
+    }
+    $this->DoRequest($url);
+    return $this->resultcode;
+  }
+
+
+  /**
+  * Get a single item from the server.
+  *
+  * @param string $url The URL to PROPFIND on
+  */
+  function DoPROPFINDRequest( $url, $props, $depth = 0 ) {
+    $this->SetDepth($depth);
+    $xml = new XMLDocument( array( 'DAV:' => '', 'urn:ietf:params:xml:ns:caldav' => 'C' ) );
+    $prop = new XMLElement('prop');
+    foreach( $props AS $v ) {
+      $xml->NSElement($prop,$v);
+    }
+
+    $this->body = $xml->Render('propfind',$prop );
+
+    $this->requestMethod = "PROPFIND";
+    $this->SetContentType("text/xml");
+    $this->DoRequest($url);
+    return $this->GetXmlResponse();
+  }
+
+
+  /**
+  * Get/Set the Principal URL
+  *
+  * @param $url string The Principal URL to set
+  */
+  function PrincipalURL( $url = null ) {
+    if ( isset($url) ) {
+      $this->principal_url = $url;
+    }
+    return $this->principal_url;
+  }
+
+
+  /**
+  * Get/Set the calendar-home-set URL
+  *
+  * @param $url array of string The calendar-home-set URLs to set
+  */
+  function CalendarHomeSet( $urls = null ) {
+    if ( isset($urls) ) {
+      if ( ! is_array($urls) ) $urls = array($urls);
+      $this->calendar_home_set = $urls;
+    }
+    return $this->calendar_home_set;
+  }
+
+
+  /**
+  * Get/Set the calendar-home-set URL
+  *
+  * @param $urls array of string The calendar URLs to set
+  */
+  function CalendarUrls( $urls = null ) {
+    if ( isset($urls) ) {
+      if ( ! is_array($urls) ) $urls = array($urls);
+      $this->calendar_urls = $urls;
+    }
+    return $this->calendar_urls;
+  }
+
+
+  /**
+  * Return the first occurrence of an href inside the named tag.
+  *
+  * @param string $tagname The tag name to find the href inside of
+  */
+  function HrefValueInside( $tagname ) {
+    foreach( $this->xmltags[$tagname] AS $k => $v ) {
+      $j = $v + 1;
+      if ( $this->xmlnodes[$j]['tag'] == 'DAV::href' ) {
+        return rawurldecode($this->xmlnodes[$j]['value']);
+      }
+    }
+    return null;
+  }
+
+
+  /**
+  * Return the href containing this property.  Except only if it's inside a status != 200
+  *
+  * @param string $tagname The tag name of the property to find the href for
+  * @param integer $which Which instance of the tag should we use
+  */
+  function HrefForProp( $tagname, $i = 0 ) {
+    if ( isset($this->xmltags[$tagname]) && isset($this->xmltags[$tagname][$i]) ) {
+      $j = $this->xmltags[$tagname][$i];
+      while( $j-- > 0 && $this->xmlnodes[$j]['tag'] != 'DAV::href' ) {
+//        printf( "Node[$j]: %s\n", $this->xmlnodes[$j]['tag']);
+        if ( $this->xmlnodes[$j]['tag'] == 'DAV::status' && $this->xmlnodes[$j]['value'] != 'HTTP/1.1 200 OK' ) return null;
+      }
+//      printf( "Node[$j]: %s\n", $this->xmlnodes[$j]['tag']);
+      if ( $j > 0 && isset($this->xmlnodes[$j]['value']) ) {
+//        printf( "Value[$j]: %s\n", $this->xmlnodes[$j]['value']);
+        return rawurldecode($this->xmlnodes[$j]['value']);
+      }
+    }
+    else {
+      printf( "xmltags[$tagname] or xmltags[$tagname][$i] is not set\n");
+    }
+    return null;
+  }
+
+
+  /**
+  * Return the href which has a resourcetype of the specified type
+  *
+  * @param string $tagname The tag name of the resourcetype to find the href for
+  * @param integer $which Which instance of the tag should we use
+  */
+  function HrefForResourcetype( $tagname, $i = 0 ) {
+    if ( isset($this->xmltags[$tagname]) && isset($this->xmltags[$tagname][$i]) ) {
+      $j = $this->xmltags[$tagname][$i];
+      while( $j-- > 0 && $this->xmlnodes[$j]['tag'] != 'DAV::resourcetype' );
+      if ( $j > 0 ) {
+        while( $j-- > 0 && $this->xmlnodes[$j]['tag'] != 'DAV::href' );
+        if ( $j > 0 && isset($this->xmlnodes[$j]['value']) ) {
+          return rawurldecode($this->xmlnodes[$j]['value']);
+        }
+      }
+    }
+    return null;
+  }
+
+
+  /**
+  * Return the <prop> ... </prop> of a propstat where the status is OK
+  *
+  * @param string $nodenum The node number in the xmlnodes which is the href
+  */
+  function GetOKProps( $nodenum ) {
+    $props = null;
+    $level = $this->xmlnodes[$nodenum]['level'];
+    $status = '';
+    while ( $this->xmlnodes[++$nodenum]['level'] >= $level ) {
+      if ( $this->xmlnodes[$nodenum]['tag'] == 'DAV::propstat' ) {
+        if ( $this->xmlnodes[$nodenum]['type'] == 'open' ) {
+          $props = array();
+          $status = '';
+        }
+        else {
+          if ( $status == 'HTTP/1.1 200 OK' ) break;
+        }
+      }
+      elseif ( !isset($this->xmlnodes[$nodenum]) || !is_array($this->xmlnodes[$nodenum]) ) {
+        break;
+      }
+      elseif ( $this->xmlnodes[$nodenum]['tag'] == 'DAV::status' ) {
+        $status = $this->xmlnodes[$nodenum]['value'];
+      }
+      else {
+        $props[] = $this->xmlnodes[$nodenum];
+      }
+    }
+    return $props;
+  }
+
+
+  /**
+  * Attack the given URL in an attempt to find a principal URL
+  *
+  * @param string $url The URL to find the principal-URL from
+  */
+  function FindPrincipal( $url ) {
+    $xml = $this->DoPROPFINDRequest( $url, array('resourcetype', 'current-user-principal', 'owner', 'principal-URL',
+                                  'urn:ietf:params:xml:ns:caldav:calendar-home-set'), 1);
+
+    $principal_url = $this->HrefForProp('DAV::principal');
+
+    if ( !isset($principal_url) ) {
+      foreach( array('DAV::current-user-principal', 'DAV::principal-URL', 'DAV::owner') AS $href ) {
+        if ( !isset($principal_url) ) {
+          $principal_url = $this->HrefValueInside($href);
+        }
+      }
+    }
+
+    return $this->PrincipalURL($principal_url);
+  }
+
+
+  /**
+  * Attack the given URL in an attempt to find a principal URL
+  *
+  * @param string $url The URL to find the calendar-home-set from
+  */
+  function FindCalendarHome( $recursed=false ) {
+    if ( !isset($this->principal_url) ) {
+      $this->FindPrincipal($this->principal_url);
+    }
+    if ( $recursed ) {
+      $this->DoPROPFINDRequest( $this->principal_url, array('urn:ietf:params:xml:ns:caldav:calendar-home-set'), 0);
+    }
+
+    $calendar_home = array();
+    foreach( $this->xmltags['urn:ietf:params:xml:ns:caldav:calendar-home-set'] AS $k => $v ) {
+      if ( $this->xmlnodes[$v]['type'] != 'open' ) continue;
+      while( $this->xmlnodes[++$v]['type'] != 'close' && $this->xmlnodes[$v]['tag'] != 'urn:ietf:params:xml:ns:caldav:calendar-home-set' ) {
+//        printf( "Tag: '%s' = '%s'\n", $this->xmlnodes[$v]['tag'], $this->xmlnodes[$v]['value']);
+        if ( $this->xmlnodes[$v]['tag'] == 'DAV::href' && isset($this->xmlnodes[$v]['value']) )
+          $calendar_home[] = rawurldecode($this->xmlnodes[$v]['value']);
+      }
+    }
+
+    if ( !$recursed && count($calendar_home) < 1 ) {
+      $calendar_home = $this->FindCalendarHome(true);
+    }
+
+    return $this->CalendarHomeSet($calendar_home);
+  }
+
+
+  /**
+  * Find the calendars, from the calendar_home_set
+  */
+  function FindCalendars( $recursed=false ) {
+    if ( !isset($this->calendar_home_set[0]) ) {
+      $this->FindCalendarHome();
+    }
+    $this->DoPROPFINDRequest( $this->calendar_home_set[0], array('resourcetype','displayname','http://calendarserver.org/ns/:getctag'), 1);
+
+    $calendars = array();
+    if ( isset($this->xmltags['urn:ietf:params:xml:ns:caldav:calendar']) ) {
+      $calendar_urls = array();
+      foreach( $this->xmltags['urn:ietf:params:xml:ns:caldav:calendar'] AS $k => $v ) {
+        $calendar_urls[$this->HrefForProp('urn:ietf:params:xml:ns:caldav:calendar', $k)] = 1;
+      }
+
+      foreach( $this->xmltags['DAV::href'] AS $i => $hnode ) {
+        $href = rawurldecode($this->xmlnodes[$hnode]['value']);
+
+        if ( !isset($calendar_urls[$href]) ) continue;
+
+//        printf("Seems '%s' is a calendar.\n", $href );
+
+        $calendar = new CalendarInfo($href);
+        $ok_props = $this->GetOKProps($hnode);
+        foreach( $ok_props AS $v ) {
+//          printf("Looking at: %s[%s]\n", $href, $v['tag'] );
+          switch( $v['tag'] ) {
+            case 'http://calendarserver.org/ns/:getctag':
+              $calendar->getctag = $v['value'];
+              break;
+            case 'DAV::displayname':
+              $calendar->displayname = isset($v['value']) ? $v['value'] : '';
+              break;
+          }
+        }
+        $calendars[] = $calendar;
+      }
+    }
+
+    return $this->CalendarUrls($calendars);
+  }
+
+
+  /**
+  * Find the calendars, from the calendar_home_set
+  */
+  function GetCalendarDetails( $url = null ) {
+    if ( isset($url) ) $this->SetCalendar($url);
+
+    $calendar_properties = array( 'resourcetype', 'displayname', 'http://calendarserver.org/ns/:getctag', 'urn:ietf:params:xml:ns:caldav:calendar-timezone', 'supported-report-set' );
+    $this->DoPROPFINDRequest( $this->calendar_url, $calendar_properties, 0);
+
+    $hnode = $this->xmltags['DAV::href'][0];
+    $href = rawurldecode($this->xmlnodes[$hnode]['value']);
+
+    $calendar = new CalendarInfo($href);
+    $ok_props = $this->GetOKProps($hnode);
+    foreach( $ok_props AS $k => $v ) {
+      $name = preg_replace( '{^.*:}', '', $v['tag'] );
+      if ( isset($v['value'] ) ) {
+        $calendar->{$name} = $v['value'];
+      }
+/*      else {
+        printf( "Calendar property '%s' has no text content\n", $v['tag'] );
+      }*/
+    }
+
+    return $calendar;
+  }
+
+
+  /**
+  * Get all etags for a calendar
+  */
+  function GetCollectionETags( $url = null ) {
+    if ( isset($url) ) $this->SetCalendar($url);
+
+    $this->DoPROPFINDRequest( $this->calendar_url, array('getetag'), 1);
+
+    $etags = array();
+    if ( isset($this->xmltags['DAV::getetag']) ) {
+      foreach( $this->xmltags['DAV::getetag'] AS $k => $v ) {
+        $href = $this->HrefForProp('DAV::getetag', $k);
+        if ( isset($href) && isset($this->xmlnodes[$v]['value']) ) $etags[$href] = $this->xmlnodes[$v]['value'];
+      }
+    }
+
+    return $etags;
+  }
+
+
+  /**
+  * Get a bunch of events for a calendar with a calendar-multiget report
+  */
+  function CalendarMultiget( $event_hrefs, $url = null ) {
+
+    if ( isset($url) ) $this->SetCalendar($url);
+
+    $hrefs = '';
+    foreach( $event_hrefs AS $k => $href ) {
+      $href = str_replace( rawurlencode('/'),'/',rawurlencode($href));
+      $hrefs .= '<href>'.$href.'</href>';
+    }
+    $this->body = <<<EOXML
+<?xml version="1.0" encoding="utf-8" ?>
+<C:calendar-multiget xmlns="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav">
+<prop><getetag/><C:calendar-data/></prop>
+$hrefs
+</C:calendar-multiget>
+EOXML;
+
+    $this->requestMethod = "REPORT";
+    $this->SetContentType("text/xml");
+    $this->DoRequest( $this->calendar_url );
+
+    $events = array();
+    if ( isset($this->xmltags['urn:ietf:params:xml:ns:caldav:calendar-data']) ) {
+      foreach( $this->xmltags['urn:ietf:params:xml:ns:caldav:calendar-data'] AS $k => $v ) {
+        $href = $this->HrefForProp('urn:ietf:params:xml:ns:caldav:calendar-data', $k);
+//        echo "Calendar-data:\n"; print_r($this->xmlnodes[$v]);
+        $events[$href] = $this->xmlnodes[$v]['value'];
+      }
+    }
+    else {
+      foreach( $event_hrefs AS $k => $href ) {
+        $this->DoGETRequest($href);
+        $events[$href] = $this->httpResponseBody;
+      }
+    }
+
+    return $events;
+  }
+
+
+  /**
+  * Given XML for a calendar query, return an array of the events (/todos) in the
+  * response.  Each event in the array will have a 'href', 'etag' and '$response_type'
+  * part, where the 'href' is relative to the calendar and the '$response_type' contains the
+  * definition of the calendar data in iCalendar format.
+  *
+  * @param string $filter XML fragment which is the <filter> element of a calendar-query
+  * @param string $url The URL of the calendar, or null to use the 'current' calendar_url
+  *
+  * @return array An array of the relative URLs, etags, and events from the server.  Each element of the array will
+  *               be an array with 'href', 'etag' and 'data' elements, corresponding to the URL, the server-supplied
+  *               etag (which only varies when the data changes) and the calendar data in iCalendar format.
+  */
+  function DoCalendarQuery( $filter, $url = null ) {
+
+    if ( isset($url) ) $this->SetCalendar($url);
+
+    $this->body = <<<EOXML
+<?xml version="1.0" encoding="utf-8" ?>
+<C:calendar-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav">
+  <D:prop>
+    <C:calendar-data/>
+    <D:getetag/>
+  </D:prop>$filter
+</C:calendar-query>
+EOXML;
+
+    $this->requestMethod = "REPORT";
+    $this->SetContentType("text/xml");
+    $this->DoRequest( $this->calendar_url );
+
+    $report = array();
+    foreach( $this->xmltags as $k => $v ) {
+      switch( $v['tag'] ) {
+        case 'DAV::response':
+          if ( $v['type'] == 'open' ) {
+            $response = array();
+          }
+          elseif ( $v['type'] == 'close' ) {
+            $report[] = $response;
+          }
+          break;
+        case 'DAV::href':
+          $response['href'] = basename( rawurldecode($v['value']) );
+          break;
+        case 'DAV::getetag':
+          $response['etag'] = preg_replace('/^"?([^"]+)"?/', '$1', $v['value']);
+          break;
+        case 'urn:ietf:params:xml:ns:caldav:calendar-data':
+          $response['data'] = $v['value'];
+          break;
+      }
+    }
+    return $report;
+  }
+
+
+  /**
+  * Get the events in a range from $start to $finish.  The dates should be in the
+  * format yyyymmddThhmmssZ and should be in GMT.  The events are returned as an
+  * array of event arrays.  Each event array will have a 'href', 'etag' and 'event'
+  * part, where the 'href' is relative to the calendar and the event contains the
+  * definition of the event in iCalendar format.
+  *
+  * @param timestamp $start The start time for the period
+  * @param timestamp $finish The finish time for the period
+  * @param string    $relative_url The URL relative to the base_url specified when the calendar was opened.  Default ''.
+  *
+  * @return array An array of the relative URLs, etags, and events, returned from DoCalendarQuery() @see DoCalendarQuery()
+  */
+  function GetEvents( $start = null, $finish = null, $relative_url = '' ) {
+    $filter = "";
+    if ( isset($start) && isset($finish) )
+        $range = "<C:time-range start=\"$start\" end=\"$finish\"/>";
+    else
+        $range = '';
+
+    $filter = <<<EOFILTER
+  <C:filter>
+    <C:comp-filter name="VCALENDAR">
+      <C:comp-filter name="VEVENT">
+        $range
+      </C:comp-filter>
+    </C:comp-filter>
+  </C:filter>
+EOFILTER;
+
+    return $this->DoCalendarQuery($filter, $relative_url);
+  }
+
+
+  /**
+  * Get the todo's in a range from $start to $finish.  The dates should be in the
+  * format yyyymmddThhmmssZ and should be in GMT.  The events are returned as an
+  * array of event arrays.  Each event array will have a 'href', 'etag' and 'event'
+  * part, where the 'href' is relative to the calendar and the event contains the
+  * definition of the event in iCalendar format.
+  *
+  * @param timestamp $start The start time for the period
+  * @param timestamp $finish The finish time for the period
+  * @param boolean   $completed Whether to include completed tasks
+  * @param boolean   $cancelled Whether to include cancelled tasks
+  * @param string    $relative_url The URL relative to the base_url specified when the calendar was opened.  Default ''.
+  *
+  * @return array An array of the relative URLs, etags, and events, returned from DoCalendarQuery() @see DoCalendarQuery()
+  */
+  function GetTodos( $start, $finish, $completed = false, $cancelled = false, $relative_url = "" ) {
+
+    if ( $start && $finish ) {
+$time_range = <<<EOTIME
+                <C:time-range start="$start" end="$finish"/>
+EOTIME;
+    }
+
+    // Warning!  May contain traces of double negatives...
+    $neg_cancelled = ( $cancelled === true ? "no" : "yes" );
+    $neg_completed = ( $cancelled === true ? "no" : "yes" );
+
+    $filter = <<<EOFILTER
+  <C:filter>
+    <C:comp-filter name="VCALENDAR">
+          <C:comp-filter name="VTODO">
+                <C:prop-filter name="STATUS">
+                        <C:text-match negate-condition="$neg_completed">COMPLETED</C:text-match>
+                </C:prop-filter>
+                <C:prop-filter name="STATUS">
+                        <C:text-match negate-condition="$neg_cancelled">CANCELLED</C:text-match>
+                </C:prop-filter>$time_range
+          </C:comp-filter>
+    </C:comp-filter>
+  </C:filter>
+EOFILTER;
+
+    return $this->DoCalendarQuery($filter, $relative_url);
+  }
+
+
+  /**
+  * Get the calendar entry by UID
+  *
+  * @param uid
+  * @param string    $relative_url The URL relative to the base_url specified when the calendar was opened.  Default ''.
+  *
+  * @return array An array of the relative URL, etag, and calendar data returned from DoCalendarQuery() @see DoCalendarQuery()
+  */
+  function GetEntryByUid( $uid, $relative_url = '' ) {
+    $filter = "";
+    if ( $uid ) {
+      $filter = <<<EOFILTER
+  <C:filter>
+    <C:comp-filter name="VCALENDAR">
+          <C:comp-filter name="VEVENT">
+                <C:prop-filter name="UID">
+                        <C:text-match icollation="i;octet">$uid</C:text-match>
+                </C:prop-filter>
+          </C:comp-filter>
+    </C:comp-filter>
+  </C:filter>
+EOFILTER;
+    }
+
+    return $this->DoCalendarQuery($filter, $relative_url);
+  }
+
+
+  /**
+  * Get the calendar entry by HREF
+  *
+  * @param string    $href         The href from a call to GetEvents or GetTodos etc.
+  *
+  * @return string The iCalendar of the calendar entry
+  */
+  function GetEntryByHref( $href ) {
+    $href = str_replace( rawurlencode('/'),'/',rawurlencode($href));
+    return $this->DoGETRequest( $href );
+  }
+
+}
+
+/**
+* Usage example
+*
+* $cal = new CalDAVClient( "http://calendar.example.com/caldav.php/username/calendar/", "username", "password", "calendar" );
+* $options = $cal->DoOptionsRequest();
+* if ( isset($options["PROPFIND"]) ) {
+*   // Fetch some information about the events in that calendar
+*   $cal->SetDepth(1);
+*   $folder_xml = $cal->DoXMLRequest("PROPFIND", '<?xml version="1.0" encoding="utf-8" ?><propfind xmlns="DAV:"><prop><getcontentlength/><getcontenttype/><resourcetype/><getetag/></prop></propfind>' );
+* }
+* // Fetch all events for February
+* $events = $cal->GetEvents("20070101T000000Z","20070201T000000Z");
+* foreach ( $events AS $k => $event ) {
+*   do_something_with_event_data( $event['data'] );
+* }
+* $acc = array();
+* $acc["google"] = array(
+* "user"=>"kunsttherapie@gmail.com",
+* "pass"=>"xxxxx",
+* "server"=>"ssl://www.google.com",
+* "port"=>"443",
+* "uri"=>"https://www.google.com/calendar/dav/kunsttherapie@gmail.com/events/",
+* );
+*
+* $acc["davical"] = array(
+* "user"=>"some_user",
+* "pass"=>"big secret",
+* "server"=>"calendar.foo.bar",
+* "port"=>"80",
+* "uri"=>"http://calendar.foo.bar/caldav.php/some_user/home/",
+* );
+* //*******************************
+*
+* $account = $acc["davical"];
+*
+* //*******************************
+* $cal = new CalDAVClient( $account["uri"], $account["user"], $account["pass"], "", $account["server"], $account["port"] );
+* $options = $cal->DoOptionsRequest();
+* print_r($options);
+*
+* //*******************************
+* //*******************************
+*
+* $xmlC = <<<PROPP
+* <?xml version="1.0" encoding="utf-8" ?>
+* <D:propfind xmlns:D="DAV:" xmlns:C="http://calendarserver.org/ns/">
+*     <D:prop>
+*             <D:displayname />
+*             <C:getctag />
+*             <D:resourcetype />
+*
+*     </D:prop>
+* </D:propfind>
+* PROPP;
+* //if ( isset($options["PROPFIND"]) ) {
+*   // Fetch some information about the events in that calendar
+* //  $cal->SetDepth(1);
+* //  $folder_xml = $cal->DoXMLRequest("PROPFIND", $xmlC);
+* //  print_r( $folder_xml);
+* //}
+*
+* // Fetch all events for February
+* $events = $cal->GetEvents("20090201T000000Z","20090301T000000Z");
+* foreach ( $events as $k => $event ) {
+*     print_r($event['data']);
+*     print "\n---------------------------------------------\n";
+* }
+*
+* //*******************************
+* //*******************************
+*/
Index: trunk/prototype/plugins/davicalCliente/Translation.php
===================================================================
--- trunk/prototype/plugins/davicalCliente/Translation.php	(revision 5341)
+++ trunk/prototype/plugins/davicalCliente/Translation.php	(revision 5341)
@@ -0,0 +1,118 @@
+<?php
+/**
+* Functions involved in translating with gettext
+* @package awl
+* @subpackage   Translation
+* @author    Andrew McMillan <andrew@mcmillan.net.nz>
+* @copyright Catalyst IT Ltd
+* @license   http://gnu.org/copyleft/gpl.html GNU GPL v2 or later
+*/
+
+if ( !function_exists('i18n') ) {
+  /**
+  * Mark a string as being internationalized.  This is a semaphore method; it
+  * does nothing but it allows us to easily identify strings that require
+  * translation.  Generally this is used to mark strings that will be stored
+  * in the database (like descriptions of permissions).
+  *
+  * AWL uses GNU gettext for internationalization (i18n) and localization (l10n) of
+  * text presented to the user. Gettext needs to know about all places involving strings,
+  * that must be translated. Mark any place, where localization at runtime shall take place
+  * by using the function translate().
+  *
+  * In the help I have used 'xlate' rather than 'translate' and 'x18n' rather than 'i18n'
+  * so that the tools skip this particular file for translation :-)
+  *
+  * E.g. instead of:
+  *   print 'TEST to be displayed in different languages';
+  * use:
+  *   print xlate('TEST to be displayed in different languages');
+  * and you are all set for pure literals. The translation teams will receive that literal
+  * string as a job to translate and will translate it (when the message is clear enough).
+  * At runtime the message is then localized when printed.
+  * The input string can contain a hint to assist translators:
+  *   print xlate('TT <!-- abbreviation for Translation Test -->');
+  * The hint portion of the string will not be printed.
+  *
+  * But consider this case:
+  *   $message_to_be_localized = 'TEST to be displayed in different languages';
+  *   print xlate($message_to_be_localized);
+  *
+  * The translate() function is called in the right place for runtime handling, but there
+  * is no message at gettext preprocessing time to be given to the translation teams,
+  * just a variable name. Translation of the variable name would break the code! So all
+  * places potentially feeding this variable have to be marked to be given to translation
+  * teams, but not translated at runtime!
+  *
+  * This method resolves all such cases. Simply mark the candidates:
+  *   $message_to_be_localized = x18n('TEST to be displayed in different languages');
+  *   print xlate($message_to_be_localized);
+  *
+  * @param string the value
+  * @return string the same value
+  */
+  function i18n($value) {
+    return $value;  /* Just pass the value through */
+  }
+}
+
+
+if ( !function_exists('translate') ) {
+  /**
+  * Convert a string in English to whatever this user's locale is
+  */
+  if ( function_exists('gettext') ) {
+    function translate( $en ) {
+      if ( ! isset($en) || $en == '' ) return $en;
+      $xl = gettext($en);
+      dbg_error_log('I18N','Translated =%s= into =%s=', $en, $xl );
+      return $xl;
+    }
+  }
+  else {
+    function translate( $en ) {
+      return $en;
+    }
+  }
+}
+
+
+if ( !function_exists('init_gettext') ) {
+  /**
+  * Initialise our use of Gettext
+  */
+  function init_gettext( $domain, $location ) {
+    if ( !function_exists('bindtextdomain') ) return;
+    bindtextdomain( $domain, $location );
+    $codeset = bind_textdomain_codeset( $domain, 'UTF-8' );
+    textdomain( $domain );
+    dbg_error_log('I18N','Bound domain =%s= to location =%s= using character set =%s=', $domain, $location, $codeset );
+  }
+}
+
+
+if ( !function_exists('awl_set_locale') ) {
+  /**
+  * Set the translation to the user's locale.  At this stage all we do is
+  * call the gettext function.
+  */
+  function awl_set_locale( $locale ) {
+    global $c;
+
+    if ( !is_array($locale) && ! preg_match('/^[a-z]{2}(_[A-Z]{2})?\./', $locale ) ) {
+      $locale = array( $locale, $locale.'.UTF-8');
+    }
+    if ( !function_exists('setlocale') ) {
+      dbg_log_array('WARN','No "setlocale()" function?  PHP gettext support missing?' );
+      return;
+    }
+    if ( $newlocale = setlocale( LC_ALL, $locale) ) {
+      dbg_error_log('I18N','Set locale to =%s=', $newlocale );
+      $c->current_locale = $newlocale;
+    }
+    else {
+      dbg_log_array('I18N','Unsupported locale: ', $locale, false );
+    }
+  }
+}
+
Index: trunk/prototype/plugins/davicalCliente/AWLUtilities.php
===================================================================
--- trunk/prototype/plugins/davicalCliente/AWLUtilities.php	(revision 5399)
+++ trunk/prototype/plugins/davicalCliente/AWLUtilities.php	(revision 5399)
@@ -0,0 +1,680 @@
+<?php
+/**
+* Utility functions of a general nature which are used by
+* most AWL library classes.
+*
+* @package   awl
+* @subpackage   Utilities
+* @author    Andrew McMillan <andrew@mcmillan.net.nz>
+* @copyright Catalyst IT Ltd, Morphoss Ltd <http://www.morphoss.com/>
+* @license   http://www.gnu.org/licenses/lgpl-3.0.txt  GNU LGPL version 3 or later
+*/
+
+if ( !function_exists('dbg_error_log') ) {
+  /**
+  * Writes a debug message into the error log using printf syntax.  If the first
+  * parameter is "ERROR" then the message will _always_ be logged.
+  * Otherwise, the first parameter is a "component" name, and will only be logged
+  * if $c->dbg["component"] is set to some non-null value.
+  *
+  * If you want to see every log message then $c->dbg["ALL"] can be set, to
+  * override the debugging status of the individual components.
+  *
+  * @var string $component The component to identify itself, or "ERROR", or "LOG:component"
+  * @var string $format A format string for the log message
+  * @var [string $parameter ...] Parameters for the format string.
+  */
+  function dbg_error_log() {
+    global $c;
+    $args = func_get_args();
+    $type = "DBG";
+    $component = array_shift($args);
+    if ( substr( $component, 0, 3) == "LOG" ) {
+      // Special escape case for stuff that always gets logged.
+      $type = 'LOG';
+      $component = substr($component,4);
+    }
+    else if ( $component == "ERROR" ) {
+      $type = "***";
+    }
+    else if ( isset($c->dbg["ALL"]) ) {
+      $type = "ALL";
+    }
+    else if ( !isset($c->dbg[strtolower($component)]) ) return;
+
+    $argc = func_num_args();
+    if ( 2 <= $argc ) {
+      $format = array_shift($args);
+    }
+    else {
+      $format = "%s";
+    }
+    @error_log( $c->sysabbr.": $type: $component:". vsprintf( $format, $args ) );
+  }
+}
+
+
+if ( !function_exists('fatal') ) {
+  function fatal() {
+    global $c;
+    $args = func_get_args();
+    $argc = func_num_args();
+    if ( 2 <= $argc ) {
+      $format = array_shift($args);
+    }
+    else {
+      $format = "%s";
+    }
+    @error_log( $c->sysabbr.": FATAL: $component:". vsprintf( $format, $args ) );
+    
+    @error_log( "================= Stack Trace ===================" );
+	
+  	$trace = array_reverse(debug_backtrace());
+    array_pop($trace);
+    foreach( $trace AS $k => $v ) {
+ 	  @error_log( sprintf(" ===>  %s[%d] calls %s%s%s()",
+	               $v['file'],
+	               $v['line'],
+	               (isset($v['class'])?$v['class']:''),
+	               (isset($v['type'])?$v['type']:''),
+	               (isset($v['function'])?$v['function']:'')
+	      ));
+    }
+    echo "Fatal Error";
+    exit();
+  }
+}
+
+
+if ( !function_exists('trace_bug') ) {
+/**
+* Not as sever as a fatal() call, but we want to log and trace it
+*/
+  function trace_bug() {
+    global $c;
+    $args = func_get_args();
+    $argc = func_num_args();
+    if ( 2 <= $argc ) {
+      $format = array_shift($args);
+    }
+    else {
+      $format = "%s";
+    }
+    @error_log( $c->sysabbr.": BUG: $component:". vsprintf( $format, $args ) );
+    
+    @error_log( "================= Stack Trace ===================" );
+	
+  	$trace = array_reverse(debug_backtrace());
+    array_pop($trace);
+    foreach( $trace AS $k => $v ) {
+ 	  @error_log( sprintf(" ===>  %s[%d] calls %s%s%s()",
+	               $v['file'],
+	               $v['line'],
+	               (isset($v['class'])?$v['class']:''),
+	               (isset($v['type'])?$v['type']:''),
+	               (isset($v['function'])?$v['function']:'')
+	      ));
+    }
+  }
+}
+
+
+if ( !function_exists('apache_request_headers') ) {
+  /**
+  * Compatibility so we can use the apache function name and still work with CGI
+  * @package awl
+  */
+  eval('
+    function apache_request_headers() {
+        foreach($_SERVER as $key=>$value) {
+            if (substr($key,0,5)=="HTTP_") {
+                $key=str_replace(" ","-",ucwords(strtolower(str_replace("_"," ",substr($key,5)))));
+                $out[$key]=$value;
+            }
+        }
+        return $out;
+    }
+  ');
+}
+
+
+
+if ( !function_exists('dbg_log_array') ) {
+  /**
+  * Function to dump an array to the error log, possibly recursively
+  *
+  * @var string $component Which component should this log message identify itself from
+  * @var string $name What name should this array dump identify itself as
+  * @var array $arr The array to be dumped.
+  * @var boolean $recursive Should the dump recurse into arrays/objects in the array
+  */
+  function dbg_log_array( $component, $name, $arr, $recursive = false ) {
+    if ( !isset($arr) || (gettype($arr) != 'array' && gettype($arr) != 'object') ) {
+      dbg_error_log( $component, "%s: array is not set, or is not an array!", $name);
+      return;
+    }
+    foreach ($arr as $key => $value) {
+      dbg_error_log( $component, "%s: >>%s<< = >>%s<<", $name, $key,
+                      (gettype($value) == 'array' || gettype($value) == 'object' ? gettype($value) : $value) );
+      if ( $recursive && (gettype($value) == 'array' || (gettype($value) == 'object' && "$key" != 'self' && "$key" != 'parent') ) ) {
+        dbg_log_array( $component, "$name"."[$key]", $value, $recursive );
+      }
+    }
+  }
+}
+
+
+
+if ( !function_exists("session_simple_md5") ) {
+  /**
+  * Make a plain MD5 hash of a string, identifying the type of hash it is
+  *
+  * @param string $instr The string to be salted and MD5'd
+  * @return string The *MD5* and the MD5 of the string
+  */
+  function session_simple_md5( $instr ) {
+    global $c;
+    if ( isset($c->dbg['password']) ) dbg_error_log( "Login", "Making plain MD5: instr=$instr, md5($instr)=".md5($instr) );
+    return ( '*MD5*'. md5($instr) );
+  }
+}
+
+
+
+if ( !function_exists("session_salted_md5") ) {
+  /**
+  * Make a salted MD5 string, given a string and (possibly) a salt.
+  *
+  * If no salt is supplied we will generate a random one.
+  *
+  * @param string $instr The string to be salted and MD5'd
+  * @param string $salt Some salt to sprinkle into the string to be MD5'd so we don't get the same PW always hashing to the same value.
+  * @return string The salt, a * and the MD5 of the salted string, as in SALT*SALTEDHASH
+  */
+  function session_salted_md5( $instr, $salt = "" ) {
+    if ( $salt == "" ) $salt = substr( md5(rand(100000,999999)), 2, 8);
+    global $c;
+    if ( isset($c->dbg['password']) ) dbg_error_log( "Login", "Making salted MD5: salt=$salt, instr=$instr, md5($salt$instr)=".md5($salt . $instr) );
+    return ( sprintf("*%s*%s", $salt, md5($salt . $instr) ) );
+  }
+}
+
+
+
+if ( !function_exists("session_salted_sha1") ) {
+  /**
+  * Make a salted SHA1 string, given a string and (possibly) a salt.  PHP5 only (although it
+  * could be made to work on PHP4 (@see http://www.openldap.org/faq/data/cache/347.html). The
+  * algorithm used here is compatible with OpenLDAP so passwords generated through this function
+  * should be able to be migrated to OpenLDAP by using the part following the second '*', i.e.
+  * the '{SSHA}....' part.
+  *
+  * If no salt is supplied we will generate a random one.
+  *
+  * @param string $instr The string to be salted and SHA1'd
+  * @param string $salt Some salt to sprinkle into the string to be SHA1'd so we don't get the same PW always hashing to the same value.
+  * @return string A *, the salt, a * and the SHA1 of the salted string, as in *SALT*SALTEDHASH
+  */
+  function session_salted_sha1( $instr, $salt = "" ) {
+    if ( $salt == "" ) $salt = substr( str_replace('*','',base64_encode(sha1(rand(100000,9999999),true))), 2, 9);
+    global $c;
+    if ( isset($c->dbg['password']) ) dbg_error_log( "Login", "Making salted SHA1: salt=$salt, instr=$instr, encoded($instr$salt)=".base64_encode(sha1($instr . $salt, true).$salt) );
+    return ( sprintf("*%s*{SSHA}%s", $salt, base64_encode(sha1($instr.$salt, true) . $salt ) ) );
+  }
+}
+
+
+if ( !function_exists("session_validate_password") ) {
+  /**
+  * Checks what a user entered against the actual password on their account.
+  * @param string $they_sent What the user entered.
+  * @param string $we_have What we have in the database as their password.  Which may (or may not) be a salted MD5.
+  * @return boolean Whether or not the users attempt matches what is already on file.
+  */
+  function session_validate_password( $they_sent, $we_have ) {
+    if ( preg_match('/^\*\*.+$/', $we_have ) ) {
+      //  The "forced" style of "**plaintext" to allow easier admin setting
+      return ( "**$they_sent" == $we_have );
+    }
+
+    if ( preg_match('/^\*(.+)\*{[A-Z]+}.+$/', $we_have, $regs ) ) {
+      if ( function_exists("session_salted_sha1") ) {
+        // A nicely salted sha1sum like "*<salt>*{SSHA}<salted_sha1>"
+        $salt = $regs[1];
+        $sha1_sent = session_salted_sha1( $they_sent, $salt ) ;
+        return ( $sha1_sent == $we_have );
+      }
+      else {
+        dbg_error_log( "ERROR", "Password is salted SHA-1 but you are using PHP4!" );
+        echo <<<EOERRMSG
+<html>
+<head>
+<title>Salted SHA1 Password format not supported with PHP4</title>
+</head>
+<body>
+<h1>Salted SHA1 Password format not supported with PHP4</h1>
+<p>At some point you have used PHP5 to set the password for this user and now you are
+   using PHP4.  You will need to assign a new password to this user using PHP4, or ensure
+   you use PHP5 everywhere (recommended).</p>
+<p>AWL has now switched to using salted SHA-1 passwords by preference in a format
+   compatible with OpenLDAP.</p>
+</body>
+</html>
+EOERRMSG;
+        exit;
+      }
+    }
+
+    if ( preg_match('/^\*MD5\*.+$/', $we_have, $regs ) ) {
+      // A crappy unsalted md5sum like "*MD5*<md5>"
+      $md5_sent = session_simple_md5( $they_sent ) ;
+      return ( $md5_sent == $we_have );
+    }
+    else if ( preg_match('/^\*(.+)\*.+$/', $we_have, $regs ) ) {
+      // A nicely salted md5sum like "*<salt>*<salted_md5>"
+      $salt = $regs[1];
+      $md5_sent = session_salted_md5( $they_sent, $salt ) ;
+      return ( $md5_sent == $we_have );
+    }
+
+    // Anything else is bad
+    return false;
+
+  }
+}
+
+
+
+if ( !function_exists("replace_uri_params") ) {
+  /**
+  * Given a URL (presumably the current one) and a parameter, replace the value of parameter,
+  * extending the URL as necessary if the parameter is not already there.
+  * @param string $uri The URI we will be replacing parameters in.
+  * @param array $replacements An array of replacement pairs array( "replace_this" => "with this" )
+  * @return string The URI with the replacements done.
+  */
+  function replace_uri_params( $uri, $replacements ) {
+    $replaced = $uri;
+    foreach( $replacements AS $param => $new_value ) {
+      $rxp = preg_replace( '/([\[\]])/', '\\\\$1', $param );  // Some parameters may be arrays.
+      $regex = "/([&?])($rxp)=([^&]+)/";
+      dbg_error_log("core", "Looking for [%s] to replace with [%s] regex is %s and searching [%s]", $param, $new_value, $regex, $replaced );
+      if ( preg_match( $regex, $replaced ) )
+        $replaced = preg_replace( $regex, "\$1$param=$new_value", $replaced);
+      else
+        $replaced .= "&$param=$new_value";
+    }
+    if ( ! preg_match( '/\?/', $replaced  ) ) {
+      $replaced = preg_replace("/&(.+)$/", "?\$1", $replaced);
+    }
+    $replaced = str_replace("&amp;", "--AmPeRsAnD--", $replaced);
+    $replaced = str_replace("&", "&amp;", $replaced);
+    $replaced = str_replace("--AmPeRsAnD--", "&amp;", $replaced);
+    dbg_error_log("core", "URI <<$uri>> morphed to <<$replaced>>");
+    return $replaced;
+  }
+}
+
+
+if ( !function_exists("uuid") ) {
+/**
+ * Generates a Universally Unique IDentifier, version 4.
+ *
+ * RFC 4122 (http://www.ietf.org/rfc/rfc4122.txt) defines a special type of Globally
+ * Unique IDentifiers (GUID), as well as several methods for producing them. One
+ * such method, described in section 4.4, is based on truly random or pseudo-random
+ * number generators, and is therefore implementable in a language like PHP.
+ *
+ * We choose to produce pseudo-random numbers with the Mersenne Twister, and to always
+ * limit single generated numbers to 16 bits (ie. the decimal value 65535). That is
+ * because, even on 32-bit systems, PHP's RAND_MAX will often be the maximum *signed*
+ * value, with only the equivalent of 31 significant bits. Producing two 16-bit random
+ * numbers to make up a 32-bit one is less efficient, but guarantees that all 32 bits
+ * are random.
+ *
+ * The algorithm for version 4 UUIDs (ie. those based on random number generators)
+ * states that all 128 bits separated into the various fields (32 bits, 16 bits, 16 bits,
+ * 8 bits and 8 bits, 48 bits) should be random, except : (a) the version number should
+ * be the last 4 bits in the 3rd field, and (b) bits 6 and 7 of the 4th field should
+ * be 01. We try to conform to that definition as efficiently as possible, generating
+ * smaller values where possible, and minimizing the number of base conversions.
+ *
+ * @copyright  Copyright (c) CFD Labs, 2006. This function may be used freely for
+ *              any purpose ; it is distributed without any form of warranty whatsoever.
+ * @author      David Holmes <dholmes@cfdsoftware.net>
+ *
+ * @return  string  A UUID, made up of 32 hex digits and 4 hyphens.
+ */
+
+  function uuid() {
+
+    // The field names refer to RFC 4122 section 4.1.2
+
+    return sprintf('%04x%04x-%04x-%03x4-%04x-%04x%04x%04x',
+        mt_rand(0, 65535), mt_rand(0, 65535), // 32 bits for "time_low"
+        mt_rand(0, 65535), // 16 bits for "time_mid"
+        mt_rand(0, 4095),  // 12 bits before the 0100 of (version) 4 for "time_hi_and_version"
+        bindec(substr_replace(sprintf('%016b', mt_rand(0, 65535)), '01', 6, 2)),
+            // 8 bits, the last two of which (positions 6 and 7) are 01, for "clk_seq_hi_res"
+            // (hence, the 2nd hex digit after the 3rd hyphen can only be 1, 5, 9 or d)
+            // 8 bits for "clk_seq_low"
+        mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535) // 48 bits for "node"
+    );
+  }
+}
+
+if ( !function_exists("translate") ) {
+    require_once ROOTPATH.'/plugins/davicalCliente/Translation.php';
+
+}
+
+ if ( !function_exists("clone") && version_compare(phpversion(), '5.0') < 0) {
+  /**
+  * PHP5 screws with the assignment operator changing so that $a = $b means that
+  * $a becomes a reference to $b.  There is a clone() that we can use in PHP5, so
+  * we have to emulate that for PHP4.  Bleargh.
+  */
+  eval( 'function clone($object) { return $object; }' );
+}
+
+if ( !function_exists("quoted_printable_encode") ) {
+  /**
+  * Process a string to fit the requirements of RFC2045 section 6.7.  Note that
+  * this works, but replaces more characters than the minimum set. For readability
+  * the spaces aren't encoded as =20 though.
+  */
+  function quoted_printable_encode($string) {
+    return preg_replace('/[^\r\n]{73}[^=\r\n]{2}/', "$0=\r\n", str_replace("%","=",str_replace("%20"," ",rawurlencode($string))));
+  }
+}
+
+
+if ( !function_exists("check_by_regex") ) {
+  /**
+  * Verify a value is OK by testing a regex against it.  If it is an array apply it to
+  * each element in the array recursively.  If it is an object we don't mess
+  * with it.
+  */
+  function check_by_regex( $val, $regex ) {
+    if ( is_null($val) ) return null;
+    switch( $regex ) {
+      case 'int':     $regex = '#^\d+$#';     break;
+    }
+    if ( is_array($val) ) {
+      foreach( $val AS $k => $v ) {
+        $val[$k] = check_by_regex($v,$regex);
+      }
+    }
+    else if ( ! is_object($val) ) {
+      if ( preg_match( $regex, $val, $matches) ) {
+        $val = $matches[0];
+      }
+      else {
+        $val = '';
+      }
+    }
+    return $val;
+  }
+}
+
+
+if ( !function_exists("param_to_global") ) {
+  /**
+  * Convert a parameter to a global.  We first look in _POST and then in _GET,
+  * and if they passed in a bunch of valid characters, we will make sure the
+  * incoming is cleaned to only match that set.
+  *
+  * @param string $varname The name of the global variable to put the answer in
+  * @param string $match_regex The part of the parameter matching this regex will be returned
+  * @param string $alias1  An alias for the name that we should look for first.
+  * @param    "    ...     More aliases, in the order which they should be examined.  $varname will be appended to the end.
+  */
+  function param_to_global( ) {
+    $args = func_get_args();
+
+    $varname = array_shift($args);
+    $GLOBALS[$varname] = null;
+
+    $match_regex = null;
+    $argc = func_num_args();
+    if ( $argc > 1 ) {
+      $match_regex = array_shift($args);
+    }
+
+    $args[] = $varname;
+    foreach( $args AS $k => $name ) {
+      if ( isset($_POST[$name]) ) {
+        $result = $_POST[$name];
+        break;
+      }
+      else if ( isset($_GET[$name]) ) {
+        $result = $_GET[$name];
+        break;
+      }
+    }
+    if ( !isset($result) ) return null;
+
+    if ( isset($match_regex) ) {
+      $result = check_by_regex( $result, $match_regex );
+    }
+
+    $GLOBALS[$varname] = $result;
+    return $result;
+  }
+}
+
+
+if ( !function_exists("get_fields") ) {
+  /**
+  * @var array $_AWL_field_cache is a cache of the field names for a table
+  */
+  $_AWL_field_cache = array();
+  
+  /**
+  * Get the names of the fields for a particular table
+  * @param string $tablename The name of the table.
+  * @return array of string The public fields in the table.
+  */
+  function get_fields( $tablename ) {
+    global $_AWL_field_cache;
+
+    if ( !isset($_AWL_field_cache[$tablename]) ) {
+      dbg_error_log( "core", ":get_fields: Loading fields for table '$tablename'" );
+      $qry = new AwlQuery();
+      $db = $qry->GetConnection();
+      $qry->SetSQL($db->GetFields($tablename));
+      $qry->Exec("core");
+      $fields = array();
+      while( $row = $qry->Fetch() ) {
+        $fields[$row->fieldname] = $row->typename . ($row->precision >= 0 ? sprintf('(%d)',$row->precision) : '');
+      }
+      $_AWL_field_cache[$tablename] = $fields;
+    }
+    return $_AWL_field_cache[$tablename];
+  }
+}
+
+
+if ( !function_exists("force_utf8") ) {
+  function define_byte_mappings() {
+    global $byte_map, $nibble_good_chars;
+
+    # Needed for using Grant McLean's byte mappings code
+    $ascii_char = '[\x00-\x7F]';
+    $cont_byte  = '[\x80-\xBF]';
+
+    $utf8_2     = '[\xC0-\xDF]' . $cont_byte;
+    $utf8_3     = '[\xE0-\xEF]' . $cont_byte . '{2}';
+    $utf8_4     = '[\xF0-\xF7]' . $cont_byte . '{3}';
+    $utf8_5     = '[\xF8-\xFB]' . $cont_byte . '{4}';
+
+    $nibble_good_chars = "/^($ascii_char+|$utf8_2|$utf8_3|$utf8_4|$utf8_5)(.*)$/s";
+
+    # From http://unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1252.TXT
+    $byte_map = array(
+        "\x80" => "\xE2\x82\xAC",  # EURO SIGN
+        "\x82" => "\xE2\x80\x9A",  # SINGLE LOW-9 QUOTATION MARK
+        "\x83" => "\xC6\x92",      # LATIN SMALL LETTER F WITH HOOK
+        "\x84" => "\xE2\x80\x9E",  # DOUBLE LOW-9 QUOTATION MARK
+        "\x85" => "\xE2\x80\xA6",  # HORIZONTAL ELLIPSIS
+        "\x86" => "\xE2\x80\xA0",  # DAGGER
+        "\x87" => "\xE2\x80\xA1",  # DOUBLE DAGGER
+        "\x88" => "\xCB\x86",      # MODIFIER LETTER CIRCUMFLEX ACCENT
+        "\x89" => "\xE2\x80\xB0",  # PER MILLE SIGN
+        "\x8A" => "\xC5\xA0",      # LATIN CAPITAL LETTER S WITH CARON
+        "\x8B" => "\xE2\x80\xB9",  # SINGLE LEFT-POINTING ANGLE QUOTATION MARK
+        "\x8C" => "\xC5\x92",      # LATIN CAPITAL LIGATURE OE
+        "\x8E" => "\xC5\xBD",      # LATIN CAPITAL LETTER Z WITH CARON
+        "\x91" => "\xE2\x80\x98",  # LEFT SINGLE QUOTATION MARK
+        "\x92" => "\xE2\x80\x99",  # RIGHT SINGLE QUOTATION MARK
+        "\x93" => "\xE2\x80\x9C",  # LEFT DOUBLE QUOTATION MARK
+        "\x94" => "\xE2\x80\x9D",  # RIGHT DOUBLE QUOTATION MARK
+        "\x95" => "\xE2\x80\xA2",  # BULLET
+        "\x96" => "\xE2\x80\x93",  # EN DASH
+        "\x97" => "\xE2\x80\x94",  # EM DASH
+        "\x98" => "\xCB\x9C",      # SMALL TILDE
+        "\x99" => "\xE2\x84\xA2",  # TRADE MARK SIGN
+        "\x9A" => "\xC5\xA1",      # LATIN SMALL LETTER S WITH CARON
+        "\x9B" => "\xE2\x80\xBA",  # SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
+        "\x9C" => "\xC5\x93",      # LATIN SMALL LIGATURE OE
+        "\x9E" => "\xC5\xBE",      # LATIN SMALL LETTER Z WITH CARON
+        "\x9F" => "\xC5\xB8",      # LATIN CAPITAL LETTER Y WITH DIAERESIS
+    );
+
+    for( $i=160; $i < 256; $i++ ) {
+      $ch = chr($i);
+      $byte_map[$ch] = iconv('ISO-8859-1', 'UTF-8', $ch);
+    }
+  }
+  define_byte_mappings();
+
+  function force_utf8( $input ) {
+    global $byte_map, $nibble_good_chars;
+
+    $output = '';
+    $char   = '';
+    $rest   = '';
+    while( $input != '' ) {
+      if ( preg_match( $nibble_good_chars, $input, $matches ) ) {
+        $output .= $matches[1];
+        $rest = $matches[2];
+      }
+      else {
+        preg_match( '/^(.)(.*)$/s', $input, $matches );
+        $char = $matches[1];
+        $rest = $matches[2];
+        if ( isset($byte_map[$char]) ) {
+          $output .= $byte_map[$char];
+        }
+        else {
+          # Must be valid UTF8 already
+          $output .= $char;
+        }
+      }
+      $input = $rest;
+    }
+    return $output;
+  }
+
+}
+
+
+/**
+* Try and extract something like "Pacific/Auckland" or "America/Indiana/Indianapolis" if possible.
+*/
+function olson_from_tzstring( $tzstring ) {
+  global $c;
+  
+  if ( function_exists('timezone_identifiers_list') && in_array($tzstring,timezone_identifiers_list()) ) return $tzstring;
+  if ( preg_match( '{((Antarctica|America|Africa|Atlantic|Asia|Australia|Indian|Europe|Pacific)/(([^/]+)/)?[^/]+)$}', $tzstring, $matches ) ) {
+//    dbg_error_log( 'INFO', 'Found timezone "%s" from string "%s"', $matches[1], $tzstring );
+    return $matches[1];
+  }
+  switch( $tzstring ) {
+    case 'New Zealand Standard Time': case 'New Zealand Daylight Time':
+         return 'Pacific/Auckland';
+         break;
+    case 'Central Standard Time':     case 'Central Daylight Time':     case 'US/Central':
+         return 'America/Chicago';
+         break;
+    case 'Eastern Standard Time':     case 'Eastern Daylight Time':     case 'US/Eastern':
+    case '(UTC-05:00) Eastern Time (US & Canada)':
+         return 'America/New_York';
+         break;
+    case 'Pacific Standard Time':     case 'Pacific Daylight Time':     case 'US/Pacific':
+         return 'America/Los_Angeles';
+         break;
+    case 'Mountain Standard Time':    case 'Mountain Daylight Time':    case 'US/Mountain':    case 'Mountain Time':
+         return 'America/Denver';
+         // The US 'Mountain Time' can in fact be America/(Denver|Boise|Phoenix|Shiprock) which
+         // all vary to some extent due to differing DST rules.
+         break;
+    case '(GMT-07.00) Arizona':
+         return 'America/Phoenix';
+         break;
+    default:
+         if ( isset($c->timezone_translations) && is_array($c->timezone_translations) 
+                      && !empty($c->timezone_translations[$tzstring]) )
+           return $c->timezone_translations[$tzstring];      
+  }
+  return null;
+}
+
+if ( !function_exists("deprecated") ) {
+  function deprecated( $method ) {
+    global $c;
+    if ( isset($c->dbg['ALL']) || isset($c->dbg['deprecated']) ) {
+      $stack = debug_backtrace();
+      array_shift($stack);
+      if ( preg_match( '{/inc/iCalendar.php$}', $stack[0]['file'] ) && $stack[0]['line'] > __LINE__ ) return;
+      @error_log( sprintf( $c->sysabbr.':DEPRECATED: Call to deprecated method "%s"', $method));
+      foreach( $stack AS $k => $v ) {
+        @error_log( sprintf( $c->sysabbr.':  ==>  called from line %4d of %s', $v['line'], $v['file']));
+      }
+    }
+  }
+}
+
+
+if ( !function_exists("gzdecode") ) {
+  function gzdecode( $instring ) {
+    global $c;
+    if ( !isset($c->use_pipe_gunzip) || $c->use_pipe_gunzip ) {
+      $descriptorspec = array(
+         0 => array("pipe", "r"),  // stdin is a pipe that the child will read from
+         1 => array("pipe", "w"),  // stdout is a pipe that the child will write to
+         2 => array("file", "/dev/null", "a") // stderr is discarded
+      );
+      $process = proc_open('gunzip',$descriptorspec, $pipes);
+      if ( is_resource($process) ) {
+        fwrite($pipes[0],$instring);
+        fclose($pipes[0]);
+        
+        $outstring = stream_get_contents($pipes[1]);
+        fclose($pipes[1]);
+        
+        proc_close($process);
+        return $outstring;
+      }
+      return '';
+    }
+    else {
+      $g=tempnam('./','gz');
+      file_put_contents($g,$instring);
+      ob_start();
+      readgzfile($g);
+      $d=ob_get_clean();
+      unlink($g);
+      return $d;
+    }
+  }
+}
+
+/**
+ * Return the AWL version
+ */
+function awl_version() {
+  global $c;
+$c->awl_library_version = 0.49;
+  return $c->awl_library_version;
+}
Index: trunk/prototype/plugins/davicalCliente/XMLDocument.php
===================================================================
--- trunk/prototype/plugins/davicalCliente/XMLDocument.php	(revision 5399)
+++ trunk/prototype/plugins/davicalCliente/XMLDocument.php	(revision 5399)
@@ -0,0 +1,306 @@
+<?php
+/**
+* Handling of namespacing for XML documents
+*
+* @package awl
+* @subpackage XMLDocument
+* @author Andrew McMillan <andrew@morphoss.com>
+* @copyright Morphoss Ltd - http://www.morphoss.com/
+* @license   http://www.gnu.org/licenses/lgpl-3.0.txt  GNU LGPL version 3 or later
+*
+*/
+require_once ROOTPATH.'/plugins/davicalCliente/XMLElement.php';
+
+/**
+* A class for XML Documents which will contain namespaced XML elements
+*
+* @package   awl
+*/
+class XMLDocument {
+
+  /**#@+
+  * @access private
+  */
+  /**
+  * holds the namespaces which this document has been configured for.
+  * @var namespaces
+  */
+  var $namespaces;
+
+  /**
+  * holds the prefixes which are shorthand for the namespaces.
+  * @var prefixes
+  */
+  var $prefixes;
+
+  /**
+  * Holds the root document for the tree
+  * @var root
+  */
+  var $root;
+
+  /**
+  * Simple XMLDocument constructor
+  *
+  * @param array $namespaces An array of 'namespace' => 'prefix' pairs, where the prefix is used as a short form for the namespace.
+  */
+  function __construct( $namespaces = null ) {
+    $this->namespaces = array();
+    $this->prefixes = array();
+    if ( $namespaces != null ) {
+      foreach( $namespaces AS $ns => $prefix ) {
+        $this->namespaces[$ns] = $prefix;
+        $this->prefixes[$prefix] = $prefix;
+      }
+    }
+    $this->next_prefix = 0;
+  }
+
+  /**
+  * Add a new namespace to the document, optionally specifying it's short prefix
+  *
+  * @param string $namespace The full namespace name to be added
+  * @param string $prefix An optional short form for the namespace.
+  */
+  function AddNamespace( $namespace, $prefix = null ) {
+    if ( !isset($this->namespaces[$namespace]) ) {
+      if ( isset($prefix) && ($prefix == "" || isset($this->prefixes[$prefix])) ) $prefix = null;
+      if ( $prefix == null ) {
+        //  Try and build a prefix based on the first alphabetic character of the last element of the namespace
+        if ( preg_match('/^(.*):([^:]+)$/', $namespace, $matches) ) {
+          $alpha = preg_replace( '/[^a-z]/i', '', $matches[2] );
+          $prefix = strtoupper(substr($alpha,0,1));
+        }
+        else {
+          $prefix = 'X';
+        }
+        $i = "";
+        if ( isset($this->prefixes[$prefix]) ) {
+          for ( $i=1; $i<10 && isset($this->prefixes["$prefix$i"]); $i++ ) {
+          }
+        }
+        if ( isset($this->prefixes["$prefix$i"]) ) {
+          dbg_error_log("ERROR", "Cannot find a free prefix for this namespace");
+          exit;
+        }
+        $prefix = "$prefix$i";
+        dbg_error_log("XMLDocument", "auto-assigning prefix of '%s' for ns of '%s'", $prefix, $namespace );
+      }
+      else if ( $prefix == "" || isset($this->prefixes[$prefix]) ) {
+        dbg_error_log("ERROR", "Cannot assign the same prefix to two different namespaces");
+        exit;
+      }
+
+      $this->prefixes[$prefix] = $prefix;
+      $this->namespaces[$namespace] = $prefix;
+    }
+    else {
+      if ( isset($this->namespaces[$namespace]) && $this->namespaces[$namespace] != $prefix ) {
+        dbg_error_log("ERROR", "Cannot use the same namespace with two different prefixes");
+        exit;
+      }
+      $this->prefixes[$prefix] = $prefix;
+      $this->namespaces[$namespace] = $prefix;
+    }
+  }
+
+
+  /**
+  * Return a tag with namespace stripped and replaced with a short form, and the ns added to the document.
+  *
+  */
+  function GetXmlNsArray() {
+
+    $ns = array();
+    foreach( $this->namespaces AS $n => $p ) {
+      if ( $p == "" ) $ns["xmlns"] = $n; else $ns["xmlns:$p"] = $n;
+    }
+
+    return $ns;
+  }
+
+
+  /**
+  * Return a tag with namespace stripped and replaced with a short form, and the ns added to the document.
+  *
+  * @param string $in_tag The tag we want a namespace prefix on.
+  * @param string $namespace The namespace we want it in (which will be parsed from $in_tag if not present
+  * @param string $prefix The prefix we would like to use.  Leave it out and one will be assigned.
+  *
+  * @return string The tag with a namespace prefix consistent with previous tags in this namespace.
+  */
+  function Tag( $in_tag, $namespace=null, $prefix=null ) {
+
+    if ( $namespace == null ) {
+      // Attempt to split out from namespace:tag
+      if ( preg_match('/^(.*):([^:]+)$/', $in_tag, $matches) ) {
+        $namespace = $matches[1];
+        $tag = $matches[2];
+      }
+      else {
+        // There is nothing we can do here
+        return $in_tag;
+      }
+    }
+    else {
+      $tag = $in_tag;
+    }
+
+    if ( !isset($this->namespaces[$namespace]) ) {
+      $this->AddNamespace( $namespace, $prefix );
+    }
+    $prefix = $this->namespaces[$namespace];
+
+    return $prefix . ($prefix == "" ? "" : ":") . $tag;
+  }
+
+
+  /**
+  * Special helper for namespaced tags.
+  *
+  * @param object $element The tag are adding a new namespaced element to
+  * @param string $tag the tag name, possibly prefixed with the namespace
+  * @param mixed  $content The content of the tag
+  * @param array  $attributes An array of key/value pairs of attributes.
+  * @param string $namespace The namespace for the tag
+  *
+  */
+  function NSElement( &$element, $in_tag, $content=false, $attributes=false, $namespace=null ) {
+    if ( $namespace == null && preg_match('/^(.*):([^:]+)$/', $in_tag, $matches) ) {
+      $namespace = $matches[1];
+      $tag = $matches[2];
+    }
+    else {
+      $tag = $in_tag;
+    }
+
+    if ( isset($namespace) && !isset($this->namespaces[$namespace]) ) $this->AddNamespace( $namespace );
+    return $element->NewElement( $tag, $content, $attributes, $namespace );
+  }
+
+
+  /**
+  * Special helper for tags in the DAV: namespace.
+  *
+  * @param object $element The tag are adding a new namespaced element to
+  * @param string $tag the tag name
+  * @param mixed  $content The content of the tag
+  * @param array  $attributes An array of key/value pairs of attributes.
+  */
+  function DAVElement( &$element, $tag, $content=false, $attributes=false ) {
+    return $this->NSElement( $element, $tag, $content, $attributes, 'DAV:' );
+  }
+
+
+  /**
+  * Special helper for tags in the urn:ietf:params:xml:ns:caldav namespace.
+  *
+  * @param object $element The tag are adding a new namespaced element to
+  * @param string $tag the tag name
+  * @param mixed  $content The content of the tag
+  * @param array  $attributes An array of key/value pairs of attributes.
+  */
+  function CalDAVElement( &$element, $tag, $content=false, $attributes=false ) {
+    if ( !isset($this->namespaces['urn:ietf:params:xml:ns:caldav']) ) $this->AddNamespace( 'urn:ietf:params:xml:ns:caldav', 'C' );
+    return $this->NSElement( $element, $tag, $content, $attributes, 'urn:ietf:params:xml:ns:caldav' );
+  }
+
+
+  /**
+  * Special helper for tags in the urn:ietf:params:xml:ns:carddav namespace.
+  *
+  * @param object $element The tag are adding a new namespaced element to
+  * @param string $tag the tag name
+  * @param mixed  $content The content of the tag
+  * @param array  $attributes An array of key/value pairs of attributes.
+  */
+  function CardDAVElement( &$element, $tag, $content=false, $attributes=false ) {
+    if ( !isset($this->namespaces['urn:ietf:params:xml:ns:carddav']) ) $this->AddNamespace( 'urn:ietf:params:xml:ns:carddav', 'VC' );
+    return $this->NSElement( $element, $tag, $content, $attributes, 'urn:ietf:params:xml:ns:carddav' );
+  }
+
+
+  /**
+  * Special helper for tags in the urn:ietf:params:xml:ns:caldav namespace.
+  *
+  * @param object $element The tag are adding a new namespaced element to
+  * @param string $tag the tag name
+  * @param mixed  $content The content of the tag
+  * @param array  $attributes An array of key/value pairs of attributes.
+  */
+  function CalendarserverElement( &$element, $tag, $content=false, $attributes=false ) {
+    if ( !isset($this->namespaces['http://calendarserver.org/ns/']) ) $this->AddNamespace( 'http://calendarserver.org/ns/', 'A' );
+    return $this->NSElement( $element, $tag, $content, $attributes, 'http://calendarserver.org/ns/' );
+  }
+
+
+  /**
+  * @param string $in_tag The tag name of the new element, possibly namespaced
+  * @param mixed $content Either a string of content, or an array of sub-elements
+  * @param array $attributes An array of attribute name/value pairs
+  * @param array $xmlns An XML namespace specifier
+  */
+  function NewXMLElement( $in_tag, $content=false, $attributes=false, $xmlns=null ) {
+    if ( $xmlns == null && preg_match('/^(.*):([^:]+)$/', $in_tag, $matches) ) {
+      $xmlns = $matches[1];
+      $tagname = $matches[2];
+    }
+    else {
+      $tagname = $in_tag;
+    }
+
+    if ( isset($xmlns) && !isset($this->namespaces[$xmlns]) ) $this->AddNamespace( $xmlns );
+    return new XMLElement($tagname, $content, $attributes, $xmlns );
+  }
+
+  /**
+  * Render the document tree into (nicely formatted) XML
+  *
+  * @param mixed $root A root XMLElement or a tagname to create one with the remaining parameters.
+  * @param mixed $content Either a string of content, or an array of sub-elements
+  * @param array $attributes An array of attribute name/value pairs
+  * @param array $xmlns An XML namespace specifier
+  *
+  * @return A rendered namespaced XML document.
+  */
+  function Render( $root, $content=false, $attributes=false, $xmlns=null ) {
+    if ( is_object($root) ) {
+      /** They handed us a pre-existing object.  We'll just use it... */
+      $this->root = $root;
+    }
+    else {
+      /** We got a tag name, so we need to create the root element */
+      $this->root = $this->NewXMLElement( $root, $content, $attributes, $xmlns );
+    }
+
+    /**
+    * Add our namespace attributes here.
+    */
+    foreach( $this->namespaces AS $n => $p ) {
+      $this->root->SetAttribute( 'xmlns'.($p == '' ? '' : ':') . $p, $n);
+    }
+
+    /** And render... */
+    return $this->root->Render(0,'<?xml version="1.0" encoding="utf-8" ?>');
+  }
+
+  /**
+  * Return a DAV::href XML element, or an array of them
+  * @param mixed $url The URL (or array of URLs) to be wrapped in DAV::href tags
+  *
+  * @return XMLElement The newly created XMLElement object.
+  */
+  function href($url) {
+    if ( is_array($url) ) {
+      $set = array();
+      foreach( $url AS $href ) {
+        $set[] = $this->href( $href );
+      }
+      return $set;
+    }
+    return $this->NewXMLElement('href', $url, false, 'DAV:');
+  }
+
+}
+
+
Index: trunk/prototype/plugins/jquery.pagination/pagination.css
===================================================================
--- trunk/prototype/plugins/jquery.pagination/pagination.css	(revision 5341)
+++ trunk/prototype/plugins/jquery.pagination/pagination.css	(revision 5341)
@@ -0,0 +1,31 @@
+.pagination {
+            font-size: 80%;
+        }
+        
+.pagination a {
+    text-decoration: none;
+	border: solid 1px #AAE;
+	color: #15B;
+}
+
+.pagination a, .pagination span {
+    display: block;
+    float: left;
+    padding: 0.3em 0.5em;
+    margin-right: 5px;
+	margin-bottom: 5px;
+	min-width:1em;
+	text-align:center;
+}
+
+.pagination .current {
+    background: #26B;
+    color: #fff;
+	border: solid 1px #AAE;
+}
+
+.pagination .current.prev, .pagination .current.next{
+	color:#999;
+	border-color:#999;
+	background:#fff;
+}
Index: trunk/prototype/plugins/jquery.pagination/jquery.pagination.js
===================================================================
--- trunk/prototype/plugins/jquery.pagination/jquery.pagination.js	(revision 5341)
+++ trunk/prototype/plugins/jquery.pagination/jquery.pagination.js	(revision 5341)
@@ -0,0 +1,231 @@
+/**
+ * This jQuery plugin displays pagination links inside the selected elements.
+ * 
+ * This plugin needs at least jQuery 1.4.2
+ *
+ * @author Gabriel Birke (birke *at* d-scribe *dot* de)
+ * @version 2.2
+ * @param {int} maxentries Number of entries to paginate
+ * @param {Object} opts Several options (see README for documentation)
+ * @return {Object} jQuery Object
+ */
+ (function($){
+	/**
+	 * @class Class for calculating pagination values
+	 */
+	$.PaginationCalculator = function(maxentries, opts) {
+		this.maxentries = maxentries;
+		this.opts = opts;
+	}
+	
+	$.extend($.PaginationCalculator.prototype, {
+		/**
+		 * Calculate the maximum number of pages
+		 * @method
+		 * @returns {Number}
+		 */
+		numPages:function() {
+			return Math.ceil(this.maxentries/this.opts.items_per_page);
+		},
+		/**
+		 * Calculate start and end point of pagination links depending on 
+		 * current_page and num_display_entries.
+		 * @returns {Array}
+		 */
+		getInterval:function(current_page)  {
+			var ne_half = Math.floor(this.opts.num_display_entries/2);
+			var np = this.numPages();
+			var upper_limit = np - this.opts.num_display_entries;
+			var start = current_page > ne_half ? Math.max( Math.min(current_page - ne_half, upper_limit), 0 ) : 0;
+			var end = current_page > ne_half?Math.min(current_page+ne_half + (this.opts.num_display_entries % 2), np):Math.min(this.opts.num_display_entries, np);
+			return {start:start, end:end};
+		}
+	});
+	
+	// Initialize jQuery object container for pagination renderers
+	$.PaginationRenderers = {}
+	
+	/**
+	 * @class Default renderer for rendering pagination links
+	 */
+	$.PaginationRenderers.defaultRenderer = function(maxentries, opts) {
+		this.maxentries = maxentries;
+		this.opts = opts;
+		this.pc = new $.PaginationCalculator(maxentries, opts);
+	}
+	$.extend($.PaginationRenderers.defaultRenderer.prototype, {
+		/**
+		 * Helper function for generating a single link (or a span tag if it's the current page)
+		 * @param {Number} page_id The page id for the new item
+		 * @param {Number} current_page 
+		 * @param {Object} appendopts Options for the new item: text and classes
+		 * @returns {jQuery} jQuery object containing the link
+		 */
+		createLink:function(page_id, current_page, appendopts){
+			var lnk, np = this.pc.numPages();
+			page_id = page_id<0?0:(page_id<np?page_id:np-1); // Normalize page id to sane value
+			appendopts = $.extend({text:page_id+1, classes:""}, appendopts||{});
+			if(page_id == current_page){
+				lnk = $("<span class='current'>" + appendopts.text + "</span>");
+			}
+			else
+			{
+				lnk = $("<a>" + appendopts.text + "</a>")
+					.attr('href', this.opts.link_to.replace(/__id__/,page_id));
+			}
+			if(appendopts.classes){ lnk.addClass(appendopts.classes); }
+			lnk.data('page_id', page_id);
+			return lnk;
+		},
+		// Generate a range of numeric links 
+		appendRange:function(container, current_page, start, end, opts) {
+			var i;
+			for(i=start; i<end; i++) {
+				this.createLink(i, current_page, opts).appendTo(container);
+			}
+		},
+		getLinks:function(current_page, eventHandler) {
+			var begin, end,
+				interval = this.pc.getInterval(current_page),
+				np = this.pc.numPages(),
+				fragment = $("<div class='pagination'></div>");
+			
+			// Generate "Previous"-Link
+			if(this.opts.prev_text && (current_page > 0 || this.opts.prev_show_always)){
+				fragment.append(this.createLink(current_page-1, current_page, {text:this.opts.prev_text, classes:"prev"}));
+			}
+			// Generate starting points
+			if (interval.start > 0 && this.opts.num_edge_entries > 0)
+			{
+				end = Math.min(this.opts.num_edge_entries, interval.start);
+				this.appendRange(fragment, current_page, 0, end, {classes:'sp'});
+				if(this.opts.num_edge_entries < interval.start && this.opts.ellipse_text)
+				{
+					jQuery("<span>"+this.opts.ellipse_text+"</span>").appendTo(fragment);
+				}
+			}
+			// Generate interval links
+			this.appendRange(fragment, current_page, interval.start, interval.end);
+			// Generate ending points
+			if (interval.end < np && this.opts.num_edge_entries > 0)
+			{
+				if(np-this.opts.num_edge_entries > interval.end && this.opts.ellipse_text)
+				{
+					jQuery("<span>"+this.opts.ellipse_text+"</span>").appendTo(fragment);
+				}
+				begin = Math.max(np-this.opts.num_edge_entries, interval.end);
+				this.appendRange(fragment, current_page, begin, np, {classes:'ep'});
+				
+			}
+			// Generate "Next"-Link
+			if(this.opts.next_text && (current_page < np-1 || this.opts.next_show_always)){
+				fragment.append(this.createLink(current_page+1, current_page, {text:this.opts.next_text, classes:"next"}));
+			}
+			$('a', fragment).click(eventHandler);
+			return fragment;
+		}
+	});
+	
+	// Extend jQuery
+	$.fn.pagination = function(maxentries, opts){
+		
+		// Initialize options with default values
+		opts = jQuery.extend({
+			items_per_page:10,
+			num_display_entries:11,
+			current_page:0,
+			num_edge_entries:0,
+			link_to:"#",
+			prev_text:"Prev",
+			next_text:"Next",
+			ellipse_text:"...",
+			prev_show_always:true,
+			next_show_always:true,
+			renderer:"defaultRenderer",
+			load_first_page:false,
+			callback:function(){return false;}
+		},opts||{});
+		
+		var containers = this,
+			renderer, links, current_page;
+		
+		/**
+		 * This is the event handling function for the pagination links. 
+		 * @param {int} page_id The new page number
+		 */
+		function paginationClickHandler(evt){
+			var links, 
+				new_current_page = $(evt.target).data('page_id'),
+				continuePropagation = selectPage(new_current_page);
+			if (!continuePropagation) {
+				evt.stopPropagation();
+			}
+			return continuePropagation;
+		}
+		
+		/**
+		 * This is a utility function for the internal event handlers. 
+		 * It sets the new current page on the pagination container objects, 
+		 * generates a new HTMl fragment for the pagination links and calls
+		 * the callback function.
+		 */
+		function selectPage(new_current_page) {
+			// update the link display of a all containers
+			containers.data('current_page', new_current_page);
+			links = renderer.getLinks(new_current_page, paginationClickHandler);
+			containers.empty();
+			links.appendTo(containers);
+			// call the callback and propagate the event if it does not return false
+			var continuePropagation = opts.callback(new_current_page, containers);
+			return continuePropagation;
+		}
+		
+		// -----------------------------------
+		// Initialize containers
+		// -----------------------------------
+		current_page = opts.current_page;
+		containers.data('current_page', current_page);
+		// Create a sane value for maxentries and items_per_page
+		maxentries = (!maxentries || maxentries < 0)?1:maxentries;
+		opts.items_per_page = (!opts.items_per_page || opts.items_per_page < 0)?1:opts.items_per_page;
+		
+		if(!$.PaginationRenderers[opts.renderer])
+		{
+			throw new ReferenceError("Pagination renderer '" + opts.renderer + "' was not found in jQuery.PaginationRenderers object.");
+		}
+		renderer = new $.PaginationRenderers[opts.renderer](maxentries, opts);
+		
+		// Attach control events to the DOM elements
+		var pc = new $.PaginationCalculator(maxentries, opts);
+		var np = pc.numPages();
+		containers.bind('setPage', {numPages:np}, function(evt, page_id) { 
+				if(page_id >= 0 && page_id < evt.data.numPages) {
+					selectPage(page_id); return false;
+				}
+		});
+		containers.bind('prevPage', function(evt){
+				var current_page = $(this).data('current_page');
+				if (current_page > 0) {
+					selectPage(current_page - 1);
+				}
+				return false;
+		});
+		containers.bind('nextPage', {numPages:np}, function(evt){
+				var current_page = $(this).data('current_page');
+				if(current_page < evt.data.numPages - 1) {
+					selectPage(current_page + 1);
+				}
+				return false;
+		});
+		
+		// When all initialisation is done, draw the links
+		links = renderer.getLinks(current_page, paginationClickHandler);
+		containers.empty();
+		links.appendTo(containers);
+		// call callback function
+		if(opts.load_first_page) {
+			opts.callback(current_page, containers);
+		}
+	} // End of $.fn.pagination block
+	
+})(jQuery);
Index: trunk/prototype/plugins/jquery.pagination/pagination.css.default
===================================================================
--- trunk/prototype/plugins/jquery.pagination/pagination.css.default	(revision 5341)
+++ trunk/prototype/plugins/jquery.pagination/pagination.css.default	(revision 5341)
@@ -0,0 +1,31 @@
+.pagination {
+            font-size: 80%;
+        }
+        
+.pagination a {
+    text-decoration: none;
+	border: solid 1px #AAE;
+	color: #15B;
+}
+
+.pagination a, .pagination span {
+    display: block;
+    float: left;
+    padding: 0.3em 0.5em;
+    margin-right: 5px;
+	margin-bottom: 5px;
+	min-width:1em;
+	text-align:center;
+}
+
+.pagination .current {
+    background: #26B;
+    color: #fff;
+	border: solid 1px #AAE;
+}
+
+.pagination .current.prev, .pagination .current.next{
+	color:#999;
+	border-color:#999;
+	background:#fff;
+}
Index: trunk/prototype/plugins/jquery.pagination/README.rst
===================================================================
--- trunk/prototype/plugins/jquery.pagination/README.rst	(revision 5341)
+++ trunk/prototype/plugins/jquery.pagination/README.rst	(revision 5341)
@@ -0,0 +1,211 @@
+jQuery Pagination Plugin
+========================
+
+Description
+-----------
+When you have a a large list of items (e.g. search results or news articles), 
+you can display them grouped in pages and present navigational elements to move 
+from one page to another. This plugin creates these navigational elements. 
+
+Usage
+-----
+Include jQuery, the pagination plugin script and the pagination.css file in
+your HTML page. In your HTML body create a container tag pair that will hold
+the link elements. Give it an id or class attribute (e.g. "News-Pagination").
+This attribute can used as the selector for jQuery.
+
+Next, write a JavaScript function that has two parameters: page_index and
+paging_container. This is the callback function where you react to clicks on the
+pagination links. It should select a slice from your content, depending on the
+page id.::
+
+    function handlePaginationClick(new_page_index, pagination_container) {
+        // This selects 20 elements from a content array
+        for(var i=new_page_id;i<;i++) {
+            $('#MyContentArea').append(content[i]);
+        }
+        return false;
+    }
+
+The code in this callback function requires knowledge of the jQuery DOM
+manipulation functions. This is where you write your display routines.
+    
+In the initialisation function of your page, when you know how many items you
+want to display overall, create the pagination element like this:::
+
+	// First Parameter: number of items
+	// Second Parameter: options object
+	$("#News-Pagination").pagination(122, {
+		items_per_page:20, 
+		callback:handlePaginationClick
+	});
+
+This will create the navigation links inside the container. You will see the 
+numbers 1-7, the first number is highlighted. When you click on another number, 
+the highlighting changes and your callback function "handlePaginationClick" 
+is called.
+
+The plugin is highly configurable through the option parameter and all elements 
+can be styled separately.
+
+
+Available Options
+-----------------
+The following list describes what options you have for the option object:
+
+callback
+	A callback function that is called when a user clicks on a pagination link. The 
+	function receives two parameters: the new page index and the pagination 
+	container (a DOM element). If the callback returns false, the event 
+	propagation is stopped. Default value: ``function(){return false;}``.
+	This callback function is essential for the functionality of the pagination!
+	It should contain code that updates your content.
+	For a fast user experience you should NOT load content via AJAX in this 
+	function. Instead, pre-load some content pages and switch between them with
+	this function.
+    
+current_page
+	The page that is selected when the pagination is initialized. Default: 0
+	
+items_per_page
+	The number of items per page. The maximum number of pages is calculated by
+	dividing the number of items by items_per_page (rounded up, minimum 1).
+	**Please note:** This value is only for calculating the number of pages. 
+	The actual selection of the items correlating to the current page and
+	number of items must be done by your code in your callback function!
+	Default: 10
+	
+link_to
+	Link target of the pagination links. Normally the page selection is 
+	triggered through an onclick event. If the link contains the string 
+	``__id__``, it will be replaced with the page number. Default: ``#``
+	
+num_display_entries
+	Maximum number of pagination links that are visible. Set to 0 to display a
+	simple "Previous/Next"-Navigation. Set to an odd number for maximum 
+	symmetry and aesthetic pleasure. Default: 11
+	
+next_text
+	Text for the "Next"-link that increases the current page number by 1. 
+	Leave blank to hide the link. Default: ``Next``
+	
+next_show_always
+	If this is set to false, the "Next"-link is only shown when the page number 
+	can be increased. Default: `true`
+	
+prev_text
+	Text for the "Previous"-link that decreases the current page number by 1. 
+	Leave blank to hide the link. Default: ``Previous``
+	
+prev_show_always
+	If this is set to false, the "Previous"-link is only shown when the page 
+	number can be decreased. Default: true
+	
+num_edge_entries
+	If this number is set to 1, links to the first and the last page are always 
+	shown, independent of the current position and the visibility constraints 
+	set by num_display_entries. You can set it to bigger numbers to show more 
+	links. Default: 0
+	
+ellipse_text
+	When there is a gap between the numbers created by num_edge_entries and the 
+	displayed number interval, this text will be inserted into the gap (inside a
+	span tag). Can be left blank to avoid the additional tag. Default: ``...``
+
+load_first_page
+	If true (default) then the callback is executed when the plugin is 
+    initialized. If you load your content with AJAX and already show content
+    whey you initialize the pagination, you should set this to false.
+
+Triggering pagination with custom events
+----------------------------------------
+There may be use cases where you want to change the pagination from your own
+JavaScript code. For example in a wizard or a questionnaire you skip pages if
+a certain option is not selected. Or clicking on images in an image gallery
+should trigger the "next page" event. For these use cases you use jQuery
+custom events like this:::
+
+	// Jump to the 5th page 
+	$("#News-Pagination").trigger('setPage', [4]);
+	// Go to the next page
+	$("#News-Pagination").trigger('nextPage');
+	// Go to the previous page
+	$("#News-Pagination").trigger('prevPage');
+
+The event handlers check if the new page number is inside the boundaries of the number of pages and ignore the event if it is outside.
+
+Version history
+---------------
+Version 1.0 
++++++++++++
+Inital release   
+
+Version 1.1 
++++++++++++
+Fixed a bug when the click on a pagination item was propagated to the browser.   
+
+Version 1.2 
++++++++++++
+Fixed bug with jQuery.noConflict(). Wrote better demo files. Tested with 
+jQuery 1.3.1
+
+Version 2.0rc1
+++++++++++++++
+  - Complete, more object-oriented rewrite
+  - Now requires jQuery 1.4. Tested with jQuery 1.4.2
+  - Support for several synchronized pagination containers
+  
+Version 2.0rc2
+++++++++++++++
+Bugfix. Renderer used restricted keyword "default"
+
+Version 2.0.1
++++++++++++++
+  - Bugfix for GitHub Issue #1, found by Cody Lindley
+  - Small text corrections
+  - Start end end points now have classes.
+
+Version 2.1
++++++++++++
+Pagination can now be controlled from you own JavaScript code by triggering
+custom events. See ``demo/demo_events.htm`` for an example.
+
+Version 2.2
++++++++++++
+alexhayes added an option to avoid calling the callback when the plugin is
+initialized.
+
+Future Plans
+------------
+   * Optional links for jumping a fixed number of pages.
+   * Trigger events when a page is selected.
+   * Implement paginaton as a jQuery UI widget.
+   * More renderers for rendering the Pagination elements differently.
+   * Documentation and examples how you implement your own renderers.
+   * Write unit tests and use QUnit instead of JSUnit.
+
+I'll implement these features as I see fit and when my time allows it. If 
+you'd like to see any of those features *now*, feel free to contact me and we 
+can discuss a reasonable fee.
+
+I'd be glad if you could send me a notice where you use jQuery Pagination. 
+Knowing common use cases will help me to improve the plugin in the future.
+
+License and Contact Information
+-------------------------------
+This plugin is licensed under the GPL v2. You can find the full license text 
+here: http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
+If you need another license, write me an email and tell me what the library 
+will be used for. I usually grant other open source licenses on an individual
+basis.
+
+Source code: http://github.com/gbirke/jquery_pagination
+
+You can reach me at:
+
+| describe europe Ltd.
+| Gabriel Birke
+| Eckerstr. 6
+| 30161 Hannover
+| birke (at) d-scribe (dot) de
+| http://www.d-scribe.de/
Index: trunk/prototype/plugins/alphanumeric/jquery.alphanumeric.js
===================================================================
--- trunk/prototype/plugins/alphanumeric/jquery.alphanumeric.js	(revision 5341)
+++ trunk/prototype/plugins/alphanumeric/jquery.alphanumeric.js	(revision 5341)
@@ -0,0 +1,82 @@
+(function($){
+
+	$.fn.alphanumeric = function(p) { 
+
+		p = $.extend({
+			ichars: "!@#$%^&*()+=[]\\\';,/{}|\":<>?~`.- ",
+			nchars: "",
+			allow: ""
+		  }, p);	
+
+		return this.each
+			(
+				function() 
+				{
+
+					if (p.nocaps) p.nchars += "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+					if (p.allcaps) p.nchars += "abcdefghijklmnopqrstuvwxyz";
+					
+					s = p.allow.split('');
+					for ( i=0;i<s.length;i++) if (p.ichars.indexOf(s[i]) != -1) s[i] = "\\" + s[i];
+					p.allow = s.join('|');
+					
+					var reg = new RegExp(p.allow,'gi');
+					var ch = p.ichars + p.nchars;
+					ch = ch.replace(reg,'');
+
+					$(this).keypress
+						(
+							function (e)
+								{
+								
+									if (!e.charCode) k = String.fromCharCode(e.which);
+										else k = String.fromCharCode(e.charCode);
+										
+									if (ch.indexOf(k) != -1) e.preventDefault();
+									if (e.ctrlKey&&k=='v') e.preventDefault();
+									
+								}
+								
+						);
+						
+					$(this).bind('contextmenu',function () {return false});
+									
+				}
+			);
+
+	};
+
+	$.fn.numeric = function(p) {
+	
+		var az = "abcdefghijklmnopqrstuvwxyz";
+		az += az.toUpperCase();
+
+		p = $.extend({
+			nchars: az
+		  }, p);	
+		  	
+		return this.each (function()
+			{
+				$(this).alphanumeric(p);
+			}
+		);
+			
+	};
+	
+	$.fn.alpha = function(p) {
+
+		var nm = "1234567890";
+
+		p = $.extend({
+			nchars: nm
+		  }, p);	
+
+		return this.each (function()
+			{
+				$(this).alphanumeric(p);
+			}
+		);
+			
+	};	
+
+})(jQuery);
Index: trunk/prototype/plugins/datejs/license.txt
===================================================================
--- trunk/prototype/plugins/datejs/license.txt	(revision 5341)
+++ trunk/prototype/plugins/datejs/license.txt	(revision 5341)
@@ -0,0 +1,23 @@
+Copyright (c) 2006-2007, Coolite Inc. (http://www.coolite.com/). All rights reserved.
+
+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.
+
+See also:
+	http://www.datejs.com/license/
+	http://www.datejs.com/
Index: trunk/prototype/plugins/datejs/core.js
===================================================================
--- trunk/prototype/plugins/datejs/core.js	(revision 5341)
+++ trunk/prototype/plugins/datejs/core.js	(revision 5341)
@@ -0,0 +1,39 @@
+/**
+ * Version: 1.0 Alpha-1 
+ * Build Date: 13-Nov-2007
+ * Copyright (c) 2006-2007, Coolite Inc. (http://www.coolite.com/). All rights reserved.
+ * License: Licensed under The MIT License. See license.txt and http://www.datejs.com/license/. 
+ * Website: http://www.datejs.com/ or http://www.coolite.com/datejs/
+ */
+Date.getMonthNumberFromName=function(name){var n=Date.CultureInfo.monthNames,m=Date.CultureInfo.abbreviatedMonthNames,s=name.toLowerCase();for(var i=0;i<n.length;i++){if(n[i].toLowerCase()==s||m[i].toLowerCase()==s){return i;}}
+return-1;};Date.getDayNumberFromName=function(name){var n=Date.CultureInfo.dayNames,m=Date.CultureInfo.abbreviatedDayNames,o=Date.CultureInfo.shortestDayNames,s=name.toLowerCase();for(var i=0;i<n.length;i++){if(n[i].toLowerCase()==s||m[i].toLowerCase()==s){return i;}}
+return-1;};Date.isLeapYear=function(year){return(((year%4===0)&&(year%100!==0))||(year%400===0));};Date.getDaysInMonth=function(year,month){return[31,(Date.isLeapYear(year)?29:28),31,30,31,30,31,31,30,31,30,31][month];};Date.getTimezoneOffset=function(s,dst){return(dst||false)?Date.CultureInfo.abbreviatedTimeZoneDST[s.toUpperCase()]:Date.CultureInfo.abbreviatedTimeZoneStandard[s.toUpperCase()];};Date.getTimezoneAbbreviation=function(offset,dst){var n=(dst||false)?Date.CultureInfo.abbreviatedTimeZoneDST:Date.CultureInfo.abbreviatedTimeZoneStandard,p;for(p in n){if(n[p]===offset){return p;}}
+return null;};Date.prototype.clone=function(){return new Date(this.getTime());};Date.prototype.compareTo=function(date){if(isNaN(this)){throw new Error(this);}
+if(date instanceof Date&&!isNaN(date)){return(this>date)?1:(this<date)?-1:0;}else{throw new TypeError(date);}};Date.prototype.equals=function(date){return(this.compareTo(date)===0);};Date.prototype.between=function(start,end){var t=this.getTime();return t>=start.getTime()&&t<=end.getTime();};Date.prototype.addMilliseconds=function(value){this.setMilliseconds(this.getMilliseconds()+value);return this;};Date.prototype.addSeconds=function(value){return this.addMilliseconds(value*1000);};Date.prototype.addMinutes=function(value){return this.addMilliseconds(value*60000);};Date.prototype.addHours=function(value){return this.addMilliseconds(value*3600000);};Date.prototype.addDays=function(value){return this.addMilliseconds(value*86400000);};Date.prototype.addWeeks=function(value){return this.addMilliseconds(value*604800000);};Date.prototype.addMonths=function(value){var n=this.getDate();this.setDate(1);this.setMonth(this.getMonth()+value);this.setDate(Math.min(n,this.getDaysInMonth()));return this;};Date.prototype.addYears=function(value){return this.addMonths(value*12);};Date.prototype.add=function(config){if(typeof config=="number"){this._orient=config;return this;}
+var x=config;if(x.millisecond||x.milliseconds){this.addMilliseconds(x.millisecond||x.milliseconds);}
+if(x.second||x.seconds){this.addSeconds(x.second||x.seconds);}
+if(x.minute||x.minutes){this.addMinutes(x.minute||x.minutes);}
+if(x.hour||x.hours){this.addHours(x.hour||x.hours);}
+if(x.month||x.months){this.addMonths(x.month||x.months);}
+if(x.year||x.years){this.addYears(x.year||x.years);}
+if(x.day||x.days){this.addDays(x.day||x.days);}
+return this;};Date._validate=function(value,min,max,name){if(typeof value!="number"){throw new TypeError(value+" is not a Number.");}else if(value<min||value>max){throw new RangeError(value+" is not a valid value for "+name+".");}
+return true;};Date.validateMillisecond=function(n){return Date._validate(n,0,999,"milliseconds");};Date.validateSecond=function(n){return Date._validate(n,0,59,"seconds");};Date.validateMinute=function(n){return Date._validate(n,0,59,"minutes");};Date.validateHour=function(n){return Date._validate(n,0,23,"hours");};Date.validateDay=function(n,year,month){return Date._validate(n,1,Date.getDaysInMonth(year,month),"days");};Date.validateMonth=function(n){return Date._validate(n,0,11,"months");};Date.validateYear=function(n){return Date._validate(n,1,9999,"seconds");};Date.prototype.set=function(config){var x=config;if(!x.millisecond&&x.millisecond!==0){x.millisecond=-1;}
+if(!x.second&&x.second!==0){x.second=-1;}
+if(!x.minute&&x.minute!==0){x.minute=-1;}
+if(!x.hour&&x.hour!==0){x.hour=-1;}
+if(!x.day&&x.day!==0){x.day=-1;}
+if(!x.month&&x.month!==0){x.month=-1;}
+if(!x.year&&x.year!==0){x.year=-1;}
+if(x.millisecond!=-1&&Date.validateMillisecond(x.millisecond)){this.addMilliseconds(x.millisecond-this.getMilliseconds());}
+if(x.second!=-1&&Date.validateSecond(x.second)){this.addSeconds(x.second-this.getSeconds());}
+if(x.minute!=-1&&Date.validateMinute(x.minute)){this.addMinutes(x.minute-this.getMinutes());}
+if(x.hour!=-1&&Date.validateHour(x.hour)){this.addHours(x.hour-this.getHours());}
+if(x.month!==-1&&Date.validateMonth(x.month)){this.addMonths(x.month-this.getMonth());}
+if(x.year!=-1&&Date.validateYear(x.year)){this.addYears(x.year-this.getFullYear());}
+if(x.day!=-1&&Date.validateDay(x.day,this.getFullYear(),this.getMonth())){this.addDays(x.day-this.getDate());}
+if(x.timezone){this.setTimezone(x.timezone);}
+if(x.timezoneOffset){this.setTimezoneOffset(x.timezoneOffset);}
+return this;};Date.prototype.clearTime=function(){this.setHours(0);this.setMinutes(0);this.setSeconds(0);this.setMilliseconds(0);return this;};Date.prototype.isLeapYear=function(){var y=this.getFullYear();return(((y%4===0)&&(y%100!==0))||(y%400===0));};Date.prototype.isWeekday=function(){return!(this.is().sat()||this.is().sun());};Date.prototype.getDaysInMonth=function(){return Date.getDaysInMonth(this.getFullYear(),this.getMonth());};Date.prototype.moveToFirstDayOfMonth=function(){return this.set({day:1});};Date.prototype.moveToLastDayOfMonth=function(){return this.set({day:this.getDaysInMonth()});};Date.prototype.moveToDayOfWeek=function(day,orient){var diff=(day-this.getDay()+7*(orient||+1))%7;return this.addDays((diff===0)?diff+=7*(orient||+1):diff);};Date.prototype.moveToMonth=function(month,orient){var diff=(month-this.getMonth()+12*(orient||+1))%12;return this.addMonths((diff===0)?diff+=12*(orient||+1):diff);};Date.prototype.getDayOfYear=function(){return Math.floor((this-new Date(this.getFullYear(),0,1))/86400000);};Date.prototype.getWeekOfYear=function(firstDayOfWeek){var y=this.getFullYear(),m=this.getMonth(),d=this.getDate();var dow=firstDayOfWeek||Date.CultureInfo.firstDayOfWeek;var offset=7+1-new Date(y,0,1).getDay();if(offset==8){offset=1;}
+var daynum=((Date.UTC(y,m,d,0,0,0)-Date.UTC(y,0,1,0,0,0))/86400000)+1;var w=Math.floor((daynum-offset+7)/7);if(w===dow){y--;var prevOffset=7+1-new Date(y,0,1).getDay();if(prevOffset==2||prevOffset==8){w=53;}else{w=52;}}
+return w;};Date.prototype.isDST=function(){console.log('isDST');return this.toString().match(/(E|C|M|P)(S|D)T/)[2]=="D";};Date.prototype.getTimezone=function(){return Date.getTimezoneAbbreviation(this.getUTCOffset,this.isDST());};Date.prototype.setTimezoneOffset=function(s){var here=this.getTimezoneOffset(),there=Number(s)*-6/10;this.addMinutes(there-here);return this;};Date.prototype.setTimezone=function(s){return this.setTimezoneOffset(Date.getTimezoneOffset(s));};Date.prototype.getUTCOffset=function(){var n=this.getTimezoneOffset()*-10/6,r;if(n<0){r=(n-10000).toString();return r[0]+r.substr(2);}else{r=(n+10000).toString();return"+"+r.substr(1);}};Date.prototype.getDayName=function(abbrev){return abbrev?Date.CultureInfo.abbreviatedDayNames[this.getDay()]:Date.CultureInfo.dayNames[this.getDay()];};Date.prototype.getMonthName=function(abbrev){return abbrev?Date.CultureInfo.abbreviatedMonthNames[this.getMonth()]:Date.CultureInfo.monthNames[this.getMonth()];};Date.prototype._toString=Date.prototype.toString;Date.prototype.toString=function(format){var self=this;var p=function p(s){return(s.toString().length==1)?"0"+s:s;};return format?format.replace(/dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|zz?z?/g,function(format){switch(format){case"hh":return p(self.getHours()<13?self.getHours():(self.getHours()-12));case"h":return self.getHours()<13?self.getHours():(self.getHours()-12);case"HH":return p(self.getHours());case"H":return self.getHours();case"mm":return p(self.getMinutes());case"m":return self.getMinutes();case"ss":return p(self.getSeconds());case"s":return self.getSeconds();case"yyyy":return self.getFullYear();case"yy":return self.getFullYear().toString().substring(2,4);case"dddd":return self.getDayName();case"ddd":return self.getDayName(true);case"dd":return p(self.getDate());case"d":return self.getDate().toString();case"MMMM":return self.getMonthName();case"MMM":return self.getMonthName(true);case"MM":return p((self.getMonth()+1));case"M":return self.getMonth()+1;case"t":return self.getHours()<12?Date.CultureInfo.amDesignator.substring(0,1):Date.CultureInfo.pmDesignator.substring(0,1);case"tt":return self.getHours()<12?Date.CultureInfo.amDesignator:Date.CultureInfo.pmDesignator;case"zzz":case"zz":case"z":return"";}}):this._toString();};
Index: trunk/prototype/plugins/datejs/core-debug.js
===================================================================
--- trunk/prototype/plugins/datejs/core-debug.js	(revision 5341)
+++ trunk/prototype/plugins/datejs/core-debug.js	(revision 5341)
@@ -0,0 +1,651 @@
+/**
+ * Version: 1.0 Alpha-1 
+ * Build Date: 12-Nov-2007
+ * Copyright (c) 2006-2007, Coolite Inc. (http://www.coolite.com/). All rights reserved.
+ * License: Licensed under The MIT License. See license.txt and http://www.datejs.com/license/. 
+ * Website: http://www.datejs.com/ or http://www.coolite.com/datejs/
+ */
+
+/**
+ * Gets the month number (0-11) if given a Culture Info specific string which is a valid monthName or abbreviatedMonthName.
+ * @param {String}   The name of the month (eg. "February, "Feb", "october", "oct").
+ * @return {Number}  The day number
+ */
+Date.getMonthNumberFromName = function (name) {
+    var n = Date.CultureInfo.monthNames, m = Date.CultureInfo.abbreviatedMonthNames, s = name.toLowerCase();
+    for (var i = 0; i < n.length; i++) {
+        if (n[i].toLowerCase() == s || m[i].toLowerCase() == s) { 
+            return i; 
+        }
+    }
+    return -1;
+};
+
+/**
+ * Gets the day number (0-6) if given a CultureInfo specific string which is a valid dayName, abbreviatedDayName or shortestDayName (two char).
+ * @param {String}   The name of the day (eg. "Monday, "Mon", "tuesday", "tue", "We", "we").
+ * @return {Number}  The day number
+ */
+Date.getDayNumberFromName = function (name) {
+    var n = Date.CultureInfo.dayNames, m = Date.CultureInfo.abbreviatedDayNames, o = Date.CultureInfo.shortestDayNames, s = name.toLowerCase();
+    for (var i = 0; i < n.length; i++) { 
+        if (n[i].toLowerCase() == s || m[i].toLowerCase() == s) { 
+            return i; 
+        }
+    }
+    return -1;  
+};
+
+/**
+ * Determines if the current date instance is within a LeapYear.
+ * @param {Number}   The year (0-9999).
+ * @return {Boolean} true if date is within a LeapYear, otherwise false.
+ */
+Date.isLeapYear = function (year) { 
+    return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0)); 
+};
+
+/**
+ * Gets the number of days in the month, given a year and month value. Automatically corrects for LeapYear.
+ * @param {Number}   The year (0-9999).
+ * @param {Number}   The month (0-11).
+ * @return {Number}  The number of days in the month.
+ */
+Date.getDaysInMonth = function (year, month) {
+    return [31, (Date.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];
+};
+
+Date.getTimezoneOffset = function (s, dst) {
+    return (dst || false) ? Date.CultureInfo.abbreviatedTimeZoneDST[s.toUpperCase()] :
+        Date.CultureInfo.abbreviatedTimeZoneStandard[s.toUpperCase()];
+};
+
+Date.getTimezoneAbbreviation = function (offset, dst) {
+    var n = (dst || false) ? Date.CultureInfo.abbreviatedTimeZoneDST : Date.CultureInfo.abbreviatedTimeZoneStandard, p;
+    for (p in n) { 
+        if (n[p] === offset) { 
+            return p; 
+        }
+    }
+    return null;
+};
+
+/**
+ * Returns a new Date object that is an exact date and time copy of the original instance.
+ * @return {Date}    A new Date instance
+ */
+Date.prototype.clone = function () {
+    return new Date(this.getTime()); 
+};
+
+/**
+ * Compares this instance to a Date object and return an number indication of their relative values.  
+ * @param {Date}     Date object to compare [Required]
+ * @return {Number}  1 = this is greaterthan date. -1 = this is lessthan date. 0 = values are equal
+ */
+Date.prototype.compareTo = function (date) {
+    if (isNaN(this)) { 
+        throw new Error(this); 
+    }
+    if (date instanceof Date && !isNaN(date)) {
+        return (this > date) ? 1 : (this < date) ? -1 : 0;
+    } else { 
+        throw new TypeError(date); 
+    }
+};
+
+/**
+ * Compares this instance to another Date object and returns true if they are equal.  
+ * @param {Date}     Date object to compare [Required]
+ * @return {Boolean} true if dates are equal. false if they are not equal.
+ */
+Date.prototype.equals = function (date) { 
+    return (this.compareTo(date) === 0); 
+};
+
+/**
+ * Determines is this instance is between a range of two dates or equal to either the start or end dates.
+ * @param {Date}     Start of range [Required]
+ * @param {Date}     End of range [Required]
+ * @return {Boolean} true is this is between or equal to the start and end dates, else false
+ */
+Date.prototype.between = function (start, end) {
+    var t = this.getTime();
+    return t >= start.getTime() && t <= end.getTime();
+};
+
+/**
+ * Adds the specified number of milliseconds to this instance. 
+ * @param {Number}   The number of milliseconds to add. The number can be positive or negative [Required]
+ * @return {Date}    this
+ */
+Date.prototype.addMilliseconds = function (value) {
+    this.setMilliseconds(this.getMilliseconds() + value);
+    return this;
+};
+
+/**
+ * Adds the specified number of seconds to this instance. 
+ * @param {Number}   The number of seconds to add. The number can be positive or negative [Required]
+ * @return {Date}    this
+ */
+Date.prototype.addSeconds = function (value) { 
+    return this.addMilliseconds(value * 1000); 
+};
+
+/**
+ * Adds the specified number of seconds to this instance. 
+ * @param {Number}   The number of seconds to add. The number can be positive or negative [Required]
+ * @return {Date}    this
+ */
+Date.prototype.addMinutes = function (value) { 
+    return this.addMilliseconds(value * 60000); /* 60*1000 */
+};
+
+/**
+ * Adds the specified number of hours to this instance. 
+ * @param {Number}   The number of hours to add. The number can be positive or negative [Required]
+ * @return {Date}    this
+ */
+Date.prototype.addHours = function (value) { 
+    return this.addMilliseconds(value * 3600000); /* 60*60*1000 */
+};
+
+/**
+ * Adds the specified number of days to this instance. 
+ * @param {Number}   The number of days to add. The number can be positive or negative [Required]
+ * @return {Date}    this
+ */
+Date.prototype.addDays = function (value) { 
+    return this.addMilliseconds(value * 86400000); /* 60*60*24*1000 */
+};
+
+/**
+ * Adds the specified number of weeks to this instance. 
+ * @param {Number}   The number of weeks to add. The number can be positive or negative [Required]
+ * @return {Date}    this
+ */
+Date.prototype.addWeeks = function (value) { 
+    return this.addMilliseconds(value * 604800000); /* 60*60*24*7*1000 */
+};
+
+/**
+ * Adds the specified number of months to this instance. 
+ * @param {Number}   The number of months to add. The number can be positive or negative [Required]
+ * @return {Date}    this
+ */
+Date.prototype.addMonths = function (value) {
+    var n = this.getDate();
+    this.setDate(1);
+    this.setMonth(this.getMonth() + value);
+    this.setDate(Math.min(n, this.getDaysInMonth()));
+    return this;
+};
+
+/**
+ * Adds the specified number of years to this instance. 
+ * @param {Number}   The number of years to add. The number can be positive or negative [Required]
+ * @return {Date}    this
+ */
+Date.prototype.addYears = function (value) {
+    return this.addMonths(value * 12);
+};
+
+/**
+ * Adds (or subtracts) to the value of the year, month, day, hour, minute, second, millisecond of the date instance using given configuration object. Positive and Negative values allowed.
+ * Example
+<pre><code>
+Date.today().add( { day: 1, month: 1 } )
+ 
+new Date().add( { year: -1 } )
+</code></pre> 
+ * @param {Object}   Configuration object containing attributes (month, day, etc.)
+ * @return {Date}    this
+ */
+Date.prototype.add = function (config) {
+    if (typeof config == "number") {
+        this._orient = config;
+        return this;    
+    }
+    var x = config;
+    if (x.millisecond || x.milliseconds) { 
+        this.addMilliseconds(x.millisecond || x.milliseconds); 
+    }
+    if (x.second || x.seconds) { 
+        this.addSeconds(x.second || x.seconds); 
+    }
+    if (x.minute || x.minutes) { 
+        this.addMinutes(x.minute || x.minutes); 
+    }
+    if (x.hour || x.hours) { 
+        this.addHours(x.hour || x.hours); 
+    }
+    if (x.month || x.months) { 
+        this.addMonths(x.month || x.months); 
+    }
+    if (x.year || x.years) { 
+        this.addYears(x.year || x.years); 
+    }
+    if (x.day || x.days) {
+        this.addDays(x.day || x.days); 
+    }
+    return this;
+};
+
+// private
+Date._validate = function (value, min, max, name) {
+    if (typeof value != "number") {
+        throw new TypeError(value + " is not a Number."); 
+    } else if (value < min || value > max) {
+        throw new RangeError(value + " is not a valid value for " + name + "."); 
+    }
+    return true;
+};
+
+/**
+ * Validates the number is within an acceptable range for milliseconds [0-999].
+ * @param {Number}   The number to check if within range.
+ * @return {Boolean} true if within range, otherwise false.
+ */
+Date.validateMillisecond = function (n) {
+    return Date._validate(n, 0, 999, "milliseconds");
+};
+
+/**
+ * Validates the number is within an acceptable range for seconds [0-59].
+ * @param {Number}   The number to check if within range.
+ * @return {Boolean} true if within range, otherwise false.
+ */
+Date.validateSecond = function (n) {
+    return Date._validate(n, 0, 59, "seconds");
+};
+
+/**
+ * Validates the number is within an acceptable range for minutes [0-59].
+ * @param {Number}   The number to check if within range.
+ * @return {Boolean} true if within range, otherwise false.
+ */
+Date.validateMinute = function (n) {
+    return Date._validate(n, 0, 59, "minutes");
+};
+
+/**
+ * Validates the number is within an acceptable range for hours [0-23].
+ * @param {Number}   The number to check if within range.
+ * @return {Boolean} true if within range, otherwise false.
+ */
+Date.validateHour = function (n) {
+    return Date._validate(n, 0, 23, "hours");
+};
+
+/**
+ * Validates the number is within an acceptable range for the days in a month [0-MaxDaysInMonth].
+ * @param {Number}   The number to check if within range.
+ * @return {Boolean} true if within range, otherwise false.
+ */
+Date.validateDay = function (n, year, month) {
+    return Date._validate(n, 1, Date.getDaysInMonth(year, month), "days");
+};
+
+/**
+ * Validates the number is within an acceptable range for months [0-11].
+ * @param {Number}   The number to check if within range.
+ * @return {Boolean} true if within range, otherwise false.
+ */
+Date.validateMonth = function (n) {
+    return Date._validate(n, 0, 11, "months");
+};
+
+/**
+ * Validates the number is within an acceptable range for years [0-9999].
+ * @param {Number}   The number to check if within range.
+ * @return {Boolean} true if within range, otherwise false.
+ */
+Date.validateYear = function (n) {
+    return Date._validate(n, 1, 9999, "seconds");
+};
+
+/**
+ * Set the value of year, month, day, hour, minute, second, millisecond of date instance using given configuration object.
+ * Example
+<pre><code>
+Date.today().set( { day: 20, month: 1 } )
+
+new Date().set( { millisecond: 0 } )
+</code></pre>
+ * 
+ * @param {Object}   Configuration object containing attributes (month, day, etc.)
+ * @return {Date}    this
+ */
+Date.prototype.set = function (config) {
+    var x = config;
+
+    if (!x.millisecond && x.millisecond !== 0) { 
+        x.millisecond = -1; 
+    }
+    if (!x.second && x.second !== 0) { 
+        x.second = -1; 
+    }
+    if (!x.minute && x.minute !== 0) { 
+        x.minute = -1; 
+    }
+    if (!x.hour && x.hour !== 0) { 
+        x.hour = -1; 
+    }
+    if (!x.day && x.day !== 0) { 
+        x.day = -1; 
+    }
+    if (!x.month && x.month !== 0) { 
+        x.month = -1; 
+    }
+    if (!x.year && x.year !== 0) { 
+        x.year = -1; 
+    }
+
+    if (x.millisecond != -1 && Date.validateMillisecond(x.millisecond)) {
+        this.addMilliseconds(x.millisecond - this.getMilliseconds()); 
+    }
+    if (x.second != -1 && Date.validateSecond(x.second)) {
+        this.addSeconds(x.second - this.getSeconds()); 
+    }
+    if (x.minute != -1 && Date.validateMinute(x.minute)) {
+        this.addMinutes(x.minute - this.getMinutes()); 
+    }
+    if (x.hour != -1 && Date.validateHour(x.hour)) {
+        this.addHours(x.hour - this.getHours()); 
+    }
+    if (x.month !== -1 && Date.validateMonth(x.month)) {
+        this.addMonths(x.month - this.getMonth()); 
+    }
+    if (x.year != -1 && Date.validateYear(x.year)) {
+        this.addYears(x.year - this.getFullYear()); 
+    }
+    
+	/* day has to go last because you can't validate the day without first knowing the month */
+    if (x.day != -1 && Date.validateDay(x.day, this.getFullYear(), this.getMonth())) {
+        this.addDays(x.day - this.getDate()); 
+    }
+    if (x.timezone) { 
+        this.setTimezone(x.timezone); 
+    }
+    if (x.timezoneOffset) { 
+        this.setTimezoneOffset(x.timezoneOffset); 
+    }
+    
+    return this;   
+};
+
+/**
+ * Resets the time of this Date object to 12:00 AM (00:00), which is the start of the day.
+ * @return {Date}    this
+ */
+Date.prototype.clearTime = function () {
+    this.setHours(0); 
+    this.setMinutes(0); 
+    this.setSeconds(0);
+    this.setMilliseconds(0); 
+    return this;
+};
+
+/**
+ * Determines whether or not this instance is in a leap year.
+ * @return {Boolean} true if this instance is in a leap year, else false
+ */
+Date.prototype.isLeapYear = function () { 
+    var y = this.getFullYear(); 
+    return (((y % 4 === 0) && (y % 100 !== 0)) || (y % 400 === 0)); 
+};
+
+/**
+ * Determines whether or not this instance is a weekday.
+ * @return {Boolean} true if this instance is a weekday
+ */
+Date.prototype.isWeekday = function () { 
+    return !(this.is().sat() || this.is().sun());
+};
+
+/**
+ * Get the number of days in the current month, adjusted for leap year.
+ * @return {Number}  The number of days in the month
+ */
+Date.prototype.getDaysInMonth = function () { 
+    return Date.getDaysInMonth(this.getFullYear(), this.getMonth());
+};
+
+/**
+ * Moves the date to the first day of the month.
+ * @return {Date}    this
+ */
+Date.prototype.moveToFirstDayOfMonth = function () {
+    return this.set({ day: 1 });
+};
+
+/**
+ * Moves the date to the last day of the month.
+ * @return {Date}    this
+ */
+Date.prototype.moveToLastDayOfMonth = function () { 
+    return this.set({ day: this.getDaysInMonth()});
+};
+
+/**
+ * Move to the next or last dayOfWeek based on the orient value.
+ * @param {Number}   The dayOfWeek to move to.
+ * @param {Number}   Forward (+1) or Back (-1). Defaults to +1. [Optional]
+ * @return {Date}    this
+ */
+Date.prototype.moveToDayOfWeek = function (day, orient) {
+    var diff = (day - this.getDay() + 7 * (orient || +1)) % 7;
+    return this.addDays((diff === 0) ? diff += 7 * (orient || +1) : diff);
+};
+
+/**
+ * Move to the next or last month based on the orient value.
+ * @param {Number}   The month to move to. 0 = January, 11 = December.
+ * @param {Number}   Forward (+1) or Back (-1). Defaults to +1. [Optional]
+ * @return {Date}    this
+ */
+Date.prototype.moveToMonth = function (month, orient) {
+    var diff = (month - this.getMonth() + 12 * (orient || +1)) % 12;
+    return this.addMonths((diff === 0) ? diff += 12 * (orient || +1) : diff);
+};
+
+/**
+ * Get the numeric day number of the year, adjusted for leap year.
+ * @return {Number} 0 through 364 (365 in leap years)
+ */
+Date.prototype.getDayOfYear = function () {
+    return Math.floor((this - new Date(this.getFullYear(), 0, 1)) / 86400000);
+};
+
+/**
+ * Get the week of the year for the current date instance.
+ * @param {Number}   A Number that represents the first day of the week (0-6) [Optional]
+ * @return {Number}  0 through 53
+ */
+Date.prototype.getWeekOfYear = function (firstDayOfWeek) {
+    var y = this.getFullYear(), m = this.getMonth(), d = this.getDate();
+    
+    var dow = firstDayOfWeek || Date.CultureInfo.firstDayOfWeek;
+	
+    var offset = 7 + 1 - new Date(y, 0, 1).getDay();
+    if (offset == 8) {
+        offset = 1;
+    }
+    var daynum = ((Date.UTC(y, m, d, 0, 0, 0) - Date.UTC(y, 0, 1, 0, 0, 0)) / 86400000) + 1;
+    var w = Math.floor((daynum - offset + 7) / 7);
+    if (w === dow) {
+        y--;
+        var prevOffset = 7 + 1 - new Date(y, 0, 1).getDay();
+        if (prevOffset == 2 || prevOffset == 8) { 
+            w = 53; 
+        } else { 
+            w = 52; 
+        }
+    }
+    return w;
+};
+
+/**
+ * Determine whether Daylight Saving Time (DST) is in effect
+ * @return {Boolean} True if DST is in effect.
+ */
+Date.prototype.isDST = function () {
+    console.log('isDST');
+    /* TODO: not sure if this is portable ... get from Date.CultureInfo? */
+    return this.toString().match(/(E|C|M|P)(S|D)T/)[2] == "D";
+};
+
+/**
+ * Get the timezone abbreviation of the current date.
+ * @return {String} The abbreviated timezone name (e.g. "EST")
+ */
+Date.prototype.getTimezone = function () {
+    return Date.getTimezoneAbbreviation(this.getUTCOffset, this.isDST());
+};
+
+Date.prototype.setTimezoneOffset = function (s) {
+    var here = this.getTimezoneOffset(), there = Number(s) * -6 / 10;
+    this.addMinutes(there - here); 
+    return this;
+};
+
+Date.prototype.setTimezone = function (s) { 
+    return this.setTimezoneOffset(Date.getTimezoneOffset(s)); 
+};
+
+/**
+ * Get the offset from UTC of the current date.
+ * @return {String} The 4-character offset string prefixed with + or - (e.g. "-0500")
+ */
+Date.prototype.getUTCOffset = function () {
+    var n = this.getTimezoneOffset() * -10 / 6, r;
+    if (n < 0) { 
+        r = (n - 10000).toString(); 
+        return r[0] + r.substr(2); 
+    } else { 
+        r = (n + 10000).toString();  
+        return "+" + r.substr(1); 
+    }
+};
+
+/**
+ * Gets the name of the day of the week.
+ * @param {Boolean}  true to return the abbreviated name of the day of the week
+ * @return {String}  The name of the day
+ */
+Date.prototype.getDayName = function (abbrev) {
+    return abbrev ? Date.CultureInfo.abbreviatedDayNames[this.getDay()] : 
+        Date.CultureInfo.dayNames[this.getDay()];
+};
+
+/**
+ * Gets the month name.
+ * @param {Boolean}  true to return the abbreviated name of the month
+ * @return {String}  The name of the month
+ */
+Date.prototype.getMonthName = function (abbrev) {
+    return abbrev ? Date.CultureInfo.abbreviatedMonthNames[this.getMonth()] : 
+        Date.CultureInfo.monthNames[this.getMonth()];
+};
+
+// private
+Date.prototype._toString = Date.prototype.toString;
+
+/**
+ * Converts the value of the current Date object to its equivalent string representation.
+ * Format Specifiers
+<pre>
+Format  Description                                                                  Example
+------  ---------------------------------------------------------------------------  -----------------------
+ s      The seconds of the minute between 1-59.                                      "1" to "59"
+ ss     The seconds of the minute with leading zero if required.                     "01" to "59"
+ 
+ m      The minute of the hour between 0-59.                                         "1"  or "59"
+ mm     The minute of the hour with leading zero if required.                        "01" or "59"
+ 
+ h      The hour of the day between 1-12.                                            "1"  to "12"
+ hh     The hour of the day with leading zero if required.                           "01" to "12"
+ 
+ H      The hour of the day between 1-23.                                            "1"  to "23"
+ HH     The hour of the day with leading zero if required.                           "01" to "23"
+ 
+ d      The day of the month between 1 and 31.                                       "1"  to "31"
+ dd     The day of the month with leading zero if required.                          "01" to "31"
+ ddd    Abbreviated day name. Date.CultureInfo.abbreviatedDayNames.                  "Mon" to "Sun" 
+ dddd   The full day name. Date.CultureInfo.dayNames.                                "Monday" to "Sunday"
+ 
+ M      The month of the year between 1-12.                                          "1" to "12"
+ MM     The month of the year with leading zero if required.                         "01" to "12"
+ MMM    Abbreviated month name. Date.CultureInfo.abbreviatedMonthNames.              "Jan" to "Dec"
+ MMMM   The full month name. Date.CultureInfo.monthNames.                            "January" to "December"
+
+ yy     Displays the year as a maximum two-digit number.                             "99" or "07"
+ yyyy   Displays the full four digit year.                                           "1999" or "2007"
+ 
+ t      Displays the first character of the A.M./P.M. designator.                    "A" or "P"
+        Date.CultureInfo.amDesignator or Date.CultureInfo.pmDesignator
+ tt     Displays the A.M./P.M. designator.                                           "AM" or "PM"
+        Date.CultureInfo.amDesignator or Date.CultureInfo.pmDesignator
+</pre>
+ * @param {String}   A format string consisting of one or more format spcifiers [Optional].
+ * @return {String}  A string representation of the current Date object.
+ */
+Date.prototype.toString = function (format) {
+    var self = this;
+
+    var p = function p(s) {
+        return (s.toString().length == 1) ? "0" + s : s;
+    };
+
+    return format ? format.replace(/dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|zz?z?/g, 
+    function (format) {
+        switch (format) {
+        case "hh":
+            return p(self.getHours() < 13 ? self.getHours() : (self.getHours() - 12));
+        case "h":
+            return self.getHours() < 13 ? self.getHours() : (self.getHours() - 12);
+        case "HH":
+            return p(self.getHours());
+        case "H":
+            return self.getHours();
+        case "mm":
+            return p(self.getMinutes());
+        case "m":
+            return self.getMinutes();
+        case "ss":
+            return p(self.getSeconds());
+        case "s":
+            return self.getSeconds();
+        case "yyyy":
+            return self.getFullYear();
+        case "yy":
+            return self.getFullYear().toString().substring(2, 4);
+        case "dddd":
+            return self.getDayName();
+        case "ddd":
+            return self.getDayName(true);
+        case "dd":
+            return p(self.getDate());
+        case "d":
+            return self.getDate().toString();
+        case "MMMM":
+            return self.getMonthName();
+        case "MMM":
+            return self.getMonthName(true);
+        case "MM":
+            return p((self.getMonth() + 1));
+        case "M":
+            return self.getMonth() + 1;
+        case "t":
+            return self.getHours() < 12 ? Date.CultureInfo.amDesignator.substring(0, 1) : Date.CultureInfo.pmDesignator.substring(0, 1);
+        case "tt":
+            return self.getHours() < 12 ? Date.CultureInfo.amDesignator : Date.CultureInfo.pmDesignator;
+        case "zzz":
+        case "zz":
+        case "z":
+            return "";
+        }
+    }
+    ) : this._toString();
+};
Index: trunk/prototype/plugins/datejs/parser.js
===================================================================
--- trunk/prototype/plugins/datejs/parser.js	(revision 5341)
+++ trunk/prototype/plugins/datejs/parser.js	(revision 5341)
@@ -0,0 +1,65 @@
+/**
+ * Version: 1.0 Alpha-1 
+ * Build Date: 13-Nov-2007
+ * Copyright (c) 2006-2007, Coolite Inc. (http://www.coolite.com/). All rights reserved.
+ * License: Licensed under The MIT License. See license.txt and http://www.datejs.com/license/. 
+ * Website: http://www.datejs.com/ or http://www.coolite.com/datejs/
+ */
+(function(){Date.Parsing={Exception:function(s){this.message="Parse error at '"+s.substring(0,10)+" ...'";}};var $P=Date.Parsing;var _=$P.Operators={rtoken:function(r){return function(s){var mx=s.match(r);if(mx){return([mx[0],s.substring(mx[0].length)]);}else{throw new $P.Exception(s);}};},token:function(s){return function(s){return _.rtoken(new RegExp("^\s*"+s+"\s*"))(s);};},stoken:function(s){return _.rtoken(new RegExp("^"+s));},until:function(p){return function(s){var qx=[],rx=null;while(s.length){try{rx=p.call(this,s);}catch(e){qx.push(rx[0]);s=rx[1];continue;}
+break;}
+return[qx,s];};},many:function(p){return function(s){var rx=[],r=null;while(s.length){try{r=p.call(this,s);}catch(e){return[rx,s];}
+rx.push(r[0]);s=r[1];}
+return[rx,s];};},optional:function(p){return function(s){var r=null;try{r=p.call(this,s);}catch(e){return[null,s];}
+return[r[0],r[1]];};},not:function(p){return function(s){try{p.call(this,s);}catch(e){return[null,s];}
+throw new $P.Exception(s);};},ignore:function(p){return p?function(s){var r=null;r=p.call(this,s);return[null,r[1]];}:null;},product:function(){var px=arguments[0],qx=Array.prototype.slice.call(arguments,1),rx=[];for(var i=0;i<px.length;i++){rx.push(_.each(px[i],qx));}
+return rx;},cache:function(rule){var cache={},r=null;return function(s){try{r=cache[s]=(cache[s]||rule.call(this,s));}catch(e){r=cache[s]=e;}
+if(r instanceof $P.Exception){throw r;}else{return r;}};},any:function(){var px=arguments;return function(s){var r=null;for(var i=0;i<px.length;i++){if(px[i]==null){continue;}
+try{r=(px[i].call(this,s));}catch(e){r=null;}
+if(r){return r;}}
+throw new $P.Exception(s);};},each:function(){var px=arguments;return function(s){var rx=[],r=null;for(var i=0;i<px.length;i++){if(px[i]==null){continue;}
+try{r=(px[i].call(this,s));}catch(e){throw new $P.Exception(s);}
+rx.push(r[0]);s=r[1];}
+return[rx,s];};},all:function(){var px=arguments,_=_;return _.each(_.optional(px));},sequence:function(px,d,c){d=d||_.rtoken(/^\s*/);c=c||null;if(px.length==1){return px[0];}
+return function(s){var r=null,q=null;var rx=[];for(var i=0;i<px.length;i++){try{r=px[i].call(this,s);}catch(e){break;}
+rx.push(r[0]);try{q=d.call(this,r[1]);}catch(ex){q=null;break;}
+s=q[1];}
+if(!r){throw new $P.Exception(s);}
+if(q){throw new $P.Exception(q[1]);}
+if(c){try{r=c.call(this,r[1]);}catch(ey){throw new $P.Exception(r[1]);}}
+return[rx,(r?r[1]:s)];};},between:function(d1,p,d2){d2=d2||d1;var _fn=_.each(_.ignore(d1),p,_.ignore(d2));return function(s){var rx=_fn.call(this,s);return[[rx[0][0],r[0][2]],rx[1]];};},list:function(p,d,c){d=d||_.rtoken(/^\s*/);c=c||null;return(p instanceof Array?_.each(_.product(p.slice(0,-1),_.ignore(d)),p.slice(-1),_.ignore(c)):_.each(_.many(_.each(p,_.ignore(d))),px,_.ignore(c)));},set:function(px,d,c){d=d||_.rtoken(/^\s*/);c=c||null;return function(s){var r=null,p=null,q=null,rx=null,best=[[],s],last=false;for(var i=0;i<px.length;i++){q=null;p=null;r=null;last=(px.length==1);try{r=px[i].call(this,s);}catch(e){continue;}
+rx=[[r[0]],r[1]];if(r[1].length>0&&!last){try{q=d.call(this,r[1]);}catch(ex){last=true;}}else{last=true;}
+if(!last&&q[1].length===0){last=true;}
+if(!last){var qx=[];for(var j=0;j<px.length;j++){if(i!=j){qx.push(px[j]);}}
+p=_.set(qx,d).call(this,q[1]);if(p[0].length>0){rx[0]=rx[0].concat(p[0]);rx[1]=p[1];}}
+if(rx[1].length<best[1].length){best=rx;}
+if(best[1].length===0){break;}}
+if(best[0].length===0){return best;}
+if(c){try{q=c.call(this,best[1]);}catch(ey){throw new $P.Exception(best[1]);}
+best[1]=q[1];}
+return best;};},forward:function(gr,fname){return function(s){return gr[fname].call(this,s);};},replace:function(rule,repl){return function(s){var r=rule.call(this,s);return[repl,r[1]];};},process:function(rule,fn){return function(s){var r=rule.call(this,s);return[fn.call(this,r[0]),r[1]];};},min:function(min,rule){return function(s){var rx=rule.call(this,s);if(rx[0].length<min){throw new $P.Exception(s);}
+return rx;};}};var _generator=function(op){return function(){var args=null,rx=[];if(arguments.length>1){args=Array.prototype.slice.call(arguments);}else if(arguments[0]instanceof Array){args=arguments[0];}
+if(args){for(var i=0,px=args.shift();i<px.length;i++){args.unshift(px[i]);rx.push(op.apply(null,args));args.shift();return rx;}}else{return op.apply(null,arguments);}};};var gx="optional not ignore cache".split(/\s/);for(var i=0;i<gx.length;i++){_[gx[i]]=_generator(_[gx[i]]);}
+var _vector=function(op){return function(){if(arguments[0]instanceof Array){return op.apply(null,arguments[0]);}else{return op.apply(null,arguments);}};};var vx="each any all".split(/\s/);for(var j=0;j<vx.length;j++){_[vx[j]]=_vector(_[vx[j]]);}}());(function(){var flattenAndCompact=function(ax){var rx=[];for(var i=0;i<ax.length;i++){if(ax[i]instanceof Array){rx=rx.concat(flattenAndCompact(ax[i]));}else{if(ax[i]){rx.push(ax[i]);}}}
+return rx;};Date.Grammar={};Date.Translator={hour:function(s){return function(){this.hour=Number(s);};},minute:function(s){return function(){this.minute=Number(s);};},second:function(s){return function(){this.second=Number(s);};},meridian:function(s){return function(){this.meridian=s.slice(0,1).toLowerCase();};},timezone:function(s){return function(){var n=s.replace(/[^\d\+\-]/g,"");if(n.length){this.timezoneOffset=Number(n);}else{this.timezone=s.toLowerCase();}};},day:function(x){var s=x[0];return function(){this.day=Number(s.match(/\d+/)[0]);};},month:function(s){return function(){this.month=((s.length==3)?Date.getMonthNumberFromName(s):(Number(s)-1));};},year:function(s){return function(){var n=Number(s);this.year=((s.length>2)?n:(n+(((n+2000)<Date.CultureInfo.twoDigitYearMax)?2000:1900)));};},rday:function(s){return function(){switch(s){case"yesterday":this.days=-1;break;case"tomorrow":this.days=1;break;case"today":this.days=0;break;case"now":this.days=0;this.now=true;break;}};},finishExact:function(x){x=(x instanceof Array)?x:[x];var now=new Date();this.year=now.getFullYear();this.month=now.getMonth();this.day=1;this.hour=0;this.minute=0;this.second=0;for(var i=0;i<x.length;i++){if(x[i]){x[i].call(this);}}
+this.hour=(this.meridian=="p"&&this.hour<13)?this.hour+12:this.hour;if(this.day>Date.getDaysInMonth(this.year,this.month)){throw new RangeError(this.day+" is not a valid value for days.");}
+var r=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second);if(this.timezone){r.set({timezone:this.timezone});}else if(this.timezoneOffset){r.set({timezoneOffset:this.timezoneOffset});}
+return r;},finish:function(x){x=(x instanceof Array)?flattenAndCompact(x):[x];if(x.length===0){return null;}
+for(var i=0;i<x.length;i++){if(typeof x[i]=="function"){x[i].call(this);}}
+if(this.now){return new Date();}
+var today=Date.today();var method=null;var expression=!!(this.days!=null||this.orient||this.operator);if(expression){var gap,mod,orient;orient=((this.orient=="past"||this.operator=="subtract")?-1:1);if(this.weekday){this.unit="day";gap=(Date.getDayNumberFromName(this.weekday)-today.getDay());mod=7;this.days=gap?((gap+(orient*mod))%mod):(orient*mod);}
+if(this.month){this.unit="month";gap=(this.month-today.getMonth());mod=12;this.months=gap?((gap+(orient*mod))%mod):(orient*mod);this.month=null;}
+if(!this.unit){this.unit="day";}
+if(this[this.unit+"s"]==null||this.operator!=null){if(!this.value){this.value=1;}
+if(this.unit=="week"){this.unit="day";this.value=this.value*7;}
+this[this.unit+"s"]=this.value*orient;}
+return today.add(this);}else{if(this.meridian&&this.hour){this.hour=(this.hour<13&&this.meridian=="p")?this.hour+12:this.hour;}
+if(this.weekday&&!this.day){this.day=(today.addDays((Date.getDayNumberFromName(this.weekday)-today.getDay()))).getDate();}
+if(this.month&&!this.day){this.day=1;}
+return today.set(this);}}};var _=Date.Parsing.Operators,g=Date.Grammar,t=Date.Translator,_fn;g.datePartDelimiter=_.rtoken(/^([\s\-\.\,\/\x27]+)/);g.timePartDelimiter=_.stoken(":");g.whiteSpace=_.rtoken(/^\s*/);g.generalDelimiter=_.rtoken(/^(([\s\,]|at|on)+)/);var _C={};g.ctoken=function(keys){var fn=_C[keys];if(!fn){var c=Date.CultureInfo.regexPatterns;var kx=keys.split(/\s+/),px=[];for(var i=0;i<kx.length;i++){px.push(_.replace(_.rtoken(c[kx[i]]),kx[i]));}
+fn=_C[keys]=_.any.apply(null,px);}
+return fn;};g.ctoken2=function(key){return _.rtoken(Date.CultureInfo.regexPatterns[key]);};g.h=_.cache(_.process(_.rtoken(/^(0[0-9]|1[0-2]|[1-9])/),t.hour));g.hh=_.cache(_.process(_.rtoken(/^(0[0-9]|1[0-2])/),t.hour));g.H=_.cache(_.process(_.rtoken(/^([0-1][0-9]|2[0-3]|[0-9])/),t.hour));g.HH=_.cache(_.process(_.rtoken(/^([0-1][0-9]|2[0-3])/),t.hour));g.m=_.cache(_.process(_.rtoken(/^([0-5][0-9]|[0-9])/),t.minute));g.mm=_.cache(_.process(_.rtoken(/^[0-5][0-9]/),t.minute));g.s=_.cache(_.process(_.rtoken(/^([0-5][0-9]|[0-9])/),t.second));g.ss=_.cache(_.process(_.rtoken(/^[0-5][0-9]/),t.second));g.hms=_.cache(_.sequence([g.H,g.mm,g.ss],g.timePartDelimiter));g.t=_.cache(_.process(g.ctoken2("shortMeridian"),t.meridian));g.tt=_.cache(_.process(g.ctoken2("longMeridian"),t.meridian));g.z=_.cache(_.process(_.rtoken(/^(\+|\-)?\s*\d\d\d\d?/),t.timezone));g.zz=_.cache(_.process(_.rtoken(/^(\+|\-)\s*\d\d\d\d/),t.timezone));g.zzz=_.cache(_.process(g.ctoken2("timezone"),t.timezone));g.timeSuffix=_.each(_.ignore(g.whiteSpace),_.set([g.tt,g.zzz]));g.time=_.each(_.optional(_.ignore(_.stoken("T"))),g.hms,g.timeSuffix);g.d=_.cache(_.process(_.each(_.rtoken(/^([0-2]\d|3[0-1]|\d)/),_.optional(g.ctoken2("ordinalSuffix"))),t.day));g.dd=_.cache(_.process(_.each(_.rtoken(/^([0-2]\d|3[0-1])/),_.optional(g.ctoken2("ordinalSuffix"))),t.day));g.ddd=g.dddd=_.cache(_.process(g.ctoken("sun mon tue wed thu fri sat"),function(s){return function(){this.weekday=s;};}));g.M=_.cache(_.process(_.rtoken(/^(1[0-2]|0\d|\d)/),t.month));g.MM=_.cache(_.process(_.rtoken(/^(1[0-2]|0\d)/),t.month));g.MMM=g.MMMM=_.cache(_.process(g.ctoken("jan feb mar apr may jun jul aug sep oct nov dec"),t.month));g.y=_.cache(_.process(_.rtoken(/^(\d\d?)/),t.year));g.yy=_.cache(_.process(_.rtoken(/^(\d\d)/),t.year));g.yyy=_.cache(_.process(_.rtoken(/^(\d\d?\d?\d?)/),t.year));g.yyyy=_.cache(_.process(_.rtoken(/^(\d\d\d\d)/),t.year));_fn=function(){return _.each(_.any.apply(null,arguments),_.not(g.ctoken2("timeContext")));};g.day=_fn(g.d,g.dd);g.month=_fn(g.M,g.MMM);g.year=_fn(g.yyyy,g.yy);g.orientation=_.process(g.ctoken("past future"),function(s){return function(){this.orient=s;};});g.operator=_.process(g.ctoken("add subtract"),function(s){return function(){this.operator=s;};});g.rday=_.process(g.ctoken("yesterday tomorrow today now"),t.rday);g.unit=_.process(g.ctoken("minute hour day week month year"),function(s){return function(){this.unit=s;};});g.value=_.process(_.rtoken(/^\d\d?(st|nd|rd|th)?/),function(s){return function(){this.value=s.replace(/\D/g,"");};});g.expression=_.set([g.rday,g.operator,g.value,g.unit,g.orientation,g.ddd,g.MMM]);_fn=function(){return _.set(arguments,g.datePartDelimiter);};g.mdy=_fn(g.ddd,g.month,g.day,g.year);g.ymd=_fn(g.ddd,g.year,g.month,g.day);g.dmy=_fn(g.ddd,g.day,g.month,g.year);g.date=function(s){return((g[Date.CultureInfo.dateElementOrder]||g.mdy).call(this,s));};g.format=_.process(_.many(_.any(_.process(_.rtoken(/^(dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|zz?z?)/),function(fmt){if(g[fmt]){return g[fmt];}else{throw Date.Parsing.Exception(fmt);}}),_.process(_.rtoken(/^[^dMyhHmstz]+/),function(s){return _.ignore(_.stoken(s));}))),function(rules){return _.process(_.each.apply(null,rules),t.finishExact);});var _F={};var _get=function(f){return _F[f]=(_F[f]||g.format(f)[0]);};g.formats=function(fx){if(fx instanceof Array){var rx=[];for(var i=0;i<fx.length;i++){rx.push(_get(fx[i]));}
+return _.any.apply(null,rx);}else{return _get(fx);}};g._formats=g.formats(["yyyy-MM-ddTHH:mm:ss","ddd, MMM dd, yyyy H:mm:ss tt","ddd MMM d yyyy HH:mm:ss zzz","d"]);g._start=_.process(_.set([g.date,g.time,g.expression],g.generalDelimiter,g.whiteSpace),t.finish);g.start=function(s){try{var r=g._formats.call({},s);if(r[1].length===0){return r;}}catch(e){}
+return g._start.call({},s);};}());Date._parse=Date.parse;Date.parse=function(s){var r=null;if(!s){return null;}
+try{r=Date.Grammar.start.call({},s);}catch(e){return null;}
+return((r[1].length===0)?r[0]:null);};Date.getParseFunction=function(fx){var fn=Date.Grammar.formats(fx);return function(s){var r=null;try{r=fn.call({},s);}catch(e){return null;}
+return((r[1].length===0)?r[0]:null);};};Date.parseExact=function(s,fx){return Date.getParseFunction(fx)(s);};
Index: trunk/prototype/plugins/datejs/date.js
===================================================================
--- trunk/prototype/plugins/datejs/date.js	(revision 5341)
+++ trunk/prototype/plugins/datejs/date.js	(revision 5341)
@@ -0,0 +1,21 @@
+/**
+ * Please include a date.js file from the /build/ folder.
+ * 
+ * Individual date.js files have been compiled for each of the 150+ supported Cultures.
+ * 
+ * Example:
+ * date.js       // English (United States)
+ * date-en-US.js // English (United States)
+ * date-de-DE.js // Deutsch (Deutschland)
+ * date-es-MX.js // français (France)
+ */
+
+alert(
+    "Please include a date.js file from the /build/ folder.\n\n" +
+    "Individual date.js files have been compiled for each supported Culture.\n\n" + 
+    "Example:\n" + 
+    "    date.js       // English (United States)\n" + 
+    "    date-en-US.js // English (United States)\n" + 
+    "    date-de-DE.js // Deutsch (Deutschland)\n" + 
+    "    date-es-MX.js // français (France)\n"
+    );
Index: trunk/prototype/plugins/datejs/sugarpak.js
===================================================================
--- trunk/prototype/plugins/datejs/sugarpak.js	(revision 5341)
+++ trunk/prototype/plugins/datejs/sugarpak.js	(revision 5341)
@@ -0,0 +1,13 @@
+/**
+ * Version: 1.0 Alpha-1 
+ * Build Date: 13-Nov-2007
+ * Copyright (c) 2006-2007, Coolite Inc. (http://www.coolite.com/). All rights reserved.
+ * License: Licensed under The MIT License. See license.txt and http://www.datejs.com/license/. 
+ * Website: http://www.datejs.com/ or http://www.coolite.com/datejs/
+ */
+Date.now=function(){return new Date();};Date.today=function(){return Date.now().clearTime();};Date.prototype._orient=+1;Date.prototype.next=function(){this._orient=+1;return this;};Date.prototype.last=Date.prototype.prev=Date.prototype.previous=function(){this._orient=-1;return this;};Date.prototype._is=false;Date.prototype.is=function(){this._is=true;return this;};Number.prototype._dateElement="day";Number.prototype.fromNow=function(){var c={};c[this._dateElement]=this;return Date.now().add(c);};Number.prototype.ago=function(){var c={};c[this._dateElement]=this*-1;return Date.now().add(c);};(function(){var $D=Date.prototype,$N=Number.prototype;var dx=("sunday monday tuesday wednesday thursday friday saturday").split(/\s/),mx=("january february march april may june july august september october november december").split(/\s/),px=("Millisecond Second Minute Hour Day Week Month Year").split(/\s/),de;var df=function(n){return function(){if(this._is){this._is=false;return this.getDay()==n;}
+return this.moveToDayOfWeek(n,this._orient);};};for(var i=0;i<dx.length;i++){$D[dx[i]]=$D[dx[i].substring(0,3)]=df(i);}
+var mf=function(n){return function(){if(this._is){this._is=false;return this.getMonth()===n;}
+return this.moveToMonth(n,this._orient);};};for(var j=0;j<mx.length;j++){$D[mx[j]]=$D[mx[j].substring(0,3)]=mf(j);}
+var ef=function(j){return function(){if(j.substring(j.length-1)!="s"){j+="s";}
+return this["add"+j](this._orient);};};var nf=function(n){return function(){this._dateElement=n;return this;};};for(var k=0;k<px.length;k++){de=px[k].toLowerCase();$D[de]=$D[de+"s"]=ef(px[k]);$N[de]=$N[de+"s"]=nf(de);}}());Date.prototype.toJSONString=function(){return this.toString("yyyy-MM-ddThh:mm:ssZ");};Date.prototype.toShortDateString=function(){return this.toString(Date.CultureInfo.formatPatterns.shortDatePattern);};Date.prototype.toLongDateString=function(){return this.toString(Date.CultureInfo.formatPatterns.longDatePattern);};Date.prototype.toShortTimeString=function(){return this.toString(Date.CultureInfo.formatPatterns.shortTimePattern);};Date.prototype.toLongTimeString=function(){return this.toString(Date.CultureInfo.formatPatterns.longTimePattern);};Date.prototype.getOrdinal=function(){switch(this.getDate()){case 1:case 21:case 31:return"st";case 2:case 22:return"nd";case 3:case 23:return"rd";default:return"th";}};
Index: trunk/prototype/plugins/datejs/time.js
===================================================================
--- trunk/prototype/plugins/datejs/time.js	(revision 5341)
+++ trunk/prototype/plugins/datejs/time.js	(revision 5341)
@@ -0,0 +1,19 @@
+/**
+ * Version: 1.0 Alpha-1 
+ * Build Date: 13-Nov-2007
+ * Copyright (c) 2006-2007, Coolite Inc. (http://www.coolite.com/). All rights reserved.
+ * License: Licensed under The MIT License. See license.txt and http://www.datejs.com/license/. 
+ * Website: http://www.datejs.com/ or http://www.coolite.com/datejs/
+ */
+TimeSpan=function(days,hours,minutes,seconds,milliseconds){this.days=0;this.hours=0;this.minutes=0;this.seconds=0;this.milliseconds=0;if(arguments.length==5){this.days=days;this.hours=hours;this.minutes=minutes;this.seconds=seconds;this.milliseconds=milliseconds;}
+else if(arguments.length==1&&typeof days=="number"){var orient=(days<0)?-1:+1;this.milliseconds=Math.abs(days);this.days=Math.floor(this.milliseconds/(24*60*60*1000))*orient;this.milliseconds=this.milliseconds%(24*60*60*1000);this.hours=Math.floor(this.milliseconds/(60*60*1000))*orient;this.milliseconds=this.milliseconds%(60*60*1000);this.minutes=Math.floor(this.milliseconds/(60*1000))*orient;this.milliseconds=this.milliseconds%(60*1000);this.seconds=Math.floor(this.milliseconds/1000)*orient;this.milliseconds=this.milliseconds%1000;this.milliseconds=this.milliseconds*orient;return this;}
+else{return null;}};TimeSpan.prototype.compare=function(timeSpan){var t1=new Date(1970,1,1,this.hours(),this.minutes(),this.seconds()),t2;if(timeSpan===null){t2=new Date(1970,1,1,0,0,0);}
+else{t2=new Date(1970,1,1,timeSpan.hours(),timeSpan.minutes(),timeSpan.seconds());}
+return(t1>t2)?1:(t1<t2)?-1:0;};TimeSpan.prototype.add=function(timeSpan){return(timeSpan===null)?this:this.addSeconds(timeSpan.getTotalMilliseconds()/1000);};TimeSpan.prototype.subtract=function(timeSpan){return(timeSpan===null)?this:this.addSeconds(-timeSpan.getTotalMilliseconds()/1000);};TimeSpan.prototype.addDays=function(n){return new TimeSpan(this.getTotalMilliseconds()+(n*24*60*60*1000));};TimeSpan.prototype.addHours=function(n){return new TimeSpan(this.getTotalMilliseconds()+(n*60*60*1000));};TimeSpan.prototype.addMinutes=function(n){return new TimeSpan(this.getTotalMilliseconds()+(n*60*1000));};TimeSpan.prototype.addSeconds=function(n){return new TimeSpan(this.getTotalMilliseconds()+(n*1000));};TimeSpan.prototype.addMilliseconds=function(n){return new TimeSpan(this.getTotalMilliseconds()+n);};TimeSpan.prototype.getTotalMilliseconds=function(){return(this.days()*(24*60*60*1000))+(this.hours()*(60*60*1000))+(this.minutes()*(60*1000))+(this.seconds()*(1000));};TimeSpan.prototype.get12HourHour=function(){return((h=this.hours()%12)?h:12);};TimeSpan.prototype.getDesignator=function(){return(this.hours()<12)?Date.CultureInfo.amDesignator:Date.CultureInfo.pmDesignator;};TimeSpan.prototype.toString=function(format){function _toString(){if(this.days()!==null&&this.days()>0){return this.days()+"."+this.hours()+":"+p(this.minutes())+":"+p(this.seconds());}
+else{return this.hours()+":"+p(this.minutes())+":"+p(this.seconds());}}
+function p(s){return(s.toString().length<2)?"0"+s:s;}
+var self=this;return format?format.replace(/d|dd|HH|H|hh|h|mm|m|ss|s|tt|t/g,function(format){switch(format){case"d":return self.days();case"dd":return p(self.days());case"H":return self.hours();case"HH":return p(self.hours());case"h":return self.get12HourHour();case"hh":return p(self.get12HourHour());case"m":return self.minutes();case"mm":return p(self.minutes());case"s":return self.seconds();case"ss":return p(self.seconds());case"t":return((this.hours()<12)?Date.CultureInfo.amDesignator:Date.CultureInfo.pmDesignator).substring(0,1);case"tt":return(this.hours()<12)?Date.CultureInfo.amDesignator:Date.CultureInfo.pmDesignator;}}):this._toString();};var TimePeriod=function(years,months,days,hours,minutes,seconds,milliseconds){this.years=0;this.months=0;this.days=0;this.hours=0;this.minutes=0;this.seconds=0;this.milliseconds=0;if(arguments.length==2&&arguments[0]instanceof Date&&arguments[1]instanceof Date){var date1=years.clone();var date2=months.clone();var temp=date1.clone();var orient=(date1>date2)?-1:+1;this.years=date2.getFullYear()-date1.getFullYear();temp.addYears(this.years);if(orient==+1){if(temp>date2){if(this.years!==0){this.years--;}}}else{if(temp<date2){if(this.years!==0){this.years++;}}}
+date1.addYears(this.years);if(orient==+1){while(date1<date2&&date1.clone().addDays(date1.getDaysInMonth())<date2){date1.addMonths(1);this.months++;}}
+else{while(date1>date2&&date1.clone().addDays(-date1.getDaysInMonth())>date2){date1.addMonths(-1);this.months--;}}
+var diff=date2-date1;if(diff!==0){var ts=new TimeSpan(diff);this.days=ts.days;this.hours=ts.hours;this.minutes=ts.minutes;this.seconds=ts.seconds;this.milliseconds=ts.milliseconds;}
+return this;}};
Index: trunk/prototype/plugins/datejs/date-pt-BR.js
===================================================================
--- trunk/prototype/plugins/datejs/date-pt-BR.js	(revision 5341)
+++ trunk/prototype/plugins/datejs/date-pt-BR.js	(revision 5341)
@@ -0,0 +1,104 @@
+/**
+ * Version: 1.0 Alpha-1 
+ * Build Date: 13-Nov-2007
+ * Copyright (c) 2006-2007, Coolite Inc. (http://www.coolite.com/). All rights reserved.
+ * License: Licensed under The MIT License. See license.txt and http://www.datejs.com/license/. 
+ * Website: http://www.datejs.com/ or http://www.coolite.com/datejs/
+ */
+Date.CultureInfo={name:"pt-BR",englishName:"Portuguese (Brazil)",nativeName:"PortuguÃªs (Brasil)",dayNames:["domingo","segunda-feira","terÃ§a-feira","quarta-feira","quinta-feira","sexta-feira","sÃ¡bado"],abbreviatedDayNames:["dom","seg","ter","qua","qui","sex","sÃ¡b"],shortestDayNames:["dom","seg","ter","qua","qui","sex","sÃ¡b"],firstLetterDayNames:["d","s","t","q","q","s","s"],monthNames:["janeiro","fevereiro","marÃ§o","abril","maio","junho","julho","agosto","setembro","outubro","novembro","dezembro"],abbreviatedMonthNames:["jan","fev","mar","abr","mai","jun","jul","ago","set","out","nov","dez"],amDesignator:"",pmDesignator:"",firstDayOfWeek:0,twoDigitYearMax:2029,dateElementOrder:"dmy",formatPatterns:{shortDate:"d/M/yyyy",longDate:"dddd, d' de 'MMMM' de 'yyyy",shortTime:"H:mm",longTime:"H:mm:ss",fullDateTime:"dddd, d' de 'MMMM' de 'yyyy H:mm:ss",sortableDateTime:"yyyy-MM-ddTHH:mm:ss",universalSortableDateTime:"yyyy-MM-dd HH:mm:ssZ",rfc1123:"ddd, dd MMM yyyy HH:mm:ss GMT",monthDay:"dd' de 'MMMM",yearMonth:"MMMM' de 'yyyy"},regexPatterns:{jan:/^jan(eiro)?/i,feb:/^fev(ereiro)?/i,mar:/^mar(Ã§o)?/i,apr:/^abr(il)?/i,may:/^mai(o)?/i,jun:/^jun(ho)?/i,jul:/^jul(ho)?/i,aug:/^ago(sto)?/i,sep:/^set(embro)?/i,oct:/^out(ubro)?/i,nov:/^nov(embro)?/i,dec:/^dez(embro)?/i,sun:/^domingo/i,mon:/^segunda-feira/i,tue:/^terÃ§a-feira/i,wed:/^quarta-feira/i,thu:/^quinta-feira/i,fri:/^sexta-feira/i,sat:/^sÃ¡bado/i,future:/^next/i,past:/^last|past|prev(ious)?/i,add:/^(\+|after|from)/i,subtract:/^(\-|before|ago)/i,yesterday:/^yesterday/i,today:/^t(oday)?/i,tomorrow:/^tomorrow/i,now:/^n(ow)?/i,millisecond:/^ms|milli(second)?s?/i,second:/^sec(ond)?s?/i,minute:/^min(ute)?s?/i,hour:/^h(ou)?rs?/i,week:/^w(ee)?k/i,month:/^m(o(nth)?s?)?/i,day:/^d(ays?)?/i,year:/^y((ea)?rs?)?/i,shortMeridian:/^(a|p)/i,longMeridian:/^(a\.?m?\.?|p\.?m?\.?)/i,timezone:/^((e(s|d)t|c(s|d)t|m(s|d)t|p(s|d)t)|((gmt)?\s*(\+|\-)\s*\d\d\d\d?)|gmt)/i,ordinalSuffix:/^\s*(st|nd|rd|th)/i,timeContext:/^\s*(\:|a|p)/i},abbreviatedTimeZoneStandard:{GMT:"-000",EST:"-0400",CST:"-0500",MST:"-0600",PST:"-0700"},abbreviatedTimeZoneDST:{GMT:"-000",EDT:"-0500",CDT:"-0600",MDT:"-0700",PDT:"-0800"}};
+Date.getMonthNumberFromName=function(name){var n=Date.CultureInfo.monthNames,m=Date.CultureInfo.abbreviatedMonthNames,s=name.toLowerCase();for(var i=0;i<n.length;i++){if(n[i].toLowerCase()==s||m[i].toLowerCase()==s){return i;}}
+return-1;};Date.getDayNumberFromName=function(name){var n=Date.CultureInfo.dayNames,m=Date.CultureInfo.abbreviatedDayNames,o=Date.CultureInfo.shortestDayNames,s=name.toLowerCase();for(var i=0;i<n.length;i++){if(n[i].toLowerCase()==s||m[i].toLowerCase()==s){return i;}}
+return-1;};Date.isLeapYear=function(year){return(((year%4===0)&&(year%100!==0))||(year%400===0));};Date.getDaysInMonth=function(year,month){return[31,(Date.isLeapYear(year)?29:28),31,30,31,30,31,31,30,31,30,31][month];};Date.getTimezoneOffset=function(s,dst){return(dst||false)?Date.CultureInfo.abbreviatedTimeZoneDST[s.toUpperCase()]:Date.CultureInfo.abbreviatedTimeZoneStandard[s.toUpperCase()];};Date.getTimezoneAbbreviation=function(offset,dst){var n=(dst||false)?Date.CultureInfo.abbreviatedTimeZoneDST:Date.CultureInfo.abbreviatedTimeZoneStandard,p;for(p in n){if(n[p]===offset){return p;}}
+return null;};Date.prototype.clone=function(){return new Date(this.getTime());};Date.prototype.compareTo=function(date){if(isNaN(this)){throw new Error(this);}
+if(date instanceof Date&&!isNaN(date)){return(this>date)?1:(this<date)?-1:0;}else{throw new TypeError(date);}};Date.prototype.equals=function(date){return(this.compareTo(date)===0);};Date.prototype.between=function(start,end){var t=this.getTime();return t>=start.getTime()&&t<=end.getTime();};Date.prototype.addMilliseconds=function(value){this.setMilliseconds(this.getMilliseconds()+value);return this;};Date.prototype.addSeconds=function(value){return this.addMilliseconds(value*1000);};Date.prototype.addMinutes=function(value){return this.addMilliseconds(value*60000);};Date.prototype.addHours=function(value){return this.addMilliseconds(value*3600000);};Date.prototype.addDays=function(value){return this.addMilliseconds(value*86400000);};Date.prototype.addWeeks=function(value){return this.addMilliseconds(value*604800000);};Date.prototype.addMonths=function(value){var n=this.getDate();this.setDate(1);this.setMonth(this.getMonth()+value);this.setDate(Math.min(n,this.getDaysInMonth()));return this;};Date.prototype.addYears=function(value){return this.addMonths(value*12);};Date.prototype.add=function(config){if(typeof config=="number"){this._orient=config;return this;}
+var x=config;if(x.millisecond||x.milliseconds){this.addMilliseconds(x.millisecond||x.milliseconds);}
+if(x.second||x.seconds){this.addSeconds(x.second||x.seconds);}
+if(x.minute||x.minutes){this.addMinutes(x.minute||x.minutes);}
+if(x.hour||x.hours){this.addHours(x.hour||x.hours);}
+if(x.month||x.months){this.addMonths(x.month||x.months);}
+if(x.year||x.years){this.addYears(x.year||x.years);}
+if(x.day||x.days){this.addDays(x.day||x.days);}
+return this;};Date._validate=function(value,min,max,name){if(typeof value!="number"){throw new TypeError(value+" is not a Number.");}else if(value<min||value>max){throw new RangeError(value+" is not a valid value for "+name+".");}
+return true;};Date.validateMillisecond=function(n){return Date._validate(n,0,999,"milliseconds");};Date.validateSecond=function(n){return Date._validate(n,0,59,"seconds");};Date.validateMinute=function(n){return Date._validate(n,0,59,"minutes");};Date.validateHour=function(n){return Date._validate(n,0,23,"hours");};Date.validateDay=function(n,year,month){return Date._validate(n,1,Date.getDaysInMonth(year,month),"days");};Date.validateMonth=function(n){return Date._validate(n,0,11,"months");};Date.validateYear=function(n){return Date._validate(n,1,9999,"seconds");};Date.prototype.set=function(config){var x=config;if(!x.millisecond&&x.millisecond!==0){x.millisecond=-1;}
+if(!x.second&&x.second!==0){x.second=-1;}
+if(!x.minute&&x.minute!==0){x.minute=-1;}
+if(!x.hour&&x.hour!==0){x.hour=-1;}
+if(!x.day&&x.day!==0){x.day=-1;}
+if(!x.month&&x.month!==0){x.month=-1;}
+if(!x.year&&x.year!==0){x.year=-1;}
+if(x.millisecond!=-1&&Date.validateMillisecond(x.millisecond)){this.addMilliseconds(x.millisecond-this.getMilliseconds());}
+if(x.second!=-1&&Date.validateSecond(x.second)){this.addSeconds(x.second-this.getSeconds());}
+if(x.minute!=-1&&Date.validateMinute(x.minute)){this.addMinutes(x.minute-this.getMinutes());}
+if(x.hour!=-1&&Date.validateHour(x.hour)){this.addHours(x.hour-this.getHours());}
+if(x.month!==-1&&Date.validateMonth(x.month)){this.addMonths(x.month-this.getMonth());}
+if(x.year!=-1&&Date.validateYear(x.year)){this.addYears(x.year-this.getFullYear());}
+if(x.day!=-1&&Date.validateDay(x.day,this.getFullYear(),this.getMonth())){this.addDays(x.day-this.getDate());}
+if(x.timezone){this.setTimezone(x.timezone);}
+if(x.timezoneOffset){this.setTimezoneOffset(x.timezoneOffset);}
+return this;};Date.prototype.clearTime=function(){this.setHours(0);this.setMinutes(0);this.setSeconds(0);this.setMilliseconds(0);return this;};Date.prototype.isLeapYear=function(){var y=this.getFullYear();return(((y%4===0)&&(y%100!==0))||(y%400===0));};Date.prototype.isWeekday=function(){return!(this.is().sat()||this.is().sun());};Date.prototype.getDaysInMonth=function(){return Date.getDaysInMonth(this.getFullYear(),this.getMonth());};Date.prototype.moveToFirstDayOfMonth=function(){return this.set({day:1});};Date.prototype.moveToLastDayOfMonth=function(){return this.set({day:this.getDaysInMonth()});};Date.prototype.moveToDayOfWeek=function(day,orient){var diff=(day-this.getDay()+7*(orient||+1))%7;return this.addDays((diff===0)?diff+=7*(orient||+1):diff);};Date.prototype.moveToMonth=function(month,orient){var diff=(month-this.getMonth()+12*(orient||+1))%12;return this.addMonths((diff===0)?diff+=12*(orient||+1):diff);};Date.prototype.getDayOfYear=function(){return Math.floor((this-new Date(this.getFullYear(),0,1))/86400000);};Date.prototype.getWeekOfYear=function(firstDayOfWeek){var y=this.getFullYear(),m=this.getMonth(),d=this.getDate();var dow=firstDayOfWeek||Date.CultureInfo.firstDayOfWeek;var offset=7+1-new Date(y,0,1).getDay();if(offset==8){offset=1;}
+var daynum=((Date.UTC(y,m,d,0,0,0)-Date.UTC(y,0,1,0,0,0))/86400000)+1;var w=Math.floor((daynum-offset+7)/7);if(w===dow){y--;var prevOffset=7+1-new Date(y,0,1).getDay();if(prevOffset==2||prevOffset==8){w=53;}else{w=52;}}
+return w;};Date.prototype.isDST=function(){console.log('isDST');return this.toString().match(/(E|C|M|P)(S|D)T/)[2]=="D";};Date.prototype.getTimezone=function(){return Date.getTimezoneAbbreviation(this.getUTCOffset,this.isDST());};Date.prototype.setTimezoneOffset=function(s){var here=this.getTimezoneOffset(),there=Number(s)*-6/10;this.addMinutes(there-here);return this;};Date.prototype.setTimezone=function(s){return this.setTimezoneOffset(Date.getTimezoneOffset(s));};Date.prototype.getUTCOffset=function(){var n=this.getTimezoneOffset()*-10/6,r;if(n<0){r=(n-10000).toString();return r[0]+r.substr(2);}else{r=(n+10000).toString();return"+"+r.substr(1);}};Date.prototype.getDayName=function(abbrev){return abbrev?Date.CultureInfo.abbreviatedDayNames[this.getDay()]:Date.CultureInfo.dayNames[this.getDay()];};Date.prototype.getMonthName=function(abbrev){return abbrev?Date.CultureInfo.abbreviatedMonthNames[this.getMonth()]:Date.CultureInfo.monthNames[this.getMonth()];};Date.prototype._toString=Date.prototype.toString;Date.prototype.toString=function(format){var self=this;var p=function p(s){return(s.toString().length==1)?"0"+s:s;};return format?format.replace(/dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|zz?z?/g,function(format){switch(format){case"hh":return p(self.getHours()<13?self.getHours():(self.getHours()-12));case"h":return self.getHours()<13?self.getHours():(self.getHours()-12);case"HH":return p(self.getHours());case"H":return self.getHours();case"mm":return p(self.getMinutes());case"m":return self.getMinutes();case"ss":return p(self.getSeconds());case"s":return self.getSeconds();case"yyyy":return self.getFullYear();case"yy":return self.getFullYear().toString().substring(2,4);case"dddd":return self.getDayName();case"ddd":return self.getDayName(true);case"dd":return p(self.getDate());case"d":return self.getDate().toString();case"MMMM":return self.getMonthName();case"MMM":return self.getMonthName(true);case"MM":return p((self.getMonth()+1));case"M":return self.getMonth()+1;case"t":return self.getHours()<12?Date.CultureInfo.amDesignator.substring(0,1):Date.CultureInfo.pmDesignator.substring(0,1);case"tt":return self.getHours()<12?Date.CultureInfo.amDesignator:Date.CultureInfo.pmDesignator;case"zzz":case"zz":case"z":return"";}}):this._toString();};
+Date.now=function(){return new Date();};Date.today=function(){return Date.now().clearTime();};Date.prototype._orient=+1;Date.prototype.next=function(){this._orient=+1;return this;};Date.prototype.last=Date.prototype.prev=Date.prototype.previous=function(){this._orient=-1;return this;};Date.prototype._is=false;Date.prototype.is=function(){this._is=true;return this;};Number.prototype._dateElement="day";Number.prototype.fromNow=function(){var c={};c[this._dateElement]=this;return Date.now().add(c);};Number.prototype.ago=function(){var c={};c[this._dateElement]=this*-1;return Date.now().add(c);};(function(){var $D=Date.prototype,$N=Number.prototype;var dx=("sunday monday tuesday wednesday thursday friday saturday").split(/\s/),mx=("january february march april may june july august september october november december").split(/\s/),px=("Millisecond Second Minute Hour Day Week Month Year").split(/\s/),de;var df=function(n){return function(){if(this._is){this._is=false;return this.getDay()==n;}
+return this.moveToDayOfWeek(n,this._orient);};};for(var i=0;i<dx.length;i++){$D[dx[i]]=$D[dx[i].substring(0,3)]=df(i);}
+var mf=function(n){return function(){if(this._is){this._is=false;return this.getMonth()===n;}
+return this.moveToMonth(n,this._orient);};};for(var j=0;j<mx.length;j++){$D[mx[j]]=$D[mx[j].substring(0,3)]=mf(j);}
+var ef=function(j){return function(){if(j.substring(j.length-1)!="s"){j+="s";}
+return this["add"+j](this._orient);};};var nf=function(n){return function(){this._dateElement=n;return this;};};for(var k=0;k<px.length;k++){de=px[k].toLowerCase();$D[de]=$D[de+"s"]=ef(px[k]);$N[de]=$N[de+"s"]=nf(de);}}());Date.prototype.toJSONString=function(){return this.toString("yyyy-MM-ddThh:mm:ssZ");};Date.prototype.toShortDateString=function(){return this.toString(Date.CultureInfo.formatPatterns.shortDatePattern);};Date.prototype.toLongDateString=function(){return this.toString(Date.CultureInfo.formatPatterns.longDatePattern);};Date.prototype.toShortTimeString=function(){return this.toString(Date.CultureInfo.formatPatterns.shortTimePattern);};Date.prototype.toLongTimeString=function(){return this.toString(Date.CultureInfo.formatPatterns.longTimePattern);};Date.prototype.getOrdinal=function(){switch(this.getDate()){case 1:case 21:case 31:return"st";case 2:case 22:return"nd";case 3:case 23:return"rd";default:return"th";}};
+(function(){Date.Parsing={Exception:function(s){this.message="Parse error at '"+s.substring(0,10)+" ...'";}};var $P=Date.Parsing;var _=$P.Operators={rtoken:function(r){return function(s){var mx=s.match(r);if(mx){return([mx[0],s.substring(mx[0].length)]);}else{throw new $P.Exception(s);}};},token:function(s){return function(s){return _.rtoken(new RegExp("^\s*"+s+"\s*"))(s);};},stoken:function(s){return _.rtoken(new RegExp("^"+s));},until:function(p){return function(s){var qx=[],rx=null;while(s.length){try{rx=p.call(this,s);}catch(e){qx.push(rx[0]);s=rx[1];continue;}
+break;}
+return[qx,s];};},many:function(p){return function(s){var rx=[],r=null;while(s.length){try{r=p.call(this,s);}catch(e){return[rx,s];}
+rx.push(r[0]);s=r[1];}
+return[rx,s];};},optional:function(p){return function(s){var r=null;try{r=p.call(this,s);}catch(e){return[null,s];}
+return[r[0],r[1]];};},not:function(p){return function(s){try{p.call(this,s);}catch(e){return[null,s];}
+throw new $P.Exception(s);};},ignore:function(p){return p?function(s){var r=null;r=p.call(this,s);return[null,r[1]];}:null;},product:function(){var px=arguments[0],qx=Array.prototype.slice.call(arguments,1),rx=[];for(var i=0;i<px.length;i++){rx.push(_.each(px[i],qx));}
+return rx;},cache:function(rule){var cache={},r=null;return function(s){try{r=cache[s]=(cache[s]||rule.call(this,s));}catch(e){r=cache[s]=e;}
+if(r instanceof $P.Exception){throw r;}else{return r;}};},any:function(){var px=arguments;return function(s){var r=null;for(var i=0;i<px.length;i++){if(px[i]==null){continue;}
+try{r=(px[i].call(this,s));}catch(e){r=null;}
+if(r){return r;}}
+throw new $P.Exception(s);};},each:function(){var px=arguments;return function(s){var rx=[],r=null;for(var i=0;i<px.length;i++){if(px[i]==null){continue;}
+try{r=(px[i].call(this,s));}catch(e){throw new $P.Exception(s);}
+rx.push(r[0]);s=r[1];}
+return[rx,s];};},all:function(){var px=arguments,_=_;return _.each(_.optional(px));},sequence:function(px,d,c){d=d||_.rtoken(/^\s*/);c=c||null;if(px.length==1){return px[0];}
+return function(s){var r=null,q=null;var rx=[];for(var i=0;i<px.length;i++){try{r=px[i].call(this,s);}catch(e){break;}
+rx.push(r[0]);try{q=d.call(this,r[1]);}catch(ex){q=null;break;}
+s=q[1];}
+if(!r){throw new $P.Exception(s);}
+if(q){throw new $P.Exception(q[1]);}
+if(c){try{r=c.call(this,r[1]);}catch(ey){throw new $P.Exception(r[1]);}}
+return[rx,(r?r[1]:s)];};},between:function(d1,p,d2){d2=d2||d1;var _fn=_.each(_.ignore(d1),p,_.ignore(d2));return function(s){var rx=_fn.call(this,s);return[[rx[0][0],r[0][2]],rx[1]];};},list:function(p,d,c){d=d||_.rtoken(/^\s*/);c=c||null;return(p instanceof Array?_.each(_.product(p.slice(0,-1),_.ignore(d)),p.slice(-1),_.ignore(c)):_.each(_.many(_.each(p,_.ignore(d))),px,_.ignore(c)));},set:function(px,d,c){d=d||_.rtoken(/^\s*/);c=c||null;return function(s){var r=null,p=null,q=null,rx=null,best=[[],s],last=false;for(var i=0;i<px.length;i++){q=null;p=null;r=null;last=(px.length==1);try{r=px[i].call(this,s);}catch(e){continue;}
+rx=[[r[0]],r[1]];if(r[1].length>0&&!last){try{q=d.call(this,r[1]);}catch(ex){last=true;}}else{last=true;}
+if(!last&&q[1].length===0){last=true;}
+if(!last){var qx=[];for(var j=0;j<px.length;j++){if(i!=j){qx.push(px[j]);}}
+p=_.set(qx,d).call(this,q[1]);if(p[0].length>0){rx[0]=rx[0].concat(p[0]);rx[1]=p[1];}}
+if(rx[1].length<best[1].length){best=rx;}
+if(best[1].length===0){break;}}
+if(best[0].length===0){return best;}
+if(c){try{q=c.call(this,best[1]);}catch(ey){throw new $P.Exception(best[1]);}
+best[1]=q[1];}
+return best;};},forward:function(gr,fname){return function(s){return gr[fname].call(this,s);};},replace:function(rule,repl){return function(s){var r=rule.call(this,s);return[repl,r[1]];};},process:function(rule,fn){return function(s){var r=rule.call(this,s);return[fn.call(this,r[0]),r[1]];};},min:function(min,rule){return function(s){var rx=rule.call(this,s);if(rx[0].length<min){throw new $P.Exception(s);}
+return rx;};}};var _generator=function(op){return function(){var args=null,rx=[];if(arguments.length>1){args=Array.prototype.slice.call(arguments);}else if(arguments[0]instanceof Array){args=arguments[0];}
+if(args){for(var i=0,px=args.shift();i<px.length;i++){args.unshift(px[i]);rx.push(op.apply(null,args));args.shift();return rx;}}else{return op.apply(null,arguments);}};};var gx="optional not ignore cache".split(/\s/);for(var i=0;i<gx.length;i++){_[gx[i]]=_generator(_[gx[i]]);}
+var _vector=function(op){return function(){if(arguments[0]instanceof Array){return op.apply(null,arguments[0]);}else{return op.apply(null,arguments);}};};var vx="each any all".split(/\s/);for(var j=0;j<vx.length;j++){_[vx[j]]=_vector(_[vx[j]]);}}());(function(){var flattenAndCompact=function(ax){var rx=[];for(var i=0;i<ax.length;i++){if(ax[i]instanceof Array){rx=rx.concat(flattenAndCompact(ax[i]));}else{if(ax[i]){rx.push(ax[i]);}}}
+return rx;};Date.Grammar={};Date.Translator={hour:function(s){return function(){this.hour=Number(s);};},minute:function(s){return function(){this.minute=Number(s);};},second:function(s){return function(){this.second=Number(s);};},meridian:function(s){return function(){this.meridian=s.slice(0,1).toLowerCase();};},timezone:function(s){return function(){var n=s.replace(/[^\d\+\-]/g,"");if(n.length){this.timezoneOffset=Number(n);}else{this.timezone=s.toLowerCase();}};},day:function(x){var s=x[0];return function(){this.day=Number(s.match(/\d+/)[0]);};},month:function(s){return function(){this.month=((s.length==3)?Date.getMonthNumberFromName(s):(Number(s)-1));};},year:function(s){return function(){var n=Number(s);this.year=((s.length>2)?n:(n+(((n+2000)<Date.CultureInfo.twoDigitYearMax)?2000:1900)));};},rday:function(s){return function(){switch(s){case"yesterday":this.days=-1;break;case"tomorrow":this.days=1;break;case"today":this.days=0;break;case"now":this.days=0;this.now=true;break;}};},finishExact:function(x){x=(x instanceof Array)?x:[x];var now=new Date();this.year=now.getFullYear();this.month=now.getMonth();this.day=1;this.hour=0;this.minute=0;this.second=0;for(var i=0;i<x.length;i++){if(x[i]){x[i].call(this);}}
+this.hour=(this.meridian=="p"&&this.hour<13)?this.hour+12:this.hour;if(this.day>Date.getDaysInMonth(this.year,this.month)){throw new RangeError(this.day+" is not a valid value for days.");}
+var r=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second);if(this.timezone){r.set({timezone:this.timezone});}else if(this.timezoneOffset){r.set({timezoneOffset:this.timezoneOffset});}
+return r;},finish:function(x){x=(x instanceof Array)?flattenAndCompact(x):[x];if(x.length===0){return null;}
+for(var i=0;i<x.length;i++){if(typeof x[i]=="function"){x[i].call(this);}}
+if(this.now){return new Date();}
+var today=Date.today();var method=null;var expression=!!(this.days!=null||this.orient||this.operator);if(expression){var gap,mod,orient;orient=((this.orient=="past"||this.operator=="subtract")?-1:1);if(this.weekday){this.unit="day";gap=(Date.getDayNumberFromName(this.weekday)-today.getDay());mod=7;this.days=gap?((gap+(orient*mod))%mod):(orient*mod);}
+if(this.month){this.unit="month";gap=(this.month-today.getMonth());mod=12;this.months=gap?((gap+(orient*mod))%mod):(orient*mod);this.month=null;}
+if(!this.unit){this.unit="day";}
+if(this[this.unit+"s"]==null||this.operator!=null){if(!this.value){this.value=1;}
+if(this.unit=="week"){this.unit="day";this.value=this.value*7;}
+this[this.unit+"s"]=this.value*orient;}
+return today.add(this);}else{if(this.meridian&&this.hour){this.hour=(this.hour<13&&this.meridian=="p")?this.hour+12:this.hour;}
+if(this.weekday&&!this.day){this.day=(today.addDays((Date.getDayNumberFromName(this.weekday)-today.getDay()))).getDate();}
+if(this.month&&!this.day){this.day=1;}
+return today.set(this);}}};var _=Date.Parsing.Operators,g=Date.Grammar,t=Date.Translator,_fn;g.datePartDelimiter=_.rtoken(/^([\s\-\.\,\/\x27]+)/);g.timePartDelimiter=_.stoken(":");g.whiteSpace=_.rtoken(/^\s*/);g.generalDelimiter=_.rtoken(/^(([\s\,]|at|on)+)/);var _C={};g.ctoken=function(keys){var fn=_C[keys];if(!fn){var c=Date.CultureInfo.regexPatterns;var kx=keys.split(/\s+/),px=[];for(var i=0;i<kx.length;i++){px.push(_.replace(_.rtoken(c[kx[i]]),kx[i]));}
+fn=_C[keys]=_.any.apply(null,px);}
+return fn;};g.ctoken2=function(key){return _.rtoken(Date.CultureInfo.regexPatterns[key]);};g.h=_.cache(_.process(_.rtoken(/^(0[0-9]|1[0-2]|[1-9])/),t.hour));g.hh=_.cache(_.process(_.rtoken(/^(0[0-9]|1[0-2])/),t.hour));g.H=_.cache(_.process(_.rtoken(/^([0-1][0-9]|2[0-3]|[0-9])/),t.hour));g.HH=_.cache(_.process(_.rtoken(/^([0-1][0-9]|2[0-3])/),t.hour));g.m=_.cache(_.process(_.rtoken(/^([0-5][0-9]|[0-9])/),t.minute));g.mm=_.cache(_.process(_.rtoken(/^[0-5][0-9]/),t.minute));g.s=_.cache(_.process(_.rtoken(/^([0-5][0-9]|[0-9])/),t.second));g.ss=_.cache(_.process(_.rtoken(/^[0-5][0-9]/),t.second));g.hms=_.cache(_.sequence([g.H,g.mm,g.ss],g.timePartDelimiter));g.t=_.cache(_.process(g.ctoken2("shortMeridian"),t.meridian));g.tt=_.cache(_.process(g.ctoken2("longMeridian"),t.meridian));g.z=_.cache(_.process(_.rtoken(/^(\+|\-)?\s*\d\d\d\d?/),t.timezone));g.zz=_.cache(_.process(_.rtoken(/^(\+|\-)\s*\d\d\d\d/),t.timezone));g.zzz=_.cache(_.process(g.ctoken2("timezone"),t.timezone));g.timeSuffix=_.each(_.ignore(g.whiteSpace),_.set([g.tt,g.zzz]));g.time=_.each(_.optional(_.ignore(_.stoken("T"))),g.hms,g.timeSuffix);g.d=_.cache(_.process(_.each(_.rtoken(/^([0-2]\d|3[0-1]|\d)/),_.optional(g.ctoken2("ordinalSuffix"))),t.day));g.dd=_.cache(_.process(_.each(_.rtoken(/^([0-2]\d|3[0-1])/),_.optional(g.ctoken2("ordinalSuffix"))),t.day));g.ddd=g.dddd=_.cache(_.process(g.ctoken("sun mon tue wed thu fri sat"),function(s){return function(){this.weekday=s;};}));g.M=_.cache(_.process(_.rtoken(/^(1[0-2]|0\d|\d)/),t.month));g.MM=_.cache(_.process(_.rtoken(/^(1[0-2]|0\d)/),t.month));g.MMM=g.MMMM=_.cache(_.process(g.ctoken("jan feb mar apr may jun jul aug sep oct nov dec"),t.month));g.y=_.cache(_.process(_.rtoken(/^(\d\d?)/),t.year));g.yy=_.cache(_.process(_.rtoken(/^(\d\d)/),t.year));g.yyy=_.cache(_.process(_.rtoken(/^(\d\d?\d?\d?)/),t.year));g.yyyy=_.cache(_.process(_.rtoken(/^(\d\d\d\d)/),t.year));_fn=function(){return _.each(_.any.apply(null,arguments),_.not(g.ctoken2("timeContext")));};g.day=_fn(g.d,g.dd);g.month=_fn(g.M,g.MMM);g.year=_fn(g.yyyy,g.yy);g.orientation=_.process(g.ctoken("past future"),function(s){return function(){this.orient=s;};});g.operator=_.process(g.ctoken("add subtract"),function(s){return function(){this.operator=s;};});g.rday=_.process(g.ctoken("yesterday tomorrow today now"),t.rday);g.unit=_.process(g.ctoken("minute hour day week month year"),function(s){return function(){this.unit=s;};});g.value=_.process(_.rtoken(/^\d\d?(st|nd|rd|th)?/),function(s){return function(){this.value=s.replace(/\D/g,"");};});g.expression=_.set([g.rday,g.operator,g.value,g.unit,g.orientation,g.ddd,g.MMM]);_fn=function(){return _.set(arguments,g.datePartDelimiter);};g.mdy=_fn(g.ddd,g.month,g.day,g.year);g.ymd=_fn(g.ddd,g.year,g.month,g.day);g.dmy=_fn(g.ddd,g.day,g.month,g.year);g.date=function(s){return((g[Date.CultureInfo.dateElementOrder]||g.mdy).call(this,s));};g.format=_.process(_.many(_.any(_.process(_.rtoken(/^(dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|zz?z?)/),function(fmt){if(g[fmt]){return g[fmt];}else{throw Date.Parsing.Exception(fmt);}}),_.process(_.rtoken(/^[^dMyhHmstz]+/),function(s){return _.ignore(_.stoken(s));}))),function(rules){return _.process(_.each.apply(null,rules),t.finishExact);});var _F={};var _get=function(f){return _F[f]=(_F[f]||g.format(f)[0]);};g.formats=function(fx){if(fx instanceof Array){var rx=[];for(var i=0;i<fx.length;i++){rx.push(_get(fx[i]));}
+return _.any.apply(null,rx);}else{return _get(fx);}};g._formats=g.formats(["yyyy-MM-ddTHH:mm:ss","ddd, MMM dd, yyyy H:mm:ss tt","ddd MMM d yyyy HH:mm:ss zzz","d"]);g._start=_.process(_.set([g.date,g.time,g.expression],g.generalDelimiter,g.whiteSpace),t.finish);g.start=function(s){try{var r=g._formats.call({},s);if(r[1].length===0){return r;}}catch(e){}
+return g._start.call({},s);};}());Date._parse=Date.parse;Date.parse=function(s){var r=null;if(!s){return null;}
+try{r=Date.Grammar.start.call({},s);}catch(e){return null;}
+return((r[1].length===0)?r[0]:null);};Date.getParseFunction=function(fx){var fn=Date.Grammar.formats(fx);return function(s){var r=null;try{r=fn.call({},s);}catch(e){return null;}
+return((r[1].length===0)?r[0]:null);};};Date.parseExact=function(s,fx){return Date.getParseFunction(fx)(s);};
Index: trunk/prototype/plugins/datejs/parser-debug.js
===================================================================
--- trunk/prototype/plugins/datejs/parser-debug.js	(revision 5341)
+++ trunk/prototype/plugins/datejs/parser-debug.js	(revision 5341)
@@ -0,0 +1,1009 @@
+/**
+ * Version: 1.0 Alpha-1 
+ * Build Date: 12-Nov-2007
+ * Copyright (c) 2006-2007, Coolite Inc. (http://www.coolite.com/). All rights reserved.
+ * License: Licensed under The MIT License. See license.txt and http://www.datejs.com/license/. 
+ * Website: http://www.datejs.com/ or http://www.coolite.com/datejs/
+ */
+ 
+(function () {
+    Date.Parsing = {
+        Exception: function (s) { 
+            this.message = "Parse error at '" + s.substring(0, 10) + " ...'"; 
+        }
+    };
+    
+    var $P = Date.Parsing; 
+    var _ = $P.Operators = {
+        //
+        // Tokenizers
+        //
+        rtoken: function (r) { // regex token
+            return function (s) {
+                var mx = s.match(r);
+                if (mx) { 
+                    return ([ mx[0], s.substring(mx[0].length) ]); 
+                } else { 
+                    throw new $P.Exception(s); 
+                }
+            };
+        },
+        token: function (s) { // whitespace-eating token
+            return function (s) {
+                return _.rtoken(new RegExp("^\s*" + s + "\s*"))(s);
+                // Removed .strip()
+                // return _.rtoken(new RegExp("^\s*" + s + "\s*"))(s).strip();
+            };
+        },
+        stoken: function (s) { // string token
+            return _.rtoken(new RegExp("^" + s)); 
+        },
+
+        //
+        // Atomic Operators
+        // 
+
+        until: function (p) {
+            return function (s) {
+                var qx = [], rx = null;
+                while (s.length) { 
+                    try { 
+                        rx = p.call(this, s); 
+                    } catch (e) { 
+                        qx.push(rx[0]); 
+                        s = rx[1]; 
+                        continue; 
+                    }
+                    break;
+                }
+                return [ qx, s ];
+            };
+        },
+        many: function (p) {
+            return function (s) {
+                var rx = [], r = null; 
+                while (s.length) { 
+                    try { 
+                        r = p.call(this, s); 
+                    } catch (e) { 
+                        return [ rx, s ]; 
+                    }
+                    rx.push(r[0]); 
+                    s = r[1];
+                }
+                return [ rx, s ];
+            };
+        },
+
+        // generator operators -- see below
+        optional: function (p) {
+            return function (s) {
+                var r = null; 
+                try { 
+                    r = p.call(this, s); 
+                } catch (e) { 
+                    return [ null, s ]; 
+                }
+                return [ r[0], r[1] ];
+            };
+        },
+        not: function (p) {
+            return function (s) {
+                try { 
+                    p.call(this, s); 
+                } catch (e) { 
+                    return [null, s]; 
+                }
+                throw new $P.Exception(s);
+            };
+        },
+        ignore: function (p) {
+            return p ? 
+            function (s) { 
+                var r = null; 
+                r = p.call(this, s); 
+                return [null, r[1]]; 
+            } : null;
+        },
+        product: function () {
+            var px = arguments[0], 
+            qx = Array.prototype.slice.call(arguments, 1), rx = [];
+            for (var i = 0 ; i < px.length ; i++) {
+                rx.push(_.each(px[i], qx));
+            }
+            return rx;
+        },
+        cache: function (rule) { 
+            var cache = {}, r = null; 
+            return function (s) {
+                try { 
+                    r = cache[s] = (cache[s] || rule.call(this, s)); 
+                } catch (e) { 
+                    r = cache[s] = e; 
+                }
+                if (r instanceof $P.Exception) { 
+                    throw r; 
+                } else { 
+                    return r; 
+                }
+            };
+        },
+    	  
+        // vector operators -- see below
+        any: function () {
+            var px = arguments;
+            return function (s) { 
+                var r = null;
+                for (var i = 0; i < px.length; i++) { 
+                    if (px[i] == null) { 
+                        continue; 
+                    }
+                    try { 
+                        r = (px[i].call(this, s)); 
+                    } catch (e) { 
+                        r = null; 
+                    }
+                    if (r) { 
+                        return r; 
+                    }
+                } 
+                throw new $P.Exception(s);
+            };
+        },
+        each: function () { 
+            var px = arguments;
+            return function (s) { 
+                var rx = [], r = null;
+                for (var i = 0; i < px.length ; i++) { 
+                    if (px[i] == null) { 
+                        continue; 
+                    }
+                    try { 
+                        r = (px[i].call(this, s)); 
+                    } catch (e) { 
+                        throw new $P.Exception(s); 
+                    }
+                    rx.push(r[0]); 
+                    s = r[1];
+                }
+                return [ rx, s]; 
+            };
+        },
+        all: function () { 
+            var px = arguments, _ = _; 
+            return _.each(_.optional(px)); 
+        },
+
+        // delimited operators
+        sequence: function (px, d, c) {
+            d = d || _.rtoken(/^\s*/);  
+            c = c || null;
+            
+            if (px.length == 1) { 
+                return px[0]; 
+            }
+            return function (s) {
+                var r = null, q = null;
+                var rx = []; 
+                for (var i = 0; i < px.length ; i++) {
+                    try { 
+                        r = px[i].call(this, s); 
+                    } catch (e) { 
+                        break; 
+                    }
+                    rx.push(r[0]);
+                    try { 
+                        q = d.call(this, r[1]); 
+                    } catch (ex) { 
+                        q = null; 
+                        break; 
+                    }
+                    s = q[1];
+                }
+                if (!r) { 
+                    throw new $P.Exception(s); 
+                }
+                if (q) { 
+                    throw new $P.Exception(q[1]); 
+                }
+                if (c) {
+                    try { 
+                        r = c.call(this, r[1]);
+                    } catch (ey) { 
+                        throw new $P.Exception(r[1]); 
+                    }
+                }
+                return [ rx, (r?r[1]:s) ];
+            };
+        },
+    		
+	    //
+	    // Composite Operators
+	    //
+    		
+        between: function (d1, p, d2) { 
+            d2 = d2 || d1; 
+            var _fn = _.each(_.ignore(d1), p, _.ignore(d2));
+            return function (s) { 
+                var rx = _fn.call(this, s); 
+                return [[rx[0][0], r[0][2]], rx[1]]; 
+            };
+        },
+        list: function (p, d, c) {
+            d = d || _.rtoken(/^\s*/);  
+            c = c || null;
+            return (p instanceof Array ?
+                _.each(_.product(p.slice(0, -1), _.ignore(d)), p.slice(-1), _.ignore(c)) :
+                _.each(_.many(_.each(p, _.ignore(d))), px, _.ignore(c)));
+        },
+        set: function (px, d, c) {
+            d = d || _.rtoken(/^\s*/); 
+            c = c || null;
+            return function (s) {
+                // r is the current match, best the current 'best' match
+                // which means it parsed the most amount of input
+                var r = null, p = null, q = null, rx = null, best = [[], s], last = false;
+
+                // go through the rules in the given set
+                for (var i = 0; i < px.length ; i++) {
+
+                    // last is a flag indicating whether this must be the last element
+                    // if there is only 1 element, then it MUST be the last one
+                    q = null; 
+                    p = null; 
+                    r = null; 
+                    last = (px.length == 1); 
+
+                    // first, we try simply to match the current pattern
+                    // if not, try the next pattern
+                    try { 
+                        r = px[i].call(this, s);
+                    } catch (e) { 
+                        continue; 
+                    }
+
+                    // since we are matching against a set of elements, the first
+                    // thing to do is to add r[0] to matched elements
+                    rx = [[r[0]], r[1]];
+
+                    // if we matched and there is still input to parse and 
+                    // we don't already know this is the last element,
+                    // we're going to next check for the delimiter ...
+                    // if there's none, or if there's no input left to parse
+                    // than this must be the last element after all ...
+                    if (r[1].length > 0 && ! last) {
+                        try { 
+                            q = d.call(this, r[1]); 
+                        } catch (ex) { 
+                            last = true; 
+                        }
+                    } else { 
+                        last = true; 
+                    }
+
+				    // if we parsed the delimiter and now there's no more input,
+				    // that means we shouldn't have parsed the delimiter at all
+				    // so don't update r and mark this as the last element ...
+                    if (!last && q[1].length === 0) { 
+                        last = true; 
+                    }
+
+
+				    // so, if this isn't the last element, we're going to see if
+				    // we can get any more matches from the remaining (unmatched)
+				    // elements ...
+                    if (!last) {
+
+                        // build a list of the remaining rules we can match against,
+                        // i.e., all but the one we just matched against
+                        var qx = []; 
+                        for (var j = 0; j < px.length ; j++) { 
+                            if (i != j) { 
+                                qx.push(px[j]); 
+                            }
+                        }
+
+                        // now invoke recursively set with the remaining input
+                        // note that we don't include the closing delimiter ...
+                        // we'll check for that ourselves at the end
+                        p = _.set(qx, d).call(this, q[1]);
+
+                        // if we got a non-empty set as a result ...
+                        // (otw rx already contains everything we want to match)
+                        if (p[0].length > 0) {
+                            // update current result, which is stored in rx ...
+                            // basically, pick up the remaining text from p[1]
+                            // and concat the result from p[0] so that we don't
+                            // get endless nesting ...
+                            rx[0] = rx[0].concat(p[0]); 
+                            rx[1] = p[1]; 
+                        }
+                    }
+
+				    // at this point, rx either contains the last matched element
+				    // or the entire matched set that starts with this element.
+
+				    // now we just check to see if this variation is better than
+				    // our best so far, in terms of how much of the input is parsed
+                    if (rx[1].length < best[1].length) { 
+                        best = rx; 
+                    }
+
+				    // if we've parsed all the input, then we're finished
+                    if (best[1].length === 0) { 
+                        break; 
+                    }
+                }
+
+			    // so now we've either gone through all the patterns trying them
+			    // as the initial match; or we found one that parsed the entire
+			    // input string ...
+
+			    // if best has no matches, just return empty set ...
+                if (best[0].length === 0) { 
+                    return best; 
+                }
+
+			    // if a closing delimiter is provided, then we have to check it also
+                if (c) {
+                    // we try this even if there is no remaining input because the pattern
+                    // may well be optional or match empty input ...
+                    try { 
+                        q = c.call(this, best[1]); 
+                    } catch (ey) { 
+                        throw new $P.Exception(best[1]); 
+                    }
+
+                    // it parsed ... be sure to update the best match remaining input
+                    best[1] = q[1];
+                }
+
+			    // if we're here, either there was no closing delimiter or we parsed it
+			    // so now we have the best match; just return it!
+                return best;
+            };
+        },
+        forward: function (gr, fname) {
+            return function (s) { 
+                return gr[fname].call(this, s); 
+            };
+        },
+
+        //
+        // Translation Operators
+        //
+        replace: function (rule, repl) {
+            return function (s) { 
+                var r = rule.call(this, s); 
+                return [repl, r[1]]; 
+            };
+        },
+        process: function (rule, fn) {
+            return function (s) {  
+                var r = rule.call(this, s); 
+                return [fn.call(this, r[0]), r[1]]; 
+            };
+        },
+        min: function (min, rule) {
+            return function (s) {
+                var rx = rule.call(this, s); 
+                if (rx[0].length < min) { 
+                    throw new $P.Exception(s); 
+                }
+                return rx;
+            };
+        }
+    };
+	
+
+	// Generator Operators And Vector Operators
+
+	// Generators are operators that have a signature of F(R) => R,
+	// taking a given rule and returning another rule, such as 
+	// ignore, which parses a given rule and throws away the result.
+
+	// Vector operators are those that have a signature of F(R1,R2,...) => R,
+	// take a list of rules and returning a new rule, such as each.
+
+	// Generator operators are converted (via the following _generator
+	// function) into functions that can also take a list or array of rules
+	// and return an array of new rules as though the function had been
+	// called on each rule in turn (which is what actually happens).
+
+	// This allows generators to be used with vector operators more easily.
+	// Example:
+	// each(ignore(foo, bar)) instead of each(ignore(foo), ignore(bar))
+
+	// This also turns generators into vector operators, which allows
+	// constructs like:
+	// not(cache(foo, bar))
+	
+    var _generator = function (op) {
+        return function () {
+            var args = null, rx = [];
+            if (arguments.length > 1) {
+                args = Array.prototype.slice.call(arguments);
+            } else if (arguments[0] instanceof Array) {
+                args = arguments[0];
+            }
+            if (args) { 
+                for (var i = 0, px = args.shift() ; i < px.length ; i++) {
+                    args.unshift(px[i]); 
+                    rx.push(op.apply(null, args)); 
+                    args.shift();
+                    return rx;
+                } 
+            } else { 
+                return op.apply(null, arguments); 
+            }
+        };
+    };
+    
+    var gx = "optional not ignore cache".split(/\s/);
+    
+    for (var i = 0 ; i < gx.length ; i++) { 
+        _[gx[i]] = _generator(_[gx[i]]); 
+    }
+
+    var _vector = function (op) {
+        return function () {
+            if (arguments[0] instanceof Array) { 
+                return op.apply(null, arguments[0]); 
+            } else { 
+                return op.apply(null, arguments); 
+            }
+        };
+    };
+    
+    var vx = "each any all".split(/\s/);
+    
+    for (var j = 0 ; j < vx.length ; j++) { 
+        _[vx[j]] = _vector(_[vx[j]]); 
+    }
+	
+}());
+
+(function () {
+    var flattenAndCompact = function (ax) { 
+        var rx = []; 
+        for (var i = 0; i < ax.length; i++) {
+            if (ax[i] instanceof Array) {
+                rx = rx.concat(flattenAndCompact(ax[i]));
+            } else { 
+                if (ax[i]) { 
+                    rx.push(ax[i]); 
+                }
+            }
+        }
+        return rx;
+    };
+    
+    Date.Grammar = {};
+	
+    Date.Translator = {
+        hour: function (s) { 
+            return function () { 
+                this.hour = Number(s); 
+            }; 
+        },
+        minute: function (s) { 
+            return function () { 
+                this.minute = Number(s); 
+            }; 
+        },
+        second: function (s) { 
+            return function () { 
+                this.second = Number(s); 
+            }; 
+        },
+        meridian: function (s) { 
+            return function () { 
+                this.meridian = s.slice(0, 1).toLowerCase(); 
+            }; 
+        },
+        timezone: function (s) {
+            return function () {
+                var n = s.replace(/[^\d\+\-]/g, "");
+                if (n.length) { 
+                    this.timezoneOffset = Number(n); 
+                } else { 
+                    this.timezone = s.toLowerCase(); 
+                }
+            };
+        },
+        day: function (x) { 
+            var s = x[0];
+            return function () { 
+                this.day = Number(s.match(/\d+/)[0]); 
+            };
+        }, 
+        month: function (s) {
+            return function () {
+                this.month = ((s.length == 3) ? Date.getMonthNumberFromName(s) : (Number(s) - 1));
+            };
+        },
+        year: function (s) {
+            return function () {
+                var n = Number(s);
+                this.year = ((s.length > 2) ? n : 
+                    (n + (((n + 2000) < Date.CultureInfo.twoDigitYearMax) ? 2000 : 1900))); 
+            };
+        },
+        rday: function (s) { 
+            return function () {
+                switch (s) {
+                case "yesterday": 
+                    this.days = -1;
+                    break;
+                case "tomorrow":  
+                    this.days = 1;
+                    break;
+                case "today": 
+                    this.days = 0;
+                    break;
+                case "now": 
+                    this.days = 0; 
+                    this.now = true; 
+                    break;
+                }
+            };
+        },
+        finishExact: function (x) {  
+            x = (x instanceof Array) ? x : [ x ]; 
+	        
+            var now = new Date();
+
+            this.year = now.getFullYear(); 
+            this.month = now.getMonth(); 
+            this.day = 1; 
+
+            this.hour = 0; 
+            this.minute = 0; 
+            this.second = 0;
+
+            for (var i = 0 ; i < x.length ; i++) { 
+                if (x[i]) { 
+                    x[i].call(this); 
+                }
+            } 
+
+            this.hour = (this.meridian == "p" && this.hour < 13) ? this.hour + 12 : this.hour;
+
+            if (this.day > Date.getDaysInMonth(this.year, this.month)) {
+                throw new RangeError(this.day + " is not a valid value for days.");
+            }
+
+            var r = new Date(this.year, this.month, this.day, this.hour, this.minute, this.second);
+
+            if (this.timezone) { 
+                r.set({ timezone: this.timezone }); 
+            } else if (this.timezoneOffset) { 
+                r.set({ timezoneOffset: this.timezoneOffset }); 
+            }
+            return r;
+        },			
+        finish: function (x) {
+            x = (x instanceof Array) ? flattenAndCompact(x) : [ x ];
+
+            if (x.length === 0) { 
+                return null; 
+            }
+
+            for (var i = 0 ; i < x.length ; i++) { 
+                if (typeof x[i] == "function") {
+                    x[i].call(this); 
+                }
+            }
+
+            if (this.now) { 
+                return new Date(); 
+            }
+
+            var today = Date.today(); 
+            var method = null;
+
+            var expression = !!(this.days != null || this.orient || this.operator);
+            if (expression) {
+                var gap, mod, orient;
+                orient = ((this.orient == "past" || this.operator == "subtract") ? -1 : 1);
+
+                if (this.weekday) {
+                    this.unit = "day";
+                    gap = (Date.getDayNumberFromName(this.weekday) - today.getDay());
+                    mod = 7;
+                    this.days = gap ? ((gap + (orient * mod)) % mod) : (orient * mod);
+                }
+                if (this.month) {
+                    this.unit = "month";
+                    gap = (this.month - today.getMonth());
+                    mod = 12;
+                    this.months = gap ? ((gap + (orient * mod)) % mod) : (orient * mod);
+                    this.month = null;
+                }
+                if (!this.unit) { 
+                    this.unit = "day"; 
+                }
+                if (this[this.unit + "s"] == null || this.operator != null) {
+                    if (!this.value) { 
+                        this.value = 1;
+                    }
+
+                    if (this.unit == "week") { 
+                        this.unit = "day"; 
+                        this.value = this.value * 7; 
+                    }
+
+                    this[this.unit + "s"] = this.value * orient;
+                }
+                return today.add(this);
+            } else {
+                if (this.meridian && this.hour) {
+                    this.hour = (this.hour < 13 && this.meridian == "p") ? this.hour + 12 : this.hour;			
+                }
+                if (this.weekday && !this.day) {
+                    this.day = (today.addDays((Date.getDayNumberFromName(this.weekday) - today.getDay()))).getDate();
+                }
+                if (this.month && !this.day) { 
+                    this.day = 1; 
+                }
+                return today.set(this);
+            }
+        }
+    };
+
+    var _ = Date.Parsing.Operators, g = Date.Grammar, t = Date.Translator, _fn;
+
+    g.datePartDelimiter = _.rtoken(/^([\s\-\.\,\/\x27]+)/); 
+    g.timePartDelimiter = _.stoken(":");
+    g.whiteSpace = _.rtoken(/^\s*/);
+    g.generalDelimiter = _.rtoken(/^(([\s\,]|at|on)+)/);
+  
+    var _C = {};
+    g.ctoken = function (keys) {
+        var fn = _C[keys];
+        if (! fn) {
+            var c = Date.CultureInfo.regexPatterns;
+            var kx = keys.split(/\s+/), px = []; 
+            for (var i = 0; i < kx.length ; i++) {
+                px.push(_.replace(_.rtoken(c[kx[i]]), kx[i]));
+            }
+            fn = _C[keys] = _.any.apply(null, px);
+        }
+        return fn;
+    };
+    g.ctoken2 = function (key) { 
+        return _.rtoken(Date.CultureInfo.regexPatterns[key]);
+    };
+
+    // hour, minute, second, meridian, timezone
+    g.h = _.cache(_.process(_.rtoken(/^(0[0-9]|1[0-2]|[1-9])/), t.hour));
+    g.hh = _.cache(_.process(_.rtoken(/^(0[0-9]|1[0-2])/), t.hour));
+    g.H = _.cache(_.process(_.rtoken(/^([0-1][0-9]|2[0-3]|[0-9])/), t.hour));
+    g.HH = _.cache(_.process(_.rtoken(/^([0-1][0-9]|2[0-3])/), t.hour));
+    g.m = _.cache(_.process(_.rtoken(/^([0-5][0-9]|[0-9])/), t.minute));
+    g.mm = _.cache(_.process(_.rtoken(/^[0-5][0-9]/), t.minute));
+    g.s = _.cache(_.process(_.rtoken(/^([0-5][0-9]|[0-9])/), t.second));
+    g.ss = _.cache(_.process(_.rtoken(/^[0-5][0-9]/), t.second));
+    g.hms = _.cache(_.sequence([g.H, g.mm, g.ss], g.timePartDelimiter));
+  
+    // _.min(1, _.set([ g.H, g.m, g.s ], g._t));
+    g.t = _.cache(_.process(g.ctoken2("shortMeridian"), t.meridian));
+    g.tt = _.cache(_.process(g.ctoken2("longMeridian"), t.meridian));
+    g.z = _.cache(_.process(_.rtoken(/^(\+|\-)?\s*\d\d\d\d?/), t.timezone));
+    g.zz = _.cache(_.process(_.rtoken(/^(\+|\-)\s*\d\d\d\d/), t.timezone));
+    g.zzz = _.cache(_.process(g.ctoken2("timezone"), t.timezone));
+    g.timeSuffix = _.each(_.ignore(g.whiteSpace), _.set([ g.tt, g.zzz ]));
+    g.time = _.each(_.optional(_.ignore(_.stoken("T"))), g.hms, g.timeSuffix);
+	  
+    // days, months, years
+    g.d = _.cache(_.process(_.each(_.rtoken(/^([0-2]\d|3[0-1]|\d)/), 
+        _.optional(g.ctoken2("ordinalSuffix"))), t.day));
+    g.dd = _.cache(_.process(_.each(_.rtoken(/^([0-2]\d|3[0-1])/), 
+        _.optional(g.ctoken2("ordinalSuffix"))), t.day));
+    g.ddd = g.dddd = _.cache(_.process(g.ctoken("sun mon tue wed thu fri sat"), 
+        function (s) { 
+            return function () { 
+                this.weekday = s; 
+            }; 
+        }
+    ));
+    g.M = _.cache(_.process(_.rtoken(/^(1[0-2]|0\d|\d)/), t.month));
+    g.MM = _.cache(_.process(_.rtoken(/^(1[0-2]|0\d)/), t.month));
+    g.MMM = g.MMMM = _.cache(_.process(
+        g.ctoken("jan feb mar apr may jun jul aug sep oct nov dec"), t.month));
+    g.y = _.cache(_.process(_.rtoken(/^(\d\d?)/), t.year));
+    g.yy = _.cache(_.process(_.rtoken(/^(\d\d)/), t.year));
+    g.yyy = _.cache(_.process(_.rtoken(/^(\d\d?\d?\d?)/), t.year));
+    g.yyyy = _.cache(_.process(_.rtoken(/^(\d\d\d\d)/), t.year));
+	
+	// rolling these up into general purpose rules
+    _fn = function () { 
+        return _.each(_.any.apply(null, arguments), _.not(g.ctoken2("timeContext")));
+    };
+    
+    g.day = _fn(g.d, g.dd); 
+    g.month = _fn(g.M, g.MMM); 
+    g.year = _fn(g.yyyy, g.yy);
+
+    // relative date / time expressions
+    g.orientation = _.process(g.ctoken("past future"), 
+        function (s) { 
+            return function () { 
+                this.orient = s; 
+            }; 
+        }
+    );
+    g.operator = _.process(g.ctoken("add subtract"), 
+        function (s) { 
+            return function () { 
+                this.operator = s; 
+            }; 
+        }
+    );  
+    g.rday = _.process(g.ctoken("yesterday tomorrow today now"), t.rday);
+    g.unit = _.process(g.ctoken("minute hour day week month year"), 
+        function (s) { 
+            return function () { 
+                this.unit = s; 
+            }; 
+        }
+    );
+    g.value = _.process(_.rtoken(/^\d\d?(st|nd|rd|th)?/), 
+        function (s) { 
+            return function () { 
+                this.value = s.replace(/\D/g, ""); 
+            }; 
+        }
+    );
+    g.expression = _.set([ g.rday, g.operator, g.value, g.unit, g.orientation, g.ddd, g.MMM ]);
+
+    // pre-loaded rules for different date part order preferences
+    _fn = function () { 
+        return  _.set(arguments, g.datePartDelimiter); 
+    };
+    g.mdy = _fn(g.ddd, g.month, g.day, g.year);
+    g.ymd = _fn(g.ddd, g.year, g.month, g.day);
+    g.dmy = _fn(g.ddd, g.day, g.month, g.year);
+    g.date = function (s) { 
+        return ((g[Date.CultureInfo.dateElementOrder] || g.mdy).call(this, s));
+    }; 
+
+    // parsing date format specifiers - ex: "h:m:s tt" 
+    // this little guy will generate a custom parser based
+    // on the format string, ex: g.format("h:m:s tt")
+    g.format = _.process(_.many(
+        _.any(
+        // translate format specifiers into grammar rules
+        _.process(
+        _.rtoken(/^(dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|zz?z?)/), 
+        function (fmt) { 
+        if (g[fmt]) { 
+            return g[fmt]; 
+        } else { 
+            throw Date.Parsing.Exception(fmt); 
+        }
+    }
+    ),
+    // translate separator tokens into token rules
+    _.process(
+    _.rtoken(/^[^dMyhHmstz]+/), // all legal separators 
+        function (s) { 
+            return _.ignore(_.stoken(s)); 
+        } 
+    )
+    )), 
+        // construct the parser ...
+        function (rules) { 
+            return _.process(_.each.apply(null, rules), t.finishExact); 
+        }
+    );
+    
+    var _F = {
+		//"M/d/yyyy": function (s) { 
+		//	var m = s.match(/^([0-2]\d|3[0-1]|\d)\/(1[0-2]|0\d|\d)\/(\d\d\d\d)/);
+		//	if (m!=null) { 
+		//		var r =  [ t.month.call(this,m[1]), t.day.call(this,m[2]), t.year.call(this,m[3]) ];
+		//		r = t.finishExact.call(this,r);
+		//		return [ r, "" ];
+		//	} else {
+		//		throw new Date.Parsing.Exception(s);
+		//	}
+		//}
+		//"M/d/yyyy": function (s) { return [ new Date(Date._parse(s)), ""]; }
+	}; 
+    var _get = function (f) { 
+        return _F[f] = (_F[f] || g.format(f)[0]);      
+    };
+  
+    g.formats = function (fx) {
+        if (fx instanceof Array) {
+            var rx = []; 
+            for (var i = 0 ; i < fx.length ; i++) {
+                rx.push(_get(fx[i])); 
+            }
+            return _.any.apply(null, rx);
+        } else { 
+            return _get(fx); 
+        }
+    };
+
+	// check for these formats first
+    g._formats = g.formats([
+        "yyyy-MM-ddTHH:mm:ss",
+        "ddd, MMM dd, yyyy H:mm:ss tt",
+        "ddd MMM d yyyy HH:mm:ss zzz",
+        "d"
+    ]);
+
+	// starting rule for general purpose grammar
+    g._start = _.process(_.set([ g.date, g.time, g.expression ], 
+        g.generalDelimiter, g.whiteSpace), t.finish);
+	
+	// real starting rule: tries selected formats first, 
+	// then general purpose rule
+    g.start = function (s) {
+        try { 
+            var r = g._formats.call({}, s); 
+            if (r[1].length === 0) {
+                return r; 
+            }
+        } catch (e) {}
+        return g._start.call({}, s);
+    };
+		
+}());
+
+
+Date._parse = Date.parse;
+
+/**
+ * Converts the specified string value into its JavaScript Date equivalent using CultureInfo specific format information.
+ * 
+ * Example
+<pre><code>
+///////////
+// Dates //
+///////////
+
+// 15-Oct-2004
+var d1 = Date.parse("10/15/2004");
+
+// 15-Oct-2004
+var d1 = Date.parse("15-Oct-2004");
+
+// 15-Oct-2004
+var d1 = Date.parse("2004.10.15");
+
+//Fri Oct 15, 2004
+var d1 = Date.parse("Fri Oct 15, 2004");
+
+///////////
+// Times //
+///////////
+
+// Today at 10 PM.
+var d1 = Date.parse("10 PM");
+
+// Today at 10:30 PM.
+var d1 = Date.parse("10:30 P.M.");
+
+// Today at 6 AM.
+var d1 = Date.parse("06am");
+
+/////////////////////
+// Dates and Times //
+/////////////////////
+
+// 8-July-2004 @ 10:30 PM
+var d1 = Date.parse("July 8th, 2004, 10:30 PM");
+
+// 1-July-2004 @ 10:30 PM
+var d1 = Date.parse("2004-07-01T22:30:00");
+
+////////////////////
+// Relative Dates //
+////////////////////
+
+// Returns today's date. The string "today" is culture specific.
+var d1 = Date.parse("today");
+
+// Returns yesterday's date. The string "yesterday" is culture specific.
+var d1 = Date.parse("yesterday");
+
+// Returns the date of the next thursday.
+var d1 = Date.parse("Next thursday");
+
+// Returns the date of the most previous monday.
+var d1 = Date.parse("last monday");
+
+// Returns today's day + one year.
+var d1 = Date.parse("next year");
+
+///////////////
+// Date Math //
+///////////////
+
+// Today + 2 days
+var d1 = Date.parse("t+2");
+
+// Today + 2 days
+var d1 = Date.parse("today + 2 days");
+
+// Today + 3 months
+var d1 = Date.parse("t+3m");
+
+// Today - 1 year
+var d1 = Date.parse("today - 1 year");
+
+// Today - 1 year
+var d1 = Date.parse("t-1y"); 
+
+
+/////////////////////////////
+// Partial Dates and Times //
+/////////////////////////////
+
+// July 15th of this year.
+var d1 = Date.parse("July 15");
+
+// 15th day of current day and year.
+var d1 = Date.parse("15");
+
+// July 1st of current year at 10pm.
+var d1 = Date.parse("7/1 10pm");
+</code></pre>
+ *
+ * @param {String}   The string value to convert into a Date object [Required]
+ * @return {Date}    A Date object or null if the string cannot be converted into a Date.
+ */
+Date.parse = function (s) {
+    var r = null; 
+    if (!s) { 
+        return null; 
+    }
+    try { 
+        r = Date.Grammar.start.call({}, s); 
+    } catch (e) { 
+        return null; 
+    }
+    return ((r[1].length === 0) ? r[0] : null);
+};
+
+Date.getParseFunction = function (fx) {
+    var fn = Date.Grammar.formats(fx);
+    return function (s) {
+        var r = null;
+        try { 
+            r = fn.call({}, s); 
+        } catch (e) { 
+            return null; 
+        }
+        return ((r[1].length === 0) ? r[0] : null);
+    };
+};
+/**
+ * Converts the specified string value into its JavaScript Date equivalent using the specified format {String} or formats {Array} and the CultureInfo specific format information.
+ * The format of the string value must match one of the supplied formats exactly.
+ * 
+ * Example
+<pre><code>
+// 15-Oct-2004
+var d1 = Date.parseExact("10/15/2004", "M/d/yyyy");
+
+// 15-Oct-2004
+var d1 = Date.parse("15-Oct-2004", "M-ddd-yyyy");
+
+// 15-Oct-2004
+var d1 = Date.parse("2004.10.15", "yyyy.MM.dd");
+
+// Multiple formats
+var d1 = Date.parseExact("10/15/2004", [ "M/d/yyyy" , "MMMM d, yyyy" ]);
+</code></pre>
+ *
+ * @param {String}   The string value to convert into a Date object [Required].
+ * @param {Object}   The expected format {String} or an array of expected formats {Array} of the date string [Required].
+ * @return {Date}    A Date object or null if the string cannot be converted into a Date.
+ */
+Date.parseExact = function (s, fx) { 
+    return Date.getParseFunction(fx)(s); 
+};
Index: trunk/prototype/plugins/datejs/sugarpak-debug.js
===================================================================
--- trunk/prototype/plugins/datejs/sugarpak-debug.js	(revision 5341)
+++ trunk/prototype/plugins/datejs/sugarpak-debug.js	(revision 5341)
@@ -0,0 +1,259 @@
+/**
+ * Version: 1.0 Alpha-1 
+ * Build Date: 12-Nov-2007
+ * Copyright (c) 2006-2007, Coolite Inc. (http://www.coolite.com/). All rights reserved.
+ * License: Licensed under The MIT License. See license.txt and http://www.datejs.com/license/. 
+ * Website: http://www.datejs.com/ or http://www.coolite.com/datejs/
+ */
+
+/**
+ **************************************************************
+ ** SugarPak - Domain Specific Language -  Syntactical Sugar **
+ **************************************************************
+ */
+ 
+/**
+ * Gets a date that is set to the current date and time. 
+ * @return {Date}    The current date and time.
+ */
+Date.now = function () {
+    return new Date();
+};
+
+/** 
+ * Gets a date that is set to the current date. The time is set to the start of the day (00:00 or 12:00 AM).
+ * @return {Date}    The current date.
+ */
+Date.today = function () {
+    return Date.now().clearTime();
+};
+
+// private
+Date.prototype._orient = +1;
+
+/** 
+ * Moves the date to the next instance of a date as specified by a trailing date element function (eg. .day(), .month()), month name function (eg. .january(), .jan()) or day name function (eg. .friday(), fri()).
+ * Example
+<pre><code>
+Date.today().next().friday();
+Date.today().next().fri();
+Date.today().next().march();
+Date.today().next().mar();
+Date.today().next().week();
+</code></pre>
+ * 
+ * @return {Date}    this
+ */
+Date.prototype.next = function () {
+    this._orient = +1;
+    return this;
+};
+
+/** 
+ * Moves the date to the previous instance of a date as specified by a trailing date element function (eg. .day(), .month()), month name function (eg. .january(), .jan()) or day name function (eg. .friday(), fri()).
+ * Example
+<pre><code>
+Date.today().last().friday();
+Date.today().last().fri();
+Date.today().last().march();
+Date.today().last().mar();
+Date.today().last().week();
+</code></pre>
+ *  
+ * @return {Date}    this
+ */
+Date.prototype.last = Date.prototype.prev = Date.prototype.previous = function () {
+    this._orient = -1;
+    return this;
+};
+
+// private
+Date.prototype._is = false;
+    
+/** 
+ * Performs a equality check when followed by either a month name or day name function.
+ * Example
+<pre><code>
+Date.today().is().friday(); // true|false
+Date.today().is().fri();
+Date.today().is().march();
+Date.today().is().mar();
+</code></pre>
+ *  
+ * @return {bool}    true|false
+ */
+Date.prototype.is = function () { 
+    this._is = true; 
+    return this; 
+}; 
+
+// private
+Number.prototype._dateElement = "day";
+
+/** 
+ * Creates a new Date (Date.now()) and adds this (Number) to the date based on the preceding date element function (eg. second|minute|hour|day|month|year).
+ * Example
+<pre><code>
+// Undeclared Numbers must be wrapped with parentheses. Requirment of JavaScript.
+(3).days().fromNow();
+(6).months().fromNow();
+
+// Declared Number variables do not require parentheses. 
+var n = 6;
+n.months().fromNow();
+</code></pre>
+ *  
+ * @return {Date}    A new Date instance
+ */
+Number.prototype.fromNow = function () {
+    var c = {};
+    c[this._dateElement] = this;
+    return Date.now().add(c);
+};
+
+/** 
+ * Creates a new Date (Date.now()) and subtract this (Number) from the date based on the preceding date element function (eg. second|minute|hour|day|month|year).
+ * Example
+<pre><code>
+// Undeclared Numbers must be wrapped with parentheses. Requirment of JavaScript.
+(3).days().ago();
+(6).months().ago();
+
+// Declared Number variables do not require parentheses. 
+var n = 6;
+n.months().ago();
+</code></pre>
+ *  
+ * @return {Date}    A new Date instance
+ */
+Number.prototype.ago = function () {
+    var c = {};
+    c[this._dateElement] = this * -1;
+    return Date.now().add(c);
+};
+
+// Build dynamic date element, month name and day name functions.
+(function () {
+    var $D = Date.prototype, $N = Number.prototype;
+
+    /* Do NOT modify the following string tokens. These tokens are used to build dynamic functions. */
+    var dx = ("sunday monday tuesday wednesday thursday friday saturday").split(/\s/),
+        mx = ("january february march april may june july august september october november december").split(/\s/),
+        px = ("Millisecond Second Minute Hour Day Week Month Year").split(/\s/),
+        de;
+    
+    // Create day name functions and abbreviated day name functions (eg. monday(), friday(), fri()).
+    var df = function (n) {
+        return function () { 
+            if (this._is) { 
+                this._is = false; 
+                return this.getDay() == n; 
+            }
+            return this.moveToDayOfWeek(n, this._orient);
+        };
+    };
+    
+    for (var i = 0 ; i < dx.length ; i++) { 
+        $D[dx[i]] = $D[dx[i].substring(0, 3)] = df(i);
+    }
+    
+    // Create month name functions and abbreviated month name functions (eg. january(), march(), mar()).
+    var mf = function (n) { 
+        return function () {
+            if (this._is) { 
+                this._is = false; 
+                return this.getMonth() === n; 
+            }
+            return this.moveToMonth(n, this._orient); 
+        };
+    };
+    
+    for (var j = 0 ; j < mx.length ; j++) { 
+        $D[mx[j]] = $D[mx[j].substring(0, 3)] = mf(j);
+    }
+    
+    // Create date element functions and plural date element functions used with Date (eg. day(), days(), months()).
+    var ef = function (j) { 
+        return function () {
+            if (j.substring(j.length - 1) != "s") { 
+                j += "s"; 
+            }
+            return this["add" + j](this._orient); 
+        };
+    };
+    
+    // Create date element functions and plural date element functions used with Number (eg. day(), days(), months()).
+    var nf = function (n) {
+        return function () {
+            this._dateElement = n;
+            return this;
+        };
+    };
+    
+    for (var k = 0 ; k < px.length ; k++) {
+        de = px[k].toLowerCase();
+        $D[de] = $D[de + "s"] = ef(px[k]);
+        $N[de] = $N[de + "s"] = nf(de);
+    }
+}());
+
+/**
+ * Converts the current date instance into a JSON string value.
+ * @return {String}  JSON string of date
+ */
+Date.prototype.toJSONString = function () {
+    return this.toString("yyyy-MM-ddThh:mm:ssZ");
+};
+
+/**
+ * Converts the current date instance to a string using the culture specific shortDatePattern.
+ * @return {String}  A string formatted as per the culture specific shortDatePattern
+ */
+Date.prototype.toShortDateString = function () {
+    return this.toString(Date.CultureInfo.formatPatterns.shortDatePattern);
+};
+
+/**
+ * Converts the current date instance to a string using the culture specific longDatePattern.
+ * @return {String}  A string formatted as per the culture specific longDatePattern
+ */
+Date.prototype.toLongDateString = function () {
+    return this.toString(Date.CultureInfo.formatPatterns.longDatePattern);
+};
+
+/**
+ * Converts the current date instance to a string using the culture specific shortTimePattern.
+ * @return {String}  A string formatted as per the culture specific shortTimePattern
+ */
+Date.prototype.toShortTimeString = function () {
+    return this.toString(Date.CultureInfo.formatPatterns.shortTimePattern);
+};
+
+/**
+ * Converts the current date instance to a string using the culture specific longTimePattern.
+ * @return {String}  A string formatted as per the culture specific longTimePattern
+ */
+Date.prototype.toLongTimeString = function () {
+    return this.toString(Date.CultureInfo.formatPatterns.longTimePattern);
+};
+
+/**
+ * Get the ordinal suffix of the current day.
+ * @return {String}  "st, "nd", "rd" or "th"
+ */
+Date.prototype.getOrdinal = function () {
+    switch (this.getDate()) {
+    case 1: 
+    case 21: 
+    case 31: 
+        return "st";
+    case 2: 
+    case 22: 
+        return "nd";
+    case 3: 
+    case 23: 
+        return "rd";
+    default: 
+        return "th";
+    }
+};
Index: trunk/prototype/plugins/datejs/time-debug.js
===================================================================
--- trunk/prototype/plugins/datejs/time-debug.js	(revision 5341)
+++ trunk/prototype/plugins/datejs/time-debug.js	(revision 5341)
@@ -0,0 +1,216 @@
+/**
+ * Version: 1.0 Alpha-1 
+ * Build Date: 12-Nov-2007
+ * Copyright (c) 2006-2007, Coolite Inc. (http://www.coolite.com/). All rights reserved.
+ * License: Licensed under The MIT License. See license.txt and http://www.datejs.com/license/. 
+ * Website: http://www.datejs.com/ or http://www.coolite.com/datejs/
+ */
+ 
+/* 
+ * TimeSpan(days, hours, minutes, seconds, milliseconds);
+ * TimeSpan(milliseconds);
+ */
+TimeSpan = function (days, hours, minutes, seconds, milliseconds) {
+    this.days = 0;
+    this.hours = 0;
+    this.minutes = 0;
+    this.seconds = 0;
+    this.milliseconds = 0;
+    
+    if (arguments.length == 5) { 
+        this.days = days; 
+        this.hours = hours; 
+        this.minutes = minutes; 
+        this.seconds = seconds; 
+        this.milliseconds = milliseconds; 
+    } 
+    else if (arguments.length == 1 && typeof days == "number") {
+        var orient = (days < 0) ? -1 : +1;
+        this.milliseconds = Math.abs(days);
+        
+        this.days = Math.floor(this.milliseconds / (24 * 60 * 60 * 1000)) * orient;
+        this.milliseconds = this.milliseconds % (24 * 60 * 60 * 1000);
+
+        this.hours = Math.floor(this.milliseconds / (60 * 60 * 1000)) * orient;
+        this.milliseconds = this.milliseconds % (60 * 60 * 1000);
+
+        this.minutes = Math.floor(this.milliseconds / (60 * 1000)) * orient;
+        this.milliseconds = this.milliseconds % (60 * 1000);
+
+        this.seconds = Math.floor(this.milliseconds / 1000) * orient;
+        this.milliseconds = this.milliseconds % 1000;
+
+        this.milliseconds = this.milliseconds * orient;
+        return this;
+    } 
+    else {
+        return null;
+    }
+};
+
+TimeSpan.prototype.compare = function (timeSpan) {
+    var t1 = new Date(1970, 1, 1, this.hours(), this.minutes(), this.seconds()), t2;
+    if (timeSpan === null) { 
+        t2 = new Date(1970, 1, 1, 0, 0, 0); 
+    }
+    else { 
+        t2 = new Date(1970, 1, 1, timeSpan.hours(), timeSpan.minutes(), timeSpan.seconds()); /* t2 = t2.addDays(timeSpan.days()); */ 
+    }
+    return (t1 > t2) ? 1 : (t1 < t2) ? -1 : 0;
+};
+
+TimeSpan.prototype.add = function (timeSpan) { 
+    return (timeSpan === null) ? this : this.addSeconds(timeSpan.getTotalMilliseconds() / 1000); 
+};
+
+TimeSpan.prototype.subtract = function (timeSpan) { 
+    return (timeSpan === null) ? this : this.addSeconds(-timeSpan.getTotalMilliseconds() / 1000); 
+};
+
+TimeSpan.prototype.addDays = function (n) { 
+    return new TimeSpan(this.getTotalMilliseconds() + (n * 24 * 60 * 60 * 1000)); 
+};
+
+TimeSpan.prototype.addHours = function (n) { 
+    return new TimeSpan(this.getTotalMilliseconds() + (n * 60 * 60 * 1000)); 
+};
+
+TimeSpan.prototype.addMinutes = function (n) { 
+    return new TimeSpan(this.getTotalMilliseconds() + (n * 60 * 1000)); 
+};
+
+TimeSpan.prototype.addSeconds = function (n) {
+    return new TimeSpan(this.getTotalMilliseconds() + (n * 1000)); 
+};
+
+TimeSpan.prototype.addMilliseconds = function (n) {
+    return new TimeSpan(this.getTotalMilliseconds() + n); 
+};
+
+TimeSpan.prototype.getTotalMilliseconds = function () {
+    return (this.days() * (24 * 60 * 60 * 1000)) + (this.hours() * (60 * 60 * 1000)) + (this.minutes() * (60 * 1000)) + (this.seconds() * (1000)); 
+};
+
+TimeSpan.prototype.get12HourHour = function () {
+    return ((h = this.hours() % 12) ? h : 12); 
+};
+
+TimeSpan.prototype.getDesignator = function () { 
+    return (this.hours() < 12) ? Date.CultureInfo.amDesignator : Date.CultureInfo.pmDesignator;
+};
+
+TimeSpan.prototype.toString = function (format) {
+    function _toString() {
+        if (this.days() !== null && this.days() > 0) {
+            return this.days() + "." + this.hours() + ":" + p(this.minutes()) + ":" + p(this.seconds());
+        }
+        else { 
+            return this.hours() + ":" + p(this.minutes()) + ":" + p(this.seconds());
+        }
+    }
+    function p(s) {
+        return (s.toString().length < 2) ? "0" + s : s;
+    } 
+    var self = this;
+    return format ? format.replace(/d|dd|HH|H|hh|h|mm|m|ss|s|tt|t/g, 
+    function (format) {
+        switch (format) {
+        case "d":	
+            return self.days();
+        case "dd":	
+            return p(self.days());
+        case "H":	
+            return self.hours();
+        case "HH":	
+            return p(self.hours());
+        case "h":	
+            return self.get12HourHour();
+        case "hh":	
+            return p(self.get12HourHour());
+        case "m":	
+            return self.minutes();
+        case "mm":	
+            return p(self.minutes());
+        case "s":	
+            return self.seconds();
+        case "ss":	
+            return p(self.seconds());
+        case "t":	
+            return ((this.hours() < 12) ? Date.CultureInfo.amDesignator : Date.CultureInfo.pmDesignator).substring(0, 1);
+        case "tt":	
+            return (this.hours() < 12) ? Date.CultureInfo.amDesignator : Date.CultureInfo.pmDesignator;
+        }
+    }
+    ) : this._toString();
+};
+
+/* 
+ * TimePeriod(startDate, endDate);
+ */
+var TimePeriod = function (years, months, days, hours, minutes, seconds, milliseconds) {
+    this.years = 0;
+    this.months = 0;
+    this.days = 0;
+    this.hours = 0;
+    this.minutes = 0;
+    this.seconds = 0;
+    this.milliseconds = 0;
+    
+    // startDate and endDate as arguments
+    if (arguments.length == 2 && arguments[0] instanceof Date && arguments[1] instanceof Date) {
+    
+        var date1 = years.clone();
+        var date2 = months.clone();
+    
+        var temp = date1.clone();
+        var orient = (date1 > date2) ? -1 : +1;
+        
+        this.years = date2.getFullYear() - date1.getFullYear();
+        temp.addYears(this.years);
+        
+        if (orient == +1) {
+            if (temp > date2) {
+                if (this.years !== 0) {
+                    this.years--;
+                }
+            }
+        } else {
+            if (temp < date2) {
+                if (this.years !== 0) {
+                    this.years++;
+                }
+            }
+        }
+        
+        date1.addYears(this.years);
+
+        if (orient == +1) {
+            while (date1 < date2 && date1.clone().addDays(date1.getDaysInMonth()) < date2) {
+                date1.addMonths(1);
+                this.months++;
+            }
+        }
+        else {
+            while (date1 > date2 && date1.clone().addDays(-date1.getDaysInMonth()) > date2) {
+                date1.addMonths(-1);
+                this.months--;
+            }
+        }
+        
+        var diff = date2 - date1;
+
+        if (diff !== 0) {
+            var ts = new TimeSpan(diff);
+            
+            this.days = ts.days;
+            this.hours = ts.hours;
+            this.minutes = ts.minutes;
+            this.seconds = ts.seconds;
+            this.milliseconds = ts.milliseconds;
+        }
+
+        // UTC Hacks required...
+        return this;
+    }
+ 
+};
Index: trunk/prototype/plugins/view/jquerymx-1.0.custom.js
===================================================================
--- trunk/prototype/plugins/view/jquerymx-1.0.custom.js	(revision 5136)
+++ trunk/prototype/plugins/view/jquerymx-1.0.custom.js	(revision 5136)
@@ -0,0 +1,1393 @@
+
+//jquery.view.js
+
+(function( $ ) {
+
+	// converts to an ok dom id
+	var toId = function( src ) {
+		return src.replace(/^\/\//, "").replace(/[\/\.]/g, "_");
+	},
+		// used for hookup ids
+		id = 1;
+
+	/**
+	 * @class jQuery.View
+	 * @tag core
+	 * @plugin jquery/view
+	 * @test jquery/view/qunit.html
+	 * @download dist/jquery.view.js
+	 * 
+	 * View provides a uniform interface for using templates with 
+	 * jQuery. When template engines [jQuery.View.register register] 
+	 * themselves, you are able to:
+	 * 
+	 *  - Use views with jQuery extensions [jQuery.fn.after after], [jQuery.fn.append append],
+	 *   [jQuery.fn.before before], [jQuery.fn.html html], [jQuery.fn.prepend prepend],
+	 *   [jQuery.fn.replaceWith replaceWith], [jQuery.fn.text text].
+	 *  - Template loading from html elements and external files.
+	 *  - Synchronous and asynchronous template loading.
+	 *  - Deferred Rendering.
+	 *  - Template caching.
+	 *  - Bundling of processed templates in production builds.
+	 *  - Hookup jquery plugins directly in the template.
+	 *  
+	 * ## Use
+	 * 
+	 * 
+	 * When using views, you're almost always wanting to insert the results 
+	 * of a rendered template into the page. jQuery.View overwrites the 
+	 * jQuery modifiers so using a view is as easy as: 
+	 * 
+	 *     $("#foo").html('mytemplate.ejs',{message: 'hello world'})
+	 *
+	 * This code:
+	 * 
+	 *  - Loads the template a 'mytemplate.ejs'. It might look like:
+	 *    <pre><code>&lt;h2>&lt;%= message %>&lt;/h2></pre></code>
+	 *  
+	 *  - Renders it with {message: 'hello world'}, resulting in:
+	 *    <pre><code>&lt;div id='foo'>"&lt;h2>hello world&lt;/h2>&lt;/div></pre></code>
+	 *  
+	 *  - Inserts the result into the foo element. Foo might look like:
+	 *    <pre><code>&lt;div id='foo'>&lt;h2>hello world&lt;/h2>&lt;/div></pre></code>
+	 * 
+	 * ## jQuery Modifiers
+	 * 
+	 * You can use a template with the following jQuery modifiers:
+	 * 
+	 * <table>
+	 * <tr><td>[jQuery.fn.after after]</td><td> <code>$('#bar').after('temp.jaml',{});</code></td></tr>
+	 * <tr><td>[jQuery.fn.after append] </td><td>  <code>$('#bar').append('temp.jaml',{});</code></td></tr>
+	 * <tr><td>[jQuery.fn.after before] </td><td> <code>$('#bar').before('temp.jaml',{});</code></td></tr>
+	 * <tr><td>[jQuery.fn.after html] </td><td> <code>$('#bar').html('temp.jaml',{});</code></td></tr>
+	 * <tr><td>[jQuery.fn.after prepend] </td><td> <code>$('#bar').prepend('temp.jaml',{});</code></td></tr>
+	 * <tr><td>[jQuery.fn.after replaceWith] </td><td> <code>$('#bar').replaceWidth('temp.jaml',{});</code></td></tr>
+	 * <tr><td>[jQuery.fn.after text] </td><td> <code>$('#bar').text('temp.jaml',{});</code></td></tr>
+	 * </table>
+	 * 
+	 * You always have to pass a string and an object (or function) for the jQuery modifier 
+	 * to user a template.
+	 * 
+	 * ## Template Locations
+	 * 
+	 * View can load from script tags or from files. 
+	 * 
+	 * ## From Script Tags
+	 * 
+	 * To load from a script tag, create a script tag with your template and an id like: 
+	 * 
+	 * <pre><code>&lt;script type='text/ejs' id='recipes'>
+	 * &lt;% for(var i=0; i &lt; recipes.length; i++){ %>
+	 *   &lt;li>&lt;%=recipes[i].name %>&lt;/li>
+	 * &lt;%} %>
+	 * &lt;/script></code></pre>
+	 * 
+	 * Render with this template like: 
+	 * 
+	 * @codestart
+	 * $("#foo").html('recipes',recipeData)
+	 * @codeend
+	 * 
+	 * Notice we passed the id of the element we want to render.
+	 * 
+	 * ## From File
+	 * 
+	 * You can pass the path of a template file location like:
+	 * 
+	 *     $("#foo").html('templates/recipes.ejs',recipeData)
+	 * 
+	 * However, you typically want to make the template work from whatever page they 
+	 * are called from.  To do this, use // to look up templates from JMVC root:
+	 * 
+	 *     $("#foo").html('//app/views/recipes.ejs',recipeData)
+	 *     
+	 * Finally, the [jQuery.Controller.prototype.view controller/view] plugin can make looking
+	 * up a thread (and adding helpers) even easier:
+	 * 
+	 *     $("#foo").html( this.view('recipes', recipeData) )
+	 * 
+	 * ## Packaging Templates
+	 * 
+	 * If you're making heavy use of templates, you want to organize 
+	 * them in files so they can be reused between pages and applications.
+	 * 
+	 * But, this organization would come at a high price 
+	 * if the browser has to 
+	 * retrieve each template individually. The additional 
+	 * HTTP requests would slow down your app. 
+	 * 
+	 * Fortunately, [steal.static.views steal.views] can build templates 
+	 * into your production files. You just have to point to the view file like: 
+	 * 
+	 *     steal.views('path/to/the/view.ejs');
+     *
+	 * ## Asynchronous
+	 * 
+	 * By default, retrieving requests is done synchronously. This is 
+	 * fine because StealJS packages view templates with your JS download. 
+	 * 
+	 * However, some people might not be using StealJS or want to delay loading 
+	 * templates until necessary. If you have the need, you can 
+	 * provide a callback paramter like: 
+	 * 
+	 *     $("#foo").html('recipes',recipeData, function(result){
+	 *       this.fadeIn()
+	 *     });
+	 * 
+	 * The callback function will be called with the result of the 
+	 * rendered template and 'this' will be set to the original jQuery object.
+	 * 
+	 * ## Deferreds (3.0.6)
+	 * 
+	 * If you pass deferreds to $.View or any of the jQuery 
+	 * modifiers, the view will wait until all deferreds resolve before 
+	 * rendering the view.  This makes it a one-liner to make a request and 
+	 * use the result to render a template. 
+	 * 
+	 * The following makes a request for todos in parallel with the 
+	 * todos.ejs template.  Once todos and template have been loaded, it with
+	 * render the view with the todos.
+	 * 
+	 *     $('#todos').html("todos.ejs",Todo.findAll());
+	 * 
+	 * ## Just Render Templates
+	 * 
+	 * Sometimes, you just want to get the result of a rendered 
+	 * template without inserting it, you can do this with $.View: 
+	 * 
+	 *     var out = $.View('path/to/template.jaml',{});
+	 *     
+     * ## Preloading Templates
+	 * 
+	 * You can preload templates asynchronously like:
+	 * 
+	 *     $.get('path/to/template.jaml',{},function(){},'view');
+	 * 
+	 * ## Supported Template Engines
+	 * 
+	 * JavaScriptMVC comes with the following template languages:
+	 * 
+	 *   - EmbeddedJS
+	 *     <pre><code>&lt;h2>&lt;%= message %>&lt;/h2></code></pre>
+	 *     
+	 *   - JAML
+	 *     <pre><code>h2(data.message);</code></pre>
+	 *     
+	 *   - Micro
+	 *     <pre><code>&lt;h2>{%= message %}&lt;/h2></code></pre>
+	 *     
+	 *   - jQuery.Tmpl
+	 *     <pre><code>&lt;h2>${message}&lt;/h2></code></pre>
+
+	 * 
+	 * The popular <a href='http://awardwinningfjords.com/2010/08/09/mustache-for-javascriptmvc-3.html'>Mustache</a> 
+	 * template engine is supported in a 2nd party plugin.
+	 * 
+	 * ## Using other Template Engines
+	 * 
+	 * It's easy to integrate your favorite template into $.View and Steal.  Read 
+	 * how in [jQuery.View.register].
+	 * 
+	 * @constructor
+	 * 
+	 * Looks up a template, processes it, caches it, then renders the template
+	 * with data and optional helpers.
+	 * 
+	 * With [stealjs StealJS], views are typically bundled in the production build.
+	 * This makes it ok to use views synchronously like:
+	 * 
+	 * @codestart
+	 * $.View("//myplugin/views/init.ejs",{message: "Hello World"})
+	 * @codeend
+	 * 
+	 * If you aren't using StealJS, it's best to use views asynchronously like:
+	 * 
+	 * @codestart
+	 * $.View("//myplugin/views/init.ejs",
+	 *        {message: "Hello World"}, function(result){
+	 *   // do something with result
+	 * })
+	 * @codeend
+	 * 
+	 * @param {String} view The url or id of an element to use as the template's source.
+	 * @param {Object} data The data to be passed to the view.
+	 * @param {Object} [helpers] Optional helper functions the view might use. Not all
+	 * templates support helpers.
+	 * @param {Object} [callback] Optional callback function.  If present, the template is 
+	 * retrieved asynchronously.  This is a good idea if you aren't compressing the templates
+	 * into your view.
+	 * @return {String} The rendered result of the view or if deferreds are passed, a deferred that will contain
+	 * the rendered result of the view.
+	 */
+
+	var $view, render, checkText, get, getRenderer
+		isDeferred = function(obj){
+			return obj && $.isFunction(obj.always) // check if obj is a $.Deferred
+		},
+		// gets an array of deferreds from an object
+		// this only goes one level deep
+		getDeferreds =  function(data){
+			var deferreds = [];
+		
+			// pull out deferreds
+			if(isDeferred(data)){
+				return [data]
+			}else{
+				for(var prop in data) {
+					if(isDeferred(data[prop])) {
+						deferreds.push(data[prop]);
+					}
+				}
+			}
+			return deferreds;
+		},
+		// gets the useful part of deferred
+		// this is for Models and $.ajax that give arrays
+		usefulPart = function(resolved){
+			return $.isArray(resolved) && 
+					resolved.length ===3 && 
+					resolved[1] === 'success' ?
+						resolved[0] : resolved
+		};
+
+	$view = $.View = function( view, data, helpers, callback ) {
+		if ( typeof helpers === 'function' ) {
+			callback = helpers;
+			helpers = undefined;
+		}
+		
+		// see if we got passed any deferreds
+		var deferreds = getDeferreds(data);
+		
+		
+		if(deferreds.length) { // does data contain any deferreds?
+			
+			// the deferred that resolves into the rendered content ...
+			var deferred = $.Deferred();
+			
+			// add the view request to the list of deferreds
+			deferreds.push(get(view, true))
+			
+			// wait for the view and all deferreds to finish
+			$.when.apply($, deferreds).then(function(resolved) {
+				var objs = $.makeArray(arguments),
+					renderer = objs.pop()[0],
+					result; //get the view render function
+				
+				// make data look like the resolved deferreds
+				if (isDeferred(data)) {
+					data = usefulPart(resolved);
+				}
+				else {
+					for (var prop in data) {
+						if (isDeferred(data[prop])) {
+							data[prop] = usefulPart(objs.shift());
+						}
+					}
+				}
+				result = renderer(data, helpers);
+				
+				//resolve with the rendered view
+				deferred.resolve( result ); // this does not work as is...
+				callback && callback(result);
+			});
+			// return the deferred ....
+			return deferred.promise();
+		}
+		else {
+
+			var response,
+				async = typeof callback === "function",
+				deferred = get(view, async);
+			
+			if(async){
+				response = deferred;
+				deferred.done(function(renderer){
+					callback(renderer(data, helpers))
+				})
+			} else {
+				deferred.done(function(renderer){
+					response = renderer(data, helpers);
+				});
+			}
+			
+			return response;
+		}
+	};
+	// makes sure there's a template
+	checkText = function( text, url ) {
+		if (!text.match(/[^\s]/) ) {
+			
+			throw "$.View ERROR: There is no template or an empty template at " + url;
+		}
+	};
+	get = function(url , async){
+		return $.ajax({
+				url: url,
+				dataType : "view",
+				async : async
+		});
+	};
+	
+	// you can request a view renderer (a function you pass data to and get html)
+	$.ajaxTransport("view", function(options, orig){
+		var view = orig.url,
+			suffix = view.match(/\.[\w\d]+$/),
+			type, el, id, renderer, url = view,
+			jqXHR,
+			response = function(text){
+				var func = type.renderer(id, text);
+				if ( $view.cache ) {
+					$view.cached[id] = func;
+				}
+				return {
+					view: func
+				};
+			};
+			
+        // if we have an inline template, derive the suffix from the 'text/???' part
+        // this only supports '<script></script>' tags
+        if ( el = document.getElementById(view)) {
+          suffix = el.type.match(/\/[\d\w]+$/)[0].replace(/^\//, '.');
+        }
+		
+		//if there is no suffix, add one
+		if (!suffix ) {
+			suffix = $view.ext;
+			url = url + $view.ext;
+		}
+
+		//convert to a unique and valid id
+		id = toId(url);
+
+		//if a absolute path, use steal to get it
+		if ( url.match(/^\/\//) ) {
+			if (typeof steal === "undefined") {
+				url = "/"+url.substr(2);
+			}
+			else {
+				url = steal.root.join(url.substr(2));
+			}
+		}
+
+		//get the template engine
+		type = $view.types[suffix];
+
+		return {
+			send : function(headers, callback){
+				if($view.cached[id]){
+					return callback( 200, "success", {view: $view.cached[id]} );
+				} else if( el  ) {
+					callback( 200, "success", response(el.innerHTML) );
+				} else {
+					jqXHR = $.ajax({
+						async : orig.async,
+						url: url,
+						dataType: "text",
+						error: function() {
+							checkText("", url);
+							callback(404);
+						},
+						success: function( text ) {
+							checkText(text, url);
+							callback(200, "success", response(text) )
+						}
+					});
+				}
+			},
+			abort : function(){
+				jqXHR && jqXHR.abort();
+			}
+		}
+	})
+	$.extend($view, {
+		/**
+		 * @attribute hookups
+		 * @hide
+		 * A list of pending 'hookups'
+		 */
+		hookups: {},
+		/**
+		 * @function hookup
+		 * Registers a hookup function that can be called back after the html is 
+		 * put on the page.  Typically this is handled by the template engine.  Currently
+		 * only EJS supports this functionality.
+		 * 
+		 *     var id = $.View.hookup(function(el){
+		 *            //do something with el
+		 *         }),
+		 *         html = "<div data-view-id='"+id+"'>"
+		 *     $('.foo').html(html);
+		 * 
+		 * 
+		 * @param {Function} cb a callback function to be called with the element
+		 * @param {Number} the hookup number
+		 */
+		hookup: function( cb ) {
+			var myid = ++id;
+			$view.hookups[myid] = cb;
+			return myid;
+		},
+		/**
+		 * @attribute cached
+		 * @hide
+		 * Cached are put in this object
+		 */
+		cached: {},
+		/**
+		 * @attribute cache
+		 * Should the views be cached or reloaded from the server. Defaults to true.
+		 */
+		cache: true,
+		/**
+		 * @function register
+		 * Registers a template engine to be used with 
+		 * view helpers and compression.  
+		 * 
+		 * ## Example
+		 * 
+		 * @codestart
+		 * $.View.register({
+		 * 	suffix : "tmpl",
+		 * 	renderer: function( id, text ) {
+		 * 		return function(data){
+		 * 			return jQuery.render( text, data );
+		 * 		}
+		 * 	},
+		 * 	script: function( id, text ) {
+		 * 		var tmpl = $.tmpl(text).toString();
+		 * 		return "function(data){return ("+
+		 * 		  	tmpl+
+		 * 			").call(jQuery, jQuery, data); }";
+		 * 	}
+		 * })
+		 * @codeend
+		 * Here's what each property does:
+		 * 
+ 		 *    * suffix - files that use this suffix will be processed by this template engine
+ 		 *    * renderer - returns a function that will render the template provided by text
+ 		 *    * script - returns a string form of the processed template function.
+		 * 
+		 * @param {Object} info a object of method and properties 
+		 * 
+		 * that enable template integration:
+		 * <ul>
+		 *   <li>suffix - the view extension.  EX: 'ejs'</li>
+		 *   <li>script(id, src) - a function that returns a string that when evaluated returns a function that can be 
+		 *    used as the render (i.e. have func.call(data, data, helpers) called on it).</li>
+		 *   <li>renderer(id, text) - a function that takes the id of the template and the text of the template and
+		 *    returns a render function.</li>
+		 * </ul>
+		 */
+		register: function( info ) {
+			this.types["." + info.suffix] = info;
+		},
+		types: {},
+		/**
+		 * @attribute ext
+		 * The default suffix to use if none is provided in the view's url.  
+		 * This is set to .ejs by default.
+		 */
+		ext: ".ejs",
+		/**
+		 * Returns the text that 
+		 * @hide 
+		 * @param {Object} type
+		 * @param {Object} id
+		 * @param {Object} src
+		 */
+		registerScript: function( type, id, src ) {
+			return "$.View.preload('" + id + "'," + $view.types["." + type].script(id, src) + ");";
+		},
+		/**
+		 * @hide
+		 * Called by a production script to pre-load a renderer function
+		 * into the view cache.
+		 * @param {String} id
+		 * @param {Function} renderer
+		 */
+		preload: function( id, renderer ) {
+			$view.cached[id] = function( data, helpers ) {
+				return renderer.call(data, data, helpers);
+			};
+		}
+
+	});
+
+
+	//---- ADD jQUERY HELPERS -----
+	//converts jquery functions to use views	
+	var convert, modify, isTemplate, getCallback, hookupView, funcs;
+
+	convert = function( func_name ) {
+		var old = $.fn[func_name];
+
+		$.fn[func_name] = function() {
+			var args = $.makeArray(arguments),
+				callbackNum, 
+				callback, 
+				self = this,
+				result;
+
+			//check if a template
+			if ( isTemplate(args) ) {
+
+				// if we should operate async
+				if ((callbackNum = getCallback(args))) {
+					callback = args[callbackNum];
+					args[callbackNum] = function( result ) {
+						modify.call(self, [result], old);
+						callback.call(self, result);
+					};
+					$view.apply($view, args);
+					return this;
+				}
+				result = $view.apply($view, args);
+				if(!isDeferred( result ) ){
+					args = [result];
+				}else{
+					result.done(function(res){
+						modify.call(self, [res], old);
+					})
+					return this;
+				}
+				//otherwise do the template now
+				
+			}
+
+			return modify.call(this, args, old);
+		};
+	};
+	// modifies the html of the element
+	modify = function( args, old ) {
+		var res, stub, hooks;
+
+		//check if there are new hookups
+		for ( var hasHookups in $view.hookups ) {
+			break;
+		}
+
+		//if there are hookups, get jQuery object
+		if ( hasHookups ) {
+			hooks = $view.hookups;
+			$view.hookups = {};
+			args[0] = $(args[0]);
+		}
+		res = old.apply(this, args);
+
+		//now hookup hookups
+		if ( hasHookups ) {
+			hookupView(args[0], hooks);
+		}
+		return res;
+	};
+
+	// returns true or false if the args indicate a template is being used
+	isTemplate = function( args ) {
+		var secArgType = typeof args[1];
+
+		return typeof args[0] == "string" && (secArgType == 'object' || secArgType == 'function') && !args[1].nodeType && !args[1].jquery;
+	};
+
+	//returns the callback if there is one (for async view use)
+	getCallback = function( args ) {
+		return typeof args[3] === 'function' ? 3 : typeof args[2] === 'function' && 2;
+	};
+
+	hookupView = function( els , hooks) {
+		//remove all hookups
+		var hookupEls, 
+			len, i = 0,
+			id, func;
+		els = els.filter(function(){
+			return this.nodeType != 3; //filter out text nodes
+		})
+		hookupEls = els.add("[data-view-id]", els);
+		len = hookupEls.length;
+		for (; i < len; i++ ) {
+			if ( hookupEls[i].getAttribute && (id = hookupEls[i].getAttribute('data-view-id')) && (func = hooks[id]) ) {
+				func(hookupEls[i], id);
+				delete hooks[id];
+				hookupEls[i].removeAttribute('data-view-id');
+			}
+		}
+		//copy remaining hooks back
+		$.extend($view.hookups, hooks);
+	};
+
+	/**
+	 *  @add jQuery.fn
+	 */
+	funcs = [
+	/**
+	 *  @function prepend
+	 *  @parent jQuery.View
+	 *  abc
+	 */
+	"prepend",
+	/**
+	 *  @function append
+	 *  @parent jQuery.View
+	 *  abc
+	 */
+	"append",
+	/**
+	 *  @function after
+	 *  @parent jQuery.View
+	 *  abc
+	 */
+	"after",
+	/**
+	 *  @function before
+	 *  @parent jQuery.View
+	 *  abc
+	 */
+	"before",
+	/**
+	 *  @function text
+	 *  @parent jQuery.View
+	 *  abc
+	 */
+	"text",
+	/**
+	 *  @function html
+	 *  @parent jQuery.View
+	 *  abc
+	 */
+	"html",
+	/**
+	 *  @function replaceWith
+	 *  @parent jQuery.View
+	 *  abc
+	 */
+	"replaceWith", 
+	"val"];
+
+	//go through helper funcs and convert
+	for ( var i = 0; i < funcs.length; i++ ) {
+		convert(funcs[i]);
+	}
+
+})(jQuery);
+
+//jquery.lang.js
+
+(function( $ ) {
+	// Several of the methods in this plugin use code adapated from Prototype
+	//  Prototype JavaScript framework, version 1.6.0.1
+	//  (c) 2005-2007 Sam Stephenson
+	var regs = {
+		undHash: /_|-/,
+		colons: /::/,
+		words: /([A-Z]+)([A-Z][a-z])/g,
+		lowUp: /([a-z\d])([A-Z])/g,
+		dash: /([a-z\d])([A-Z])/g,
+		replacer: /\{([^\}]+)\}/g,
+		dot: /\./
+	},
+		getNext = function(current, nextPart, add){
+			return current[nextPart] || ( add && (current[nextPart] = {}) );
+		},
+		isContainer = function(current){
+			var type = typeof current;
+			return type && (  type == 'function' || type == 'object' );
+		},
+		getObject = function( objectName, roots, add ) {
+			
+			var parts = objectName ? objectName.split(regs.dot) : [],
+				length =  parts.length,
+				currents = $.isArray(roots) ? roots : [roots || window],
+				current,
+				ret, 
+				i,
+				c = 0,
+				type;
+			
+			if(length == 0){
+				return currents[0];
+			}
+			while(current = currents[c++]){
+				for (i =0; i < length - 1 && isContainer(current); i++ ) {
+					current = getNext(current, parts[i], add);
+				}
+				if( isContainer(current) ) {
+					
+					ret = getNext(current, parts[i], add); 
+					
+					if( ret !== undefined ) {
+						
+						if ( add === false ) {
+							delete current[parts[i]];
+						}
+						return ret;
+						
+					}
+					
+				}
+			}
+		},
+
+		/** 
+		 * @class jQuery.String
+		 * 
+		 * A collection of useful string helpers.
+		 * 
+		 */
+		str = $.String = $.extend( $.String || {} , {
+			/**
+			 * @function
+			 * Gets an object from a string.
+			 * @param {String} name the name of the object to look for
+			 * @param {Array} [roots] an array of root objects to look for the name
+			 * @param {Boolean} [add] true to add missing objects to 
+			 *  the path. false to remove found properties. undefined to 
+			 *  not modify the root object
+			 */
+			getObject : getObject,
+			/**
+			 * Capitalizes a string
+			 * @param {String} s the string.
+			 * @return {String} a string with the first character capitalized.
+			 */
+			capitalize: function( s, cache ) {
+				return s.charAt(0).toUpperCase() + s.substr(1);
+			},
+			/**
+			 * Capitalizes a string from something undercored. Examples:
+			 * @codestart
+			 * jQuery.String.camelize("one_two") //-> "oneTwo"
+			 * "three-four".camelize() //-> threeFour
+			 * @codeend
+			 * @param {String} s
+			 * @return {String} a the camelized string
+			 */
+			camelize: function( s ) {
+				s = str.classize(s);
+				return s.charAt(0).toLowerCase() + s.substr(1);
+			},
+			/**
+			 * Like camelize, but the first part is also capitalized
+			 * @param {String} s
+			 * @return {String} the classized string
+			 */
+			classize: function( s , join) {
+				var parts = s.split(regs.undHash),
+					i = 0;
+				for (; i < parts.length; i++ ) {
+					parts[i] = str.capitalize(parts[i]);
+				}
+
+				return parts.join(join || '');
+			},
+			/**
+			 * Like [jQuery.String.classize|classize], but a space separates each 'word'
+			 * @codestart
+			 * jQuery.String.niceName("one_two") //-> "One Two"
+			 * @codeend
+			 * @param {String} s
+			 * @return {String} the niceName
+			 */
+			niceName: function( s ) {
+				str.classize(parts[i],' ');
+			},
+
+			/**
+			 * Underscores a string.
+			 * @codestart
+			 * jQuery.String.underscore("OneTwo") //-> "one_two"
+			 * @codeend
+			 * @param {String} s
+			 * @return {String} the underscored string
+			 */
+			underscore: function( s ) {
+				return s.replace(regs.colons, '/').replace(regs.words, '$1_$2').replace(regs.lowUp, '$1_$2').replace(regs.dash, '_').toLowerCase();
+			},
+			/**
+			 * Returns a string with {param} replaced values from data.
+			 * 
+			 *     $.String.sub("foo {bar}",{bar: "far"})
+			 *     //-> "foo far"
+			 *     
+			 * @param {String} s The string to replace
+			 * @param {Object} data The data to be used to look for properties.  If it's an array, multiple
+			 * objects can be used.
+			 * @param {Boolean} [remove] if a match is found, remove the property from the object
+			 */
+			sub: function( s, data, remove ) {
+				var obs = [];
+				obs.push(s.replace(regs.replacer, function( whole, inside ) {
+					//convert inside to type
+					var ob = getObject(inside, data, typeof remove == 'boolean' ? !remove : remove),
+						type = typeof ob;
+					if((type === 'object' || type === 'function') && type !== null){
+						obs.push(ob);
+						return "";
+					}else{
+						return ""+ob;
+					}
+				}));
+				return obs.length <= 1 ? obs[0] : obs;
+			}
+		});
+
+})(jQuery);
+
+//jquery.lang.rsplit.js
+
+(function( $ ) {
+	/**
+	 * @add jQuery.String
+	 */
+	$.String.
+	/**
+	 * Splits a string with a regex correctly cross browser
+	 * 
+	 *     $.String.rsplit("a.b.c.d", /\./) //-> ['a','b','c','d']
+	 * 
+	 * @param {String} string The string to split
+	 * @param {RegExp} regex A regular expression
+	 * @return {Array} An array of strings
+	 */
+	rsplit = function( string, regex ) {
+		var result = regex.exec(string),
+			retArr = [],
+			first_idx, last_idx;
+		while ( result !== null ) {
+			first_idx = result.index;
+			last_idx = regex.lastIndex;
+			if ( first_idx !== 0 ) {
+				retArr.push(string.substring(0, first_idx));
+				string = string.slice(first_idx);
+			}
+			retArr.push(result[0]);
+			string = string.slice(result[0].length);
+			result = regex.exec(string);
+		}
+		if ( string !== '' ) {
+			retArr.push(string);
+		}
+		return retArr;
+	};
+})(jQuery);
+
+//jquery.view.ejs.js
+
+(function( $ ) {
+	var myEval = function(script){
+			eval(script);
+		},
+		chop = function( string ) {
+			return string.substr(0, string.length - 1);
+		},
+		rSplit = $.String.rsplit,
+		extend = $.extend,
+		isArray = $.isArray,
+		clean = function( content ) {
+				return content.replace(/\\/g, '\\\\').replace(/\n/g, '\\n').replace(/"/g, '\\"');
+		}
+		// from prototype  http://www.prototypejs.org/
+		escapeHTML = function(content){
+			return content.replace(/&/g,'&amp;')
+					.replace(/</g,'&lt;')
+					.replace(/>/g,'&gt;')
+					.replace(/"/g, '&#34;')
+					.replace(/'/g, "&#39;");
+		},
+		EJS = function( options ) {
+			//returns a renderer function
+			if ( this.constructor != EJS ) {
+				var ejs = new EJS(options);
+				return function( data, helpers ) {
+					return ejs.render(data, helpers);
+				};
+			}
+			//so we can set the processor
+			if ( typeof options == "function" ) {
+				this.template = {};
+				this.template.process = options;
+				return;
+			}
+			//set options on self
+			extend(this, EJS.options, options);
+			this.template = compile(this.text, this.type, this.name);
+		};
+	/**
+	 * @class jQuery.EJS
+	 * 
+	 * @plugin jquery/view/ejs
+	 * @parent jQuery.View
+	 * @download  http://jmvcsite.heroku.com/pluginify?plugins[]=jquery/view/ejs/ejs.js
+	 * @test jquery/view/ejs/qunit.html
+	 * 
+	 * 
+	 * Ejs provides <a href="http://www.ruby-doc.org/stdlib/libdoc/erb/rdoc/">ERB</a> 
+	 * style client side templates.  Use them with controllers to easily build html and inject
+	 * it into the DOM.
+	 * 
+	 * ###  Example
+	 * 
+	 * The following generates a list of tasks:
+	 * 
+	 * @codestart html
+	 * &lt;ul>
+	 * &lt;% for(var i = 0; i < tasks.length; i++){ %>
+	 *     &lt;li class="task &lt;%= tasks[i].identity %>">&lt;%= tasks[i].name %>&lt;/li>
+	 * &lt;% } %>
+	 * &lt;/ul>
+	 * @codeend
+	 * 
+	 * For the following examples, we assume this view is in <i>'views\tasks\list.ejs'</i>.
+	 * 
+	 * 
+	 * ## Use
+	 * 
+	 * ### Loading and Rendering EJS:
+	 * 
+	 * You should use EJS through the helper functions [jQuery.View] provides such as:
+	 * 
+	 *   - [jQuery.fn.after after]
+	 *   - [jQuery.fn.append append]
+	 *   - [jQuery.fn.before before]
+	 *   - [jQuery.fn.html html], 
+	 *   - [jQuery.fn.prepend prepend],
+	 *   - [jQuery.fn.replaceWith replaceWith], and 
+	 *   - [jQuery.fn.text text].
+	 * 
+	 * or [jQuery.Controller.prototype.view].
+	 * 
+	 * ### Syntax
+	 * 
+	 * EJS uses 5 types of tags:
+	 * 
+	 *   - <code>&lt;% CODE %&gt;</code> - Runs JS Code.
+	 *     For example:
+	 *     
+	 *         <% alert('hello world') %>
+	 *     
+	 *   - <code>&lt;%= CODE %&gt;</code> - Runs JS Code and writes the result into the result of the template.
+	 *     For example:
+	 *     
+	 *         <h1><%= 'hello world' %></h1>
+	 *        
+	 *   - <code>&lt;%~ CODE %&gt;</code> - Runs JS Code and writes the _escaped_ result into the result of the template.
+	 *     For example:
+	 *     
+	 *         <%~ 'hello world' %>
+	 *         
+	 *   - <code>&lt;%%= CODE %&gt;</code> - Writes <%= CODE %> to the result of the template.  This is very useful for generators.
+	 *     
+	 *         <%%= 'hello world' %>
+	 *         
+	 *   - <code>&lt;%# CODE %&gt;</code> - Used for comments.  This does nothing.
+	 *     
+	 *         <%# 'hello world' %>
+	 *        
+	 * ## Hooking up controllers
+	 * 
+	 * After drawing some html, you often want to add other widgets and plugins inside that html.
+	 * View makes this easy.  You just have to return the Contoller class you want to be hooked up.
+	 * 
+	 * @codestart
+	 * &lt;ul &lt;%= Mxui.Tabs%>>...&lt;ul>
+	 * @codeend
+	 * 
+	 * You can even hook up multiple controllers:
+	 * 
+	 * @codestart
+	 * &lt;ul &lt;%= [Mxui.Tabs, Mxui.Filler]%>>...&lt;ul>
+	 * @codeend
+	 * 
+	 * <h2>View Helpers</h2>
+	 * View Helpers return html code.  View by default only comes with 
+	 * [jQuery.EJS.Helpers.prototype.view view] and [jQuery.EJS.Helpers.prototype.text text].
+	 * You can include more with the view/helpers plugin.  But, you can easily make your own!
+	 * Learn how in the [jQuery.EJS.Helpers Helpers] page.
+	 * 
+	 * @constructor Creates a new view
+	 * @param {Object} options A hash with the following options
+	 * <table class="options">
+	 *     <tbody><tr><th>Option</th><th>Default</th><th>Description</th></tr>
+	 *     <tr>
+	 *      <td>url</td>
+	 *      <td>&nbsp;</td>
+	 *      <td>loads the template from a file.  This path should be relative to <i>[jQuery.root]</i>.
+	 *      </td>
+	 *     </tr>
+	 *     <tr>
+	 *      <td>text</td>
+	 *      <td>&nbsp;</td>
+	 *      <td>uses the provided text as the template. Example:<br/><code>new View({text: '&lt;%=user%>'})</code>
+	 *      </td>
+	 *     </tr>
+	 *     <tr>
+	 *      <td>element</td>
+	 *      <td>&nbsp;</td>
+	 *      <td>loads a template from the innerHTML or value of the element.
+	 *      </td>
+	 *     </tr>
+	 *     <tr>
+	 *      <td>type</td>
+	 *      <td>'<'</td>
+	 *      <td>type of magic tags.  Options are '&lt;' or '['
+	 *      </td>
+	 *     </tr>
+	 *     <tr>
+	 *      <td>name</td>
+	 *      <td>the element ID or url </td>
+	 *      <td>an optional name that is used for caching.
+	 *      </td>
+	 *     </tr>
+	 *     <tr>
+	 *      <td>cache</td>
+	 *      <td>true in production mode, false in other modes</td>
+	 *      <td>true to cache template.
+	 *      </td>
+	 *     </tr>
+	 *     
+	 *    </tbody></table>
+	 */
+	$.EJS = EJS;
+	/** 
+	 * @Prototype
+	 */
+	EJS.prototype = {
+		constructor: EJS,
+		/**
+		 * Renders an object with extra view helpers attached to the view.
+		 * @param {Object} object data to be rendered
+		 * @param {Object} extra_helpers an object with additonal view helpers
+		 * @return {String} returns the result of the string
+		 */
+		render: function( object, extraHelpers ) {
+			object = object || {};
+			this._extra_helpers = extraHelpers;
+			var v = new EJS.Helpers(object, extraHelpers || {});
+			return this.template.process.call(object, object, v);
+		}
+	};
+	/* @Static */
+
+
+	EJS.
+	/**
+	 * Used to convert what's in &lt;%= %> magic tags to a string
+	 * to be inserted in the rendered output.
+	 * 
+	 * Typically, it's a string, and the string is just inserted.  However,
+	 * if it's a function or an object with a hookup method, it can potentially be 
+	 * be ran on the element after it's inserted into the page.
+	 * 
+	 * This is a very nice way of adding functionality through the view.
+	 * Usually this is done with [jQuery.EJS.Helpers.prototype.plugin]
+	 * but the following fades in the div element after it has been inserted:
+	 * 
+	 * @codestart
+	 * &lt;%= function(el){$(el).fadeIn()} %>
+	 * @codeend
+	 * 
+	 * @param {String|Object|Function} input the value in between the
+	 * write majic tags: &lt;%= %>
+	 * @return {String} returns the content to be added to the rendered
+	 * output.  The content is different depending on the type:
+	 * 
+	 *   * string - a bac
+	 *   * foo - bar
+	 */
+	text = function( input ) {
+		if ( typeof input == 'string' ) {
+			return input;
+		}
+		if ( input === null || input === undefined ) {
+			return '';
+		}
+		var hook = 
+			(input.hookup && function( el, id ) {
+				input.hookup.call(input, el, id);
+			}) 
+			||
+			(typeof input == 'function' && input)
+			||
+			(isArray(input) && function( el, id ) {
+				for ( var i = 0; i < input.length; i++ ) {
+					var stub;
+					stub = input[i].hookup ? input[i].hookup(el, id) : input[i](el, id);
+				}
+			});
+		if(hook){
+			return "data-view-id='" + $.View.hookup(hook) + "'";
+		}
+		return input.toString ? input.toString() : "";
+	};
+	EJS.clean = function(text){
+		//return sanatized text
+		if(typeof text == 'string'){
+			return escapeHTML(text)
+		}else{
+			return "";
+		}
+	}
+	//returns something you can call scan on
+	var scan = function(scanner, source, block ) {
+		var source_split = rSplit(source, /\n/),
+			i=0;
+		for (; i < source_split.length; i++ ) {
+			scanline(scanner,  source_split[i], block);
+		}
+		
+	},
+	scanline= function(scanner,  line, block ) {
+		scanner.lines++;
+		var line_split = rSplit(line, scanner.splitter),
+			token;
+		for ( var i = 0; i < line_split.length; i++ ) {
+			token = line_split[i];
+			if ( token !== null ) {
+				block(token, scanner);
+			}
+		}
+	},
+	makeScanner = function(left, right){
+		var scanner = {};
+		extend(scanner, {
+			left: left + '%',
+			right: '%' + right,
+			dLeft: left + '%%',
+			dRight: '%%' + right,
+			eeLeft : left + '%==',
+			eLeft: left + '%=',
+			cmnt: left + '%#',
+			cleanLeft: left+"%~",
+			scan : scan,
+			lines : 0
+		});
+		scanner.splitter = new RegExp("(" + [scanner.dLeft, scanner.dRight, scanner.eeLeft, scanner.eLeft, scanner.cleanLeft,
+		scanner.cmnt, scanner.left, scanner.right + '\n', scanner.right, '\n'].join(")|(").
+			replace(/\[/g,"\\[").replace(/\]/g,"\\]") + ")");
+		return scanner;
+	},
+	// compiles a template
+	compile = function( source, left, name ) {
+		source = source.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
+		//normalize line endings
+		left = left || '<';
+		var put_cmd = "___v1ew.push(",
+			insert_cmd = put_cmd,
+			buff = new EJS.Buffer(['var ___v1ew = [];'], []),
+			content = '',
+			put = function( content ) {
+				buff.push(put_cmd, '"', clean(content), '");');
+			},
+			startTag = null,
+			empty = function(){
+				content = ''
+			};
+		
+		scan( makeScanner(left, left === '[' ? ']' : '>') , 
+			source||"", 
+			function( token, scanner ) {
+				// if we don't have a start pair
+				if ( startTag === null ) {
+					switch ( token ) {
+					case '\n':
+						content = content + "\n";
+						put(content);
+						buff.cr();
+						empty();
+						break;
+					case scanner.left:
+					case scanner.eLeft:
+					case scanner.eeLeft:
+					case scanner.cleanLeft:
+					case scanner.cmnt:
+						startTag = token;
+						if ( content.length > 0 ) {
+							put(content);
+						}
+						empty();
+						break;
+
+						// replace <%% with <%
+					case scanner.dLeft:
+						content += scanner.left;
+						break;
+					default:
+						content +=  token;
+						break;
+					}
+				}
+				else {
+					switch ( token ) {
+					case scanner.right:
+						switch ( startTag ) {
+						case scanner.left:
+							if ( content[content.length - 1] == '\n' ) {
+								content = chop(content);
+								buff.push(content, ";");
+								buff.cr();
+							}
+							else {
+								buff.push(content, ";");
+							}
+							break;
+						case scanner.cleanLeft : 
+							buff.push(insert_cmd, "(jQuery.EJS.clean(", content, ")));");
+							break;
+						case scanner.eLeft:
+							buff.push(insert_cmd, "(jQuery.EJS.text(", content, ")));");
+							break;
+						case scanner.eeLeft:
+							buff.push(insert_cmd, "(jQuery.EJS.text(", content, ")));");
+							break;
+						}
+						startTag = null;
+						empty();
+						break;
+					case scanner.dRight:
+						content += scanner.right;
+						break;
+					default:
+						content += token;
+						break;
+					}
+				}
+			})
+		if ( content.length > 0 ) {
+			// Should be content.dump in Ruby
+			buff.push(put_cmd, '"', clean(content) + '");');
+		}
+		var template = buff.close(),
+			out = {
+				out : 'try { with(_VIEW) { with (_CONTEXT) {' + template + " return ___v1ew.join('');}}}catch(e){e.lineNumber=null;throw e;}"
+			};
+		//use eval instead of creating a function, b/c it is easier to debug
+		myEval.call(out,'this.process = (function(_CONTEXT,_VIEW){' + out.out + '});\r\n//@ sourceURL='+name+".js");
+		return out;
+	};
+
+
+	// a line and script buffer
+	// we use this so we know line numbers when there
+	// is an error.  
+	// pre and post are setup and teardown for the buffer
+	EJS.Buffer = function( pre_cmd, post ) {
+		this.line = [];
+		this.script = [];
+		this.post = post;
+
+		// add the pre commands to the first line
+		this.push.apply(this, pre_cmd);
+	};
+	EJS.Buffer.prototype = {
+		//need to maintain your own semi-colons (for performance)
+		push: function() {
+			this.line.push.apply(this.line, arguments);
+		},
+
+		cr: function() {
+			this.script.push(this.line.join(''), "\n");
+			this.line = [];
+		},
+		//returns the script too
+		close: function() {
+			var stub;
+
+			if ( this.line.length > 0 ) {
+				this.script.push(this.line.join(''));
+				this.line = [];
+			}
+
+			stub = this.post.length && this.push.apply(this, this.post);
+
+			this.script.push(";"); //makes sure we always have an ending /
+			return this.script.join("");
+		}
+
+	};
+	
+
+	//type, cache, folder
+	/**
+	 * @attribute options
+	 * Sets default options for all views
+	 * <table class="options">
+	 * <tbody><tr><th>Option</th><th>Default</th><th>Description</th></tr>
+	 * <tr>
+	 * <td>type</td>
+	 * <td>'<'</td>
+	 * <td>type of magic tags.  Options are '&lt;' or '['
+	 * </td>
+	 * </tr>
+	 * <tr>
+	 * <td>cache</td>
+	 * <td>true in production mode, false in other modes</td>
+	 * <td>true to cache template.
+	 * </td>
+	 * </tr>
+	 * </tbody></table>
+	 * 
+	 */
+	EJS.options = {
+		type: '<',
+		ext: '.ejs'
+	};
+
+
+
+
+	/**
+	 * @class jQuery.EJS.Helpers
+	 * @parent jQuery.EJS
+	 * By adding functions to jQuery.EJS.Helpers.prototype, those functions will be available in the 
+	 * views.
+	 * @constructor Creates a view helper.  This function is called internally.  You should never call it.
+	 * @param {Object} data The data passed to the view.  Helpers have access to it through this._data
+	 */
+	EJS.Helpers = function( data, extras ) {
+		this._data = data;
+		this._extras = extras;
+		extend(this, extras);
+	};
+	/* @prototype*/
+	EJS.Helpers.prototype = {
+		/**
+		 * Hooks up a jQuery plugin on.
+		 * @param {String} name the plugin name
+		 */
+		plugin: function( name ) {
+			var args = $.makeArray(arguments),
+				widget = args.shift();
+			return function( el ) {
+				var jq = $(el);
+				jq[widget].apply(jq, args);
+			};
+		},
+		/**
+		 * Renders a partial view.  This is deprecated in favor of <code>$.View()</code>.
+		 */
+		view: function( url, data, helpers ) {
+			helpers = helpers || this._extras;
+			data = data || this._data;
+			return $.View(url, data, helpers); //new EJS(options).render(data, helpers);
+		}
+	};
+
+
+	$.View.register({
+		suffix: "ejs",
+		//returns a function that renders the view
+		script: function( id, src ) {
+			return "jQuery.EJS(function(_CONTEXT,_VIEW) { " + new EJS({
+				text: src
+			}).template.out + " })";
+		},
+		renderer: function( id, text ) {
+			var ejs = new EJS({
+				text: text,
+				name: id
+			});
+			return function( data, helpers ) {
+				return ejs.render.call(ejs, data, helpers);
+			};
+		}
+	});
+})(jQuery);
Index: trunk/prototype/plugins/view/jquerymx-1.0.custom.min.js
===================================================================
--- trunk/prototype/plugins/view/jquerymx-1.0.custom.min.js	(revision 5136)
+++ trunk/prototype/plugins/view/jquerymx-1.0.custom.min.js	(revision 5136)
@@ -0,0 +1,19 @@
+(function(i){var x=function(a){return a.replace(/^\/\//,"").replace(/[\/\.]/g,"_")},y=1,e,o,p;isDeferred=function(a){return a&&i.isFunction(a.always)};getDeferreds=function(a){var b=[];if(isDeferred(a))return[a];else for(var c in a)isDeferred(a[c])&&b.push(a[c]);return b};usefulPart=function(a){return i.isArray(a)&&a.length===3&&a[1]==="success"?a[0]:a};e=i.View=function(a,b,c,d){if(typeof c==="function"){d=c;c=undefined}var f=getDeferreds(b);if(f.length){var g=i.Deferred();f.push(p(a,true));i.when.apply(i,
+f).then(function(j){var k=i.makeArray(arguments),l=k.pop()[0];if(isDeferred(b))b=usefulPart(j);else for(var m in b)if(isDeferred(b[m]))b[m]=usefulPart(k.shift());k=l(b,c);g.resolve(k);d&&d(k)});return g.promise()}else{var h;f=typeof d==="function";g=p(a,f);if(f){h=g;g.done(function(j){d(j(b,c))})}else g.done(function(j){h=j(b,c)});return h}};o=function(a,b){if(!a.match(/[^\s]/))throw"$.View ERROR: There is no template or an empty template at "+b;};p=function(a,b){return i.ajax({url:a,dataType:"view",
+async:b})};i.ajaxTransport("view",function(a,b){a=b.url;var c=a.match(/\.[\w\d]+$/),d,f,g,h=a,j,k=function(l){l=d.renderer(g,l);if(e.cache)e.cached[g]=l;return{view:l}};if(f=document.getElementById(a))c=f.type.match(/\/[\d\w]+$/)[0].replace(/^\//,".");if(!c){c=e.ext;h+=e.ext}g=x(h);if(h.match(/^\/\//))h=typeof steal==="undefined"?"/"+h.substr(2):steal.root.join(h.substr(2));d=e.types[c];return{send:function(l,m){if(e.cached[g])return m(200,"success",{view:e.cached[g]});else if(f)m(200,"success",k(f.innerHTML));
+else j=i.ajax({async:b.async,url:h,dataType:"text",error:function(){o("",h);m(404)},success:function(s){o(s,h);m(200,"success",k(s))}})},abort:function(){j&&j.abort()}}});i.extend(e,{hookups:{},hookup:function(a){var b=++y;e.hookups[b]=a;return b},cached:{},cache:true,register:function(a){this.types["."+a.suffix]=a},types:{},ext:".ejs",registerScript:function(a,b,c){return"$.View.preload('"+b+"',"+e.types["."+a].script(b,c)+");"},preload:function(a,b){e.cached[a]=function(c,d){return b.call(c,c,d)}}});
+var t,n,u,v,w,q;t=function(a){var b=i.fn[a];i.fn[a]=function(){var c=i.makeArray(arguments),d,f,g=this;if(u(c)){if(d=v(c)){f=c[d];c[d]=function(h){n.call(g,[h],b);f.call(g,h)};e.apply(e,c);return this}c=e.apply(e,c);if(isDeferred(c)){c.done(function(h){n.call(g,[h],b)});return this}else c=[c]}return n.call(this,c,b)}};n=function(a,b){var c;for(var d in e.hookups)break;if(d){c=e.hookups;e.hookups={};a[0]=i(a[0])}b=b.apply(this,a);d&&w(a[0],c);return b};u=function(a){var b=typeof a[1];return typeof a[0]==
+"string"&&(b=="object"||b=="function")&&!a[1].nodeType&&!a[1].jquery};v=function(a){return typeof a[3]==="function"?3:typeof a[2]==="function"&&2};w=function(a,b){var c,d=0,f,g;a=a.filter(function(){return this.nodeType!=3});a=a.add("[data-view-id]",a);for(c=a.length;d<c;d++)if(a[d].getAttribute&&(f=a[d].getAttribute("data-view-id"))&&(g=b[f])){g(a[d],f);delete b[f];a[d].removeAttribute("data-view-id")}i.extend(e.hookups,b)};q=["prepend","append","after","before","text","html","replaceWith","val"];
+for(var r=0;r<q.length;r++)t(q[r])})(jQuery);
+(function(j){var g={undHash:/_|-/,colons:/::/,words:/([A-Z]+)([A-Z][a-z])/g,lowUp:/([a-z\d])([A-Z])/g,dash:/([a-z\d])([A-Z])/g,replacer:/\{([^\}]+)\}/g,dot:/\./},l=function(a,c,b){return a[c]||b&&(a[c]={})},m=function(a){return(a=typeof a)&&(a=="function"||a=="object")},n=function(a,c,b){a=a?a.split(g.dot):[];var f=a.length;c=j.isArray(c)?c:[c||window];var d,e,h,o=0;if(f==0)return c[0];for(;d=c[o++];){for(h=0;h<f-1&&m(d);h++)d=l(d,a[h],b);if(m(d)){e=l(d,a[h],b);if(e!==undefined){b===false&&delete d[a[h]];
+return e}}}},k=j.String=j.extend(j.String||{},{getObject:n,capitalize:function(a){return a.charAt(0).toUpperCase()+a.substr(1)},camelize:function(a){a=k.classize(a);return a.charAt(0).toLowerCase()+a.substr(1)},classize:function(a,c){a=a.split(g.undHash);for(var b=0;b<a.length;b++)a[b]=k.capitalize(a[b]);return a.join(c||"")},niceName:function(){k.classize(parts[i]," ")},underscore:function(a){return a.replace(g.colons,"/").replace(g.words,"$1_$2").replace(g.lowUp,"$1_$2").replace(g.dash,"_").toLowerCase()},
+sub:function(a,c,b){var f=[];f.push(a.replace(g.replacer,function(d,e){d=n(e,c,typeof b=="boolean"?!b:b);e=typeof d;if((e==="object"||e==="function")&&e!==null){f.push(d);return""}else return""+d}));return f.length<=1?f[0]:f}})})(jQuery);
+(function(f){f.String.rsplit=function(a,e){for(var b=e.exec(a),c=[],d;b!==null;){d=b.index;if(d!==0){c.push(a.substring(0,d));a=a.slice(d)}c.push(b[0]);a=a.slice(b[0].length);b=e.exec(a)}a!==""&&c.push(a);return c}})(jQuery);
+(function(g){var p=function(a){eval(a)},q=function(a){return a.substr(0,a.length-1)},l=g.String.rsplit,j=g.extend,r=g.isArray,m=function(a){return a.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/"/g,'\\"')};escapeHTML=function(a){return a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&#34;").replace(/'/g,"&#39;")};EJS=function(a){if(this.constructor!=EJS){var b=new EJS(a);return function(c,e){return b.render(c,e)}}if(typeof a=="function"){this.template={};this.template.process=
+a}else{j(this,EJS.options,a);this.template=s(this.text,this.type,this.name)}};g.EJS=EJS;EJS.prototype={constructor:EJS,render:function(a,b){a=a||{};this._extra_helpers=b;b=new EJS.Helpers(a,b||{});return this.template.process.call(a,a,b)}};EJS.text=function(a){if(typeof a=="string")return a;if(a===null||a===undefined)return"";var b=a.hookup&&function(c,e){a.hookup.call(a,c,e)}||typeof a=="function"&&a||r(a)&&function(c,e){for(var d=0;d<a.length;d++)a[d].hookup?a[d].hookup(c,e):a[d](c,e)};if(b)return"data-view-id='"+
+g.View.hookup(b)+"'";return a.toString?a.toString():""};EJS.clean=function(a){return typeof a=="string"?escapeHTML(a):""};var n=function(a,b,c){b=l(b,/\n/);for(var e=0;e<b.length;e++)t(a,b[e],c)},t=function(a,b,c){a.lines++;b=l(b,a.splitter);for(var e,d=0;d<b.length;d++){e=b[d];e!==null&&c(e,a)}},u=function(a,b){var c={};j(c,{left:a+"%",right:"%"+b,dLeft:a+"%%",dRight:"%%"+b,eeLeft:a+"%==",eLeft:a+"%=",cmnt:a+"%#",cleanLeft:a+"%~",scan:n,lines:0});c.splitter=new RegExp("("+[c.dLeft,c.dRight,c.eeLeft,
+c.eLeft,c.cleanLeft,c.cmnt,c.left,c.right+"\n",c.right,"\n"].join(")|(").replace(/\[/g,"\\[").replace(/\]/g,"\\]")+")");return c},s=function(a,b,c){a=a.replace(/\r\n/g,"\n").replace(/\r/g,"\n");b=b||"<";var e=new EJS.Buffer(["var ___v1ew = [];"],[]),d="",o=function(h){e.push("___v1ew.push(",'"',m(h),'");')},i=null,k=function(){d=""};n(u(b,b==="["?"]":">"),a||"",function(h,f){if(i===null)switch(h){case "\n":d+="\n";o(d);e.cr();k();break;case f.left:case f.eLeft:case f.eeLeft:case f.cleanLeft:case f.cmnt:i=
+h;d.length>0&&o(d);k();break;case f.dLeft:d+=f.left;break;default:d+=h;break}else switch(h){case f.right:switch(i){case f.left:if(d[d.length-1]=="\n"){d=q(d);e.push(d,";");e.cr()}else e.push(d,";");break;case f.cleanLeft:e.push("___v1ew.push(","(jQuery.EJS.clean(",d,")));");break;case f.eLeft:e.push("___v1ew.push(","(jQuery.EJS.text(",d,")));");break;case f.eeLeft:e.push("___v1ew.push(","(jQuery.EJS.text(",d,")));");break}i=null;k();break;case f.dRight:d+=f.right;break;default:d+=h;break}});d.length>
+0&&e.push("___v1ew.push(",'"',m(d)+'");');a={out:"try { with(_VIEW) { with (_CONTEXT) {"+e.close()+" return ___v1ew.join('');}}}catch(e){e.lineNumber=null;throw e;}"};p.call(a,"this.process = (function(_CONTEXT,_VIEW){"+a.out+"});\r\n//@ sourceURL="+c+".js");return a};EJS.Buffer=function(a,b){this.line=[];this.script=[];this.post=b;this.push.apply(this,a)};EJS.Buffer.prototype={push:function(){this.line.push.apply(this.line,arguments)},cr:function(){this.script.push(this.line.join(""),"\n");this.line=
+[]},close:function(){if(this.line.length>0){this.script.push(this.line.join(""));this.line=[]}this.post.length&&this.push.apply(this,this.post);this.script.push(";");return this.script.join("")}};EJS.options={type:"<",ext:".ejs"};EJS.Helpers=function(a,b){this._data=a;this._extras=b;j(this,b)};EJS.Helpers.prototype={plugin:function(){var a=g.makeArray(arguments),b=a.shift();return function(c){c=g(c);c[b].apply(c,a)}},view:function(a,b,c){c=c||this._extras;b=b||this._data;return g.View(a,b,c)}};g.View.register({suffix:"ejs",
+script:function(a,b){return"jQuery.EJS(function(_CONTEXT,_VIEW) { "+(new EJS({text:b})).template.out+" })"},renderer:function(a,b){var c=new EJS({text:b,name:a});return function(e,d){return c.render.call(c,e,d)}}})})(jQuery);
Index: trunk/prototype/plugins/qtip/LICENSE
===================================================================
--- trunk/prototype/plugins/qtip/LICENSE	(revision 5341)
+++ trunk/prototype/plugins/qtip/LICENSE	(revision 5341)
@@ -0,0 +1,7 @@
+Copyright Â© 2009 Craig Thompson
+
+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. 
Index: trunk/prototype/plugins/qtip/REQUIREMENTS
===================================================================
--- trunk/prototype/plugins/qtip/REQUIREMENTS	(revision 5341)
+++ trunk/prototype/plugins/qtip/REQUIREMENTS	(revision 5341)
@@ -0,0 +1,5 @@
+JQUERY IS REQUIRED FOR USE OF THIS PLUGIN
+
+You can grab the latest version here: http://jquery.com
+
+We recommend version 1.3 due to its significant speed increases in several areas, but qTip supports the use of jQuery version 1.2.6 and above for all you who have decided not to upgrade.
Index: trunk/prototype/plugins/qtip/jquery.qtip-1.0.0-rc3.min.js
===================================================================
--- trunk/prototype/plugins/qtip/jquery.qtip-1.0.0-rc3.min.js	(revision 5341)
+++ trunk/prototype/plugins/qtip/jquery.qtip-1.0.0-rc3.min.js	(revision 5341)
@@ -0,0 +1,15 @@
+/*
+ * jquery.qtip. The jQuery tooltip plugin
+ *
+ * Copyright (c) 2009 Craig Thompson
+ * http://craigsworks.com
+ *
+ * Licensed under MIT
+ * http://www.opensource.org/licenses/mit-license.php
+ *
+ * Launch  : February 2009
+ * Version : 1.0.0-rc3
+ * Released: Tuesday 12th May, 2009 - 00:00
+ * Debug: jquery.qtip.debug.js
+ */
+(function(f){f.fn.qtip=function(B,u){var y,t,A,s,x,w,v,z;if(typeof B=="string"){if(typeof f(this).data("qtip")!=="object"){f.fn.qtip.log.error.call(self,1,f.fn.qtip.constants.NO_TOOLTIP_PRESENT,false)}if(B=="api"){return f(this).data("qtip").interfaces[f(this).data("qtip").current]}else{if(B=="interfaces"){return f(this).data("qtip").interfaces}}}else{if(!B){B={}}if(typeof B.content!=="object"||(B.content.jquery&&B.content.length>0)){B.content={text:B.content}}if(typeof B.content.title!=="object"){B.content.title={text:B.content.title}}if(typeof B.position!=="object"){B.position={corner:B.position}}if(typeof B.position.corner!=="object"){B.position.corner={target:B.position.corner,tooltip:B.position.corner}}if(typeof B.show!=="object"){B.show={when:B.show}}if(typeof B.show.when!=="object"){B.show.when={event:B.show.when}}if(typeof B.show.effect!=="object"){B.show.effect={type:B.show.effect}}if(typeof B.hide!=="object"){B.hide={when:B.hide}}if(typeof B.hide.when!=="object"){B.hide.when={event:B.hide.when}}if(typeof B.hide.effect!=="object"){B.hide.effect={type:B.hide.effect}}if(typeof B.style!=="object"){B.style={name:B.style}}B.style=c(B.style);s=f.extend(true,{},f.fn.qtip.defaults,B);s.style=a.call({options:s},s.style);s.user=f.extend(true,{},B)}return f(this).each(function(){if(typeof B=="string"){w=B.toLowerCase();A=f(this).qtip("interfaces");if(typeof A=="object"){if(u===true&&w=="destroy"){while(A.length>0){A[A.length-1].destroy()}}else{if(u!==true){A=[f(this).qtip("api")]}for(y=0;y<A.length;y++){if(w=="destroy"){A[y].destroy()}else{if(A[y].status.rendered===true){if(w=="show"){A[y].show()}else{if(w=="hide"){A[y].hide()}else{if(w=="focus"){A[y].focus()}else{if(w=="disable"){A[y].disable(true)}else{if(w=="enable"){A[y].disable(false)}}}}}}}}}}}else{v=f.extend(true,{},s);v.hide.effect.length=s.hide.effect.length;v.show.effect.length=s.show.effect.length;if(v.position.container===false){v.position.container=f(document.body)}if(v.position.target===false){v.position.target=f(this)}if(v.show.when.target===false){v.show.when.target=f(this)}if(v.hide.when.target===false){v.hide.when.target=f(this)}t=f.fn.qtip.interfaces.length;for(y=0;y<t;y++){if(typeof f.fn.qtip.interfaces[y]=="undefined"){t=y;break}}x=new d(f(this),v,t);f.fn.qtip.interfaces[t]=x;if(typeof f(this).data("qtip")=="object"){if(typeof f(this).attr("qtip")==="undefined"){f(this).data("qtip").current=f(this).data("qtip").interfaces.length}f(this).data("qtip").interfaces.push(x)}else{f(this).data("qtip",{current:0,interfaces:[x]})}if(v.content.prerender===false&&v.show.when.event!==false&&v.show.ready!==true){v.show.when.target.bind(v.show.when.event+".qtip-"+t+"-create",{qtip:t},function(C){z=f.fn.qtip.interfaces[C.data.qtip];z.options.show.when.target.unbind(z.options.show.when.event+".qtip-"+C.data.qtip+"-create");z.cache.mouse={x:C.pageX,y:C.pageY};p.call(z);z.options.show.when.target.trigger(z.options.show.when.event)})}else{x.cache.mouse={x:v.show.when.target.offset().left,y:v.show.when.target.offset().top};p.call(x)}}})};function d(u,t,v){var s=this;s.id=v;s.options=t;s.status={animated:false,rendered:false,disabled:false,focused:false};s.elements={target:u.addClass(s.options.style.classes.target),tooltip:null,wrapper:null,content:null,contentWrapper:null,title:null,button:null,tip:null,bgiframe:null};s.cache={mouse:{},position:{},toggle:0};s.timers={};f.extend(s,s.options.api,{show:function(y){var x,z;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"show")}if(s.elements.tooltip.css("display")!=="none"){return s}s.elements.tooltip.stop(true,false);x=s.beforeShow.call(s,y);if(x===false){return s}function w(){if(s.options.position.type!=="static"){s.focus()}s.onShow.call(s,y);if(f.browser.msie){s.elements.tooltip.get(0).style.removeAttribute("filter")}}s.cache.toggle=1;if(s.options.position.type!=="static"){s.updatePosition(y,(s.options.show.effect.length>0))}if(typeof s.options.show.solo=="object"){z=f(s.options.show.solo)}else{if(s.options.show.solo===true){z=f("div.qtip").not(s.elements.tooltip)}}if(z){z.each(function(){if(f(this).qtip("api").status.rendered===true){f(this).qtip("api").hide()}})}if(typeof s.options.show.effect.type=="function"){s.options.show.effect.type.call(s.elements.tooltip,s.options.show.effect.length);s.elements.tooltip.queue(function(){w();f(this).dequeue()})}else{switch(s.options.show.effect.type.toLowerCase()){case"fade":s.elements.tooltip.fadeIn(s.options.show.effect.length,w);break;case"slide":s.elements.tooltip.slideDown(s.options.show.effect.length,function(){w();if(s.options.position.type!=="static"){s.updatePosition(y,true)}});break;case"grow":s.elements.tooltip.show(s.options.show.effect.length,w);break;default:s.elements.tooltip.show(null,w);break}s.elements.tooltip.addClass(s.options.style.classes.active)}return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_SHOWN,"show")},hide:function(y){var x;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"hide")}else{if(s.elements.tooltip.css("display")==="none"){return s}}clearTimeout(s.timers.show);s.elements.tooltip.stop(true,false);x=s.beforeHide.call(s,y);if(x===false){return s}function w(){s.onHide.call(s,y)}s.cache.toggle=0;if(typeof s.options.hide.effect.type=="function"){s.options.hide.effect.type.call(s.elements.tooltip,s.options.hide.effect.length);s.elements.tooltip.queue(function(){w();f(this).dequeue()})}else{switch(s.options.hide.effect.type.toLowerCase()){case"fade":s.elements.tooltip.fadeOut(s.options.hide.effect.length,w);break;case"slide":s.elements.tooltip.slideUp(s.options.hide.effect.length,w);break;case"grow":s.elements.tooltip.hide(s.options.hide.effect.length,w);break;default:s.elements.tooltip.hide(null,w);break}s.elements.tooltip.removeClass(s.options.style.classes.active)}return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_HIDDEN,"hide")},updatePosition:function(w,x){var C,G,L,J,H,E,y,I,B,D,K,A,F,z;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"updatePosition")}else{if(s.options.position.type=="static"){return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.CANNOT_POSITION_STATIC,"updatePosition")}}G={position:{left:0,top:0},dimensions:{height:0,width:0},corner:s.options.position.corner.target};L={position:s.getPosition(),dimensions:s.getDimensions(),corner:s.options.position.corner.tooltip};if(s.options.position.target!=="mouse"){if(s.options.position.target.get(0).nodeName.toLowerCase()=="area"){J=s.options.position.target.attr("coords").split(",");for(C=0;C<J.length;C++){J[C]=parseInt(J[C])}H=s.options.position.target.parent("map").attr("name");E=f('img[usemap="#'+H+'"]:first').offset();G.position={left:Math.floor(E.left+J[0]),top:Math.floor(E.top+J[1])};switch(s.options.position.target.attr("shape").toLowerCase()){case"rect":G.dimensions={width:Math.ceil(Math.abs(J[2]-J[0])),height:Math.ceil(Math.abs(J[3]-J[1]))};break;case"circle":G.dimensions={width:J[2]+1,height:J[2]+1};break;case"poly":G.dimensions={width:J[0],height:J[1]};for(C=0;C<J.length;C++){if(C%2==0){if(J[C]>G.dimensions.width){G.dimensions.width=J[C]}if(J[C]<J[0]){G.position.left=Math.floor(E.left+J[C])}}else{if(J[C]>G.dimensions.height){G.dimensions.height=J[C]}if(J[C]<J[1]){G.position.top=Math.floor(E.top+J[C])}}}G.dimensions.width=G.dimensions.width-(G.position.left-E.left);G.dimensions.height=G.dimensions.height-(G.position.top-E.top);break;default:return f.fn.qtip.log.error.call(s,4,f.fn.qtip.constants.INVALID_AREA_SHAPE,"updatePosition");break}G.dimensions.width-=2;G.dimensions.height-=2}else{if(s.options.position.target.add(document.body).length===1){G.position={left:f(document).scrollLeft(),top:f(document).scrollTop()};G.dimensions={height:f(window).height(),width:f(window).width()}}else{if(typeof s.options.position.target.attr("qtip")!=="undefined"){G.position=s.options.position.target.qtip("api").cache.position}else{G.position=s.options.position.target.offset()}G.dimensions={height:s.options.position.target.outerHeight(),width:s.options.position.target.outerWidth()}}}y=f.extend({},G.position);if(G.corner.search(/right/i)!==-1){y.left+=G.dimensions.width}if(G.corner.search(/bottom/i)!==-1){y.top+=G.dimensions.height}if(G.corner.search(/((top|bottom)Middle)|center/)!==-1){y.left+=(G.dimensions.width/2)}if(G.corner.search(/((left|right)Middle)|center/)!==-1){y.top+=(G.dimensions.height/2)}}else{G.position=y={left:s.cache.mouse.x,top:s.cache.mouse.y};G.dimensions={height:1,width:1}}if(L.corner.search(/right/i)!==-1){y.left-=L.dimensions.width}if(L.corner.search(/bottom/i)!==-1){y.top-=L.dimensions.height}if(L.corner.search(/((top|bottom)Middle)|center/)!==-1){y.left-=(L.dimensions.width/2)}if(L.corner.search(/((left|right)Middle)|center/)!==-1){y.top-=(L.dimensions.height/2)}I=(f.browser.msie)?1:0;B=(f.browser.msie&&parseInt(f.browser.version.charAt(0))===6)?1:0;if(s.options.style.border.radius>0){if(L.corner.search(/Left/)!==-1){y.left-=s.options.style.border.radius}else{if(L.corner.search(/Right/)!==-1){y.left+=s.options.style.border.radius}}if(L.corner.search(/Top/)!==-1){y.top-=s.options.style.border.radius}else{if(L.corner.search(/Bottom/)!==-1){y.top+=s.options.style.border.radius}}}if(I){if(L.corner.search(/top/)!==-1){y.top-=I}else{if(L.corner.search(/bottom/)!==-1){y.top+=I}}if(L.corner.search(/left/)!==-1){y.left-=I}else{if(L.corner.search(/right/)!==-1){y.left+=I}}if(L.corner.search(/leftMiddle|rightMiddle/)!==-1){y.top-=1}}if(s.options.position.adjust.screen===true){y=o.call(s,y,G,L)}if(s.options.position.target==="mouse"&&s.options.position.adjust.mouse===true){if(s.options.position.adjust.screen===true&&s.elements.tip){K=s.elements.tip.attr("rel")}else{K=s.options.position.corner.tooltip}y.left+=(K.search(/right/i)!==-1)?-6:6;y.top+=(K.search(/bottom/i)!==-1)?-6:6}if(!s.elements.bgiframe&&f.browser.msie&&parseInt(f.browser.version.charAt(0))==6){f("select, object").each(function(){A=f(this).offset();A.bottom=A.top+f(this).height();A.right=A.left+f(this).width();if(y.top+L.dimensions.height>=A.top&&y.left+L.dimensions.width>=A.left){k.call(s)}})}y.left+=s.options.position.adjust.x;y.top+=s.options.position.adjust.y;F=s.getPosition();if(y.left!=F.left||y.top!=F.top){z=s.beforePositionUpdate.call(s,w);if(z===false){return s}s.cache.position=y;if(x===true){s.status.animated=true;s.elements.tooltip.animate(y,200,"swing",function(){s.status.animated=false})}else{s.elements.tooltip.css(y)}s.onPositionUpdate.call(s,w);if(typeof w!=="undefined"&&w.type&&w.type!=="mousemove"){f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_POSITION_UPDATED,"updatePosition")}}return s},updateWidth:function(w){var x;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"updateWidth")}else{if(w&&typeof w!=="number"){return f.fn.qtip.log.error.call(s,2,"newWidth must be of type number","updateWidth")}}x=s.elements.contentWrapper.siblings().add(s.elements.tip).add(s.elements.button);if(!w){if(typeof s.options.style.width.value=="number"){w=s.options.style.width.value}else{s.elements.tooltip.css({width:"auto"});x.hide();if(f.browser.msie){s.elements.wrapper.add(s.elements.contentWrapper.children()).css({zoom:"normal"})}w=s.getDimensions().width+1;if(!s.options.style.width.value){if(w>s.options.style.width.max){w=s.options.style.width.max}if(w<s.options.style.width.min){w=s.options.style.width.min}}}}if(w%2!==0){w-=1}s.elements.tooltip.width(w);x.show();if(s.options.style.border.radius){s.elements.tooltip.find(".qtip-betweenCorners").each(function(y){f(this).width(w-(s.options.style.border.radius*2))})}if(f.browser.msie){s.elements.wrapper.add(s.elements.contentWrapper.children()).css({zoom:"1"});s.elements.wrapper.width(w);if(s.elements.bgiframe){s.elements.bgiframe.width(w).height(s.getDimensions.height)}}return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_WIDTH_UPDATED,"updateWidth")},updateStyle:function(w){var z,A,x,y,B;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"updateStyle")}else{if(typeof w!=="string"||!f.fn.qtip.styles[w]){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.STYLE_NOT_DEFINED,"updateStyle")}}s.options.style=a.call(s,f.fn.qtip.styles[w],s.options.user.style);s.elements.content.css(q(s.options.style));if(s.options.content.title.text!==false){s.elements.title.css(q(s.options.style.title,true))}s.elements.contentWrapper.css({borderColor:s.options.style.border.color});if(s.options.style.tip.corner!==false){if(f("<canvas>").get(0).getContext){z=s.elements.tooltip.find(".qtip-tip canvas:first");x=z.get(0).getContext("2d");x.clearRect(0,0,300,300);y=z.parent("div[rel]:first").attr("rel");B=b(y,s.options.style.tip.size.width,s.options.style.tip.size.height);h.call(s,z,B,s.options.style.tip.color||s.options.style.border.color)}else{if(f.browser.msie){z=s.elements.tooltip.find('.qtip-tip [nodeName="shape"]');z.attr("fillcolor",s.options.style.tip.color||s.options.style.border.color)}}}if(s.options.style.border.radius>0){s.elements.tooltip.find(".qtip-betweenCorners").css({backgroundColor:s.options.style.border.color});if(f("<canvas>").get(0).getContext){A=g(s.options.style.border.radius);s.elements.tooltip.find(".qtip-wrapper canvas").each(function(){x=f(this).get(0).getContext("2d");x.clearRect(0,0,300,300);y=f(this).parent("div[rel]:first").attr("rel");r.call(s,f(this),A[y],s.options.style.border.radius,s.options.style.border.color)})}else{if(f.browser.msie){s.elements.tooltip.find('.qtip-wrapper [nodeName="arc"]').each(function(){f(this).attr("fillcolor",s.options.style.border.color)})}}}return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_STYLE_UPDATED,"updateStyle")},updateContent:function(A,y){var z,x,w;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"updateContent")}else{if(!A){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.NO_CONTENT_PROVIDED,"updateContent")}}z=s.beforeContentUpdate.call(s,A);if(typeof z=="string"){A=z}else{if(z===false){return}}if(f.browser.msie){s.elements.contentWrapper.children().css({zoom:"normal"})}if(A.jquery&&A.length>0){A.clone(true).appendTo(s.elements.content).show()}else{s.elements.content.html(A)}x=s.elements.content.find("img[complete=false]");if(x.length>0){w=0;x.each(function(C){f('<img src="'+f(this).attr("src")+'" />').load(function(){if(++w==x.length){B()}})})}else{B()}function B(){s.updateWidth();if(y!==false){if(s.options.position.type!=="static"){s.updatePosition(s.elements.tooltip.is(":visible"),true)}if(s.options.style.tip.corner!==false){n.call(s)}}}s.onContentUpdate.call(s);return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_CONTENT_UPDATED,"loadContent")},loadContent:function(w,z,A){var y;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"loadContent")}y=s.beforeContentLoad.call(s);if(y===false){return s}if(A=="post"){f.post(w,z,x)}else{f.get(w,z,x)}function x(B){s.onContentLoad.call(s);f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_CONTENT_LOADED,"loadContent");s.updateContent(B)}return s},updateTitle:function(w){if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"updateTitle")}else{if(!w){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.NO_CONTENT_PROVIDED,"updateTitle")}}returned=s.beforeTitleUpdate.call(s);if(returned===false){return s}if(s.elements.button){s.elements.button=s.elements.button.clone(true)}s.elements.title.html(w);if(s.elements.button){s.elements.title.prepend(s.elements.button)}s.onTitleUpdate.call(s);return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_TITLE_UPDATED,"updateTitle")},focus:function(A){var y,x,w,z;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"focus")}else{if(s.options.position.type=="static"){return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.CANNOT_FOCUS_STATIC,"focus")}}y=parseInt(s.elements.tooltip.css("z-index"));x=6000+f("div.qtip[qtip]").length-1;if(!s.status.focused&&y!==x){z=s.beforeFocus.call(s,A);if(z===false){return s}f("div.qtip[qtip]").not(s.elements.tooltip).each(function(){if(f(this).qtip("api").status.rendered===true){w=parseInt(f(this).css("z-index"));if(typeof w=="number"&&w>-1){f(this).css({zIndex:parseInt(f(this).css("z-index"))-1})}f(this).qtip("api").status.focused=false}});s.elements.tooltip.css({zIndex:x});s.status.focused=true;s.onFocus.call(s,A);f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_FOCUSED,"focus")}return s},disable:function(w){if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"disable")}if(w){if(!s.status.disabled){s.status.disabled=true;f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_DISABLED,"disable")}else{f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.TOOLTIP_ALREADY_DISABLED,"disable")}}else{if(s.status.disabled){s.status.disabled=false;f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_ENABLED,"disable")}else{f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.TOOLTIP_ALREADY_ENABLED,"disable")}}return s},destroy:function(){var w,x,y;x=s.beforeDestroy.call(s);if(x===false){return s}if(s.status.rendered){s.options.show.when.target.unbind("mousemove.qtip",s.updatePosition);s.options.show.when.target.unbind("mouseout.qtip",s.hide);s.options.show.when.target.unbind(s.options.show.when.event+".qtip");s.options.hide.when.target.unbind(s.options.hide.when.event+".qtip");s.elements.tooltip.unbind(s.options.hide.when.event+".qtip");s.elements.tooltip.unbind("mouseover.qtip",s.focus);s.elements.tooltip.remove()}else{s.options.show.when.target.unbind(s.options.show.when.event+".qtip-create")}if(typeof s.elements.target.data("qtip")=="object"){y=s.elements.target.data("qtip").interfaces;if(typeof y=="object"&&y.length>0){for(w=0;w<y.length-1;w++){if(y[w].id==s.id){y.splice(w,1)}}}}delete f.fn.qtip.interfaces[s.id];if(typeof y=="object"&&y.length>0){s.elements.target.data("qtip").current=y.length-1}else{s.elements.target.removeData("qtip")}s.onDestroy.call(s);f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_DESTROYED,"destroy");return s.elements.target},getPosition:function(){var w,x;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"getPosition")}w=(s.elements.tooltip.css("display")!=="none")?false:true;if(w){s.elements.tooltip.css({visiblity:"hidden"}).show()}x=s.elements.tooltip.offset();if(w){s.elements.tooltip.css({visiblity:"visible"}).hide()}return x},getDimensions:function(){var w,x;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"getDimensions")}w=(!s.elements.tooltip.is(":visible"))?true:false;if(w){s.elements.tooltip.css({visiblity:"hidden"}).show()}x={height:s.elements.tooltip.outerHeight(),width:s.elements.tooltip.outerWidth()};if(w){s.elements.tooltip.css({visiblity:"visible"}).hide()}return x}})}function p(){var s,w,u,t,v,y,x;s=this;s.beforeRender.call(s);s.status.rendered=true;s.elements.tooltip='<div qtip="'+s.id+'" class="qtip '+(s.options.style.classes.tooltip||s.options.style)+'"style="display:none; -moz-border-radius:0; -webkit-border-radius:0; border-radius:0;position:'+s.options.position.type+';">  <div class="qtip-wrapper" style="position:relative; overflow:hidden; text-align:left;">    <div class="qtip-contentWrapper" style="overflow:hidden;">       <div class="qtip-content '+s.options.style.classes.content+'"></div></div></div></div>';s.elements.tooltip=f(s.elements.tooltip);s.elements.tooltip.appendTo(s.options.position.container);s.elements.tooltip.data("qtip",{current:0,interfaces:[s]});s.elements.wrapper=s.elements.tooltip.children("div:first");s.elements.contentWrapper=s.elements.wrapper.children("div:first").css({background:s.options.style.background});s.elements.content=s.elements.contentWrapper.children("div:first").css(q(s.options.style));if(f.browser.msie){s.elements.wrapper.add(s.elements.content).css({zoom:1})}if(s.options.hide.when.event=="unfocus"){s.elements.tooltip.attr("unfocus",true)}if(typeof s.options.style.width.value=="number"){s.updateWidth()}if(f("<canvas>").get(0).getContext||f.browser.msie){if(s.options.style.border.radius>0){m.call(s)}else{s.elements.contentWrapper.css({border:s.options.style.border.width+"px solid "+s.options.style.border.color})}if(s.options.style.tip.corner!==false){e.call(s)}}else{s.elements.contentWrapper.css({border:s.options.style.border.width+"px solid "+s.options.style.border.color});s.options.style.border.radius=0;s.options.style.tip.corner=false;f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.CANVAS_VML_NOT_SUPPORTED,"render")}if((typeof s.options.content.text=="string"&&s.options.content.text.length>0)||(s.options.content.text.jquery&&s.options.content.text.length>0)){u=s.options.content.text}else{if(typeof s.elements.target.attr("title")=="string"&&s.elements.target.attr("title").length>0){u=s.elements.target.attr("title").replace("\\n","<br />");s.elements.target.attr("title","")}else{if(typeof s.elements.target.attr("alt")=="string"&&s.elements.target.attr("alt").length>0){u=s.elements.target.attr("alt").replace("\\n","<br />");s.elements.target.attr("alt","")}else{u=" ";f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.NO_VALID_CONTENT,"render")}}}if(s.options.content.title.text!==false){j.call(s)}s.updateContent(u);l.call(s);if(s.options.show.ready===true){s.show()}if(s.options.content.url!==false){t=s.options.content.url;v=s.options.content.data;y=s.options.content.method||"get";s.loadContent(t,v,y)}s.onRender.call(s);f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_RENDERED,"render")}function m(){var F,z,t,B,x,E,u,G,D,y,w,C,A,s,v;F=this;F.elements.wrapper.find(".qtip-borderBottom, .qtip-borderTop").remove();t=F.options.style.border.width;B=F.options.style.border.radius;x=F.options.style.border.color||F.options.style.tip.color;E=g(B);u={};for(z in E){u[z]='<div rel="'+z+'" style="'+((z.search(/Left/)!==-1)?"left":"right")+":0; position:absolute; height:"+B+"px; width:"+B+'px; overflow:hidden; line-height:0.1px; font-size:1px">';if(f("<canvas>").get(0).getContext){u[z]+='<canvas height="'+B+'" width="'+B+'" style="vertical-align: top"></canvas>'}else{if(f.browser.msie){G=B*2+3;u[z]+='<v:arc stroked="false" fillcolor="'+x+'" startangle="'+E[z][0]+'" endangle="'+E[z][1]+'" style="width:'+G+"px; height:"+G+"px; margin-top:"+((z.search(/bottom/)!==-1)?-2:-1)+"px; margin-left:"+((z.search(/Right/)!==-1)?E[z][2]-3.5:-1)+'px; vertical-align:top; display:inline-block; behavior:url(#default#VML)"></v:arc>'}}u[z]+="</div>"}D=F.getDimensions().width-(Math.max(t,B)*2);y='<div class="qtip-betweenCorners" style="height:'+B+"px; width:"+D+"px; overflow:hidden; background-color:"+x+'; line-height:0.1px; font-size:1px;">';w='<div class="qtip-borderTop" dir="ltr" style="height:'+B+"px; margin-left:"+B+'px; line-height:0.1px; font-size:1px; padding:0;">'+u.topLeft+u.topRight+y;F.elements.wrapper.prepend(w);C='<div class="qtip-borderBottom" dir="ltr" style="height:'+B+"px; margin-left:"+B+'px; line-height:0.1px; font-size:1px; padding:0;">'+u.bottomLeft+u.bottomRight+y;F.elements.wrapper.append(C);if(f("<canvas>").get(0).getContext){F.elements.wrapper.find("canvas").each(function(){A=E[f(this).parent("[rel]:first").attr("rel")];r.call(F,f(this),A,B,x)})}else{if(f.browser.msie){F.elements.tooltip.append('<v:image style="behavior:url(#default#VML);"></v:image>')}}s=Math.max(B,(B+(t-B)));v=Math.max(t-B,0);F.elements.contentWrapper.css({border:"0px solid "+x,borderWidth:v+"px "+s+"px"})}function r(u,w,s,t){var v=u.get(0).getContext("2d");v.fillStyle=t;v.beginPath();v.arc(w[0],w[1],s,0,Math.PI*2,false);v.fill()}function e(v){var t,s,x,u,w;t=this;if(t.elements.tip!==null){t.elements.tip.remove()}s=t.options.style.tip.color||t.options.style.border.color;if(t.options.style.tip.corner===false){return}else{if(!v){v=t.options.style.tip.corner}}x=b(v,t.options.style.tip.size.width,t.options.style.tip.size.height);t.elements.tip='<div class="'+t.options.style.classes.tip+'" dir="ltr" rel="'+v+'" style="position:absolute; height:'+t.options.style.tip.size.height+"px; width:"+t.options.style.tip.size.width+'px; margin:0 auto; line-height:0.1px; font-size:1px;">';if(f("<canvas>").get(0).getContext){t.elements.tip+='<canvas height="'+t.options.style.tip.size.height+'" width="'+t.options.style.tip.size.width+'"></canvas>'}else{if(f.browser.msie){u=t.options.style.tip.size.width+","+t.options.style.tip.size.height;w="m"+x[0][0]+","+x[0][1];w+=" l"+x[1][0]+","+x[1][1];w+=" "+x[2][0]+","+x[2][1];w+=" xe";t.elements.tip+='<v:shape fillcolor="'+s+'" stroked="false" filled="true" path="'+w+'" coordsize="'+u+'" style="width:'+t.options.style.tip.size.width+"px; height:"+t.options.style.tip.size.height+"px; line-height:0.1px; display:inline-block; behavior:url(#default#VML); vertical-align:"+((v.search(/top/)!==-1)?"bottom":"top")+'"></v:shape>';t.elements.tip+='<v:image style="behavior:url(#default#VML);"></v:image>';t.elements.contentWrapper.css("position","relative")}}t.elements.tooltip.prepend(t.elements.tip+"</div>");t.elements.tip=t.elements.tooltip.find("."+t.options.style.classes.tip).eq(0);if(f("<canvas>").get(0).getContext){h.call(t,t.elements.tip.find("canvas:first"),x,s)}if(v.search(/top/)!==-1&&f.browser.msie&&parseInt(f.browser.version.charAt(0))===6){t.elements.tip.css({marginTop:-4})}n.call(t,v)}function h(t,v,s){var u=t.get(0).getContext("2d");u.fillStyle=s;u.beginPath();u.moveTo(v[0][0],v[0][1]);u.lineTo(v[1][0],v[1][1]);u.lineTo(v[2][0],v[2][1]);u.fill()}function n(u){var t,w,s,x,v;t=this;if(t.options.style.tip.corner===false||!t.elements.tip){return}if(!u){u=t.elements.tip.attr("rel")}w=positionAdjust=(f.browser.msie)?1:0;t.elements.tip.css(u.match(/left|right|top|bottom/)[0],0);if(u.search(/top|bottom/)!==-1){if(f.browser.msie){if(parseInt(f.browser.version.charAt(0))===6){positionAdjust=(u.search(/top/)!==-1)?-3:1}else{positionAdjust=(u.search(/top/)!==-1)?1:2}}if(u.search(/Middle/)!==-1){t.elements.tip.css({left:"50%",marginLeft:-(t.options.style.tip.size.width/2)})}else{if(u.search(/Left/)!==-1){t.elements.tip.css({left:t.options.style.border.radius-w})}else{if(u.search(/Right/)!==-1){t.elements.tip.css({right:t.options.style.border.radius+w})}}}if(u.search(/top/)!==-1){t.elements.tip.css({top:-positionAdjust})}else{t.elements.tip.css({bottom:positionAdjust})}}else{if(u.search(/left|right/)!==-1){if(f.browser.msie){positionAdjust=(parseInt(f.browser.version.charAt(0))===6)?1:((u.search(/left/)!==-1)?1:2)}if(u.search(/Middle/)!==-1){t.elements.tip.css({top:"50%",marginTop:-(t.options.style.tip.size.height/2)})}else{if(u.search(/Top/)!==-1){t.elements.tip.css({top:t.options.style.border.radius-w})}else{if(u.search(/Bottom/)!==-1){t.elements.tip.css({bottom:t.options.style.border.radius+w})}}}if(u.search(/left/)!==-1){t.elements.tip.css({left:-positionAdjust})}else{t.elements.tip.css({right:positionAdjust})}}}s="padding-"+u.match(/left|right|top|bottom/)[0];x=t.options.style.tip.size[(s.search(/left|right/)!==-1)?"width":"height"];t.elements.tooltip.css("padding",0);t.elements.tooltip.css(s,x);if(f.browser.msie&&parseInt(f.browser.version.charAt(0))==6){v=parseInt(t.elements.tip.css("margin-top"))||0;v+=parseInt(t.elements.content.css("margin-top"))||0;t.elements.tip.css({marginTop:v})}}function j(){var s=this;if(s.elements.title!==null){s.elements.title.remove()}s.elements.title=f('<div class="'+s.options.style.classes.title+'">').css(q(s.options.style.title,true)).css({zoom:(f.browser.msie)?1:0}).prependTo(s.elements.contentWrapper);if(s.options.content.title.text){s.updateTitle.call(s,s.options.content.title.text)}if(s.options.content.title.button!==false&&typeof s.options.content.title.button=="string"){s.elements.button=f('<a class="'+s.options.style.classes.button+'" style="float:right; position: relative"></a>').css(q(s.options.style.button,true)).html(s.options.content.title.button).prependTo(s.elements.title).click(function(t){if(!s.status.disabled){s.hide(t)}})}}function l(){var t,v,u,s;t=this;v=t.options.show.when.target;u=t.options.hide.when.target;if(t.options.hide.fixed){u=u.add(t.elements.tooltip)}if(t.options.hide.when.event=="inactive"){s=["click","dblclick","mousedown","mouseup","mousemove","mouseout","mouseenter","mouseleave","mouseover"];function y(z){if(t.status.disabled===true){return}clearTimeout(t.timers.inactive);t.timers.inactive=setTimeout(function(){f(s).each(function(){u.unbind(this+".qtip-inactive");t.elements.content.unbind(this+".qtip-inactive")});t.hide(z)},t.options.hide.delay)}}else{if(t.options.hide.fixed===true){t.elements.tooltip.bind("mouseover.qtip",function(){if(t.status.disabled===true){return}clearTimeout(t.timers.hide)})}}function x(z){if(t.status.disabled===true){return}if(t.options.hide.when.event=="inactive"){f(s).each(function(){u.bind(this+".qtip-inactive",y);t.elements.content.bind(this+".qtip-inactive",y)});y()}clearTimeout(t.timers.show);clearTimeout(t.timers.hide);t.timers.show=setTimeout(function(){t.show(z)},t.options.show.delay)}function w(z){if(t.status.disabled===true){return}if(t.options.hide.fixed===true&&t.options.hide.when.event.search(/mouse(out|leave)/i)!==-1&&f(z.relatedTarget).parents("div.qtip[qtip]").length>0){z.stopPropagation();z.preventDefault();clearTimeout(t.timers.hide);return false}clearTimeout(t.timers.show);clearTimeout(t.timers.hide);t.elements.tooltip.stop(true,true);t.timers.hide=setTimeout(function(){t.hide(z)},t.options.hide.delay)}if((t.options.show.when.target.add(t.options.hide.when.target).length===1&&t.options.show.when.event==t.options.hide.when.event&&t.options.hide.when.event!=="inactive")||t.options.hide.when.event=="unfocus"){t.cache.toggle=0;v.bind(t.options.show.when.event+".qtip",function(z){if(t.cache.toggle==0){x(z)}else{w(z)}})}else{v.bind(t.options.show.when.event+".qtip",x);if(t.options.hide.when.event!=="inactive"){u.bind(t.options.hide.when.event+".qtip",w)}}if(t.options.position.type.search(/(fixed|absolute)/)!==-1){t.elements.tooltip.bind("mouseover.qtip",t.focus)}if(t.options.position.target==="mouse"&&t.options.position.type!=="static"){v.bind("mousemove.qtip",function(z){t.cache.mouse={x:z.pageX,y:z.pageY};if(t.status.disabled===false&&t.options.position.adjust.mouse===true&&t.options.position.type!=="static"&&t.elements.tooltip.css("display")!=="none"){t.updatePosition(z)}})}}function o(u,v,A){var z,s,x,y,t,w;z=this;if(A.corner=="center"){return v.position}s=f.extend({},u);y={x:false,y:false};t={left:(s.left<f.fn.qtip.cache.screen.scroll.left),right:(s.left+A.dimensions.width+2>=f.fn.qtip.cache.screen.width+f.fn.qtip.cache.screen.scroll.left),top:(s.top<f.fn.qtip.cache.screen.scroll.top),bottom:(s.top+A.dimensions.height+2>=f.fn.qtip.cache.screen.height+f.fn.qtip.cache.screen.scroll.top)};x={left:(t.left&&(A.corner.search(/right/i)!=-1||(A.corner.search(/right/i)==-1&&!t.right))),right:(t.right&&(A.corner.search(/left/i)!=-1||(A.corner.search(/left/i)==-1&&!t.left))),top:(t.top&&A.corner.search(/top/i)==-1),bottom:(t.bottom&&A.corner.search(/bottom/i)==-1)};if(x.left){if(z.options.position.target!=="mouse"){s.left=v.position.left+v.dimensions.width}else{s.left=z.cache.mouse.x}y.x="Left"}else{if(x.right){if(z.options.position.target!=="mouse"){s.left=v.position.left-A.dimensions.width}else{s.left=z.cache.mouse.x-A.dimensions.width}y.x="Right"}}if(x.top){if(z.options.position.target!=="mouse"){s.top=v.position.top+v.dimensions.height}else{s.top=z.cache.mouse.y}y.y="top"}else{if(x.bottom){if(z.options.position.target!=="mouse"){s.top=v.position.top-A.dimensions.height}else{s.top=z.cache.mouse.y-A.dimensions.height}y.y="bottom"}}if(s.left<0){s.left=u.left;y.x=false}if(s.top<0){s.top=u.top;y.y=false}if(z.options.style.tip.corner!==false){s.corner=new String(A.corner);if(y.x!==false){s.corner=s.corner.replace(/Left|Right|Middle/,y.x)}if(y.y!==false){s.corner=s.corner.replace(/top|bottom/,y.y)}if(s.corner!==z.elements.tip.attr("rel")){e.call(z,s.corner)}}return s}function q(u,t){var v,s;v=f.extend(true,{},u);for(s in v){if(t===true&&s.search(/(tip|classes)/i)!==-1){delete v[s]}else{if(!t&&s.search(/(width|border|tip|title|classes|user)/i)!==-1){delete v[s]}}}return v}function c(s){if(typeof s.tip!=="object"){s.tip={corner:s.tip}}if(typeof s.tip.size!=="object"){s.tip.size={width:s.tip.size,height:s.tip.size}}if(typeof s.border!=="object"){s.border={width:s.border}}if(typeof s.width!=="object"){s.width={value:s.width}}if(typeof s.width.max=="string"){s.width.max=parseInt(s.width.max.replace(/([0-9]+)/i,"$1"))}if(typeof s.width.min=="string"){s.width.min=parseInt(s.width.min.replace(/([0-9]+)/i,"$1"))}if(typeof s.tip.size.x=="number"){s.tip.size.width=s.tip.size.x;delete s.tip.size.x}if(typeof s.tip.size.y=="number"){s.tip.size.height=s.tip.size.y;delete s.tip.size.y}return s}function a(){var s,t,u,x,v,w;s=this;u=[true,{}];for(t=0;t<arguments.length;t++){u.push(arguments[t])}x=[f.extend.apply(f,u)];while(typeof x[0].name=="string"){x.unshift(c(f.fn.qtip.styles[x[0].name]))}x.unshift(true,{classes:{tooltip:"qtip-"+(arguments[0].name||"defaults")}},f.fn.qtip.styles.defaults);v=f.extend.apply(f,x);w=(f.browser.msie)?1:0;v.tip.size.width+=w;v.tip.size.height+=w;if(v.tip.size.width%2>0){v.tip.size.width+=1}if(v.tip.size.height%2>0){v.tip.size.height+=1}if(v.tip.corner===true){v.tip.corner=(s.options.position.corner.tooltip==="center")?false:s.options.position.corner.tooltip}return v}function b(v,u,t){var s={bottomRight:[[0,0],[u,t],[u,0]],bottomLeft:[[0,0],[u,0],[0,t]],topRight:[[0,t],[u,0],[u,t]],topLeft:[[0,0],[0,t],[u,t]],topMiddle:[[0,t],[u/2,0],[u,t]],bottomMiddle:[[0,0],[u,0],[u/2,t]],rightMiddle:[[0,0],[u,t/2],[0,t]],leftMiddle:[[u,0],[u,t],[0,t/2]]};s.leftTop=s.bottomRight;s.rightTop=s.bottomLeft;s.leftBottom=s.topRight;s.rightBottom=s.topLeft;return s[v]}function g(s){var t;if(f("<canvas>").get(0).getContext){t={topLeft:[s,s],topRight:[0,s],bottomLeft:[s,0],bottomRight:[0,0]}}else{if(f.browser.msie){t={topLeft:[-90,90,0],topRight:[-90,90,-s],bottomLeft:[90,270,0],bottomRight:[90,270,-s]}}}return t}function k(){var s,t,u;s=this;u=s.getDimensions();t='<iframe class="qtip-bgiframe" frameborder="0" tabindex="-1" src="javascript:false" style="display:block; position:absolute; z-index:-1; filter:alpha(opacity=\'0\'); border: 1px solid red; height:'+u.height+"px; width:"+u.width+'px" />';s.elements.bgiframe=s.elements.wrapper.prepend(t).children(".qtip-bgiframe:first")}f(document).ready(function(){f.fn.qtip.cache={screen:{scroll:{left:f(window).scrollLeft(),top:f(window).scrollTop()},width:f(window).width(),height:f(window).height()}};var s;f(window).bind("resize scroll",function(t){clearTimeout(s);s=setTimeout(function(){if(t.type==="scroll"){f.fn.qtip.cache.screen.scroll={left:f(window).scrollLeft(),top:f(window).scrollTop()}}else{f.fn.qtip.cache.screen.width=f(window).width();f.fn.qtip.cache.screen.height=f(window).height()}for(i=0;i<f.fn.qtip.interfaces.length;i++){var u=f.fn.qtip.interfaces[i];if(u.status.rendered===true&&(u.options.position.type!=="static"||u.options.position.adjust.scroll&&t.type==="scroll"||u.options.position.adjust.resize&&t.type==="resize")){u.updatePosition(t,true)}}},100)});f(document).bind("mousedown.qtip",function(t){if(f(t.target).parents("div.qtip").length===0){f(".qtip[unfocus]").each(function(){var u=f(this).qtip("api");if(f(this).is(":visible")&&!u.status.disabled&&f(t.target).add(u.elements.target).length>1){u.hide(t)}})}})});f.fn.qtip.interfaces=[];f.fn.qtip.log={error:function(){return this}};f.fn.qtip.constants={};f.fn.qtip.defaults={content:{prerender:false,text:false,url:false,data:null,title:{text:false,button:false}},position:{target:false,corner:{target:"bottomRight",tooltip:"topLeft"},adjust:{x:0,y:0,mouse:true,screen:false,scroll:true,resize:true},type:"absolute",container:false},show:{when:{target:false,event:"mouseover"},effect:{type:"fade",length:100},delay:140,solo:false,ready:false},hide:{when:{target:false,event:"mouseout"},effect:{type:"fade",length:100},delay:0,fixed:false},api:{beforeRender:function(){},onRender:function(){},beforePositionUpdate:function(){},onPositionUpdate:function(){},beforeShow:function(){},onShow:function(){},beforeHide:function(){},onHide:function(){},beforeContentUpdate:function(){},onContentUpdate:function(){},beforeContentLoad:function(){},onContentLoad:function(){},beforeTitleUpdate:function(){},onTitleUpdate:function(){},beforeDestroy:function(){},onDestroy:function(){},beforeFocus:function(){},onFocus:function(){}}};f.fn.qtip.styles={defaults:{background:"white",color:"#111",overflow:"hidden",textAlign:"left",width:{min:0,max:250},padding:"5px 9px",border:{width:1,radius:0,color:"#d3d3d3"},tip:{corner:false,color:false,size:{width:13,height:13},opacity:1},title:{background:"#e1e1e1",fontWeight:"bold",padding:"7px 12px"},button:{cursor:"pointer"},classes:{target:"",tip:"qtip-tip",title:"qtip-title",button:"qtip-button",content:"qtip-content",active:"qtip-active"}},cream:{border:{width:3,radius:0,color:"#F9E98E"},title:{background:"#F0DE7D",color:"#A27D35"},background:"#FBF7AA",color:"#A27D35",classes:{tooltip:"qtip-cream"}},light:{border:{width:3,radius:0,color:"#E2E2E2"},title:{background:"#f1f1f1",color:"#454545"},background:"white",color:"#454545",classes:{tooltip:"qtip-light"}},dark:{border:{width:3,radius:0,color:"#303030"},title:{background:"#404040",color:"#f3f3f3"},background:"#505050",color:"#f3f3f3",classes:{tooltip:"qtip-dark"}},red:{border:{width:3,radius:0,color:"#CE6F6F"},title:{background:"#f28279",color:"#9C2F2F"},background:"#F79992",color:"#9C2F2F",classes:{tooltip:"qtip-red"}},green:{border:{width:3,radius:0,color:"#A9DB66"},title:{background:"#b9db8c",color:"#58792E"},background:"#CDE6AC",color:"#58792E",classes:{tooltip:"qtip-green"}},blue:{border:{width:3,radius:0,color:"#ADD9ED"},title:{background:"#D0E9F5",color:"#5E99BD"},background:"#E5F6FE",color:"#4D9FBF",classes:{tooltip:"qtip-blue"}}}})(jQuery);
Index: trunk/prototype/Sync.php
===================================================================
--- trunk/prototype/Sync.php	(revision 5376)
+++ trunk/prototype/Sync.php	(revision 5399)
@@ -39,5 +39,5 @@
 }
 
-require_once 'app/controller.php';
+require_once 'api/controller.php';
 
 $mounted = array(); $synced = array();
Index: trunk/prototype/REST.php
===================================================================
--- trunk/prototype/REST.php	(revision 5341)
+++ trunk/prototype/REST.php	(revision 5399)
@@ -52,5 +52,5 @@
 }
 
-require_once 'app/controller.php';
+require_once 'api/controller.php';
 
 $URI = Controller::URI( $concept, $id );
Index: trunk/prototype/services/PostgreSQL.php
===================================================================
--- trunk/prototype/services/PostgreSQL.php	(revision 5341)
+++ trunk/prototype/services/PostgreSQL.php	(revision 5399)
@@ -96,5 +96,5 @@
 
     public function open  ( $config ){
-        
+        		
         $this->config = $config;
         
Index: trunk/prototype/services/iCal.php
===================================================================
--- trunk/prototype/services/iCal.php	(revision 5344)
+++ trunk/prototype/services/iCal.php	(revision 5399)
@@ -1,6 +1,6 @@
 <?php
 
-require_once ROOTPATH.'/app/plugins/icalcreator/iCalUtilityFunctions.class.php';
-require_once ROOTPATH.'/app/plugins/icalcreator/iCalcreator.class.php';        
+require_once ROOTPATH.'/plugins/icalcreator/iCalUtilityFunctions.class.php';
+require_once ROOTPATH.'/plugins/icalcreator/iCalcreator.class.php';        
 require_once ROOTPATH.'/modules/calendar/constants.php';
 
Index: trunk/prototype/config/expressoCalendar.ini
===================================================================
--- trunk/prototype/config/expressoCalendar.ini	(revision 5399)
+++ trunk/prototype/config/expressoCalendar.ini	(revision 5399)
@@ -0,0 +1,6 @@
+folder = "calendar"
+
+useCaldav = true
+
+;Utilizar ou não caldav {TRUE or FALSE}
+;useCaldav = TRUE
Index: trunk/prototype/config/SMTP.srv
===================================================================
--- trunk/prototype/config/SMTP.srv	(revision 5341)
+++ trunk/prototype/config/SMTP.srv	(revision 5399)
@@ -5,4 +5,4 @@
 prot = 25
 auth = false
-username = expresso-admin
-password = prognus
+;username =
+;password = 
Index: trunk/prototype/config/CalDAV.srv
===================================================================
--- trunk/prototype/config/CalDAV.srv	(revision 5399)
+++ trunk/prototype/config/CalDAV.srv	(revision 5399)
@@ -0,0 +1,2 @@
+;Url utilizada para acessar o serviço caldav
+url = ""
Index: trunk/prototype/config/OpenLDAP.srv
===================================================================
--- trunk/prototype/config/OpenLDAP.srv	(revision 5341)
+++ trunk/prototype/config/OpenLDAP.srv	(revision 5399)
@@ -2,8 +2,8 @@
 class = "OpenLDAP"
 [config]
+idAtribute = "uidNumber"
 host = 127.0.0.1
-context = "dc=prognus"
-idAtribute = "uidNumber"
-;user = expressodev
-;password = ''
 
+;context = dc=exemplo.com
+;user = 
+;password = 
Index: trunk/prototype/config/PostgreSQL.srv
===================================================================
--- trunk/prototype/config/PostgreSQL.srv	(revision 5341)
+++ trunk/prototype/config/PostgreSQL.srv	(revision 5399)
@@ -2,2 +2,12 @@
 class = "PostgreSQL"
 [config]
+port = 5432
+dbname= expresso
+
+;conexão via socket unix 
+host= /tmp
+;conexão via tcp
+;host = 127.0.0.1
+
+;user=
+;password=
Index: trunk/prototype/links.php
===================================================================
--- trunk/prototype/links.php	(revision 5341)
+++ trunk/prototype/links.php	(revision 5399)
@@ -1,13 +1,25 @@
 <?php
 
-require_once 'app/controller.php';
+require_once 'api/controller.php';
 
-$links = Controller::links( $_GET['concept'] );
+$concept = isset($_GET['concept']) ? $_GET['concept'] : false;
 
-$concepts = array();
+$links = Controller::links( $concept );
 
-foreach( $links as $linkName => $linkTarget )
+if( $concept )
+    $links = array( $concept => $links );
+
+$return = array();
+
+foreach( $links as $target => $link )
+{
+    $concepts = array();
+
+    foreach( $link as $linkName => $linkTarget )
 	 if( Controller::isConcept( $linkName ) )
 	    $concepts[ $linkName ] = true;
 
-echo json_encode( array( 'concepts' => $concepts, 'links' => $links ) );
+    $return[ $target ] = array( 'concepts' => $concepts, 'links' => $link );
+}
+
+echo json_encode( $concept ? $return[ $concept ] : $return );
Index: trunk/prototype/me.php
===================================================================
--- trunk/prototype/me.php	(revision 5341)
+++ trunk/prototype/me.php	(revision 5399)
@@ -1,10 +1,27 @@
 <?php
 
-if ( isset( $_COOKIE[ 'sessionid' ] ) ) 
-     session_id( $_COOKIE[ 'sessionid' ] ); 
+require_once  (dirname(__FILE__).'/api/controller.php');
 
-session_start();
+$me = Controller::read(array('concept' => 'user', 'service' => 'OpenLDAP'  , 'id' => Config::me('uidNumber')));
 
-require_once "app/controller.php";
-	
-echo json_encode( Controller::read(array('concept' => 'user', 'service' => 'OpenLDAP'  , 'id' => Config::me('uidNumber'))) );
+echo json_encode( $me );
+
+// if( !$me )
+//     return;
+// 
+// $links = Controller::links();
+// 
+// $return = array();
+// 
+// foreach( $links as $concept => $link )
+// {
+//     $concepts = array();
+// 
+//     foreach( $link as $linkName => $linkTarget )
+// 	 if( Controller::isConcept( $linkName ) )
+// 	    $concepts[ $linkName ] = true;
+// 
+//      $return[ $concept ] = array( 'concepts' => $concepts, 'links' => $link );
+// }
+// 
+// echo json_encode( array( 'me' => $me, 'links' => $return ) );
Index: trunk/prototype/modules/attach_message/attach_message.js
===================================================================
--- trunk/prototype/modules/attach_message/attach_message.js	(revision 5336)
+++ trunk/prototype/modules/attach_message/attach_message.js	(revision 5399)
@@ -265,5 +265,5 @@
 		var firstFolder = jQuery("#foldertree-container")
 		.removeClass('empty-container')
-		.html(DataLayer.render(BASE_PATH + 'app/templates/foldertree.ejs', {folders: [tree1, tree2, tree3]}))
+		.html(DataLayer.render(BASE_PATH + 'api/templates/foldertree.ejs', {folders: [tree1, tree2, tree3]}))
 		.find("#foldertree").treeview()
 		.click(function(event){
@@ -313,5 +313,5 @@
 		jQuery("#mailgrid-container")
 		.removeClass('empty-container')
-		.html(DataLayer.render(BASE_PATH + 'app/templates/messagegrid.ejs', {}))
+		.html(DataLayer.render(BASE_PATH + 'api/templates/messagegrid.ejs', {}))
 		.find("#message_attacher_grid")
 		.jqGrid({
Index: trunk/prototype/modules/filters/filters.js
===================================================================
--- trunk/prototype/modules/filters/filters.js	(revision 5341)
+++ trunk/prototype/modules/filters/filters.js	(revision 5399)
@@ -229,5 +229,5 @@
     details_container.accordion({autoHeight: false});
     
-    DataLayer.render( BASE_PATH + 'app/templates/folderselect.ejs', 'folder:select', function( html ){
+    DataLayer.render( BASE_PATH + 'api/templates/folderselect.ejs', 'folder:select', function( html ){
 	  details_container.find(".select-folderlist").append( html );
     });
Index: trunk/prototype/modules/calendar/interceptors/Notifications.php
===================================================================
--- trunk/prototype/modules/calendar/interceptors/Notifications.php	(revision 5341)
+++ trunk/prototype/modules/calendar/interceptors/Notifications.php	(revision 5399)
@@ -2,6 +2,6 @@
 require_once ROOTPATH.'/modules/calendar/constants.php';
 require_once ROOTPATH.'/modules/calendar/interceptors/Helpers.php';
-require_once ROOTPATH.'/app/plugins/icalcreator/iCalcreator.class.php';
-require_once ROOTPATH.'/app/templates/parseTPL.php';
+require_once ROOTPATH.'/plugins/icalcreator/iCalcreator.class.php';
+require_once ROOTPATH.'/api/parseTPL.php';
  
 class Notifications extends Helpers 
@@ -140,5 +140,5 @@
             
              $subject['notificationType'] = 'Convite de Calendario';
-             $subject['eventTitle'] = $schedulable['summary'];
+             $subject['eventTitle'] = mb_convert_encoding($schedulable['summary'],'ISO-8859-1','ISO-8859-1,UTF-8');
              $subject['startDate'] = date_format( $sTime , 'd/m/Y');
              $subject['startTime'] = ($schedulable['allDay']) ? '' : date_format( $sTime , 'H:i');
@@ -200,5 +200,5 @@
           
         $subject['notificationType'] = 'Convite Aceito';
-        $subject['eventTitle'] = $schedulable['summary'];
+        $subject['eventTitle'] = mb_convert_encoding($schedulable['summary'],'ISO-8859-1','ISO-8859-1,UTF-8');
         $subject['startDate'] = date_format( $sTime , 'd/m/Y');
         $subject['startTime'] = ($schedulable['allDay']) ? '' : date_format( $sTime , 'H:i');
@@ -241,6 +241,6 @@
        $mail['attachments'][] = $ical;
        $mail['isHtml'] = true;                         
-       $mail['body'] = parseTPL::load_tpl( $data ,ROOTPATH.'/app/templates/'.$template.'.tpl');
-       $mail['subject'] = parseTPL::load_tpl( $subject ,ROOTPATH.'/app/templates/notify_subject.tpl');;
+       $mail['body'] = parseTPL::load_tpl( $data ,ROOTPATH.'/modules/calendar/templates/'.$template.'.tpl');
+       $mail['subject'] = parseTPL::load_tpl( $subject ,ROOTPATH.'/modules/calendar/templates/notify_subject.tpl');;
        $mail['from'] = Config::me('mail');   
        $mail['to'] = $to;
@@ -293,5 +293,5 @@
                     
              $subject['notificationType'] = 'Cancelamento de Calendario';
-             $subject['eventTitle'] = $schedulable['summary'];
+             $subject['eventTitle'] = mb_convert_encoding($schedulable['summary'],'ISO-8859-1','ISO-8859-1,UTF-8');
              $subject['startDate'] = date_format( $sTime , 'd/m/Y');
              $subject['startTime'] = ($schedulable['allDay']) ? '' : date_format( $sTime , 'H:i');
@@ -347,5 +347,5 @@
            
              $subject['notificationType'] = 'Cancelamento de Calendario';
-             $subject['eventTitle'] = $schedulable['summary'];
+             $subject['eventTitle'] = mb_convert_encoding($schedulable['summary'],'ISO-8859-1','ISO-8859-1,UTF-8');
              $subject['startDate'] = date_format( $sTime , 'd/m/Y');
              $subject['startTime'] = ($schedulable['allDay']) ? '' : date_format( $sTime , 'H:i');
@@ -421,5 +421,5 @@
 
             $subject['notificationType'] = 'Modificação de Calendario';
-            $subject['eventTitle'] = $schedulable['summary'];
+            $subject['eventTitle'] = mb_convert_encoding($schedulable['summary'],'ISO-8859-1','ISO-8859-1,UTF-8');
             $subject['startDate'] = date_format($sTime, 'd/m/Y');
             $subject['startTime'] = ($schedulable['allDay']) ? '' : date_format($sTime, 'H:i');
Index: trunk/prototype/modules/calendar/interceptors/DBMapping.php
===================================================================
--- trunk/prototype/modules/calendar/interceptors/DBMapping.php	(revision 5376)
+++ trunk/prototype/modules/calendar/interceptors/DBMapping.php	(revision 5399)
@@ -682,5 +682,5 @@
         if($valid == true)
         {
-             $newCriteria['filter'] = array('AND',$newCriteria['filter'] , array('=' , 'owner', $_SESSION['wallet']['user']['uidNumber']) );        
+             $newCriteria['filter'] = array('AND',$newCriteria['filter'] , array('=' , 'owner', Config::me('uidNumber')) );        
             $externalUsers = Controller::find( $newuri , $original['properties'] ? $original['properties'] : null , $newCriteria );
 
@@ -709,6 +709,6 @@
     public function createSchedulableMails( &$uri , &$result , &$criteria , $original ){
 	
-        require_once (ROOTPATH.'/app/plugins/icalcreator/iCalcreator.class.php' );
-        require_once (ROOTPATH.'/app/templates/parseTPL.php' );
+        require_once (ROOTPATH.'/plugins/icalcreator/iCalcreator.class.php' );
+        require_once (ROOTPATH.'/api/parseTPL.php' );
         $schedulable = Controller::read( array( 'concept' => 'schedulable' , 'id' => $result['id'] )); 
         $participants = Controller::find( array( 'concept' => 'participant' ) , false ,array( 'filter' => array('=', 'schedulable' ,  $result['id']) )) ; 
@@ -777,5 +777,5 @@
                                                           'schedulableLocation' =>  $schedulable['location'],
                                                           'participants' =>  $attList
-                                                        ),ROOTPATH.'/app/templates/notify_create_body.tpl');
+                                                        ),ROOTPATH.'/api/templates/notify_create_body.tpl');
                 
                 //TODO: Internacionalização do Subject
@@ -824,5 +824,5 @@
 //HELPERS
     private static function decodeRepeat( $repeat , $start , $end ) {
-    require_once ROOTPATH.'/app/plugins/when/When.php';
+    require_once ROOTPATH.'/plugins/when/When.php';
 
     $r = new When();
@@ -982,5 +982,5 @@
         $op = array_shift($filter);
 
-        if (is_array($filter[0])) {
+        if (isset($filter[0]) && is_array($filter[0])) {
             foreach ($filter as $i => $f)
                 $filter[$i] = self::validExternalUserCriteria($f, $map ,$findCalendar );
Index: trunk/prototype/modules/calendar/interceptors/DAViCalAdapter.php
===================================================================
--- trunk/prototype/modules/calendar/interceptors/DAViCalAdapter.php	(revision 5366)
+++ trunk/prototype/modules/calendar/interceptors/DAViCalAdapter.php	(revision 5399)
@@ -39,5 +39,5 @@
     
     static function import($data , $params = false)
-    {              
+    {                  
         $user =  Controller::find(array('concept' => 'user' , 'service' => 'OpenLDAP' ),false,array('filter' => array('=','uid',$params['owner'])));  
         $params['owner'] = $user[0]['id'];
@@ -87,6 +87,6 @@
         if(isset($params['calendar']))
         { 
-            require_once ROOTPATH.'/app/plugins/icalcreator/iCalUtilityFunctions.class.php';
-            require_once ROOTPATH.'/app/plugins/icalcreator/iCalcreator.class.php';
+            require_once ROOTPATH.'/plugins/icalcreator/iCalUtilityFunctions.class.php';
+            require_once ROOTPATH.'/plugins/icalcreator/iCalcreator.class.php';
             
             $vcalendar = new icalCreator( ); 
@@ -118,5 +118,5 @@
     
     static function move($origem , $destino , $owner)
-    {    
+    {  
         $user =  Controller::find(array('concept' => 'user' , 'service' => 'OpenLDAP' ),false,array('filter' => array('=','uid',$owner)));  
         $owner = $user[0]['id'];
@@ -153,7 +153,7 @@
     {  
       ob_start();
-      require_once ROOTPATH.'/app/plugins/davicalCliente/caldav-client-v2.php';
-      $cal = new CalDAVClient( $_SESSION['wallet']['caldav']['url'].'/'.$_SESSION['wallet']['user']['uid'].'/'.$params['collection'].'/', $_SESSION['wallet']['user']['uid'], $_SESSION['wallet']['user']['password'] );
-      $cal->DoPUTRequest( $_SESSION['wallet']['caldav']['url'].'/'.$_SESSION['wallet']['user']['uid'].'/'.$params['collection'].'/'.$params['uid'].'.ics', $data  );  
+      require_once ROOTPATH.'/plugins/davicalCliente/caldav-client-v2.php';
+      $cal = new CalDAVClient( Config::service( 'CalDAV' , 'url' ).'/'.Config::me( 'uid' ).'/'.$params['collection'].'/', Config::me( 'uid' ), $_SESSION['wallet']['user']['password'] );
+      $cal->DoPUTRequest( Config::service( 'CalDAV' , 'url' ).'/'.Config::me( 'uid' ).'/'.$params['collection'].'/'.$params['uid'].'.ics', $data  );  
       ob_end_clean();
     }
@@ -162,7 +162,7 @@
     {
        ob_start();
-       require_once ROOTPATH.'/app/plugins/davicalCliente/caldav-client-v2.php';
-       $cal = new CalDAVClient( $_SESSION['wallet']['caldav']['url'].'/'.$_SESSION['wallet']['user']['uid'].'/'.$params['collection'].'/', $_SESSION['wallet']['user']['uid'], $_SESSION['wallet']['user']['password']);
-       $cal->DoDELETERequest( $_SESSION['wallet']['caldav']['url'].'/'.$_SESSION['wallet']['user']['uid'].'/'.$params['collection'].'/'.$data.'.ics' );
+       require_once ROOTPATH.'/plugins/davicalCliente/caldav-client-v2.php';
+       $cal = new CalDAVClient( Config::service( 'CalDAV' , 'url' ).'/'.Config::me( 'uid' ).'/'.$params['collection'].'/', Config::me( 'uid' ), $_SESSION['wallet']['user']['password']);
+       $cal->DoDELETERequest( Config::service( 'CalDAV' , 'url' ).'/'.Config::me( 'uid' ).'/'.$params['collection'].'/'.$data.'.ics' );
        ob_end_clean();
     }
@@ -171,7 +171,7 @@
     {
        ob_start();
-       require_once ROOTPATH.'/app/plugins/davicalCliente/caldav-client-v2.php';
-       $cal = new CalDAVClient( $_SESSION['wallet']['caldav']['url'].'/'.$_SESSION['wallet']['user']['uid'].'/', $_SESSION['wallet']['user']['uid'], $_SESSION['wallet']['user']['password']);
-       $cal->DoDELETERequest($_SESSION['wallet']['caldav']['url'].'/'.$_SESSION['wallet']['user']['uid'].'/'.$data.'/');
+       require_once ROOTPATH.'/plugins/davicalCliente/caldav-client-v2.php';
+       $cal = new CalDAVClient( Config::service( 'CalDAV' , 'url' ).'/'.Config::me( 'uid' ).'/', Config::me( 'uid' ), $_SESSION['wallet']['user']['password']);
+       $cal->DoDELETERequest(Config::service( 'CalDAV' , 'url' ).'/'.Config::me( 'uid' ).'/'.$data.'/');
        ob_end_clean();
     }
@@ -180,6 +180,6 @@
     {
        ob_start();
-       require_once ROOTPATH.'/app/plugins/davicalCliente/caldav-client-v2.php';
-       $cal = new CalDAVClient( $_SESSION['wallet']['caldav']['url'].'/'.$_SESSION['wallet']['user']['uid'].'/', $_SESSION['wallet']['user']['uid'], $_SESSION['wallet']['user']['password']);       
+       require_once ROOTPATH.'/plugins/davicalCliente/caldav-client-v2.php';
+       $cal = new CalDAVClient( Config::service( 'CalDAV' , 'url' ).'/'.Config::me( 'uid' ).'/', Config::me( 'uid' ), $_SESSION['wallet']['user']['password']);       
        $cal->DoMOVERequest( $origem.'/' , $destination.'/' );
        ob_end_clean();
@@ -189,6 +189,6 @@
     {
        ob_start();
-       require_once ROOTPATH.'/app/plugins/davicalCliente/caldav-client-v2.php';
-       $cal = new CalDAVClient( $_SESSION['wallet']['caldav']['url'].'/'.$_SESSION['wallet']['user']['uid'].'/', $_SESSION['wallet']['user']['uid'], $_SESSION['wallet']['user']['password']);       
+       require_once ROOTPATH.'/plugins/davicalCliente/caldav-client-v2.php';
+       $cal = new CalDAVClient( Config::service( 'CalDAV' , 'url' ).'/'.Config::me( 'uid' ).'/', Config::me( 'uid' ), $_SESSION['wallet']['user']['password']);       
        ob_end_clean();
        return $cal->FindCalendars();
@@ -198,6 +198,6 @@
     {
         ob_start();
-        require_once ROOTPATH.'/app/plugins/davicalCliente/caldav-client-v2.php';
-        $cal = new CalDAVClient( $_SESSION['wallet']['caldav']['url'].'/'.$_SESSION['wallet']['user']['uid'].'/', $_SESSION['wallet']['user']['uid'], $_SESSION['wallet']['user']['password']);
+        require_once ROOTPATH.'/plugins/davicalCliente/caldav-client-v2.php';
+        $cal = new CalDAVClient( Config::service( 'CalDAV' , 'url' ).'/'.Config::me( 'uid' ).'/', Config::me( 'uid' ), $_SESSION['wallet']['user']['password']);
  
         $xml ="<?xml version=\"1.0\" encoding=\"utf-8\" ?>
@@ -216,5 +216,5 @@
           
           
-        $cal->DoXMLRequest('MKCALENDAR', $xml, $_SESSION['wallet']['caldav']['url'].'/'.$_SESSION['wallet']['user']['uid'].'/'.$location.'/');
+        $cal->DoXMLRequest('MKCALENDAR', $xml, Config::service( 'CalDAV' , 'url' ).'/'.Config::me( 'uid' ).'/'.$location.'/');
         ob_end_clean();
     }
@@ -223,6 +223,6 @@
     {
         ob_start();
-        require_once ROOTPATH.'/app/plugins/davicalCliente/caldav-client-v2.php';
-        $cal = new CalDAVClient( $_SESSION['wallet']['caldav']['url'].'/'.$_SESSION['wallet']['user']['uid'].'/', $_SESSION['wallet']['user']['uid'], $_SESSION['wallet']['user']['password']);
+        require_once ROOTPATH.'/plugins/davicalCliente/caldav-client-v2.php';
+        $cal = new CalDAVClient( Config::service( 'CalDAV' , 'url' ).'/'.Config::me( 'uid' ).'/', Config::me( 'uid' ), $_SESSION['wallet']['user']['password']);
          
         $events = $cal->GetCollectionETags($url) ;
@@ -234,6 +234,5 @@
             $args = array_merge($args , $sync);
         }
-           
-        
+          
         include ROOTPATH.'/Sync.php';
         ob_end_clean();
Index: trunk/prototype/modules/calendar/alarms.php
===================================================================
--- trunk/prototype/modules/calendar/alarms.php	(revision 5341)
+++ trunk/prototype/modules/calendar/alarms.php	(revision 5399)
@@ -4,5 +4,5 @@
 	define('ROOTPATH', dirname(__FILE__).'/../..');
 
-require_once ROOTPATH.'/app/controller.php';
+require_once ROOTPATH.'/api/controller.php';
 require_once ROOTPATH.'/modules/calendar/constants.php';
 
@@ -37,5 +37,5 @@
 		if((((int)( $ev['startTime'] / 1000 )) - ( $v['time'] * $unit )) < time() ) //ja esta na hora de mandar o alarme ?
 		{                               
-                        require_once (ROOTPATH.'/app/templates/parseTPL.php' );
+                        require_once (ROOTPATH.'/api/parseTPL.php' );
            
 			switch ($v['type']) {
@@ -87,5 +87,5 @@
                          
 						 $mail['isHtml'] = true;                         
-						 $mail['body'] = parseTPL::load_tpl($data,ROOTPATH.'/app/templates/notify_alarm_body.tpl');
+						 $mail['body'] = parseTPL::load_tpl($data,ROOTPATH.'/modules/calendar/templates/notify_alarm_body.tpl');
                          
 						 $mail['subject'] = 'Alarme de Calendario';
Index: trunk/prototype/modules/calendar/export.php
===================================================================
--- trunk/prototype/modules/calendar/export.php	(revision 5341)
+++ trunk/prototype/modules/calendar/export.php	(revision 5399)
@@ -1,4 +1,4 @@
 <?php
-require_once '../../app/controller.php';
+require_once '../../api/controller.php';
 $params = $_GET;
 
Index: trunk/prototype/modules/calendar/css/layout.css
===================================================================
--- trunk/prototype/modules/calendar/css/layout.css	(revision 5356)
+++ trunk/prototype/modules/calendar/css/layout.css	(revision 5399)
@@ -91,5 +91,5 @@
 
 .ui-icon.ui-icon-gear {
-	background-image: url(images/cog.png);
+	background-image: url(../img/cog.png);
     background-position: 0 0;
 }
Index: trunk/prototype/modules/calendar/css/style.css
===================================================================
--- trunk/prototype/modules/calendar/css/style.css	(revision 5351)
+++ trunk/prototype/modules/calendar/css/style.css	(revision 5399)
@@ -26,5 +26,5 @@
 }
 .expresso-calendar-container #trash.empty {
-	background-image: url(images/trash-empty.png);
+	background-image: url(../img/trash-empty.png);
 	background-repeat: no-repeat;
 	background-position: bottom center;
@@ -32,5 +32,5 @@
 
 .expresso-calendar-container #trash.full {
-	background-image: url(images/trash-full.png);
+	background-image: url(../img/trash-full.png);
 	background-repeat: no-repeat;
 	background-position: bottom center;
Index: trunk/prototype/modules/calendar/img/trash-full.svg
===================================================================
--- trunk/prototype/modules/calendar/img/trash-full.svg	(revision 5399)
+++ trunk/prototype/modules/calendar/img/trash-full.svg	(revision 5399)
@@ -0,0 +1,1301 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://web.resource.org/cc/"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:xlink="http://www.w3.org/1999/xlink"
+   xmlns:sodipodi="http://inkscape.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="48.000000px"
+   height="48.000000px"
+   id="svg9397"
+   sodipodi:version="0.32"
+   inkscape:version="0.42.2"
+   sodipodi:docbase="/home/silvestre/.icons/yasis/scalable/filesystems"
+   sodipodi:docname="gnome-fs-trash-full.svg">
+  <defs
+     id="defs9399">
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient4166">
+      <stop
+         style="stop-color:#000000;stop-opacity:0.74242425"
+         offset="0"
+         id="stop4168" />
+      <stop
+         style="stop-color:#000000;stop-opacity:0;"
+         offset="1"
+         id="stop4170" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient4154">
+      <stop
+         style="stop-color:#ffffff;stop-opacity:1;"
+         offset="0"
+         id="stop4156" />
+      <stop
+         style="stop-color:#ffffff;stop-opacity:0;"
+         offset="1"
+         id="stop4158" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient4144">
+      <stop
+         style="stop-color:#020202;stop-opacity:0.55686277"
+         offset="0"
+         id="stop4146" />
+      <stop
+         style="stop-color:#020202;stop-opacity:0;"
+         offset="1"
+         id="stop4148" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient4134">
+      <stop
+         style="stop-color:#fafafa;stop-opacity:1.0000000"
+         offset="0"
+         id="stop4136" />
+      <stop
+         style="stop-color:#e1e1e1;stop-opacity:1.0000000"
+         offset="1"
+         id="stop4138" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient4085">
+      <stop
+         style="stop-color:#e8e8e8;stop-opacity:1;"
+         offset="0"
+         id="stop4087" />
+      <stop
+         style="stop-color:#b4b4b4;stop-opacity:1.0000000"
+         offset="1"
+         id="stop4089" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient4077">
+      <stop
+         style="stop-color:#000000;stop-opacity:0.36683416"
+         offset="0"
+         id="stop4079" />
+      <stop
+         style="stop-color:#000000;stop-opacity:0;"
+         offset="1"
+         id="stop4081" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient4067">
+      <stop
+         style="stop-color:#000000;stop-opacity:0.29648241"
+         offset="0"
+         id="stop4069" />
+      <stop
+         style="stop-color:#000000;stop-opacity:0;"
+         offset="1"
+         id="stop4071" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient5704">
+      <stop
+         style="stop-color:#71a771;stop-opacity:1;"
+         offset="0"
+         id="stop5706" />
+      <stop
+         id="stop5712"
+         offset="0.50000000"
+         style="stop-color:#b9d4b9;stop-opacity:1.0000000;" />
+      <stop
+         style="stop-color:#71a771;stop-opacity:1.0000000"
+         offset="1"
+         id="stop5708" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient5689">
+      <stop
+         style="stop-color:#ffffff;stop-opacity:1;"
+         offset="0"
+         id="stop5691" />
+      <stop
+         style="stop-color:#ffffff;stop-opacity:0;"
+         offset="1"
+         id="stop5693" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient4788">
+      <stop
+         style="stop-color:#000000;stop-opacity:1;"
+         offset="0"
+         id="stop4790" />
+      <stop
+         style="stop-color:#000000;stop-opacity:0;"
+         offset="1"
+         id="stop4792" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient4778">
+      <stop
+         style="stop-color:#ffffff;stop-opacity:1;"
+         offset="0"
+         id="stop4780" />
+      <stop
+         style="stop-color:#ffffff;stop-opacity:0;"
+         offset="1"
+         id="stop4782" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient4770">
+      <stop
+         style="stop-color:#000000;stop-opacity:0.17587940"
+         offset="0"
+         id="stop4772" />
+      <stop
+         style="stop-color:#1c1c1c;stop-opacity:0.71859294"
+         offset="1"
+         id="stop4774" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient4757">
+      <stop
+         style="stop-color:#bfbfbf;stop-opacity:1.0000000"
+         offset="0.0000000"
+         id="stop4759" />
+      <stop
+         id="stop2816"
+         offset="0.088235296"
+         style="stop-color:#adadad;stop-opacity:1.0000000;" />
+      <stop
+         id="stop4765"
+         offset="0.50000000"
+         style="stop-color:#ffffff;stop-opacity:1.0000000;" />
+      <stop
+         style="stop-color:#c9c9c9;stop-opacity:1.0000000;"
+         offset="0.86764705"
+         id="stop2818" />
+      <stop
+         id="stop2820"
+         offset="0.92993081"
+         style="stop-color:#a0a0a0;stop-opacity:1.0000000;" />
+      <stop
+         style="stop-color:#555555;stop-opacity:1.0000000;"
+         offset="1.0000000"
+         id="stop4761" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4757"
+       id="linearGradient4763"
+       x1="11.343426"
+       y1="23.593567"
+       x2="37.362164"
+       y2="25.217485"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(0.966374,0.000000,0.000000,0.966374,0.807615,0.868618)" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4770"
+       id="linearGradient4776"
+       x1="24.613926"
+       y1="8.5221605"
+       x2="24.613926"
+       y2="14.175982"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.012968,0.000000,0.000000,1.191080,-1.281055,0.136660)" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4778"
+       id="linearGradient4784"
+       x1="27.936396"
+       y1="13.567308"
+       x2="27.136486"
+       y2="7.9051638"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.012968,0.000000,0.000000,1.191080,-1.281055,0.136660)" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4788"
+       id="radialGradient4794"
+       cx="24.111181"
+       cy="40.210232"
+       fx="24.111181"
+       fy="54.377266"
+       r="20.896358"
+       gradientTransform="matrix(1.000000,0.000000,0.000000,0.349112,-5.676882e-16,26.17234)"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient5689"
+       id="linearGradient5695"
+       x1="16.226482"
+       y1="17.740736"
+       x2="16.226482"
+       y2="41.101620"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(0.865934,0.000000,0.000000,0.865934,2.743370,3.775290)" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient5704"
+       id="linearGradient5710"
+       x1="29.304344"
+       y1="32.166393"
+       x2="18.547052"
+       y2="32.166393"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4067"
+       id="linearGradient4073"
+       x1="16.800301"
+       y1="3.2786884"
+       x2="16.043716"
+       y2="8.9617481"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4077"
+       id="linearGradient4083"
+       x1="25.486326"
+       y1="6.1202154"
+       x2="20.240427"
+       y2="9.3114710"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4085"
+       id="linearGradient4091"
+       x1="19.248159"
+       y1="12.877095"
+       x2="18.907463"
+       y2="15.169650"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4085"
+       id="linearGradient4106"
+       gradientUnits="userSpaceOnUse"
+       x1="19.248159"
+       y1="12.877095"
+       x2="18.907463"
+       y2="15.169650" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4067"
+       id="linearGradient4108"
+       gradientUnits="userSpaceOnUse"
+       x1="16.800301"
+       y1="3.2786884"
+       x2="16.043716"
+       y2="8.9617481" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4077"
+       id="linearGradient4110"
+       gradientUnits="userSpaceOnUse"
+       x1="25.486326"
+       y1="6.1202154"
+       x2="20.240427"
+       y2="9.3114710" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4085"
+       id="linearGradient4112"
+       gradientUnits="userSpaceOnUse"
+       x1="19.248159"
+       y1="12.877095"
+       x2="18.907463"
+       y2="15.169650" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4067"
+       id="linearGradient4114"
+       gradientUnits="userSpaceOnUse"
+       x1="16.800301"
+       y1="3.2786884"
+       x2="16.043716"
+       y2="8.9617481" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4077"
+       id="linearGradient4116"
+       gradientUnits="userSpaceOnUse"
+       x1="25.486326"
+       y1="6.1202154"
+       x2="20.240427"
+       y2="9.3114710" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4085"
+       id="linearGradient4126"
+       gradientUnits="userSpaceOnUse"
+       x1="19.248159"
+       y1="12.877095"
+       x2="18.907463"
+       y2="15.169650" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4067"
+       id="linearGradient4128"
+       gradientUnits="userSpaceOnUse"
+       x1="16.800301"
+       y1="3.2786884"
+       x2="16.043716"
+       y2="8.9617481" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4077"
+       id="linearGradient4130"
+       gradientUnits="userSpaceOnUse"
+       x1="25.486326"
+       y1="6.1202154"
+       x2="20.240427"
+       y2="9.3114710" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4144"
+       id="linearGradient4150"
+       x1="30.637486"
+       y1="22.338787"
+       x2="32.946110"
+       y2="21.814198"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4154"
+       id="linearGradient4160"
+       x1="30.754084"
+       y1="19.562832"
+       x2="29.523184"
+       y2="19.892651"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4134"
+       id="linearGradient4164"
+       gradientUnits="userSpaceOnUse"
+       x1="28.939877"
+       y1="13.420758"
+       x2="29.329912"
+       y2="15.853606"
+       gradientTransform="matrix(0.865934,0.000000,0.000000,0.865934,3.197630,3.926710)" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4166"
+       id="linearGradient4172"
+       x1="30.052210"
+       y1="14.327715"
+       x2="26.769909"
+       y2="26.577425"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       y2="10.806106"
+       x2="17.270700"
+       y1="12.042769"
+       x1="15.977868"
+       gradientTransform="matrix(1.012968,0.000000,0.000000,1.191080,-1.281055,0.136660)"
+       gradientUnits="userSpaceOnUse"
+       id="linearGradient3032"
+       xlink:href="#linearGradient4778"
+       inkscape:collect="always" />
+    <linearGradient
+       gradientUnits="userSpaceOnUse"
+       y2="26.577425"
+       x2="26.769909"
+       y1="14.327715"
+       x1="30.052210"
+       id="linearGradient3030"
+       xlink:href="#linearGradient4166"
+       inkscape:collect="always" />
+    <linearGradient
+       gradientTransform="matrix(0.865934,0.000000,0.000000,0.865934,3.197630,3.926710)"
+       y2="15.853606"
+       x2="29.329912"
+       y1="13.420758"
+       x1="28.939877"
+       gradientUnits="userSpaceOnUse"
+       id="linearGradient3028"
+       xlink:href="#linearGradient4134"
+       inkscape:collect="always" />
+    <linearGradient
+       gradientUnits="userSpaceOnUse"
+       y2="19.892651"
+       x2="29.523184"
+       y1="19.562832"
+       x1="30.754084"
+       id="linearGradient3026"
+       xlink:href="#linearGradient4154"
+       inkscape:collect="always" />
+    <linearGradient
+       gradientUnits="userSpaceOnUse"
+       y2="21.814198"
+       x2="32.946110"
+       y1="22.338787"
+       x1="30.637486"
+       id="linearGradient3024"
+       xlink:href="#linearGradient4144"
+       inkscape:collect="always" />
+    <linearGradient
+       y2="9.3114710"
+       x2="20.240427"
+       y1="6.1202154"
+       x1="25.486326"
+       gradientUnits="userSpaceOnUse"
+       id="linearGradient3022"
+       xlink:href="#linearGradient4077"
+       inkscape:collect="always" />
+    <linearGradient
+       y2="8.9617481"
+       x2="16.043716"
+       y1="3.2786884"
+       x1="16.800301"
+       gradientUnits="userSpaceOnUse"
+       id="linearGradient3020"
+       xlink:href="#linearGradient4067"
+       inkscape:collect="always" />
+    <linearGradient
+       y2="15.169650"
+       x2="18.907463"
+       y1="12.877095"
+       x1="19.248159"
+       gradientUnits="userSpaceOnUse"
+       id="linearGradient3018"
+       xlink:href="#linearGradient4085"
+       inkscape:collect="always" />
+    <linearGradient
+       y2="9.3114710"
+       x2="20.240427"
+       y1="6.1202154"
+       x1="25.486326"
+       gradientUnits="userSpaceOnUse"
+       id="linearGradient3016"
+       xlink:href="#linearGradient4077"
+       inkscape:collect="always" />
+    <linearGradient
+       y2="8.9617481"
+       x2="16.043716"
+       y1="3.2786884"
+       x1="16.800301"
+       gradientUnits="userSpaceOnUse"
+       id="linearGradient3014"
+       xlink:href="#linearGradient4067"
+       inkscape:collect="always" />
+    <linearGradient
+       y2="15.169650"
+       x2="18.907463"
+       y1="12.877095"
+       x1="19.248159"
+       gradientUnits="userSpaceOnUse"
+       id="linearGradient3012"
+       xlink:href="#linearGradient4085"
+       inkscape:collect="always" />
+    <linearGradient
+       y2="9.3114710"
+       x2="20.240427"
+       y1="6.1202154"
+       x1="25.486326"
+       gradientUnits="userSpaceOnUse"
+       id="linearGradient3010"
+       xlink:href="#linearGradient4077"
+       inkscape:collect="always" />
+    <linearGradient
+       y2="8.9617481"
+       x2="16.043716"
+       y1="3.2786884"
+       x1="16.800301"
+       gradientUnits="userSpaceOnUse"
+       id="linearGradient3008"
+       xlink:href="#linearGradient4067"
+       inkscape:collect="always" />
+    <linearGradient
+       y2="15.169650"
+       x2="18.907463"
+       y1="12.877095"
+       x1="19.248159"
+       gradientUnits="userSpaceOnUse"
+       id="linearGradient3006"
+       xlink:href="#linearGradient4085"
+       inkscape:collect="always" />
+    <linearGradient
+       gradientUnits="userSpaceOnUse"
+       y2="15.169650"
+       x2="18.907463"
+       y1="12.877095"
+       x1="19.248159"
+       id="linearGradient3004"
+       xlink:href="#linearGradient4085"
+       inkscape:collect="always" />
+    <linearGradient
+       gradientUnits="userSpaceOnUse"
+       y2="9.3114710"
+       x2="20.240427"
+       y1="6.1202154"
+       x1="25.486326"
+       id="linearGradient3002"
+       xlink:href="#linearGradient4077"
+       inkscape:collect="always" />
+    <linearGradient
+       gradientUnits="userSpaceOnUse"
+       y2="8.9617481"
+       x2="16.043716"
+       y1="3.2786884"
+       x1="16.800301"
+       id="linearGradient3000"
+       xlink:href="#linearGradient4067"
+       inkscape:collect="always" />
+    <linearGradient
+       gradientUnits="userSpaceOnUse"
+       y2="32.166393"
+       x2="18.547052"
+       y1="32.166393"
+       x1="29.304344"
+       id="linearGradient2998"
+       xlink:href="#linearGradient5704"
+       inkscape:collect="always" />
+    <linearGradient
+       gradientTransform="matrix(0.865934,0.000000,0.000000,0.865934,2.743370,3.775290)"
+       gradientUnits="userSpaceOnUse"
+       y2="41.101620"
+       x2="16.226482"
+       y1="17.740736"
+       x1="16.226482"
+       id="linearGradient2996"
+       xlink:href="#linearGradient5689"
+       inkscape:collect="always" />
+    <radialGradient
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.000000,0.000000,0.000000,0.349112,-5.676882e-16,26.17234)"
+       r="20.896358"
+       fy="54.377266"
+       fx="24.111181"
+       cy="40.210232"
+       cx="24.111181"
+       id="radialGradient2994"
+       xlink:href="#linearGradient4788"
+       inkscape:collect="always" />
+    <linearGradient
+       gradientTransform="matrix(1.012968,0.000000,0.000000,1.191080,-1.281055,0.136660)"
+       gradientUnits="userSpaceOnUse"
+       y2="7.9051638"
+       x2="27.136486"
+       y1="13.567308"
+       x1="27.936396"
+       id="linearGradient2992"
+       xlink:href="#linearGradient4778"
+       inkscape:collect="always" />
+    <linearGradient
+       gradientTransform="matrix(1.012968,0.000000,0.000000,1.191080,-1.281055,0.136660)"
+       gradientUnits="userSpaceOnUse"
+       y2="14.175982"
+       x2="24.613926"
+       y1="8.5221605"
+       x1="24.613926"
+       id="linearGradient2990"
+       xlink:href="#linearGradient4770"
+       inkscape:collect="always" />
+    <linearGradient
+       gradientTransform="matrix(0.966374,0.000000,0.000000,0.966374,0.807615,0.868618)"
+       gradientUnits="userSpaceOnUse"
+       y2="25.217485"
+       x2="37.362164"
+       y1="23.593567"
+       x1="11.343426"
+       id="linearGradient2988"
+       xlink:href="#linearGradient4757"
+       inkscape:collect="always" />
+    <linearGradient
+       id="linearGradient2974">
+      <stop
+         id="stop2976"
+         offset="0.0000000"
+         style="stop-color:#bfbfbf;stop-opacity:1.0000000" />
+      <stop
+         style="stop-color:#adadad;stop-opacity:1.0000000;"
+         offset="0.088235296"
+         id="stop2978" />
+      <stop
+         style="stop-color:#ffffff;stop-opacity:1.0000000;"
+         offset="0.50000000"
+         id="stop2980" />
+      <stop
+         id="stop2982"
+         offset="0.86764705"
+         style="stop-color:#c9c9c9;stop-opacity:1.0000000;" />
+      <stop
+         style="stop-color:#a0a0a0;stop-opacity:1.0000000;"
+         offset="0.92993081"
+         id="stop2984" />
+      <stop
+         id="stop2986"
+         offset="1.0000000"
+         style="stop-color:#555555;stop-opacity:1.0000000;" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient2942">
+      <stop
+         id="stop2944"
+         offset="0"
+         style="stop-color:#71a771;stop-opacity:1;" />
+      <stop
+         style="stop-color:#b9d4b9;stop-opacity:1.0000000;"
+         offset="0.50000000"
+         id="stop2946" />
+      <stop
+         id="stop2948"
+         offset="1"
+         style="stop-color:#71a771;stop-opacity:1.0000000" />
+    </linearGradient>
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4788"
+       id="radialGradient3066"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.000000,0.000000,0.000000,0.349112,-3.935653e-16,26.17234)"
+       cx="24.111181"
+       cy="40.210232"
+       fx="24.111181"
+       fy="54.377266"
+       r="20.896358" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4757"
+       id="linearGradient3068"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(0.966374,0.000000,0.000000,0.966374,0.807615,0.868618)"
+       x1="11.343426"
+       y1="23.593567"
+       x2="37.362164"
+       y2="25.217485" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4770"
+       id="linearGradient3070"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.012968,0.000000,0.000000,1.191080,-1.281055,0.136660)"
+       x1="24.613926"
+       y1="8.5221605"
+       x2="24.613926"
+       y2="14.175982" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4778"
+       id="linearGradient3072"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.012968,0.000000,0.000000,1.191080,-1.281055,0.136660)"
+       x1="27.936396"
+       y1="13.567308"
+       x2="27.136486"
+       y2="7.9051638" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient5704"
+       id="linearGradient3074"
+       gradientUnits="userSpaceOnUse"
+       x1="29.304344"
+       y1="32.166393"
+       x2="18.547052"
+       y2="32.166393" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient5689"
+       id="linearGradient3076"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(0.865934,0.000000,0.000000,0.865934,2.743370,3.775290)"
+       x1="16.226482"
+       y1="17.740736"
+       x2="16.226482"
+       y2="41.101620" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4778"
+       id="linearGradient3078"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.012968,0.000000,0.000000,1.191080,-1.281055,0.136660)"
+       x1="15.977868"
+       y1="12.042769"
+       x2="17.270700"
+       y2="10.806106" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4788"
+       id="radialGradient3103"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.000000,0.000000,0.000000,0.349112,6.440167e-17,26.17234)"
+       cx="24.111181"
+       cy="40.210232"
+       fx="24.111181"
+       fy="54.377266"
+       r="20.896358" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4757"
+       id="linearGradient3105"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(0.966374,0.000000,0.000000,0.966374,0.807615,0.868618)"
+       x1="11.343426"
+       y1="23.593567"
+       x2="37.362164"
+       y2="25.217485" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4770"
+       id="linearGradient3107"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.012968,0.000000,0.000000,1.191080,-1.281055,0.136660)"
+       x1="24.613926"
+       y1="8.5221605"
+       x2="24.613926"
+       y2="14.175982" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4778"
+       id="linearGradient3109"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.012968,0.000000,0.000000,1.191080,-1.281055,0.136660)"
+       x1="27.936396"
+       y1="13.567308"
+       x2="27.136486"
+       y2="7.9051638" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient5704"
+       id="linearGradient3111"
+       gradientUnits="userSpaceOnUse"
+       x1="29.304344"
+       y1="32.166393"
+       x2="18.547052"
+       y2="32.166393" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient5689"
+       id="linearGradient3113"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(0.865934,0.000000,0.000000,0.865934,2.743370,3.775290)"
+       x1="16.226482"
+       y1="17.740736"
+       x2="16.226482"
+       y2="41.101620" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4085"
+       id="linearGradient3115"
+       gradientUnits="userSpaceOnUse"
+       x1="19.248159"
+       y1="12.877095"
+       x2="18.907463"
+       y2="15.169650" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4067"
+       id="linearGradient3117"
+       gradientUnits="userSpaceOnUse"
+       x1="16.800301"
+       y1="3.2786884"
+       x2="16.043716"
+       y2="8.9617481" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4077"
+       id="linearGradient3119"
+       gradientUnits="userSpaceOnUse"
+       x1="25.486326"
+       y1="6.1202154"
+       x2="20.240427"
+       y2="9.3114710" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4085"
+       id="linearGradient3121"
+       gradientUnits="userSpaceOnUse"
+       x1="19.248159"
+       y1="12.877095"
+       x2="18.907463"
+       y2="15.169650" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4067"
+       id="linearGradient3123"
+       gradientUnits="userSpaceOnUse"
+       x1="16.800301"
+       y1="3.2786884"
+       x2="16.043716"
+       y2="8.9617481" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4077"
+       id="linearGradient3125"
+       gradientUnits="userSpaceOnUse"
+       x1="25.486326"
+       y1="6.1202154"
+       x2="20.240427"
+       y2="9.3114710" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4085"
+       id="linearGradient3127"
+       gradientUnits="userSpaceOnUse"
+       x1="19.248159"
+       y1="12.877095"
+       x2="18.907463"
+       y2="15.169650" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4067"
+       id="linearGradient3129"
+       gradientUnits="userSpaceOnUse"
+       x1="16.800301"
+       y1="3.2786884"
+       x2="16.043716"
+       y2="8.9617481" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4077"
+       id="linearGradient3131"
+       gradientUnits="userSpaceOnUse"
+       x1="25.486326"
+       y1="6.1202154"
+       x2="20.240427"
+       y2="9.3114710" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4166"
+       id="linearGradient3133"
+       gradientUnits="userSpaceOnUse"
+       x1="30.052210"
+       y1="14.327715"
+       x2="26.769909"
+       y2="26.577425" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4134"
+       id="linearGradient3135"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(0.865934,0.000000,0.000000,0.865934,3.197630,3.926710)"
+       x1="28.939877"
+       y1="13.420758"
+       x2="29.329912"
+       y2="15.853606" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4144"
+       id="linearGradient3137"
+       gradientUnits="userSpaceOnUse"
+       x1="30.637486"
+       y1="22.338787"
+       x2="32.946110"
+       y2="21.814198" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4154"
+       id="linearGradient3139"
+       gradientUnits="userSpaceOnUse"
+       x1="30.754084"
+       y1="19.562832"
+       x2="29.523184"
+       y2="19.892651" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4778"
+       id="linearGradient3141"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.012968,0.000000,0.000000,1.191080,-1.281055,0.136660)"
+       x1="15.977868"
+       y1="12.042769"
+       x2="17.270700"
+       y2="10.806106" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4778"
+       id="linearGradient3144"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.169799,0.000000,0.000000,1.375487,-62.67377,-28.27764)"
+       x1="15.977868"
+       y1="12.042769"
+       x2="17.270700"
+       y2="10.806106" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4154"
+       id="linearGradient3147"
+       gradientUnits="userSpaceOnUse"
+       x1="30.754084"
+       y1="19.562832"
+       x2="29.523184"
+       y2="19.892651"
+       gradientTransform="translate(-57.50168,-23.90080)" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4144"
+       id="linearGradient3150"
+       gradientUnits="userSpaceOnUse"
+       x1="30.637486"
+       y1="22.338787"
+       x2="32.946110"
+       y2="21.814198"
+       gradientTransform="translate(-57.50168,-23.90080)" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4134"
+       id="linearGradient3153"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="translate(-57.50168,-23.90080)"
+       x1="28.939877"
+       y1="13.420758"
+       x2="29.329912"
+       y2="15.853606" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4166"
+       id="linearGradient3156"
+       gradientUnits="userSpaceOnUse"
+       x1="30.052210"
+       y1="14.327715"
+       x2="26.769909"
+       y2="26.577425"
+       gradientTransform="matrix(1.154823,0.000000,0.000000,1.154823,-61.19438,-28.43546)" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient5689"
+       id="linearGradient3171"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="translate(-58.02627,-24.07567)"
+       x1="16.226482"
+       y1="17.740736"
+       x2="16.226482"
+       y2="41.101620" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient5704"
+       id="linearGradient3174"
+       gradientUnits="userSpaceOnUse"
+       x1="29.304344"
+       y1="32.166393"
+       x2="18.547052"
+       y2="32.166393"
+       gradientTransform="translate(-57.50168,-23.90080)" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4770"
+       id="linearGradient3177"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.169799,0.000000,0.000000,1.375487,-62.67377,-28.27764)"
+       x1="24.613926"
+       y1="8.5221605"
+       x2="24.613926"
+       y2="14.175982" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4778"
+       id="linearGradient3179"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.169799,0.000000,0.000000,1.375487,-62.67377,-28.27764)"
+       x1="27.936396"
+       y1="13.567308"
+       x2="27.136486"
+       y2="7.9051638" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4757"
+       id="linearGradient3182"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.115991,0.000000,0.000000,1.115991,-60.26173,-27.43236)"
+       x1="11.343426"
+       y1="23.593567"
+       x2="37.362164"
+       y2="25.217485" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4085"
+       id="linearGradient3225"
+       gradientUnits="userSpaceOnUse"
+       x1="19.248159"
+       y1="12.877095"
+       x2="18.907463"
+       y2="15.169650" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4067"
+       id="linearGradient3227"
+       gradientUnits="userSpaceOnUse"
+       x1="16.800301"
+       y1="3.2786884"
+       x2="16.043716"
+       y2="8.9617481" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4077"
+       id="linearGradient3229"
+       gradientUnits="userSpaceOnUse"
+       x1="25.486326"
+       y1="6.1202154"
+       x2="20.240427"
+       y2="9.3114710" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4085"
+       id="linearGradient3231"
+       gradientUnits="userSpaceOnUse"
+       x1="19.248159"
+       y1="12.877095"
+       x2="18.907463"
+       y2="15.169650" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4067"
+       id="linearGradient3233"
+       gradientUnits="userSpaceOnUse"
+       x1="16.800301"
+       y1="3.2786884"
+       x2="16.043716"
+       y2="8.9617481" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4077"
+       id="linearGradient3235"
+       gradientUnits="userSpaceOnUse"
+       x1="25.486326"
+       y1="6.1202154"
+       x2="20.240427"
+       y2="9.3114710" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4085"
+       id="linearGradient3237"
+       gradientUnits="userSpaceOnUse"
+       x1="19.248159"
+       y1="12.877095"
+       x2="18.907463"
+       y2="15.169650" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4067"
+       id="linearGradient3239"
+       gradientUnits="userSpaceOnUse"
+       x1="16.800301"
+       y1="3.2786884"
+       x2="16.043716"
+       y2="8.9617481" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4077"
+       id="linearGradient3241"
+       gradientUnits="userSpaceOnUse"
+       x1="25.486326"
+       y1="6.1202154"
+       x2="20.240427"
+       y2="9.3114710" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4166"
+       id="linearGradient3243"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.154823,0.000000,0.000000,1.154823,-61.19438,-28.43546)"
+       x1="30.052210"
+       y1="14.327715"
+       x2="26.769909"
+       y2="26.577425" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4134"
+       id="linearGradient3245"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="translate(-57.50168,-23.90080)"
+       x1="28.939877"
+       y1="13.420758"
+       x2="29.329912"
+       y2="15.853606" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4144"
+       id="linearGradient3247"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="translate(-57.50168,-23.90080)"
+       x1="30.637486"
+       y1="22.338787"
+       x2="32.946110"
+       y2="21.814198" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4154"
+       id="linearGradient3249"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="translate(-57.50168,-23.90080)"
+       x1="30.754084"
+       y1="19.562832"
+       x2="29.523184"
+       y2="19.892651" />
+  </defs>
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="2.8593751"
+     inkscape:cx="86.119421"
+     inkscape:cy="10.221574"
+     inkscape:document-units="px"
+     inkscape:current-layer="g3374"
+     inkscape:window-width="1024"
+     inkscape:window-height="721"
+     inkscape:window-x="-4"
+     inkscape:window-y="25" />
+  <metadata
+     id="metadata9402">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1">
+    <g
+       id="g3374"
+       transform="matrix(1.154823,0.000000,0.000000,1.154823,-3.692697,-4.534655)">
+      <path
+         sodipodi:type="arc"
+         style="opacity:0.64179104;color:#000000;fill:url(#radialGradient4794);fill-opacity:1.0000000;fill-rule:nonzero;stroke:none;stroke-width:1.2500000;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;visibility:visible;display:inline;overflow:visible"
+         id="path4786"
+         sodipodi:cx="24.111181"
+         sodipodi:cy="40.210232"
+         sodipodi:rx="20.896358"
+         sodipodi:ry="7.2951779"
+         d="M 45.007540 40.210232 A 20.896358 7.2951779 0 1 1  3.2148228,40.210232 A 20.896358 7.2951779 0 1 1  45.007540 40.210232 z"
+         transform="matrix(0.865934,0.000000,0.000000,0.909965,3.411770,2.263303)" />
+      <path
+         style="color:#000000;fill:url(#linearGradient4763);fill-opacity:1.0000000;fill-rule:nonzero;stroke:#464646;stroke-width:0.86593357;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4.0000000;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;visibility:visible;display:inline;overflow:visible;stroke-dasharray:none"
+         d="M 9.6045363,13.516168 C 9.6045363,5.8719923 38.431263,5.8846076 38.431263,13.516168 L 35.797350,38.392026 C 35.358364,45.562123 12.931612,45.845590 12.311614,38.392026 L 9.6045363,13.516168 z "
+         id="rect3302"
+         sodipodi:nodetypes="ccccc" />
+      <path
+         style="color:#000000;fill:url(#linearGradient4776);fill-opacity:1.0000000;fill-rule:nonzero;stroke:url(#linearGradient4784);stroke-width:1.0984197;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4.0000000;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;visibility:visible;display:inline;overflow:visible"
+         d="M 36.624990,13.153925 C 36.624990,15.338326 30.911451,17.111173 23.871555,17.111173 C 16.831657,17.111173 11.118119,15.338326 11.118119,13.153925 C 11.118119,10.969523 16.831657,8.9040190 23.871555,8.9040190 C 30.911451,8.9040190 36.624990,10.969523 36.624990,13.153925 z "
+         id="path4767"
+         sodipodi:nodetypes="csssc" />
+      <path
+         style="fill:url(#linearGradient5710);fill-opacity:1.0;fill-rule:evenodd;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"
+         d="M 22.625000 23.156250 C 23.617573 23.401726 24.394392 25.105653 24.406250 25.125000 C 24.715909 25.630269 25.593750 27.343750 25.593750 27.343750 L 23.406250 28.687500 L 28.593750 29.062500 L 30.625000 24.187500 L 28.250000 25.843750 C 28.250000 25.843750 27.231426 23.472058 26.500000 23.281250 C 25.768576 23.090444 22.625000 23.156250 22.625000 23.156250 z M 21.687500 23.343750 C 20.426083 23.343750 18.812500 26.343751 18.812500 26.343750 L 22.343750 28.562500 L 24.062500 25.312500 C 23.518187 24.437328 22.959589 23.343750 21.687500 23.343750 z M 19.093750 28.500000 L 14.281250 28.843750 L 16.250000 30.281250 C 16.249999 30.281251 14.872743 32.205801 15.062500 32.937500 C 15.252257 33.669198 16.343750 36.687500 16.343750 36.687500 C 16.074490 35.701112 17.176383 34.207283 17.187500 34.187500 C 17.477855 33.670898 18.687500 31.656250 18.687500 31.656250 L 20.750000 32.843750 L 19.093750 28.500000 z M 31.531250 30.093750 L 27.812500 32.000000 L 29.718750 35.156250 C 30.749238 35.139006 32.002584 35.216295 32.656250 34.125000 C 33.304434 33.042858 31.531251 30.093751 31.531250 30.093750 z M 26.593750 33.062500 L 23.250000 37.062500 L 26.437500 41.187500 L 26.500000 38.593750 C 26.500000 38.593751 28.835466 38.810676 29.375000 38.281250 C 29.914531 37.751821 32.156250 35.093750 32.156250 35.093750 C 31.435626 35.819120 29.585191 35.593518 29.562500 35.593750 C 28.969924 35.599766 26.625000 35.562500 26.625000 35.562500 L 26.593750 33.062500 z M 21.125000 34.500000 L 17.437500 34.593750 C 16.938456 35.495504 16.255185 36.545377 16.875000 37.656250 C 17.489619 38.757802 20.906249 38.687499 20.906250 38.687500 L 21.125000 34.500000 z "
+         id="path41"
+         transform="matrix(0.865934,0.000000,0.000000,0.865934,3.197630,3.926710)" />
+      <path
+         style="fill:url(#linearGradient5695);fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"
+         d="M 11.358718,15.397202 C 15.900014,18.081565 22.230149,18.144287 22.230149,18.144287 L 22.230149,42.556297 C 22.230149,42.556297 15.591795,42.449226 13.878672,39.879541 L 11.358718,15.397202 z "
+         id="path5687"
+         sodipodi:nodetypes="ccccc" />
+      <path
+         style="color:#000000;fill:none;fill-opacity:1.0000000;fill-rule:nonzero;stroke:#ffffff;stroke-width:1.0984197;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4.0000000;stroke-dashoffset:0.0000000;stroke-opacity:0.66666669;visibility:visible;display:inline;overflow:visible"
+         d="M 36.624990,13.153925 C 36.624990,15.338326 30.911451,17.111173 23.871555,17.111173 C 16.831657,17.111173 11.118119,15.338326 11.118119,13.153925 C 11.118119,10.969523 16.831657,8.9040190 23.871555,8.9040190 C 30.911451,8.9040190 36.624990,10.969523 36.624990,13.153925 z "
+         id="path2093"
+         sodipodi:nodetypes="csssc" />
+      <g
+         id="g3205"
+         transform="matrix(0.900230,0.000000,0.000000,0.900230,53.60474,24.87921)">
+        <g
+           id="g3185">
+          <g
+             id="g4118"
+             transform="matrix(1.018840,-0.171285,0.171285,1.018840,-53.49886,-22.81311)">
+            <path
+               sodipodi:nodetypes="cscscsccccc"
+               id="path4120"
+               d="M 14.087703,10.705804 C 14.087703,10.705804 17.150689,9.7966529 17.803070,8.0399857 C 18.455452,6.2833182 18.278784,6.1593838 18.278784,6.1593838 C 18.278784,6.1593838 19.482751,7.9002530 20.055476,7.9856944 C 20.628201,8.0711358 21.968786,7.5880798 21.968786,7.5880798 C 21.968786,7.5880798 22.567320,10.116836 23.603076,10.368932 C 24.638831,10.621029 24.925193,10.663749 24.925193,10.663749 L 24.607681,13.446159 C 24.607681,13.446159 24.377711,15.546290 24.698308,16.295682 C 23.921105,16.742234 16.739194,16.263575 14.416669,15.059161 C 15.262330,14.243259 14.059223,10.896713 14.087703,10.705804 z "
+               style="fill:url(#linearGradient3225);fill-opacity:1.0000000;fill-rule:evenodd;stroke:#646464;stroke-width:0.42916039;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000" />
+            <path
+               sodipodi:nodetypes="cccc"
+               transform="matrix(0.865934,0.000000,0.000000,0.865934,3.197630,3.926710)"
+               id="path4122"
+               d="M 12.765027,7.9999999 C 15.431693,7.3879784 17.442623,5.5081957 17.573771,3.2786885 L 19.322404,8.9617486 L 12.765027,7.9999999 z "
+               style="fill:url(#linearGradient3227);fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000" />
+            <path
+               sodipodi:nodetypes="ccccc"
+               transform="matrix(0.865934,0.000000,0.000000,0.865934,3.197630,3.926710)"
+               id="path4124"
+               d="M 21.464481,4.5464480 L 19.366120,9.1366120 L 24.480874,14.163934 C 24.174863,13.639344 24.421071,9.7677892 24.830601,7.9562841 C 23.256831,7.8251366 22.338798,7.5628399 21.464481,4.5464480 z "
+               style="fill:url(#linearGradient3229);fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000" />
+          </g>
+          <g
+             transform="matrix(0.738941,-0.338951,0.338951,0.738941,-43.43672,-16.16082)"
+             id="g4093">
+            <path
+               style="fill:url(#linearGradient3231);fill-opacity:1.0000000;fill-rule:evenodd;stroke:#646464;stroke-width:0.42916039;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
+               d="M 14.087703,10.705804 C 14.087703,10.705804 17.150689,9.7966529 17.803070,8.0399857 C 18.455452,6.2833182 18.278784,6.1593838 18.278784,6.1593838 C 18.278784,6.1593838 19.482751,7.9002530 20.055476,7.9856944 C 20.628201,8.0711358 21.968786,7.5880798 21.968786,7.5880798 C 21.968786,7.5880798 22.567320,10.116836 23.603076,10.368932 C 24.638831,10.621029 24.925193,10.663749 24.925193,10.663749 L 24.607681,13.446159 C 24.607681,13.446159 24.269865,15.201021 24.590462,15.950413 C 22.772297,16.925199 16.739194,16.263575 14.416669,15.059161 C 15.262330,14.243259 14.059223,10.896713 14.087703,10.705804 z "
+               id="path3337"
+               sodipodi:nodetypes="cscscsccccc" />
+            <path
+               style="fill:url(#linearGradient3233);fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"
+               d="M 12.765027,7.9999999 C 15.431693,7.3879784 17.442623,5.5081957 17.573771,3.2786885 L 19.322404,8.9617486 L 12.765027,7.9999999 z "
+               id="path4065"
+               transform="matrix(0.865934,0.000000,0.000000,0.865934,3.197630,3.926710)"
+               sodipodi:nodetypes="cccc" />
+            <path
+               style="fill:url(#linearGradient3235);fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"
+               d="M 21.464481,4.5464480 L 19.366120,9.1366120 L 24.480874,14.163934 C 24.174863,13.639344 24.421071,9.7677892 24.830601,7.9562841 C 23.256831,7.8251366 22.338798,7.5628399 21.464481,4.5464480 z "
+               id="path4075"
+               transform="matrix(0.865934,0.000000,0.000000,0.865934,3.197630,3.926710)"
+               sodipodi:nodetypes="ccccc" />
+          </g>
+          <g
+             id="g4098"
+             transform="matrix(1.154823,0.000000,0.000000,1.154823,-61.19438,-28.43546)">
+            <path
+               sodipodi:nodetypes="cscscsccccc"
+               id="path4100"
+               d="M 14.087703,10.705804 C 14.087703,10.705804 17.150689,9.7966529 17.803070,8.0399857 C 18.455452,6.2833182 18.278784,6.1593838 18.278784,6.1593838 C 18.278784,6.1593838 19.482751,7.9002530 20.055476,7.9856944 C 20.628201,8.0711358 21.968786,7.5880798 21.968786,7.5880798 C 21.968786,7.5880798 22.567320,10.116836 23.603076,10.368932 C 24.638831,10.621029 24.925193,10.663749 24.925193,10.663749 L 24.607681,13.446159 C 24.607681,13.446159 24.377711,15.546290 24.698308,16.295682 C 23.921105,16.742234 16.739194,16.263575 14.416669,15.059161 C 15.262330,14.243259 14.059223,10.896713 14.087703,10.705804 z "
+               style="fill:url(#linearGradient3237);fill-opacity:1.0000000;fill-rule:evenodd;stroke:#646464;stroke-width:0.42916039;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000" />
+            <path
+               sodipodi:nodetypes="cccc"
+               transform="matrix(0.865934,0.000000,0.000000,0.865934,3.197630,3.926710)"
+               id="path4102"
+               d="M 12.765027,7.9999999 C 15.431693,7.3879784 17.442623,5.5081957 17.573771,3.2786885 L 19.322404,8.9617486 L 12.765027,7.9999999 z "
+               style="fill:url(#linearGradient3239);fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000" />
+            <path
+               sodipodi:nodetypes="ccccc"
+               transform="matrix(0.865934,0.000000,0.000000,0.865934,3.197630,3.926710)"
+               id="path4104"
+               d="M 21.464481,4.5464480 L 19.366120,9.1366120 L 24.480874,14.163934 C 24.174863,13.639344 24.421071,9.7677892 24.830601,7.9562841 C 23.256831,7.8251366 22.338798,7.5628399 21.464481,4.5464480 z "
+               style="fill:url(#linearGradient3241);fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000" />
+          </g>
+        </g>
+        <g
+           id="g3199">
+          <path
+             sodipodi:nodetypes="cccssssccssscc"
+             id="path4132"
+             d="M -33.545187,-8.8138255 C -33.816922,-11.531156 -24.306263,-12.663376 -23.581642,-9.8101802 L -22.222977,-6.7305386 C -22.222977,-6.7305386 -23.038177,-5.0095636 -22.857020,-4.2849422 C -22.675865,-3.5603208 -22.494711,-2.3828102 -22.675865,-1.2053007 C -22.857020,-0.027790025 -23.762797,1.3308766 -23.491065,1.8743420 C -23.219332,2.4178075 -25.212040,3.2330063 -25.755507,2.3272301 C -26.298973,1.4214528 -26.298973,1.4214528 -26.298973,1.4214528 L -28.019949,1.3308766 C -28.019949,1.3308766 -26.027241,0.15336590 -26.570707,-0.48067812 C -27.114172,-1.1147233 -31.099591,0.69683138 -31.099591,0.062787362 C -31.099591,-0.57125550 -32.458256,-4.8284077 -32.820567,-5.1001410 C -33.182879,-5.3718743 -33.364034,-6.2776505 -33.364034,-6.2776505 L -33.545187,-8.8138255 z "
+             style="fill:url(#linearGradient3243);fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:0.43296680;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000" />
+          <path
+             style="fill:url(#linearGradient3245);fill-opacity:1.0000000;fill-rule:evenodd;stroke:#646464;stroke-width:0.55541325;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
+             d="M -32.845933,-9.5619995 C -33.108228,-12.184951 -23.927895,-13.277848 -23.228442,-10.523749 L -21.916966,-7.5510692 C -21.916966,-7.5510692 -22.703852,-5.8898667 -22.528988,-5.1904135 C -22.354125,-4.4909592 -22.179261,-3.3543466 -22.354125,-2.2177340 C -22.528988,-1.0811214 -23.403305,0.23035564 -23.141010,0.75494554 C -22.878716,1.2795354 -24.802213,2.0664214 -25.326804,1.1921038 C -25.851395,0.31778614 -25.851395,0.31778614 -25.851395,0.31778614 L -27.512598,0.23035564 C -27.512598,0.23035564 -25.589099,-0.90625695 -26.113690,-1.5182797 C -26.638280,-2.1303024 -30.485277,-0.38166706 -30.485277,-0.99368976 C -30.485277,-1.6057113 -31.796753,-5.7150034 -32.146480,-5.9772995 C -32.496207,-6.2395945 -32.671070,-7.1139121 -32.671070,-7.1139121 L -32.845933,-9.5619995 z "
+             id="path4162"
+             sodipodi:nodetypes="cccssssccssscc" />
+          <path
+             sodipodi:nodetypes="ccccccc"
+             id="path4142"
+             d="M -25.763975,-1.3215650 L -26.856871,-5.8024390 C -27.009876,-7.2450610 -24.714795,-3.4417840 -24.714795,-3.4417840 C -24.233921,-2.6548990 -24.321352,1.2795280 -24.321352,1.2795280 C -25.086379,1.6729700 -25.698401,0.077342000 -25.698401,0.077342000 L -26.725724,0.011769000 C -26.310423,-0.27238400 -25.654686,-0.94998000 -25.763975,-1.3215650 z "
+             style="fill:url(#linearGradient3247);fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000" />
+          <path
+             sodipodi:nodetypes="ccccc"
+             id="path4152"
+             d="M -26.944303,-6.3270290 L -25.807691,-1.5401440 C -26.113702,-2.2177390 -27.643756,-1.7368660 -27.643756,-1.7368660 L -28.758510,-6.1740250 C -28.233920,-6.6330410 -26.944303,-6.3270290 -26.944303,-6.3270290 z "
+             style="fill:url(#linearGradient3249);fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000" />
+        </g>
+      </g>
+    </g>
+  </g>
+</svg>
Index: trunk/prototype/modules/calendar/img/trash-empty.svg
===================================================================
--- trunk/prototype/modules/calendar/img/trash-empty.svg	(revision 5399)
+++ trunk/prototype/modules/calendar/img/trash-empty.svg	(revision 5399)
@@ -0,0 +1,1208 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://web.resource.org/cc/"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:xlink="http://www.w3.org/1999/xlink"
+   xmlns:sodipodi="http://inkscape.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="48.000000px"
+   height="48.000000px"
+   id="svg9397"
+   sodipodi:version="0.32"
+   inkscape:version="0.42.2"
+   sodipodi:docbase="/home/silvestre/.icons/yasis/scalable/filesystems"
+   sodipodi:docname="gnome-fs-trash-empty.svg">
+  <defs
+     id="defs9399">
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient4166">
+      <stop
+         style="stop-color:#000000;stop-opacity:0.74242425"
+         offset="0"
+         id="stop4168" />
+      <stop
+         style="stop-color:#000000;stop-opacity:0;"
+         offset="1"
+         id="stop4170" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient4154">
+      <stop
+         style="stop-color:#ffffff;stop-opacity:1;"
+         offset="0"
+         id="stop4156" />
+      <stop
+         style="stop-color:#ffffff;stop-opacity:0;"
+         offset="1"
+         id="stop4158" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient4144">
+      <stop
+         style="stop-color:#020202;stop-opacity:0.55686277"
+         offset="0"
+         id="stop4146" />
+      <stop
+         style="stop-color:#020202;stop-opacity:0;"
+         offset="1"
+         id="stop4148" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient4134">
+      <stop
+         style="stop-color:#fafafa;stop-opacity:1.0000000"
+         offset="0"
+         id="stop4136" />
+      <stop
+         style="stop-color:#e1e1e1;stop-opacity:1.0000000"
+         offset="1"
+         id="stop4138" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient4085">
+      <stop
+         style="stop-color:#e8e8e8;stop-opacity:1;"
+         offset="0"
+         id="stop4087" />
+      <stop
+         style="stop-color:#b4b4b4;stop-opacity:1.0000000"
+         offset="1"
+         id="stop4089" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient4077">
+      <stop
+         style="stop-color:#000000;stop-opacity:0.36683416"
+         offset="0"
+         id="stop4079" />
+      <stop
+         style="stop-color:#000000;stop-opacity:0;"
+         offset="1"
+         id="stop4081" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient4067">
+      <stop
+         style="stop-color:#000000;stop-opacity:0.29648241"
+         offset="0"
+         id="stop4069" />
+      <stop
+         style="stop-color:#000000;stop-opacity:0;"
+         offset="1"
+         id="stop4071" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient5704">
+      <stop
+         style="stop-color:#71a771;stop-opacity:1;"
+         offset="0"
+         id="stop5706" />
+      <stop
+         id="stop5712"
+         offset="0.50000000"
+         style="stop-color:#b9d4b9;stop-opacity:1.0000000;" />
+      <stop
+         style="stop-color:#71a771;stop-opacity:1.0000000"
+         offset="1"
+         id="stop5708" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient5689">
+      <stop
+         style="stop-color:#ffffff;stop-opacity:1;"
+         offset="0"
+         id="stop5691" />
+      <stop
+         style="stop-color:#ffffff;stop-opacity:0;"
+         offset="1"
+         id="stop5693" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient4788">
+      <stop
+         style="stop-color:#000000;stop-opacity:1;"
+         offset="0"
+         id="stop4790" />
+      <stop
+         style="stop-color:#000000;stop-opacity:0;"
+         offset="1"
+         id="stop4792" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient4778">
+      <stop
+         style="stop-color:#ffffff;stop-opacity:1;"
+         offset="0"
+         id="stop4780" />
+      <stop
+         style="stop-color:#ffffff;stop-opacity:0;"
+         offset="1"
+         id="stop4782" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient4770">
+      <stop
+         style="stop-color:#000000;stop-opacity:0.17587940"
+         offset="0"
+         id="stop4772" />
+      <stop
+         style="stop-color:#1c1c1c;stop-opacity:0.71859294"
+         offset="1"
+         id="stop4774" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient4757">
+      <stop
+         style="stop-color:#bfbfbf;stop-opacity:1.0000000"
+         offset="0.0000000"
+         id="stop4759" />
+      <stop
+         id="stop2816"
+         offset="0.088235296"
+         style="stop-color:#adadad;stop-opacity:1.0000000;" />
+      <stop
+         id="stop4765"
+         offset="0.50000000"
+         style="stop-color:#ffffff;stop-opacity:1.0000000;" />
+      <stop
+         style="stop-color:#c9c9c9;stop-opacity:1.0000000;"
+         offset="0.86764705"
+         id="stop2818" />
+      <stop
+         id="stop2820"
+         offset="0.92993081"
+         style="stop-color:#a0a0a0;stop-opacity:1.0000000;" />
+      <stop
+         style="stop-color:#555555;stop-opacity:1.0000000;"
+         offset="1.0000000"
+         id="stop4761" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4757"
+       id="linearGradient4763"
+       x1="11.343426"
+       y1="23.593567"
+       x2="37.362164"
+       y2="25.217485"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(0.966374,0.000000,0.000000,0.966374,0.807615,0.868618)" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4770"
+       id="linearGradient4776"
+       x1="24.613926"
+       y1="8.5221605"
+       x2="24.613926"
+       y2="14.175982"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.012968,0.000000,0.000000,1.191080,-1.281055,0.136660)" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4778"
+       id="linearGradient4784"
+       x1="27.936396"
+       y1="13.567308"
+       x2="27.136486"
+       y2="7.9051638"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.012968,0.000000,0.000000,1.191080,-1.281055,0.136660)" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4788"
+       id="radialGradient4794"
+       cx="24.111181"
+       cy="40.210232"
+       fx="24.111181"
+       fy="54.377266"
+       r="20.896358"
+       gradientTransform="matrix(1.000000,0.000000,0.000000,0.349112,-5.676882e-16,26.17234)"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient5689"
+       id="linearGradient5695"
+       x1="16.226482"
+       y1="17.740736"
+       x2="16.226482"
+       y2="41.101620"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(0.865934,0.000000,0.000000,0.865934,2.743370,3.775290)" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient5704"
+       id="linearGradient5710"
+       x1="29.304344"
+       y1="32.166393"
+       x2="18.547052"
+       y2="32.166393"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4067"
+       id="linearGradient4073"
+       x1="16.800301"
+       y1="3.2786884"
+       x2="16.043716"
+       y2="8.9617481"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4077"
+       id="linearGradient4083"
+       x1="25.486326"
+       y1="6.1202154"
+       x2="20.240427"
+       y2="9.3114710"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4085"
+       id="linearGradient4091"
+       x1="19.248159"
+       y1="12.877095"
+       x2="18.907463"
+       y2="15.169650"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4085"
+       id="linearGradient4106"
+       gradientUnits="userSpaceOnUse"
+       x1="19.248159"
+       y1="12.877095"
+       x2="18.907463"
+       y2="15.169650" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4067"
+       id="linearGradient4108"
+       gradientUnits="userSpaceOnUse"
+       x1="16.800301"
+       y1="3.2786884"
+       x2="16.043716"
+       y2="8.9617481" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4077"
+       id="linearGradient4110"
+       gradientUnits="userSpaceOnUse"
+       x1="25.486326"
+       y1="6.1202154"
+       x2="20.240427"
+       y2="9.3114710" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4085"
+       id="linearGradient4112"
+       gradientUnits="userSpaceOnUse"
+       x1="19.248159"
+       y1="12.877095"
+       x2="18.907463"
+       y2="15.169650" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4067"
+       id="linearGradient4114"
+       gradientUnits="userSpaceOnUse"
+       x1="16.800301"
+       y1="3.2786884"
+       x2="16.043716"
+       y2="8.9617481" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4077"
+       id="linearGradient4116"
+       gradientUnits="userSpaceOnUse"
+       x1="25.486326"
+       y1="6.1202154"
+       x2="20.240427"
+       y2="9.3114710" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4085"
+       id="linearGradient4126"
+       gradientUnits="userSpaceOnUse"
+       x1="19.248159"
+       y1="12.877095"
+       x2="18.907463"
+       y2="15.169650" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4067"
+       id="linearGradient4128"
+       gradientUnits="userSpaceOnUse"
+       x1="16.800301"
+       y1="3.2786884"
+       x2="16.043716"
+       y2="8.9617481" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4077"
+       id="linearGradient4130"
+       gradientUnits="userSpaceOnUse"
+       x1="25.486326"
+       y1="6.1202154"
+       x2="20.240427"
+       y2="9.3114710" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4144"
+       id="linearGradient4150"
+       x1="30.637486"
+       y1="22.338787"
+       x2="32.946110"
+       y2="21.814198"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4154"
+       id="linearGradient4160"
+       x1="30.754084"
+       y1="19.562832"
+       x2="29.523184"
+       y2="19.892651"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4134"
+       id="linearGradient4164"
+       gradientUnits="userSpaceOnUse"
+       x1="28.939877"
+       y1="13.420758"
+       x2="29.329912"
+       y2="15.853606"
+       gradientTransform="matrix(0.865934,0.000000,0.000000,0.865934,3.197630,3.926710)" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4166"
+       id="linearGradient4172"
+       x1="30.052210"
+       y1="14.327715"
+       x2="26.769909"
+       y2="26.577425"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       y2="10.806106"
+       x2="17.270700"
+       y1="12.042769"
+       x1="15.977868"
+       gradientTransform="matrix(1.012968,0.000000,0.000000,1.191080,-1.281055,0.136660)"
+       gradientUnits="userSpaceOnUse"
+       id="linearGradient3032"
+       xlink:href="#linearGradient4778"
+       inkscape:collect="always" />
+    <linearGradient
+       gradientUnits="userSpaceOnUse"
+       y2="26.577425"
+       x2="26.769909"
+       y1="14.327715"
+       x1="30.052210"
+       id="linearGradient3030"
+       xlink:href="#linearGradient4166"
+       inkscape:collect="always" />
+    <linearGradient
+       gradientTransform="matrix(0.865934,0.000000,0.000000,0.865934,3.197630,3.926710)"
+       y2="15.853606"
+       x2="29.329912"
+       y1="13.420758"
+       x1="28.939877"
+       gradientUnits="userSpaceOnUse"
+       id="linearGradient3028"
+       xlink:href="#linearGradient4134"
+       inkscape:collect="always" />
+    <linearGradient
+       gradientUnits="userSpaceOnUse"
+       y2="19.892651"
+       x2="29.523184"
+       y1="19.562832"
+       x1="30.754084"
+       id="linearGradient3026"
+       xlink:href="#linearGradient4154"
+       inkscape:collect="always" />
+    <linearGradient
+       gradientUnits="userSpaceOnUse"
+       y2="21.814198"
+       x2="32.946110"
+       y1="22.338787"
+       x1="30.637486"
+       id="linearGradient3024"
+       xlink:href="#linearGradient4144"
+       inkscape:collect="always" />
+    <linearGradient
+       y2="9.3114710"
+       x2="20.240427"
+       y1="6.1202154"
+       x1="25.486326"
+       gradientUnits="userSpaceOnUse"
+       id="linearGradient3022"
+       xlink:href="#linearGradient4077"
+       inkscape:collect="always" />
+    <linearGradient
+       y2="8.9617481"
+       x2="16.043716"
+       y1="3.2786884"
+       x1="16.800301"
+       gradientUnits="userSpaceOnUse"
+       id="linearGradient3020"
+       xlink:href="#linearGradient4067"
+       inkscape:collect="always" />
+    <linearGradient
+       y2="15.169650"
+       x2="18.907463"
+       y1="12.877095"
+       x1="19.248159"
+       gradientUnits="userSpaceOnUse"
+       id="linearGradient3018"
+       xlink:href="#linearGradient4085"
+       inkscape:collect="always" />
+    <linearGradient
+       y2="9.3114710"
+       x2="20.240427"
+       y1="6.1202154"
+       x1="25.486326"
+       gradientUnits="userSpaceOnUse"
+       id="linearGradient3016"
+       xlink:href="#linearGradient4077"
+       inkscape:collect="always" />
+    <linearGradient
+       y2="8.9617481"
+       x2="16.043716"
+       y1="3.2786884"
+       x1="16.800301"
+       gradientUnits="userSpaceOnUse"
+       id="linearGradient3014"
+       xlink:href="#linearGradient4067"
+       inkscape:collect="always" />
+    <linearGradient
+       y2="15.169650"
+       x2="18.907463"
+       y1="12.877095"
+       x1="19.248159"
+       gradientUnits="userSpaceOnUse"
+       id="linearGradient3012"
+       xlink:href="#linearGradient4085"
+       inkscape:collect="always" />
+    <linearGradient
+       y2="9.3114710"
+       x2="20.240427"
+       y1="6.1202154"
+       x1="25.486326"
+       gradientUnits="userSpaceOnUse"
+       id="linearGradient3010"
+       xlink:href="#linearGradient4077"
+       inkscape:collect="always" />
+    <linearGradient
+       y2="8.9617481"
+       x2="16.043716"
+       y1="3.2786884"
+       x1="16.800301"
+       gradientUnits="userSpaceOnUse"
+       id="linearGradient3008"
+       xlink:href="#linearGradient4067"
+       inkscape:collect="always" />
+    <linearGradient
+       y2="15.169650"
+       x2="18.907463"
+       y1="12.877095"
+       x1="19.248159"
+       gradientUnits="userSpaceOnUse"
+       id="linearGradient3006"
+       xlink:href="#linearGradient4085"
+       inkscape:collect="always" />
+    <linearGradient
+       gradientUnits="userSpaceOnUse"
+       y2="15.169650"
+       x2="18.907463"
+       y1="12.877095"
+       x1="19.248159"
+       id="linearGradient3004"
+       xlink:href="#linearGradient4085"
+       inkscape:collect="always" />
+    <linearGradient
+       gradientUnits="userSpaceOnUse"
+       y2="9.3114710"
+       x2="20.240427"
+       y1="6.1202154"
+       x1="25.486326"
+       id="linearGradient3002"
+       xlink:href="#linearGradient4077"
+       inkscape:collect="always" />
+    <linearGradient
+       gradientUnits="userSpaceOnUse"
+       y2="8.9617481"
+       x2="16.043716"
+       y1="3.2786884"
+       x1="16.800301"
+       id="linearGradient3000"
+       xlink:href="#linearGradient4067"
+       inkscape:collect="always" />
+    <linearGradient
+       gradientUnits="userSpaceOnUse"
+       y2="32.166393"
+       x2="18.547052"
+       y1="32.166393"
+       x1="29.304344"
+       id="linearGradient2998"
+       xlink:href="#linearGradient5704"
+       inkscape:collect="always" />
+    <linearGradient
+       gradientTransform="matrix(0.865934,0.000000,0.000000,0.865934,2.743370,3.775290)"
+       gradientUnits="userSpaceOnUse"
+       y2="41.101620"
+       x2="16.226482"
+       y1="17.740736"
+       x1="16.226482"
+       id="linearGradient2996"
+       xlink:href="#linearGradient5689"
+       inkscape:collect="always" />
+    <radialGradient
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.000000,0.000000,0.000000,0.349112,-5.676882e-16,26.17234)"
+       r="20.896358"
+       fy="54.377266"
+       fx="24.111181"
+       cy="40.210232"
+       cx="24.111181"
+       id="radialGradient2994"
+       xlink:href="#linearGradient4788"
+       inkscape:collect="always" />
+    <linearGradient
+       gradientTransform="matrix(1.012968,0.000000,0.000000,1.191080,-1.281055,0.136660)"
+       gradientUnits="userSpaceOnUse"
+       y2="7.9051638"
+       x2="27.136486"
+       y1="13.567308"
+       x1="27.936396"
+       id="linearGradient2992"
+       xlink:href="#linearGradient4778"
+       inkscape:collect="always" />
+    <linearGradient
+       gradientTransform="matrix(1.012968,0.000000,0.000000,1.191080,-1.281055,0.136660)"
+       gradientUnits="userSpaceOnUse"
+       y2="14.175982"
+       x2="24.613926"
+       y1="8.5221605"
+       x1="24.613926"
+       id="linearGradient2990"
+       xlink:href="#linearGradient4770"
+       inkscape:collect="always" />
+    <linearGradient
+       gradientTransform="matrix(0.966374,0.000000,0.000000,0.966374,0.807615,0.868618)"
+       gradientUnits="userSpaceOnUse"
+       y2="25.217485"
+       x2="37.362164"
+       y1="23.593567"
+       x1="11.343426"
+       id="linearGradient2988"
+       xlink:href="#linearGradient4757"
+       inkscape:collect="always" />
+    <linearGradient
+       id="linearGradient2974">
+      <stop
+         id="stop2976"
+         offset="0.0000000"
+         style="stop-color:#bfbfbf;stop-opacity:1.0000000" />
+      <stop
+         style="stop-color:#adadad;stop-opacity:1.0000000;"
+         offset="0.088235296"
+         id="stop2978" />
+      <stop
+         style="stop-color:#ffffff;stop-opacity:1.0000000;"
+         offset="0.50000000"
+         id="stop2980" />
+      <stop
+         id="stop2982"
+         offset="0.86764705"
+         style="stop-color:#c9c9c9;stop-opacity:1.0000000;" />
+      <stop
+         style="stop-color:#a0a0a0;stop-opacity:1.0000000;"
+         offset="0.92993081"
+         id="stop2984" />
+      <stop
+         id="stop2986"
+         offset="1.0000000"
+         style="stop-color:#555555;stop-opacity:1.0000000;" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient2942">
+      <stop
+         id="stop2944"
+         offset="0"
+         style="stop-color:#71a771;stop-opacity:1;" />
+      <stop
+         style="stop-color:#b9d4b9;stop-opacity:1.0000000;"
+         offset="0.50000000"
+         id="stop2946" />
+      <stop
+         id="stop2948"
+         offset="1"
+         style="stop-color:#71a771;stop-opacity:1.0000000" />
+    </linearGradient>
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4788"
+       id="radialGradient3066"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.000000,0.000000,0.000000,0.349112,-3.935653e-16,26.17234)"
+       cx="24.111181"
+       cy="40.210232"
+       fx="24.111181"
+       fy="54.377266"
+       r="20.896358" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4757"
+       id="linearGradient3068"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(0.966374,0.000000,0.000000,0.966374,0.807615,0.868618)"
+       x1="11.343426"
+       y1="23.593567"
+       x2="37.362164"
+       y2="25.217485" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4770"
+       id="linearGradient3070"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.012968,0.000000,0.000000,1.191080,-1.281055,0.136660)"
+       x1="24.613926"
+       y1="8.5221605"
+       x2="24.613926"
+       y2="14.175982" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4778"
+       id="linearGradient3072"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.012968,0.000000,0.000000,1.191080,-1.281055,0.136660)"
+       x1="27.936396"
+       y1="13.567308"
+       x2="27.136486"
+       y2="7.9051638" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient5704"
+       id="linearGradient3074"
+       gradientUnits="userSpaceOnUse"
+       x1="29.304344"
+       y1="32.166393"
+       x2="18.547052"
+       y2="32.166393" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient5689"
+       id="linearGradient3076"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(0.865934,0.000000,0.000000,0.865934,2.743370,3.775290)"
+       x1="16.226482"
+       y1="17.740736"
+       x2="16.226482"
+       y2="41.101620" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4778"
+       id="linearGradient3078"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.012968,0.000000,0.000000,1.191080,-1.281055,0.136660)"
+       x1="15.977868"
+       y1="12.042769"
+       x2="17.270700"
+       y2="10.806106" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4788"
+       id="radialGradient3103"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.000000,0.000000,0.000000,0.349112,6.440167e-17,26.17234)"
+       cx="24.111181"
+       cy="40.210232"
+       fx="24.111181"
+       fy="54.377266"
+       r="20.896358" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4757"
+       id="linearGradient3105"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(0.966374,0.000000,0.000000,0.966374,0.807615,0.868618)"
+       x1="11.343426"
+       y1="23.593567"
+       x2="37.362164"
+       y2="25.217485" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4770"
+       id="linearGradient3107"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.012968,0.000000,0.000000,1.191080,-1.281055,0.136660)"
+       x1="24.613926"
+       y1="8.5221605"
+       x2="24.613926"
+       y2="14.175982" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4778"
+       id="linearGradient3109"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.012968,0.000000,0.000000,1.191080,-1.281055,0.136660)"
+       x1="27.936396"
+       y1="13.567308"
+       x2="27.136486"
+       y2="7.9051638" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient5704"
+       id="linearGradient3111"
+       gradientUnits="userSpaceOnUse"
+       x1="29.304344"
+       y1="32.166393"
+       x2="18.547052"
+       y2="32.166393" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient5689"
+       id="linearGradient3113"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(0.865934,0.000000,0.000000,0.865934,2.743370,3.775290)"
+       x1="16.226482"
+       y1="17.740736"
+       x2="16.226482"
+       y2="41.101620" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4085"
+       id="linearGradient3115"
+       gradientUnits="userSpaceOnUse"
+       x1="19.248159"
+       y1="12.877095"
+       x2="18.907463"
+       y2="15.169650" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4067"
+       id="linearGradient3117"
+       gradientUnits="userSpaceOnUse"
+       x1="16.800301"
+       y1="3.2786884"
+       x2="16.043716"
+       y2="8.9617481" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4077"
+       id="linearGradient3119"
+       gradientUnits="userSpaceOnUse"
+       x1="25.486326"
+       y1="6.1202154"
+       x2="20.240427"
+       y2="9.3114710" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4085"
+       id="linearGradient3121"
+       gradientUnits="userSpaceOnUse"
+       x1="19.248159"
+       y1="12.877095"
+       x2="18.907463"
+       y2="15.169650" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4067"
+       id="linearGradient3123"
+       gradientUnits="userSpaceOnUse"
+       x1="16.800301"
+       y1="3.2786884"
+       x2="16.043716"
+       y2="8.9617481" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4077"
+       id="linearGradient3125"
+       gradientUnits="userSpaceOnUse"
+       x1="25.486326"
+       y1="6.1202154"
+       x2="20.240427"
+       y2="9.3114710" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4085"
+       id="linearGradient3127"
+       gradientUnits="userSpaceOnUse"
+       x1="19.248159"
+       y1="12.877095"
+       x2="18.907463"
+       y2="15.169650" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4067"
+       id="linearGradient3129"
+       gradientUnits="userSpaceOnUse"
+       x1="16.800301"
+       y1="3.2786884"
+       x2="16.043716"
+       y2="8.9617481" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4077"
+       id="linearGradient3131"
+       gradientUnits="userSpaceOnUse"
+       x1="25.486326"
+       y1="6.1202154"
+       x2="20.240427"
+       y2="9.3114710" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4166"
+       id="linearGradient3133"
+       gradientUnits="userSpaceOnUse"
+       x1="30.052210"
+       y1="14.327715"
+       x2="26.769909"
+       y2="26.577425" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4134"
+       id="linearGradient3135"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(0.865934,0.000000,0.000000,0.865934,3.197630,3.926710)"
+       x1="28.939877"
+       y1="13.420758"
+       x2="29.329912"
+       y2="15.853606" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4144"
+       id="linearGradient3137"
+       gradientUnits="userSpaceOnUse"
+       x1="30.637486"
+       y1="22.338787"
+       x2="32.946110"
+       y2="21.814198" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4154"
+       id="linearGradient3139"
+       gradientUnits="userSpaceOnUse"
+       x1="30.754084"
+       y1="19.562832"
+       x2="29.523184"
+       y2="19.892651" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4778"
+       id="linearGradient3141"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.012968,0.000000,0.000000,1.191080,-1.281055,0.136660)"
+       x1="15.977868"
+       y1="12.042769"
+       x2="17.270700"
+       y2="10.806106" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4778"
+       id="linearGradient3144"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.169799,0.000000,0.000000,1.375487,-62.67377,-28.27764)"
+       x1="15.977868"
+       y1="12.042769"
+       x2="17.270700"
+       y2="10.806106" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4154"
+       id="linearGradient3147"
+       gradientUnits="userSpaceOnUse"
+       x1="30.754084"
+       y1="19.562832"
+       x2="29.523184"
+       y2="19.892651"
+       gradientTransform="translate(-57.50168,-23.90080)" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4144"
+       id="linearGradient3150"
+       gradientUnits="userSpaceOnUse"
+       x1="30.637486"
+       y1="22.338787"
+       x2="32.946110"
+       y2="21.814198"
+       gradientTransform="translate(-57.50168,-23.90080)" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4134"
+       id="linearGradient3153"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="translate(-57.50168,-23.90080)"
+       x1="28.939877"
+       y1="13.420758"
+       x2="29.329912"
+       y2="15.853606" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4166"
+       id="linearGradient3156"
+       gradientUnits="userSpaceOnUse"
+       x1="30.052210"
+       y1="14.327715"
+       x2="26.769909"
+       y2="26.577425"
+       gradientTransform="matrix(1.154823,0.000000,0.000000,1.154823,-61.19438,-28.43546)" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient5689"
+       id="linearGradient3171"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="translate(-58.02627,-24.07567)"
+       x1="16.226482"
+       y1="17.740736"
+       x2="16.226482"
+       y2="41.101620" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient5704"
+       id="linearGradient3174"
+       gradientUnits="userSpaceOnUse"
+       x1="29.304344"
+       y1="32.166393"
+       x2="18.547052"
+       y2="32.166393"
+       gradientTransform="translate(-57.50168,-23.90080)" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4770"
+       id="linearGradient3177"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.169799,0.000000,0.000000,1.375487,-62.67377,-28.27764)"
+       x1="24.613926"
+       y1="8.5221605"
+       x2="24.613926"
+       y2="14.175982" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4778"
+       id="linearGradient3179"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.169799,0.000000,0.000000,1.375487,-62.67377,-28.27764)"
+       x1="27.936396"
+       y1="13.567308"
+       x2="27.136486"
+       y2="7.9051638" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4757"
+       id="linearGradient3182"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.115991,0.000000,0.000000,1.115991,-60.26173,-27.43236)"
+       x1="11.343426"
+       y1="23.593567"
+       x2="37.362164"
+       y2="25.217485" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4085"
+       id="linearGradient3225"
+       gradientUnits="userSpaceOnUse"
+       x1="19.248159"
+       y1="12.877095"
+       x2="18.907463"
+       y2="15.169650" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4067"
+       id="linearGradient3227"
+       gradientUnits="userSpaceOnUse"
+       x1="16.800301"
+       y1="3.2786884"
+       x2="16.043716"
+       y2="8.9617481" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4077"
+       id="linearGradient3229"
+       gradientUnits="userSpaceOnUse"
+       x1="25.486326"
+       y1="6.1202154"
+       x2="20.240427"
+       y2="9.3114710" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4085"
+       id="linearGradient3231"
+       gradientUnits="userSpaceOnUse"
+       x1="19.248159"
+       y1="12.877095"
+       x2="18.907463"
+       y2="15.169650" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4067"
+       id="linearGradient3233"
+       gradientUnits="userSpaceOnUse"
+       x1="16.800301"
+       y1="3.2786884"
+       x2="16.043716"
+       y2="8.9617481" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4077"
+       id="linearGradient3235"
+       gradientUnits="userSpaceOnUse"
+       x1="25.486326"
+       y1="6.1202154"
+       x2="20.240427"
+       y2="9.3114710" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4085"
+       id="linearGradient3237"
+       gradientUnits="userSpaceOnUse"
+       x1="19.248159"
+       y1="12.877095"
+       x2="18.907463"
+       y2="15.169650" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4067"
+       id="linearGradient3239"
+       gradientUnits="userSpaceOnUse"
+       x1="16.800301"
+       y1="3.2786884"
+       x2="16.043716"
+       y2="8.9617481" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4077"
+       id="linearGradient3241"
+       gradientUnits="userSpaceOnUse"
+       x1="25.486326"
+       y1="6.1202154"
+       x2="20.240427"
+       y2="9.3114710" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4166"
+       id="linearGradient3243"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.154823,0.000000,0.000000,1.154823,-61.19438,-28.43546)"
+       x1="30.052210"
+       y1="14.327715"
+       x2="26.769909"
+       y2="26.577425" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4134"
+       id="linearGradient3245"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="translate(-57.50168,-23.90080)"
+       x1="28.939877"
+       y1="13.420758"
+       x2="29.329912"
+       y2="15.853606" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4144"
+       id="linearGradient3247"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="translate(-57.50168,-23.90080)"
+       x1="30.637486"
+       y1="22.338787"
+       x2="32.946110"
+       y2="21.814198" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4154"
+       id="linearGradient3249"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="translate(-57.50168,-23.90080)"
+       x1="30.754084"
+       y1="19.562832"
+       x2="29.523184"
+       y2="19.892651" />
+  </defs>
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="2.8593751"
+     inkscape:cx="86.119421"
+     inkscape:cy="10.221574"
+     inkscape:document-units="px"
+     inkscape:current-layer="g3374"
+     inkscape:window-width="1024"
+     inkscape:window-height="721"
+     inkscape:window-x="-4"
+     inkscape:window-y="25" />
+  <metadata
+     id="metadata9402">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1">
+    <g
+       id="g3374"
+       transform="matrix(1.154823,0.000000,0.000000,1.154823,-3.692697,-4.534655)">
+      <path
+         sodipodi:type="arc"
+         style="opacity:0.64179104;color:#000000;fill:url(#radialGradient4794);fill-opacity:1.0000000;fill-rule:nonzero;stroke:none;stroke-width:1.2500000;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;visibility:visible;display:inline;overflow:visible"
+         id="path4786"
+         sodipodi:cx="24.111181"
+         sodipodi:cy="40.210232"
+         sodipodi:rx="20.896358"
+         sodipodi:ry="7.2951779"
+         d="M 45.007540 40.210232 A 20.896358 7.2951779 0 1 1  3.2148228,40.210232 A 20.896358 7.2951779 0 1 1  45.007540 40.210232 z"
+         transform="matrix(0.865934,0.000000,0.000000,0.909965,3.411770,2.263303)" />
+      <path
+         style="color:#000000;fill:url(#linearGradient4763);fill-opacity:1.0000000;fill-rule:nonzero;stroke:#464646;stroke-width:0.86593357;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4.0000000;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;visibility:visible;display:inline;overflow:visible;stroke-dasharray:none"
+         d="M 9.6045363,13.516168 C 9.6045363,5.8719923 38.431263,5.8846076 38.431263,13.516168 L 35.797350,38.392026 C 35.358364,45.562123 12.931612,45.845590 12.311614,38.392026 L 9.6045363,13.516168 z "
+         id="rect3302"
+         sodipodi:nodetypes="ccccc" />
+      <path
+         style="color:#000000;fill:url(#linearGradient4776);fill-opacity:1.0000000;fill-rule:nonzero;stroke:url(#linearGradient4784);stroke-width:1.0984197;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4.0000000;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;visibility:visible;display:inline;overflow:visible"
+         d="M 36.624990,13.153925 C 36.624990,15.338326 30.911451,17.111173 23.871555,17.111173 C 16.831657,17.111173 11.118119,15.338326 11.118119,13.153925 C 11.118119,10.969523 16.831657,8.9040190 23.871555,8.9040190 C 30.911451,8.9040190 36.624990,10.969523 36.624990,13.153925 z "
+         id="path4767"
+         sodipodi:nodetypes="csssc" />
+      <path
+         style="fill:url(#linearGradient5710);fill-opacity:1.0;fill-rule:evenodd;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"
+         d="M 22.625000 23.156250 C 23.617573 23.401726 24.394392 25.105653 24.406250 25.125000 C 24.715909 25.630269 25.593750 27.343750 25.593750 27.343750 L 23.406250 28.687500 L 28.593750 29.062500 L 30.625000 24.187500 L 28.250000 25.843750 C 28.250000 25.843750 27.231426 23.472058 26.500000 23.281250 C 25.768576 23.090444 22.625000 23.156250 22.625000 23.156250 z M 21.687500 23.343750 C 20.426083 23.343750 18.812500 26.343751 18.812500 26.343750 L 22.343750 28.562500 L 24.062500 25.312500 C 23.518187 24.437328 22.959589 23.343750 21.687500 23.343750 z M 19.093750 28.500000 L 14.281250 28.843750 L 16.250000 30.281250 C 16.249999 30.281251 14.872743 32.205801 15.062500 32.937500 C 15.252257 33.669198 16.343750 36.687500 16.343750 36.687500 C 16.074490 35.701112 17.176383 34.207283 17.187500 34.187500 C 17.477855 33.670898 18.687500 31.656250 18.687500 31.656250 L 20.750000 32.843750 L 19.093750 28.500000 z M 31.531250 30.093750 L 27.812500 32.000000 L 29.718750 35.156250 C 30.749238 35.139006 32.002584 35.216295 32.656250 34.125000 C 33.304434 33.042858 31.531251 30.093751 31.531250 30.093750 z M 26.593750 33.062500 L 23.250000 37.062500 L 26.437500 41.187500 L 26.500000 38.593750 C 26.500000 38.593751 28.835466 38.810676 29.375000 38.281250 C 29.914531 37.751821 32.156250 35.093750 32.156250 35.093750 C 31.435626 35.819120 29.585191 35.593518 29.562500 35.593750 C 28.969924 35.599766 26.625000 35.562500 26.625000 35.562500 L 26.593750 33.062500 z M 21.125000 34.500000 L 17.437500 34.593750 C 16.938456 35.495504 16.255185 36.545377 16.875000 37.656250 C 17.489619 38.757802 20.906249 38.687499 20.906250 38.687500 L 21.125000 34.500000 z "
+         id="path41"
+         transform="matrix(0.865934,0.000000,0.000000,0.865934,3.197630,3.926710)" />
+      <path
+         style="fill:url(#linearGradient5695);fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"
+         d="M 11.358718,15.397202 C 15.900014,18.081565 22.230149,18.144287 22.230149,18.144287 L 22.230149,42.556297 C 22.230149,42.556297 15.591795,42.449226 13.878672,39.879541 L 11.358718,15.397202 z "
+         id="path5687"
+         sodipodi:nodetypes="ccccc" />
+      <path
+         style="color:#000000;fill:none;fill-opacity:1.0000000;fill-rule:nonzero;stroke:#ffffff;stroke-width:1.0984197;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4.0000000;stroke-dashoffset:0.0000000;stroke-opacity:0.66666669;visibility:visible;display:inline;overflow:visible"
+         d="M 36.624990,13.153925 C 36.624990,15.338326 30.911451,17.111173 23.871555,17.111173 C 16.831657,17.111173 11.118119,15.338326 11.118119,13.153925 C 11.118119,10.969523 16.831657,8.9040190 23.871555,8.9040190 C 30.911451,8.9040190 36.624990,10.969523 36.624990,13.153925 z "
+         id="path2093"
+         sodipodi:nodetypes="csssc" />
+    </g>
+  </g>
+</svg>
Index: trunk/prototype/modules/calendar/js/debug.js
===================================================================
--- trunk/prototype/modules/calendar/js/debug.js	(revision 5399)
+++ trunk/prototype/modules/calendar/js/debug.js	(revision 5399)
@@ -0,0 +1,24 @@
+function dump(arr,level) {
+		var dumped_text = "";
+		if(!level) level = 0;
+
+		//The padding given at the beginning of the line.
+		var level_padding = "";
+		for(var j=0;j<level+1;j++) level_padding += "    ";
+
+		if(typeof(arr) == 'object') { //Array/Hashes/Objects
+			for(var item in arr) {
+				var value = arr[item];
+
+				if(typeof(value) == 'object') { //If it is an array,
+					dumped_text += level_padding + "'" + item + "' ...\n";
+					dumped_text += dump(value,level+1);
+				} else {
+					dumped_text += level_padding + "'" + item + "' => \"" + value + "\"\n";
+				}
+			}
+		} else { //Stings/Chars/Numbers etc.
+			dumped_text = "===>"+arr+"<===("+typeof(arr)+")";
+		}
+		return dumped_text;
+	}
Index: trunk/prototype/modules/calendar/js/init.js
===================================================================
--- trunk/prototype/modules/calendar/js/init.js	(revision 5399)
+++ trunk/prototype/modules/calendar/js/init.js	(revision 5399)
@@ -0,0 +1,225 @@
+$(document).ready(function() {
+
+	refresh_calendars();
+	$tabs = $('#tabs').tabs({
+	    add: function( event, ui ) {
+			User.lastView = $tabs.tabs('option' ,'selected');
+			$tabs.tabs('select', '#' + ui.panel.id);
+		},
+		remove: function( event, ui ) {
+			$tabs.tabs('select', User.lastView);
+		},
+		show: function( event, ui ){
+			delete Calendar.currentViewKey;
+			$('#calendar').fullCalendar('refetchEvents');
+		}
+	})
+	.tabs('option', 'tabTemplate', "<li><a href='#{href}'>#{label}</a><span class='ui-icon ui-icon-close'>Remove Tab</span></li>" );
+
+	/**
+	  * Make a button to close the tab
+	  */
+	$tabs.find( "span.ui-icon-close" ).live( "click", function() {
+		var index = $( "li", $tabs ).index( $( this ).parent() );
+		if($tabs.tabs('option' ,'selected') == index){
+			if($tabs.tabs("length") == 2 && User.lastView != 1)
+				$tabs.tabs( "select", 0);
+			$tabs.tabs( "select", User.lastView);
+		}
+		if($tabs.tabs('option' ,'selected') == 0 || $tabs.tabs('option' ,'selected') == 1)
+			User.lastView = $tabs.tabs('option' ,'selected');
+		if(index != -1)
+		  $tabs.tabs( "remove", index );	
+			
+		
+		});	
+	$('.button.config-menu').button({
+	    icons: {
+		primary: "ui-icon-gear",
+		secondary: "ui-icon-triangle-1-s"
+	    },
+	    text: false
+	});
+      $('.button.add').button({
+	      icons: {
+		      secondary: "ui-icon-plus"
+	      }
+      })
+
+		var miniCalendar = $('.block-vertical-toolbox .mini-calendar').datepicker({
+			dateFormat: 'yy-m-d',
+			//dateFormat: 'DD, d MM, yy',
+			//inline: true,
+			firstDay: dayOfWeek(User.preferences.weekStart),
+			onSelect: function(dateText, inst)
+			{	
+				$tabs.tabs("select", "#calendar");
+				var date = dateText.split('-');
+				var dateFullCalendar = $.fullCalendar.formatDate($('#calendar').fullCalendar('getDate'), "yyyy-MM-dd").split('-');
+				$('#calendar').fullCalendar('gotoDate',date[0],date[1]-1,date[2]);
+				$('#calendar').fullCalendar( 'changeView', 'agendaDay' );
+			}			
+		})
+		.find('.ui-icon-circle-triangle-e').removeClass('ui-icon-circle-triangle-e').addClass('ui-icon-triangle-1-e').end()
+		.find('.ui-icon-circle-triangle-w').removeClass('ui-icon-circle-triangle-w').addClass('ui-icon-triangle-1-w');
+		
+		//Onclick do mês
+		$('.ui-datepicker-title .ui-datepicker-month').live('click',function(){
+			$tabs.tabs("select", "#calendar");
+			var currentDate = $.fullCalendar.formatDate($('#calendar').fullCalendar('getDate'), "yyyy-MM-dd").split('-');
+			$('#calendar').fullCalendar('gotoDate',$('.ui-datepicker-title .ui-datepicker-year').html(), Date.getMonthNumberFromName($('.ui-datepicker-title .ui-datepicker-month').html()),currentDate[2]);
+ 			$('#calendar').fullCalendar( 'changeView', 'month');
+		});
+		//Onclick do ano
+		$('.ui-datepicker-title .ui-datepicker-year').live('click',function(){
+			$tabs.tabs("select", "#calendar");
+			var currentDate = $.fullCalendar.formatDate($('#calendar').fullCalendar('getDate'), "yyyy-MM-dd").split('-');
+			$('#calendar').fullCalendar('gotoDate',$('.ui-datepicker-title .ui-datepicker-year').html(), Date.getMonthNumberFromName($('.ui-datepicker-title .ui-datepicker-month').html()), currentDate[2]);
+			$('.fc-button-year').click();
+		});
+		
+	//Onclick em um dia do calendário anual
+	$( ".fc-day-number" ).live( "click", function() {
+			
+		var date = $(this).parents('[class*="fc-day-"]').attr('class').match(/fc-day-(\d{4})-(\d{2})-(\d{2})/);
+
+		if (date) date.shift();
+		else return false;
+
+		$('#calendar').fullCalendar('gotoDate',date[0],date[1]-1,date[2]);
+		$('#calendar').fullCalendar( 'changeView', 'agendaDay' );
+	});	
+
+	$('.main-search input.search').keydown(function(event){
+		if(event.keyCode == 13) {
+			Encoder.EncodeType = "entity";
+			//$(this).val($(this).val());
+					
+			add_events_list($(this).val());
+			$(this).val('');
+		}
+	});
+				
+	$('.block-horizontal-toolbox .main-config-menu').menu({
+		content: $('.main-config-menu-content').html(),
+		positionOpts: {
+			posX: 'left', 
+			posY: 'bottom',
+			offsetX: -140,
+			offsetY: 0,
+			directionH: 'right',
+			directionV: 'down', 
+			detectH: true, // do horizontal collision detection  
+			detectV: true, // do vertical collision detection
+			linkToFront: false
+		},
+		flyOut: true,
+		showSpeed: 100,
+		crumbDefaultText: '>'
+	});
+	      
+		$('#trash').droppable({
+			drop: function(event, ui){
+				// 		calendar.fullCalendar( 'removeEvents', ui.draggable.attr('event-id') );
+				DataLayer.remove( "event", ui.draggable.attr('event-id') );
+				$(this).switchClass('empty','full');
+			},
+			tolerance: "touch"
+		});
+
+      /* initialize the calendar
+      -----------------------------------------------------------------*/
+		$(".button.add.add-event").click(function(event){
+			eventDetails({ 
+				startTime: $.now(),
+				endTime:!!User.preferences.defaultCalendar ? Calendar.signatureOf[User.preferences.defaultCalendar].calendar.defaultDuration != "" ? ($.now() + Calendar.signatureOf[User.preferences.defaultCalendar].calendar.defaultDuration * 60000) : (User.preferences.defaultDuration * 60000)
+				: $.now() + (User.preferences.defaultDuration * 60000)
+			}, true );
+		});
+
+	var calendar = $('#calendar').fullCalendar({
+
+		defaultView: User.preferences.defaultCalView,
+		timeFormat: User.preferences.hourFormat,
+		axisFormat: User.preferences.hourFormat,
+		eventSources: Calendar.sources,
+
+		header: {
+			left: 'prev,next today,basicWeek,basicDay',
+			center: 'title',
+			right: 'agendaDay,agendaWeek,month,year'
+		},
+		firstDay: dayOfWeek(User.preferences.weekStart),
+		editable: true,
+		selectable: true,
+		selectHelper: true,
+		droppable: true, // this allows things to be dropped onto the calendar !!!
+		timeFormat: {
+			agenda: 'HH:mm{ - HH:mm}',
+			'': 'HH:mm{ - HH:mm} }'
+		},
+		titleFormat: {
+			month: 'MMMM yyyy',                             
+			week: "dd[ yyyy] { 'a'[ MMM] dd 'de' MMMM '-' yyyy}", 
+			day: 'dddd,  dd MMM , yyyy'
+		},
+		columnFormat:{
+			month: 'ddd',    
+			week: 'ddd dd/MM', 
+			day: 'dddd dd/MM'  
+		},
+		monthNames: ['Janeiro','Fevereiro','Março','Abril','Maio','Junho','Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro' ], 
+		monthNamesShort: ['Jan','Fev','Mar','Abr','Maio','Jun','Jul','Ago','Set','Out','Nov','Dez'],
+		dayNames: [ 'Domingo', 'Segunda', 'Terça', 'Quarta', 'Quinta', 'Sexta', 'Sábado'],
+		dayNamesShort: ['Dom','Seg','Ter','Qua','Qui','Sex','Sáb'],
+		dayNamesShortest: ['D','S','T','Q','Q','S','S'],
+		allDayText: 'Dia todo',
+		buttonText: {
+			today: 'hoje',
+			month: 'mês',
+			week: 'semana',
+			day: 'dia',
+			year: 'ano'
+		},
+		
+		eventRender: function( event, element, view ){
+			$(element).attr( 'event-id', event.id );
+		},
+
+		select: function( start, end, allDay, event, view ){
+			eventDetails( { 'start': start,
+					'end': end,
+					'allDay': allDay } );
+		},
+
+		eventDrop: function( event ){
+			DataLayer.put( "schedulable:calendar", event );
+		},
+
+		eventResize: function( event ){
+			DataLayer.put( "schedulable:calendar", event );
+		},
+
+		eventClick: function( evt, event, view ){
+			eventDetails( DataLayer.get( "schedulable", evt.id), true);
+		}
+	});
+	  
+	if($(window).height() < $('body').height()){
+		var hei = $('body').height() - $(window).height();
+		hei = $('#divAppbox').height() - hei;
+		$('#divAppbox').css('max-height', hei);
+		$('#divAppbox').css('min-height', hei);
+		$('body').css('overflow-y','hidden');
+		delete hei;
+	 }
+	  
+	 $(window).resize(function(){
+		$('#divAppbox').css('max-height', $(window).height() - 104);
+		$('#divAppbox').css('min-height', $(window).height() - 104);
+		$('#divAppbox').css('overflow-x', 'auto');
+		$('#divAppbox').css('overflow-y', 'scroll');
+	});	  
+	//Todo chamada do metodo que adiciona ao full calendar o botao de listagem de eventos  
+	//listEvents();
+});
Index: trunk/prototype/modules/calendar/index.php
===================================================================
--- trunk/prototype/modules/calendar/index.php	(revision 5381)
+++ trunk/prototype/modules/calendar/index.php	(revision 5399)
@@ -1,385 +1,85 @@
-<?php
-
-	$GLOBALS['phpgw_info']['flags'] = Array(  'currentapp'    =>      'expressoCalendar',
-						  'noheader'      =>      false,
-						  'nonavbar'      =>      false,
-						  'noappheader'   =>      true,
-						  'noappfooter'   =>      true,
-						  'nofooter'      =>      true  );
-
-	include('../../../header.inc.php');
-        
-        $_SESSION['flags']['currentapp']  = 'expressoCalendar';
-        
-        
-	$_SESSION['wallet']['Sieve']['user']          = $GLOBALS['phpgw_info']['user']['account_lid'];
-	$_SESSION['wallet']['Sieve']['password']      = $GLOBALS['phpgw_info']['user']['passwd'];
-
-	$_SESSION['wallet']['Cyrus']['user']          = $GLOBALS['phpgw_info']['user']['account_lid'];
-	$_SESSION['wallet']['Cyrus']['password']      = $GLOBALS['phpgw_info']['user']['passwd'];
-
-	$_SESSION['wallet']['user']['uid']	      =  $GLOBALS['phpgw_info']['user']['userid'];
-        $_SESSION['wallet']['user']['uidNumber']      =  $GLOBALS['phpgw_info']['user']['account_id'];
-        $_SESSION['wallet']['user']['password']       =  $GLOBALS['phpgw_info']['user']['passwd'];
-        $_SESSION['wallet']['user']['cn']             =  $GLOBALS['phpgw_info']['user']['cn'];
-        $_SESSION['wallet']['user']['mail']           =  $GLOBALS['phpgw_info']['user']['email'];
-        		
-        //Configuração caldav
-        $_SESSION['config']['expressoCalendar']['useCaldav'] = false;
-        $_SESSION['wallet']['caldav']['url'] = 'http://davical.prognus.com.br/caldav.php';
-        /////////////////////////////////////////////////////////////////////////////////////////////////////
-        
-	$_SESSION['wallet']['PostgreSQL']['user']     = $GLOBALS['phpgw_info']['server']['db_user'];
-	$_SESSION['wallet']['PostgreSQL']['password'] = $GLOBALS['phpgw_info']['server']['db_pass'];
-	$_SESSION['wallet']['PostgreSQL']['dbname']   = $GLOBALS['phpgw_info']['server']['db_name'];
-	$_SESSION['wallet']['PostgreSQL']['host']     = $GLOBALS['phpgw_info']['server']['db_host'];
-?>
 <html>
 <head>
 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
-<script>
-	function dump(arr,level) {
-		var dumped_text = "";
-		if(!level) level = 0;
-
-		//The padding given at the beginning of the line.
-		var level_padding = "";
-		for(var j=0;j<level+1;j++) level_padding += "    ";
-
-		if(typeof(arr) == 'object') { //Array/Hashes/Objects
-			for(var item in arr) {
-				var value = arr[item];
-
-				if(typeof(value) == 'object') { //If it is an array,
-					dumped_text += level_padding + "'" + item + "' ...\n";
-					dumped_text += dump(value,level+1);
-				} else {
-					dumped_text += level_padding + "'" + item + "' => \"" + value + "\"\n";
-				}
-			}
-		} else { //Stings/Chars/Numbers etc.
-			dumped_text = "===>"+arr+"<===("+typeof(arr)+")";
-		}
-		return dumped_text;
-	}
-</script>
+<script type='text/javascript' src='js/debug.js'></script>
 <!--<link rel='stylesheet' type='text/css' href="../../../templates/jquery-ui/redmond/jquery-ui.css"/>-->
 
 <!--<link rel='stylesheet' type='text/css' href='../fullcalendar/fullcalendar.css' />-->
 <link rel="stylesheet" type="text/css" href="css/reset.css" />
-<link rel='stylesheet' type='text/css' href='../../app/plugins/fullcalendar/fullcalendar.css' />
-<link rel='stylesheet' type='text/css' href='../../app/plugins/fullcalendar/fullcalendar.print.css' media='print' />
-<link rel='stylesheet' type='text/css' href='../../app/plugins/jquery/jquery-ui.custom.css'/>
-<link rel='stylesheet' type='text/css' href='../../app/plugins/icalendar/jquery.icalendar.css'/>
-<link type="text/css" href="../../app/plugins/fgmenu/fg.menu.css" media="screen" rel="stylesheet" />
+<link rel='stylesheet' type='text/css' href='../../plugins/fullcalendar/fullcalendar.css' />
+<link rel='stylesheet' type='text/css' href='../../plugins/fullcalendar/fullcalendar.print.css' media='print' />
+<link rel='stylesheet' type='text/css' href='../../plugins/jquery/jquery-ui.custom.css'/>
+<link rel='stylesheet' type='text/css' href='../../plugins/icalendar/jquery.icalendar.css'/>
+<link rel="stylesheet" type="text/css" href="../../plugins/fgmenu/fg.menu.css" media="screen"/>
 <!--<link type="text/css" href="../../fgmenu/theme/ui.all.css" media="screen" rel="stylesheet" />-->
 
-<link rel='stylesheet' type='text/css' href='../../app/plugins/fileupload/jquery.fileupload-ui.css'/>
-<link rel="stylesheet" href="../../app/plugins/jquery.pagination/pagination.css" />
+<link rel='stylesheet' type='text/css' href='../../plugins/fileupload/jquery.fileupload-ui.css'/>
+<link rel="stylesheet" type='text/css' href="../../plugins/jquery.pagination/pagination.css" />
 
 <!-- JPicker -->
-<link rel="Stylesheet" type="text/css" href="../../app/plugins/jpicker/css/jPicker-1.1.6.min.css" />
-<link rel="Stylesheet" type="text/css" href="../../app/plugins/jpicker/jPicker.css" />
+<link rel="Stylesheet" type="text/css" href="../../plugins/jpicker/css/jPicker-1.1.6.min.css" />
+<link rel="Stylesheet" type="text/css" href="../../plugins/jpicker/jPicker.css" />
 
-<link rel="Stylesheet" type="text/css" href="../../app/plugins/farbtastic/farbtastic.css" />
-<link rel="Stylesheet" type="text/css" href="../../app/plugins/timepicker/jquery-ui-timepicker-addon.css" />
-<link rel="stylesheet" type="text/css" href='../../app/plugins/zebradialog/css/zebra_dialog.css'></link>
+<link rel="Stylesheet" type="text/css" href="../../plugins/farbtastic/farbtastic.css" />
+<link rel="Stylesheet" type="text/css" href="../../plugins/timepicker/jquery-ui-timepicker-addon.css" />
+<link rel="stylesheet" type="text/css" href='../../plugins/zebradialog/css/zebra_dialog.css'></link>
 
 <link rel="stylesheet" type="text/css" href="css/layout.css" />
 <link rel="stylesheet" type="text/css" href="css/style.css" />
 
-<script type='text/javascript' src='../../app/plugins/datejs/date-pt-BR.js'></script>
-<script type='text/javascript' src='../../app/plugins/jquery/jquery.min.js'></script>
-<script type='text/javascript' src='../../app/plugins/icalendar/jquery.icalendar.js'></script>
-<script type='text/javascript' src='../../app/plugins/jquery/jquery-ui.custom.min.js'></script>
-<script type='text/javascript' src="../../app/plugins/jquery/i18n/jquery.ui.datepicker-pt-BR.js"></script>
-<script type='text/javascript' src="../../app/plugins/timepicker/jquery-ui-timepicker-addon.js"></script>
-<script type='text/javascript' src="../../app/plugins/timepicker/localization/jquery-ui-timepicker-pt-BR.js"></script>
-<script type='text/javascript' src='../../app/plugins/json2/json2.js'></script>
-<script type='text/javascript' src='../../app/plugins/store/jquery.store.js'></script>
-<script type='text/javascript' src='../../app/plugins/fileupload/jquery.fileupload.js'></script>
-<script type='text/javascript' src='../../app/plugins/fileupload/jquery.fileupload-ui.js'></script>
-<script type='text/javascript' src='../../app/plugins/fileupload/jquery.iframe-transport.js'></script>
-<script type='text/javascript' src='../../app/plugins/store/jquery.store.js'></script>
-<script type="text/javascript" src="../../app/plugins/jquery.pagination/jquery.pagination.js"></script>
-<script type='text/javascript' src='../../app/plugins/mask/jquery.maskedinput.js'></script>
-<script type='text/javascript' src='../../app/plugins/alphanumeric/jquery.alphanumeric.js'></script>
-<script type='text/javascript' src='../../app/plugins/watermark/jquery.watermarkinput.js'></script>
-<script type='text/javascript' src='../../app/plugins/encoder/encoder.js'></script>
-<script type='text/javascript' src='../../app/datalayer.js'></script>
+<script type='text/javascript' src='../../plugins/datejs/date-pt-BR.js'></script>
+<script type='text/javascript' src='../../plugins/jquery/jquery.min.js'></script>
+<script type='text/javascript' src='../../plugins/icalendar/jquery.icalendar.js'></script>
+<script type='text/javascript' src='../../plugins/jquery/jquery-ui.custom.min.js'></script>
+<script type='text/javascript' src="../../plugins/jquery/i18n/jquery.ui.datepicker-pt-BR.js"></script>
+<script type='text/javascript' src="../../plugins/timepicker/jquery-ui-timepicker-addon.js"></script>
+<script type='text/javascript' src="../../plugins/timepicker/localization/jquery-ui-timepicker-pt-BR.js"></script>
+<script type='text/javascript' src='../../plugins/json2/json2.js'></script>
+<script type='text/javascript' src='../../plugins/store/jquery.store.js'></script>
+<script type='text/javascript' src='../../plugins/fileupload/jquery.fileupload.js'></script>
+<script type='text/javascript' src='../../plugins/fileupload/jquery.fileupload-ui.js'></script>
+<script type='text/javascript' src='../../plugins/fileupload/jquery.iframe-transport.js'></script>
+<script type='text/javascript' src='../../plugins/store/jquery.store.js'></script>
+<script type="text/javascript" src="../../plugins/jquery.pagination/jquery.pagination.js"></script>
+<script type='text/javascript' src='../../plugins/mask/jquery.maskedinput.js'></script>
+<script type='text/javascript' src='../../plugins/alphanumeric/jquery.alphanumeric.js'></script>
+<script type='text/javascript' src='../../plugins/watermark/jquery.watermarkinput.js'></script>
+<script type='text/javascript' src='../../plugins/encoder/encoder.js'></script>
+<script type='text/javascript' src='../../api/datalayer.js'></script>
 
 <!-- Datejs -->    
 <!-- <script type='text/javascript' src='../../datejs/core.js'></script> -->
-<!--<script type='text/javascript' src='../../app/plugins/datejs/date-pt-BR.js'></script>-->
-<!-- <script type='text/javascript' src='../../app/plugins/datejs/globalization/pt-BR.js'></script> -->
-<script type='text/javascript' src='../../app/plugins/datejs/sugarpak.js'></script>
-<script type='text/javascript' src='../../app/plugins/datejs/parser.js'></script>
+<!-- <script type='text/javascript' src='../../plugins/datejs/date-pt-BR.js'></script>-->
+<!-- <script type='text/javascript' src='../../plugins/datejs/globalization/pt-BR.js'></script> -->
+<script type='text/javascript' src='../../plugins/datejs/sugarpak.js'></script>
+<script type='text/javascript' src='../../plugins/datejs/parser.js'></script>
 
 <!--  <script type='text/javascript' src='../../datejs/time.js'></script>  -->
-<script type='text/javascript' src='../../app/plugins/dateFormat/dateFormat.js'></script>
+<script type='text/javascript' src='../../plugins/dateFormat/dateFormat.js'></script>
+
+<!--<script type='text/javascript' src='../fullcalendar/fullcalendar.min.js'></script>-->
+<script type='text/javascript' src='../../plugins/fullcalendar/fullcalendar.js'></script>
+
+<script type='text/javascript' src='../../plugins/jquery.dateFormat/jquery.dateFormat.js'></script>
+
+<script type='text/javascript' src='../../plugins/zebradialog/javascript/zebra_dialog.js'></script>
+<script type='text/javascript' src='../../plugins/scrollto/jquery.scrollTo.js'></script>
+<!-- <script type='text/javascript' src='../../plugins/view/jquerymx-1.0.custom.min.js'></script> -->
+<script type='text/javascript' src='../../plugins/ejs/ejs.js'></script>
+
+<script type="text/javascript" src="../../plugins/fgmenu/fg.menu.js"></script>
+
+<script type="text/javascript" src="../../plugins/qtip/jquery.qtip-1.0.0-rc3.min.js"></script>
+
+<!-- JPicker -->
+<script type="text/javascript" src="../../plugins/jpicker/jpicker-1.1.6.min.js"></script>
+<script type="text/javascript" src="../../plugins/farbtastic/farbtastic.js"></script>
+
 <script type='text/javascript' src='js/base64.js'></script>
 <script type='text/javascript' src='js/helpers.js'></script>
 <script type='text/javascript' src='js/calendar.codecs.js'></script>
+<script type='text/javascript' src='js/I18n.js'></script>
+<script type="text/javascript" src="js/init.js"></script>
 
-
-
-<!--<script type='text/javascript' src='../fullcalendar/fullcalendar.min.js'></script>-->
-<script type='text/javascript' src='../../app/plugins/fullcalendar/fullcalendar.js'></script>
-<script type='text/javascript' src='js/I18n.js'></script>
-<script type='text/javascript' src='../../app/plugins/jquery.dateFormat/jquery.dateFormat.js'></script>
-
-<script type='text/javascript' src='../../app/plugins/zebradialog/javascript/zebra_dialog.js'></script>
-<script type='text/javascript' src='../../app/plugins/scrollto/jquery.scrollTo.js'></script>
-<!-- <script type='text/javascript' src='../../app/plugins/view/jquerymx-1.0.custom.min.js'></script> -->
-<script type='text/javascript' src='../../app/plugins/ejs/ejs.js'></script>
-
-<script type="text/javascript" src="../../app/plugins/fgmenu/fg.menu.js"></script>
-
-<script type="text/javascript" src="../../app/plugins/qtip/jquery.qtip-1.0.0-rc3.min.js"></script>
-
-<!-- JPicker -->
-<script src="../../app/plugins/jpicker/jpicker-1.1.6.min.js" type="text/javascript"></script>
-
-<script src="../../app/plugins/farbtastic/farbtastic.js" type="text/javascript"></script>
-
-<script type='text/javascript'>
-
-
-$(document).ready(function() {
-
-	refresh_calendars();
-	$tabs = $('#tabs').tabs({
-	    add: function( event, ui ) {
-			User.lastView = $tabs.tabs('option' ,'selected');
-			$tabs.tabs('select', '#' + ui.panel.id);
-		},
-		remove: function( event, ui ) {
-			$tabs.tabs('select', User.lastView);
-		},
-		show: function( event, ui ){
-			delete Calendar.currentViewKey;
-			$('#calendar').fullCalendar('refetchEvents');
-		}
-	})
-	.tabs('option', 'tabTemplate', "<li><a href='#{href}'>#{label}</a><span class='ui-icon ui-icon-close'>Remove Tab</span></li>" );
-
-	/**
-	  * Make a button to close the tab
-	  */
-	$tabs.find( "span.ui-icon-close" ).live( "click", function() {
-		var index = $( "li", $tabs ).index( $( this ).parent() );
-		if($tabs.tabs('option' ,'selected') == index){
-			if($tabs.tabs("length") == 2 && User.lastView != 1)
-				$tabs.tabs( "select", 0);
-			$tabs.tabs( "select", User.lastView);
-		}
-		if($tabs.tabs('option' ,'selected') == 0 || $tabs.tabs('option' ,'selected') == 1)
-			User.lastView = $tabs.tabs('option' ,'selected');
-		if(index != -1)
-		  $tabs.tabs( "remove", index );	
-			
-		
-		});	
-	$('.button.config-menu').button({
-	    icons: {
-		primary: "ui-icon-gear",
-		secondary: "ui-icon-triangle-1-s"
-	    },
-	    text: false
-	});
-      $('.button.add').button({
-	      icons: {
-		      secondary: "ui-icon-plus"
-	      }
-      })
-
-		var miniCalendar = $('.block-vertical-toolbox .mini-calendar').datepicker({
-			dateFormat: 'yy-m-d',
-			//dateFormat: 'DD, d MM, yy',
-			//inline: true,
-			firstDay: dayOfWeek(User.preferences.weekStart),
-			onSelect: function(dateText, inst)
-			{	
-				$tabs.tabs("select", "#calendar");
-				var date = dateText.split('-');
-				var dateFullCalendar = $.fullCalendar.formatDate($('#calendar').fullCalendar('getDate'), "yyyy-MM-dd").split('-');
-				$('#calendar').fullCalendar('gotoDate',date[0],date[1]-1,date[2]);
-				$('#calendar').fullCalendar( 'changeView', 'agendaDay' );
-			}			
-		})
-		.find('.ui-icon-circle-triangle-e').removeClass('ui-icon-circle-triangle-e').addClass('ui-icon-triangle-1-e').end()
-		.find('.ui-icon-circle-triangle-w').removeClass('ui-icon-circle-triangle-w').addClass('ui-icon-triangle-1-w');
-		
-		//Onclick do mês
-		$('.ui-datepicker-title .ui-datepicker-month').live('click',function(){
-			$tabs.tabs("select", "#calendar");
-			$('#calendar').fullCalendar('gotoDate',$(this).siblings('span').html(), Date.getMonthNumberFromName($(this).html() == 'Março' ? 'Mar' : $(this).html()),'01');
- 			$('#calendar').fullCalendar( 'changeView', 'month');
-		});
-		//Onclick do ano
-		$('.ui-datepicker-title .ui-datepicker-year').live('click',function(){
-			$tabs.tabs("select", "#calendar");
-			$('#calendar').fullCalendar('gotoDate',$(this).html(), '0', '01');
-			$('.fc-button-year').click();
-		});
-		
-	//Onclick em um dia do calendário anual
-	$( ".fc-day-number" ).live( "click", function() {
-			
-		var date = $(this).parents('[class*="fc-day-"]').attr('class').match(/fc-day-(\d{4})-(\d{2})-(\d{2})/);
-
-		if (date) date.shift();
-		else return false;
-
-		$('#calendar').fullCalendar('gotoDate',date[0],date[1]-1,date[2]);
-		$('#calendar').fullCalendar( 'changeView', 'agendaDay' );
-	});	
-
-	$('.main-search input.search').keydown(function(event){
-		if(event.keyCode == 13) {
-			Encoder.EncodeType = "entity";
-			//$(this).val($(this).val());
-					
-			add_events_list($(this).val());
-			$(this).val('');
-		}
-	});
-				
-	$('.block-horizontal-toolbox .main-config-menu').menu({
-		content: $('.main-config-menu-content').html(),
-		positionOpts: {
-			posX: 'left', 
-			posY: 'bottom',
-			offsetX: -140,
-			offsetY: 0,
-			directionH: 'right',
-			directionV: 'down', 
-			detectH: true, // do horizontal collision detection  
-			detectV: true, // do vertical collision detection
-			linkToFront: false
-		},
-		flyOut: true,
-		showSpeed: 100,
-		crumbDefaultText: '>'
-	});
-	      
-		$('#trash').droppable({
-			drop: function(event, ui){
-				// 		calendar.fullCalendar( 'removeEvents', ui.draggable.attr('event-id') );
-				DataLayer.remove( "event", ui.draggable.attr('event-id') );
-				$(this).switchClass('empty','full');
-			},
-			tolerance: "touch"
-		});
-
-      /* initialize the calendar
-      -----------------------------------------------------------------*/
-		$(".button.add.add-event").click(function(event){
-			var startEvent = new Date(); 
-			if(startEvent.toString('mm') < 30)
-				startEvent.add({minutes: 30 - parseInt(startEvent.toString('mm'))});
-			else
-				startEvent.add({hours: 1, minutes: '-'+startEvent.toString('mm')});
-			var endEvent = function(date){
-				if(!!User.preferences.defaultCalendar){
-					return Calendar.signatureOf[User.preferences.defaultCalendar].calendar.defaultDuration != "" ? 
-						(parseInt(date.getTime()) + Calendar.signatureOf[User.preferences.defaultCalendar].calendar.defaultDuration * 60000) 
-						: (User.preferences.defaultDuration * 60000);
-				}else
-					return parseInt(date.getTime()) + (User.preferences.defaultDuration * 60000);
-			};	
-			eventDetails({ 
-				startTime: startEvent.getTime(),
-				endTime: endEvent(startEvent)
-			}, true );
-		});
-
-	var calendar = $('#calendar').fullCalendar({
-
-		defaultView: User.preferences.defaultCalView,
-		timeFormat: User.preferences.hourFormat,
-		axisFormat: User.preferences.hourFormat,
-		eventSources: Calendar.sources,
-
-		header: {
-			left: 'prev,next today,basicWeek,basicDay',
-			center: 'title',
-			right: 'agendaDay,agendaWeek,month,year'
-		},
-		firstDay: dayOfWeek(User.preferences.weekStart),
-		editable: true,
-		selectable: true,
-		selectHelper: true,
-		droppable: true, // this allows things to be dropped onto the calendar !!!
-		timeFormat: {
-			agenda: 'HH:mm{ - HH:mm}',
-			'': 'HH:mm{ - HH:mm} }'
-		},
-		titleFormat: {
-			month: 'MMMM yyyy',                             
-			week: "dd[ yyyy] { 'a'[ MMM] dd 'de' MMMM '-' yyyy}", 
-			day: 'dddd,  dd MMM, yyyy'
-		},
-		columnFormat:{
-			month: 'ddd',    
-			week: 'ddd dd/MM', 
-			day: 'dddd dd/MM'  
-		},
-		monthNames: ['Janeiro','Fevereiro','Março','Abril','Maio','Junho','Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro' ], 
-		monthNamesShort: ['Jan','Fev','Mar','Abr','Mai','Jun','Jul','Ago','Set','Out','Nov','Dez'],
-		dayNames: [ 'Domingo', 'Segunda', 'Terça', 'Quarta', 'Quinta', 'Sexta', 'Sábado'],
-		dayNamesShort: ['Dom','Seg','Ter','Qua','Qui','Sex','Sáb'],
-		dayNamesShortest: ['D','S','T','Q','Q','S','S'],
-		allDayText: 'Dia todo',
-		buttonText: {
-			today: 'hoje',
-			month: 'mês',
-			week: 'semana',
-			day: 'dia',
-			year: 'ano'
-		},
-		
-		eventRender: function( event, element, view ){
-			$(element).attr( 'event-id', event.id );
-		},
-
-		select: function( start, end, allDay, event, view ){
-			eventDetails( { 'start': start,
-					'end': end,
-					'allDay': allDay } );
-		},
-
-		eventDrop: function( event ){
-			DataLayer.put( "schedulable:calendar", event );
-		},
-
-		eventResize: function( event ){
-			DataLayer.put( "schedulable:calendar", event );
-		},
-
-		eventClick: function( evt, event, view ){
-			eventDetails( DataLayer.get( "schedulable", evt.id), true);
-		}
-	});
-	  
-	if($(window).height() < $('body').height()){
-		var hei = $('body').height() - $(window).height();
-		hei = $('#divAppbox').height() - hei;
-		$('#divAppbox').css('max-height', hei);
-		$('#divAppbox').css('min-height', hei);
-		$('body').css('overflow-y','hidden');
-		delete hei;
-	 }
-	  
-	 $(window).resize(function(){
-		$('#divAppbox').css('max-height', $(window).height() - 104);
-		$('#divAppbox').css('min-height', $(window).height() - 104);
-		$('#divAppbox').css('overflow-x', 'auto');
-		$('#divAppbox').css('overflow-y', 'scroll');
-	});	  
-	//Todo chamada do metodo que adiciona ao full calendar o botao de listagem de eventos  
-	//listEvents();
-});
-</script>
 </head>
 
Index: trunk/prototype/modules/calendar/templates/notify_reject_body.tpl
===================================================================
--- trunk/prototype/modules/calendar/templates/notify_reject_body.tpl	(revision 5399)
+++ trunk/prototype/modules/calendar/templates/notify_reject_body.tpl	(revision 5399)
@@ -0,0 +1,6 @@
+<br />[participant] rejeitou o seu convite de compromisso agendado para [startDate].<br /><br />
+<strong>[eventTitle]</strong><br />
+<strong>InÃ­cio:</strong> [startDate] [startTime]<br />
+<strong>TÃ©rmino:</strong> [endDate] [endTime]<br />
+<strong>Local:</strong> [eventLocation]<br />
+
Index: trunk/prototype/modules/calendar/templates/notify_attempt_body.tpl
===================================================================
--- trunk/prototype/modules/calendar/templates/notify_attempt_body.tpl	(revision 5399)
+++ trunk/prototype/modules/calendar/templates/notify_attempt_body.tpl	(revision 5399)
@@ -0,0 +1,6 @@
+<br />[participant] talvez compareÃ§a no compromisso agendado para [startDate].<br /><br />
+<strong>[eventTitle]</strong><br />
+<strong>InÃ­cio:</strong> [startDate] [startTime]<br />
+<strong>TÃ©rmino:</strong> [endDate] [endTime]<br />
+<strong>Local:</strong> [eventLocation]<br />
+
Index: trunk/prototype/modules/calendar/templates/notify_suggest_body.tpl
===================================================================
--- trunk/prototype/modules/calendar/templates/notify_suggest_body.tpl	(revision 5399)
+++ trunk/prototype/modules/calendar/templates/notify_suggest_body.tpl	(revision 5399)
@@ -0,0 +1,6 @@
+<br />[participant] sugeriu um novo horÃ¡rio para o seu convite de compromisso agendado para [startDate].<br /><br />
+<strong>[eventTitle]</strong><br />
+<strong>InÃ­cio sugerido:</strong> [startDateSuggested] [startTimeSuggested]<br />
+<strong>TÃ©rmino:</strong> [endDateSuggested] [endTimeSuggested]<br />
+<strong>Local:</strong> [eventLocation]<br />
+<strong>Participantes:</strong> [participants]
Index: trunk/prototype/modules/calendar/templates/calendar_list.ejs
===================================================================
--- trunk/prototype/modules/calendar/templates/calendar_list.ejs	(revision 5381)
+++ trunk/prototype/modules/calendar/templates/calendar_list.ejs	(revision 5399)
@@ -22,5 +22,5 @@
 						</div> 
 							<a class="cal-list-options-btn my-cal-list-options-btn-<%= agendas_usuario[i].id %>" style="background-color:#<%=assinatures.backgroundColor%>; border-color:#<%= assinatures.borderColor%>;">
-								<img src="img/arrow_down.png" width="10" height="10" class="cal-list-img"/>
+								<img src="../prototype/modules/calendar/img/arrow_down.png" width="10" height="10" class="cal-list-img"/>
 							</a>
 							
Index: trunk/prototype/modules/calendar/templates/notify_subject.tpl
===================================================================
--- trunk/prototype/modules/calendar/templates/notify_subject.tpl	(revision 5399)
+++ trunk/prototype/modules/calendar/templates/notify_subject.tpl	(revision 5399)
@@ -0,0 +1,1 @@
+[notificationType]: [eventTitle] @ [startDate] [startTime] - [endDate] [endTime] ([participant])
Index: trunk/prototype/modules/calendar/templates/calendarlist.ejs
===================================================================
--- trunk/prototype/modules/calendar/templates/calendarlist.ejs	(revision 5341)
+++ trunk/prototype/modules/calendar/templates/calendarlist.ejs	(revision 5399)
@@ -10,5 +10,5 @@
 						
 						<a class="cal-list-options-btn my-cal-list-options-btn-<%= i %>" onclick="show_cal_list_options('my-cal-list-options-', <%= i %>)">
-							<img src="img/arrow_down.png" width="10" height="10" class="cal-list-img"/>
+							<img src="../prototype/modules/calendar/img/arrow_down.png" width="10" height="10" class="cal-list-img"/>
 						</a>
 						<div class="cal-list-options my-cal-list-options-<%= i %> hidden">
Index: trunk/prototype/modules/calendar/templates/index.ejs
===================================================================
--- trunk/prototype/modules/calendar/templates/index.ejs	(revision 5399)
+++ trunk/prototype/modules/calendar/templates/index.ejs	(revision 5399)
@@ -0,0 +1,136 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
+
+<!--<link rel='stylesheet' type='text/css' href="<?= ROOTPATH ?>../templates/jquery-ui/redmond/jquery-ui.css"/>-->
+
+<!--<link rel='stylesheet' type='text/css' href='../fullcalendar/fullcalendar.css' />-->
+<script type='text/javascript' src='<?= MODULESURL ?>/js/debug.js'></script>
+<link rel="stylesheet" type="text/css" href="<?= MODULESURL ?>/css/reset.css" />
+
+<link rel='stylesheet' type='text/css' href='<?= PLUGINSURL ?>/fullcalendar/fullcalendar.css' />
+<link rel='stylesheet' type='text/css' href='<?= PLUGINSURL ?>/fullcalendar/fullcalendar.print.css' media='print' />
+<link rel='stylesheet' type='text/css' href='<?= PLUGINSURL ?>/jquery/jquery-ui.custom.css'/>
+<link rel='stylesheet' type='text/css' href='<?= PLUGINSURL ?>/icalendar/jquery.icalendar.css'/>
+<link rel="stylesheet" type="text/css" href="<?= PLUGINSURL ?>/fgmenu/fg.menu.css" media="screen"/>
+<!--<link type="text/css" href="<?= $ROOTPATH ?>fgmenu/theme/ui.all.css" media="screen" rel="stylesheet" />-->
+
+<link rel='stylesheet' type='text/css' href='<?= PLUGINSURL ?>/fileupload/jquery.fileupload-ui.css'/>
+<link rel="stylesheet" type='text/css' href="<?= PLUGINSURL ?>/jquery.pagination/pagination.css" />
+
+<!-- JPicker -->
+<link rel="Stylesheet" type="text/css" href="<?= PLUGINSURL ?>/jpicker/css/jPicker-1.1.6.min.css" />
+<link rel="Stylesheet" type="text/css" href="<?= PLUGINSURL ?>/jpicker/jPicker.css" />
+
+<link rel="Stylesheet" type="text/css" href="<?= PLUGINSURL ?>/farbtastic/farbtastic.css" />
+<link rel="Stylesheet" type="text/css" href="<?= PLUGINSURL ?>/timepicker/jquery-ui-timepicker-addon.css" />
+<link rel="stylesheet" type="text/css" href='<?= PLUGINSURL ?>/zebradialog/css/zebra_dialog.css'></link>
+
+<link rel="stylesheet" type="text/css" href="<?= MODULESURL ?>/css/layout.css" />
+<link rel="stylesheet" type="text/css" href="<?= MODULESURL ?>/css/style.css" />
+
+<script type='text/javascript' src='<?= PLUGINSURL ?>/datejs/date-pt-BR.js'></script>
+<script type='text/javascript' src='<?= PLUGINSURL ?>/jquery/jquery.min.js'></script>
+<script type='text/javascript' src='<?= PLUGINSURL ?>/icalendar/jquery.icalendar.js'></script>
+<script type='text/javascript' src='<?= PLUGINSURL ?>/jquery/jquery-ui.custom.min.js'></script>
+<script type='text/javascript' src="<?= PLUGINSURL ?>/jquery/i18n/jquery.ui.datepicker-pt-BR.js"></script>
+<script type='text/javascript' src="<?= PLUGINSURL ?>/timepicker/jquery-ui-timepicker-addon.js"></script>
+<script type='text/javascript' src="<?= PLUGINSURL ?>/timepicker/localization/jquery-ui-timepicker-pt-BR.js"></script>
+<script type='text/javascript' src='<?= PLUGINSURL ?>/json2/json2.js'></script>
+<script type='text/javascript' src='<?= PLUGINSURL ?>/store/jquery.store.js'></script>
+<script type='text/javascript' src='<?= PLUGINSURL ?>/fileupload/jquery.fileupload.js'></script>
+<script type='text/javascript' src='<?= PLUGINSURL ?>/fileupload/jquery.fileupload-ui.js'></script>
+<script type='text/javascript' src='<?= PLUGINSURL ?>/fileupload/jquery.iframe-transport.js'></script>
+<script type='text/javascript' src='<?= PLUGINSURL ?>/store/jquery.store.js'></script>
+<script type="text/javascript" src="<?= PLUGINSURL ?>/jquery.pagination/jquery.pagination.js"></script>
+<script type='text/javascript' src='<?= PLUGINSURL ?>/mask/jquery.maskedinput.js'></script>
+<script type='text/javascript' src='<?= PLUGINSURL ?>/alphanumeric/jquery.alphanumeric.js'></script>
+<script type='text/javascript' src='<?= PLUGINSURL ?>/watermark/jquery.watermarkinput.js'></script>
+<script type='text/javascript' src='<?= PLUGINSURL ?>/encoder/encoder.js'></script>
+<script type='text/javascript' src='<?= PLUGINSURL ?>/../api/datalayer.js'></script>
+
+<!-- Datejs -->    
+<!-- <script type='text/javascript' src='<?= ROOTPATH ?>datejs/core.js'></script> -->
+<!-- <script type='text/javascript' src='<?= PLUGINSURL ?>/datejs/date-pt-BR.js'></script>-->
+<!-- <script type='text/javascript' src='<?= PLUGINSURL ?>/datejs/globalization/pt-BR.js'></script> -->
+<script type='text/javascript' src='<?= PLUGINSURL ?>/datejs/sugarpak.js'></script>
+<script type='text/javascript' src='<?= PLUGINSURL ?>/datejs/parser.js'></script>
+
+<!--  <script type='text/javascript' src='<?= ROOTPATH ?>datejs/time.js'></script>  -->
+<script type='text/javascript' src='<?= PLUGINSURL ?>/dateFormat/dateFormat.js'></script>
+<!--<script type='text/javascript' src='../fullcalendar/fullcalendar.min.js'></script>-->
+<script type='text/javascript' src='<?= PLUGINSURL ?>/fullcalendar/fullcalendar.js'></script>
+<script type='text/javascript' src='<?= PLUGINSURL ?>/jquery.dateFormat/jquery.dateFormat.js'></script>
+<script type='text/javascript' src='<?= PLUGINSURL ?>/zebradialog/javascript/zebra_dialog.js'></script>
+<script type='text/javascript' src='<?= PLUGINSURL ?>/scrollto/jquery.scrollTo.js'></script>
+<!-- <script type='text/javascript' src='<?= PLUGINSURL ?>/view/jquerymx-1.0.custom.min.js'></script> -->
+<script type='text/javascript' src='<?= PLUGINSURL ?>/ejs/ejs.js'></script>
+<script type="text/javascript" src="<?= PLUGINSURL ?>/fgmenu/fg.menu.js"></script>
+<script type="text/javascript" src="<?= PLUGINSURL ?>/qtip/jquery.qtip-1.0.0-rc3.min.js"></script>
+
+<!-- JPicker -->
+<script type="text/javascript" src="<?= PLUGINSURL ?>/jpicker/jpicker-1.1.6.min.js"></script>
+<script type="text/javascript" src="<?= PLUGINSURL ?>/farbtastic/farbtastic.js"></script>
+
+<script type="text/javascript">
+
+DataLayer.dispatchPath = '<?= PLUGINSURL ?>/../';
+DataLayer.templatePath = '<?= MODULESURL ?>/';
+
+</script>
+
+<script type='text/javascript' src='<?= MODULESURL ?>/js/base64.js'></script>
+<script type='text/javascript' src='<?= MODULESURL ?>/js/helpers.js'></script>
+<script type='text/javascript' src='<?= MODULESURL ?>/js/calendar.codecs.js'></script>
+<script type='text/javascript' src='<?= MODULESURL ?>/js/I18n.js'></script>
+<script type="text/javascript" src="<?= MODULESURL ?>/js/init.js"></script>
+
+</head>
+
+<body>
+	<div id="wrap" class="expresso-calendar-container" style="text-align:left;">
+		<div class="block-horizontal-toolbox">
+			<a class="button config-menu main-config-menu" href="#"></a>
+			<div class="main-config-menu-content hidden"> 
+				<ul>
+					<li><a href="#" onclick="add_tab_preferences();" class="menu-command configurations">Prefer&ecirc;ncias</a></li>
+					<li><a href="#" onclick="add_tab_configure_calendar();" class="menu-command configurations">Configura&ccedil;&atilde;o de agendas</a></li>
+					<li><a href="#" onclick="show_modal_import_export(0);" class="menu-pass-through">Importar</a></li>
+					<li><a href="#" onclick="show_modal_import_export(1);" class="menu-pass-through">Exportar</a></li>
+				</ul>
+			</div>		
+			<fieldset class="search-field main-search ui-corner-all">
+				<span class="ui-icon ui-icon-search"></span>
+				<input class="search" type="text" />
+			</fieldset>
+		</div>
+		
+		<div class="block-vertical-toolbox">
+			<a class="button add add-event" href="#">Adicionar evento</a>
+			<!--<a class="button add" href="#" onclick="add_events_list();">Lista de Eventos</a>-->
+			<div class="mini-calendar"></div>
+
+			<div class="calendars-list"></div> 
+
+			<div id="trash" class="ui-corner-all empty hidden"  align="middle" valign="middle"><label>Lixeira</label></div>
+		</div>
+
+		<div id="tabs"> 
+			<ul>
+				<li><a href="#calendar">Agenda</a></li>
+				<li><a href="#tab_events_list_" onclick="add_events_list();">Lista de Eventos</a></li>
+				<!--<li><a href="#sandbox2">Sandbox</a></li>-->
+			</ul>
+			<div id="calendar"> </div>
+			<div id="tab_events_list_"> </div>
+			<div id="sandbox2">	</div>
+		</div>
+		
+		<div id="sandbox" class="expresso-calendar-container hidden"> </div>
+		<div id="div-import-export-calendar" class="expresso-calendar-container"> </div>
+		<div id="div-alarm" class="expresso-alarm-container"> </div>
+	</div>
+</body>
+
+</html>
+
Index: trunk/prototype/modules/calendar/templates/notify_cancel_body.tpl
===================================================================
--- trunk/prototype/modules/calendar/templates/notify_cancel_body.tpl	(revision 5399)
+++ trunk/prototype/modules/calendar/templates/notify_cancel_body.tpl	(revision 5399)
@@ -0,0 +1,1 @@
+<br />Seu compromisso agendado para [startDate] foi cancelado.<br />
Index: trunk/prototype/modules/calendar/templates/notify_modify_body.tpl
===================================================================
--- trunk/prototype/modules/calendar/templates/notify_modify_body.tpl	(revision 5399)
+++ trunk/prototype/modules/calendar/templates/notify_modify_body.tpl	(revision 5399)
@@ -0,0 +1,5 @@
+<br />Seu compromisso agendado para [startDate] foi modificado.<br /><br /><strong>[eventTitle]</strong><br />
+<strong>InÃ­cio:</strong> [startDate] [startTime]<br />
+<strong>TÃ©rmino:</strong> [endDate] [endTime]<br />
+<strong>Local:</strong> [eventLocation]<br />
+<strong>Participantes:</strong> [participants]
Index: trunk/prototype/modules/calendar/templates/notify_alarm_body.tpl
===================================================================
--- trunk/prototype/modules/calendar/templates/notify_alarm_body.tpl	(revision 5399)
+++ trunk/prototype/modules/calendar/templates/notify_alarm_body.tpl	(revision 5399)
@@ -0,0 +1,7 @@
+<br />Este Ã© um lembrete informando que vocÃª possui um compromisso agendado para [startDate].<br /><br />
+<strong>[eventTitle]</strong><br />
+<strong>InÃ­cio:</strong> [startDate] [startTime]<br />
+<strong>TÃ©rmino:</strong> [endDate] [endTime]<br />
+<strong>Fuso Horario:</strong> [timezone]<br />
+<strong>Local:</strong> [eventLocation]<br />
+<strong>Participantes:</strong> [participants]
Index: trunk/prototype/modules/calendar/templates/notify_accept_body.tpl
===================================================================
--- trunk/prototype/modules/calendar/templates/notify_accept_body.tpl	(revision 5399)
+++ trunk/prototype/modules/calendar/templates/notify_accept_body.tpl	(revision 5399)
@@ -0,0 +1,5 @@
+<br />[participant] aceitou o seu convite de compromisso agendado para [startDate].<br /><br />
+<strong>[eventTitle]</strong><br />
+<strong>InÃ­cio:</strong> [startDate] [startTime]<br />
+<strong>TÃ©rmino:</strong> [endDate] [endTime]<br />
+<strong>Local:</strong> [eventLocation]<br />
Index: trunk/prototype/modules/calendar/templates/notify_create_body.tpl
===================================================================
--- trunk/prototype/modules/calendar/templates/notify_create_body.tpl	(revision 5399)
+++ trunk/prototype/modules/calendar/templates/notify_create_body.tpl	(revision 5399)
@@ -0,0 +1,6 @@
+<br />VocÃª foi convidado para um compromisso agendado para [startDate].<br /><br />
+<strong>[eventTitle]</strong><br />
+<strong>InÃ­cio:</strong> [startDate] [startTime]<br />
+<strong>TÃ©rmino:</strong> [endDate] [endTime]<br />
+<strong>Local:</strong> [eventLocation]<br />
+<strong>Participantes:</strong> [participants]
Index: trunk/prototype/api/parseTPL.php
===================================================================
--- trunk/prototype/api/parseTPL.php	(revision 5399)
+++ trunk/prototype/api/parseTPL.php	(revision 5399)
@@ -0,0 +1,20 @@
+<?php
+
+class ParseTPL
+{
+	
+	static function load_tpl(&$data, $file){
+      $tpl = '' ;
+	if( $fd = @fopen($file,"r")){
+		while( !feof($fd) ){
+			$tpl = fread($fd,1024);
+		}
+	}
+	foreach($data as $i => $v){
+		$tpl = str_replace('['.$i.']',$v,$tpl);}
+	
+	return $tpl;
+	}	
+}
+
+?>
Index: trunk/prototype/api/datalayer.js
===================================================================
--- trunk/prototype/api/datalayer.js	(revision 5399)
+++ trunk/prototype/api/datalayer.js	(revision 5399)
@@ -0,0 +1,2432 @@
+internalUrl = /^([A-z0-9-_]+)(:[A-z0-9-_]+)?$/;
+internalUri = /^([a-zA-Z0-9-_]+)\(([a-zA-Z0-9-_]+)\):\/\/(.*)|([a-zA-Z0-9-_]+):\/\/(.*)$/;
+isGeneratedId = /^\d+\(javascript\)$/;
+arrayName = /^([A-z0-9-_]+)\[\]$/;
+startsDoubleDot = /^:/;
+// cached_urls = {};
+
+$.ajaxPrefilter(function( options, originalOptions, jqXHR ){
+
+      if( options.url != 'undefined' && internalUrl.test( options.url ) ){
+
+// 	  if( !cached_urls[options.url] )
+// 	      return;
+// 	  alert( options.url + " dentro" );
+	  jqXHR.abort(); 
+
+	  var callback = ( options.success || options.complete || $.noop );
+
+	  switch( options.type.toUpperCase() )
+	  {
+	    case 'GET':
+		  return callback( DataLayer.get( options.url, /*false,*/ options.data ) );
+
+	    case 'POST':
+		  return callback( DataLayer.put( options.url, options.data ) );
+	  }
+
+	  //return( false );
+
+// 	  options.url = params[1];
+// 	  options.data = ( options.data || "" ) + "&" + params[2];
+      }
+
+});
+
+// $("a").live("click", function( event ){
+// 
+//     event.preventDefault();
+// 
+//     $.ajax({
+// 
+// 	
+// 
+//     });
+// 
+// });
+
+$("form").live( "submit", function( event ){
+
+    var $this = $(this), action = $this.attr('action'), res = false,
+    
+    method = $this.attr( 'method' ),
+    
+    fileInputs = $this.find('input[type="file"]');
+    
+    if( fileInputs.length && !$this.is('[enctype="multipart/form-data"]') )
+    {
+	event.preventDefault();
+
+	DataLayer.send( action, 
+			[ method, 'iframe json' ], {}, 
+			//TODO: check the type for conversion
+			DataLayer.receive, 
+			false, { 'formData': $this.serializeArray(),  'fileInput': fileInputs } );
+
+	return( false );
+    }
+    
+    if( res = internalUrl.exec( action ) )
+    {
+	event.preventDefault();
+
+	var data = DataLayer.form( this );
+	
+	switch( method.toUpperCase() )
+	{
+	  case 'GET':
+		DataLayer.get( res[0], data );
+
+	  case 'POST':
+	DataLayer.put( res[1], data );
+	}
+
+	return( false );
+    }
+
+    return( true );
+});
+
+this.storage = new $.store();
+
+DataLayer = {
+
+    links: {},
+    concepts: {},
+    listeners: {},
+    encoders: {},
+    decoders: {},
+    templates: {},
+    criterias: {},
+    tasks: [],
+
+    render: function( templateName, data, filter, formatter, force ){
+
+	if( $.isFunction( filter ) )
+	{
+	    force = formatter;
+	    formatter = filter;
+	    filter = false;
+	}
+
+	if( typeof data === "string" )
+	{
+	    data = this.get( data, filter, force ) || {};
+	}
+	
+	var formatting = function( template ){
+
+	      if( template === false ) return( false );
+
+	      if( template )
+		  DataLayer.templates[ templateName ] = new EJS({ text: template, cache: false });
+
+	      var html = DataLayer.templates[ templateName ].render( { data: data } );
+
+	      if( !formatter )
+		  return( html );
+
+	      return formatter( html );
+	}
+
+	if( this.templates[ templateName ] )
+	{
+	    return formatting();
+	}
+
+	return this.send( DataLayer.templatePath + templateName, 'get', false, formatting, !!!formatter );
+    },
+    
+    send: function( url, type, data, callback, sync, extraOptions ){
+      
+	  var result = false, fired = false;
+      
+	  var envelope = {
+
+	      'async': ( typeof sync !== "undefined" ? !sync : !!callback ),
+	      'url': url,
+	      'success': function( dt, textStatus, jqXHR ){
+
+		    if( callback )
+		    {
+			fired = true;
+			result = callback( dt, textStatus, jqXHR );
+		    }
+		    else
+			result = dt;
+
+		},
+	      'complete': function( jqXHR, textStatus ){
+
+		  if( !fired && callback )
+		      result = callback( false, textStatus, jqXHR );
+
+	      },
+
+	      'type': $.isArray( type ) ? type[0] : type,
+	      'data': data
+
+	    };
+
+	  if( $.isArray( type ) && type[1] )
+	      envelope['dataType'] = type[1];
+
+	  if( extraOptions )
+	      envelope = $.extend( envelope, extraOptions );
+
+	  $.ajax( envelope );
+      
+	  return( result );
+    },
+    
+    dispatch: function( dispatcher, data, callback, isPost, dataType ){
+      
+      return this.send( this.dispatchPath + dispatcher + ".php", 
+			[ ( isPost ? 'post' : 'get' ), dataType || 'json' ],
+			data,
+			callback );
+
+//       $.ajax({
+// 	      'async': !!callback,
+// 	      'url': this.dispatchPath + dispatcher + ".php",
+// 	      'type': ( isPost ? 'post' : 'get' ),
+// 	      'dataType': 'json',
+// 	      'data': data,
+// 	      'success': function( dt, textStatus, jqXHR ){
+// 
+// 		    if( callback )
+// 		    {
+// 			fired = true;
+// 			callback( dt, textStatus, jqXHR );
+// 		    }
+// 		    else
+// 			result = dt;
+// 
+// 		},
+// 	      'complete': function( jqXHR, textStatus ){
+// 
+// 		  if( !fired && callback )
+// 		      callback( false, textStatus, jqXHR );
+// 
+// 	      }/*,
+// 	      'processData': false*/
+// 	  });
+
+      //return( result );
+    },
+
+    form: function( target ){
+
+	var params = {}, $this = $(target);
+
+	if( !$this.is( "form" ) )
+	    $this = $this.parents( "form" );
+
+	$.each( $this.serializeArray(), function( i, el ){
+
+	    if( newName = arrayName.exec( el.name ) )
+		el.name = newName[1];
+	    else if( !params[ el.name ] )
+		return( params[ el.name ] = el.value );
+
+	    params[ el.name ] = params[ el.name ] || [];
+
+	    if( $.type(params[ el.name ]) !== "array" )
+		params[ el.name ] = [ params[ el.name ] ];
+
+	    params[ el.name ].push( el.value );
+	});
+
+// 	alert(dump(params));
+
+	return this.decode( $this.attr( "action" ), params );
+    },
+
+    blend: function( action, data ){
+
+// 	if( notArray = (!$.isArray(data)) )
+// 	    data = [ data ];
+
+	var form = $('form[action="'+action+'"]');
+
+	form.get(0).reset();
+
+	var named = form.find( 'input[name]' );
+
+	for( var name in data )
+	{
+	    named.filter( '[name="'+name+'"]' ).val( data[name] );
+	}
+    },
+
+ 
+    
+    put: function( concept, filter, data, oneSide ){
+      
+      ///////////////////////////// normalize ////////////////////////////////
+	if( arguments.length == 2 )
+	{
+	    data = filter;
+	    filter = false;
+	}
+	if( typeof data === "undefined" ||
+	    $.type(data) === "boolean" )
+	{
+	    oneSide = data;
+	    data = filter;
+	    filter = false;
+	}
+	
+	if( !concept || !data )
+	    return( false );
+
+	var decoder = "", id = false, bothSides = (typeof oneSide === "undefined"), notArray, res;
+	
+	if( $.type(filter) === "string" )
+	{
+	    id = filter;
+	    filter = false;
+	}
+
+	if( id )
+	    data.id = id;
+
+	if( notArray = ( $.type( data ) !== "array" ) )
+	    data = [ data ];
+
+	if( res = internalUrl.exec( concept ) )
+	{
+	    //TODO: verificar se a decodificaÃ§ao deve ser feita em cada item do array
+	    data = this.decode( concept, data );
+	    concept = res[1];
+	    decoder = res[2];
+	}
+
+      ////////////////////////////////////////////////////////////////////////
+
+	if( bothSides || !oneSide )
+	{
+	    var result = false, links = this.links( concept ), 
+	    current = this.check( concept ) || {}, ids = [];
+
+	    for( var i = 0; i < data.length; i++ )
+	    {
+		var key = ids[ ids.length ] = data[i].id || this.generateId( concept ), updateSet = {};
+
+		////////////////////////////// linkage /////////////////////////////////    
+		for( var link in links )
+		{
+		    if( data[i][link] )
+		    {
+			var isConcept = false;
+		      
+			if( isConcept = this.isConcept( concept, link ) )
+			    data[i][link] = [ data[i][link] ];
+
+			var _this = this;
+
+			$.each( data[i][link], function( ii, el ){
+
+				var isRef = false;
+
+				if( isRef = ($.type(el) === "string") )
+				    el = { id: el };
+
+				var nestedLinks = _this.links( links[link], true );
+				
+				if( isConcept )
+				{
+				    el[ nestedLinks[concept] ] = el[ nestedLinks[concept] ] || [];
+				    el[ nestedLinks[concept] ].push( key );
+				}
+				else
+				    el[ nestedLinks[concept] ] = key;
+
+				if( isRef && ( !current[ key ] || !current[ key ][ link ] || 
+				               (isConcept ? current[ key ][ link ] !== el.id : !$.inArray( el.id, current[ key ][ link ] )) ) )
+				{
+				    updateSet[ links[link] ] = updateSet[ links[link] ] || [];
+				    updateSet[ links[link] ].push( el );
+				}
+				else if( !isRef )
+				    data[i][link][ii] = _this.put( links[link], el, oneSide );
+			    });
+
+			if( isConcept )
+			    data[i][link] = data[i][link][0];
+		    }
+		}
+		//////////////////////////////////////////////////////////////////////////
+
+		if( data[i].id )
+		    data[i] = this.merge( current[ data[i].id ], data[i] );
+
+		 current[ key ] = data[i];
+
+		if( bothSides )
+		  this.report( concept, key, data[i] );
+	    }
+
+	    this.store( concept, current );
+
+	    for( var setKey in updateSet )
+	    {
+		if( bothSides )
+		    for( var i = 0; i < updateSet[ setKey ].length; i++ )
+		      this.report( setKey, updateSet[ setKey ][i].id, updateSet[ setKey ][i] );
+		    
+		DataLayer.put( setKey, updateSet[ setKey ], false );
+	    }
+	}
+
+	if( oneSide ) 
+	    this.commit( concept, ids/*, true */);
+
+	this.broadcast( concept, oneSide ? 'server' : bothSides ? 'serverclient' : 'client', true );
+
+	return( notArray ? ids[0] : ids );
+
+    },
+    
+    remove: function( concept, id, oneSide ){
+      
+	var bothSides = (typeof oneSide === "undefined"),
+
+	links = this.links( concept ), ids = [],
+
+	current = this.check( concept, id );
+
+	if( !current ) return;
+	
+	if( id )
+	    current.id = id;
+
+	if( notArray = ( $.type( current ) !== "array" ) )
+	    current = [ current ];
+
+	for( var i = 0; i < current.length; i++ )
+	{
+	    var currentId = ids[ ids.length ] = current[i].id;
+
+	    if( bothSides )
+	      this.report( concept, currentId, false );
+
+	    if( bothSides || !oneSide )
+	      this.del( concept, currentId );
+
+	    for( var link in links )
+	    {
+		if( !current[i][link] )
+		    continue;
+
+		var nestedLinks = this.links( links[link], true );
+
+		if( isConcept = this.isConcept( concept, link ) )
+		    current[i][link] = [ current[i][link] ];
+
+		$.each( current[i][link], function( ii, el ){
+
+			el = DataLayer.storage.cache[links[link]][el];
+
+			if( notArrayNested = ( $.type( el[ nestedLinks[concept] ] ) !== "array" ) )
+			    el[ nestedLinks[concept] ] = [ el[nestedLinks[concept]] ];
+
+			el[ nestedLinks[concept] ] = $.grep( el[ nestedLinks[concept] ], function( nested, iii ){
+			    return ( currentId !== nested );
+			});
+
+			if( notArrayNested )
+			    el[ nestedLinks[concept] ] = el[ nestedLinks[concept] ][0] || false;
+			if(!el[ nestedLinks[concept] ] || !el[ nestedLinks[concept] ].length)
+				delete el[ nestedLinks[concept] ];
+		});
+	    }
+	}
+
+	if( oneSide )
+	    this.commit( concept, ids );
+
+	this.broadcast( concept, oneSide ? 'server' : bothSides ? 'serverclient' : 'client', false );
+    },
+    
+    report: function( concept, id, data )
+    {      
+	var current = this.check( ':current', concept ) || {};
+
+	if( !current[ id ] )
+	    current[ id ] = this.check( concept, id ) || {};
+	
+	this.store( ':current', concept, current );
+
+	var diff = this.diff( current[ id ], data );
+
+	var diffs = this.check( ':diff', concept ) || {};
+
+	if( diffs[ id ] )
+	    diff = this.merge( diffs[ id ], diff );
+
+	if( !diff || !$.isEmptyObject( diff ) )
+	    diffs[ id ] = diff;
+
+	this.store( ':diff', concept, diffs );
+    },
+
+//     enqueue: function( queueName, concept, id, data ){
+// 
+// 	var queue = this.check( ':' + queueName, concept ) || {};
+// 
+// 
+//     },
+//     
+//     dequeue: function( queueName, concept, id ){
+// 
+// 	
+// 
+//     },
+    
+    
+    
+    rollback: function( concept, ids ){
+      
+	var queue = this.prepareQ( 'current', concept, ids );
+
+	ids = [];
+
+	for( var id in queue )
+	{
+	     this.put( concept, id, queue[id], false );
+
+	     ids[ ids.length ] = id;
+	}
+
+	this.clearQ( concept, ( ids.length ? ids : false ) );
+
+	this.broadcast( concept, 'revert' );
+      
+    },
+    
+    prepareQ: function( queueName, concept, ids ){
+      
+      var notArray = false;
+      
+      if( notArray = ($.type(concept) !== "array") )
+	  concept = [ concept ];
+      
+      var q = {};
+      
+      for( var i = 0; i < concept.length; i++ )
+      {
+	  var queue = this.check( ':' + queueName, concept[i] || false );
+	  
+	  if( !queue ) continue;
+
+	  if( ids )
+	  {
+	      if( $.type(ids) !== "array" )
+		  ids = [ ids ];
+
+	      var filtered = {};
+
+	      for( var ii = 0; ii < ids.length; ii++ )
+	      {
+		  filtered[ ids[ii] ] = queue[ ids[ii] ];
+	      }
+
+	      queue = filtered;
+	  }
+
+	  q[ concept[i] ] = queue;
+      }
+      
+      return( notArray ? q[ concept[0] ] : q );
+    },
+    
+    clearQ: function( concept, ids ){
+      
+//       	var current = this.check( ':current', concept || false );
+	var diffs = this.check( ':diff', concept || false );
+
+	if( !ids )
+	   /* current =*/ diffs = {};
+	else
+	{
+	    if( notArray = ($.type(ids) !== "array") )
+	      ids = [ ids ];
+
+	    for( var i = 0; i < ids.length; i++ )
+	    {
+// 		delete current[ ids[i] ];
+		delete diffs[ ids[i] ];
+	    }
+	}
+
+// 	this.store( ':current', concept, current );
+	this.store( ':diff', concept, diffs );
+    },
+
+    commit: function( concept, ids, callback ){
+      
+	var queue = this.prepareQ( 'diff', concept, ids );
+
+	this.sync( queue, !$.isArray(concept) && concept || false, callback );
+    },
+    
+    sync: function( queue, concept, callback ){
+
+	if( !queue || $.isEmptyObject( queue ) )
+	    return;
+
+	if( concept )
+	{
+	  var helper = {}; 
+	  helper[concept] = queue; 
+	  queue = helper;
+	}
+
+	var data = {}, URIs = {};
+
+	for( var concept in queue )
+	    for( var id in queue[concept] )
+	    {
+		data[ this.URI( concept, id ) ] = queue[concept][id];
+		URIs[ this.URI( concept, id ) ] = { concept: concept, id: id };
+	    }
+
+	if( $.isEmptyObject( data ) )
+	    return;
+
+	this.dispatch( "Sync", data, function( data, status, jqXHR ){
+
+// 	    switch( status )
+// 	    {
+// 	      case "error":
+// 	      case "parsererror":
+// 		return DataLayer.rollback( concept, URI );
+// 	      case "success":
+// 		return DataLayer.commit();
+// 	      case "timeout":
+// 	      case "notmodified":
+// 	    }
+
+	    var received = DataLayer.receive( data );
+
+	    for( var URI in URIs )
+		if( typeof received[URI] !== "undefined" )
+		    DataLayer.clearQ( URIs[URI].concept, URIs[URI].id );
+
+	    if( callback )
+		callback( received );
+
+// 	    for( var URI in data )
+// 	    { 
+// 		var parsed = DataLayer.parseURI( URI ),
+//    
+// 		concept = parsed[1], id = parsed[3];
+// 
+// 		if( $.type(data[URI]) === "string" )
+// 		{
+// 		  //TODO:threat the exception thrown
+// 		  DataLayer.rollback( concept, id );
+// 		  delete URIs[ URI ];
+// 		  continue;
+// 		}
+// 
+// 		if( data[URI] === false ){
+// 		  DataLayer.remove( concept, id, false );
+// 		  continue;
+// 		}
+// 
+// 		if( id !== data[URI].id )
+// 		  DataLayer.move( concept, id, data[URI].id );
+// 		
+// 		DataLayer.put( concept, id, data[URI], false );
+// 	    }
+// 	    
+// 	    for( var URI in URIs )
+// 		 DataLayer.clearQ( URIs[URI].concept, URIs[URI].id );
+// 	    
+// 	    if( callback )
+// 		callback();
+
+	}, true );
+
+    },
+    
+    receive: function( data ){
+      
+	var received = {};
+	
+	    for( var URI in data )
+	    { 
+		var parsed = DataLayer.parseURI( URI ),
+   
+	    concept = parsed[4], id = parsed[5];
+
+	    received[ URI ] = data[ URI ];
+
+		if( $.type(data[URI]) === "string" )
+		{
+		  //TODO:threat the exception thrown
+		  DataLayer.rollback( concept, id );
+		  continue;
+		}
+
+		if( data[URI] === false ){
+		  DataLayer.remove( concept, id, false );
+		  continue;
+		}
+
+		if( id !== data[URI].id )
+		  DataLayer.move( concept, id, data[URI].id );
+		
+		DataLayer.put( concept, id, data[URI], false );
+	    }
+	    
+	return( received );
+	    
+    },
+    
+    unique: function( origArr ){ 
+
+	var newArr = [];
+      
+	for ( var x = 0; x < origArr.length; x++ )
+	{
+		var found = false;
+	    for ( var y = 0; !found && y < newArr.length; y++ ) 
+		if ( origArr[x] === newArr[y] )  
+		  found = true;
+
+	    if ( !found ) 
+		newArr[ newArr.length ] = origArr[x];
+	}
+
+	return newArr;
+    },
+
+    merge: function( current, data ){
+      
+	return this.copy(  data, current );
+
+// 	return $.extend( current, data );
+
+    },
+    
+    // clone objects, skip other types.
+    clone: function(target) {
+	    if ( typeof target == 'object' ) {
+		    Clone.prototype = target;
+		    return new Clone();
+	    } else {
+		    return target;
+	    }
+    },
+      
+    // Shallow Copy 
+    shallowCopy: function(target) {
+	    if (typeof target !== 'object' ) {
+		    return target;  // non-object have value sematics, so target is already a copy.
+	    } else {
+		    var value = target.valueOf();
+		    if (target != value) { 
+			    // the object is a standard object wrapper for a native type, say String.
+			    // we can make a copy by instantiating a new object around the value.
+			    return new target.constructor(value);
+		    } else {
+			    // ok, we have a normal object. If possible, we'll clone the original's prototype 
+			    // (not the original) to get an empty object with the same prototype chain as
+			    // the original.  If just copy the instance properties.  Otherwise, we have to 
+			    // copy the whole thing, property-by-property.
+			    if ( target instanceof target.constructor && target.constructor !== Object ) { 
+				    var c = clone(target.constructor.prototype);
+      
+				    // give the copy all the instance properties of target.  It has the same
+				    // prototype as target, so inherited properties are already there.
+				    for ( var property in target) { 
+					    if (target.hasOwnProperty(property)) {
+						    c[property] = target[property];
+					    } 
+				    }
+			    } else {
+				    var c = {};
+				    for ( var property in target ) c[property] = target[property];
+			    }
+			    
+			    return c;
+		    }
+	    }
+    },
+
+    // entry point for deep copy.
+    // source is the object to be deep copied.
+    // depth is an optional recursion limit. Defaults to 256.
+    // deep copy handles the simple cases itself: non-objects and object's we've seen before.
+    // For complex cases, it first identifies an appropriate DeepCopier, then delegate the details of copying the object to him.
+    copy: function(source, result, depth) {
+      
+	    // null is a special case: it's the only value of type 'object' without properties.
+	    if ( source === null ) return null;
+
+	    // All non-objects use value semantics and don't need explict copying.
+	    if ( typeof source !== 'object' ) return source;
+
+	    if( !depth || !(depth instanceof RecursionHelper) ) depth = new RecursionHelper(depth);
+
+	    var cachedResult = depth.getCachedResult(source);
+
+	    // we've already seen this object during this deep copy operation
+	    // so can immediately return the result.  This preserves the cyclic
+	    // reference structure and protects us from infinite recursion.
+	    if ( cachedResult ) return cachedResult;
+
+	    // objects may need special handling depending on their class.  There is
+	    // a class of handlers call "DeepCopiers"  that know how to copy certain
+	    // objects.  There is also a final, generic deep copier that can handle any object.
+	    for ( var i=0; i<this.comparators.length; i++ ) {
+
+		    var comparator = this.comparators[i];
+
+		    if ( comparator.can(source) ) {
+	
+			    // once we've identified which DeepCopier to use, we need to call it in a very
+			    // particular order: create, cache, populate.  This is the key to detecting cycles.
+			    // We also keep track of recursion depth when calling the potentially recursive
+			    // populate(): this is a fail-fast to prevent an infinite loop from consuming all
+			    // available memory and crashing or slowing down the browser.
+      
+			    if( !result )
+				// Start by creating a stub object that represents the copy.
+				result = comparator.create(source);
+			    else if( !comparator.can(result) )
+				throw new Error("can't compare diferent kind of objects.");
+
+			    // we now know the deep copy of source should always be result, so if we encounter
+			    // source again during this deep copy we can immediately use result instead of
+			    // descending into it recursively.  
+			    depth.cacheResult(source, result);
+
+			    // only DeepCopier.populate() can recursively deep copy.  So, to keep track
+			    // of recursion depth, we increment this shared counter before calling it,
+			    // and decrement it afterwards.
+			    depth.depth++;
+			    if ( depth.depth > depth.maxDepth ) {
+				    throw new Error("Exceeded max recursion depth in deep copy.");
+			    }
+
+			    // It's now safe to let the comparator recursively deep copy its properties.
+			    var returned = comparator.populate( function(source, result) { return DataLayer.copy(source, result, depth); }, source, result );
+	
+				if(returned)
+					result = returned;
+
+			    depth.depth--;
+
+			    return result;
+		    }
+	    }
+	    // the generic copier can handle anything, so we should never reach this line.
+	    throw new Error("no DeepCopier is able to copy " + source);
+    },
+
+    // publicly expose the list of deepCopiers.
+    comparators: [],
+
+    // make deep copy() extensible by allowing others to 
+    // register their own custom Comparators.
+    registerComparator: function(comparatorOptions) {
+
+	  // publicly expose the Comparator class.
+	  var comparator = {
+
+	      // determines if this Comparator can handle the given object.
+	      can: function(source) { return false; },
+    
+	      // starts the deep copying process by creating the copy object.  You
+	      // can initialize any properties you want, but you can't call recursively
+	      // into the copy().
+	      create: function(source) { },
+
+	      // Completes the deep copy of the source object by populating any properties
+	      // that need to be recursively deep copied.  You can do this by using the
+	      // provided deepCopyAlgorithm instance's copy() method.  This will handle
+	      // cyclic references for objects already deepCopied, including the source object
+	      // itself.  The "result" passed in is the object returned from create().
+	      populate: function(deepCopyAlgorithm, source, result) {}
+	  };
+
+	  for ( var key in comparatorOptions ) comparator[key] = comparatorOptions[key];
+
+	  this.comparators.unshift( comparator );
+    },
+ 
+    diff: function( base, toDiff ){
+
+	if( typeof base === 'undefined' || $.isEmptyObject(base) )
+	    return( toDiff );
+
+	if( toDiff === false )
+	    return( false );
+
+	toDiff = $.extend( {}, toDiff );
+
+	for( var key in toDiff )
+	{
+	    switch( $.type(toDiff[key]) )
+	    {
+	      case 'object': 
+		if( $.isEmptyObject(toDiff[key] = this.diff( base[key], toDiff[key] )) )
+		  delete toDiff[key];
+	      break;
+	      case 'array':
+		if( base[key] && !(toDiff[key] = $.grep( toDiff[key], function( el, i ){ return( $.inArray( el, base[key] ) === -1 ); } )).length )
+		  delete toDiff[key];
+	      break;
+	      default:
+		if( base[key] == toDiff[key] )
+		  delete toDiff[key];
+	    }
+	}
+
+	return( toDiff );
+
+    },
+    
+    links: function( concept, reverse ){
+
+	if( !this.links[ concept ] )
+	{
+	    var result = this.dispatch( "links", { concept: concept } ) || false;
+
+	    if( !result )
+		return( false );
+
+	    this.concepts[ concept ] = $.extend( this.concepts[ concept ] || {}, 
+						 result['concepts'] || {} );
+
+	    this.links[ concept ] =  result['links'] || {};
+	}
+
+	if( reverse )
+	{
+	    var reverted = {}, llinks = this.links[ concept ];
+    
+	    for( var key in llinks )
+		reverted[ llinks[key] ] = key;
+
+	    return( reverted );
+	}
+
+	return( this.links[ concept ] );
+
+    },
+    
+    isConcept: function( concept, attr ){
+      
+	if( typeof this.concepts[concept] === "undefined" )
+	{
+	    this.links( concept );
+	}
+
+	return !!this.concepts[ concept ][ attr ];
+    },
+    
+    URI: function( concept, URI, context ){
+      
+	if( res = internalUrl.exec( concept ) )
+	    concept = res[1];
+	
+	context = context ? "(" + context + ")" : "";
+      
+	if( URI )
+	    return( concept + context + "://" + URI );
+	else
+	    return( concept );
+      
+    },
+    
+    parseURI: function( URI ){
+
+	return internalUri.exec( URI ) || false;
+
+    },
+    
+    
+   
+    
+    generateId: function( concept ){
+      
+	var newId = this.counter + "(javascript)";
+      
+	this.store( ":counter", (this.counter++) + "" );
+	
+	return( newId );
+    },
+   
+
+   
+
+    get: function( concept, /*URI, */filter, oneSide ){
+
+	///////////////////////////// normalize ////////////////////////////////
+	if( arguments.length == 2 && $.type(filter) === "boolean" )
+	{
+	    oneSide = filter;
+	    filter = false;
+	}
+	
+	var encoder = false, id = false, bothSides = (typeof oneSide === 'undefined'), res;
+	
+	if( $.type(filter) === "string" )
+	{
+	    id = filter;
+	    filter = false;
+	}
+
+	filter = filter || false;
+
+	if( !concept )
+	    return( false );
+
+	if( res = internalUrl.exec( concept ) )
+	{
+	    encoder = concept;
+	    concept = res[1];
+
+	    if( filter )
+		filter = this.criteria( encoder, filter );
+	}
+	
+	if ( $.type(filter) === "array" )
+	{
+	    filter = { filter: filter, criteria: false };
+	}
+	
+	//////////////////////////////////////////////////////////////////////////
+	
+	var result = false;
+
+	if( bothSides || !oneSide )
+	    result = this.check( concept, id || filter );
+
+	if( !result && (bothSides || oneSide) )
+	{
+	    result = this.request( concept, id || filter.filter, filter.criteria );
+
+	    if( result && bothSides && (!filter || 
+									!filter.criteria || 
+									!filter.criteria.format) )
+	    {
+	      var newResult = [];
+	    
+	      for( var i = 0; i < result.length; i++ )
+		  newResult[i] = $.extend( {}, result[i] );
+
+	      this.put( concept, id, newResult, false );
+	    }
+	}
+
+	if( /*result &&*/ encoder )
+	    result = this.encode( encoder, result, filter ); //TODO: retirar o filtro no mÃ©todo encode
+
+	return( result );
+    },
+    
+    
+    filter: function( base, filter ){
+      
+	var filtered = [];
+      
+// 	var operator = filter.shift();
+      
+	/*for( var key in base )
+	{
+	    switch( operator )
+	    {
+		case 'AND':
+		  for( var i = 0, current = true; i < filter.length && current; i++ )
+		    current = this.compare( '&', current, this.compare( base[key], filter[i] ) );
+		break;
+		case 'OR':
+		  for( var i = 0, current = false; i < filter.length && !current; i++ )
+		    current = this.compare( '|', current, this.compare( base[key], filter[i] ) );
+		break;
+		case 'IN':
+		  for( var i = 0, current = false; i < filter[1].length && !current; i++ )
+		    current = this.compare( '|', current, this.compare( base[key], [ '=', filter[0], filter[1][i] ] ) );
+		break;
+		default : current = this.compare( operator, base[key], );
+	    }
+	*/    
+// 	    if( !noGroup )
+// 		for( var i = 0, current = original; i < filter.length && ( current === original ); i++ )
+// 		    current = this.compare( operator, current, this.compare( base[key], filter[i] ) );
+
+// 	    if( current )
+// 		filtered[ filtered.length ] = key;
+// 	}
+
+	return( filtered );
+    },
+    
+    compare: function( operator, base, test ){
+      
+      switch( operator )
+      {
+	  case '*':  return  RegExp( "*" + base + "*" ).test( test );
+	  case '^':  return  RegExp( "^" + base +  "" ).test( test );
+	  case '$':  return  RegExp( ""  + base + "$" ).test( test );
+
+	  case '&': return ( base && test );
+	  case '|': return ( base || test );
+
+	  case '=':  return ( base == test );
+	  case '<=': return ( base <= test );
+	  case '>=': return ( base >= test );
+	  case '>':  return ( base <  test );
+	  case '<':  return ( base >  test );
+      }
+      
+    },
+    
+//     clone: function( object ){
+// 
+// 	new { prototype: object };
+// 
+//     },
+
+    check: function( namespace, keys ){
+
+	if( !namespace )
+	    return( false );
+
+	var result = this.storage.get( namespace );
+
+	if( !keys || !result )
+	  return( result || false );
+
+	if( notArray = $.type(keys) === "string" )
+	    keys = [ keys ];
+	else if( $.type(keys) !== "array" )
+	    keys = this.filter( result, keys.filter );
+
+	var res = [];
+
+	for( var i = 0; i < keys.length; i++ )
+	    res[ res.length ] = result[keys[i]];
+
+	return( notArray ? res[0] || false : res.length ? res : false );
+    },
+
+    storage: {
+      
+	cache: {},
+      
+	set: function( key, value ){
+
+	    this.cache[key] = value;
+
+	},
+	get: function( key ){
+
+	    return DataLayer.copy( this.cache[key] );
+
+	},
+	del: function( key ){
+
+	    delete this.cache[key];
+
+	}
+    },
+
+    flush: function(){
+
+    },
+    
+    restore: function(){
+      
+    },
+
+    store: function( namespace, key, data ){
+
+	if( !data )
+	  return this.storage.set( namespace, key );
+
+	var res = this.check( namespace ) || {};
+
+	res[key] = data;
+
+	return this.storage.set( namespace, res );
+    },
+
+    del: function( namespace, key ){
+      
+	if( !key )
+	  return this.storage.del( namespace );
+
+	var res = this.check( namespace ) || {};
+
+	delete res[key];
+
+	return this.storage.set( namespace, res );
+      
+    },
+    
+     move: function( concept, oldId, newId ){
+
+	this.put( concept, newId, this.check( concept, oldId ), false );
+
+	this.remove( concept, oldId, false );
+    },
+    
+
+    
+    
+    
+    request: function( concept, filter, criteria ){
+
+      var id = false, criteria = criteria || {};
+
+      if( $.type(filter) === "string" )
+      {
+	  id = filter;
+	  filter = false;
+      }
+
+      return this.dispatch( "request", { 
+
+	  concept: concept || '',
+	  id: id || '',
+	  filter: filter || '',
+	  criteria: criteria || '',
+	  service: criteria.service || '',
+	  properties: criteria.properties || ''
+
+      } );
+    },
+
+    
+    //         sync: function( data, callback ){
+// 
+// 	if( !data || $.isEmptyObject( data ) )
+// 	    return;
+//       
+// 	this.send( "Sync", data, function( data, status, jqXHR ){
+// 
+// // 	    switch( status )
+// // 	    {
+// // 	      case "error":
+// // 	      case "parsererror":
+// // 		return DataLayer.rollback( concept, URI );
+// // 	      case "success":
+// // 		return DataLayer.commit();
+// // 	      case "timeout":
+// // 	      case "notmodified":
+// // 	    }
+// 
+// 	    if( callback )
+// 	    {
+// 		var result = callback( data, status, jqXHR );
+// 
+// 		if( result === false )
+// 		    return;
+// 		else if( typeof result != "undefined" )
+// 		    data = result;
+// 	    }
+// 
+// 	    for( var URI in data )
+// 	    { 
+// 		var parsed = DataLayer.parseURI( URI ), 
+//    
+// 		concept = parsed[1], /*URI = parsed[3],*/
+// 
+// 		links = DataLayer.links( concept );
+// 
+// 		for( var linkName in links )
+// 		{
+// 		    var subURI = data[URI][linkName];
+// 
+// 		    if( subURI && data[subURI] )
+// 		    {
+// 			data[URI][linkName] = DataLayer.put( linkName, subURI, data[subURI], false );
+// 
+// 			delete( data[subURI] );
+// 		    }
+// 		}
+// 
+// 		DataLayer.put( concept, URI, data[URI], false );
+// 	    }
+// 	}, true );
+// 
+//     },
+
+//     report: function( concept, URI, data, sync )
+//     {
+// 	var current = this.dequeue( 'current', concept, URI );
+// 
+// 	if( !current )
+// 	    this.enqueue( 'current', concept, URI, ( current = this.check( concept, URI ) || {} ) );
+// 
+// 	var diff = this.diff( current, data );
+// 
+// 	if( !diff )
+// 	    this.dequeue( 'current', concept, URI, true );
+// 	else
+// 	    this.enqueue( 'diff', concept, URI, diff );
+// 	
+// 	if( sync )
+// 	    this.commit( concept, URI, function(){ 
+// 
+// 		DataLayer.set( concept, URI, data, false );
+// 
+// 	    });
+//     },
+    
+//     enqueue: function( type, concept, URI, obj ){
+//       
+// 	//var newURI = this.URI( concept, URI );
+// 	
+// 	if( !this.queue[type] )
+// 	    this.queue[type] = {};
+// 
+// 	if( !this.queue['all'] )
+// 	    this.queue['all'] = {};
+// 	
+// 	if( !this.queue[type][concept] )
+// 	    this.queue[type][concept] = {};
+// 	
+// 	if( !this.queue['all'][type] )
+// 	    this.queue['all'][type] = {};
+// 	
+// 	if( !this.queue['all'][type][/*new*/URI] )
+// 	    this.queue[type][concept][URI] = this.queue['all'][type][/*new*/URI] = obj;
+// 
+// 	this.store( ':queue', this.queue );
+//     },
+//     
+//     dequeue: function( type, concept, URI, remove ){
+//       
+//       ///////////////////////////// normalize ////////////////////////////////
+// 	if( arguments.length < 4 && $.type(URI) === 'boolean' )
+// 	{
+// 	    remove = URI;
+// 	    URI = false;
+// 	}
+// 	if( arguments.length < 3 && $.type(concept) === 'boolean' )
+// 	{
+// 	    remove = concept;
+// 	    concept = false;
+// 	}
+//       //////////////////////////////////////////////////////////////////////////
+//       
+// 	if( !this.queue[type] || !this.queue['all'] )
+// 	    return( false );
+// 	
+// 	if( !concept )
+// 	{
+// 	    var obj = this.queue['all'][type];
+// 	    
+// 	    if( remove )
+// 	    {
+// 		delete this.queue['all'][type];
+// 		delete this.queue[type];
+// 	    }
+// 
+// 	    this.store( ':queue', this.queue );
+// 	    return( obj );
+// 	}
+// 
+// 	if( !this.queue[type][concept] )
+// 	    return( false );
+// 	
+// 	if( !URI )
+// 	{
+// 	    var obj = this.queue[type][concept];
+// 
+// 	    if( remove )
+// 	    {
+// 		var URIs = this.queue[type][concept];
+// 
+// 		for( var subURI in URIs )
+// 		     delete this.queue['all'][type][subURI];
+// 
+// 		delete this.queue[type][concept];
+// 	    }
+// 
+// 	    this.store( ':queue', this.queue );
+// 	    return( obj );
+// 	}
+// 
+// // 	var newURI = URI ? this.URI( concept, URI ) : concept;
+// 	
+// 	var obj = this.queue['all'][type][/*new*/URI];
+//   
+// 	if( remove )
+// 	{
+// 	    delete this.queue['all'][type][/*new*/URI];
+// 	    delete this.queue[type][concept][URI];
+// 	}
+// 
+// 	this.store( ':queue', this.queue );
+// 	return( obj );
+//     },
+    
+           //TODO: definir a 'usage' desta funÃ§Ã£o e refatora-la
+//     set: function( concept, filter, data, oneSide ){
+// 
+// 	///////////////////////////// normalize ////////////////////////////////
+// 	if( arguments.length == 2 )
+// 	{
+// 	    data = filter;
+// 	    filter = false;
+// 	}
+// 	if( $.type(data) === "boolean" )
+// 	{
+// 	    oneSide = data;
+// 	    data = filter;
+// 	    filter = false;
+// 	}
+// 	
+// 	if( !concept || !data )
+// 	    return( false );
+// 
+// 	var decoder = "", URI = false, bothSides = (typeof oneSide === "undefined");
+// 	
+// 	if( $.type(filter) === "string" )
+// 	{
+// 	    URI = filter;
+// 	    filter = false;
+// 	}
+// 
+// 	if( res = internalUrl.exec( concept ) )
+// 	{
+// 	    //TODO: verificar se a decodificaÃ§ao deve ser feita em cada item do array
+// 	    data = this.decode( concept, data );
+// 	    concept = res[1];
+// 	    decoder = res[2];
+// 	}
+// 	///////////////////////////////////////////////////////////////////////////
+// 
+// 	if( bothSides || oneSide )
+// 	    this.report( concept, URI, data, !bothSides );
+// 
+// 	if( bothSides || !oneSide )
+// 	{
+// 	    if( URI )
+// 	    {
+// 	      var helper = {}; 
+// 	      helper[URI] = data; 
+// 	      data = helper;
+// 	    }
+// 
+// 	    for( var URI in data )
+// 	    {
+// 		var current = this.check( concept, URI ) || {};
+// 
+// 		data[URI] = this.merge( current, data[URI] );
+// 
+// 		this.store( concept, URI, data[URI] );
+// 	    }
+// 
+// 	}
+// 
+// 	this.broadcast( concept, oneSide ? 'client' : 'server' );
+// 
+// 	return( true );
+//     },
+//     put: function( concept, URI, data, oneSide ){
+//       
+//       ///////////////////////////// normalize ////////////////////////////////
+// 	if( $.type(URI) !== "string" && arguments.length < 4 )
+// 	{
+// 	    oneSide = data;
+// 	    data = URI;
+// 	    URI = false;
+// 	}
+//       ////////////////////////////////////////////////////////////////////////
+//       
+//       ////////////////////////////// linkage /////////////////////////////////
+// 	var result = false, links = this.links( concept );
+// 
+// 	for( var link in links )
+// 	{
+// 	    if( data[link] )
+// 	    {
+// 		if( $.isArray( data[link] ) )
+// 		{
+// 		    data[link] = this.put( links[link], data[link].URI, data[link], oneSide );
+// 		}
+// 		else if( $.isObject( data[link] ) )
+// 		{
+// 		    $.each( data[link], function( i, el ){
+// 
+// 			  data[link][i] = this.put( links[link], el.URI, el, oneSide );
+// 
+// 		    });
+// 		}
+// 	    }
+// 	}
+//       //////////////////////////////////////////////////////////////////////////
+//     
+// 	if( typeof data.URI === "undefined" )
+// 	{
+// 	    URI = this.add( concept, data, oneSide );
+// 	}
+// 	else if( data.URI === false )
+// 	{
+// 	    status = this.remove( concept, URI, oneSide );
+// 	}
+// 	else
+// 	{
+// 	    status = this.set( concept, URI, data, oneSide );
+// 	}
+// 
+// 	if( URI && data.URI && URI !== data.URI )
+// 	    this.move( concept, URI, data.URI );
+// 
+// 	return( data.URI || URI );
+// 
+//     },
+    
+    //     add: function( concept, data, oneSide ){
+//       
+//       ///////////////////////////// normalize ////////////////////////////////
+// 	if( !concept || !data )
+// 	    return( false );
+// 
+// 	if( res = internalUrl.exec( concept ) )
+// 	{
+// 	    //TODO: verificar se a decodificaÃ¯Â¿ÅÃ¯Â¿Åo deve ser feita em cada item do array
+// 	    data = this.decode( concept, data );
+// 	    concept = res[1];
+// 	    decoder = res[2];
+// 	}
+// 
+// 	var bothSides = (typeof oneSide === "undefined"), uris = [];
+// 
+// 	if( notArray = $.type(data) !== "array" )
+// 	    data = [ data ];
+//       //////////////////////////////////////////////////////////////////////////
+// 
+// 	for( var i = 0; i < data.length; i++ )
+// 	{
+// 	    var URI = uris[i] = this.generateURI( concept );
+// 
+// 	    this.set( concept, URI, data[i], oneSide );
+// 	}
+// 
+// 	return( notArray ? uris[0] : uris );
+//     },
+//      put: function( concept, data ){
+// 
+// 	var decoder = "";
+// 
+// 	if( res = internalUrl.exec( concept ) )
+// 	{
+// 	    data = this.decode( concept, data );
+// 	    concept = res[1];
+// 	    decoder = res[2];
+// 	}
+// 
+// 	var New = [], Update = [], uris = [];
+// 
+// 	if( notArray = $.type(data) !== "array" )
+// 	    data = [ data ];
+// 	
+// 	for( var i = 0; i < data.length; i++ )
+// 	{
+// 	    if( !data[i].URI )
+// 	    {
+// 		uris[ uris.length ] = data[i].URI = this.create( concept, data[i] );
+// 		New[ New.length ] = data[i];
+// 		continue;
+// 	    }
+// 
+// 	    for( var key in data[i] )
+// 		if( klass = this.isReference( concept, key, data[i][key] ) )
+// 		      data[i][key] = this.put( klass + decoder, data[i][key] );
+// 
+// 	    Update[ Update.length ] = this.update( concept, data[i].URI, data[i] );
+// 	}
+// 
+// 	this.report( concept, { "created": New, "updated": Update });
+// 
+// 	return( notArray ? uris[0] : uris );
+//     },
+//     merge: function( concept, current, data ){
+// 
+// 	current = current || {};
+// 
+// 	for( var key in data )
+// 	    current[key] = (klass = this.isReference( concept, key, data[key] )) ? 
+// 			   this.merge( klass, current[key], data[key] ) : data[key];
+// 
+// 	return( current );
+//     },
+// 
+//     isReference: function( concept, key, value ){
+// 
+//       return( ($.type(value) === "object" || 
+// 	       $.type(value) === "array" )? this.links[concept][key] : false );
+// 
+//     },
+//     
+//     set: function( concept, data, URI, mergeable ){
+// 	
+// 	if( URI )
+// 	{
+// 	    var res = this.get( concept, true ) || {};
+// 	    
+// 	    if( mergeable )
+// 		data = this.merge( res[URI] || {}, data );
+// 
+// 	    res[URI] = data;
+// 
+// 	    data = res;
+// 	}
+// 
+// 	return this.store( concept, data );
+//     },    
+// 
+//     create: function( concept, data ){
+// 
+//       if( notArray = ($.type(data) !== "array") )
+// 	    data = [ data ];
+// 
+//       var uris = [];
+// 
+//       for( var i = 0; i < data.length; i++ )
+//       {
+// 	  uris[ uris.length ] = data[i].URI = "javascript://" + (this.counter + i);
+// 
+// 	  this.set( concept, data[i], data[i].URI );
+//       }
+//  
+//       this.set( ":counter", (this.counter += data.length) );
+// 
+//       return notArray ? uris[0] : uris;
+//     },
+// 
+//     update: function( concept, URI, data )
+//     {
+// 	var target = this.check( concept, URI ) || {};
+// 
+// 	target = this.merge( concept, target, data );
+// 
+// 	if( target.URI !== URI )
+// 	    this.remove( concept, URI );
+// 
+// 	this.set( concept, target, target.URI );
+// 
+// 	return( target );
+//     },
+// 
+//     remove: function( concept, URI ){
+// 
+// 	if( !URI )
+// 	    return this.storage.del( concept );
+// 
+// 	var res = this.check( concept );
+// 
+// 	delete res[URI];
+// 	
+// 	this.set( concept, res );
+//     },
+// 
+//     del: function( concept, URI ){
+// 
+// 	this.remove( concept, URI );
+// 
+// 	this.report( concept, { "deleted": { 'URI': URI } });
+//     },
+// 
+//     report: function( concept, changes ){
+// 
+//       this.broadcast( concept, changes.created, changes.updated, changes.deleted );
+// 
+// 	if( changes.created )
+// 	    this.sync( concept, changes.created, 'create' );
+// 	if( changes.updated )
+// 	    this.sync( concept, changes.updated, 'update' );
+// 	if( changes.deleted )
+// 	    this.sync( concept, changes.deleted, 'delete' );
+// 
+//     },
+// 
+// 
+//    sync: function( concept, data, type ){
+// 
+// 	if( $.type(data) !== "array" )
+// 	    data = [ data ];
+// 
+// 	$.each( data, function( i, el ){
+// 
+// 	   DataLayer.send( concept, el, type );
+// 
+// 	});
+// 
+//     },
+//     
+//     
+//     
+//     
+// 
+//     request: function( concept, URI, filter ){
+// 
+// //       if( startsDoubleDot.test(concept) )
+// // 	  return( false );
+// 
+//       filter = filter || {};
+// 
+//       if( URI )
+// 	filter.URI = URI;
+// 
+//       return this.send( concept, filter, "read", true );
+// 
+//     },
+// 
+//     send: function( concept, data, type, wait ){
+// 
+//       switch( type )
+//       {
+// 	case "create": type = "POST"; break;
+// 	case "update": type = "PUT"; break;
+// 	case "delete": type = "DELETE"; break;
+// 	case "read": type = "GET"; break;
+//       }
+// 
+//       var url = this.basePath + concept;
+// 
+//       var result = [], notArray = false;
+// 
+// //      alert( data.URI );
+// 
+//       if( data.URI && data.URI.indexOf("javascript://") !== 0 )
+// 	  url += "/" + data.URI;
+// 
+//       var callback = function( dt, textStatus, jqXHR ){
+// 
+// 	    if( notArray = (!$.isArray( dt )) )
+// 		dt = [ dt ];
+// 
+// 	    $.each( dt, function( i, el ){
+// 
+// 		if( !el || !el.URI )
+// 		    return;
+// 
+// 		if( data.URI )
+// 		    el = DataLayer.update( concept, data.URI, el );
+// 		else
+// 		    DataLayer.set( concept, el, el.URI );
+// 
+// 		result[ result.length ] = el;
+// 		DataLayer.broadcast( concept );
+// 	  });
+//       };
+// 
+//       $.ajax({
+// 	      'async': ( !wait ),
+// 	      'url': url,
+// 	      'type': type,
+// 	      'success': callback,
+// 	      'dataType': 'json',
+// 	      'data': data/*,
+// 	      'processData': false*/
+// 	  });
+// 
+//       return( notArray ? result[0] || false : result );
+//     },
+    
+    
+    generateURI: function( concept ){
+      
+	return this.URI( concept, this.generateId( concept ), "javascript" );
+
+    },
+    
+
+    broadcast: function( concept, status, diff ){
+
+	if( this.listeners[ concept ] )
+	    for( var i = 0; 
+		i < this.listeners[ concept ].length; 
+		this.listeners[ concept ][ i++ ]( status, diff ) );
+    },
+
+    listen: function( concept, listener ){
+
+	this.register( "listeners", concept, listener );
+
+    },
+
+    codec: function( concept, namespace, codec ){
+
+	if( codec.encoder )
+	    this.encoder( concept, namespace, codec.encoder );
+	if( codec.decoder )
+	    this.decoder( concept, namespace, codec.decoder );
+	if( codec.criteria )
+	    this.register( "criterias", concept + ":" + namespace, codec.criteria );
+
+    },
+
+    encoder: function( concept, namespace, encoder ){
+
+	this.register( "encoders", concept + ":" + namespace, encoder );
+
+    },
+
+    encode: function( encoder, data, filter ){
+
+	if( this.encoders[ encoder ] )
+	    for( var i = 0;
+		i < this.encoders[ encoder ].length;
+		data = this.encoders[ encoder ][ i++ ]( data, filter ) );
+
+	return( data );
+    },
+
+    decoder: function( concept, namespace, decoder ){
+
+	this.register( "decoders", concept + ":" + namespace, decoder );
+
+    },
+
+    decode: function( decoder, data ){
+
+	if( this.decoders[ decoder ] )
+	    for( var i = 0;
+		i < this.decoders[ decoder ].length;
+		data = this.decoders[ decoder ][ i++ ]( data ) );
+
+	return( data );
+    },
+
+    criteria: function( codec, filter ){
+
+	if( this.criterias[ codec ] )
+	    for( var i = 0;
+		i < this.criterias[ codec ].length;
+		filter = this.criterias[ codec ][ i++ ]( filter ) );
+
+	return( filter );
+
+    },
+
+    register: function( kind, concept, deployable ){
+
+      if( arguments.length < 3 )
+      {
+	  deployable = concept;
+	  concept = kind;
+	  kind = 'global';
+      }
+
+      if( !this[ kind ][ concept ] )
+	    this[ kind ][ concept ] = [];
+
+	this[ kind ][ concept ][ this[ kind ][ concept ].length ] = deployable;
+
+    },
+    
+    start: function(){
+
+	var timer = function(){
+
+	      setTimeout( timer, 1 );
+
+	      var now = parseInt( $.now() / 1000 );
+
+	      var tasks = DataLayer.tasks[ now ];
+
+	      if( !tasks ) return;
+
+	      for( var i = 0; i < tasks.length; i++ )
+	      {
+		  var result = tasks[i].task( now );
+
+		  if( tasks[i].factor )
+		  DataLayer.schedule( tasks[i].task, tasks[i].factor );
+	      }
+      
+	      delete DataLayer.tasks[ now ];
+	};
+
+	setTimeout( timer, 1 );
+    },
+    
+    task: function( timestamp, task, factor )
+    {
+	if( !this.tasks[ timestamp ] )
+	    this.tasks[ timestamp ] = [];
+
+	this.tasks[ timestamp ][ this.tasks[ timestamp ].length ] = { task: task, factor: factor || false };
+    },
+
+    schedule: function( task, time ){
+
+	time = time || 1;
+	
+	var index = parseInt( $.now() / 1000 ) + time;
+
+	this.task( index, task, time );
+    },
+    
+    poll: function( concept, time ){
+      
+      this.schedule( function( now ){
+  
+	  DataLayer.commit( concept );
+
+	}, time || 5 );
+    },
+    
+    init: function(){
+      
+	this.counter = parseInt( this.get( ":counter", false ) ) || 0;
+
+	if( !this.dispatchPath )
+	    this.dispatchPath = "../../";
+
+	if( !this.templatePath )
+	    this.templatePath = "";
+
+	if( !this.basePath )
+	    this.basePath = this.dispatchPath + "REST.php?q=";
+
+	this.schedule( function( now ){
+
+	    DataLayer.flush();
+
+	});
+
+	this.start();
+    }
+}
+
+// the re-usable constructor function used by clone().
+function Clone() {}
+
+//Recursion Helper
+function RecursionHelper(){ this.clear(); };
+
+RecursionHelper.prototype = {
+  
+	constructor: RecursionHelper,
+
+	// copiedObjects keeps track of objects already copied by this
+	// deepCopy operation, so we can correctly handle cyclic references.
+	copiedObjects: [],
+
+	depth: 0,
+
+	maxDepth: 256,
+
+	//reset the recursion helper cache
+	clear: function(){
+		this.copiedObjects = [];
+		this.depth = 0;
+	},
+
+	// add an object to the cache.  No attempt is made to filter duplicates;
+	// we always check getCachedResult() before calling it.
+	cacheResult: function(source, result) {
+		this.copiedObjects.push([source, result]);
+	},
+
+	// Returns the cached copy of a given object, or undefined if it's an
+	// object we haven't seen before.
+	getCachedResult: function(source) {
+
+		for ( var i=0; i<this.copiedObjects.length; i++ ) {
+			if ( this.copiedObjects[i][0] === source ) {
+				return this.copiedObjects[i][1];
+			}
+		}
+
+		return undefined;
+	}
+};
+
+// Generic Object copier
+// the ultimate fallback DeepCopier, which tries to handle the generic case.  This
+// should work for base Objects and many user-defined classes.
+DataLayer.registerComparator({
+	can: function(source) { return true; },
+
+	create: function(source) {
+		if ( source instanceof source.constructor ) {
+			return DataLayer.clone(source.constructor.prototype);
+		} else {
+			return {};
+		}
+	},
+
+	populate: function(deepCopy, source, result) {
+		for ( var key in source ) {
+			if ( source.hasOwnProperty(key) ) {
+				result[key] = deepCopy(source[key], result[key]);
+			}
+		}
+		return result;
+	}
+});
+
+// Array copier
+DataLayer.registerComparator({
+	can: function(source) {
+		return ( source instanceof Array );
+	},
+
+	create: function(source) {
+		return new source.constructor();
+	},
+
+	populate: function(deepCopy, source, result) {
+		for ( var i=0; i<source.length; i++) {
+			result.push( deepCopy(source[i], result[i]) );
+		}
+		result =  DataLayer.unique( result )
+		return result;
+	}
+});
+
+// Date copier
+DataLayer.registerComparator({
+	can: function(source) {
+		return ( source instanceof Date );
+	},
+
+	create: function(source) {
+		return new Date(source);
+	}
+});
+
+// HTML DOM Node copier
+DataLayer.registerComparator({
+
+	// function to detect Nodes.  In particular, we're looking
+	// for the cloneNode method.  The global document is also defined to
+	// be a Node, but is a special case in many ways.
+	can: function(source) { 
+	  
+	  if ( window.Node ) {
+		  return source instanceof Node;
+	  } else {
+		  // the document is a special Node and doesn't have many of
+		  // the common properties so we use an identity check instead.
+		  if ( source === document ) return true;
+		  return (
+			  typeof source.nodeType === 'number' &&
+			  source.attributes &&
+			  source.childNodes &&
+			  source.cloneNode
+		  );
+	  } 
+      },
+
+      create: function(source) {
+	      // there can only be one (document).
+	      if ( source === document ) return document;
+
+	      // start with a shallow copy.  We'll handle the deep copy of
+	      // its children ourselves.
+	      return source.cloneNode(false);
+      },
+      
+      diff: function(base, source){
+	
+      },
+
+      populate: function(deepCopy, source, result) {
+	      // we're not copying the global document, so don't have to populate it either.
+	      if ( source === document ) return document;
+
+	      // if this Node has children, deep copy them one-by-one.
+	      if ( source.childNodes && source.childNodes.length ) {
+		      for ( var i=0; i<source.childNodes.length; i++ ) {
+			      var childCopy = deepCopy(source.childNodes[i], result.childNodes[i] || false );
+			      result.appendChild(childCopy);
+		      }
+	      }
+		return result;
+      }
+});
+
+DataLayer.init();
+
+// setTimeout(function(){
+//  
+//     
+// 
+// }, 1000 );
+
+// var DataLayer = {
+// 
+//     get: function( concept, filter ){
+// 
+// 	var data = this.storage.get( concept );
+// 
+// 	if( !filter )
+// 	    return( data );
+// 
+// 	return this.filter( data, filter );
+//     },
+//     
+//     filter:function( data, filter ){
+//       
+// 	if( filter.charAt )
+// 	    filter = { URI: filter };
+// 	
+// 	var filtered = [];
+// 
+// 	$.each(data, function(i, obj){
+// 	  
+// 	    for( var attr in filter )
+// 		if( filter[attr] !== obj[attr] )
+// 		    return( true );
+// 
+// 	    filtered[i] = obj;
+// 	});
+// 
+// 	return( filtered );
+//     },
+// 
+//     find: function( concept, filter, callback ){
+// 
+// 	var data = this.get( concept, filter ); 
+// 
+// 	if( data )
+// 	    return callback( data );
+// 
+// 	//TODO: register callback like a weak listener
+// 
+// // 	$.ajax({ 
+// // 	      type: 'GET',
+// // 	      data: $.param( filter ),
+// // 	      success: callback,  
+// // 	      url: BASE_PATH + filter.URI || concept
+// // 	});
+// 	this.report( concept, filter );
+//     },
+// 
+//     put: function( concept, data, filter ){
+// 
+// 	var beforeDiff = this.store( concept, $.extend({},data) );
+// 
+// 	this.report( concept, data, filter, beforeDiff );
+//     },
+//     
+//     
+//     /*var data = {
+// 			startTime: $.now(),
+// 			endTime: $.now() + 1800000,
+// 			summary: "meu querido evento",
+// 			description: "desc do evento",
+// 			location: "prognus software livre",
+// 			class: 1,
+// 			calendar: 1,
+// 			category: 1,
+// 			participants: [ { 
+// 					   user: { isExternal: true, mail: "user7@prognus.org", name: "user7" }
+// 				      },{ 
+// 					   user: "1003"
+// 				      } ]
+// 
+// 		  };*/
+//     
+// 
+//     merge:function( data, target ){
+//       
+// 	var diff = { New: {}, Update:{}, Delete: {} };
+//       
+// 	for( var key in data )
+// 	{
+// 	    if( !target[ key ] )
+// 		diff.New[ key ] = target[ key ] = data[ key ];
+// 
+// 	    
+// 	  
+// 	}
+//       
+//     }
+// 
+//     store: function( concept, data, filter ){
+// 
+// 	if( !data.spline )
+// 	    data = [ data ];
+// 
+// 	var target = this.storage.get( concept );
+// 	
+// 	var diff = { New: {}, Update:{}, Delete: {} };
+// 
+// 	for( var i = 0; i < data.length; i++ )
+// 	{
+// 	    if( data[i].URI && target[ data[i].URI ] )
+// 	    {
+// 		diff.Update[ data[i].URI ] = this.merge( target[ data[i].URI ], data[i] );
+// 	    }
+// 	    else
+// 	    {
+// 		diff.New[] = data[i];
+// 	    }
+// 	}
+// 
+// 	
+// 
+// 	this.broadcast( concept, data );
+// 
+// 	if( filter )
+// 	    target = this.filter( target, filter );
+// 
+// 	if( target )
+// 	    data = $.extend( target, data );
+// 
+// 	this.storage.set( concept, data );
+// 
+// // 	return;
+//     },
+//     
+//     set: function( concept, data, filter ){
+// 
+//       
+// 
+//     },
+// 
+//     post: function( concept, data, filter, isNew ){
+// 
+// 	var callback = function(  ){ DataLayer.store( concept, data, filter ) };
+// 
+// 	//TODO: register callback like a weak listener
+// 
+// 	this.report( concept, data, filter, isNew );
+//     },
+//     
+//     report: function( concept, filter, postData, isNew ){
+//       
+// 	$.ajax({ 
+// 		type: postData ? isNew ? 'POST' : 'PUT' : 'GET',
+// 		data: postData || $.param( filter ),
+// 		success: function( data ){ DataLayer.broadcast( concept ) },
+// 		url: BASE_PATH + filter.URI || concept
+// 	  });
+//     },
+//     
+//     del:function( concept, filter ){
+// 
+//       
+// 
+//     }
+//     
+//     broadcast: function( concept, data ){
+// 
+// 	
+// 
+//     },
+// 
+//     pool: function(){
+//       
+//     },
+//
+//     refresh: function(){
+//       
+//     }
+// };
+
+// 
+// DataLayer = {
+//   
+//     get: function( concept, filter ){
+// 
+// 	var data = this.storage.get( concept );
+// 
+// 	if( !filter )
+// 	    return( data );
+// 
+// 	if( filter.charAt )
+// 	    filter = { URI: filter };
+// 	
+// 	var filtered = [];
+// 
+// 	$.each(data, function(i, obj){
+// 	  
+// 	    for( var attr in filter )
+// 		if( filter[attr] !== obj[attr] )
+// 		    return( true );
+// 
+// 	    filtered[i] = obj;
+// 	});
+// 
+// 	return( filtered );
+//     },
+// 
+//     find: function( concept, filter, callback ){
+// 
+// 	var data = this.get( concept, filter ); 
+// 
+// 	if( data )
+// 	    return callback( data );
+// 
+// 	 $.ajax({ 
+// 	      type: 'GET', 
+// 	      data: $.param( filter ),
+// 	      success: callback,  
+// 	      url: filter.URI || concept
+// 	});
+//     },
+// 
+//     put: function( concept, data, filter ){
+// 
+// 	var target = this.get( concept, filter );
+// 
+// 	if( target )
+// 	    data = $.extend( target, data );
+//       
+// 	this.storage.set( concept, data );
+// 	
+// 	//diff
+//     },
+//     
+//     post: function( concept, data, filter ){
+// 
+// 	
+// 
+//     },
+//     
+//     pool: function(){
+//       
+//     },
+//     
+//     queue: function(){
+//       
+//     },
+//     
+//     dequeue: function(){
+//       
+//     },
+//     
+//     refresh: function(){
+//       
+//     }
+// }
+
+// var DataLayer = {
+  
+//       cache: {},
+  
+//       get: function( concept, location ){
+	
+	   /* if( location )
+	    {*/
+// 		var schema = $.data( this.cache, concept + ':schema' );
+// 		var uri = [];
+// 
+// 		$.each( schema, function( i, addrs ){
+// 		      uri[ uri.length ] = location[addrs];
+// 		});
+
+		/*var filter = [], result = false;
+
+		while( !(result = $.data( this.cache, uri.join( '.' ) )) || !(uri = uri.join('.')) )
+		  filter[ filter.length ] = uri.pop();
+  
+		if( !filter.length )
+		{
+		    var indexes = $.data( this.cache, uri + ':indexes' );
+
+		    if( indexes )
+			Array.prototype.concat.apply( result, indexes );
+		    
+		    return( result );
+		}
+
+		for( var i = 0; i < result.length; i++ )
+		{
+		    
+		}
+
+		if( result.length )
+		    return( result );
+	    }*/
+
+// 	    var data = $.data( this.cache, concept );
+
+// 	    if( !data )
+// 		$.ajax( );
+
+// 	    return( data );
+//       },
+      
+//       data: function(){
+// 
+// 	  
+// 
+//       }
+//       
+//       search: function( concept, filter ){
+// 
+// 	  var schema = $.data( this.cache, concept + ':schema' );
+// 	  var uri = [];
+// 
+// 	  $.each( schema, function( i, addrs ){
+// 		uri[ uri.length ] = location[addrs];
+// 	  });
+//       }
+//       put: function( concept, data, location ){
+
+// 	    if( location )
+// 	    {
+// 		var schema = $.data( this.cache, concept + ':schema');
+// 		var uri = [];
+
+// 		$.each( schema, function( i, addrs ){
+// 		      uri[ uri.length ] = location[addrs];
+// 		});
+
+// 		var result = false, filter = [];
+
+// 		while( !(result = $.data( this.cache, uri.join('.')) )
+// 		    filter[ filter.length ] = uri.pop();
+
+// 		$.data( this.cache, '
+
+// 	    }
+
+// 		var model = this.storage.get( concept );
+// 
+// 		$.each( model, function( i, o ){
+// 		    $.each( location, function( ii, attr ){
+// 			 if( o[ii] === attr )
+// 			    return( false );
+// 		    }); 
+// 		});
+
+// 	    return $.data( this.cache, concept, data );
+
+//       },
+//       del: function( concept, location ){
+// 
+// 	    if( location )
+// 	    {
+// 		var schema = $.data( this.cache, 'concepts', concept );
+// 		var uri = [];
+// 
+// 		$.each( schema, function( i, addrs ){
+// 		      uri[ uri.length ] = location[addrs];
+// 		});
+// 
+// 		concept = uri.join( '.' );
+
+// 		var model = this.storage.get( concept );
+// 
+// 		$.each( model, function( i, o ){
+// 		    $.each( location, function( ii, attr ){
+// 			 if( o[ii] === attr )
+// 			    return( false );
+// 		    }); 
+// 		});
+// 	    }
+// 	    
+// 	
+// 	    $.removeData( this.cache, concept );
+//       }
+// }
Index: trunk/prototype/api/cache/MemoryCache.php
===================================================================
--- trunk/prototype/api/cache/MemoryCache.php	(revision 5399)
+++ trunk/prototype/api/cache/MemoryCache.php	(revision 5399)
@@ -0,0 +1,110 @@
+<?php
+/**
+ * DooMemCache class file.
+ *
+ * @author Leng Sheng Hong <darkredz@gmail.com>
+ * @link http://www.doophp.com/
+ * @copyright Copyright &copy; 2009 Leng Sheng Hong
+ * @license http://www.doophp.com/license
+ */
+
+
+/**
+ * DooMemCache provides caching methods utilizing the Memcache extension.
+ *
+ * If you have multiple servers for memcache, you would have to set it up in common.conf.php
+ * <code>
+ * // host, port, persistent, weight
+ * $config['MEMCACHE'] = array(
+ *                       array('192.168.1.31', '11211', true, 40),
+ *                       array('192.168.1.23', '11211', true, 80)
+ *                     );
+ * </code>
+ *
+ * @author Leng Sheng Hong <darkredz@gmail.com>
+ * @version $Id: DooMemCache.php 1000 2009-08-22 19:36:10
+ * @package doo.cache
+ * @since 1.1
+ */
+
+class MemoryCache{
+    /**
+     * Memcached connection
+     * @var Memcache
+     */
+    protected $_memcache;
+
+    /**
+     * Configurations of the connections
+     * @var array
+     */
+    protected $_config;
+
+    public function  __construct($conf=Null) {
+        //$this->_memcache = new Memcache();
+//        $this->_config = $conf;
+
+        // host, port, persistent, weight
+//        if($conf!==Null){
+//            foreach ($conf as $c){
+//                $result = $this->_memcache->addServer($c[0], $c[1], $c[2], $c[3]);
+//            }
+//        }
+//        else{
+//            $this->_memcache->addServer('localhost', 11211);
+//        }
+    }
+
+    /**
+     * Adds a cache with an unique Id.
+     *
+     * @param string $id Cache Id
+     * @param mixed $data Data to be stored
+     * @param int $expire Seconds to expired
+     * @param int $compressed To store the data in Zlib compressed format
+     * @return bool True if success
+     */
+    public function put($id, $data, $expire=0, $compressed=false){
+
+
+//         if($compressed)
+//             return $this->_memcache->set($id, $data, MEMCACHE_COMPRESSED, $expire);
+//         else
+//             return $this->_memcache->set($id, $data, 0, $expire);
+	return false;
+    }
+
+    /**
+     * Retrieves a value from cache with an Id.
+     *
+     * @param string $id A unique key identifying the cache
+     * @return mixed The value stored in cache. Return false if no cache found or already expired.
+     */
+    public function get($id){
+     
+//         $return = $this->_memcache->get($id);
+	  $return = false;
+
+	return( $return );
+    }
+    
+    /**
+     * Deletes an APC data cache with an identifying Id
+     *
+     * @param string $id Id of the cache
+     * @return bool True if success
+     */
+    public function clear($id){
+        return $this->_memcache->delete($id);
+    }
+
+    /**
+     * Deletes all data cache
+     * @return bool True if success
+     */
+    public function clearAll(){
+        return $this->_memcache->flush();
+    }
+
+}
+
Index: trunk/prototype/api/newcontroller.php
===================================================================
--- trunk/prototype/api/newcontroller.php	(revision 5341)
+++ trunk/prototype/api/newcontroller.php	(revision 5341)
@@ -0,0 +1,515 @@
+<?php
+
+if( !defined( 'ROOTPATH' ) )
+    define( 'ROOTPATH', dirname(__FILE__).'/..' );
+
+require_once(ROOTPATH.'/app/config.php');
+
+/**
+TODO list:
+
+  * definir de forma centralizada os caminhos e as constantes necessÃ¡rias;
+  * criar um User Agent detect e um OS server detect para customizaÃ§Ãµes espeÃ§Ã­ficas de cada browser / servidor;
+  * criar um registrador para fallback handlers;
+  * criar um dependency manager na configuraÃ§Ã£o dos serviÃ§os, para poder gerenciar os imports corretamente
+  * criar um login e a recuperaÃ§Ã£o da sessÃ£o;
+
+*/
+
+class Controller {
+
+	static $cache;
+	static $services = array();
+	static $interceptors = array();
+	static $config = array();
+	static $includes = array();
+	static $wallet;
+
+	public function __destruct()
+	{
+// 	    if( $this->service )
+// 		$this->service->close();
+// 	    else
+	    self::closeAll();
+	}
+
+	public static function closeAll()
+	{
+	    if( self::$services )
+		foreach( self::$services as $serviceName => $service )
+		    if( self::$config[ $serviceName ]['type'] === 'service' )
+		      $service->close();
+	}
+
+	public static function clearAll()
+	{
+	    return self::$cache->clearAll();
+	}
+
+	public static function clear( $id )
+	{
+	    return self::$cache->clear( $id );
+	}
+
+	public static function get( $id )
+	{
+	    return self::$cache->get( $id );
+	}
+
+	public static function put( $id, $data, $expires, $compressed )
+	{
+	    return self::$cache->put( $id, $data, $expires, $compressed );
+	}
+
+	public static function find( $concept, $filter, $options = false )
+	{
+	    if( isset($URI['id']) && $URI['id'] )
+		return self::read( $URI, $params, $options );
+
+	    return self::call( 'find', $URI, $params, $options );
+	}
+
+	public static function read( $concept, $id, $options = false )
+	{
+	    if( !is_string( $id ) )
+		return self::find( $concept, $id, $options );
+
+	    return self::call( 'read', $concept, $id, $options );
+	}
+	
+// 	public static function deleteAll( $URI, $params = false, $criteria = false )
+// 	{
+// 	    if( isset($URI['id']) && $URI['id'] )
+// 		return self::delete( $URI, $params, $criteria );
+// 
+// 	    return self::call( 'deleteAll', $URI, $params, $criteria );
+// 	}
+
+	public static function delete( $concept, $id = false, $options = false )
+	{
+// 	    if( !isset($URI['id']) || !$URI['id'] )
+// 		return self::deleteAll( $URI, $params, $criteria );
+
+	    return self::call( 'delete', $URI, $params, $criteria );
+	}
+	
+// 	public static function replace( $URI, $params, $criteria = false )
+// 	{
+// 	    if( isset($URI['id']) && $URI['id'] )
+// 		return self::update( $URI, $params, $criteria );
+// 
+// 	    return self::call( 'replace', $URI, $params, $criteria );
+// 	}
+
+	public static function update( $concept, $params, $filter = false, $options = false )
+	{
+	    if( !isset($URI['id']) || !$URI['id'] )
+		return self::replace( $URI, $params, $criteria );
+
+	    return self::call( 'update', $URI, $params, $criteria );
+	}
+
+	public static function create( $concept, $params, $filter = false, $options = false )
+	{
+	    return self::call( 'create', $concept, $params, $filter, $options )
+	}
+
+	public static function begin( $concept, $id, $options = false )
+	{
+	    return self::call( 'begin', $concept, $id, $options );
+	}
+
+	public static function commit( $concept, /*$id,*/ $params = false, $options = false )
+	{
+	    return self::call( 'commit', $concept, $id, $params, $options );
+	}
+
+	public static function rollback($concept, /*$id,*/ $options = false )
+	{
+	    return self::call( 'rollback', $URI, $params, $options );
+	}
+
+	public static function format( $type, $data, $options = false )
+	{
+	    return self::call( 'format', $type, $data, $options );
+	}
+
+	public static function parse( $type, $data, $options = false )
+	{
+	    return self::call( 'parse', $type, $data, $options );
+	}
+
+	public static function URI( $className, $id = false, $service = false )
+	{
+	    return array( 'concept' => $className,
+			  'service' => $service ? $service : false, 
+			  'id' => $id ? $id : '' );
+	}
+
+	public static function links( $concept )
+	{
+	    if( !isset(self::$config[ $concept ]) )
+	      self::$config[ $concept ] = self::loadConfig( $concept );
+
+	    return( isset(self::$config[ $concept ]['links']) ? 
+			  self::$config[ $concept ]['links'] : array() );
+	}
+
+	public static function isConcept( $concept )
+	{
+	    if( isset( self::$config[ $concept ] ) && 
+		self::$config[ $concept ] )
+		return( true );
+	    else
+		return file_exists( ROOTPATH."/config/$concept.ini" );
+	}
+
+	public static function getConcept( $concept )
+	{
+	    if( isset( self::$config[ $concept ] ) )
+		return( self::$config[ $concept ] );
+
+	    return( self::$config[ $concept ] = self::loadConfig( $concept ) );
+	}
+
+	public static function loadCache( $cacheType = 'Memory' )
+	{
+	    include_once( "cache/MemoryCache.php" );
+	    return new MemoryCache();
+	}
+	
+	public static function loadConfig( $className, $isService = false )
+	{
+	    $fileName = $className.'.'.($isService ? 'srv' : 'ini');
+
+	    $config = self::$cache->get( $fileName );
+
+	    if( !$config )
+	    {
+		$config = parse_ini_file( ROOTPATH."/config/$fileName", true );
+
+		self::$cache->put( $fileName, $config );
+	    }
+
+	    return( $config );
+	}
+
+	public static function import( $path, $ext = ".php" )
+	{
+           
+	    if( !isset(self::$includes[$path]) )
+	    {
+		require_once( ROOTPATH.'/'.$path.$ext );
+		self::$includes[$path] = false;
+	    }
+
+	    return( self::$includes[$path] );
+	}
+
+	public static function load( $path, $class = false )
+	{
+            
+            if( $return = self::import( $path, "" ) )
+		return( $return );
+            
+	    if( !$class ){
+		preg_match( '/^\/?.*\/([^\/]+).php$/', $path, $class );
+		$class = $class[1];
+	    }
+
+	    $object =  self::$cache->get( $class );
+
+	    if( !$object )
+	    {
+		$object = new $class();
+		 self::$cache->put( $class, $object );
+	    }
+
+	    self::$includes[$path] = $object;
+
+	    return( $object );
+	}
+
+	public static function wallet( $serviceName )
+	{
+	    if( !isset( self::$wallet ) )
+	    {
+		//// Hack //// TODO: passar o init da sessÃ£o no login do expresso
+		if ( isset( $_COOKIE[ 'sessionid' ] ) ) 
+		      session_id( $_COOKIE[ 'sessionid' ] ); 
+                
+		@session_start();
+
+// 		if( !isset( $_SESSION['wallet'] ) )
+// 		{
+// 		    if( isset( $GLOBALS['phpgw_info'] ) )
+// 		    {
+// 				$_SESSION['wallet']['Sieve']['user']          = $GLOBALS['phpgw_info']['user']['account_lid'];
+// 				$_SESSION['wallet']['Sieve']['password']      = $GLOBALS['phpgw_info']['user']['passwd'];
+// 
+// 				$_SESSION['wallet']['Cyrus']['user']          = $GLOBALS['phpgw_info']['user']['account_lid'];
+// 				$_SESSION['wallet']['Cyrus']['password']      = $GLOBALS['phpgw_info']['user']['passwd'];
+// 
+// 				$_SESSION['wallet']['user']		      = $GLOBALS['phpgw_info']['user']['account_lid'];
+// 			// 			$_SESSION['wallet']['me']['password']      = $_SESSION['phpgw_info']['expressomail']['user']['passwd'];
+// 
+// 				$_SESSION['wallet']['PostgreSQL']['user']     = $GLOBALS['phpgw_info']['server']['db_user'];
+// 				$_SESSION['wallet']['PostgreSQL']['password'] = $GLOBALS['phpgw_info']['server']['db_pass'];
+// 				$_SESSION['wallet']['PostgreSQL']['dbname']   = $GLOBALS['phpgw_info']['server']['db_name'];
+// 		    }
+// 		    else
+// 			$_SESSION['wallet'] = array();
+// 		}
+                
+                if(isset($_SESSION['wallet']))
+                    self::$wallet = $_SESSION['wallet'];
+		/////////////
+	    }
+
+	    return isset( self::$wallet[ $serviceName ] )? self::$wallet[ $serviceName ] : false;
+	}
+
+	public static function dispatch( $dispatcher, $data, $optionsMap = false )
+	{
+// 	    if( $mappedTo )
+// 		$data = array( $mappedTo => $data );
+// 
+// 	    foreach( $data as $method => $params )
+// 	    {
+// // 		foreach( $data[ $method ] as $name => $value )
+// 	    }
+// 
+// 	    self::import( "$dispatcher.php" );
+	}
+
+	public static function loadAll( $configurable, $isService = false )
+	{
+	}
+
+	public static function connect( $service, $config )
+	{
+	    $result = $service->open( $config );
+
+	    if( is_string( $result ) )
+		throw new Exception( $result );
+
+	    return( true );
+	}
+
+	public static function open( $serviceName, $config = false )
+	{
+	    $service = self::$services[ $serviceName ];
+
+	    $srvConfig = array();
+
+	    if( isset(self::$config[ $serviceName ][ 'config' ]) )
+		$srvConfig = self::configure( $srvConfig, self::$config[ $serviceName ][ 'config' ] );
+	    if( $wallet = self::wallet( $serviceName ) )
+		$srvConfig = self::configure( $srvConfig, $wallet );
+	    if( $config )
+		$srvConfig = self::configure( $srvConfig, $config );
+
+	    if( empty( $srvConfig ) )
+		$srvConfig = false;
+
+	    if( $service && self::$config[ $serviceName ]['type'] === 'service' )
+		self::connect( $service, $srvConfig );
+	}
+
+	public static function configure( $config, $newConfig )
+	{
+	    foreach( $newConfig as $key => $value )
+		$config[$key] = $value;
+
+	    return( $config );
+	}
+
+	public static function service( $serviceName, $concept = false )
+	{
+	    if( isset( self::$services[ $serviceName ] ) )
+		return self::$services[ $serviceName ];
+
+	    if( !isset(self::$config[ $serviceName ]) )
+		 self::$config[ $serviceName ] = self::loadConfig( $serviceName, true );
+
+	    if( !isset(self::$config[ $serviceName ]) )
+		return( false );
+
+	    if( !isset(self::$config[ $serviceName ]['type']) )
+		self::$config[ $serviceName ]['type'] = 'service';
+
+	    self::import( 'app/'.self::$config[ $serviceName ]['type'] );   //TODO: Item 4
+
+	    self::$services[ $serviceName ] = self::load( self::$config[ $serviceName ]['path'],
+							  self::$config[ $serviceName ]['class'] );
+
+	    if( $concept && isset(self::$config[ $concept ]['service.config']) )
+		self::open( $serviceName, $self::$config[ $concept ]['service.config'] );
+	    else
+		self::open( $serviceName );
+
+	    return( self::$services[ $serviceName ] = $service );
+	}
+
+	public static function interceptor( $method, $concept = false, $serviceName = false, $isService = false )
+	{
+	    if( $concept && !isset(self::$config[ $concept ]) )
+	      self::$config[ $concept ] = self::loadConfig( $concept );
+
+	    if( !$concept ) $concept = 'global';
+	    if( !$isService || !$serviceName ) $serviceName = 'global';
+
+	    if( !isset( self::$interceptors[ $concept ] ) )
+		self::$interceptors[ $concept ] = array();
+
+	    if( !isset( self::$interceptors[ $concept ][ $serviceName ] ) )
+		self::$interceptors[ $concept ][ $serviceName ] = array();
+
+	    if( !isset( self::$interceptors[ $concept ][ $serviceName ][ $method ] ) )
+	    {
+		$events = array( 'before', 'after' );
+		$interceptors = array();
+
+		$prefix = ( $isService )? "$serviceName." : "";
+
+		foreach( $events as $i => $event )
+		{
+		    $interceptors[$event] = array();
+
+		    if( !isset(self::$config[$concept]["$prefix$event.$method"]) )
+		      continue;
+
+		    foreach( self::$config[$concept]["$prefix$event.$method"] as $intercept => $interceptor )
+			    $interceptors[$event][$intercept] = self::load( $interceptor );
+		}
+
+		self::$interceptors[ $concept ][ $serviceName ][ $method ] = $interceptors;
+	    }
+
+	    return( self::$interceptors[ $concept ][ $serviceName ][ $method ] );
+	}
+
+	public static function fire( $eventType, $method, $params, $original, $isService = false )
+	{
+	    $interceptors = self::interceptor( $method,
+					       isset($original['URI']['concept']) ? $original['URI']['concept'] : false,
+					       isset($params['URI']['service']) ? $params['URI']['service'] : false, $isService );
+
+	    if( $interceptors && isset($interceptors[ $eventType ]) )
+		foreach( $interceptors[ $eventType ] as $intercept => $interceptor )
+		{
+		    $return = $interceptor->$intercept( $params['URI'], $params['properties'], $params['criteria'], $original, $params['service'] );
+
+		    if( $return === false )
+			return( false );
+
+		    if( isset($return) )
+			$params['properties'] = $return;
+		}
+
+	      return( $params );
+	}
+
+	/*
+	  * ex: array
+	  *		(
+	  *			[0] array( 'OR', array( array( '=', 'campo', 'valor' ), 
+							  array( 'OR', array( array( '=', 'campo', 'valor' ) ) ) )
+	  *			[1] array( '=', 'campo' , 'valor' )
+	  *			[2] array( 'OR' , array( array( '=' , campo', 'valor' ) ) )
+	  *			[3] array( 'IN', 'campo', array( '1' , '2' , '3' ) )
+	  *		)
+	  * OR
+	  *	    array( '=' , 'campo' , 'valor' )
+	*/
+
+	public static function call( $method, $URI, $properties, $criteria = false, $service = false )
+	{
+	    try
+	    {
+		$original = $params = array( 'properties' => $properties, 
+				             'criteria' => $criteria, 
+					     'URI' => $URI,
+					     'service' => $service );
+
+		if( isset($params['URI']['concept']) )
+		    $params = self::fire( 'before', $method, $params, $original );
+
+		if( !$params['service'] )
+		{
+		    $isInternal = true;
+
+		    if( ( !isset($params['URI']['service']) || !$params['URI']['service'] ) && isset($params['URI']['concept']) )
+		    {
+			if( !isset(self::$config[ $URI['concept'] ]) )
+			    self::$config[ $URI['concept'] ] = self::loadConfig( $URI['concept'] );
+
+			$params['URI']['service'] = self::$config[ $URI['concept'] ][ 'service' ];
+		    }
+
+		    if( !isset($params['URI']['service']) )
+			return( false );
+
+		    $params['service'] = self::service( $params['URI']['service'], isset($params['URI']['concept']) ? $params['URI']['concept'] : false );
+		}
+
+		if( isset($params['URI']['service']) )
+		    $params = self::fire( 'before', $method, $params, $original, true );
+
+		if( $params['service'] )
+		    switch( $method )
+		    {
+			case 'find': $return = $params['service']->find( $params['URI'], $params['properties'], $params['criteria'] ); break;
+
+			case 'read': $return = $params['service']->read( $params['URI'], $params['properties']/*, $criteria*/ ); break;
+
+			case 'create': $return = $params['service']->create( $params['URI'], $params['properties']/*, $criteria*/ ); break;
+
+			case 'delete': $return = $params['service']->delete( $params['URI'], $params['properties']/*, $criteria*/ ); break;
+
+			case 'deleteAll': $return = $params['service']->deleteAll( $params['URI'], $params['properties'], $params['criteria'] ); break;
+
+			case 'update': $return = $params['service']->update( $params['URI'], $params['properties']/*, $criteria*/ ); break;
+
+			case 'replace': $return = $params['service']->replace( $params['URI'], $params['properties'], $params['criteria'] ); break;
+
+			case 'begin': $return = $params['service']->begin( $params['URI'] ); break;
+
+			case 'commit': $return = $params['service']->commit( $params['URI'] ); break;
+
+			case 'rollback': $return = $params['service']->rollback( $params['URI'] ); break;
+
+			case 'parse': $return = $params['service']->parse( $params['properties'], $params['criteria'] ); break;
+
+			case 'format': $return = $params['service']->format( $params['properties'], $params['criteria'] ); break;
+		    }
+    
+		if( isset($return) && $return !== false )
+		    $params['properties'] = $return;
+
+		if( isset($params['URI']['service']) )
+		    $params = self::fire( 'after', $method, $params, $original, true );
+
+		if( isset($URI['concept']) )
+		    $params = self::fire( 'after', $method, $params, $original );
+	    }
+	    catch( Exception $e )
+	    {
+		if( !self::fallback( $e ) )
+		    self::closeAll();
+
+		return( false );
+	    }
+
+	    return( empty($params['properties']) ? false : $params['properties'] );
+	}
+
+	public static function fallback( $exception )
+	{
+	    error_log( $exception->getMessage() );
+	    return( true );
+	}
+}
+
+Controller::$cache = Controller::loadCache();
+?>
Index: trunk/prototype/api/service.php
===================================================================
--- trunk/prototype/api/service.php	(revision 5341)
+++ trunk/prototype/api/service.php	(revision 5341)
@@ -0,0 +1,79 @@
+<?php
+
+
+// interface Service
+// {
+// //---------------
+// 
+//     public function load   ( $concept, $parents = false, $id = false );
+// 
+// //---------------
+// 
+//     public function search ( $justthese = false, $params = false, $criteria = false );
+// 
+// //---------------
+// 
+//     public function delete ( $justthese = false, $params = false, $criteria = false );
+// 
+// //---------------
+//    
+//     public function update ( $data,              $params = false, $criteria = false );
+// 
+// //---------------
+// 
+//     public function create ( $data,              $params = false );
+// 
+// //---------------
+// 
+//     public function connect( $config );
+// 
+//     public function close();
+// 
+//     public function setup();
+// 
+//     public function teardown();
+// }
+
+
+interface Service
+{
+//---------------
+
+    public function find     ( $uri, $justthese = false, $criteria = false );
+
+    public function read     ( $uri, $justthese = false/*, $criteria = false*/ );
+
+//---------------
+
+    public function deleteAll( $uri, $justthese = false, $criteria = false ); 
+
+    public function delete   ( $uri, $justthese = false/*, $criteria = false*/ );// avaliar
+
+//---------------
+
+    public function replace  ( $uri, $data, $criteria = false );
+
+    public function update   ( $uri, $data/*, $criteria = false*/ );
+
+//---------------
+
+    public function create   ( $uri, $data/*, $criteria = false*/ );
+
+//---------------
+
+    public function open     ( $config );
+
+    public function close    ();
+
+
+    public function begin     ( $uri );
+
+    public function commit    ( $uri );
+
+    public function rollback  ( $uri );
+
+
+    public function setup     ();
+
+    public function teardown  ();
+}
Index: trunk/prototype/api/controller.php
===================================================================
--- trunk/prototype/api/controller.php	(revision 5399)
+++ trunk/prototype/api/controller.php	(revision 5399)
@@ -0,0 +1,640 @@
+<?php
+
+if( !defined( 'ROOTPATH' ) )
+    define( 'ROOTPATH', dirname(__FILE__).'/..' );
+
+require_once(ROOTPATH.'/api/config.php');
+
+/**
+TODO list:
+
+  * definir de forma centralizada os caminhos e as constantes necessÃ¡rias;
+  * criar um User Agent detect e um OS server detect para customizaÃ§Ãµes espeÃ§Ã­ficas de cada browser / servidor;
+  * criar um registrador para fallback handlers;
+  * criar um dependency manager na configuraÃ§Ã£o dos serviÃ§os, para poder gerenciar os imports corretamente
+  * criar um login e a recuperaÃ§Ã£o da sessÃ£o;
+
+*/
+
+class Controller {
+
+	static $cache;
+	static $services = array();
+	static $interceptors = array();
+	static $config = array();
+	static $includes = array();
+	static $tx = array();
+	static $txID = 0;
+	static $wallet;
+
+	public function __destruct()
+	{
+// 	    if( $this->service )
+// 		$this->service->close();
+// 	    else
+	    self::closeAll();
+	}
+
+	public static function closeAll()
+	{
+	    if( self::$services )
+		foreach( self::$services as $serviceName => $service )
+		    if( self::$config[ $serviceName ]['type'] === 'service' )
+		      $service->close();
+	}
+
+	public static function clearAll()
+	    {
+	    return self::$cache->clearAll();
+	    }
+
+	public static function clear( $id )
+	{
+	    return self::$cache->clear( $id );
+	}
+
+	public static function check( $id )
+	{
+	    return self::$cache->get( $id );
+	}
+
+	public static function store( $id, $data, $expires, $compressed )
+	{
+	    return self::$cache->put( $id, $data, $expires, $compressed );
+	}
+
+	public static function put( $URI, $data, $txIds = false )
+	{
+	    try
+	    {
+		$URI = self::serviceName( $URI );
+
+		if( $commit = !$txIds )
+			    $txIds = array();
+
+		if( !isset( self::$tx[ $URI['service'] ] ) )
+		{
+			    self::call( 'begin', $URI );
+			    self::$tx[ $txIds[] = $URI['service'] ] = array();
+	    }
+
+		$method = $data ? isset( $data['id'] ) ?
+			  'update' : 'create' : 'delete';
+
+		$links = self::links( $URI['concept'] );
+
+		$Tx = array( 'order' => self::$txID++ );
+
+		$postpone = array();
+
+		if( $data )
+		{
+		    $URI['id'] = isset( $data['id'] ) ? $data['id'] : false;
+
+		    foreach( $links as $linkName => $linkTarget )
+		    {
+				if( isset( $data[$linkName] ) && is_array( $data[$linkName] ) )
+				{
+					if( self::isConcept( $linkName ) )
+						$data[$linkName] = self::put( array( 'concept' => $linkTarget ), $data[$linkName], &$txIds );
+					else
+						$postpone[$linkTarget] = $data[$linkName];
+				}
+	}
+		}
+		else
+		  $URI['id'] = isset( $data['id'] ) ? $data['id'] : $URI['id'];
+
+		$result = Controller::call( $method, $URI, $data, false, false, true );
+
+		if( !is_bool( $result ) && !is_string( $result ) && isset( $result['id'] ) )
+		      $URI['id'] = $result['id'];
+
+		self::$tx[ $URI['service'] ][] = array_merge( $Tx, array( 'id' => $URI['id'], 'concept' => $URI['concept'], 'method' => $method, 'service' => $URI['service'], 'rollback' => !!!$result ) );
+
+		foreach( $postpone as $linkTarget => $dt )
+		      foreach( $dt as $ii => $value )
+	{
+			  if( !is_array( $value ) )
+			    $value = array( 'id' => $value );
+
+			  $value[ $URI['concept'] ] = $URI['id'];
+
+			  self::put( array( 'concept' => $linkTarget ), $value, &$txIds );
+	}
+
+		if( $commit )
+	{
+		      $result = array();
+
+		      for( $i = count( $txIds ) - 1; $i >= 0; $i-- )
+		      {
+			      $currentTx = self::$tx[ $txIds[$i] ];
+			      unset( self::$tx[ $txIds[$i] ] );
+
+			      if( !self::commit( array( 'service' => $txIds[$i] ), $currentTx ) )
+			      {
+				  self::rollback( array( 'service' => $txIds[$i] ), $currentTx );
+
+				  foreach( $currentTx as $i => $st )
+				      $currentTx[$i][ 'rollback' ] = true;
+	}
+
+			      $result = array_merge( $result, $currentTx );
+		      }
+			  
+			  self::$txID = 0;
+
+		      return( $result );
+		}
+
+	    }
+	    catch( Exception $e )
+	{
+		if( !self::fallback( $e ) )
+		    self::closeAll();
+
+		return( false );
+	    }
+	
+	    return( $URI['id'] );
+	}
+	
+	public static function get()
+	    {
+	    
+	    }
+
+	public static function find( $URI, $params = false, $criteria = false )
+	{
+	    if( isset($URI['id']) && $URI['id'] )
+		return self::read( $URI, $params, $criteria );
+	    
+	    return self::call( 'find', $URI, $params, $criteria );
+	}
+
+	public static function read( $URI, $params = false, $criteria = false )
+	{
+	    if( !isset($URI['id']) || !$URI['id'] )
+		return self::find( $URI, $params, $criteria );
+
+	    return self::call( 'read', $URI, $params, $criteria );
+	}
+
+	public static function deleteAll( $URI, $params = false, $criteria = false )
+	{
+	    if( isset($URI['id']) && $URI['id'] )
+		return self::delete( $URI, $params, $criteria );
+
+	    return self::call( 'deleteAll', $URI, $params, $criteria );
+	}
+
+	public static function delete( $URI, $params = false, $criteria = false )
+	{
+	    if( !isset($URI['id']) || !$URI['id'] )
+		return self::deleteAll( $URI, $params, $criteria );
+
+	    return self::call( 'delete', $URI, $params, $criteria );
+	}
+
+	public static function replace( $URI, $params, $criteria = false )
+	{
+	    if( isset($URI['id']) && $URI['id'] )
+		return self::update( $URI, $params, $criteria );
+
+	    return self::call( 'replace', $URI, $params, $criteria );
+	}
+
+	public static function update( $URI, $params, $criteria = false )
+	{
+	    if( !isset($URI['id']) || !$URI['id'] )
+		return self::replace( $URI, $params, $criteria );
+
+	    return self::call( 'update', $URI, $params, $criteria );
+	}
+
+	public static function create( $URI, $params, $criteria = false )
+	{
+	    return self::call( 'create', $URI, $params, $criteria );
+	}
+
+	public static function begin( $URI, $params = false, $criteria = false )
+	{
+	    return self::call( 'begin', $URI, $params, $criteria );
+	}
+
+	public static function commit( $URI, $criteria = false )
+	    {
+	    return self::call( 'commit', $URI, false, $criteria );
+	}
+
+	public static function rollback( $URI, $criteria = false )
+	{
+	    return self::call( 'rollback', $URI, false, $criteria );
+	}
+
+	public static function format( $URI, $params, $criteria = false )
+	{
+	    return self::call( 'format', $URI, $params, $criteria );
+	}
+
+	public static function parse( $URI, $data, $criteria = false )
+	{
+	    return self::call( 'parse', $URI, $data, $criteria );
+	    }
+
+	public static function URI( $className, $id = false, $service = false )
+	{
+	    return array( 'concept' => $className,
+			  'service' => $service ? $service : false, 
+			  'id' => $id ? $id : '' );
+	}
+
+	//TODO: Compatibilizar as configs relativas aos modulos, adicionando os mesmo nos parametros passados
+	public static function links( $concept = false )
+	{
+	    if( !isset(self::$config[ $concept ]) )
+	      self::$config[ $concept ] = self::loadConfig( $concept );
+
+	    return( isset(self::$config[ $concept ]['links']) ? 
+			  self::$config[ $concept ]['links'] : array() );
+	}
+
+	public static function isConcept( $concept )
+	{ 
+	    if( isset( self::$config[ $concept ] ) && 
+		self::$config[ $concept ] )
+		return( true );
+		else
+		return file_exists( ROOTPATH."/config/$concept.ini" );
+	}
+
+	public static function getConcept( $concept, $moduleName = false )
+	{
+	    if( isset( self::$config[ $concept ] ) )
+		return( self::$config[ $concept ] );
+
+	    return( self::$config[ $concept ] = self::loadConfig( $concept, $moduleName ) );
+	}
+
+	public static function loadCache( $cacheType = 'Memory' )
+	{
+	    include_once( "cache/MemoryCache.php" );
+	    return new MemoryCache();
+	}
+
+	//TODO: Compatibilizar as configs relativas aos modulos, adicionando os mesmo nos parametros passados
+	public static function loadConfig( $className, $isService = false)
+	{
+	    $fileName = $className.'.'.($isService ? 'srv' : 'ini');
+
+	    $config = self::$cache->get( $fileName );
+        
+	    if( !$config )
+	    {
+                $config = parse_ini_file( ROOTPATH.'/config/'.$fileName, true );
+
+		self::$cache->put( $fileName, $config );
+	    }
+
+	    return( $config );
+	}
+
+	public static function import( $path, $ext = ".php" )
+	{ 
+	    if( !isset(self::$includes[$path]) )
+	{
+		require_once( ROOTPATH.'/'.$path.$ext );
+		self::$includes[$path] = false;
+	    }
+
+	    return( self::$includes[$path] );
+	}
+
+	public static function load( $path, $class = false )
+	    { 
+            if( $return = self::import( $path, "" ) )
+		return( $return );
+
+	    if( !$class ){
+		preg_match( '/^\/?.*\/([^\/]+).php$/', $path, $class );
+		$class = $class[1];
+	    }
+
+	    $object =  self::$cache->get( $class );
+
+	    if( !$object )
+	    {
+		$object = new $class();
+		 self::$cache->put( $class, $object );
+	    }
+
+	    self::$includes[$path] = $object;
+
+	    return( $object );
+	}
+
+	public static function wallet( $serviceName )
+	{
+	    if( !isset( self::$wallet ) )
+	    {
+		//// Hack //// TODO: passar o init da sessÃ£o no login do expresso
+		Config::init();
+
+                if(isset($_SESSION['wallet']))
+                    self::$wallet = $_SESSION['wallet'];
+		/////////////
+	    }
+
+	    return isset( self::$wallet[ $serviceName ] )? self::$wallet[ $serviceName ] : false;
+	}
+		
+	public static function connect( $service, $config )
+	    {
+	    $result = $service->open( $config );
+
+	    if( is_string( $result ) )
+		throw new Exception( $result );
+
+	    return( true );
+	}
+
+	public static function configure( $config, $newConfig )
+	{
+	    foreach( $newConfig as $key => $value )
+		$config[$key] = $value;
+
+	    return( $config );
+	    }
+
+	public static function dispatch( $dispatcher, $data, $optionsMap = false )
+	{
+// 	    if( $mappedTo )
+// 		$data = array( $mappedTo => $data );
+// 
+// 	    foreach( $data as $method => $params )
+// 	    {
+// // 		foreach( $data[ $method ] as $name => $value )
+// 	    }
+// 
+// 	    self::import( "$dispatcher.php" );
+	}
+
+	//TODO: Compatibilizar as configs relativas aos modulos, adicionando os mesmo nos parametros passados
+	public static function service( $serviceName, $concept = false )
+	{
+	    if( isset( self::$services[ $serviceName ] ) )
+		return self::$services[ $serviceName ];
+
+	    if( !isset(self::$config[ $serviceName ]) )
+		 self::$config[ $serviceName ] = self::loadConfig( $serviceName, true );
+
+	    if( !isset(self::$config[ $serviceName ]) )
+		return( false );
+
+	    if( !isset(self::$config[ $serviceName ]['type']) )
+		self::$config[ $serviceName ]['type'] = 'service';
+
+	    self::import( 'api/'.self::$config[ $serviceName ]['type'] );   //TODO: Item 4
+
+	    $service = self::load( self::$config[ $serviceName ]['path'],
+				   self::$config[ $serviceName ]['class'] );
+
+	      $srvConfig = array();
+
+	    if( isset(self::$config[ $serviceName ][ 'config' ]) )
+		$srvConfig = self::configure( $srvConfig, self::$config[ $serviceName ][ 'config' ] );
+	    if( $wallet = self::wallet( $serviceName ) )
+		$srvConfig = self::configure( $srvConfig, $wallet );
+	    if( $concept && isset(self::$config[ $concept ]['service.config']) )
+		$srvConfig = self::configure( $srvConfig, self::$config[ $concept ]['service.config'] );
+
+	    if( empty( $srvConfig ) )
+		$srvConfig = false;
+
+	    if( $service && self::$config[ $serviceName ]['type'] === 'service' )
+		self::connect( $service, $srvConfig );
+
+	    return( self::$services[ $serviceName ] = $service );
+	}
+
+	//TODO: Compatibilizar as configs relativas aos modulos, adicionando os mesmo nos parametros passados
+	public static function interceptor( $method, $concept = false, $serviceName = false, $isService = false )
+	{
+	    if( $concept && !isset(self::$config[ $concept ]) )
+	      self::$config[ $concept ] = self::loadConfig( $concept );
+
+	    if( !$concept ) $concept = 'global';
+	    if( !$isService || !$serviceName ) $serviceName = 'global';
+
+	    if( !isset( self::$interceptors[ $concept ] ) )
+		self::$interceptors[ $concept ] = array();
+
+	    if( !isset( self::$interceptors[ $concept ][ $serviceName ] ) )
+		self::$interceptors[ $concept ][ $serviceName ] = array();
+
+	    if( !isset( self::$interceptors[ $concept ][ $serviceName ][ $method ] ) )
+	    {
+		$events = array( 'before', 'after' );
+		$interceptors = array();
+
+		$prefix = ( $isService )? "$serviceName." : "";
+
+		foreach( $events as $i => $event )
+		{
+		    $interceptors[$event] = array();
+
+		    if( !isset(self::$config[$concept]["$prefix$event.$method"]) )
+		      continue;
+
+		    foreach( self::$config[$concept]["$prefix$event.$method"] as $intercept => $interceptor )
+			    $interceptors[$event][$intercept] = self::load( $interceptor );
+		}
+
+		self::$interceptors[ $concept ][ $serviceName ][ $method ] = $interceptors;
+	    }
+
+	    return( self::$interceptors[ $concept ][ $serviceName ][ $method ] );
+	}
+
+	public static function interceptorCommit( $eventType, $commitList, $isService = false )
+	{
+	    $result = array( $eventType => array() );
+        
+        if( is_array( $commitList ) )
+	        foreach( $commitList as $i => $tx )
+	        {
+		    $interceptors = self::interceptor( 'commit', $tx['concept'], $tx['service'], $isService );
+      
+		    $result[$eventType] = array_merge( $result[$eventType], $interceptors[$eventType] );
+	        }
+
+	    return( $result );
+	}
+
+	public static function fire( $eventType, $method, &$params, $original, $isService = false )
+	{
+	    if( $method === 'commit' )
+		$interceptors = self::interceptorCommit( $eventType, $params['criteria'], $isService );
+
+	    else
+		$interceptors = self::interceptor( $method,
+						   isset($original['URI']['concept']) ? $original['URI']['concept'] : false,
+						   isset($params['URI']['service']) ? $params['URI']['service'] : false, $isService );
+
+	    if( $interceptors && isset($interceptors[ $eventType ]) )
+		foreach( $interceptors[ $eventType ] as $intercept => $interceptor )
+		{
+		    $return = $interceptor->$intercept( $params['URI'], $params['properties'], $params['criteria'], $original/*, $params['service']*/ );
+
+		    if( $return === false )
+		return( false );
+
+		    if( isset($return) )
+			$params['properties'] = $return;
+		}
+
+	      return( $params );
+	}
+
+	/*
+	  * ex: array
+	  *		(
+	  *			[0] array( 'OR', array( array( '=', 'campo', 'valor' ), 
+							  array( 'OR', array( array( '=', 'campo', 'valor' ) ) ) )
+	  *			[1] array( '=', 'campo' , 'valor' )
+	  *			[2] array( 'OR' , array( array( '=' , campo', 'valor' ) ) )
+	  *			[3] array( 'IN', 'campo', array( '1' , '2' , '3' ) )
+	  *		)
+	  * OR
+	  *	    array( '=' , 'campo' , 'valor' )
+	*/
+
+	//TODO: Compatibilizar as configs relativas aos modulos, adicionando os mesmo nos parametros passados
+	public static function serviceName( $URI, $original = false )
+	{
+	     $concept = "";
+
+	    if( $original && isset($original['concept']) && $original['concept'] )
+		$concept = $original['concept'];
+	    elseif( isset($URI['concept']) && $URI['concept'] )
+		$concept = $URI['concept'];
+
+	    if( ( !isset($URI['service']) || !$URI['service'] ) && $concept )
+	    {
+		if( !isset(self::$config[ $concept ]) )
+		    self::$config[ $concept ] = self::loadConfig( $concept );
+
+		$URI['service'] = self::$config[ $concept ][ 'service' ];
+	    }
+
+	    if( !isset($URI['service']) )
+		throw new Exception( "CONFIGURATION ERROR: service name from concept '$concept' not found" );
+
+	    return( $URI );
+	}
+
+	//TODO: Compatibilizar as configs relativas aos modulos, adicionando os mesmos nas options passadas
+	public static function call( $method, $URI, $properties = false, $options = false, $service = false, $noTX = false )
+	{
+	    try
+	    {
+		if( !isset($URI['concept']) ) $URI['concept'] = false;
+
+		$original = $params = array( 'properties' => $properties, 
+				             'criteria' => $options, 
+					     'URI' => $URI,
+					     'service' => $service );
+
+		if( isset($params['URI']['concept'])  && !self::fire( 'before', $method, $params, $original ) )
+		    return( empty($params['properties']) ? false : $params['properties'] );
+
+		if( $params && !$params['service'] )
+		{
+		    $params['URI'] = self::serviceName( $params['URI'], $original['URI'] );
+
+		    $params['service'] = self::service( $params['URI']['service'], $params['URI']['concept'] );
+		}
+
+		if( isset($params['URI']['service']) )
+		{
+		    if( $commit = (!isset(self::$tx[ $params['URI']['service'] ]) && ( $method === 'create' ||
+										       $method === 'update' ||
+										       $method === 'delete' )) )
+		    {
+			self::call( 'begin', $params['URI'] );
+			self::$tx[ $params['URI']['service'] ] = true;
+		    }
+
+		    if( !self::fire( 'before', $method, $params, $original, true ) )
+			return( empty($params['properties']) ? false : $params['properties'] );
+		}
+
+		if( $params['service'] )
+		    switch( $method )
+	    { 
+			case 'find': $return = $params['service']->find( $params['URI'], $params['properties'], $params['criteria'] ); break;
+
+			case 'read': $return = $params['service']->read( $params['URI'], $params['properties']/*, $criteria*/ ); break;
+
+			case 'create': $return = $params['service']->create( $params['URI'], $params['properties']/*, $criteria*/ ); break;
+
+			case 'delete': $return = $params['service']->delete( $params['URI'], $params['properties']/*, $criteria*/ ); break;
+
+			case 'deleteAll': $return = $params['service']->deleteAll( $params['URI'], $params['properties'], $params['criteria'] ); break;
+
+			case 'update': $return = $params['service']->update( $params['URI'], $params['properties']/*, $criteria*/ ); break;
+
+			case 'replace': $return = $params['service']->replace( $params['URI'], $params['properties'], $params['criteria'] ); break;
+
+			case 'begin': $return = $params['service']->begin( $params['URI'] ); break;
+
+			case 'commit': $return = $params['service']->commit( $params['URI'], $params['criteria'] ); break;
+
+			case 'rollback': $return = $params['service']->rollback( $params['URI'], $params['criteria'] ); break;
+
+			case 'parse': $return = $params['service']->parse( $params['properties'], $params['criteria'] ); break;
+
+			case 'format': $return = $params['service']->format( $params['properties'], $params['criteria'] ); break;
+	    }
+
+		if( isset($return) && $return !== false )
+		    $params['properties'] = $return;
+
+		if( isset($params['URI']['service']) )
+		{
+		    if( !self::fire( 'after', $method, $params, $original, true ) )
+			return( empty($params['properties']) ? false : $params['properties'] );
+
+		    if( $commit )
+		    {
+			if( !self::call( 'commit', $params['URI'], false, self::$tx[ $params['URI']['service'] ] ) )
+			    self::call( 'rollback', $params['URI'] , false, self::$tx[ $params['URI']['service'] ] );
+
+			unset( self::$tx[ $params['URI']['service'] ] );
+		    }
+		}
+
+		if( isset($URI['concept']) && !self::fire( 'after', $method, $params, $original ) )
+		    return( empty($params['properties']) ? false : $params['properties'] );
+	    }
+	    catch( Exception $e )
+	    {
+		if( !self::fallback( $e ) )
+		    self::closeAll();
+
+		return( false );
+	    }
+
+	    return( empty($params['properties']) ? false : $params['properties'] );
+	}
+
+	public static function fallback( $exception )
+	{
+	    error_log( $exception->getMessage() );
+	    return( true );
+	}
+}
+
+Controller::$cache = Controller::loadCache();
+?>
Index: trunk/prototype/api/formatter.php
===================================================================
--- trunk/prototype/api/formatter.php	(revision 5341)
+++ trunk/prototype/api/formatter.php	(revision 5341)
@@ -0,0 +1,8 @@
+<?php
+
+interface Formatter
+{
+    public function format( $data , $params = false);
+
+    public function parse( $data , $params = false);
+}
Index: trunk/prototype/api/config.php
===================================================================
--- trunk/prototype/api/config.php	(revision 5399)
+++ trunk/prototype/api/config.php	(revision 5399)
@@ -0,0 +1,92 @@
+<?php
+
+class Config 
+{
+    static $register;
+    static $sessionStarted;
+  
+    static function module($config , $module = false)
+    {
+        //Todo: registrar na nova api o currentapp
+        if(!$module)
+            $module =  $_SESSION['flags']['currentapp'];
+  
+        if( !isset( $_SESSION['config'][$module] ) || !isset( $_SESSION['config'][$module][$config] ))
+            $_SESSION['config'][$module] = parse_ini_file( ROOTPATH."/config/$module.ini", true );
+        
+        return isset($_SESSION['config'][$module][$config]) ? $_SESSION['config'][$module][$config] : false;
+     
+    }
+    
+    static function me($config)
+    {
+        
+        return isset($_SESSION['wallet']['user'][$config]) ? $_SESSION['wallet']['user'][$config] : false;
+    }
+    
+    static function service( $service , $config )
+    {
+        if( !isset( $_SESSION['wallet'][$service] ) || !isset( $_SESSION['wallet'][$service][$config] ))
+            $_SESSION['wallet'][$service] = parse_ini_file( ROOTPATH."/config/$service.srv", true );
+        
+        return isset($_SESSION['wallet'][$service][$config]) ? $_SESSION['wallet'][$service][$config] : false;
+    }
+    
+    static function regSet( $name , $value)
+    {
+        self::$register[$name] = $value;
+    }
+    static function regGet ($name )
+    {
+        return (isset(self::$register[$name]) ? self::$register[$name] : false );
+    }
+
+    static function init( $header = false )
+    {
+        
+        if( !defined( 'ROOTPATH' ) )
+            define( 'ROOTPATH', dirname(__FILE__).'/..' );
+        
+        if ( isset( $_COOKIE[ 'sessionid' ] ) ) 
+        {
+            session_id( $_COOKIE[ 'sessionid' ] ); 
+            $GLOBALS['phpgw']->session->sessionid = $_COOKIE[ 'sessionid' ];
+        }
+		
+	if( !self::$sessionStarted )
+            self::$sessionStarted = session_start();
+		
+	if( $header === true )
+	{
+            require_once (dirname(__FILE__).'/../../header.inc.php');
+
+            $_SESSION['wallet']['Sieve']['user']          =  $GLOBALS['phpgw_info']['user']['account_lid'];
+            $_SESSION['wallet']['Sieve']['password']      =  $GLOBALS['phpgw_info']['user']['passwd'];
+
+            $_SESSION['wallet']['Cyrus']['user']          =  $GLOBALS['phpgw_info']['user']['account_lid'];
+            $_SESSION['wallet']['Cyrus']['password']      =  $GLOBALS['phpgw_info']['user']['passwd'];
+
+            $_SESSION['wallet']['user']['uid']	      	  =  $GLOBALS['phpgw_info']['user']['userid'];
+            $_SESSION['wallet']['user']['uidNumber']      =  $GLOBALS['phpgw_info']['user']['account_id'];
+            $_SESSION['wallet']['user']['password']       =  $GLOBALS['phpgw_info']['user']['passwd'];
+            $_SESSION['wallet']['user']['cn']             =  $GLOBALS['phpgw_info']['user']['cn'];
+            $_SESSION['wallet']['user']['mail']           =  $GLOBALS['phpgw_info']['user']['email'];
+
+            $_SESSION['wallet']['PostgreSQL']['user']     = $GLOBALS['phpgw_info']['server']['db_user'];
+            $_SESSION['wallet']['PostgreSQL']['password'] = $GLOBALS['phpgw_info']['server']['db_pass'];
+            $_SESSION['wallet']['PostgreSQL']['dbname']   = $GLOBALS['phpgw_info']['server']['db_name'];
+            $_SESSION['wallet']['PostgreSQL']['host']     = $GLOBALS['phpgw_info']['server']['db_host'];
+            
+            $_SESSION['wallet']['OpenLDAP']['context']   =  $GLOBALS['phpgw_info']['server']['ldap_context'];
+            $_SESSION['wallet']['OpenLDAP']['host']      =  $GLOBALS['phpgw_info']['server']['ldap_host'];
+           
+	}
+		
+    }
+
+}
+
+    Config::init();
+	
+
+?>
Index: trunk/prototype/api/templates/jquery-ui/redmond/jquery-ui.css
===================================================================
--- trunk/prototype/api/templates/jquery-ui/redmond/jquery-ui.css	(revision 5341)
+++ trunk/prototype/api/templates/jquery-ui/redmond/jquery-ui.css	(revision 5341)
@@ -0,0 +1,568 @@
+/*
+ * jQuery UI CSS Framework 1.8.16
+ *
+ * Copyright 2011, 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/Theming/API
+ */
+
+/* Layout helpers
+----------------------------------*/
+.ui-helper-hidden { display: none; }
+.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
+.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
+.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
+.ui-helper-clearfix { display: inline-block; }
+/* required comment for clearfix to work in Opera \*/
+* html .ui-helper-clearfix { height:1%; }
+.ui-helper-clearfix { display:block; }
+/* end clearfix */
+.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
+
+
+/* Interaction Cues
+----------------------------------*/
+.ui-state-disabled { cursor: default !important; }
+
+
+/* Icons
+----------------------------------*/
+
+/* states and images */
+.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
+
+
+/* Misc visuals
+----------------------------------*/
+
+/* Overlays */
+.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
+
+
+/*
+ * jQuery UI CSS Framework 1.8.16
+ *
+ * Copyright 2011, 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/Theming/API
+ *
+ * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Lucida%20Grande,%20Lucida%20Sans,%20Arial,%20sans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=5px&bgColorHeader=5c9ccc&bgTextureHeader=12_gloss_wave.png&bgImgOpacityHeader=55&borderColorHeader=4297d7&fcHeader=ffffff&iconColorHeader=d8e7f3&bgColorContent=fcfdfd&bgTextureContent=06_inset_hard.png&bgImgOpacityContent=100&borderColorContent=a6c9e2&fcContent=222222&iconColorContent=469bdd&bgColorDefault=dfeffc&bgTextureDefault=02_glass.png&bgImgOpacityDefault=85&borderColorDefault=c5dbec&fcDefault=2e6e9e&iconColorDefault=6da8d5&bgColorHover=d0e5f5&bgTextureHover=02_glass.png&bgImgOpacityHover=75&borderColorHover=79b7e7&fcHover=1d5987&iconColorHover=217bc0&bgColorActive=f5f8f9&bgTextureActive=06_inset_hard.png&bgImgOpacityActive=100&borderColorActive=79b7e7&fcActive=e17009&iconColorActive=f9bd01&bgColorHighlight=fbec88&bgTextureHighlight=01_flat.png&bgImgOpacityHighlight=55&borderColorHighlight=fad42e&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=02_glass.png&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
+ */
+
+
+/* Component containers
+----------------------------------*/
+.ui-widget { font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1.1em; }
+.ui-widget .ui-widget { font-size: 1em; }
+.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1em; }
+.ui-widget-content { border: 1px solid #a6c9e2; background: #fcfdfd url(images/ui-bg_inset-hard_100_fcfdfd_1x100.png) 50% bottom repeat-x; color: #222222; }
+.ui-widget-content a { color: #222222; }
+.ui-widget-header { border: 1px solid #4297d7; background: #5c9ccc url(images/ui-bg_gloss-wave_55_5c9ccc_500x100.png) 50% 50% repeat-x; color: #ffffff; font-weight: bold; }
+.ui-widget-header a { color: #ffffff; }
+
+/* Interaction states
+----------------------------------*/
+.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #c5dbec; background: #dfeffc url(images/ui-bg_glass_85_dfeffc_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #2e6e9e; }
+.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #2e6e9e; text-decoration: none; }
+.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #79b7e7; background: #d0e5f5 url(images/ui-bg_glass_75_d0e5f5_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #1d5987; }
+.ui-state-hover a, .ui-state-hover a:hover { color: #1d5987; text-decoration: none; }
+.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #79b7e7; background: #f5f8f9 url(images/ui-bg_inset-hard_100_f5f8f9_1x100.png) 50% 50% repeat-x; font-weight: bold; color: #e17009; }
+.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #e17009; text-decoration: none; }
+.ui-widget :active { outline: none; }
+
+/* Interaction Cues
+----------------------------------*/
+.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight  {border: 1px solid #fad42e; background: #fbec88 url(images/ui-bg_flat_55_fbec88_40x100.png) 50% 50% repeat-x; color: #363636; }
+.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
+.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; }
+.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; }
+.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; }
+.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
+.ui-priority-secondary, .ui-widget-content .ui-priority-secondary,  .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
+.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
+
+/* Icons
+----------------------------------*/
+
+/* states and images */
+.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_469bdd_256x240.png); }
+.ui-widget-content .ui-icon {background-image: url(images/ui-icons_469bdd_256x240.png); }
+.ui-widget-header .ui-icon {background-image: url(images/ui-icons_d8e7f3_256x240.png); }
+.ui-state-default .ui-icon { background-image: url(images/ui-icons_6da8d5_256x240.png); }
+.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_217bc0_256x240.png); }
+.ui-state-active .ui-icon {background-image: url(images/ui-icons_f9bd01_256x240.png); }
+.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); }
+.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); }
+
+/* positioning */
+.ui-icon-carat-1-n { background-position: 0 0; }
+.ui-icon-carat-1-ne { background-position: -16px 0; }
+.ui-icon-carat-1-e { background-position: -32px 0; }
+.ui-icon-carat-1-se { background-position: -48px 0; }
+.ui-icon-carat-1-s { background-position: -64px 0; }
+.ui-icon-carat-1-sw { background-position: -80px 0; }
+.ui-icon-carat-1-w { background-position: -96px 0; }
+.ui-icon-carat-1-nw { background-position: -112px 0; }
+.ui-icon-carat-2-n-s { background-position: -128px 0; }
+.ui-icon-carat-2-e-w { background-position: -144px 0; }
+.ui-icon-triangle-1-n { background-position: 0 -16px; }
+.ui-icon-triangle-1-ne { background-position: -16px -16px; }
+.ui-icon-triangle-1-e { background-position: -32px -16px; }
+.ui-icon-triangle-1-se { background-position: -48px -16px; }
+.ui-icon-triangle-1-s { background-position: -64px -16px; }
+.ui-icon-triangle-1-sw { background-position: -80px -16px; }
+.ui-icon-triangle-1-w { background-position: -96px -16px; }
+.ui-icon-triangle-1-nw { background-position: -112px -16px; }
+.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
+.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
+.ui-icon-arrow-1-n { background-position: 0 -32px; }
+.ui-icon-arrow-1-ne { background-position: -16px -32px; }
+.ui-icon-arrow-1-e { background-position: -32px -32px; }
+.ui-icon-arrow-1-se { background-position: -48px -32px; }
+.ui-icon-arrow-1-s { background-position: -64px -32px; }
+.ui-icon-arrow-1-sw { background-position: -80px -32px; }
+.ui-icon-arrow-1-w { background-position: -96px -32px; }
+.ui-icon-arrow-1-nw { background-position: -112px -32px; }
+.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
+.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
+.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
+.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
+.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
+.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
+.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
+.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
+.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
+.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
+.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
+.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
+.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
+.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
+.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
+.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
+.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
+.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
+.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
+.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
+.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
+.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
+.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
+.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
+.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
+.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
+.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
+.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
+.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
+.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
+.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
+.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
+.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
+.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
+.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
+.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
+.ui-icon-arrow-4 { background-position: 0 -80px; }
+.ui-icon-arrow-4-diag { background-position: -16px -80px; }
+.ui-icon-extlink { background-position: -32px -80px; }
+.ui-icon-newwin { background-position: -48px -80px; }
+.ui-icon-refresh { background-position: -64px -80px; }
+.ui-icon-shuffle { background-position: -80px -80px; }
+.ui-icon-transfer-e-w { background-position: -96px -80px; }
+.ui-icon-transferthick-e-w { background-position: -112px -80px; }
+.ui-icon-folder-collapsed { background-position: 0 -96px; }
+.ui-icon-folder-open { background-position: -16px -96px; }
+.ui-icon-document { background-position: -32px -96px; }
+.ui-icon-document-b { background-position: -48px -96px; }
+.ui-icon-note { background-position: -64px -96px; }
+.ui-icon-mail-closed { background-position: -80px -96px; }
+.ui-icon-mail-open { background-position: -96px -96px; }
+.ui-icon-suitcase { background-position: -112px -96px; }
+.ui-icon-comment { background-position: -128px -96px; }
+.ui-icon-person { background-position: -144px -96px; }
+.ui-icon-print { background-position: -160px -96px; }
+.ui-icon-trash { background-position: -176px -96px; }
+.ui-icon-locked { background-position: -192px -96px; }
+.ui-icon-unlocked { background-position: -208px -96px; }
+.ui-icon-bookmark { background-position: -224px -96px; }
+.ui-icon-tag { background-position: -240px -96px; }
+.ui-icon-home { background-position: 0 -112px; }
+.ui-icon-flag { background-position: -16px -112px; }
+.ui-icon-calendar { background-position: -32px -112px; }
+.ui-icon-cart { background-position: -48px -112px; }
+.ui-icon-pencil { background-position: -64px -112px; }
+.ui-icon-clock { background-position: -80px -112px; }
+.ui-icon-disk { background-position: -96px -112px; }
+.ui-icon-calculator { background-position: -112px -112px; }
+.ui-icon-zoomin { background-position: -128px -112px; }
+.ui-icon-zoomout { background-position: -144px -112px; }
+.ui-icon-search { background-position: -160px -112px; }
+.ui-icon-wrench { background-position: -176px -112px; }
+.ui-icon-gear { background-position: -192px -112px; }
+.ui-icon-heart { background-position: -208px -112px; }
+.ui-icon-star { background-position: -224px -112px; }
+.ui-icon-link { background-position: -240px -112px; }
+.ui-icon-cancel { background-position: 0 -128px; }
+.ui-icon-plus { background-position: -16px -128px; }
+.ui-icon-plusthick { background-position: -32px -128px; }
+.ui-icon-minus { background-position: -48px -128px; }
+.ui-icon-minusthick { background-position: -64px -128px; }
+.ui-icon-close { background-position: -80px -128px; }
+.ui-icon-closethick { background-position: -96px -128px; }
+.ui-icon-key { background-position: -112px -128px; }
+.ui-icon-lightbulb { background-position: -128px -128px; }
+.ui-icon-scissors { background-position: -144px -128px; }
+.ui-icon-clipboard { background-position: -160px -128px; }
+.ui-icon-copy { background-position: -176px -128px; }
+.ui-icon-contact { background-position: -192px -128px; }
+.ui-icon-image { background-position: -208px -128px; }
+.ui-icon-video { background-position: -224px -128px; }
+.ui-icon-script { background-position: -240px -128px; }
+.ui-icon-alert { background-position: 0 -144px; }
+.ui-icon-info { background-position: -16px -144px; }
+.ui-icon-notice { background-position: -32px -144px; }
+.ui-icon-help { background-position: -48px -144px; }
+.ui-icon-check { background-position: -64px -144px; }
+.ui-icon-bullet { background-position: -80px -144px; }
+.ui-icon-radio-off { background-position: -96px -144px; }
+.ui-icon-radio-on { background-position: -112px -144px; }
+.ui-icon-pin-w { background-position: -128px -144px; }
+.ui-icon-pin-s { background-position: -144px -144px; }
+.ui-icon-play { background-position: 0 -160px; }
+.ui-icon-pause { background-position: -16px -160px; }
+.ui-icon-seek-next { background-position: -32px -160px; }
+.ui-icon-seek-prev { background-position: -48px -160px; }
+.ui-icon-seek-end { background-position: -64px -160px; }
+.ui-icon-seek-start { background-position: -80px -160px; }
+/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
+.ui-icon-seek-first { background-position: -80px -160px; }
+.ui-icon-stop { background-position: -96px -160px; }
+.ui-icon-eject { background-position: -112px -160px; }
+.ui-icon-volume-off { background-position: -128px -160px; }
+.ui-icon-volume-on { background-position: -144px -160px; }
+.ui-icon-power { background-position: 0 -176px; }
+.ui-icon-signal-diag { background-position: -16px -176px; }
+.ui-icon-signal { background-position: -32px -176px; }
+.ui-icon-battery-0 { background-position: -48px -176px; }
+.ui-icon-battery-1 { background-position: -64px -176px; }
+.ui-icon-battery-2 { background-position: -80px -176px; }
+.ui-icon-battery-3 { background-position: -96px -176px; }
+.ui-icon-circle-plus { background-position: 0 -192px; }
+.ui-icon-circle-minus { background-position: -16px -192px; }
+.ui-icon-circle-close { background-position: -32px -192px; }
+.ui-icon-circle-triangle-e { background-position: -48px -192px; }
+.ui-icon-circle-triangle-s { background-position: -64px -192px; }
+.ui-icon-circle-triangle-w { background-position: -80px -192px; }
+.ui-icon-circle-triangle-n { background-position: -96px -192px; }
+.ui-icon-circle-arrow-e { background-position: -112px -192px; }
+.ui-icon-circle-arrow-s { background-position: -128px -192px; }
+.ui-icon-circle-arrow-w { background-position: -144px -192px; }
+.ui-icon-circle-arrow-n { background-position: -160px -192px; }
+.ui-icon-circle-zoomin { background-position: -176px -192px; }
+.ui-icon-circle-zoomout { background-position: -192px -192px; }
+.ui-icon-circle-check { background-position: -208px -192px; }
+.ui-icon-circlesmall-plus { background-position: 0 -208px; }
+.ui-icon-circlesmall-minus { background-position: -16px -208px; }
+.ui-icon-circlesmall-close { background-position: -32px -208px; }
+.ui-icon-squaresmall-plus { background-position: -48px -208px; }
+.ui-icon-squaresmall-minus { background-position: -64px -208px; }
+.ui-icon-squaresmall-close { background-position: -80px -208px; }
+.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
+.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
+.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
+.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
+.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
+.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
+
+
+/* Misc visuals
+----------------------------------*/
+
+/* Corner radius */
+.ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 5px; -webkit-border-top-left-radius: 5px; -khtml-border-top-left-radius: 5px; border-top-left-radius: 5px; }
+.ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 5px; -webkit-border-top-right-radius: 5px; -khtml-border-top-right-radius: 5px; border-top-right-radius: 5px; }
+.ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 5px; -webkit-border-bottom-left-radius: 5px; -khtml-border-bottom-left-radius: 5px; border-bottom-left-radius: 5px; }
+.ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 5px; -webkit-border-bottom-right-radius: 5px; -khtml-border-bottom-right-radius: 5px; border-bottom-right-radius: 5px; }
+
+/* Overlays */
+.ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); }
+.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -khtml-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }/*
+ * jQuery UI Resizable 1.8.16
+ *
+ * Copyright 2011, 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/Resizable#theming
+ */
+.ui-resizable { position: relative;}
+.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block; }
+.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
+.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
+.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
+.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }
+.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }
+.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
+.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
+.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
+.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/*
+ * jQuery UI Selectable 1.8.16
+ *
+ * Copyright 2011, 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/Selectable#theming
+ */
+.ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; }
+/*
+ * jQuery UI Accordion 1.8.16
+ *
+ * Copyright 2011, 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/Accordion#theming
+ */
+/* IE/Win - Fix animation bug - #4615 */
+.ui-accordion { width: 100%; }
+.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
+.ui-accordion .ui-accordion-li-fix { display: inline; }
+.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }
+.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; }
+.ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; }
+.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
+.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; }
+.ui-accordion .ui-accordion-content-active { display: block; }
+/*
+ * jQuery UI Autocomplete 1.8.16
+ *
+ * Copyright 2011, 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/Autocomplete#theming
+ */
+.ui-autocomplete { position: absolute; cursor: default; }	
+
+/* workarounds */
+* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
+
+/*
+ * jQuery UI Menu 1.8.16
+ *
+ * Copyright 2010, 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/Menu#theming
+ */
+.ui-menu {
+	list-style:none;
+	padding: 2px;
+	margin: 0;
+	display:block;
+	float: left;
+}
+.ui-menu .ui-menu {
+	margin-top: -3px;
+}
+.ui-menu .ui-menu-item {
+	margin:0;
+	padding: 0;
+	zoom: 1;
+	float: left;
+	clear: left;
+	width: 100%;
+}
+.ui-menu .ui-menu-item a {
+	text-decoration:none;
+	display:block;
+	padding:.2em .4em;
+	line-height:1.5;
+	zoom:1;
+}
+.ui-menu .ui-menu-item a.ui-state-hover,
+.ui-menu .ui-menu-item a.ui-state-active {
+	font-weight: normal;
+	margin: -1px;
+}
+/*
+ * jQuery UI Button 1.8.16
+ *
+ * Copyright 2011, 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#theming
+ */
+.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */
+.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
+button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
+.ui-button-icons-only { width: 3.4em; } 
+button.ui-button-icons-only { width: 3.7em; } 
+
+/*button text element */
+.ui-button .ui-button-text { display: block; line-height: 1.4;  }
+.ui-button-text-only .ui-button-text { padding: .4em 1em; }
+.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }
+.ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }
+.ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; }
+.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }
+/* no icon support for input elements, provide padding by default */
+input.ui-button { padding: .4em 1em; }
+
+/*button icon element(s) */
+.ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }
+.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }
+.ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }
+.ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
+.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
+
+/*button sets*/
+.ui-buttonset { margin-right: 7px; }
+.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; }
+
+/* workarounds */
+button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */
+/*
+ * jQuery UI Dialog 1.8.16
+ *
+ * Copyright 2011, 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#theming
+ */
+.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; }
+.ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative;  }
+.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; } 
+.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
+.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
+.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
+.ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
+.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
+.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; }
+.ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; }
+.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
+.ui-draggable .ui-dialog-titlebar { cursor: move; }
+/*
+ * jQuery UI Slider 1.8.16
+ *
+ * Copyright 2011, 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/Slider#theming
+ */
+.ui-slider { position: relative; text-align: left; }
+.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
+.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
+
+.ui-slider-horizontal { height: .8em; }
+.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
+.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
+.ui-slider-horizontal .ui-slider-range-min { left: 0; }
+.ui-slider-horizontal .ui-slider-range-max { right: 0; }
+
+.ui-slider-vertical { width: .8em; height: 100px; }
+.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
+.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
+.ui-slider-vertical .ui-slider-range-min { bottom: 0; }
+.ui-slider-vertical .ui-slider-range-max { top: 0; }/*
+ * jQuery UI Tabs 1.8.16
+ *
+ * Copyright 2011, 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/Tabs#theming
+ */
+.ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
+.ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; }
+.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; }
+.ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; }
+.ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; }
+.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; }
+.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
+.ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; }
+.ui-tabs .ui-tabs-hide { display: none !important; }
+/*
+ * jQuery UI Datepicker 1.8.16
+ *
+ * Copyright 2011, 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/Datepicker#theming
+ */
+.ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; }
+.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
+.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
+.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
+.ui-datepicker .ui-datepicker-prev { left:2px; }
+.ui-datepicker .ui-datepicker-next { right:2px; }
+.ui-datepicker .ui-datepicker-prev-hover { left:1px; }
+.ui-datepicker .ui-datepicker-next-hover { right:1px; }
+.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px;  }
+.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
+.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
+.ui-datepicker select.ui-datepicker-month-year {width: 100%;}
+.ui-datepicker select.ui-datepicker-month, 
+.ui-datepicker select.ui-datepicker-year { width: 49%;}
+.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
+.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0;  }
+.ui-datepicker td { border: 0; padding: 1px; }
+.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
+.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
+.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
+.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
+
+/* with multiple calendars */
+.ui-datepicker.ui-datepicker-multi { width:auto; }
+.ui-datepicker-multi .ui-datepicker-group { float:left; }
+.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
+.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
+.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
+.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
+.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
+.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
+.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
+.ui-datepicker-row-break { clear:both; width:100%; font-size:0em; }
+
+/* RTL support */
+.ui-datepicker-rtl { direction: rtl; }
+.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
+.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
+.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
+.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
+.ui-datepicker-rtl .ui-datepicker-group { float:right; }
+.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
+.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
+
+/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
+.ui-datepicker-cover {
+    display: none; /*sorry for IE5*/
+    display/**/: block; /*sorry for IE5*/
+    position: absolute; /*must have*/
+    z-index: -1; /*must have*/
+    filter: mask(); /*must have*/
+    top: -4px; /*must have*/
+    left: -4px; /*must have*/
+    width: 200px; /*must have*/
+    height: 200px; /*must have*/
+}/*
+ * jQuery UI Progressbar 1.8.16
+ *
+ * Copyright 2011, 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/Progressbar#theming
+ */
+.ui-progressbar { height:2em; text-align: left; }
+.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }
Index: trunk/prototype/api/templates/messagegrid.ejs
===================================================================
--- trunk/prototype/api/templates/messagegrid.ejs	(revision 5136)
+++ trunk/prototype/api/templates/messagegrid.ejs	(revision 5136)
@@ -0,0 +1,7 @@
+<table class="fuu" id="message_attacher_grid"><tr><td/></tr></table>
+<div id="message_attacher_grid_pager"></div>
+<div id="selected_messages_counter">
+	<span class="message-size-counter">
+		Foram selecionadas <strong id="selected_messages_number">0</strong> mensagens, totalizando <strong id="selected_messages_size"><span>0</span> Bytes</strong> de anexo.
+	<span>
+</div>
Index: trunk/prototype/api/templates/folderselect.ejs
===================================================================
--- trunk/prototype/api/templates/folderselect.ejs	(revision 5341)
+++ trunk/prototype/api/templates/folderselect.ejs	(revision 5341)
@@ -0,0 +1,58 @@
+<%
+	var specialFolders = {
+			Inbox: {name:'Caixa de Entrada', classe:'inbox'}, 
+			Trash: {name:'Lixeira', classe:'trash'}, 
+			Drafts:{name:'Rascunhos', classe:'drafts'}, 
+			Spam:  {name:'Spam', classe:'spam'}, 
+			Sent:  {name:'Enviados', classe:'sent'}
+		};
+
+	var deep = 0;
+	function recursive_forest(array_trees)
+	{
+		deep++;
+		var ident = '';
+		while (ident.length < deep) ident = '-' + ident;
+		ident = ident + ' ';
+			
+
+		for(var i=0; i<array_trees.length; i++)	{
+			folder_class = '';
+			folder_name = array_trees[i].commonName;
+
+			if( specialFolders[folder_name] ){
+				folder_class = specialFolders[folder_name].classe;
+				folder_name = specialFolders[folder_name].name;
+			}
+
+			%><option value="<%= array_trees[i].id %>" class="folder <%= folder_class %>" title="<%= folder_name %>"><%= ident + folder_name %></option>
+			<%
+
+			if (array_trees[i].children.length>0)
+			  recursive_forest(array_trees[i].children);
+
+		}
+ 
+		deep--;
+	}
+%>
+<select class="folderselect-component">
+  <optgroup label="Minhas Pastas">
+      <% deep = 0;
+         recursive_forest(folders[0]); %>
+  </optgroup>
+  <% if(folders[1].length > 0) { %>
+  <optgroup label="Pastas compartilhadas">
+	  <% deep = 0;
+         recursive_forest(folders[1]); %>
+  </optgroup>
+  <%}%>
+  <!--
+  <% if(preferences.use_local_messages == 1) { %>
+  <optgroup label="Pastas locais">
+	  <% deep = 0; 
+         recursive_forest(folders[2]); %>
+  </optgroup>
+  <%}%>
+  -->
+</select>
Index: trunk/prototype/api/templates/foldertree.ejs
===================================================================
--- trunk/prototype/api/templates/foldertree.ejs	(revision 5341)
+++ trunk/prototype/api/templates/foldertree.ejs	(revision 5341)
@@ -0,0 +1,51 @@
+<%
+	var specialFolders = {
+			INBOX: {name:'Caixa de Entrada', classe:'inbox'}, 
+			Inbox: {name:'Caixa de Entrada', classe:'inbox'}, 
+			Trash: {name:'Lixeira', classe:'trash'}, 
+			Drafts:{name:'Rascunhos', classe:'drafts'}, 
+			Spam:  {name:'Spam', classe:'spam'}, 
+			Sent:  {name:'Enviados', classe:'sent'}
+		};
+
+	function recursive_forest(array_trees)
+	{
+	  %><ul><%
+	
+	      for(var i=0; i<array_trees.length; i++)
+	      {
+		  folder_class = '';
+		  folder_name = array_trees[i].commonName;
+
+		  if( specialFolders[folder_name] ){
+		      folder_class = specialFolders[folder_name].classe;
+		      folder_name = specialFolders[folder_name].name;
+		  }
+
+		  %><li id="<%= array_trees[i].id %>" class="closed"><span class="folder <%= folder_class %>" title="<%= folder_name %>"><%= folder_name %></span>
+		  <%
+
+		  if (array_trees[i].children.length>0)
+			  recursive_forest(array_trees[i].children);
+
+		  %></li><%
+	      }
+ 
+	  %></ul><%
+	}
+%>
+<ul id="foldertree" class="filetree foldertree-skin-prognus">
+  <li><span class="folder">Minhas Pastas</span>
+      <% recursive_forest(data.folders[0]); %>
+  </li>
+  <% if(data.folders[1].length > 0) { %>
+  <li><span class="folder">Pastas compartilhadas</span>
+      <% recursive_forest(data.folders[1]); %>
+  </li> 
+  <%}%>
+  <% if(preferences.use_local_messages == 1) { %>
+  <li><span class="folder">Pastas locais</span>
+      <% recursive_forest(data.folders[2]); %>
+  </li>
+  <%}%>
+</ul>
Index: trunk/prototype/api/templates/list.ejs
===================================================================
--- trunk/prototype/api/templates/list.ejs	(revision 5136)
+++ trunk/prototype/api/templates/list.ejs	(revision 5136)
@@ -0,0 +1,20 @@
+<ul id="<%= id %>"><%
+
+  for(var i=0; i<list.length; i++)
+  {
+      if( typeof filter !== "undefined" )
+	  list[i] = filter( list[i] );
+
+      if( !list[i] )
+	    continue;
+
+      %><li id="<%= list[i].id %>" class="<%= list[i].class %>" title="<%= list[i].title%>"><%= list[i].content %>
+      <%
+
+      if (list[i].children && list[i].children.length>0)
+	      mount_list(array_trees[i].children);
+
+      %></li><%
+  }
+
+%></ul>'
Index: trunk/prototype/upload.php
===================================================================
--- trunk/prototype/upload.php	(revision 5341)
+++ trunk/prototype/upload.php	(revision 5399)
@@ -3,5 +3,5 @@
 $result = array();
 
-require_once 'app/controller.php';
+require_once 'api/controller.php';
 $URI = Controller::URI( 'attachment' );
 
Index: trunk/prototype/post.php
===================================================================
--- trunk/prototype/post.php	(revision 5341)
+++ trunk/prototype/post.php	(revision 5399)
@@ -5,5 +5,5 @@
 $data = $_REQUEST['data']; unset( $_REQUEST['data'] );
 
-require_once "app/controller.php";
+require_once "api/controller.php";
 
 echo json_encode( Controller::put( $_REQUEST, $data ) );
Index: trunk/prototype/converter.php
===================================================================
--- trunk/prototype/converter.php	(revision 5346)
+++ trunk/prototype/converter.php	(revision 5399)
@@ -1,5 +1,5 @@
 <?php
 
-require_once 'app/controller.php';
+require_once 'api/controller.php';
 
 $args = Controller::call( 'parse',
Index: trunk/prototype/request.php
===================================================================
--- trunk/prototype/request.php	(revision 5341)
+++ trunk/prototype/request.php	(revision 5399)
@@ -26,5 +26,5 @@
 $service = ( $criteria && isset( $criteria['service'] ) )? $criteria['service']: false;
 
-require_once 'app/controller.php';
+require_once 'api/controller.php';
 
 ///Conversor Para utf8 ante de codificar para json pois o json so funciona com utf8
Index: trunk/prototype/import.php
===================================================================
--- trunk/prototype/import.php	(revision 5341)
+++ 	(revision )
@@ -1,5 +1,0 @@
-<?php
-require_once 'app/controller.php';
-
-
-?>
Index: trunk/prototype/presentation.html
===================================================================
--- trunk/prototype/presentation.html	(revision 5341)
+++ 	(revision )
@@ -1,148 +1,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-	<title>Protótipo de tela: Seleção de mensagens para anexar</title>
-	<!--<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/themes/redmond/jquery-ui.css" type="text/css" media="screen" />-->
-
-	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js"></script>
-
-	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.js"></script>
-	<script src="app/plugins/jqgrid/js/i18n/grid.locale-pt-br.js" type="text/javascript"></script>
-	<link rel="stylesheet" href="app/plugins/jqgrid/themes/prognusone/jquery-ui-1.8.2.custom.css" type="text/css" />	
-
-	<script type="text/javascript" src="app/plugins/view/jquerymx-1.0.custom.min.js"></script>
-
-	<script type="text/javascript" src="app/plugins/treeview/jquery.treeview.js"></script>
-	<link rel="stylesheet" href="app/plugins/treeview/jquery.treeview.css" type="text/css" media="screen" />
-
-	<script src="app/plugins/jqgrid/js/jquery.jqGrid.min.js" type="text/javascript"></script>
-	<link rel="stylesheet" href="app/plugins/jqgrid/css/ui.jqgrid.css" type="text/css" />
-
-	<script src='app/plugins/fullcalendar/fullcalendar.min.js' type='text/javascript'></script>
-	<link rel="stylesheet" href="app/plugins/fullcalendar/fullcalendar.css" type="text/css" />
-
-	<script src="app/plugins/countdown/jquery.countdown.min.js" type="text/javascript"></script>
-	<script src="app/plugins/countdown/jquery.countdown-pt-BR.js" type="text/javascript"></script>
-
-	
-
-
-	<style>	body {margin:5px; padding:5px; font-family:Arial, sans-serif;} .foot-notes {width:875px;height:110px;padding:5px;text-align:left;}
-/* 	#feedback { font-size: 1.4em; } */
-	.error { color: red; font-weight: bold; }
-	.info   { color: green; font-weight: bold; }
-	#selectable .ui-selecting { background: #FECA40; }
-	#selectable .ui-selected { background: #F39814; color: white; }
-	#selectable { list-style-type: none; margin: 0; padding: 0; width: 60%; }
-	#dfds-panel{ padding:5px; width:2000px; height:100%; border: #ccc solid 1px; display: inline-block; }
-	.timable { font-size: 90%; }
-	
-/* 	#selectable li { margin: 3px; padding: 0.4em; font-size: 1.4em; height: 18px; } */
-	</style>
-
-</head>
-
-<body>
-
-<script type="text/javascript">
-
-    var MODULE_PATH = "modules";
-    var BASE_PATH = "";
-
-    $(document).ready(function(){
-    
-	$.getJSON( MODULE_PATH + "/", function(dirs){
-
-	      var ids = [];
-
-	      $.each(dirs, function(i, dir){
-
-		    switch( dir ){
-			case ".": case "..": case "index.php":
-			return( true );
-		    }
-
-		    ids[ ids.length ] = dir;
-
-		    $( '<div id="'+dir+'"></div>').appendTo( "#dfds-panel" );
-	      });
-
-	      $( '#' + ids.join(',#') ).dialog({
-		      width:920,
-		      height:550,
-		      resizable:false,
-		      modal: true,
-		      autoOpen:false
-	      })
-	      .each(function(i, el){
-		    var dfd = $(el).attr("id");
-		    $("<div>" + dfd + "</div>")
-		    .appendTo("#dfd-openers")
-		    .button()
-		    .click(function(event){
-
-			    $(".log").switchClass('error', 'info').html( "loading..." );
-			    $(el).html(MODULE_PATH+"/"+dfd+"/"+dfd+".ejs", {basePath: BASE_PATH})/*.hide()*/;
-
-			    $.getScript(MODULE_PATH+"/"+dfd+"/"+dfd+".js", function(){
-
-				$(".log").html( "" );
-				$(el).dialog( "open" );
-			    });
-		    });
-		});
-	  });
-
-	  $(".log").ajaxError(function(e, jqxhr, settings, exception) {
-		if( settings.dataType == 'script' ) {
-// 		    alert( dump( exception ) );
-		    $(this).switchClass('info', 'error').html( exception.message + " on line " + exception.lineNumber );
-		}
-	    });
-    });
-
-</script>
-<div id="dfd-openers">
-</div>
-<div class="foot-notes">
-	<span class="foot-note">*<small>Os protótipos de tela apresentados limitam-se a mera apresentação da estrutura e disposição dos elementos na tela,
-	não devendo servir, portanto, para definição de características específicas do layout como ícones, cores e efeitos de eventos disparados.
-	A presença dos ícones nestes protótipos não pressupõe a autorização de uso no Expresso Livre. </small></span>
-<div id="dfds-panel">
-</div>
-<div class="clear"></div>
-<!-- 	<br/><br/><br/><br/><br/><br/><br/> -->
-
-
-</div>
-<!-- <div class="log info"></div> -->
-<script>
-      function dump(arr,level) {
-	      var dumped_text = "";
-	      if(!level) level = 0;
-
-	      //The padding given at the beginning of the line.
-	      var level_padding = "";
-	      for(var j=0;j<level+1;j++) level_padding += "    ";
-
-	      if(typeof(arr) == 'object') { //Array/Hashes/Objects
-		      for(var item in arr) {
-			      var value = arr[item];
-
-			      if(typeof(value) == 'object') { //If it is an array,
-				      dumped_text += level_padding + "'" + item + "' ...\n";
-				      dumped_text += dump(value,level+1);
-			      } else {
-				      dumped_text += level_padding + "'" + item + "' => \"" + value + "\"\n";
-			      }
-		      }
-	      } else { //Stings/Chars/Numbers etc.
-		      dumped_text = "===>"+arr+"<===("+typeof(arr)+")";
-	      }
-	      return dumped_text;
-      }
-</script>
-
-</body>
-</html>
