jQuery.ui||(function(C){var I=C.fn.remove,D=C.browser.mozilla&&(parseFloat(C.browser.version)<1.9);C.ui={version:"1.7.1",plugin:{add:function(K,L,N){var M=C.ui[K].prototype;for(var J in N){M.plugins[J]=M.plugins[J]||[];M.plugins[J].push([L,N[J]])}},call:function(J,L,K){var N=J.plugins[L];if(!N||!J.element[0].parentNode){return }for(var M=0;M<N.length;M++){if(J.options[N[M][0]]){N[M][1].apply(J.element,K)}}}},contains:function(K,J){return document.compareDocumentPosition?K.compareDocumentPosition(J)&16:K!==J&&K.contains(J)},hasScroll:function(M,K){if(C(M).css("overflow")=="hidden"){return false}var J=(K&&K=="left")?"scrollLeft":"scrollTop",L=false;if(M[J]>0){return true}M[J]=1;L=(M[J]>0);M[J]=0;return L},isOverAxis:function(K,J,L){return(K>J)&&(K<(J+L))},isOver:function(O,K,N,M,J,L){return C.ui.isOverAxis(O,N,J)&&C.ui.isOverAxis(K,M,L)},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,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}};if(D){var F=C.attr,E=C.fn.removeAttr,H="http://www.w3.org/2005/07/aaa",A=/^aria-/,B=/^wairole:/;C.attr=function(K,J,L){var M=L!==undefined;return(J=="role"?(M?F.call(this,K,J,"wairole:"+L):(F.apply(this,arguments)||"").replace(B,"")):(A.test(J)?(M?K.setAttributeNS(H,J.replace(A,"aaa:"),L):F.call(this,K,J.replace(A,"aaa:"))):F.apply(this,arguments)))};C.fn.removeAttr=function(J){return(A.test(J)?this.each(function(){this.removeAttributeNS(H,J.replace(A,""))}):E.call(this,J))}}C.fn.extend({remove:function(){C("*",this).add(this).each(function(){C(this).triggerHandler("remove")});return I.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})},scrollParent:function(){var J;if((C.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){J=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)}else{J=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"))||!J.length?C(document):J}});C.extend(C.expr[":"],{data:function(L,K,J){return !!C.data(L,J[3])},focusable:function(K){var L=K.nodeName.toLowerCase(),J=C.attr(K,"tabindex");return(/input|select|textarea|button|object/.test(L)?!K.disabled:"a"==L||"area"==L?K.href||!isNaN(J):!isNaN(J))&&!C(K)["area"==L?"parents":"closest"](":hidden").length},tabbable:function(K){var J=C.attr(K,"tabindex");return(isNaN(J)||J>=0)&&C(K).is(":focusable")}});function G(M,N,O,L){function K(Q){var P=C[M][N][Q]||[];return(typeof P=="string"?P.split(/,?\s+/):P)}var J=K("getter");if(L.length==1&&typeof L[0]=="string"){J=J.concat(K("getterSetter"))}return(C.inArray(O,J)!=-1)}C.widget=function(K,J){var L=K.split(".")[0];K=K.split(".")[1];C.fn[K]=function(P){var N=(typeof P=="string"),O=Array.prototype.slice.call(arguments,1);if(N&&P.substring(0,1)=="_"){return this}if(N&&G(L,K,P,O)){var M=C.data(this[0],K);return(M?M[P].apply(M,O):undefined)}return this.each(function(){var Q=C.data(this,K);(!Q&&!N&&C.data(this,K,new C[L][K](this,P))._init());(Q&&N&&C.isFunction(Q[P])&&Q[P].apply(Q,O))})};C[L]=C[L]||{};C[L][K]=function(O,N){var M=this;this.namespace=L;this.widgetName=K;this.widgetEventPrefix=C[L][K].eventPrefix||K;this.widgetBaseClass=L+"-"+K;this.options=C.extend({},C.widget.defaults,C[L][K].defaults,C.metadata&&C.metadata.get(O)[K],N);this.element=C(O).bind("setData."+K,function(Q,P,R){if(Q.target==O){return M._setData(P,R)}}).bind("getData."+K,function(Q,P){if(Q.target==O){return M._getData(P)}}).bind("remove",function(){return M.destroy()})};C[L][K].prototype=C.extend({},C.widget.prototype,J);C[L][K].getterSetter="option"};C.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").removeAttr("aria-disabled")},option:function(L,M){var K=L,J=this;if(typeof L=="string"){if(M===undefined){return this._getData(L)}K={};K[L]=M}C.each(K,function(N,O){J._setData(N,O)})},_getData:function(J){return this.options[J]},_setData:function(J,K){this.options[J]=K;if(J=="disabled"){this.element[K?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",K)}},enable:function(){this._setData("disabled",false)},disable:function(){this._setData("disabled",true)},_trigger:function(L,M,N){var P=this.options[L],J=(L==this.widgetEventPrefix?L:this.widgetEventPrefix+L);M=C.Event(M);M.type=J;if(M.originalEvent){for(var K=C.event.props.length,O;K;){O=C.event.props[--K];M[O]=M.originalEvent[O]}}this.element.trigger(M,N);return !(C.isFunction(P)&&P.call(this.element[0],M,N)===false||M.isDefaultPrevented())}};C.widget.defaults={disabled:false};C.ui.mouse={_mouseInit:function(){var J=this;this.element.bind("mousedown."+this.widgetName,function(K){return J._mouseDown(K)}).bind("click."+this.widgetName,function(K){if(J._preventClickEvent){J._preventClickEvent=false;K.stopImmediatePropagation();return false}});if(C.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);(C.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},_mouseDown:function(L){L.originalEvent=L.originalEvent||{};if(L.originalEvent.mouseHandled){return }(this._mouseStarted&&this._mouseUp(L));this._mouseDownEvent=L;var K=this,M=(L.which==1),J=(typeof this.options.cancel=="string"?C(L.target).parents().add(L.target).filter(this.options.cancel).length:false);if(!M||J||!this._mouseCapture(L)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){K.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(L)&&this._mouseDelayMet(L)){this._mouseStarted=(this._mouseStart(L)!==false);if(!this._mouseStarted){L.preventDefault();return true}}this._mouseMoveDelegate=function(N){return K._mouseMove(N)};this._mouseUpDelegate=function(N){return K._mouseUp(N)};C(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);(C.browser.safari||L.preventDefault());L.originalEvent.mouseHandled=true;return true},_mouseMove:function(J){if(C.browser.msie&&!J.button){return this._mouseUp(J)}if(this._mouseStarted){this._mouseDrag(J);return J.preventDefault()}if(this._mouseDistanceMet(J)&&this._mouseDelayMet(J)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,J)!==false);(this._mouseStarted?this._mouseDrag(J):this._mouseUp(J))}return !this._mouseStarted},_mouseUp:function(J){C(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=(J.target==this._mouseDownEvent.target);this._mouseStop(J)}return false},_mouseDistanceMet:function(J){return(Math.max(Math.abs(this._mouseDownEvent.pageX-J.pageX),Math.abs(this._mouseDownEvent.pageY-J.pageY))>=this.options.distance)},_mouseDelayMet:function(J){return this.mouseDelayMet},_mouseStart:function(J){},_mouseDrag:function(J){},_mouseStop:function(J){},_mouseCapture:function(J){return true}};C.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery);(function(C){C.widget("ui.resizable",C.extend({},C.ui.mouse,{_init:function(){var E=this,I=this.options;this.element.addClass("ui-resizable");C.extend(this,{_aspectRatio:!!(I.aspectRatio),aspectRatio:I.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:I.helper||I.ghost||I.animate?I.helper||"ui-resizable-helper":null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){if(/relative/.test(this.element.css("position"))&&C.browser.opera){this.element.css({position:"relative",top:"auto",left:"auto"})}this.element.wrap(C("<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=I.handles||(!C(".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 J=this.handles.split(",");this.handles={};for(var F=0;F<J.length;F++){var H=C.trim(J[F]),D="ui-resizable-"+H;var G=C("<div class=\"ui-resizable-handle "+D+"\"></div>");if(/sw|se|ne|nw/.test(H)){G.css({zIndex:++I.zIndex})}if("se"==H){G.addClass("ui-icon ui-icon-gripsmall-diagonal-se")}this.handles[H]=".ui-resizable-"+H;this.element.append(G)}}this._renderAxis=function(O){O=O||this.element;for(var L in this.handles){if(this.handles[L].constructor==String){this.handles[L]=C(this.handles[L],this.element).show()}if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var M=C(this.handles[L],this.element),N=0;N=/sw|ne|nw|se|n|s/.test(L)?M.outerHeight():M.outerWidth();var K=["padding",/ne|nw|n/.test(L)?"Top":/se|sw|s/.test(L)?"Bottom":/^e$/.test(L)?"Right":"Left"].join("");O.css(K,N);this._proportionallyResize()}if(!C(this.handles[L]).length){continue}}};this._renderAxis(this.element);this._handles=C(".ui-resizable-handle",this.element).disableSelection();this._handles.mouseover(function(){if(!E.resizing){if(this.className){var K=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)}E.axis=K&&K[1]?K[1]:"se"}});if(I.autoHide){this._handles.hide();C(this.element).addClass("ui-resizable-autohide").hover(function(){C(this).removeClass("ui-resizable-autohide");E._handles.show()},function(){if(!E.resizing){C(this).addClass("ui-resizable-autohide");E._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy();var D=function(F){C(F).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){D(this.element);var E=this.element;E.parent().append(this.originalElement.css({position:E.css("position"),width:E.outerWidth(),height:E.outerHeight(),top:E.css("top"),left:E.css("left")})).end().remove()}this.originalElement.css("resize",this.originalResizeStyle);D(this.originalElement)},_mouseCapture:function(E){var F=false;for(var D in this.handles){if(C(this.handles[D])[0]==E.target){F=true}}return this.options.disabled||!!F},_mouseStart:function(F){var I=this.options,E=this.element.position(),D=this.element;this.resizing=true;this.documentScroll={top:C(document).scrollTop(),left:C(document).scrollLeft()};if(D.is(".ui-draggable")||(/absolute/).test(D.css("position"))){D.css({position:"absolute",top:E.top,left:E.left})}if(C.browser.opera&&(/relative/).test(D.css("position"))){D.css({position:"relative",top:"auto",left:"auto"})}this._renderProxy();var J=B(this.helper.css("left")),G=B(this.helper.css("top"));if(I.containment){J+=C(I.containment).scrollLeft()||0;G+=C(I.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:J,top:G};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:J,top:G};this.sizeDiff={width:D.outerWidth()-D.width(),height:D.outerHeight()-D.height()};this.originalMousePosition={left:F.pageX,top:F.pageY};this.aspectRatio=(typeof I.aspectRatio=="number")?I.aspectRatio:((this.originalSize.width/this.originalSize.height)||1);var H=C(".ui-resizable-"+this.axis).css("cursor");C("body").css("cursor",H=="auto"?this.axis+"-resize":H);D.addClass("ui-resizable-resizing");this._propagate("start",F);return true},_mouseDrag:function(D){var G=this.helper,F=this.options,L={},O=this,I=this.originalMousePosition,M=this.axis;var P=(D.pageX-I.left)||0,N=(D.pageY-I.top)||0;var H=this._change[M];if(!H){return false}var K=H.apply(this,[D,P,N]),J=C.browser.msie&&C.browser.version<7,E=this.sizeDiff;if(this._aspectRatio||D.shiftKey){K=this._updateRatio(K,D)}K=this._respectSize(K,D);this._propagate("resize",D);G.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});if(!this._helper&&this._proportionallyResizeElements.length){this._proportionallyResize()}this._updateCache(K);this._trigger("resize",D,this.ui());return false},_mouseStop:function(G){this.resizing=false;var H=this.options,L=this;if(this._helper){var F=this._proportionallyResizeElements,D=F.length&&(/textarea/i).test(F[0].nodeName),E=D&&C.ui.hasScroll(F[0],"left")?0:L.sizeDiff.height,J=D?0:L.sizeDiff.width;var M={width:(L.size.width-J),height:(L.size.height-E)},I=(parseInt(L.element.css("left"),10)+(L.position.left-L.originalPosition.left))||null,K=(parseInt(L.element.css("top"),10)+(L.position.top-L.originalPosition.top))||null;if(!H.animate){this.element.css(C.extend(M,{top:K,left:I}))}L.helper.height(L.size.height);L.helper.width(L.size.width);if(this._helper&&!H.animate){this._proportionallyResize()}}C("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop",G);if(this._helper){this.helper.remove()}return false},_updateCache:function(D){var E=this.options;this.offset=this.helper.offset();if(A(D.left)){this.position.left=D.left}if(A(D.top)){this.position.top=D.top}if(A(D.height)){this.size.height=D.height}if(A(D.width)){this.size.width=D.width}},_updateRatio:function(G,F){var H=this.options,I=this.position,E=this.size,D=this.axis;if(G.height){G.width=(E.height*this.aspectRatio)}else{if(G.width){G.height=(E.width/this.aspectRatio)}}if(D=="sw"){G.left=I.left+(E.width-G.width);G.top=null}if(D=="nw"){G.top=I.top+(E.height-G.height);G.left=I.left+(E.width-G.width)}return G},_respectSize:function(K,F){var I=this.helper,H=this.options,P=this._aspectRatio||F.shiftKey,O=this.axis,R=A(K.width)&&H.maxWidth&&(H.maxWidth<K.width),L=A(K.height)&&H.maxHeight&&(H.maxHeight<K.height),G=A(K.width)&&H.minWidth&&(H.minWidth>K.width),Q=A(K.height)&&H.minHeight&&(H.minHeight>K.height);if(G){K.width=H.minWidth}if(Q){K.height=H.minHeight}if(R){K.width=H.maxWidth}if(L){K.height=H.maxHeight}var E=this.originalPosition.left+this.originalSize.width,N=this.position.top+this.size.height;var J=/sw|nw|w/.test(O),D=/nw|ne|n/.test(O);if(G&&J){K.left=E-H.minWidth}if(R&&J){K.left=E-H.maxWidth}if(Q&&D){K.top=N-H.minHeight}if(L&&D){K.top=N-H.maxHeight}var M=!K.width&&!K.height;if(M&&!K.left&&K.top){K.top=null}else{if(M&&!K.top&&K.left){K.left=null}}return K},_proportionallyResize:function(){var I=this.options;if(!this._proportionallyResizeElements.length){return }var F=this.helper||this.element;for(var E=0;E<this._proportionallyResizeElements.length;E++){var G=this._proportionallyResizeElements[E];if(!this.borderDif){var D=[G.css("borderTopWidth"),G.css("borderRightWidth"),G.css("borderBottomWidth"),G.css("borderLeftWidth")],H=[G.css("paddingTop"),G.css("paddingRight"),G.css("paddingBottom"),G.css("paddingLeft")];this.borderDif=C.map(D,function(J,L){var K=parseInt(J,10)||0,M=parseInt(H[L],10)||0;return K+M})}if(C.browser.msie&&!(!(C(F).is(":hidden")||C(F).parents(":hidden").length))){continue}G.css({height:(F.height()-this.borderDif[0]-this.borderDif[2])||0,width:(F.width()-this.borderDif[1]-this.borderDif[3])||0})}},_renderProxy:function(){var E=this.element,H=this.options;this.elementOffset=E.offset();if(this._helper){this.helper=this.helper||C("<div style=\"overflow:hidden;\"></div>");var D=C.browser.msie&&C.browser.version<7,F=(D?1:0),G=(D?2:-1);this.helper.addClass(this._helper).css({width:this.element.outerWidth()+G,height:this.element.outerHeight()+G,position:"absolute",left:this.elementOffset.left-F+"px",top:this.elementOffset.top-F+"px",zIndex:++H.zIndex});this.helper.appendTo("body").disableSelection()}else{this.helper=this.element}},_change:{e:function(F,E,D){return{width:this.originalSize.width+E}},w:function(G,E,D){var I=this.options,F=this.originalSize,H=this.originalPosition;return{left:H.left+E,width:F.width-E}},n:function(G,E,D){var I=this.options,F=this.originalSize,H=this.originalPosition;return{top:H.top+D,height:F.height-D}},s:function(F,E,D){return{height:this.originalSize.height+D}},se:function(F,E,D){return C.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[F,E,D]))},sw:function(F,E,D){return C.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[F,E,D]))},ne:function(F,E,D){return C.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[F,E,D]))},nw:function(F,E,D){return C.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[F,E,D]))}},_propagate:function(E,D){C.ui.plugin.call(this,E,[D,this.ui()]);(E!="resize"&&this._trigger(E,D,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}}}));C.extend(C.ui.resizable,{version:"1.7.1",eventPrefix:"resize",defaults:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,cancel:":input,option",containment:false,delay:0,distance:1,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1000}});C.ui.plugin.add("resizable","alsoResize",{start:function(E,F){var D=C(this).data("resizable"),G=D.options;_store=function(H){C(H).each(function(){C(this).data("resizable-alsoresize",{width:parseInt(C(this).width(),10),height:parseInt(C(this).height(),10),left:parseInt(C(this).css("left"),10),top:parseInt(C(this).css("top"),10)})})};if(typeof (G.alsoResize)=="object"&&!G.alsoResize.parentNode){if(G.alsoResize.length){G.alsoResize=G.alsoResize[0];_store(G.alsoResize)}else{C.each(G.alsoResize,function(H,I){_store(H)})}}else{_store(G.alsoResize)}},resize:function(F,H){var E=C(this).data("resizable"),I=E.options,G=E.originalSize,K=E.originalPosition;var J={height:(E.size.height-G.height)||0,width:(E.size.width-G.width)||0,top:(E.position.top-K.top)||0,left:(E.position.left-K.left)||0},D=function(L,M){C(L).each(function(){var P=C(this),Q=C(this).data("resizable-alsoresize"),O={},N=M&&M.length?M:["width","height","top","left"];C.each(N||["width","height","top","left"],function(R,T){var S=(Q[T]||0)+(J[T]||0);if(S&&S>=0){O[T]=S||null}});if(/relative/.test(P.css("position"))&&C.browser.opera){E._revertToRelativePosition=true;P.css({position:"absolute",top:"auto",left:"auto"})}P.css(O)})};if(typeof (I.alsoResize)=="object"&&!I.alsoResize.nodeType){C.each(I.alsoResize,function(L,M){D(L,M)})}else{D(I.alsoResize)}},stop:function(E,F){var D=C(this).data("resizable");if(D._revertToRelativePosition&&C.browser.opera){D._revertToRelativePosition=false;el.css({position:"relative"})}C(this).removeData("resizable-alsoresize-start")}});C.ui.plugin.add("resizable","animate",{stop:function(H,M){var N=C(this).data("resizable"),I=N.options;var G=N._proportionallyResizeElements,D=G.length&&(/textarea/i).test(G[0].nodeName),E=D&&C.ui.hasScroll(G[0],"left")?0:N.sizeDiff.height,K=D?0:N.sizeDiff.width;var F={width:(N.size.width-K),height:(N.size.height-E)},J=(parseInt(N.element.css("left"),10)+(N.position.left-N.originalPosition.left))||null,L=(parseInt(N.element.css("top"),10)+(N.position.top-N.originalPosition.top))||null;N.element.animate(C.extend(F,L&&J?{top:L,left:J}:{}),{duration:I.animateDuration,easing:I.animateEasing,step:function(){var O={width:parseInt(N.element.css("width"),10),height:parseInt(N.element.css("height"),10),top:parseInt(N.element.css("top"),10),left:parseInt(N.element.css("left"),10)};if(G&&G.length){C(G[0]).css({width:O.width,height:O.height})}N._updateCache(O);N._propagate("resize",H)}})}});C.ui.plugin.add("resizable","containment",{start:function(E,O){var Q=C(this).data("resizable"),I=Q.options,K=Q.element;var F=I.containment,J=(F instanceof C)?F.get(0):(/parent/.test(F))?K.parent().get(0):F;if(!J){return }Q.containerElement=C(J);if(/document/.test(F)||F==document){Q.containerOffset={left:0,top:0};Q.containerPosition={left:0,top:0};Q.parentData={element:C(document),left:0,top:0,width:C(document).width(),height:C(document).height()||document.body.parentNode.scrollHeight}}else{var M=C(J),H=[];C(["Top","Right","Left","Bottom"]).each(function(S,R){H[S]=B(M.css("padding"+R))});Q.containerOffset=M.offset();Q.containerPosition=M.position();Q.containerSize={height:(M.innerHeight()-H[3]),width:(M.innerWidth()-H[1])};var N=Q.containerOffset,D=Q.containerSize.height,L=Q.containerSize.width,G=(C.ui.hasScroll(J,"left")?J.scrollWidth:L),P=(C.ui.hasScroll(J)?J.scrollHeight:D);Q.parentData={element:J,left:N.left,top:N.top,width:G,height:P}}},resize:function(F,O){var R=C(this).data("resizable"),H=R.options,E=R.containerSize,N=R.containerOffset,L=R.size,M=R.position,P=R._aspectRatio||F.shiftKey,D={top:0,left:0},G=R.containerElement;if(G[0]!=document&&(/static/).test(G.css("position"))){D=N}if(M.left<(R._helper?N.left:0)){R.size.width=R.size.width+(R._helper?(R.position.left-N.left):(R.position.left-D.left));if(P){R.size.height=R.size.width/H.aspectRatio}R.position.left=H.helper?N.left:0}if(M.top<(R._helper?N.top:0)){R.size.height=R.size.height+(R._helper?(R.position.top-N.top):R.position.top);if(P){R.size.width=R.size.height*H.aspectRatio}R.position.top=R._helper?N.top:0}R.offset.left=R.parentData.left+R.position.left;R.offset.top=R.parentData.top+R.position.top;var K=Math.abs((R._helper?R.offset.left-D.left:(R.offset.left-D.left))+R.sizeDiff.width),Q=Math.abs((R._helper?R.offset.top-D.top:(R.offset.top-N.top))+R.sizeDiff.height);var J=R.containerElement.get(0)==R.element.parent().get(0),I=/relative|absolute/.test(R.containerElement.css("position"));if(J&&I){K-=R.parentData.left}if(K+R.size.width>=R.parentData.width){R.size.width=R.parentData.width-K;if(P){R.size.height=R.size.width/R.aspectRatio}}if(Q+R.size.height>=R.parentData.height){R.size.height=R.parentData.height-Q;if(P){R.size.width=R.size.height*R.aspectRatio}}},stop:function(E,L){var N=C(this).data("resizable"),F=N.options,J=N.position,K=N.containerOffset,D=N.containerPosition,G=N.containerElement;var H=C(N.helper),O=H.offset(),M=H.outerWidth()-N.sizeDiff.width,I=H.outerHeight()-N.sizeDiff.height;if(N._helper&&!F.animate&&(/relative/).test(G.css("position"))){C(this).css({left:O.left-D.left-K.left,width:M,height:I})}if(N._helper&&!F.animate&&(/static/).test(G.css("position"))){C(this).css({left:O.left-D.left-K.left,width:M,height:I})}}});C.ui.plugin.add("resizable","ghost",{start:function(F,G){var D=C(this).data("resizable"),H=D.options,E=D.size;D.ghost=D.originalElement.clone();D.ghost.css({opacity:0.25,display:"block",position:"relative",height:E.height,width:E.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof H.ghost=="string"?H.ghost:"");D.ghost.appendTo(D.helper)},resize:function(E,F){var D=C(this).data("resizable"),G=D.options;if(D.ghost){D.ghost.css({position:"relative",height:D.size.height,width:D.size.width})}},stop:function(E,F){var D=C(this).data("resizable"),G=D.options;if(D.ghost&&D.helper){D.helper.get(0).removeChild(D.ghost.get(0))}}});C.ui.plugin.add("resizable","grid",{resize:function(D,L){var N=C(this).data("resizable"),G=N.options,J=N.size,H=N.originalSize,I=N.originalPosition,M=N.axis,K=G._aspectRatio||D.shiftKey;G.grid=typeof G.grid=="number"?[G.grid,G.grid]:G.grid;var F=Math.round((J.width-H.width)/(G.grid[0]||1))*(G.grid[0]||1),E=Math.round((J.height-H.height)/(G.grid[1]||1))*(G.grid[1]||1);if(/^(se|s|e)$/.test(M)){N.size.width=H.width+F;N.size.height=H.height+E}else{if(/^(ne)$/.test(M)){N.size.width=H.width+F;N.size.height=H.height+E;N.position.top=I.top-E}else{if(/^(sw)$/.test(M)){N.size.width=H.width+F;N.size.height=H.height+E;N.position.left=I.left-F}else{N.size.width=H.width+F;N.size.height=H.height+E;N.position.top=I.top-E;N.position.left=I.left-F}}}}});var B=function(D){return parseInt(D,10)||0};var A=function(D){return !isNaN(parseInt(D,10))}})(jQuery);(function(C){var B={dragStart:"start.draggable",drag:"drag.draggable",dragStop:"stop.draggable",maxHeight:"maxHeight.resizable",minHeight:"minHeight.resizable",maxWidth:"maxWidth.resizable",minWidth:"minWidth.resizable",resizeStart:"start.resizable",resize:"drag.resizable",resizeStop:"stop.resizable"},A="ui-dialog ui-widget ui-widget-content ui-corner-all ";C.widget("ui.dialog",{_init:function(){this.originalTitle=this.element.attr("title");var L=this,M=this.options,J=M.title||this.originalTitle||"&nbsp;",E=C.ui.dialog.getTitleId(this.element),K=(this.uiDialog=C("<div/>")).appendTo(document.body).hide().addClass(A+M.dialogClass).css({position:"absolute",overflow:"hidden",zIndex:M.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(N){(M.closeOnEscape&&N.keyCode&&N.keyCode==C.ui.keyCode.ESCAPE&&L.close(N))}).attr({role:"dialog","aria-labelledby":E}).mousedown(function(N){L.moveToTop(false,N)}),G=this.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(K),F=(this.uiDialogTitlebar=C("<div></div>")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(K),I=C("<a href=\"#\"/>").addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){I.addClass("ui-state-hover")},function(){I.removeClass("ui-state-hover")}).focus(function(){I.addClass("ui-state-focus")}).blur(function(){I.removeClass("ui-state-focus")}).mousedown(function(N){N.stopPropagation()}).click(function(N){L.close(N);return false}).appendTo(F),H=(this.uiDialogTitlebarCloseText=C("<span/>")).addClass("ui-icon ui-icon-closethick").text(M.closeText).appendTo(I),D=C("<span/>").addClass("ui-dialog-title").attr("id",E).html(J).prependTo(F);F.find("*").add(F).disableSelection();(M.draggable&&C.fn.draggable&&this._makeDraggable());(M.resizable&&C.fn.resizable&&this._makeResizable());this._createButtons(M.buttons);this._isOpen=false;(M.bgiframe&&C.fn.bgiframe&&K.bgiframe());(M.autoOpen&&this.open())},destroy:function(){(this.overlay&&this.overlay.destroy());this.uiDialog.hide();this.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body");this.uiDialog.remove();(this.originalTitle&&this.element.attr("title",this.originalTitle))},close:function(E){var D=this;if(false===D._trigger("beforeclose",E)){return }(D.overlay&&D.overlay.destroy());D.uiDialog.unbind("keypress.ui-dialog");(D.options.hide?D.uiDialog.hide(D.options.hide,function(){D._trigger("close",E)}):D.uiDialog.hide()&&D._trigger("close",E));C.ui.dialog.overlay.resize();D._isOpen=false},isOpen:function(){return this._isOpen},moveToTop:function(F,E){if((this.options.modal&&!F)||(!this.options.stack&&!this.options.modal)){return this._trigger("focus",E)}if(this.options.zIndex>C.ui.dialog.maxZ){C.ui.dialog.maxZ=this.options.zIndex}(this.overlay&&this.overlay.$el.css("z-index",C.ui.dialog.overlay.maxZ=++C.ui.dialog.maxZ));var D={scrollTop:this.element.attr("scrollTop"),scrollLeft:this.element.attr("scrollLeft")};this.uiDialog.css("z-index",++C.ui.dialog.maxZ);this.element.attr(D);this._trigger("focus",E)},open:function(){if(this._isOpen){return }var E=this.options,D=this.uiDialog;this.overlay=E.modal?new C.ui.dialog.overlay(this):null;(D.next().length&&D.appendTo("body"));this._size();this._position(E.position);D.show(E.show);this.moveToTop(true);(E.modal&&D.bind("keypress.ui-dialog",function(H){if(H.keyCode!=C.ui.keyCode.TAB){return }var G=C(":tabbable",this),I=G.filter(":first")[0],F=G.filter(":last")[0];if(H.target==F&&!H.shiftKey){setTimeout(function(){I.focus()},1)}else{if(H.target==I&&H.shiftKey){setTimeout(function(){F.focus()},1)}}}));C([]).add(D.find(".ui-dialog-content :tabbable:first")).add(D.find(".ui-dialog-buttonpane :tabbable:first")).add(D).filter(":first").focus();this._trigger("open");this._isOpen=true},_createButtons:function(G){var F=this,D=false,E=C("<div></div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix");this.uiDialog.find(".ui-dialog-buttonpane").remove();(typeof G=="object"&&G!==null&&C.each(G,function(){return !(D=true)}));if(D){C.each(G,function(H,I){C("<button type=\"button\"></button>").addClass("ui-state-default ui-corner-all").text(H).click(function(){I.apply(F.element[0],arguments)}).hover(function(){C(this).addClass("ui-state-hover")},function(){C(this).removeClass("ui-state-hover")}).focus(function(){C(this).addClass("ui-state-focus")}).blur(function(){C(this).removeClass("ui-state-focus")}).appendTo(E)});E.appendTo(this.uiDialog)}},_makeDraggable:function(){var D=this,F=this.options,E;this.uiDialog.draggable({cancel:".ui-dialog-content",handle:".ui-dialog-titlebar",containment:"document",start:function(){E=F.height;C(this).height(C(this).height()).addClass("ui-dialog-dragging");(F.dragStart&&F.dragStart.apply(D.element[0],arguments))},drag:function(){(F.drag&&F.drag.apply(D.element[0],arguments))},stop:function(){C(this).removeClass("ui-dialog-dragging").height(E);(F.dragStop&&F.dragStop.apply(D.element[0],arguments));C.ui.dialog.overlay.resize()}})},_makeResizable:function(G){G=(G===undefined?this.options.resizable:G);var D=this,F=this.options,E=typeof G=="string"?G:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",alsoResize:this.element,maxWidth:F.maxWidth,maxHeight:F.maxHeight,minWidth:F.minWidth,minHeight:F.minHeight,start:function(){C(this).addClass("ui-dialog-resizing");(F.resizeStart&&F.resizeStart.apply(D.element[0],arguments))},resize:function(){(F.resize&&F.resize.apply(D.element[0],arguments))},handles:E,stop:function(){C(this).removeClass("ui-dialog-resizing");F.height=C(this).height();F.width=C(this).width();(F.resizeStop&&F.resizeStop.apply(D.element[0],arguments));C.ui.dialog.overlay.resize()}}).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_position:function(I){var E=C(window),F=C(document),G=F.scrollTop(),D=F.scrollLeft(),H=G;if(C.inArray(I,["center","top","right","bottom","left"])>=0){I=[I=="right"||I=="left"?I:"center",I=="top"||I=="bottom"?I:"middle"]}if(I.constructor!=Array){I=["center","middle"]}if(I[0].constructor==Number){D+=I[0]}else{switch(I[0]){case"left":D+=0;break;case"right":D+=E.width()-this.uiDialog.outerWidth();break;default:case"center":D+=(E.width()-this.uiDialog.outerWidth())/2}}if(I[1].constructor==Number){G+=I[1]}else{switch(I[1]){case"top":G+=0;break;case"bottom":G+=E.height()-this.uiDialog.outerHeight();break;default:case"middle":G+=(E.height()-this.uiDialog.outerHeight())/2}}G=Math.max(G,H);this.uiDialog.css({top:G,left:D})},_setData:function(E,F){(B[E]&&this.uiDialog.data(B[E],F));switch(E){case"buttons":this._createButtons(F);break;case"closeText":this.uiDialogTitlebarCloseText.text(F);break;case"dialogClass":this.uiDialog.removeClass(this.options.dialogClass).addClass(A+F);break;case"draggable":(F?this._makeDraggable():this.uiDialog.draggable("destroy"));break;case"height":this.uiDialog.height(F);break;case"position":this._position(F);break;case"resizable":var D=this.uiDialog,G=this.uiDialog.is(":data(resizable)");(G&&!F&&D.resizable("destroy"));(G&&typeof F=="string"&&D.resizable("option","handles",F));(G||this._makeResizable(F));break;case"title":C(".ui-dialog-title",this.uiDialogTitlebar).html(F||"&nbsp;");break;case"width":this.uiDialog.width(F);break}C.widget.prototype._setData.apply(this,arguments)},_size:function(){var E=this.options;this.element.css({height:0,minHeight:0,width:"auto"});var D=this.uiDialog.css({height:"auto",width:E.width}).height();this.element.css({minHeight:Math.max(E.minHeight-D,0),height:E.height=="auto"?"auto":Math.max(E.height-D,0)})}});C.extend(C.ui.dialog,{version:"1.7.1",defaults:{autoOpen:true,bgiframe:false,buttons:{},closeOnEscape:true,closeText:"close",dialogClass:"",draggable:true,hide:null,height:"auto",maxHeight:false,maxWidth:false,minHeight:150,minWidth:150,modal:false,position:"center",resizable:true,show:null,stack:true,title:"",width:300,zIndex:1000},getter:"isOpen",uuid:0,maxZ:0,getTitleId:function(D){return"ui-dialog-title-"+(D.attr("id")||++this.uuid)},overlay:function(D){this.$el=C.ui.dialog.overlay.create(D)}});C.extend(C.ui.dialog.overlay,{instances:[],maxZ:0,events:C.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(D){return D+".dialog-overlay"}).join(" "),create:function(E){if(this.instances.length===0){setTimeout(function(){C(document).bind(C.ui.dialog.overlay.events,function(F){var G=C(F.target).parents(".ui-dialog").css("zIndex")||0;return(G>C.ui.dialog.overlay.maxZ)})},1);C(document).bind("keydown.dialog-overlay",function(F){(E.options.closeOnEscape&&F.keyCode&&F.keyCode==C.ui.keyCode.ESCAPE&&E.close(F))});C(window).bind("resize.dialog-overlay",C.ui.dialog.overlay.resize)}var D=C("<div></div>").appendTo(document.body).addClass("ui-widget-overlay").css({width:this.width(),height:this.height()});(E.options.bgiframe&&C.fn.bgiframe&&D.bgiframe());this.instances.push(D);return D},destroy:function(D){this.instances.splice(C.inArray(this.instances,D),1);if(this.instances.length===0){C([document,window]).unbind(".dialog-overlay")}D.remove()},height:function(){if(C.browser.msie&&C.browser.version<7){var E=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);var D=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);if(E<D){return C(window).height()+"px"}else{return E+"px"}}else{return C(document).height()+"px"}},width:function(){if(C.browser.msie&&C.browser.version<7){var D=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth);var E=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth);if(D<E){return C(window).width()+"px"}else{return D+"px"}}else{return C(document).width()+"px"}},resize:function(){var D=C([]);C.each(C.ui.dialog.overlay.instances,function(){D=D.add(this)});D.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);$.fn.toEm=function(A){A=jQuery.extend({scope:"body"},A);var C=parseInt(this[0],10);var D=jQuery("<div style=\"display: none; font-size: 1em; margin: 0; padding:0; height: auto; line-height: 1; border:0;\">&nbsp;</div>").appendTo(A.scope);var B=D.height();D.remove();return(C/B).toFixed(8)+"em"};$.fn.toPx=function(A){A=jQuery.extend({scope:"body"},A);var C=parseFloat(this[0]);var D=jQuery("<div style=\"display: none; font-size: 1em; margin: 0; padding:0; height: auto; line-height: 1; border:0;\">&nbsp;</div>").appendTo(A.scope);var B=D.height();D.remove();return Math.round(C*B)+"px"};(function(A){A.fn.bgIframe=A.fn.bgiframe=function(C){if(A.browser.msie&&/6.0/.test(navigator.userAgent)){C=A.extend({top:"auto",left:"auto",width:"auto",height:"auto",opacity:true,src:"javascript:false;"},C||{});var D=function(E){return E&&E.constructor==Number?E+"px":E},B="<iframe class=\"bgiframe\"frameborder=\"0\"tabindex=\"-1\"src=\""+C.src+"\"style=\"display:block;position:absolute;z-index:-1;"+(C.opacity!==false?"filter:Alpha(Opacity='0');":"")+"top:"+(C.top=="auto"?"expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+'px')":D(C.top))+";left:"+(C.left=="auto"?"expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+'px')":D(C.left))+";width:"+(C.width=="auto"?"expression(this.parentNode.offsetWidth+'px')":D(C.width))+";height:"+(C.height=="auto"?"expression(this.parentNode.offsetHeight+'px')":D(C.height))+";\"/>";return this.each(function(){if(A("> iframe.bgiframe",this).length==0){this.insertBefore(document.createElement(B),this.firstChild)}})}return this}})(jQuery);if(typeof fleegix=="undefined"){var fleegix={}}if(typeof fleegix.date=="undefined"){fleegix.date={}}fleegix.date.Date=function(){var B=Array.prototype.slice.apply(arguments);var D=null;var F=null;var G=null;var E=false;if(B.length===0){F=new Date()}else{if(B.length==1){F=new Date(B[0])}else{D=B[B.length-1];if(typeof D=="boolean"){E=B.pop();G=B.pop()}else{if(typeof D=="string"){G=B.pop();if(G=="Etc/UTC"||G=="Etc/GMT"){E=true}}}D=B[B.length-1];if(typeof D=="string"){F=new Date(B[0])}else{var A=[];for(var C=0;C<8;C++){A[C]=B[C]||0}F=new Date(A[0],A[1],A[2],A[3],A[4],A[5],A[6],A[7])}}}this._useCache=false;this._tzInfo={};this._tzAbbr="";this._day=0;this.year=0;this.month=0;this.date=0;this.hours=0;this.minutes=0;this.seconds=0;this.milliseconds=0;this.timezone=G||null;this.utc=E||false;this.setFromDateObjProxy(F)};fleegix.date.Date.prototype={getDate:function(){return this.date},getDay:function(){return this._day},getFullYear:function(){return this.year},getMonth:function(){return this.month},getYear:function(){return this.year},getHours:function(){return this.hours},getMilliseconds:function(){return this.milliseconds},getMinutes:function(){return this.minutes},getSeconds:function(){return this.seconds},getTime:function(){var A=Date.UTC(this.year,this.month,this.date,this.hours,this.minutes,this.seconds,this.milliseconds);return A+(this.getTimezoneOffset()*60*1000)},getTimezone:function(){return this.timezone},getTimezoneOffset:function(){var A=this.getTimezoneInfo();return A.tzOffset},getTimezoneAbbreviation:function(){var A=this.getTimezoneInfo();return A.tzAbbr},getTimezoneInfo:function(){var A;if(this.utc){A={tzOffset:0,tzAbbr:"UTC"}}else{if(this._useCache){A=this._tzInfo}else{if(this.timezone){var B=new Date(Date.UTC(this.year,this.month,this.date,this.hours,this.minutes,this.seconds,this.milliseconds));var C=this.timezone;A=fleegix.date.timezone.getTzInfo(B,C)}else{A={tzOffset:this.getLocalOffset(),tzAbbr:null}}this._tzInfo=A;this._useCache=true}}return A},getUTCDate:function(){return this.getUTCDateProxy().getUTCDate()},getUTCDay:function(){return this.getUTCDateProxy().getUTCDay()},getUTCFullYear:function(){return this.getUTCDateProxy().getUTCFullYear()},getUTCHours:function(){return this.getUTCDateProxy().getUTCHours()},getUTCMilliseconds:function(){return this.getUTCDateProxy().getUTCMilliseconds()},getUTCMinutes:function(){return this.getUTCDateProxy().getUTCMinutes()},getUTCMonth:function(){return this.getUTCDateProxy().getUTCMonth()},getUTCSeconds:function(){return this.getUTCDateProxy().getUTCSeconds()},setDate:function(A){this.setAttribute("date",A)},setFullYear:function(A){this.setAttribute("year",A)},setMonth:function(A){this.setAttribute("month",A)},setYear:function(A){this.setUTCAttribute("year",A)},setHours:function(A){this.setAttribute("hours",A)},setMilliseconds:function(A){this.setAttribute("milliseconds",A)},setMinutes:function(A){this.setAttribute("minutes",A)},setSeconds:function(A){this.setAttribute("seconds",A)},setTime:function(B){if(isNaN(B)){throw new Error("Units must be a number.")}var A=new Date(0);A.setUTCMilliseconds(B-(this.getTimezoneOffset()*60*1000));this.setFromDateObjProxy(A,true)},setUTCDate:function(A){this.setUTCAttribute("date",A)},setUTCFullYear:function(A){this.setUTCAttribute("year",A)},setUTCHours:function(A){this.setUTCAttribute("hours",A)},setUTCMilliseconds:function(A){this.setUTCAttribute("milliseconds",A)},setUTCMinutes:function(A){this.setUTCAttribute("minutes",A)},setUTCMonth:function(A){this.setUTCAttribute("month",A)},setUTCSeconds:function(A){this.setUTCAttribute("seconds",A)},toGMTString:function(){},toLocaleString:function(){},toLocaleDateString:function(){},toLocaleTimeString:function(){},toSource:function(){},toString:function(){var D=this.getFullYear()+"-"+(this.getMonth()+1)+"-"+this.getDate();var C=this.getHours()||12;C=String(C);var A=String(this.getMinutes());if(A.length==1){A="0"+A}var B=String(this.getSeconds());if(B.length==1){B="0"+B}D+=" "+C;D+=":"+A;D+=":"+B;return D},toUTCString:function(){},valueOf:function(){return this.getTime()},clone:function(){return new fleegix.date.Date(this.year,this.month,this.date,this.hours,this.minutes,this.seconds,this.milliseconds,this.timezone)},setFromDateObjProxy:function(B,A){this.year=A?B.getUTCFullYear():B.getFullYear();this.month=A?B.getUTCMonth():B.getMonth();this.date=A?B.getUTCDate():B.getDate();this.hours=A?B.getUTCHours():B.getHours();this.minutes=A?B.getUTCMinutes():B.getMinutes();this.seconds=A?B.getUTCSeconds():B.getSeconds();this.milliseconds=A?B.getUTCMilliseconds():B.getMilliseconds();this._day=A?B.getUTCDay():B.getDay();this._useCache=false},getUTCDateProxy:function(){var A=new Date(Date.UTC(this.year,this.month,this.date,this.hours,this.minutes,this.seconds,this.milliseconds));A.setUTCMinutes(A.getUTCMinutes()+this.getTimezoneOffset());return A},setAttribute:function(C,D){if(isNaN(D)){throw new Error("Units must be a number.")}var B=new Date(this.year,this.month,this.date,this.hours,this.minutes,this.seconds,this.milliseconds);var A=C=="year"?"FullYear":C.substr(0,1).toUpperCase()+C.substr(1);B["set"+A](D);this.setFromDateObjProxy(B)},setUTCAttribute:function(C,D){if(isNaN(D)){throw new Error("Units must be a number.")}var A=C=="year"?"FullYear":C.substr(0,1).toUpperCase()+C.substr(1);var B=this.getUTCDateProxy();B["setUTC"+A](D);B.setUTCMinutes(B.getUTCMinutes()-this.getTimezoneOffset());this.setFromDateObjProxy(B,true)},setTimezone:function(A){if(A=="Etc/UTC"||A=="Etc/GMT"){this.utc=true}this.timezone=A;this._useCache=false},removeTimezone:function(){this.utc=false;this.timezone=null;this._useCache=false},civilToJulianDayNumber:function(E,B,D){var C;B++;if(B>12){C=parseInt(B/12,10);B=B%12;E+=C}if(B<=2){E-=1;B+=12}C=Math.floor(E/100);var A=2-C+Math.floor(C/4);jDt=Math.floor(365.25*(E+4716))+Math.floor(30.6001*(B+1))+D+A-1524;return jDt},getLocalOffset:function(){var A=this;var B=new Date(A.getYear(),A.getMonth(),A.getDate(),A.getHours(),A.getMinutes(),A.getSeconds());return B.getTimezoneOffset()}};fleegix.date.timezone=new function(){var _this=this;var monthMap={"jan":0,"feb":1,"mar":2,"apr":3,"may":4,"jun":5,"jul":6,"aug":7,"sep":8,"oct":9,"nov":10,"dec":11};var dayMap={"sun":0,"mon":1,"tue":2,"wed":3,"thu":4,"fri":5,"sat":6};var regionMap={"EST":"northamerica","MST":"northamerica","HST":"northamerica","EST5EDT":"northamerica","CST6CDT":"northamerica","MST7MDT":"northamerica","PST8PDT":"northamerica","America":"northamerica","Pacific":"australasia","Atlantic":"europe","Africa":"africa","Indian":"africa","Antarctica":"antarctica","Asia":"asia","Australia":"australasia","Europe":"europe","WET":"europe","CET":"europe","MET":"europe","EET":"europe"};var regionExceptions={"Pacific/Honolulu":"northamerica","Atlantic/Bermuda":"northamerica","Atlantic/Cape_Verde":"africa","Atlantic/St_Helena":"africa","Indian/Kerguelen":"antarctica","Indian/Chagos":"asia","Indian/Maldives":"asia","Indian/Christmas":"australasia","Indian/Cocos":"australasia","America/Danmarkshavn":"europe","America/Scoresbysund":"europe","America/Godthab":"europe","America/Thule":"europe","Asia/Yekaterinburg":"europe","Asia/Omsk":"europe","Asia/Novosibirsk":"europe","Asia/Krasnoyarsk":"europe","Asia/Irkutsk":"europe","Asia/Yakutsk":"europe","Asia/Vladivostok":"europe","Asia/Sakhalin":"europe","Asia/Magadan":"europe","Asia/Kamchatka":"europe","Asia/Anadyr":"europe","Africa/Ceuta":"europe","America/Argentina/Buenos_Aires":"southamerica","America/Argentina/Cordoba":"southamerica","America/Argentina/Tucuman":"southamerica","America/Argentina/La_Rioja":"southamerica","America/Argentina/San_Juan":"southamerica","America/Argentina/Jujuy":"southamerica","America/Argentina/Catamarca":"southamerica","America/Argentina/Mendoza":"southamerica","America/Argentina/Rio_Gallegos":"southamerica","America/Argentina/Ushuaia":"southamerica","America/Aruba":"southamerica","America/La_Paz":"southamerica","America/Noronha":"southamerica","America/Belem":"southamerica","America/Fortaleza":"southamerica","America/Recife":"southamerica","America/Araguaina":"southamerica","America/Maceio":"southamerica","America/Bahia":"southamerica","America/Sao_Paulo":"southamerica","America/Campo_Grande":"southamerica","America/Cuiaba":"southamerica","America/Porto_Velho":"southamerica","America/Boa_Vista":"southamerica","America/Manaus":"southamerica","America/Eirunepe":"southamerica","America/Rio_Branco":"southamerica","America/Santiago":"southamerica","Pacific/Easter":"southamerica","America/Bogota":"southamerica","America/Curacao":"southamerica","America/Guayaquil":"southamerica","Pacific/Galapagos":"southamerica","Atlantic/Stanley":"southamerica","America/Cayenne":"southamerica","America/Guyana":"southamerica","America/Asuncion":"southamerica","America/Lima":"southamerica","Atlantic/South_Georgia":"southamerica","America/Paramaribo":"southamerica","America/Port_of_Spain":"southamerica","America/Montevideo":"southamerica","America/Caracas":"southamerica"};function builtInLoadZoneFile(fileName,sync){if(typeof fleegix.xhr=="undefined"){throw new Error("Please use the Fleegix.js XHR module, or define your own transport mechanism for downloading zone files.")}var url=_this.zoneFileBasePath+"/"+fileName;if(sync){return fleegix.xhr.doReq({url:url,async:false})}else{return fleegix.xhr.doGet(_this.parseZones,url)}}function getRegionForTimezone(tz){var exc=regionExceptions[tz];if(exc){return exc}else{reg=tz.split("/")[0];return regionMap[reg]}}function parseTimeString(str){var pat=/(\d+)(?::0*(\d*))?(?::0*(\d*))?([wsugz])?$/;var hms=str.match(pat);hms[1]=parseInt(hms[1],10);hms[2]=hms[2]?parseInt(hms[2],10):0;hms[3]=hms[3]?parseInt(hms[3],10):0;return hms}function getZone(dt,tz){var t=tz;var zoneList=_this.zones[t];while(typeof zoneList=="string"){t=zoneList;zoneList=_this.zones[t]}if(!zoneList){throw new Error("\""+t+"\" is either incorrect, or not loaded in the timezone registry.")}for(var i=0;i<zoneList.length;i++){var z=zoneList[i];if(!z[3]){break}var yea=parseInt(z[3],10);var mon=11;var dat=31;if(z[4]){mon=monthMap[z[4].substr(0,3).toLowerCase()];dat=parseInt(z[5],10)}var t=z[6]?z[6]:"23:59:59";t=parseTimeString(t);var d=Date.UTC(yea,mon,dat,t[1],t[2],t[3]);if(dt.getTime()<d){break}}if(i==zoneList.length){throw new Error("No Zone found for \""+timezone+"\" on "+dt)}return zoneList[i]}function getBasicOffset(z){var off=parseTimeString(z[0]);var adj=z[0].indexOf("-")==0?-1:1;off=adj*(((off[1]*60+off[2])*60+off[3])*1000);return -off/60/1000}function getRule(dt,str){var currRule=null;var year=dt.getUTCFullYear();var rules=_this.rules[str];var ruleHits=[];var getMonthNumber=function(r){return monthMap[r[3].substr(0,3).toLowerCase()]};var checkForHits=function(incr,rule,d,dt){d.setUTCDate(d.getUTCDate()+incr);if(dt>=d){ruleHits.push({"rule":rule,"date":d})}else{if((rule[0]<year)&&(getMonthNumber(r)>8)){d.setUTCFullYear(d.getUTCFullYear()-1);if(dt>=d){ruleHits.push({"rule":rule,"date":d})}}}};if(!rules||rules=="undefined"){return null}for(var i=0;i<rules.length;i++){r=rules[i];if((r[1]<year)||(r[0]<year&&r[1]=="only")||(r[0]>year)){continue}var mon=getMonthNumber(r);var day=r[4];if(isNaN(day)){if(day.substr(0,4)=="last"){var day=dayMap[day.substr(4,3).toLowerCase()];var t=parseTimeString(r[5]);var d=new Date(Date.UTC(dt.getUTCFullYear(),mon+1,1,t[1]-24,t[2],t[3]));var dtDay=d.getUTCDay();var incr=(day>dtDay)?(day-dtDay-7):(day-dtDay);checkForHits(incr,r,d,dt)}else{day=dayMap[day.substr(0,3).toLowerCase()];if(day!="undefined"){if(r[4].substr(3,2)==">="){var t=parseTimeString(r[5]);var d=new Date(Date.UTC(dt.getUTCFullYear(),mon,parseInt(r[4].substr(5),10),t[1],t[2],t[3]));var dtDay=d.getUTCDay();var incr=(day<dtDay)?(day-dtDay+7):(day-dtDay);checkForHits(incr,r,d,dt)}else{if(day.substr(3,2)=="<="){var t=parseTimeString(r[5]);var d=new Date(Date.UTC(dt.getUTCFullYear(),mon,parseInt(r[4].substr(5),10),t[1],t[2],t[3]));var dtDay=d.getUTCDay();var incr=(day>dtDay)?(day-dtDay-7):(day-dtDay);checkForHits(incr,r,d,dt)}}}}}else{var t=parseTimeString(r[5]);var d=new Date(Date.UTC(dt.getUTCFullYear(),mon,day,t[1],t[2],t[3]));if(dt<d){continue}else{ruleHits.push({"rule":r,"date":d})}}}if(ruleHits.length){f=function(a,b){return(a.date.getTime()>=b.date.getTime())?1:-1};ruleHits.sort(f);currRule=ruleHits.pop().rule}return currRule}function getAdjustedOffset(off,rule){var save=rule[6];var t=parseTimeString(save);var adj=save.indexOf("-")==0?-1:1;var ret=(adj*(((t[1]*60+t[2])*60+t[3])*1000));ret=ret/60/1000;ret-=off;ret=-Math.ceil(ret);return ret}function getAbbreviation(zone,rule){var res;var base=zone[2];if(base.indexOf("%s")>-1){var repl;if(rule){repl=rule[7]}else{repl="S"}res=base.replace("%s",repl)}else{res=base}return res}this.zoneFileBasePath;this.zoneFiles=["africa","antarctica","asia","australasia","backward","etcetera","europe","northamerica","pacificnew","southamerica"];this.loadingSchemes={PRELOAD_ALL:"preloadAll",LAZY_LOAD:"lazyLoad",MANUAL_LOAD:"manualLoad"};this.loadingScheme=this.loadingSchemes.LAZY_LOAD;this.defaultZoneFile=this.loadingScheme==this.loadingSchemes.PRELOAD_ALL?this.zoneFiles:"northamerica";this.loadedZones={};this.zones={};this.rules={};this.init=function(){var def=this.defaultZoneFile;if(typeof def=="string"){this.loadZoneFile(this.defaultZoneFile)}else{for(var i=0;i<def.length;i++){this.loadZoneFile(def[i])}}};this.loadZoneFile=function(fileName,sync){if(typeof this.zoneFileBasePath=="undefined"){throw new Error("Please define a base path to your zone file directory -- fleegix.date.timezone.zoneFileBasePath.")}this.loadedZones[fileName]=true;return builtInLoadZoneFile(fileName,sync)};this.loadZoneJSONData=function(url,sync){var processData=function(data){data=eval("("+data+")");for(var z in data.zones){_this.zones[z]=data.zones[z]}for(var r in data.rules){_this.rules[r]=data.rules[r]}};if(sync){var data=fleegix.xhr.doGet(url);processData(data)}else{fleegix.xhr.doGet(processData,url)}};this.loadZoneDataFromObject=function(data){if(!data){return }for(var z in data.zones){_this.zones[z]=data.zones[z]}for(var r in data.rules){_this.rules[r]=data.rules[r]}};this.getAllZones=function(){var arr=[];for(z in this.zones){arr.push(z)}return arr.sort()};this.parseZones=function(str){var s="";var lines=str.split("\n");var arr=[];var chunk="";var zone=null;var rule=null;for(var i=0;i<lines.length;i++){l=lines[i];if(l.match(/^\s/)){l="Zone "+zone+l}l=l.split("#")[0];if(l.length>3){arr=l.split(/\s+/);chunk=arr.shift();switch(chunk){case"Zone":zone=arr.shift();if(!_this.zones[zone]){_this.zones[zone]=[]}_this.zones[zone].push(arr);break;case"Rule":rule=arr.shift();if(!_this.rules[rule]){_this.rules[rule]=[]}_this.rules[rule].push(arr);break;case"Link":if(_this.zones[arr[1]]){throw new Error("Error with Link "+arr[1])}_this.zones[arr[1]]=arr[0];break;case"Leap":break;default:break}}}return true};this.getTzInfo=function(dt,tz){if(this.loadingScheme==this.loadingSchemes.LAZY_LOAD){var zoneFile=getRegionForTimezone(tz);if(!zoneFile){throw new Error("Not a valid timezone ID.")}else{if(!this.loadedZones[zoneFile]){var res=this.loadZoneFile(zoneFile,true);if(res.length){this.parseZones(res)}else{throw new Error("Error loading zone file for "+zoneFile)}}}}var zone=getZone(dt,tz);var off=getBasicOffset(zone);var rule=getRule(dt,zone[1]);if(rule){off=getAdjustedOffset(off,rule)}var abbr=getAbbreviation(zone,rule);return{tzOffset:off,tzAbbr:abbr}}};if(typeof fleegix=="undefined"){var fleegix={}}if(typeof fleegix.date=="undefined"){fleegix.date={}}fleegix.date.util={};fleegix.date.util.weekdayLong=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];fleegix.date.util.weekdayShort=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];fleegix.date.util.monthLong=["January","February","March","April","May","June","July","August","September","October","November","December"];fleegix.date.util.monthShort=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];fleegix.date.util.meridian={"AM":"AM","PM":"PM"};fleegix.date.util.supportedFormats={"a":function(A){return fleegix.date.util.weekdayShort[A.getDay()]},"A":function(A){return fleegix.date.util.weekdayLong[A.getDay()]},"b":function(A){return fleegix.date.util.monthShort[A.getMonth()]},"h":function(A){return fleegix.date.util.strftime(A,"%b")},"B":function(A){return fleegix.date.util.monthLong[A.getMonth()]},"c":function(A){return fleegix.date.util.strftime(A,"%a %b %d %T %Y")},"C":function(A){return fleegix.date.util.calcCentury(A.getFullYear())},"d":function(A){return fleegix.date.util.leftPad(A.getDate(),2,"0")},"D":function(A){return fleegix.date.util.strftime(A,"%m/%d/%y")},"e":function(A){return fleegix.date.util.leftPad(A.getDate(),2," ")},"f":function(){return fleegix.date.util.strftimeNotImplemented("f")},"F":function(A){return fleegix.date.util.strftime(A,"%Y-%m-%d")},"g":function(){return fleegix.date.util.strftimeNotImplemented("g")},"G":function(){return fleegix.date.util.strftimeNotImplemented("G")},"H":function(A){return fleegix.date.util.leftPad(A.getHours(),2,"0")},"I":function(A){return fleegix.date.util.leftPad(fleegix.date.util.hrMil2Std(A.getHours()),2,"0")},"j":function(A){return fleegix.date.util.leftPad(fleegix.date.util.calcDays(A),3,"0")},"k":function(A){return fleegix.date.util.leftPad(A.getHours(),2," ")},"l":function(A){return fleegix.date.util.leftPad(fleegix.date.util.hrMil2Std(A.getHours()),2," ")},"m":function(A){return fleegix.date.util.leftPad((A.getMonth()+1),2,"0")},"M":function(A){return fleegix.date.util.leftPad(A.getMinutes(),2,"0")},"n":function(){return"\n"},"p":function(A){return fleegix.date.util.getMeridian(A.getHours())},"r":function(A){return fleegix.date.util.strftime(A,"%I:%M:%S %p")},"R":function(A){return fleegix.date.util.strftime(A,"%H:%M")},"S":function(A){return fleegix.date.util.leftPad(A.getSeconds(),2,"0")},"t":function(){return"\t"},"T":function(A){return fleegix.date.util.strftime(A,"%H:%M:%S")},"u":function(A){return fleegix.date.util.convertOneBase(A.getDay())},"U":function(){return fleegix.date.util.strftimeNotImplemented("U")},"V":function(){return fleegix.date.util.strftimeNotImplemented("V")},"W":function(){return fleegix.date.util.strftimeNotImplemented("W")},"w":function(A){return A.getDay()},"x":function(A){return fleegix.date.util.strftime(A,"%D")},"X":function(A){return fleegix.date.util.strftime(A,"%T")},"y":function(A){return fleegix.date.util.getTwoDigitYear(A.getFullYear())},"Y":function(A){return fleegix.date.util.leftPad(A.getFullYear(),4,"0")},"z":function(){return fleegix.date.util.strftimeNotImplemented("z")},"Z":function(){return fleegix.date.util.strftimeNotImplemented("Z")},"%":function(A){return"%"}};fleegix.date.util.getSupportedFormats=function(){var B="";for(var A in fleegix.date.util.supportedFormats){B+=A}return B};fleegix.date.util.supportedFormatsPat=new RegExp("%["+fleegix.date.util.getSupportedFormats()+"]{1}","g");fleegix.date.util.strftime=function(C,E){var G=null;var D=[];var A=[];var F=E;G=C?C:new Date();G=typeof C=="number"?new Date(C):C;while(D=fleegix.date.util.supportedFormatsPat.exec(E)){A.push(D[0])}for(var B=0;B<A.length;B++){key=A[B].replace(/%/,"");F=F.replace("%"+key,fleegix.date.util.supportedFormats[key](G))}return F};fleegix.date.util.strftimeNotImplemented=function(A){throw ("fleegix.date.util.strftime format \""+A+"\" not implemented.")};fleegix.date.util.leftPad=function(B,A,C){var E=B.toString();var D=C?C:" ";while(E.length<A){E=D+E}return E};fleegix.date.util.calcCentury=function(B){var A=parseInt(B/100);A=A.toString();return fleegix.date.util.leftPad(A)};fleegix.date.util.calcDays=function(B){var D=new Date(B.getFullYear(),0,1);var C=0;var A=0;D=D.getTime();C=(B.getTime()-D);A=parseInt(((((C/1000)/60)/60)/24))+1;return A};fleegix.date.util.convertOneBase=function(A){return A==0?7:A};fleegix.date.util.getTwoDigitYear=function(A){var C=A+1000;var B=C.toString();B=B.substr(2);return B};fleegix.date.util.getMeridian=function(A){return A>11?fleegix.date.util.meridian.PM:fleegix.date.util.meridian.AM};fleegix.date.util.hrMil2Std=function(A){var B=typeof A=="number"?A:parseInt(A);var C=B>12?B-12:B;C=C==0?12:C;return C};fleegix.date.util.hrStd2Mil=function(A,B){var C=typeof A=="number"?A:parseInt(A);var D="";if(B){D=C<12?(C+12):C}else{D=C==12?0:C}return D};fleegix.date.util.dateParts={YEAR:0,MONTH:1,DAY:2,HOUR:3,MINUTE:4,SECOND:5,MILLISECOND:6,QUARTER:7,WEEK:8,WEEKDAY:9};fleegix.date.util.add=function(dt,interv,incr){if(typeof dt=="number"){dt=new Date(dt)}function fixOvershoot(){if(sum.getDate()<dt.getDate()){sum.setDate(0)}}var sum=new Date(dt);with(fleegix.date.util.dateParts){switch(interv){case YEAR:sum.setFullYear(dt.getFullYear()+incr);fixOvershoot();break;case QUARTER:incr*=3;case MONTH:sum.setMonth(dt.getMonth()+incr);fixOvershoot();break;case WEEK:incr*=7;case DAY:sum.setDate(dt.getDate()+incr);break;case WEEKDAY:var dat=dt.getDate();var weeks=0;var days=0;var strt=0;var trgt=0;var adj=0;var mod=incr%5;if(mod==0){days=(incr>0)?5:-5;weeks=(incr>0)?((incr-5)/5):((incr+5)/5)}else{days=mod;weeks=parseInt(incr/5)}strt=dt.getDay();if(strt==6&&incr>0){adj=1}else{if(strt==0&&incr<0){adj=-1}}trgt=strt+days;if(trgt==0||trgt==6){adj=(incr>0)?2:-2}sum.setDate(dat+(7*weeks)+days+adj);break;case HOUR:sum.setHours(sum.getHours()+incr);break;case MINUTE:sum.setMinutes(sum.getMinutes()+incr);break;case SECOND:sum.setSeconds(sum.getSeconds()+incr);break;case MILLISECOND:sum.setMilliseconds(sum.getMilliseconds()+incr);break;default:break}}return sum};fleegix.date.util.diff=function(date1,date2,interv){if(typeof date1=="number"){date1=new Date(date1)}if(typeof date2=="number"){date2=new Date(date2)}var yeaDiff=date2.getFullYear()-date1.getFullYear();var monDiff=(date2.getMonth()-date1.getMonth())+(yeaDiff*12);var msDiff=date2.getTime()-date1.getTime();var secDiff=msDiff/1000;var minDiff=secDiff/60;var houDiff=minDiff/60;var dayDiff=houDiff/24;var weeDiff=dayDiff/7;var delta=0;with(fleegix.date.util.dateParts){switch(interv){case YEAR:delta=yeaDiff;break;case QUARTER:var m1=date1.getMonth();var m2=date2.getMonth();var q1=Math.floor(m1/3)+1;var q2=Math.floor(m2/3)+1;q2+=(yeaDiff*4);delta=q2-q1;break;case MONTH:delta=monDiff;break;case WEEK:delta=parseInt(weeDiff);break;case DAY:delta=dayDiff;break;case WEEKDAY:var days=Math.round(dayDiff);var weeks=parseInt(days/7);var mod=days%7;if(mod==0){days=weeks*5}else{var adj=0;var aDay=date1.getDay();var bDay=date2.getDay();weeks=parseInt(days/7);mod=days%7;var dtMark=new Date(date1);dtMark.setDate(dtMark.getDate()+(weeks*7));var dayMark=dtMark.getDay();if(dayDiff>0){switch(true){case aDay==6:adj=-1;break;case aDay==0:adj=0;break;case bDay==6:adj=-1;break;case bDay==0:adj=-2;break;case (dayMark+mod)>5:adj=-2;break;default:break}}else{if(dayDiff<0){switch(true){case aDay==6:adj=0;break;case aDay==0:adj=1;break;case bDay==6:adj=2;break;case bDay==0:adj=1;break;case (dayMark+mod)<0:adj=2;break;default:break}}}days+=adj;days-=(weeks*2)}delta=days;break;case HOUR:delta=houDiff;break;case MINUTE:delta=minDiff;break;case SECOND:delta=secDiff;break;case MILLISECOND:delta=msDiff;break;default:break}}return Math.round(delta)};if(!this.JSON){JSON={}}(function(){function f(n){return n<10?"0"+n:n}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(key){return this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z"};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={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","\"":"\\\"","\\":"\\\\"},rep;function quote(string){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){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==="object"&&typeof value.toJSON==="function"){value=value.toJSON(key)}if(typeof rep==="function"){value=rep.call(holder,key,value)}switch(typeof value){case"string":return quote(value);case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value){return"null"}gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==="[object Array]"){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||"null"}v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";gap=mind;return v}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{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v}}if(typeof JSON.stringify!=="function"){JSON.stringify=function(value,replacer,space){var i;gap="";indent="";if(typeof space==="number"){for(i=0;i<space;i+=1){indent+=" "}}else{if(typeof space==="string"){indent=space}}rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("JSON.stringify")}return str("",{"":value})}}if(typeof JSON.parse!=="function"){JSON.parse=function(text,reviver){var j;function walk(holder,key){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)}cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}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,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")}}})();(function(){var NAMESPACE="log";var IE6_POSITION_FIXED=true;var bbird;var outputList;var cache=[];var state=getState();var classes={};var profiler={};var IDs={blackbird:"blackbird",checkbox:"bbVis",filters:"bbFilters",controls:"bbControls",size:"bbSize"};var messageTypes={debug:true,info:true,warn:true,error:true,profile:true};function generateMarkup(){var spans=[];for(type in messageTypes){spans.push(["<span class=\"",type,"\" type=\"",type,"\"></span>"].join(""))}var newNode=document.createElement("DIV");newNode.id=IDs.blackbird;newNode.style.display="none";newNode.innerHTML=["<div class=\"header\">","<div class=\"left\">","<div id=\"",IDs.filters,"\" class=\"filters\" title=\"click to filter by message type\">",spans.join(""),"</div>","</div>","<div class=\"right\">","<div id=\"",IDs.controls,"\" class=\"controls\">","<span id=\"",IDs.size,"\" title=\"contract\" op=\"resize\"></span>","<span class=\"clear\" title=\"clear\" op=\"clear\"></span>","<span class=\"close\" title=\"close\" op=\"close\"></span>","</div>","</div>","</div>","<div class=\"main\">","<div class=\"left\"></div><div class=\"mainBody\">","<ol>",cache.join(""),"</ol>","</div><div class=\"right\"></div>","</div>","<div class=\"footer\">","<div class=\"left\"><label for=\"",IDs.checkbox,"\"><input type=\"checkbox\" id=\"",IDs.checkbox,"\" />Visible on page load</label></div>","<div class=\"right\"></div>","</div>"].join("");return newNode}function backgroundImage(){var bodyTag=document.getElementsByTagName("BODY")[0];if(bodyTag.currentStyle&&IE6_POSITION_FIXED){if(bodyTag.currentStyle.backgroundImage=="none"){bodyTag.style.backgroundImage="url(about:blank)"}if(bodyTag.currentStyle.backgroundAttachment=="scroll"){bodyTag.style.backgroundAttachment="fixed"}}}function addMessage(type,content){content=(content.constructor==Array)?content.join(""):content;if(outputList){var newMsg=document.createElement("LI");newMsg.className=type;newMsg.innerHTML=["<span class=\"icon\"></span>",content].join("");outputList.appendChild(newMsg);scrollToBottom()}else{cache.push(["<li class=\"",type,"\"><span class=\"icon\"></span>",content,"</li>"].join(""))}}function clear(){outputList.innerHTML=""}function clickControl(evt){if(!evt){evt=window.event}var el=(evt.target)?evt.target:evt.srcElement;if(el.tagName=="SPAN"){switch(el.getAttributeNode("op").nodeValue){case"resize":resize();break;case"clear":clear();break;case"close":hide();break}}}function clickFilter(evt){if(!evt){evt=window.event}var span=(evt.target)?evt.target:evt.srcElement;if(span&&span.tagName=="SPAN"){var type=span.getAttributeNode("type").nodeValue;if(evt.altKey){var filters=document.getElementById(IDs.filters).getElementsByTagName("SPAN");var active=0;for(entry in messageTypes){if(messageTypes[entry]){active++}}var oneActiveFilter=(active==1&&messageTypes[type]);for(var i=0;filters[i];i++){var spanType=filters[i].getAttributeNode("type").nodeValue;filters[i].className=(oneActiveFilter||(spanType==type))?spanType:spanType+"Disabled";messageTypes[spanType]=oneActiveFilter||(spanType==type)}}else{messageTypes[type]=!messageTypes[type];span.className=(messageTypes[type])?type:type+"Disabled"}var disabledTypes=[];for(type in messageTypes){if(!messageTypes[type]){disabledTypes.push(type)}}disabledTypes.push("");outputList.className=disabledTypes.join("Hidden ");scrollToBottom()}}function clickVis(evt){if(!evt){evt=window.event}var el=(evt.target)?evt.target:evt.srcElement;state.load=el.checked;setState()}function scrollToBottom(){outputList.scrollTop=outputList.scrollHeight}function isVisible(){return(bbird.style.display=="block")}function hide(){bbird.style.display="none"}function show(){var body=document.getElementsByTagName("BODY")[0];body.removeChild(bbird);body.appendChild(bbird);bbird.style.display="block"}function reposition(position){if(position===undefined||position==null){position=(state&&state.pos===null)?1:(state.pos+1)%4}switch(position){case 0:classes[0]="bbTopLeft";break;case 1:classes[0]="bbTopRight";break;case 2:classes[0]="bbBottomLeft";break;case 3:classes[0]="bbBottomRight";break}state.pos=position;setState()}function resize(size){if(size===undefined||size===null){size=(state&&state.size==null)?0:(state.size+1)%2}classes[1]=(size===0)?"bbSmall":"bbLarge";var span=document.getElementById(IDs.size);span.title=(size===1)?"small":"large";span.className=span.title;state.size=size;setState();scrollToBottom()}function setState(){var props=[];for(entry in state){var value=(state[entry]&&state[entry].constructor===String)?"\""+state[entry]+"\"":state[entry];props.push(entry+":"+value)}props=props.join(",");var expiration=new Date();expiration.setDate(expiration.getDate()+14);document.cookie=["blackbird={",props,"}; expires=",expiration.toUTCString(),";"].join("");var newClass=[];for(word in classes){newClass.push(classes[word])}bbird.className=newClass.join(" ")}function getState(){var re=new RegExp(/blackbird=({[^;]+})(;|\b|$)/);var match=re.exec(document.cookie);return(match&&match[1])?eval("("+match[1]+")"):{pos:null,size:null,load:null}}function readKey(evt){if(!evt){evt=window.event}var code=113;if(evt&&evt.keyCode==code){var visible=isVisible();if(visible&&evt.shiftKey&&evt.altKey){clear()}else{if(visible&&evt.shiftKey){reposition()}else{if(!evt.shiftKey&&!evt.altKey){(visible)?hide():show()}}}}}function addEvent(obj,type,fn){var obj=(obj.constructor===String)?document.getElementById(obj):obj;if(obj.attachEvent){obj["e"+type+fn]=fn;obj[type+fn]=function(){obj["e"+type+fn](window.event)};obj.attachEvent("on"+type,obj[type+fn])}else{obj.addEventListener(type,fn,false)}}function removeEvent(obj,type,fn){var obj=(obj.constructor===String)?document.getElementById(obj):obj;if(obj.detachEvent){obj.detachEvent("on"+type,obj[type+fn]);obj[type+fn]=null}else{obj.removeEventListener(type,fn,false)}}window[NAMESPACE]={toggle:function(){(isVisible())?hide():show()},resize:function(){resize()},clear:function(){clear()},move:function(){reposition()},debug:function(msg){addMessage("debug",msg)},warn:function(msg){addMessage("warn",msg)},info:function(msg){addMessage("info",msg)},error:function(msg){addMessage("error",msg)},profile:function(label){var currentTime=new Date();if(label==undefined||label==""){addMessage("error","<b>ERROR:</b> Please specify a label for your profile statement")}else{if(profiler[label]){addMessage("profile",[label,": ",currentTime-profiler[label],"ms"].join(""));delete profiler[label]}else{profiler[label]=currentTime;addMessage("profile",label)}}return currentTime}};addEvent(window,"load",function(){var body=document.getElementsByTagName("BODY")[0];bbird=body.appendChild(generateMarkup());outputList=bbird.getElementsByTagName("OL")[0];backgroundImage();addEvent(IDs.checkbox,"click",clickVis);addEvent(IDs.filters,"click",clickFilter);addEvent(IDs.controls,"click",clickControl);addEvent(document,"keyup",readKey);resize(state.size);reposition(state.pos);if(state.load){show();document.getElementById(IDs.checkbox).checked=true}scrollToBottom();window[NAMESPACE].init=function(){show();window[NAMESPACE].error(["<b>",NAMESPACE,"</b> can only be initialized once"])};addEvent(window,"unload",function(){removeEvent(IDs.checkbox,"click",clickVis);removeEvent(IDs.filters,"click",clickFilter);removeEvent(IDs.controls,"click",clickControl);removeEvent(document,"keyup",readKey)})})})();(function(A){A.widget("ns.tomnoddy",{_init:function(){if(this.element.attr("editable")){this.element.bind("click",{th:this},this.itemClick)}if(this.element.attr("bref")){this.element.bind("mousedown",{th:this},this.mouseDown);this.element.bind("click",{th:this},this.tossEvent)}this.delay=false},bubbleBlow:function(N){if(!N){N=jQuery.Event("click");N.data={id:this.element.attr("id"),th:this}}N.data.th.element.unbind("mousemove",N.data.th.itsADrag);N.data.th.element.unbind("mouseup",N.data.th.closeBubble);var K=N.data.th.element.attr("id");if(A("#bubble-"+K).is("*")){return }var C=A("#"+K).offset();var H=null;var G=null;var Q=null;var B=null;if(A("#"+K).parent().hasClass("event-title")){H=A("#"+K).parent().parent().children(".event-time").offset().left+A("#"+K).parent().parent().children(".event-time").outerWidth()/2}else{if(A("#"+K).hasClass("listEventTitle")){H=A("#"+K).parent().children(".listEventTime").children("strong").offset().left+A("#"+K).parent().children(".listEventTime").children("strong").outerWidth()/2}else{H=C.left+A("#"+K).outerWidth()/2}}Q=C.top+A("#"+K).outerHeight()/2;B=A(window).height()-Q;var D=0;G=A(window).width()-H;if(N.data.th.element.parents(".tomnoddy-bubble").size()===0){D=49}else{D=49*(N.data.th.element.parents(".tomnoddy-bubble").size()+1)}var E=A("body").find(".tomnoddy-bubble").size();if(E===0){E=E+1}else{E=E*3}var J=D+E;var F=J+1;if(A(this).closest(".tomnoddy-bubble").hasClass(".tomnoddy-bubble-more")){A(this).parent().parent().children(".event-time").css("z-index",F+1)}else{A(this).parents(".bubbleBlowStart").css("z-index",F+1)}var I="";if(dotcal.calendar.views.ui==dotcal.calendar.views.currentUI.CALENDAR){I=A("<div id='bubble-"+K+"' class='tomnoddy-bubble' style='z-index: "+J+";'><div class='tomnoddy-bubble-sprite' style='z-index: "+F+";'></div><div class='tomnoddy-bubble-wrapper'><div class='tomnoddy-bubble-padding'><div class='tomnoddy-bubble-header ui-widget-header ui-corner-all clearfix'><button id='close-"+K+"' class='tomnoddy-bubble-close noBorder ui-corner-all' alt='Close this event' title='Close this event' style='float: right;'><span class='ui-icon ui-icon-circle-close'></span></button><div class='tomnoddy-bubble-header-label'></div></div><div class='tomnoddy-bubble-scroll'></div><div class='tomnoddy-bubble-footer clearfix'><button id='done-"+K+"' class='ui-state-default ui-corner-all' style='float: right;' alt='Save this event' title='Save this event'>Done</button><div class='tomnoddy-bubble-footer-reminder'> Website calendars may take up to 15 minutes to update.</div></div></div>")}else{I=A("<div id='bubble-"+K+"' class='tomnoddy-bubble' style='z-index: "+J+";'><div class='tomnoddy-bubble-sprite' style='z-index: "+F+";'></div><div class='tomnoddy-bubble-wrapper'><div class='tomnoddy-bubble-padding'><div class='tomnoddy-bubble-header ui-widget-header ui-corner-all clearfix'><button id='close-"+K+"' class='tomnoddy-bubble-close noBorder ui-corner-all' alt='Close this event' title='Close this event' style='float: right;'><span class='ui-icon ui-icon-circle-close'></span></button><div class='tomnoddy-bubble-header-label'></div></div><div class='tomnoddy-bubble-scroll'></div><div class='tomnoddy-bubble-footer clearfix'><button id='done-"+K+"' class='ui-state-default ui-corner-all' style='float: right;' alt='Save this event' title='Save this event'>Done</button></div></div>")}if(N.data.th.element.parents(".tomnoddy-bubble").is("*")){if(A("#"+K).parent().hasClass("bubbleBlowStart")){A("#"+K).parent().append(I)}else{A("#"+K).parent().parent().children(".event-time").append(I)}}else{A("body").append(I)}A(I).bgiframe();N.data.th._trigger("blowBubble",0,K);var L="tomnoddy-bubble-";var P="tomnoddy-bubble-sprite-";var S=-30;var O=false;if(Q+S>A("#bubble-"+K).height()){L+="lower-";P+="lower-"}else{L+="upper-";P+="upper-";O=true}var R=false;if(H>A(window).width()/2){L+="right";P+="right";R=true}else{L+="left";P+="left"}var M=true;if(!O&&!(A("#bubble-"+K).height()<Q)){M=false}else{if(O&&!(A("#bubble-"+K).height()<B)){M=false}}if(R&&!(A("#bubble-"+K).width()<H)){M=false}else{if(!R&&!(A("#bubble-"+K).width()<G)){M=false}}if(Q<=0||H<=0){M=false}if(M){A(I).addClass(L);A(I).children(".tomnoddy-bubble-sprite").addClass(P);if(N.data.th.element.parents(".tomnoddy-bubble").is("*")){A(I).css((H>A(window).width()/2)?"right":"left","50%");A(I).css((Q+S>A("#bubble-"+K).height())?"bottom":"top",((Q+S>A("#bubble-"+K).height())?"49px":"100%"))}else{if(Q+S>A("#bubble-"+K).height()){Q-=A(I).height()}if(H>A(window).width()/2){H-=A(I).width()}A(I).css("top",A(Q).toEm());A(I).css("left",H)}}else{if(N.data.th.element.parents(".tomnoddy-bubble").is("*")){A(I).css("top","-"+(A(I).height()/2)+"px");A(I).css("left","-11px")}else{A(I).css("top","100px");A(I).css("left","50%");A(I).css("marginLeft","-"+(A(I).width()/2)+"px")}A(I).children(".tomnoddy-bubble-sprite").addClass("tomnoddy-bubble-sprite-hidden")}A("#close-"+K).hover(function(){A(this).addClass("border ui-state-hover")},function(){A(this).removeClass("border ui-state-hover")});A("button.ui-state-default, input.ui-state-default, a.ui-state-default").hover(function(){A(this).addClass("ui-state-hover")},function(){A(this).removeClass("ui-state-hover")});A("#close-"+K).bind("mouseup",{th:N.data.th},N.data.th.closeBubble);A("#done-"+K).bind("mouseup",{th:N.data.th},N.data.th.closeBubble);if(A(".tomnoddy-bubble").size()<2){A("body").bind("mousedown",{th:N.data.th},N.data.th.bubblePop)}var T=A("#"+A(I).attr("id")+" input[type=text]");T.push(A("#"+A(I).attr("id")+" [type=textarea]"));if(T.length>0){A(T[0]).focus()}},bubblePop:function(B){B.stopPropagation();A(B.target).parents(".tomnoddy-bubble").eq(0).find(".tomnoddy-bubble").each(function(){if(A(B.target).parents(".tomnoddy-bubble").eq(0).attr("id")!=A(this).attr("id")){A(this).parent(".bubbleBlowStart").css("z-index","50");var C=A(this).attr("id").substring(7);A("#close-"+C).unbind("mouseup",B.data.th.closeBubble);A("#done-"+C).unbind("mouseup",B.data.th.closeBubble);if(A(".tomnoddy-bubble").size()<2){A("body").unbind("mousedown",B.data.th.bubblePop)}B.data.th._trigger("popBubble",0,C);A("#bubble-"+C).remove()}});if(!A(B.target).parents().hasClass("tomnoddy-bubble")){B.data.th.closeBubble(B)}},closeBubble:function(B){var C=B.data.th.element.attr("id");A("#close-"+C).unbind("mouseup",B.data.th.closeBubble);A("#done-"+C).unbind("mouseup",B.data.th.closeBubble);if(A(".tomnoddy-bubble").size()<2){A("body").unbind("mousedown",B.data.th.bubblePop)}B.stopPropagation();B.data.th._trigger("popBubble",0,C);A("#bubble-"+C).remove();if(B.data.th.element.parent().parent().children(".bubbleBlowStart").size()>0){B.data.th.element.parent().parent().children(".bubbleBlowStart").css("z-index","50")}},editBlur:function(C){C.data.th._trigger("editEnd",0,C.data.th.element.attr("id"));if(A("#tomnoddy-editfield").val()!=C.data.th.element.html()){C.data.th._trigger("editBubble",0,[C.data.th.element.attr("id"),A("#tomnoddy-editfield").val(),C.data.th.element.attr("editable")])}A("#tomnoddy-editfield").remove();A(".tomnoddy-editfield-content").remove();var B=C.data.th.element;if(!B.attr("editable")){B=B.find("[editable]")}B.css("visibility",C.data.th.visibility)},emphysema:function(){var B=jQuery.Event("click");B.data={id:this.element.attr("id"),th:this};this.closeBubble(B)},itemClick:function(D){if(A(this).attr("id")!=A(D.target).attr("id")){return(false)}if(A("#tomnoddy-editfield").is("*")){A("#tomnoddy-editfield").blur()}if(D.data.th.delay){D.data.th.delay=false}else{if(!A("#tomnoddy-editfield").is("*")){var B=D.data.th.element;if(!B.attr("editable")){B=B.find("[editable]")}D.data.th.visibility=B.css("visibility");B.css("visibility","hidden");editfield=A("<textarea style='position: absolute; z-index: 1100;' class='ui-widget-content ui-corner-all' id='tomnoddy-editfield'>"+B.html()+"</textarea>");if(D.data.th.element.parents(".tomnoddy-bubble").is("*")){D.data.th.element.before(editfield);A(editfield).css("top","0");var C=A(D.data.th.element).parent().children(".label").width()+5;A(editfield).css("left",C);var F=D.data.th.element.width()-5;A(editfield).css("width",F);var E=D.data.th.element.height();A(editfield).css("maxHeight",(E>100)?E:100)}else{A("body").append(editfield);offset=D.data.th.element.offset();A(editfield).css("top",offset.top);A(editfield).css("left",offset.left);A(editfield).css("maxHeight",100)}A(editfield).elastic();D.data.th._trigger("editStart",0,D.data.th.element.attr("id"));A("#tomnoddy-editfield").focus();A("#tomnoddy-editfield").bind("blur",{th:D.data.th},D.data.th.editBlur)}}return(false)},itsADrag:function(B){B.data.th.element.unbind("mousemove",B.data.th.itsADrag);B.data.th.element.unbind("mouseup",B.data.th.closeBubble)},mouseDown:function(B){if(A(B.target).attr("bref")||A(B.target).parents("#ns-tabs-list").is("*")){B.data.th.element.bind("mouseup",{th:B.data.th},B.data.th.bubbleBlow);B.data.th.element.bind("mousemove",{th:B.data.th},B.data.th.itsADrag)}},tossEvent:function(B){B.stopPropagation()},rebind:function(){this.element.bind("mousedown",{th:this},this.mouseDown);this.element.bind("click",{th:this},this.tossEvent);this.delay=false},unbind:function(){this.element.unbind("mouseup",this.bubbleBlow);this.element.unbind("mousedown",this.mouseDown);this.element.unbind("click",this.tossEvent)},destroy:function(){this.element.unbind("mousedown",this.mouseDown);this.element.unbind("click",this.tossEvent)}})})(jQuery);var dotcal={calendar:{},ui:{},user:{}};dotcal.ui=new function(){this.facebookDefaultTextAreaText="Whats on your mind?";this.currentEventImages=[];this.jQueryUIStateDefault=null;this.jQueryUIStateHover=null;this.jQueryUIStateHighlight=null;this.jQueryUIStateActive=null;this.jQueryUIWidgetHeader=null;this.jQueryUIWidgetOverlay=null;this.tabs=[];this.setJQueryDOMConstaints=function(){var A=$("<div class=\"delMe\"></div>");A.hide();$("body").append(A);this.jQueryUIStateDefault=$("<div class=\"ui-state-default\"></div>").appendTo(A);this.jQueryUIStateHover=$("<div class=\"ui-state-hover\"></div>").appendTo(A);this.jQueryUIStateHighlight=$("<div class=\"ui-state-highlight\"></div>").appendTo(A);this.jQueryUIStateActive=$("<div class=\"ui-state-active\"></div>").appendTo(A);this.jQueryUIWidgetHeader=$("<div class=\"ui-widget-header\"></div>").appendTo(A);this.jQueryUIWidgetOverlay=$("<div class=\"ui-widget-overlay\"></div>").appendTo(A)};this.getEmbedCode=function(C,B){if(!B){B="cupertino"}var A="<!-- THEMED CALENDAR CODE START -->\n";A+="<!-- http://dotcal.com/embedded-calendar-widget-instructions -->\n";A+="<iframe src=\""+dotcal.ui.getEmbedLink(C,B)+"\" style=\"border: 0\" width=\"100%\" height=\"610\" frameborder=\"0\" scrolling=\"no\"></iframe>\n";A+="<a target=\"_blank\" href=\"http://dotcal.com\">Get a dotCal Calendar!</a>";A+="\n\n";A+="<!-- OPTIONAL MINI-LIST CALENDAR CODE START -->\n";A+="<iframe src=\""+dotcal.ui.getMiniEmbedLink(C,B)+"\" style=\"border: 0\" width=\"100%\" height=\"610\" frameborder=\"0\" scrolling=\"no\"></iframe>\n";A+="<a target=\"_blank\" href=\"http://dotcal.com\">Get a dotCal Calendar!</a>";return A};this.getEmbedLink=function(E,D){var A=dotcal.calendar.ticket.getTicketFromCollectionID(E,dotcal.calendar.ticket.permission.READ);var C=document.location.protocol+"//"+document.location.host;if(!D){D="cupertino"}var B=C+"/embed?u="+A+"&v=month&theme="+D;return B};this.getMiniEmbedLink=function(E,D){var A=dotcal.calendar.ticket.getTicketFromCollectionID(E,dotcal.calendar.ticket.permission.READ);var C=document.location.protocol+"//"+document.location.host;if(!D){D="cupertino"}var B=C+"/embed/mini?u="+A+"&v=month";return B};this.selectBox=function(A,B,E,C,J){var F="<select";if(E){F+=" id=\""+E+"\""}if(C){F+=" class=\""+C+"\""}if(J){F+=J}F+=">";for(var I in A){if(A.hasOwnProperty(I)){var G=I.split(/_/);var H="";for(var D=0;G.length>D;D++){H+=dotcal.string.capitalize(G[D].toLowerCase());if(G.length>1&&G.length!=D+1){H+=" "}}F+="<option value=\""+A[I]+"\"";if(B==A[I]){F+=" selected=selected"}F+=">"+H+"</option>"}}F+="</select>";return F};this.switchToMainPage=function(A){$(".mainPage:visible").hide();$("#"+A+"MainPage").show();$("#ns-new").removeClass("ui-state-active");$("#ns-mashup").removeClass("ui-state-active");$("#ns-share-from").removeClass("ui-state-active");$("#ns-share-into").removeClass("ui-state-active");$("#ns-sync-with").removeClass("ui-state-active");$("#ns-share").removeClass("ui-state-active");$("#ns-import").removeClass("ui-state-active");$("#ns-export").removeClass("ui-state-active");$("#ns-public").removeClass("ui-state-active");$("#ns-publish").removeClass("ui-state-active")};this.setHREFBlank=function(){$(".tomnoddy-bubble-scroll a[href], .listEventItem a[href]").attr("target","_blank");$(".outlookLink").attr("target","")}};dotcal.calendar=new function(){this.refreshCheckInterval=5000;this.types={MASHUP:"mashup",SUBSCRIPTION:"subscription",NORMAL:"normal",SEARCH:"search",DC_SYNC:"dotCal sync"};this.collections=[];this.currCollectionID=null;this.import_timers=[];this.fiscalYearStartTime=null;this.typeReadOnly=function(A){if(A==dotcal.calendar.types.NORMAL||A==dotcal.calendar.types.DC_SYNC){return false}else{return true}};this.drawFolderBubbleInsides=function(D,G){var F=dotcal.calendar.getCollectionByID(G);if(F===null){$("#"+G).tomnoddy("emphysema");return }var C="#bubble-"+G;var B=dotcal.calendar.event.setupBubble(D,G,"About This Calendar");$("<div class=\"component\"><span class=\"label\"><strong>Calendar Name</strong>:</span> "+dotcal.string.stripSlashes(F.title)+"<div class=\"clear\"></div></div>").appendTo(B);$("<div class=\"component\"><span class=\"label\"><strong>Calendar Type</strong>:</span> "+dotcal.string.capitalize(F.type)+"<div class=\"clear\"></div></div>").appendTo(B);if(F.categories.length>0){var A=dotcal.calendar.event.categories.getDisplayableCategoryList(F.categories);$("<div class=\"component\"><span class=\"label\"><strong>Categories</strong>:</span> "+A+"</div>").appendTo(B)}var E=$("<div class=\"component actions\"></div>").appendTo(B);$("<button name=\"ns-tab-close\" id=\"ns-tab-close\" collection_id=\""+G+"\" class=\"ui-state-default ui-corner-all\" title=\"Delete Calendar\" style=\"float: right;\">Delete Calendar</button>").appendTo(E);$("<button id=\"editCalendarProperties\" class=\"ui-state-default ui-corner-all\">Edit Calendar Settings</button>").appendTo(E);$(C+" #editCalendarProperties").bind("click",{id:G},dotcal.calendar.properties);$("<button name=\"ns-sync\" id=\"ns-sync\" class=\"ui-state-default ui-corner-all\" title=\"Refresh\">Refresh Calendar</button>").appendTo(E);$(C+" #ns-sync").bind("click",dotcal.calendar.syncCalendar);$(C+" #ns-tab-close").bind("click",function(H){$("#"+G).tomnoddy("emphysema");$("#tabby").tabs("closeTabManually",G,"tab-bar-0")})};this.properties=function(A){dotcal.calendar.render.unhighlightAreaButtons();$("#"+A.data.id).tomnoddy("emphysema");$("#calendar").hide();$(".content").hide();$("#newCalendarControls li a").removeClass("ui-corner-tl ui-corner-bl ui-state-active");$("#newCalendarControls li a").parent().hide();$("#newCalendarPanels div[name]").hide();$("#newCalendarPanels div.general").show();$("#events_file_upload").hide();$("#calCreateOK").show();$("#calErrors").empty().hide();$("#newCalFeedSelector").hide();$("#newCalURLField").hide();$("[name=\"newCalPerms\"]:first").attr("checked","1");$("#newCalendar .pageTitle").html("Edit Calendar properties");$("#newCalendar").show();$("#calDateArea #calDateDisplay").hide();$("#calDateArea .loadingSettings").show();$.post("/calendar/properties",{authenticity_token:window.AUTH_TOKEN,id:A.data.id},function(G){var B=JSON.parse(G,null);if($("li a[rel=\""+B.type+"\"]").attr("id")=="newDotcalICalURLCalendar"){$("li a[id=\"newDotcalICalURLCalendar\"]").parent().show();$("li a[id=\"newDotcalICalURLCalendar\"]").addClass("ui-state-active ui-corner-left")}else{$("li a[rel=\""+B.type+"\"]").parent().show();$("li a[rel=\""+B.type+"\"]").addClass("ui-state-active ui-corner-left")}switch(B.type){case"newBlankCalendar":break;case"newGoogleCalendar":$("#newCalFeedSelector").show();$("#newCalURLField").show();break;case"newYahooCalendar":$("#newCalFeedSelector").show();break;case"newYahooBetaCalendar":$("#newCalFeedSelector").show();$("#newCalURLField").show();break;case"newUpcomingCalendar":$("#newCalFeedSelector").show();$("#newCalURLField").show();break;case"newICalURLCalendar":$("#newCalFeedSelector").show();$("#newCalURLField").show();$("#newCalzone").show();break;case"newICalFileCalendar":$("#newCalzone").show();break;case"newMashupCalendar":$("#selectedCalendars").empty();var D=[];for(var C=0;C<B.mashup.length;C++){D[B.mashup[C]]=1}for(C=0;dotcal.ui.tabs.length>C;C++){var E=dotcal.ui.tabs[C];if(E.collection.type!=dotcal.calendar.types.MASHUP){var F="<input type=\"checkbox\" name=\""+E.id+"\"";if(D[E.id]){F+=" checked=\"1\""}F+=">"+E.title+"</input><br/>";$("#selectedCalendars").append(F)}}break;case"newSearchResultsCalendar":break}$("#newCalendarPanels div[name=\""+B.type+"\"]").show();$("#calName").val(dotcal.string.stripSlashes(B.name));$("#calIcon").val(B.icon);$("#userName").val(B.username);$("#newCalURL").val(B.source);$("#password").val(B.password);$("#retype").val(B.password);$("#calSearchTerms").val(B.search);switch(B.permission){case"private":$("[name=\"newCalPerms\"]:first").attr("checked","1");break;case"public":$("[name=\"newCalPerms\"]:last").attr("checked","1");break}if(B.collection_generic_type==dotcal.calendar.types.SUBSCRIPTION){$("[name=\"newCalFeed\"]:first").attr("checked","1")}else{$("[name=\"newCalFeed\"]:last").attr("checked","1")}if(B.scope===false){$("[name=\"newCalSearch\"]:first").attr("checked","1")}else{$("[name=\"newCalSearch\"]:last").attr("checked","1")}$("#calCreateCategory").empty();if(B.categories.length>0){for(C=0;C<B.categories.length;C++){dotcal.calendar.drawCategoryBox($("#calCreateCategory"),B.categories[C].name)}}else{dotcal.calendar.drawCategoryBox($("#calCreateCategory"),"")}$("#calCreateCategory span button").click(function(){$(this).parent().remove()});if(B.error){$("#calErrors").show();$("#calErrors").append(B.error)}$("#newCalTimeZone_timezone").find("option[value=\""+B.zone+"\"]").attr("selected","1");$("#calDateArea #calDateDisplay").show();$("#calDateArea .loadingSettings").hide();$("#calSettingsUID").val(A.data.id);dotcal.ui.switchToMainPage("panels")})};this.drawCategoryBox=function(A,C){var E=$("<span></span>");E.appendTo(A);var D=$("<input type=\"text\" name=\"newCategory\" class=\"calCategoryInput ui-widget-content ui-corner-all\" value=\""+C+"\"/>").appendTo(E);var B=$("<span style=\"margin-top: -1em; margin-bottom:1.4em;\"></span>").appendTo(E);$("<button name=\"newCategoryRemove\" class=\"ui-state-default ui-corner-all\">Remove</button>").appendTo(E);D.autocomplete(dotcal.calendar.event.categories.categories,{multiple:false,mustMatch:false,autoFill:false,matchContains:"word",itemClass:"ui-state-default",hoverClass:"ui-state-hover",resultsClass:"ac_results",append:B});$("<br/>").appendTo(A)};this.parseCollectionForUse=function(B){var A=JSON.parse(B,null);return this.populateCollectionFromJSONParsing(A)};this.populateCollectionFromJSONParsing=function(A){var B=dotcal.calendar.event.parseEvents(A.events,A.id);var C=this.getNewCollectionHash();C.events=B;C.author=A.author;C.title=A.title;C.icon_uri=A.icon_uri;C.id=A.id;C.tickets=dotcal.calendar.parseTicketsFromJSON(A.tickets);C.type=A.type;C.categories=A.categories;C.mashup_sources=A.mashup_sources;C.polling_range=A.polling_range;C.polling_range.start=dotcal.calendar.date.fromISO8601Date(C.polling_range.start);C.polling_range.end=dotcal.calendar.date.fromISO8601Date(C.polling_range.end);C.polling_range.updated=dotcal.calendar.date.fromISO8601Date(C.polling_range.updated);return C};this.getNewCollectionHash=function(){return{id:null,title:null,event_color:null,icon_url:null,tickets:[],events:[],mashup_sources:[]}};this.getCurrentCollection=function(){for(var A in this.collections){if(this.collections[A].id==this.currCollectionID){return this.collections[A]}}return false};this.updateEventsInCollection=function(F,E){var G=this.getCollectionByID(F);var C=false;var A=E.length;for(var D=0;G.events.length>D;D++){C=false;for(var B=0;E.length>B;B++){if(A!=1&&G.events[D].id.search(E[B].id)!=-1&&G.events[D].id.search(/_/)!=-1){C=true}if(!C&&G.events[D].id==E[B].id){C=true}}if(!C){E.push(G.events[D])}}dotcal.calendar.event.sortEventsByStartDate(E);G.events=[];G.events=E;return G};this.getCollectionByID=function(C){var B=dotcal.calendar.collections;for(var D in B){if(B[D].id==C){return B[D]}}for(D in B){if(B[D].mashup_sources.length>0){for(var A in B[D].mashup_sources){if(B[D].mashup_sources[A].id==C){return B[D].mashup_sources[A]}}}}return null};this.removeCollectionByID=function(E){var D=dotcal.calendar.collections;var F=[];var A=[];for(var G in D){if(D[G].id!=E){F.push(D[G])}}if(E==dotcal.calendar.currCollectionID){dotcal.calendar.currCollectionID=null}for(var B=0;dotcal.ui.tabs.length>B;B++){var C=dotcal.ui.tabs[B];if(C.id!=E){A.push(C)}}dotcal.calendar.collections=F;dotcal.ui.tabs=A};this.dropAllCollectionsButCurrent=function(){if(this.currCollectionID===null){return false}var A=this.getCollectionByID(this.currCollectionID);A.event_color=dotcal.calendar.render.tab_colors[0];dotcal.calendar.collections=[];dotcal.calendar.collections.push(A);$("#tabby").tabs("setTab",dotcal.calendar.render.baseCalendarTabBarID,A.id,true);dotcal.calendar.render.getCollectionAndDrawEvents(this.currentCollectionID)};this.anyEventsForCollections=function(A){if(!A){return false}if(A.events.length>0){return true}return false};this.getCollectionFromEvents=function(A){var B=this.getNewCollectionHash();B.events=A;return B};this.updateCalendar=function(C,F){var B=F[0];var D=F[1];var A=F[2];var E=dotcal.calendar.getCollectionByID(B);E[A]=D;$.post("/calendar/update_collection",{authenticity_token:window.AUTH_TOKEN,collection:JSON.stringify(E,null)},function(G){if(A=="title"){$("#"+B).children("#ns-tab-label").html(D)}})};this.syncCalendar=function(){dotcal.calendar.render.showLoading(true,"Refreshing Calendar...",null);$("#"+dotcal.calendar.render.baseCalendarTabBarID).find("#ns-tabs-list .ui-tabs-selected").each(function(){var A=$(this).attr("id");$.post("/calendar/sync",{authenticity_token:window.AUTH_TOKEN,calendar_id:A},function(C){var B=JSON.parse(C,null);if(B.syncing){$("#tabby").tabs("icon",B.id,"/stylesheets/dotcal/images/ajax-loader.gif");dotcal.calendar.import_timers[A]=setTimeout(function(){dotcal.calendar.firstTimeFeed(A);dotcal.calendar.render.showLoading(false,null,dotcal.calendar.views.currDate)},dotcal.calendar.refreshCheckInterval)}else{dotcal.calendar.render.showLoading(false,null,dotcal.calendar.views.currDate)}})})};this.deleteCalendar=function(A){if(dotcal.calendar.import_timers[A]){clearTimeout(dotcal.calendar.import_timers[A]);dotcal.calendar.import_timers=dotcal.calendar.import_timers.splice(A,1)}$.post("/calendar/delete",{authenticity_token:window.AUTH_TOKEN,collectionID:A},function(B){dotcal.calendar.removeCollectionByID(A)})};this.parseTicketsFromJSON=function(C){var A=[];for(var B in C){if(C.hasOwnProperty(B)){A.push(C[B])}}return A};this.firstTimeFeed=function(A){dotcal.calendar.import_timers=dotcal.calendar.import_timers.splice(A,1);dotcal.calendar.render.getCollectionAndDrawEvents(A);$.post("/calendar/reading",{authenticity_token:window.AUTH_TOKEN,calendar_id:A},function(C){var B=JSON.parse(C,null);if(B.uri){$("#tabby").tabs("icon",A,B.uri)}else{dotcal.calendar.import_timers[A]=setTimeout(function(){dotcal.calendar.firstTimeFeed(A)},dotcal.calendar.refreshCheckInterval)}})};this.handleNewCalendarCreation=function(A){if(dotcal.calendar.render.multiView===false){for(var B=0;dotcal.ui.tabs.length>B;B++){dotcal.ui.tabs[B].state="off"}}A.state="on";A.collection=A;dotcal.ui.tabs.push(A);$("tabby").tabs("option","multiView",false);$("#tabby").tabs("addTab","tab-bar-0",A.icon_uri,dotcal.string.stripSlashes(A.title),A.id,"on",true,A.type);dotcal.calendar.render.render();dotcal.calendar.render.getCollectionAndDrawEvents(A.id)};this.iCalendarWebcalURL=function(D,F){var B=dotcal.calendar.getTicketFromCollectionID(D,dotcal.calendar.ticket.permission.READ);var A=window.cosmo_url;var E=dotcal.string.webcalifyURL(A);var C=E+"webcal/collection/"+D+"?ticket="+B;return C+"?client="+F}};dotcal.string=new function(){this.capitalize=function(A){return A.substr(0,1).toUpperCase()+A.substr(1)};this.lpad=function(D,C,B){var A=D;while(A.length<B){A=C+A}return A};this.trim=function(A){return A.replace(/^[\n\t ]+/,"").replace(/[\n\t ]+$/,"")};this.collapseWhitespace=function(A){return A.replace(/[\t\n ]+/g," ")};this.replaceString=function(A){A=A.replace(/\&amp;/g,"&");A=A.replace(/\&lt;/g,"<");A=A.replace(/\&gt;/g,">");A=A.replace(/\&quot;/g,"\"");A=A.replace(/\\n/g,"\n");A=A.replace(/\\,/g,",");A=A.replace(/\\;/g,";");return A};this.escapeHTMLChars=function(A){return A.replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/&/g,"&amp;")};this.cleanString=function(A){A=A.replace(/"/g,"&quot;");return A};this.translateTextToSafeHTML=function(A){A=A.replace(/\n/g,"<br/>");return A};this.nl2br=function(A){var B=A;A=escape(A);if(A.indexOf("%0D%0A")>-1){re_nlchar=/%0D%0A/g}else{if(A.indexOf("%0A")>-1){re_nlchar=/%0A/g}else{if(A.indexOf("%0D")>-1){re_nlchar=/%0D/g}else{return B}}}return unescape(A.replace(re_nlchar,"<br />"))};this.webcalifyURL=function(A){var B=A.replace(/^https/,"webcal");B=B.replace(/^http/,"webcal");return B};this.stripContactName=function(A){A=A.replace(/\"/g,"");A=A.replace(/\'/g,"");return A};this.stripEmail=function(A){A=A.replace(/</g,"");A=A.replace(/>/g,"");return A};this.stripSlashes=function(A){A=A.replace(/\\'/g,"'");A=A.replace(/\\"/g,"\"");A=A.replace(/\\0/g,"\x00");A=A.replace(/\\\\/g,"\\");return A};this.isUrl=function(A){return A.match(/^(ht|f)tps?:\/\/[a-z0-9-\.]+\.[a-z]{2,4}\/?([^\s<>\#%"\,\{\}\\|\\\^\[\]`]+)?$/)}};dotcal.calendar.ticket=new function(){this.permission={READ:"read",WRITE:"write"};this.getTicketFromCollectionID=function(C,A){var F=dotcal.calendar.getCollectionByID(C);var D=null;for(var B=0;B<F.tickets.length;B++){var E=F.tickets[B];if(E.permission==A){D=E.unique}}return D}};dotcal.calendar.event=new function(){this.alarmTimes={NONE:"null",AT_EVENT_START:"-PT0S",FIVE_MINUTES_BEFORE:"-PT5M",TEN_MINUTES_BEFORE:"-PT10M",FIFTEEN_MINUTES_BEFORE:"-PT15M",THIRTY_MINUTES_BEFORE:"-PT30M",FOURTY_FIVE_MINUTES_BEFORE:"-PT45M",ONE_HOUR_BEFORE:"-PT1H",TWO_HOURS_BEFORE:"-PT2H",FIVE_HOURS_BEFORE:"-PT5H",FIFTEEN_HOURS_BEFORE:"-PT15H",ONE_DAY_BEFORE:"-P1D",TWO_DAYS_BEFORE:"-P2D",ONE_WEEK_BEFORE:"-P7D"};this.alarmTypes={EMAIL:"EMAIL",DISPLAY:"SHARETOP",SMS:"SMS",TWITTER:"TWITTER"};this.sendInvitationTo={EVERYONE:"EVERYONE",HAVENOTRESPONDED:"HAVENOTRESPONDED",JUSTADDED:"JUSTADDED"};this.defaultAlarmTypeIfNoneExists="EMAIL";this.parseEvents=function(B){var A=[];var D={};for(var E in B){if(B.hasOwnProperty(E)){var C=B[E];D=this.parseEventForUse(C);A.push(D)}}this.sortEventsByStartDate(A);return A};this.sortEventsByStartDate=function(A){A.sort(function(C,B){if(C.dtstart.getTime()>B.dtstart.getTime()){return 1}else{return -1}})};this.parseEventForUse=function(A){A.dtstart=dotcal.calendar.date.fromISO8601Date(A.dtstart);A.dtend=dotcal.calendar.date.fromISO8601Duration(A.duration,A.dtstart);A.id=dotcal.calendar.event.makeIDSafeForDOM(A.id);if(!A.location||A.location=="null"){A.location=""}if(!A.body||A.body=="null"){A.body=""}else{A.body=dotcal.string.replaceString(A.body)}if(A.summary){A.summary=dotcal.string.replaceString(A.summary)}if(A.venue){A.venue=dotcal.string.replaceString(A.venue)}if(!A.location||A.location=="null"){A.location=""}else{A.location=dotcal.string.replaceString(A.location)}if(!A.timezone||A.timezone=="null"){A.timezone=""}if(!A.url||A.url=="null"){A.url=""}if(!A.venue||A.venue=="null"){A.venue=""}A.invitation.rsvps=[];return A};this.makeIDSafeForDOM=function(A){A=A.replace(/@/g,"-AT-");A=A.replace(/\./g,"-DOT-");A=A.replace(/\//g,"-FSL-");A=A.replace(/:/g,"-COLN-");A=A.replace(/\[/g,"-LBRACKET-");A=A.replace(/\]/g,"-RBRACKET-");A=A.replace(/,/g,"-CMA-");A=A.replace(/\\/g,"-BSLH-");return A};this.makeIDCorrect=function(A){A=A.replace(/-AT-/g,"@");A=A.replace(/-DOT-/g,".");A=A.replace(/-FSL-/g,"/");A=A.replace(/-COLN-/g,":");A=A.replace(/-LBRACKET-/g,"[");A=A.replace(/-RBRACKET-/g,"]");A=A.replace(/-CMA-/g,",");A=A.replace(/-BSLH-/g,"\\");return A};this.parseEventToShipBack=function(D){var B={};for(var A in D){if(D.hasOwnProperty(A)){B[A]=D[A]}}B.id=dotcal.calendar.event.makeIDCorrect(B.id);if(B.duration!="P1D"){B.duration=dotcal.calendar.date.parseDateForICalDuration(B.dtstart,B.dtend)}B.dtstart=dotcal.calendar.date.toISO8601DateCosmo(B.dtstart);for(var C=0;B.alarms.length>C;C++){if(B.alarms[C].time!=dotcal.calendar.event.alarmTimes.NONE){B.alarms[C].sent=dotcal.calendar.date.fromISO8601Duration(B.alarms[C].time,D.dtstart);B.alarms[C].sent=dotcal.calendar.date.toISO8601DateCosmo(B.alarms[C].sent)}else{B.alarms[C].sent="null";B.alarms[C].alarm_type="null"}}return B};this.mashEventLists=function(F,E){var D=F.concat(E);var C=[];o:for(var B=0,H=D.length;B<H;B++){for(var A=0,G=C.length;A<G;A++){if(C[A].id==D[B].id){continue o}}C[C.length]=D[B]}this.sortEventsByStartDate(C);return C};this.addGuestToEvent=function(D,A){var C=true;for(var B=0;D.invitation.guests.length>B;B++){if((D.invitation.guests[B].id&&D.invitation.guests[B].id==A.id)||D.invitation.guests[B].vaddress==A.vaddress){C=false}}if(C){D.invitation.guests.push(A)}};this.updateEventsForCollectionID=function(C,B){var A=0;if(B.length==1){dotcal.calendar.views[dotcal.calendar.views.currMode][dotcal.calendar.views.currView].rePopulateCell(B[0].dtstart,dotcal.calendar.getCollectionByID(B[0].collection_id))}else{var D=dotcal.calendar.getCollectionByID(C);dotcal.calendar.views[dotcal.calendar.views.currMode][dotcal.calendar.views.currView].unpopulate();if(dotcal.calendar.render.multiView){dotcal.calendar.views.box.month.monthWeeks=[];for(A=0;dotcal.calendar.collections.length>A;A++){dotcal.calendar.views[dotcal.calendar.views.currMode][dotcal.calendar.views.currView].populate(dotcal.calendar.views.currDate,dotcal.calendar.collections[A],dotcal.calendar.render.multiView)}}else{dotcal.calendar.views[dotcal.calendar.views.currMode][dotcal.calendar.views.currView].populate(dotcal.calendar.views.currDate,D,dotcal.calendar.render.multiView)}}for(A=0;dotcal.calendar.collections.length>A;A++){if(dotcal.calendar.render.multiView){$("*[collection="+dotcal.calendar.collections[A].id+"]").css("background",dotcal.calendar.collections[A].event_color)}}};this.drawReadOnlyEventBubbleInsides=function(N,K){var G=$("#"+K).attr("event_id");var D="#bubble-"+K;var B=$(D).children().children().children(".tomnoddy-bubble-header").children(".tomnoddy-bubble-header-label");var E=$(D).children().children().children(".tomnoddy-bubble-scroll");var R=$(D).children().children().children(".tomnoddy-bubble-footer");var P=dotcal.calendar.event.getFullEventByID(G);$(D).addClass("tomnoddy-bubble-detail");var J="";if(P.timezone){J="("+P.timezone+")"}$("<strong>"+dotcal.calendar.date.getFormattedLongDate(P.dtstart)+" "+J+"</strong>").appendTo($(B));$("<a href=\""+dotcal.calendar.event.getEventLandingPageURL(P)+"\" class=\"button ui-state-default ui-corner-all\" style=\"float: right; text-align: center; margin-right: 10px;\">Event Sharing<br />Page</a>").appendTo(E);$("<div class=\"component title\"><strong>Title</strong>: "+dotcal.string.replaceString(dotcal.string.cleanString(P.summary))+"</div>").appendTo(E);if(P.duration=="P1D"){$("<div class=\"component start\"><strong>This Event Happens All Day</strong></div><div class=\"component end\">&nbsp;</div>").appendTo(E)}else{$("<div class=\"component start\"><strong>Start</strong>: "+dotcal.calendar.date.getFormattedHour(P.dtstart)+"</div>").appendTo(E);$("<div class=\"component end\"><strong>End</strong>: "+dotcal.calendar.date.getFormattedHour(P.dtend)+"</div>").appendTo(E)}if(P.venue){$("<div class=\"component place\"><strong>Place</strong>: "+dotcal.string.translateTextToSafeHTML(P.venue)+"</div>").appendTo(E)}if(P.location){var C="http://maps.google.com/?q="+encodeURIComponent(P.location);var Q=P.location+" <a href=\""+C+"\" target=\"_blank\">(<strong>map</strong>)</a>";var A=Q;$("<div class=\"component location\"><strong>The Address</strong>: "+A+"</div>").appendTo(E)}if(P.r_freq){var I=dotcal.string.capitalize(P.r_freq.toLowerCase());$("<div class=\"component recurrence\"><strong>Happens</strong>: "+I+"</div>").appendTo(E)}if(P.url){var F="<a href=\""+P.url+"\">"+P.url+"</a>";$("<div class=\"component url\"><strong>Website</strong>: "+F+"</div>").appendTo(E)}if(P.categories.length>0){var L=dotcal.calendar.event.categories.getDisplayableCategoryList(P.categories);$("<div class=\"component description\"><strong>Categories</strong>: "+L+"</div>").appendTo(E)}var M="No description provided.";if(P.body){M=dotcal.string.replaceString(dotcal.string.translateTextToSafeHTML(P.body))}$("<div class=\"component description\"><strong>Description</strong>: "+M+"</div>").appendTo(E);var H=$("<div class=\"subscribe\"><span class=\"txt\">Add this event to my:</span></div>");$(R).append(H);var O=$("<div class=\"subscribe\" style=\"margin-top: 5px;\"><span class=\"txt\">Share with my Friends:</span></div>");$(R).append(O);dotcal.calendar.event.attachSharingToDOMNode(H,P);dotcal.calendar.event.attachSocialNetworksToDOMNode(O,P);dotcal.ui.setHREFBlank()};this.drawEventBubbleInsides=function(Z,S){var H=$("#"+S).attr("event_id");var D="#bubble-"+S;var O=$(D);var B=$(D).children().children().children(".tomnoddy-bubble-header");var F=$(D).children().children().children(".tomnoddy-bubble-scroll");var g=$(D).children().children().children(".tomnoddy-bubble-footer");var b=dotcal.calendar.event.getFullEventByID(H);$(D).addClass("tomnoddy-bubble-detail");var P=false;if(b.duration=="P1D"){P=true}if(b.parent_event_id&&b.parent_event_id!=b.id){var X=$("<button id='occ_del_"+b.id+"' event_id='"+b.id+"' collection_id='"+b.collection_id+"' title='Delete just this instance from the repeating series' class='tomnoddy-bubble-delete ui-state-error ui-corner-all' style='float: left;' alt='Delete this event'>Delete This</button>");$(B).prepend(X);X.click(function(){if(confirm("Do you want to delete this event instance?")){dotcal.calendar.render.showLoading(true,"Updating Event...");var i=dotcal.calendar.event.getFullEventByID($(this).attr("event_id"));var h={};h.tzid=i.timezone;h.time=dotcal.calendar.date.toISO8601DateCosmo(i.dtstart);dotcal.calendar.event.updateEventProperty(i,"exdates",h)}})}var K=S+"-bubble-trash";$(B).prepend("<button  id='"+K+"' collection_id='"+b.collection_id+"' title='Delete this event' class='tomnoddy-bubble-delete ui-state-error ui-corner-all' style='float: left;' alt='Delete this event'>Delete</button>");if(b.parent_event_id){$("#"+S+"-bubble-trash").attr("title","Delete all events");$("#"+S+"-bubble-trash").text("Delete All");$(B).prepend("<span style=\"float: left; margin: 0.2em 0.5em 0 0;\">(R)</span>")}var L="";if(b.timezone){L="("+b.timezone+")"}$("<strong>"+dotcal.calendar.date.getFormattedShortDate(b.dtstart)+" "+L+"</strong>").appendTo($(B).children(".tomnoddy-bubble-header-label"));$("#"+K).hover(function(){$(this).addClass("ui-state-hover")},function(){$(this).removeClass("ui-state-hover")});$("#bubble-"+S+" .tomnoddy-bubble-header .noBorder").hover(function(){$(this).addClass("border ui-state-hover")},function(){$(this).removeClass("border ui-state-hover")});$("#"+K).click(function(){if(confirm("Do you want to delete this event?")){dotcal.calendar.event.deleteEvent(S,$(this).attr("collection_id"))}});if(dotcal.calendar.render.multiView){var A=$("<div class=\"component message ui-state-highlight ui-corner-all\"><span class=\"label clearfix\"><span style=\"float: right;\"><strong>Which calendar</strong>:</span><span class=\"ui-icon ui-icon-info\" style=\"float: right; margin-right: 5px;\"></span></span></div>").appendTo(F);var d={};for(var a=0;dotcal.calendar.collections.length>a;a++){if(!dotcal.calendar.typeReadOnly(dotcal.calendar.collections[a].type)){d[dotcal.calendar.collections[a].title]=dotcal.calendar.collections[a].id}}var U=dotcal.ui.selectBox(d,b.collection_id,null,"eventCollectionSelect","event_id=\""+b.id+"\"");var E=$(U);E.appendTo(A);$(".eventCollectionSelect").change(function(){var i=$(this).attr("event_id");var h=$(this).val();var j=dotcal.calendar.event.getFullEventByID(i);if(j.collection_id==h){return }dotcal.calendar.event.moveEventToCollection(j.id,j.collection_id,h)})}dotcal.calendar.event.createBubbleEditableDIV(b.summary,"summary","Title",O,F,H,false);$("<div class=\"component clearfix\"><span class=\"label\"><strong>All Day</strong>:</span><input type=\"checkbox\" event_id=\""+b.id+"\" id=\""+b.id+"_allday\" updatetext=\"no\"/></div>").appendTo(F);var W=$("#"+b.id+"_allday");W.bind("click",function(k){var j=$(this).attr("event_id");var i=dotcal.calendar.event.getFullEventByID(j);i.dtstart=new Date(i.dtstart.getFullYear(),i.dtstart.getMonth(),i.dtstart.getDate());i.dtend=new Date(i.dtstart);var h=[];h.push(j+"_allday");if($(this).attr("checked")){h.push("P1D");i.dtend.setDate(i.dtend.getDate()+1);$("#"+j+"_start_time").hide();$("#"+j+"_end_time").hide()}else{h.push("PT1H");i.dtend.setHours(i.dtend.getHours()+1);$("#"+j+"_start_time").show();$("#"+j+"_end_time").show()}h.push("duration");dotcal.calendar.event.updateEvent("",h)});$("<div class=\"editable-container datePickerTarget\" style=\"position: relative; overflow: visible;\"></div>").appendTo(F);var R=$("<div id=\""+b.id+"_start_time\" class=\"editable-container component\"><span class=\"label\"><strong>Start Time</strong>:</span></div>").appendTo(F);var T=$("<span class=\"time_select_div\"></span>").appendTo(R);var N=$("<input id=\""+b.id+"_dtstart_select\" type=\"text\" event_id=\""+b.id+"\" updatetext=\"no\" event_property=\"dtstart\" class=\"ui-widget-content ui-corner-all\" size=\"7\" value=\""+dotcal.calendar.date.getFormattedHour(b.dtstart)+"\"/>").appendTo(T);N.timeselect({onSelect:dotcal.calendar.event.timeSelect});$(" <strong style=\"margin-left: 5px;\">Date</strong>: <span id=\""+b.id+"_dtstart_datepicker-div\" style=\"position: relative;\"><input id=\""+b.id+"_dtstart_datepicker\" event_id=\""+b.id+"\" event_property=\"dtstart\" type=\"text\" updatetext=\"no\" value=\""+dotcal.calendar.date.getDatePickerFormattedDate(b.dtstart)+"\" class=\"ui-widget-content ui-corner-all\" size=\"10\"/></span>").appendTo(R);$("<div class=\"clear\"></div>").appendTo(R);var C=$("<div id=\""+b.id+"_end_time\" class=\"editable-container component\"><span class=\"label\"><strong>End Time</strong>:</span> </div>").appendTo(F);var Q=$("<span class=\"time_select_div\"></span>").appendTo(C);var c=$("<input id=\""+b.id+"_dtend_select\" type=\"text\" event_id=\""+b.id+"\" updatetext=\"no\" event_property=\"dtend\" class=\"ui-widget-content ui-corner-all\" size=\"7\" value=\""+dotcal.calendar.date.getFormattedHour(b.dtend)+"\"/>").appendTo(Q);c.timeselect({onSelect:dotcal.calendar.event.timeSelect});$(" <strong style=\"margin-left: 5px;\">Date</strong>: <span id=\""+b.id+"_dtend_datepicker-div\" style=\"position: relative;\"><input id=\""+b.id+"_dtend_datepicker\" event_id=\""+b.id+"\" event_property=\"dtend\" type=\"text\" updatetext=\"no\" value=\""+dotcal.calendar.date.getDatePickerFormattedDate(b.dtend)+"\" class=\"ui-widget-content ui-corner-all\" size=\"10\"/></span>").appendTo(C);$("<div class=\"clear\"></div>").appendTo(C);if(P){R.hide();C.hide();W.attr("checked","checked")}var I="<div class=\"component actions\" style=\"z-index: 30;\">";I+="<span class=\"label\"><strong></strong>&nbsp;</span>";I+="<span class=\"bubbleBlowStart\"><button id=\"recurrence-"+b.id+"\" event_id=\""+b.id+"\" bref=\"&nbsp;\" class=\"ui-state-default ui-corner-all withIconLeft\"><span class=\"ui-icon ui-icon-calendar\"></span>Recurrence</button></span>";I+=" - <span class=\"bubbleBlowStart\"><button id=\"categories-"+b.id+"\" event_id=\""+b.id+"\" bref=\"&nbsp;\" class=\"ui-state-default ui-corner-all withIconLeft\"><span class=\"ui-icon ui-icon-pin-s\"></span>Categories</button></span>";I+="</div>";$(I).appendTo(F);$("#recurrence-"+b.id).tomnoddy({blowBubble:dotcal.calendar.event.recurrence.drawRecurrenceBubbleInsides});$("#categories-"+b.id).tomnoddy({blowBubble:dotcal.calendar.event.categories.drawCategoryBubbleInsides});dotcal.calendar.event.attachDateChangeToDatePicker($("#"+b.id+"_dtstart_datepicker"),".datePickerTarget");dotcal.calendar.event.attachDateChangeToDatePicker($("#"+b.id+"_dtend_datepicker"),".datePickerTarget");dotcal.calendar.event.createBubbleEditableDIV(b.url,"url","URL",O,F,H,false);dotcal.calendar.event.createBubbleEditableDIV(b.venue,"venue","Place",O,F,H,false);dotcal.calendar.event.createBubbleEditableDIV(b.location,"location","The Address",O,F,H,false);$("#bid-"+b.id+"_location").css("width","300px");$("#theaddress").children(".clear").remove();$("<span id=\"location_link_span\"><a id=\"location_link\" href=\"\" target=\"_blank\"><strong>(Map)</strong></a></span><div class=\"clear\"></div>").appendTo("#theaddress");if(b.location){$("#location_link_span").show();var V="http://maps.google.com/?q="+encodeURIComponent(b.location);$("#location_link").attr("href",V)}dotcal.calendar.event.createBubbleEditableDIV(b.body,"body","Description",O,F,H,true);$("#description .label").after("<span class=\"label\"><a target=\"_blank\" href=\""+dotcal.calendar.event.getEventLandingPageURL(b)+"\" class=\"buttonBig ui-state-default ui-corner-all\">Event Sharing Page</a></span>");var M=$("<div class=\"component actions\"></div>");M.appendTo(F);var J=$("<span style=\"float: right; position: relative;\"><button id=\"tweet-button-"+b.id+"\" event_id=\""+b.id+"\" title=\"Tweet This Event\" class=\"withIconLeft ui-state-default ui-corner-all\"><img src=\"/stylesheets/dotcal/images/calendar_buttons/twitterbutton.png\" class=\"png icon\" width=\"20\" height=\"20\" alt=\"\" style=\"margin-top: -10px;\" />Tweet This Event&nbsp;</button></span>").appendTo(M);if(!dotcal.user.currUser.twitter_support){J.addClass("ui-state-disabled")}else{J.removeClass("ui-state-disabled");$("#tweet-button-"+b.id).bind("click",function(h){var i=dotcal.calendar.event.getFullEventByID($(this).attr("event_id"));var j=i.tickets[0].unique;$.post("/event/tweet_event",{authenticity_token:window.AUTH_TOKEN,f:i.ical_file,u:j},function(e){alert(i.summary+" has been tweeted!")})})}var G=$("<span class=\"bubbleBlowStart\" style=\"float: right; position: relative;\"><button id=\"facebook-"+b.id+"\" event_id=\""+b.id+"\" bref=\"&nbsp;\" class=\"ui-state-default ui-corner-all withIconLeft\"><img src=\"/stylesheets/dotcal/images/calendar_buttons/facebookbutton.png\" width=\"20\" height=\"20\" border=\"0\" class=\"icon png\" style=\"margin-top: -10px;\" />Facebook this Event</button></span>").appendTo(M);$("#facebook-"+b.id).tomnoddy({blowBubble:dotcal.calendar.event.drawFacebookBubbleInsides});var Y=$("<span class=\"bubbleBlowStart\"></span>").appendTo(M);$("<button id=\"invite-"+b.id+"\" event_id=\""+b.id+"\" bref=\"&nbsp;\" class=\"ui-state-default ui-corner-all withIconLeft\"><span class=\"ui-icon ui-icon-mail-open\"></span>Invites</button>").appendTo(Y);$("#invite-"+b.id).tomnoddy({blowBubble:dotcal.calendar.event.drawInviteBubbleInsides});$("<span class=\"bubbleBlowStart\"><button class=\"ui-state-default ui-corner-all withIconLeft\" id=\"alert-"+b.id+"\" event_id=\""+b.id+"\" bref=\"&nbsp;\"><span class=\"ui-icon ui-icon-clock\"></span>Alerts</button></span>").appendTo(M);$("<div class=\"clear\"></div>").appendTo(M);$("#alert-"+b.id).tomnoddy({blowBubble:dotcal.calendar.event.drawAlarmBubbleInsides})};this.timeSelect=function(E,D){var G=dotcal.calendar.event.getFullEventByID($(this).attr("event_id"));var B=$(this).attr("event_property");var H=$(this).attr("id");if(D){var F=new Date(G[B].getFullYear(),G[B].getMonth(),G[B].getDate(),D.getHours(),D.getMinutes(),0);if(B=="dtstart"){var A=dotcal.calendar.date.parseDateForICalDuration(G.dtstart,G.dtend);G.dtend=dotcal.calendar.date.fromISO8601Duration(A,F)}var C=[];C.push(H);C.push(F);C.push(B);dotcal.calendar.event.updateEvent("",C)}else{D=G[B]}$(this).val(dotcal.calendar.date.getFormattedHour(D))};this.setupBubble=function(E,G,F){var D="#bubble-"+G;var C=$(D).children().children().children(".tomnoddy-bubble-header");var A=$(D).children().children().children(".tomnoddy-bubble-scroll");var B=$(D).children().children().children(".tomnoddy-bubble-footer");$(D).addClass("tomnoddy-bubble-content");$("<strong>"+F+"</strong>").appendTo($(C).children(".tomnoddy-bubble-header-label"));return A};this.drawInviteBubbleInsides=function(A,B){var E=dotcal.calendar.event.getFullEventByID($("#"+B).attr("event_id"));var I=dotcal.calendar.event.setupBubble(A,B,"Invitations for "+E.summary);var K=E.invitation.total_going+E.invitation.total_maybe_going+E.invitation.total_not_going;var D=dotcal.calendar.event.getEventLandingPageURL(E)+"&ss="+window.session_secret;var G=$("<div id=\"attendance\" class=\"component\"></div>").appendTo(I);$("<strong>Attendance:</strong><br />").appendTo(G);$("<p><strong>"+K+" of "+E.invitation.total_invited+"</strong> people have responded to this invitation.</p>").appendTo(G);$("<a id=\"view_guest_list\" href=\""+D+"\" target=\"_blank\" class=\"button ui-state-default ui-corner-all\" style=\"float: right; position: relative; top: -0.5em;\">View Guest Responses</a>").appendTo(G);$("<p>[ <strong>Yes</strong>: <span class=\"ui-state-confirm ui-corner-all\" style=\"padding: 0.2em 0.5em;\">"+E.invitation.total_going+"</span>, <strong>No</strong>: <span class=\"ui-state-error ui-corner-all\" style=\"padding: 0.2em 0.5em;\">"+E.invitation.total_not_going+"</span>, <strong>Maybe</strong>: <span class=\"ui-state-highlight ui-corner-all\" style=\"padding: 0.2em 0.5em;\">"+E.invitation.total_maybe_going+"</span> ]</p>").appendTo(G);var H=$("<div id=\"people\" class=\"component\"></div>").appendTo(I);$("<strong>Guests</strong>:<br/><span style=\"font-size: 0.92em;\">Enter using: First Name Last Name Email,</span><br />").appendTo(H);$("<textarea id=\""+E.id+"_guests\" event_id=\""+E.id+"\" class=\"ac_input ui-widget-content ui-corner-all\" rows=\"5\" style=\"width: 98%;\" autocomplete=\"off\"/><br />").appendTo(H);var C="";if(E.invitation.email_rsvp_updates){C="checked=checked"}var F=$("<p>I want to be notified when people respond to the invitation: </p>");F.appendTo(I);var J=$("<input type=\"checkbox\" id=\""+E.id+"_invitation_email_response\" "+C+" event_id=\""+E.id+"\" updatetext=\"no\"/>");J.appendTo(F);J.change(function(){var M=dotcal.calendar.event.getFullEventByID($(this).attr("event_id"));var L=false;if($(this).attr("checked")){L=true}M.invitation.email_rsvp_updates=L;dotcal.calendar.event.updateEventInvitation(M)});$("<p>Send To: <input type=\"radio\" name=\"all_guests\" value=\""+dotcal.calendar.event.sendInvitationTo.EVERYONE+"\"> Everyone <input type=\"radio\" name=\"all_guests\" value=\""+dotcal.calendar.event.sendInvitationTo.HAVENOTRESPONDED+"\"> People that have yet to respond <input type=\"radio\" name=\"all_guests\" value=\""+dotcal.calendar.event.sendInvitationTo.JUSTADDED+"\" checked> People I just added</p>").appendTo(I);$("<div class=\"actions\"><button id=\""+E.id+"_send_invitation\" event_id=\""+E.id+"\" title=\"Send Invitations\" class=\"ui-state-default ui-corner-all\" style=\"float: right;\">Send Invitations</button><div class=\"clear\"></div></div>").appendTo($(I).parents("#bubble-invite-"+E.id).find(".tomnoddy-bubble-footer"));$(I).parents("#bubble-invite-"+E.id).find("#done-invite-"+E.id).text("Not Yet").attr("title","Save but dont send yet");$("#"+E.id+"_guests").autocomplete(dotcal.user.currUser.contacts_autocomplete,{multiple:true,mustMatch:false,autoFill:false,matchContains:"word",itemClass:"ui-state-default",hoverClass:"ui-state-hover",resultsClass:"ac_results",append:$("#bubble-"+B+" #people")});$("#"+E.id+"_guests").blur(function(){$(this).search()}).result(function(L,P,Q){var S=dotcal.calendar.event.getFullEventByID($(this).attr("event_id"));var M=S.invitation.guests.length;var T=dotcal.email.splitEmails($("#"+S.id+"_guests").val());var U=null;var R="";var W="";var O=null;for(var N=0;T.length>N;N++){R="";W="";O=null;if(T[N].search(/[ \t]/)>-1){var V=T[N].split(/[ \t]/);if(V.length>=2){R=dotcal.string.stripContactName(V[0])}if(V.length>=3){W=dotcal.string.stripContactName(V[1])}U=dotcal.string.stripEmail(V[V.length-1])}else{U=dotcal.string.stripEmail(T[N])}O=dotcal.user.getContactByVAddress(U);if(O){dotcal.calendar.event.addGuestToEvent(S,O)}else{O={};O.vaddress=U;O.first_name=R;O.last_name=W;dotcal.calendar.event.addGuestToEvent(S,O)}}if(S.invitation.guests.length!=M){dotcal.calendar.event.updateEventInvitation(S)}else{dotcal.calendar.event.updateContactsInAutoComplete(S.invitation.guests,"#"+S.id+"_guests")}});$("#"+E.id+"_send_invitation").bind("click",function(O){var P=dotcal.calendar.event.getFullEventByID($(this).attr("event_id"));var M=dotcal.calendar.event.parseEventToShipBack(P);var N="bubble-invite-"+$(this).attr("event_id");var L=$("#"+N+" input[name=all_guests]:checked").val();if(P.invitation.guests.length>0){$.post("/event/send_invitation",{authenticity_token:window.AUTH_TOKEN,event:JSON.stringify(M,null),all_guests:L},function(Q){var R="";if(L==dotcal.calendar.event.sendInvitationTo.JUSTADDED){R="The Invitation has been sent only to guests that have not recieved it."}else{if(L==dotcal.calendar.event.sendInvitationTo.EVERYONE){R="The Invitation has been sent to all of the guests."}else{if(L==dotcal.calendar.event.sendInvitationTo.HAVENOTRESPONDED){R="The invitation has been sent to people that have yet to respond to it."}}}alert(R);$("#invite-"+P.id).tomnoddy("emphysema")})}else{alert("You must add at least one guest before you can send an invitation.")}});dotcal.calendar.event.updateContactsInAutoComplete(E.invitation.guests,"#"+E.id+"_guests")};this.updateContactsInAutoComplete=function(E,A){var D=dotcal.user.parseContactsAsAutoCompleteContacts(E);var B="";for(var C=0;D.length>C;C++){B+=D[C]+", "}$(A).val(B)};this.updateEventInvitation=function(B){var A=dotcal.calendar.event.parseEventToShipBack(B);if(B.parent_event_id){A.id=B.parent_event_id}$.post("/event/update_invitation",{authenticity_token:window.AUTH_TOKEN,event:JSON.stringify(A,null)},function(E){var C=JSON.parse(E,null);for(var D=0;C.new_contacts.length>D;D++){dotcal.user.currUser.contacts.push(C.new_contacts[D])}if(C.new_contacts.length>0){dotcal.user.updateAutoCompleteContacts()}B.invitation=C.updated_invitation;dotcal.calendar.event.updateContactsInAutoComplete(B.invitation.guests,"#"+B.id+"_guests")})};this.drawAlarmBubbleInsides=function(A,B){var J=dotcal.calendar.event.getFullEventByID($("#"+B).attr("event_id"));var L=dotcal.calendar.event.setupBubble(A,B,"Alert for "+J.summary);$("<div class=\"component\"><strong>Event Start</strong>:&nbsp;"+dotcal.calendar.date.getFormattedShortDate(J.dtstart)+" @ "+dotcal.calendar.date.getFormattedHour(J.dtstart)+"</div>").appendTo(L);$("<p><strong>Alert</strong>:</p>").appendTo(L);var C=$("<div class=\"component message ui-state-highlight ui-corner-all clearfix\"><div style=\"margin-bottom: 5px;\">You can set only one alarm for an Event and a type:</div></div>").appendTo(L);var N=dotcal.calendar.event.defaultAlarmTypeIfNoneExists;var E=null;if(J.alarms.length!==0){N=J.alarms[0].alarm_type}for(var P in dotcal.calendar.event.alarmTypes){if(dotcal.calendar.event.alarmTypes.hasOwnProperty(P)){var D="";D+="<input type=\"radio\" name=\"alarmTypes\" value=\""+P+"\"";if(N==P){D+=" checked=checked";E=dotcal.calendar.event.alarmTypes[P]}D+=" event_id=\""+J.id+"\" class=\"alarmChange\">";$("<strong>"+D+dotcal.string.capitalize(dotcal.calendar.event.alarmTypes[P].toLowerCase())+"</strong>").appendTo(C)}}var M="";if(J.alarms.length!==0){M=J.alarms[0].time}else{M=dotcal.calendar.event.alarmTimes.AT_EVENT_START}var F=dotcal.ui.selectBox(dotcal.calendar.event.alarmTimes,M,"alarm_"+J.id,"alarmDropDown alarmChange","event_id=\""+J.id+"\" updatetext=\"no\"");$("<div style=\"margin-top: 10px;\" align=\"center\"><strong>When</strong>:&nbsp;"+F+"</div>").appendTo(C);$(".alarmChange").change(function(){dotcal.calendar.event.alarmUpdate(this)});var I=$("<div class=\""+dotcal.calendar.event.alarmTypes.DISPLAY+"Area alertInfoArea\"><p>The <strong>Desktop</strong> setting allows you to set the alarm in dotCal and have your connected desktop or webtop client pop up an alarm. Compatible Desktop clients such as: Apple iCal, Thunderbird, Outlook or Google Calendar will work just fine.</p></div>");I.appendTo(L);var O=$("<div class=\""+dotcal.calendar.event.alarmTypes.EMAIL+"Area alertInfoArea\"><p>By default the alert email is sent to your account default, feel free to change it to another email address if you wish:</p></div>");O.appendTo(L);var H=dotcal.user.currUser.email;if(J.alarms.length>0&&J.alarms[0].send_to){H=J.alarms[0].send_to}$("<p><input type=\"text\" size=\"35\" id=\"alarm_"+dotcal.calendar.event.alarmTypes.EMAIL+"_"+J.id+"\" class=\"alarmTextValueChange ui-widget-content ui-corner-all\" value=\""+H+"\" event_id=\""+J.id+"\"/></p>").appendTo(O);var G=$("<div class=\""+dotcal.calendar.event.alarmTypes.SMS+"Area alertInfoArea\"></div>");G.appendTo(L);if(dotcal.user.currUser.cellphone&&dotcal.user.currUser.cellphone_provider){$("<p>A SMS will be sent to your current cell number on file which is <strong>"+dotcal.user.currUser.cellphone+"</strong>.</p>").appendTo(G)}else{$("<p class=\"ui-state-error ui-corner-all\" style=\"padding: 5px; background-image: none;\"><span class=\"ui-icon ui-icon-info\" style=\"float: left; margin-right: 5px;\"></span> You do not have a cellphone number to use for SMS alerting, please set it in your <a href=\"/users/preferences\">preferences</a>.</p>").appendTo(G)}var K=$("<div class=\""+dotcal.calendar.event.alarmTypes.TWITTER+"Area alertInfoArea\"></div>");K.appendTo(L);if(dotcal.user.currUser.twitter_support){$("<p>A direct message will be sent to your twitter account on file alerting you of this event.</p>").appendTo(K)}else{$("<p class=\"ui-state-error ui-corner-all\" style=\"padding: 5px; background-image: none;\"><span class=\"ui-icon ui-icon-info\" style=\"float: left; margin-right: 5px;\"></span> You do not have a Twitter account set for Twitter alerting, please set it in your <a href=\"/users/preferences?default=social_networks\">Social Networks preferences</a>.</p>").appendTo(K)}$(".alarmTextValueChange").blur(function(){dotcal.calendar.event.alarmUpdate(this)});I.hide();O.hide();G.hide();K.hide();$("."+E+"Area").show()};this.alarmUpdate=function(C){var K="bubble-alert-"+$(C).attr("event_id");var J=$(C).attr("event_id");var I=$("#"+K+" .alarmDropDown").val();var H=$("#"+K+" input[name=alarmTypes]:checked").val();var B=null;var G=dotcal.calendar.event.getFullEventByID(J);var E=null;for(var D in dotcal.calendar.event.alarmTypes){if(D==H){E=dotcal.calendar.event.alarmTypes[D];B=$("#alarm_"+E+"_"+G.id).val()}}$(".alertInfoArea").hide();$("."+E+"Area").show();if(I&&H){if(H==dotcal.calendar.event.alarmTypes.SMS&&(!dotcal.user.currUser.cellphone||!dotcal.user.currUser.cellphone_provider)){return }if(G.alarms.length===0){var A={time:I,alarm_type:H,send_to:B};G.alarms.push(A)}else{G.alarms[0].time=I;G.alarms[0].alarm_type=H;G.alarms[0].send_to=B}var F=[];F.push("alarm_"+$(C).attr("event_id"));F.push(I);F.push("ignore");dotcal.calendar.event.updateEvent("",F)}};this.drawFacebookBubbleInsides=function(A,B){var H=dotcal.calendar.event.getFullEventByID($("#"+B).attr("event_id"));var I=dotcal.calendar.event.setupBubble(A,B,"Post To Facebook");var C=$("<div id=\"facebook_bubble\"></div>").appendTo(I);var F=$(I).parent().children(".tomnoddy-bubble-footer");if(!dotcal.user.currUser.facebook_integration){$("<p><a href=\"/rusers/facebook_oauth_start\">You need to integrate Facebook with dotCal first</a>!</p>").appendTo(C);return }var J=$("<div class=\"buttons ui-state-highlight ui-corner-all\"></div>");dotcal.ui.currentEventImages=[window.surl+"images/dotcal_events.jpg"];$("<div id=\"description_images\" style=\"display: none;\">"+H.body+"</div>").appendTo(I);$("#description_images img").each(function(){dotcal.ui.currentEventImages.push($(this).attr("src"))});$("#description_images").remove();var M="<div><strong>Facebook Wall:</strong> <input id=\"post_to_fb_wall\" type=\"checkbox\" name=\"post_wall\" checked=checked/></div>";M+="<div><strong>Facebook Events:</strong> <input id=\"post_to_fb_events\" type=\"checkbox\" name=\"post_event\" checked=checked/>";M+="<span class=\"permission_selections\"><input type=\"radio\" name=\"fb_permission\" value=\"OPEN\" checked=checked /><strong>Public, Open to all</strong><input type=\"radio\" name=\"fb_permission\" value=\"CLOSED\" /><strong>Public, Invites Only</strong></span>";M+="</div>";$(M).appendTo(J);var K=$("<div class=\"title\"></div>");$("<div><strong>Title:</strong> \""+H.summary+"\"</div>").appendTo(K);$("<div class=\"description\"><strong>Description:</strong> \""+H.summary+"\" - is at "+dotcal.calendar.date.getFormattedLongDate(H.dtstart)+": "+H.body+"</div>").appendTo(K);var G=$("<div class=\"specify\"></div>");var E="<div class=\"carousel\">";E+="<div class=\"image\"><img src=\""+dotcal.ui.currentEventImages[0]+"\" /></div>";E+="<table class=\"controls\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";E+="<tr>";E+="<td class=\"control\"><button class=\"left ui-state-default ui-corner-all\" style=\"margin-right: 0;\"><span class=\"ui-icon ui-icon-circle-triangle-w\"></span></button></td>";E+="<td class=\"middle ui-state-default\">Choose a Thumbnail</td>";E+="<td class=\"control\"><button class=\"right ui-state-default ui-corner-all\"><span class=\"ui-icon ui-icon-circle-triangle-e\"></span></button></td>";E+="</tr></table></div>";$("<div class=\"specify_left\">"+E+"</div>").appendTo(G);var N=$("<div class=\"specify_right\"></div>").appendTo(G);var L=$("<textarea id=\"facebook_post_message\" class=\"ui-widget-content ui-corner-all\">"+dotcal.ui.facebookDefaultTextAreaText+"</textarea>").appendTo(N);$(J).appendTo(C);$(K).appendTo(C);$("<hr/>").appendTo(C);$(G).appendTo(C);$("<div class=\"clear\"></div>").appendTo(C);$("#done-facebook-"+H.id).remove();var D=$("<button id=\"default_facebook_post_button\" event_id=\""+H.id+"\" class=\"ui-state-default ui-corner-all\" style=\"float: right;\">Post</button>").appendTo(F);$("<span id=\"fallback_facebook_post_button\" style=\"float: right; position: relative; display: none;\">"+dotcal.calendar.event.getLargeFacebookLinkForEvent(H,"My Facebook Wall")+"</span>").appendTo(F);$("#post_to_fb_events").change(function(){if($(this).attr("checked")){$(".permission_selections").show()}else{$(".permission_selections").hide()}});$("#facebook_post_message").focus(function(){if($(this).val()==dotcal.ui.facebookDefaultTextAreaText){$(this).val("")}});$("#facebook_post_message").blur(function(){if($(this).val()==""){$(this).val(dotcal.ui.facebookDefaultTextAreaText)}});$("#facebook_bubble .carousel .controls .left").click(function(){var Q=$("#facebook_bubble .carousel .image img").attr("src");var P=Q;for(var O=0;dotcal.ui.currentEventImages.length>O;O++){if(dotcal.ui.currentEventImages[O]==Q){if(dotcal.ui.currentEventImages.length>O){P=dotcal.ui.currentEventImages[O-1]}else{}}}$("#facebook_bubble .carousel .image img").attr("src",P)});$("#facebook_bubble .carousel .controls .right").click(function(){var Q=$("#facebook_bubble .carousel .image img").attr("src");var P=Q;for(var O=0;dotcal.ui.currentEventImages.length>O;O++){if(dotcal.ui.currentEventImages[O]==Q){if(dotcal.ui.currentEventImages.length==O){}else{P=dotcal.ui.currentEventImages[O+1]}}}$("#facebook_bubble .carousel .image img").attr("src",P)});D.click(function(){var S=dotcal.calendar.event.getFullEventByID($(this).attr("event_id"));var R="";if($("#post_to_fb_events").attr("checked")){R="EVENTS"}else{if($("#post_to_fb_wall").attr("checked")){R="WALL"}}var Q=$("#facebook_bubble .carousel .image img").attr("src");var P=$("#facebook_post_message").val();var O="";if(R=="EVENTS"){O=$("[name=fb_permission]").val()}if(P==dotcal.ui.facebookDefaultTextAreaText){P=""}$.post("/event/post_to_facebook",{authenticity_token:window.AUTH_TOKEN,f:S.ical_file,c:S.collection_id,i:Q,m:P,l:R,p:O},function(U){var T=JSON.parse(U,null);if(T=="down"){$("#post_to_fb_events").attr("checked","");$("#post_to_fb_events").attr("disabled","disabled");$(".permission_selections").hide();$("#default_facebook_post_button").hide();$("#fallback_facebook_post_button").show();alert("Facebook Connect is "+T+"\n\nIts just not available at this time.  To post Only to your wall, Click the \"My Facebook Wall\" button below.")}else{alert("This event was posted to Facebook!")}})})};this.createBubbleEditableDIV=function(K,C,D,G,H,E,I){var B=G.attr("id").replace(/^bubble-/,"");B=B.replace(/^bobble-/,"");var J=$(G).css("z-index");$(".tomnoddy-bubble").find(".editable-container").each(function(L){var M=parseInt(J,10)-L;$(this).css("z-index",M)});var A=$("<div id=\""+D.toLowerCase().replace(" ","")+"\"class=\"component editable-container\"><span class=\"label\"><strong>"+D+"</strong>:</span></div>").appendTo(H);var F=null;if(!I){F=$("<input type=\"text\" id=\""+B+"_"+C+"\" event_id=\""+E+"\" editable=\""+C+"\" class=\"editable ui-widget-content ui-corner-all\" />").appendTo(A)}else{F=$("<textarea id=\""+B+"_"+C+"\" event_id=\""+E+"\" editable=\""+C+"\" class=\"editable ui-widget-content ui-corner-all\" rows=\"4\"></textarea>").appendTo(A)}F.val(K);F.blur(function(){var M=[];var N=dotcal.calendar.event.getFullEventByID($(this).attr("event_id"));if(N[$(this).attr("editable")]==$(this).val()){return }if($(this).attr("editable")=="url"){var L=$(this).val().replace(/ /g,"");if(L.length>0){if(L.search(/^[A-Za-z]+:\/\//)==-1){L="http://"+L}L=L.toLowerCase();if(!dotcal.string.isUrl(L)){alert("That is not a valid URL, please check it!");return }$(this).val(L)}}M.push($(this).attr("id"));M.push($(this).val());M.push($(this).attr("editable"));dotcal.calendar.event.updateEvent("",M)});$("<div class=\"clear\"></div>").appendTo(A);return F};this.placeEventDIV=function(B,E,J,D){var F=dotcal.calendar.getCollectionByID(B.collection_id);var I="";var H="<div id=\""+B.id+"_draggable\" event_id=\""+B.id+"\" collection=\""+B.collection_id+"\" class=\"event\" updatetext=\"no\"><div class=\"innerWrap ui-corner-all\">";if(B.alarms.length>0){H+="<span class=\"ui-icon ui-icon-clock\" style=\"float: right;\"></span>"}if(D){if(B.duration=="P1D"){if(dotcal.calendar.views.ui==dotcal.calendar.views.currentUI.EMBED){I="(D)"}else{I="(All Day)"}}else{I=dotcal.calendar.date.getFormattedShortTime(B.dtstart)}if(dotcal.calendar.views.ui==dotcal.calendar.views.currentUI.CALENDAR){if(B.r_rule){I+=" (R)"}}}H+="<strong class=\"event-time\"><span id=\"bid-"+B.id+"\" class=\"bid-"+B.id+" time\" title=\""+I+"\" event_id=\""+B.id+"\" bref=\"&nbsp;\">"+I+"</span></strong>";var G="(No Title)";if(B.summary){G=B.summary}H+="<span class=\"event-title\"><span id=\"bid-"+B.id+"\" class=\"bid-"+B.id+" title\" title=\""+dotcal.string.replaceString(dotcal.string.cleanString(G))+"\" event_id=\""+B.id+"\" bref=\"&nbsp;\">"+dotcal.string.replaceString(dotcal.string.cleanString(G))+"</span></span>";H+="</div></div>";var A=$(H);if(E){A.children(".innerWrap").addClass("color").css("background",F.event_color)}else{A.children(".innerWrap").addClass("ui-state-active")}A.appendTo(J);if(dotcal.calendar.views.ui==dotcal.calendar.views.currentUI.CALENDAR){var C=dotcal.calendar.event.drawEventBubbleInsides;if(dotcal.calendar.typeReadOnly(F.type)){C=dotcal.calendar.event.drawReadOnlyEventBubbleInsides}$("#bid-"+B.id).tomnoddy({blowBubble:C});$(".bid-"+B.id).tomnoddy({blowBubble:C});A.children(".innerWrap").bind("dblclick",function(K){});dotcal.calendar.event.addDraggableActionsToEvent($("#"+B.id+"_draggable"))}else{if(dotcal.calendar.views.ui==dotcal.calendar.views.currentUI.EMBED){$("#bid-"+B.id).tomnoddy({blowBubble:dotcal.calendar.event.drawReadOnlyEventBubbleInsides});$(".bid-"+B.id).tomnoddy({blowBubble:dotcal.calendar.event.drawReadOnlyEventBubbleInsides})}}return A};this.attachDateChangeToDatePicker=function(B,A){$(B).datepicker({dateFormat:"yy-mm-dd",appendTo:A,onSelect:function(F,D){var E=dotcal.calendar.event.getFullEventByID($(this).attr("event_id"));F+=fleegix.date.util.strftime(E[$(this).attr("event_property")],"-%H-%M");var C=dotcal.calendar.views.box.day.convertIdToDate(F);if($(this).attr("event_property")=="dtstart"){E.dtend=dotcal.calendar.date.fromISO8601Duration(E.duration,C)}var G=[];G.push($(this).attr("id"));G.push(C);G.push($(this).attr("event_property"));dotcal.calendar.event.updateEvent("",G)}});$("#ui-datepicker-div").hide()};this.attachSharingToDOMNode=function(C,B){var A=$("<span class=\"share\">"+dotcal.calendar.event.getDotCalLinkImageForEvent(B)+" "+dotcal.calendar.event.getGoogleCalendarLinkForEvent(B)+" "+dotcal.calendar.event.getiCalLinkImageForEvent(B)+" "+dotcal.calendar.event.getOutlookLinkImageForEvent(B)+" "+dotcal.calendar.event.getThunderbirdLinkImageForEvent(B)+" </span>");A.appendTo($(C));var D=$("#outlook_version").dialog({bgiframe:true,width:400,height:200,modal:true,closeOnEscape:true,position:["center",100],resizable:false,autoOpen:false,buttons:{"Done":function(){$(this).dialog("close")}}});$(".outlookLink").click(function(){D.dialog("open")});return A};this.attachSocialNetworksToDOMNode=function(C,B){var A=$("<span class=\"share\">"+dotcal.calendar.event.getFacebookLinkForEvent(B)+" "+dotcal.calendar.event.getTwitterLinkForEvent(B)+dotcal.calendar.event.getMySpaceLinkForEvent(B)+"</span>");A.appendTo($(C));return A};this.drawMoreBubbleInsides=function(B,C){var M=null;var F="";var H=C.replace(/more-/,"");H=H.replace(/-/g,"/");var D=new Date(H);var N=dotcal.calendar.event.getFullEventsByDateForCollections(D,dotcal.calendar.collections);var G=$("#bubble-"+C);var L=$("#bubble-"+C).children().children().children(".tomnoddy-bubble-scroll");$(G).addClass("tomnoddy-bubble-more");$("#bubble-"+C).children().children().children(".tomnoddy-bubble-header").children(".tomnoddy-bubble-header-label").html("More Events");for(var J in N){if(N.hasOwnProperty(J)){var P=N[J].events;for(var E=0;E<P.length;E++){B=P[E];F=B.id;var O="bobble-"+B.id;M="<div id=\"more-event-"+F+"\" class=\"event\">";if(B.alarm_time){M+="<span class=\"ui-icon ui-icon-clock\" style=\"float: right;\"></span>"}var K="";if(B.duration=="P1D"){K="(All Day)"}else{K=dotcal.calendar.date.getFormattedShortTime(B.dtstart)}M+="<strong class=\"event-time bubbleBlowStart\"><span id=\""+O+"\" class=\""+O+" time\" event_id=\""+F+"\" bref=\"&nbsp;\">"+K+"</span></strong>";var I="(No title)";if(B.summary){I=B.summary}M+="<span class=\"event-title\"><span id=\""+O+"\" class=\""+O+" title\" event_id=\""+F+"\" bref=\"&nbsp;\">"+I+"</span></span>";M+="<br class=\"clear\" /></div>";var A=$(M);$(A).appendTo(L);if(dotcal.calendar.views.ui==dotcal.calendar.views.currentUI.CALENDAR){$("."+O).tomnoddy({blowBubble:dotcal.calendar.event.drawEventBubbleInsides});$("."+O).tomnoddy({blowBubble:dotcal.calendar.event.drawEventBubbleInsides})}else{if(dotcal.calendar.views.ui==dotcal.calendar.views.currentUI.EMBED){$("."+O).tomnoddy({blowBubble:dotcal.calendar.event.drawReadOnlyEventBubbleInsides});$("."+O).tomnoddy({blowBubble:dotcal.calendar.event.drawReadOnlyEventBubbleInsides})}}}}}$(".event .event-time .time, .event .event-title .title").hover(function(){$(this).addClass("underline")},function(){$(this).removeClass("underline")});$(".event:last").addClass("lastEvent")};this.getFullEventByID=function(D){var A=dotcal.calendar.collections;for(var C in A){if(A.hasOwnProperty(C)){for(var B in A[C].events){if(A[C].events.hasOwnProperty(B)){if(A[C].events[B].id==D){return A[C].events[B]}}}}}return null};this.groupAllEventsOfSameDateTogether=function(E){var B=E.events;var D={};for(var A=0;A<B.length;A++){var C=dotcal.calendar.date.getEventIdFromDate(B[A].dtstart);if(!D[C]){D[C]=[]}D[C].push(B[A])}return D};this.getEventsForTodayAndBeyond=function(C,G){var F=[];var E=false;for(var D in G.events){if(G.events.hasOwnProperty(D)){var A=G.events[D];if(A.dtstart.getFullYear()>C.getFullYear()){E=true}else{if((C.getDate()<=A.dtstart.getDate()&&C.getMonth()==A.dtstart.getMonth())||(C.getMonth()<A.dtstart.getMonth())){if(A.dtstart.getFullYear()>=C.getFullYear()){E=true}}}if(E){F.push(A);E=false}}}var B=dotcal.calendar.getNewCollectionHash();B.events=F;return B};this.getFullEventsByDateForCollections=function(C,D){var A=[];for(var E in D){if(D.hasOwnProperty(E)){var B=this.getFullEventsByDateForCollection(C,D[E]);A.push(B)}}return A};this.getFullEventsByDateForCollection=function(A,E){var D=[];var C=E.events;for(var B=0;B<C.length;B++){if(C[B].dtstart.getFullYear()==A.getFullYear()&&C[B].dtstart.getMonth()==A.getMonth()&&C[B].dtstart.getDate()==A.getDate()){D.push(C[B])}}D.sort(function(G,F){if(G.dtstart.getTime()>F.dtstart.getTime()){return 1}else{return -1}});E=dotcal.calendar.getNewCollectionHash();E.events=D;return E};this.removeEventFromCollection=function(D,A){var C=[];var B=A.events;for(var E in B){if(B.hasOwnProperty(E)){if(B[E].parent_event_id!=D.id&&B[E].id!=D.id){C.push(B[E])}}}C.sort(function(G,F){if(G.dtstart.getTime()>F.dtstart.getTime()){return 1}else{return -1}});return C};this.getEventLandingPageURL=function(A){var B=null;if(A.tickets.length!==0){B=A.tickets[0].unique}return location.protocol+"//"+location.host+"/event/landing?u="+B+"&f="+encodeURIComponent(A.ical_file)};this.getTwitterLinkForEvent=function(A){var B=dotcal.calendar.ticket.getTicketFromCollectionID(A.collection_id,dotcal.calendar.ticket.permission.READ);return"<a title=\"Tweet This Event\" target=\"_blank\" href=\"/event/na_tweet_event?u="+B+"&f="+A.ical_file+"\"><span class=\"twitter_share_button\"></span></a>"};this.getMySpaceLinkForEvent=function(C){var A="<a href='"+dotcal.calendar.event.getEventLandingPageURL(C)+"' title='Click here to view this event!'><img border='0' src='http://dotcal.com/images/dotcal_events.jpg' align='right' /></a>";A+="<h3>'"+dotcal.string.cleanString(C.summary)+"'</h3>";A+="<p><a href='"+dotcal.calendar.event.getEventLandingPageURL(C)+"'>Click here to view this event</a>!</p>";A+="<p>"+dotcal.string.cleanString(C.summary)+" is at "+dotcal.calendar.date.getFormattedLongDate(C.dtstart)+" - "+dotcal.string.cleanString(C.body)+"</p>";var B="<form id=\"myspacepostto\" method=\"post\" action=\"http://www.myspace.com/index.cfm?fuseaction=postto\"target=\"_blank\" style=\"display: inline;\"><input type=\"hidden\" name=\"t\" value=\""+dotcal.string.cleanString(C.summary)+"\" /><input type=\"hidden\" name=\"c\" value=\""+A+"\" /><input type=\"hidden\" name=\"u\" value=\""+dotcal.calendar.event.getEventLandingPageURL(C)+"\" /><input type=\"hidden\" name=\"l\" value=\"2\" /><a href=\"#\" onclick=\"document.getElementById('myspacepostto').submit();return false;\" title=\"Share This Event on MySpace\"><span class=\"myspace_share_button\"></span></a></form>";return B};this.getFacebookLinkForEvent=function(A){return"<a name=\"fb_share\" type=\"icon\" title=\"Share This Event On Facebook\" share_url=\""+dotcal.calendar.event.getEventLandingPageURL(A)+"\"><img src=\"/stylesheets/dotcal/images/calendar_buttons/facebookbutton.png\" width=\"20\" height=\"20\" border=\"0\" class=\"icon png\" style=\"\" /></a><script type=\"text/javascript\">window.FB = {};</script><script src=\"http://static.ak.fbcdn.net/connect.php/js/FB.Share\" type=\"text/javascript\"></script>"};this.getLargeFacebookLinkForEvent=function(A,B){return"<a name=\"fb_share\" type=\"icon_link\" title=\"Share This Event On Facebook\" share_url=\""+dotcal.calendar.event.getEventLandingPageURL(A)+"\" class=\"withIconLeft button ui-state-default ui-corner-all\"><img src=\"/stylesheets/dotcal/images/calendar_buttons/facebookbutton.png\" width=\"20\" height=\"20\" border=\"0\" class=\"icon png\" style=\"margin-top: -10px;\" />"+B+"</a><script src=\"http://static.ak.fbcdn.net/connect.php/js/FB.Share\" type=\"text/javascript\"></script>"};this.getGoogleCalendarLinkForEvent=function(B){var C=dotcal.calendar.date.toUTCDateString(dotcal.calendar.date.getUTCDate(B.dtstart));var A=dotcal.calendar.date.toUTCDateString(dotcal.calendar.date.getUTCDate(B.dtend));return"<a href=\"http://www.google.com/calendar/event?action=TEMPLATE&text="+encodeURIComponent(B.summary)+"&dates="+C+"/"+A+"&location="+encodeURIComponent(B.location)+"&details="+encodeURIComponent(B.body)+"&trp=true&sprop=website:http://www.neutralspace.com&sprop=name:dotCal powered by neutralspace\" title=\"Add this event to Google Calendar\" target=\"_blank\"><span class=\"google_share_button\"></span></a>"};this.getICSDownloadLinkForEvent=function(A){var B=dotcal.calendar.ticket.getTicketFromCollectionID(A.collection_id,dotcal.calendar.ticket.permission.READ);return window.surl+"webcal/event/"+B+"/"+A.ical_file};this.getiCalLinkImageForEvent=function(A){return this.getLinkImageForEvent(A,"Add this event to Apple iCal","ical_share_button","iCal")};this.getiPhoneLinkImageForEvent=function(A){return this.getLinkImageForEvent(A,"Add this event to your mobile device","iphone_share_button","iPhone")};this.getThunderbirdLinkImageForEvent=function(A){return this.getLinkImageForEvent(A,"Add this event to Thunderbird","thunderbird_share_button","sunbird")};this.getDotCalLinkImageForEvent=function(B){var C=dotcal.calendar.date.toUTCDateString(dotcal.calendar.date.getUTCDate(B.dtstart));var A=dotcal.calendar.date.toUTCDateString(dotcal.calendar.date.getUTCDate(B.dtend));return"<a target=\"_blank\" href=\"/event/new?type=FULL&summary="+encodeURIComponent(B.summary)+"&start="+C+"&end="+A+"&location="+encodeURIComponent(B.location)+"&description="+encodeURIComponent(B.body)+"&url="+encodeURIComponent(B.url)+"\" title=\"Add this event to dotCal Calendar!\"><span class=\"dotcal_share_button\"></span></a>"};this.getOutlookLinkImageForEvent=function(B){var C=dotcal.calendar.ticket.getTicketFromCollectionID(B.collection_id,dotcal.calendar.ticket.permission.READ);var A=this.getICSDownloadLinkForEvent(B);$("#outlook2007Link").attr("href",A);$("#outlook2003Link").attr("href",window.surl+"event/outlook_2003?u="+C+"&f="+B.ical_file);return"<a href='#' class='outlookLink' title='Share This Event With Microsoft Outlook'><span class='outlook_share_button'></span></a>"};this.getLinkImageForEvent=function(C,E,D,A){var B=this.getICSDownloadLinkForEvent(C);return"<a href=\""+B+"\" title=\""+E+"\"><span class=\""+D+"\"></span></a>"};this.addDroppableActionsToCalendarCell=function(A){A.droppable({accept:".event",drop:function(E,H){var D=$(this).attr("id");var G=false;if(D.search(/allday_/)===0){D=D.replace(/allday_/,"");G=true}var F=H.draggable.attr("event_id");E=dotcal.calendar.event.getFullEventByID(F);if(D.length==10&&!G){D+=fleegix.date.util.strftime(E.dtstart,"-%H-%M")}var C=dotcal.calendar.views.box.day.convertIdToDate(D);if(E.dtstart.getFullYear()==C.getFullYear()&&E.dtstart.getMonth()==C.getMonth()&&E.dtstart.getDate()==C.getDate()&&E.dtstart.getHours()==C.getHours()&&E.dtstart.getMinutes()==C.getMinutes()){var B=dotcal.calendar.getCollectionByID(E.collection_id);dotcal.calendar.event.updateEventsForCollectionID(E.collection_id,B.events)}else{if(G){E.duration="P1D";E.dtstart=new Date(C);E.dtstart.setHours(0);E.dtstart.setMinutes(0);E.dtstart.setSeconds(0);E.dtend=new Date(C);E.dtend.setDate(E.dtend.getDate()+1)}else{if(H.draggable.children(".event-time").size()>0&&H.draggable.children(".event-time").html().search(/All Day/)>-1){E.duration="PT1H";E.dtend=new Date(C);E.dtend.setHours(E.dtend.getHours()+1)}else{E.dtend=dotcal.calendar.date.fromISO8601Duration(E.duration,C)}}var I=[];I.push(H.draggable.attr("id"));I.push(C);I.push("dtstart");dotcal.calendar.event.updateEvent("",I)}},hoverClass:"droppable"})};this.addDraggableActionsToEvent=function(A){var B=dotcal.calendar.getCurrentCollection();if(dotcal.calendar.typeReadOnly(B.type)){return }A.draggable({appendTo:"#calendar",helper:"clone",zIndex:"999",stop:function(C,D){var E=$(this).attr("id");$(this).parent().children("#"+E).remove()}})};this.addEventCreateToDOMNode=function(A,B){if(!B){B="dblclick"}$(A).bind(B,function(H){var G=dotcal.calendar.getCurrentCollection();if(dotcal.calendar.typeReadOnly(G.type)){var F=dotcal.string.capitalize(G.type)+"'s";alert("Calendar "+F+" are read only, PLEASE put your event in one of the "+F+" sources, or create a new source!");return }var E=$(this);var C=E.attr("id");var D=null;var K=false;if(C.search(/allday_/)==-1){D=dotcal.calendar.views[dotcal.calendar.views.currMode][dotcal.calendar.views.currView].convertIdToDate(C)}else{var J=C.split("_");var I=J[1];D=dotcal.calendar.views[dotcal.calendar.views.currMode][dotcal.calendar.views.currView].convertIdToDate(I);K=true}dotcal.calendar.event.createNewEvent(dotcal.calendar.currCollectionID,D,K)})};this.createNewEvent=function(B,A,C){log.profile("dotcal.calendar.event.createNewEvent()");if(!C){C=false}dotcal.calendar.render.showLoading(true,"Creating Event...");$.get("/event/new",{type:"SHORT",start:encodeURIComponent(dotcal.calendar.date.toISO8601DateCosmo(dotcal.calendar.date.getUTCDate(A)))+"Z",collectionID:encodeURIComponent(B),allDay:C,summary:"New Event"},function(G){var D=JSON.parse(G,null);var F=dotcal.calendar.event.parseEventForUse(D);F.collection_id=B;var E=[];E.push(F);var H=dotcal.calendar.updateEventsInCollection(B,E);dotcal.calendar.event.updateEventsForCollectionID(B,H.events);$("#bid-"+F.id).tomnoddy("bubbleBlow");dotcal.calendar.render.showLoading(false,null,F.dtstart);log.profile("dotcal.calendar.event.createNewEvent()")})};this.moveEventToCollection=function(D,E,C){log.profile("dotcal.calendar.event.moveEventToCollection()");dotcal.calendar.render.showLoading(true,"Moving Event...");var B=dotcal.calendar.event.getFullEventByID(D);var F=encodeURIComponent(dotcal.calendar.date.toISO8601Date(dotcal.calendar.views.firstDisplayDate));var A=encodeURIComponent(dotcal.calendar.date.toISO8601Date(dotcal.calendar.views.lastDisplayDate));$.post("/event/move",{authenticity_token:window.AUTH_TOKEN,eventID:D,oldCollectionID:E,newCollectionID:C,start:F,end:A},function(K){var G=JSON.parse(K,null);var J=dotcal.calendar.event.parseEvents(G);for(var H=0;J.length>H;H++){J[H].collection_id=C}var L=dotcal.calendar.getCollectionByID(E);L.events=dotcal.calendar.event.removeEventFromCollection(B,L);var I=dotcal.calendar.getCollectionByID(C);if(J.length>1){I.events=J}else{I.events.push(J[0])}$("#bid-"+B.id).tomnoddy("emphysema");dotcal.calendar.event.updateEventsForCollectionID(I.id,I.events);dotcal.calendar.render.showLoading(false,null,B.dtstart);log.profile("dotcal.calendar.event.moveEventToCollection()")})};this.deleteEvent=function(G,E){log.profile("dotcal.calendar.event.deleteEvent()");dotcal.calendar.render.showLoading(true,"Deleting Event...");var C=$("#"+G).attr("event_id");var D=dotcal.calendar.event.getFullEventByID(C);var A=dotcal.calendar.event.parseEventToShipBack(D);var F=encodeURIComponent(dotcal.calendar.date.toISO8601Date(dotcal.calendar.views.firstDisplayDate));var B=encodeURIComponent(dotcal.calendar.date.toISO8601Date(dotcal.calendar.views.lastDisplayDate));log.profile("/event/delete AJAX");$.post("/event/delete",{authenticity_token:window.AUTH_TOKEN,event:JSON.stringify(A,null),collectionID:E,start:F,end:B},function(J){log.profile("/event/delete AJAX");log.profile("parse JSON, rm event");var H=JSON.parse(J,null);var K=dotcal.calendar.getCollectionByID(E);K.events=dotcal.calendar.event.removeEventFromCollection(D,K);log.profile("parse JSON, rm event");log.profile("trans events and rm events from coll");$("#"+G).tomnoddy("emphysema");var I=dotcal.calendar.event.parseEvents(H);K.events=I;dotcal.calendar.event.updateEventsForCollectionID(K.id,I);log.profile("trans events and rm events from coll");dotcal.calendar.render.showLoading(false,null,D.dtstart);log.profile("dotcal.calendar.event.deleteEvent()")})};this.updateEvent=function(A,C){log.profile("dotcal.calendar.event.updateEvent()");dotcal.calendar.render.showLoading(true,"Updating Event...");var J=C[0];var I=$("#"+J).attr("event_id");var H=C[1];var D=C[2];var E=dotcal.calendar.event.getFullEventByID(I);E[D]=H;var G=dotcal.calendar.event.parseEventToShipBack(E);var B=encodeURIComponent(dotcal.calendar.date.toISO8601Date(dotcal.calendar.views.firstDisplayDate));var F=encodeURIComponent(dotcal.calendar.date.toISO8601Date(dotcal.calendar.views.lastDisplayDate));$.post("/event/update",{authenticity_token:window.AUTH_TOKEN,event:JSON.stringify(G,null),start:B,end:F},function(N){var K=JSON.parse(N,null);if(K.status==="down"){if(K.reason==="edit_conflict"){alert("That event has been edited on Google since the last time dotCal was synchronized. Please synchronize your calendar (by double-clicking the calendar tab and then clicking 'Reflesh') before editing.")}dotcal.calendar.render.showLoading(false,null,E.dtstart);log.profile("dotcal.calendar.event.updateEvent()");return }if(J.search(/_/)>-1){if(($("#"+J).length!==0)&&$("#"+J+"[updatetext=\"no\"]").length===0){$("#"+J).val(H)}}dotcal.calendar.event.commonEventRefresh(K);if(D=="dtstart"){var L=dotcal.calendar.event.getFullEventByID(I);$("#"+I+"_dtend_select").val((dotcal.calendar.date.getFormattedHour(L.dtend)))}else{if(D=="location"){var M="http://maps.google.com/?q="+encodeURIComponent(H);$("#location_link_span").show();$("#location_link").attr("href",M)}}dotcal.calendar.render.showLoading(false,null,E.dtstart);log.profile("dotcal.calendar.event.updateEvent()")})};this.updateEventProperty=function(D,C,B){dotcal.calendar.render.showLoading(true,"Updating Event...");var E=encodeURIComponent(dotcal.calendar.date.toISO8601Date(dotcal.calendar.views.firstDisplayDate));var A=encodeURIComponent(dotcal.calendar.date.toISO8601Date(dotcal.calendar.views.lastDisplayDate));$.post("/event/update_event_property",{authenticity_token:window.AUTH_TOKEN,event_filename:D.ical_file,collection_id:D.collection_id,property:C,value:JSON.stringify(B),start:E,end:A},function(G){var F=JSON.parse(G,null);$("#bid-"+D.id).tomnoddy("emphysema");dotcal.calendar.event.commonEventRefresh(F);dotcal.calendar.render.showLoading(false,null,D.dtstart)})};this.commonEventRefresh=function(A){var B=dotcal.calendar.event.parseEvents(A);var C=dotcal.calendar.updateEventsInCollection(B[0].collection_id,B);dotcal.calendar.event.updateEventsForCollectionID(B[0].collection_id,C.events)}};dotcal.calendar.event.categories=new function(){this.categories=["Causes","Education","Meetings","Music/Arts","Sports","Trips","Birthday","Birthday Party","Cocktail Party","Club Party","Concert","Fraternity/Sorority Party","Business Meeting","Barbecue","Card Night","Dinner Party","Holiday Party","Night of Mayhem","Movie/TV Night","Drinking Games","Bar Night","LAN Party","Study Group","Mixer","Slumber Party","Erotic Party","Benefit","Goodbye Party","House Party","Reunion","Religion","Dining","Food","Cooking","Fundraiser","Protest","Rally","Class","Lecture"," Office Hours","Workshop","Club/Group Meeting","Convention","Dorm/House Meeting","Informational Meeting","Audition","Exhibit","Jam Session","Listening Party","Opening","Performance","Preview","Recital","Rehearsal","Pep Rally","Pick-Up","Sporting Event","Sports Practice","Tournament","Camping Trip","Daytrip","Group Trip","Roadtrip","Carnival","Ceremony","Festival","Flea Market","Retail","Wedding"];this.drawCategoryBubbleInsides=function(C,D){var I=dotcal.calendar.event.getFullEventByID($("#"+D).attr("event_id"));var H=dotcal.calendar.getCollectionByID(I.collection_id);var K=dotcal.calendar.event.setupBubble(C,D,"Categories for "+I.summary);var A=$("<div id=\"eventCategoryContainer\" event_id=\""+I.id+"\"></div>").appendTo(K);if(H.categories.length>0){var J=4;var E="<table border=\"0\"><tr><th colspan=\""+J+"\" ><strong>Select Categories For This Event:</strong></th>";for(var F=0;H.categories.length>F;F++){if((F%J)===0){E+="</tr><tr>"}var B=H.categories[F].name;var L="";if(dotcal.calendar.event.categories.eventHasCategory(I,B)){L="checked=\"checked\""}E+="<td><input event_id=\""+I.id+"\" type=\"checkbox\" class=\"eventCategory\" name=\"eventCategories\" value=\""+B+"\" "+L+"/>"+B+"<td>"}E+="</table>";$(E).appendTo(A);$(".eventCategory").change(function(){var N=dotcal.calendar.event.getFullEventByID($(this).attr("event_id"));N.categories=[];$("[name=\"eventCategories\"]").each(function(P,O){if($(this).attr("checked")){dotcal.calendar.event.categories.addCategoryToEvent(N,$(this).val())}});var M=[];M.push("eventCategoryContainer");M.push(N.summary);M.push("summary");dotcal.calendar.event.updateEvent("",M)})}else{var G="<p>You must <strong>add categories to this Calendar</strong> before you  can add categories to this Event.<br/><br/><strong>To add categories to this Calendar</strong>: double click the tab and select \"edit\".  You can add categories from  the Calendar edit screen.</p>";$(G).appendTo(A)}};this.addCategoryToEvent=function(D,C){for(var B=0;D.categories.length>B;B++){if(D.categories[B].name==C){return }}var A={name:C};A["class"]="Category";D.categories.push(A)};this.eventHasCategory=function(C,B){for(var A=0;C.categories.length>A;A++){if(C.categories[A].name==B){return true}}return false};this.getDisplayableCategoryList=function(A){var C="";if(A.length>0){for(var B=0;A.length>B;B++){C+=A[B].name;if(A.length!=B+1){C+=", "}}}return C}};dotcal.calendar.event.recurrence=new function(){this.recurrDisplayPeriod={DAYS:"DAILY",WEEKS:"WEEKLY",MONTHS:"MONTHLY",YEARS:"YEARLY"};this.recurrDisplayFreq={FOREVER:"FOREVER",FOR:"COUNT",UNTIL:"UNTIL"};this.monthDisplayPeriod={FIRST:"1",SECOND:"2",THIRD:"3",FORTH:"4",FIFTH:"5"};this.monthDisplayFreq={Mon:"MO",Tue:"TU",Wed:"WE",Thu:"TH",Fri:"FR",Sat:"SA",Sun:"SU",Day:"DAY"};this.drawRecurrenceBubbleInsides=function(B,C){var G=dotcal.calendar.event.getFullEventByID($("#"+C).attr("event_id"));var D=new Date(G.dt_start);D.setMonth(D.getMonth()+3);var O=dotcal.calendar.date.getEventIdFromDate(D);var N=dotcal.calendar.date.toUTCDateString(D);var H=dotcal.calendar.event.setupBubble(B,C,"Recurrence for "+G.title);$("#bubble-recurrence-"+G.id).addClass("recurrenceBubble");$("<div><strong>Recurrence</strong></div>").appendTo(H);var I=$("<div id=\"recurrenceHousing\"></div>");I.appendTo(H);var K=C+"-main-checkbox";$("<div><input class=\"eventRecurring\" id=\""+K+"\" type=\"checkbox\" /> <label for=\""+K+"\">This Appointment Recurs</label></div>").appendTo(I);var A=dotcal.ui.selectBox(dotcal.calendar.event.recurrence.recurrDisplayPeriod,"DAYS","recurrDisplayPeriod","setting","");var L=dotcal.ui.selectBox(dotcal.calendar.event.recurrence.recurrDisplayFreq,"FOR","recurrDisplayFreq","setting","");var F=dotcal.calendar.event.recurrence.getMonthDisplayPeriodSelect();var M=dotcal.ui.selectBox(dotcal.calendar.event.recurrence.monthDisplayFreq,"Mon","monthDisplayFreq","setting","");var E="";for(var J in dotcal.calendar.event.recurrence.monthDisplayFreq){if(dotcal.calendar.event.recurrence.monthDisplayFreq.hasOwnProperty(J)){E+="<li id=\""+dotcal.calendar.event.recurrence.monthDisplayFreq[J]+"\" class=\"ui-state-default\">"+J+"</li>"}}$("<div id=\"recurrenceSettings\" event_id=\""+G.id+"\"><table border=\"0\"><tr><td>Every <input id=\"recurrPeriodTimes\" type=\"text\" class=\"setting textSetting ui-widget-content ui-corner-all\" value=\"1\" /> "+A+"</td><td> <span class=\"setting weekSettings periodSetting\" style=\"display: none;\"> on </span></td><td> <span class=\"setting weekSettings periodSetting\" style=\"display: none;\"><ol id=\"recurrenceSelectable\" class=\"setting\">"+E+"</ol></span><span class=\"setting monthSettings periodSetting\" style=\"display: none;\">on the "+F+" "+M+"</span></td><td> "+L+"   <span class=\"forSetting freqSetting\" style=\"display: none;\"><input id=\"forValue\" type=\"text\" class=\"setting textSetting ui-widget-content ui-corner-all\" size=\"3\" value=\"2\" /> times</span><span class=\"untilSetting freqSetting\" style=\"display: none;\"><span id=\"untilValue\" class=\"setting\" date=\""+N+"\">"+O+"</div><span></span></td></tr></table></div>").appendTo(I);$("#monthDisplayPeriod, #monthDisplayFreq").change(function(P){dotcal.calendar.event.recurrence.updateEventRecurrence($("#recurrenceSettings").attr("id"),false)});$(".textSetting").blur(function(P){dotcal.calendar.event.recurrence.updateEventRecurrence($("#recurrenceSettings").attr("id"),false)});$("#recurrenceSelectable").selectable({selected:function(P,Q){dotcal.calendar.event.recurrence.updateEventRecurrence($("#recurrenceSettings").attr("id"),false)},unselected:function(P,Q){dotcal.calendar.event.recurrence.updateEventRecurrence($("#recurrenceSettings").attr("id"),false)}});$("#"+K).click(function(Q){var P=$(this).attr("checked");if(P){if($("#recurrDisplayPeriod").val()==dotcal.calendar.event.recurrence.recurrDisplayPeriod.WEEKS){$(".weekSettings").show()}else{if($("#recurrDisplayPeriod").val()==dotcal.calendar.event.recurrence.recurrDisplayPeriod.MONTHS){$(".monthSettings").show()}}$(".setting").attr("disabled","")}else{$(".periodSetting").hide();$(".setting").attr("disabled","disabled")}dotcal.calendar.event.recurrence.updateEventRecurrence($("#recurrenceSettings").attr("id"),!P)});$("#recurrDisplayPeriod").change(function(P){$(".periodSetting").hide();if($(this).val()==dotcal.calendar.event.recurrence.recurrDisplayPeriod.WEEKS){$(".weekSettings").show()}else{if($(this).val()==dotcal.calendar.event.recurrence.recurrDisplayPeriod.MONTHS){$(".monthSettings").show()}}dotcal.calendar.event.recurrence.updateEventRecurrence($("#recurrenceSettings").attr("id"),false)});$("#recurrDisplayFreq").change(function(P){$(".freqSetting").hide();if($(this).val()==dotcal.calendar.event.recurrence.recurrDisplayFreq.FOR){$(".forSetting").show()}else{if($(this).val()==dotcal.calendar.event.recurrence.recurrDisplayFreq.UNTIL){$(".untilSetting").show()}else{if($(this).val()==dotcal.calendar.event.recurrence.recurrDisplayFreq.FOREVER){}}}dotcal.calendar.event.recurrence.updateEventRecurrence($("#recurrenceSettings").attr("id"),false)});$(".setting").attr("disabled","disabled");if(!G.r_rule){$("#recurrDisplayPeriod").val(dotcal.calendar.event.recurrence.recurrDisplayPeriod.WEEKS)}else{dotcal.calendar.event.recurrence.parseRecurrenceRuleToUI(G.r_rule);$(".eventRecurring").attr("checked","checked");$(".setting").attr("disabled","")}};this.parseRecurrenceRuleToUI=function(J){var H=J.split(";");var F=[];for(var G=0;G<H.length;G++){var A=H[G].split("=");F.push(A)}var I=true;var B="";for(G=0;G<F.length;G++){if(F[G][0]=="FREQ"){$("#recurrDisplayPeriod").val(F[G][1]);B=F[G][1];$(".periodSetting").hide();if(F[G][1]==dotcal.calendar.event.recurrence.recurrDisplayPeriod.WEEKS){$(".weekSettings").show()}else{if(F[G][1]==dotcal.calendar.event.recurrence.recurrDisplayPeriod.MONTHS){$(".monthSettings").show()}}}else{if(F[G][0]=="COUNT"){$("#recurrDisplayFreq").val(F[G][0]);$(".forSetting").show();$("#forValue").val(F[G][1]);I=false}else{if(F[G][0]=="UNTIL"){$("#recurrDisplayFreq").val(F[G][0]);$(".untilSetting").show();var C=dotcal.calendar.date.fromISO8601Date(F[G][1]);var L=dotcal.calendar.date.getEventIdFromDate(C);$("#untilValue").html(L);$("#untilValue").attr("date",F[G][1]);I=false}else{if(F[G][0]=="BYDAY"){var K=dotcal.calendar.event.recurrence.parseByDay(F[G][1]);if(B==dotcal.calendar.event.recurrence.recurrDisplayPeriod.MONTHS){$("#monthDisplayFreq").val(K[0][0]);$("#monthDisplayPeriod").val(K[0][1])}else{if(B==dotcal.calendar.event.recurrence.recurrDisplayPeriod.WEEKS){for(var E=0;K.length>E;E++){$("#"+K[E]).addClass("ui-selected")}}}}else{if(F[G][0]=="INTERVAL"){$("#recurrPeriodTimes").val(F[G][1])}else{if(F[G][0]=="BYMONTHDAY"){$("#monthDisplayFreq").val(dotcal.calendar.event.recurrence.monthDisplayFreq.Day);var D=F[G][1];if(5>=D){D=D+D+D+""}$("#monthDisplayPeriod").val(D)}}}}}}}if(I){$(".freqSetting").hide();$("#recurrDisplayFreq").val(dotcal.calendar.event.recurrence.recurrDisplayFreq.FOREVER)}};this.parseByDay=function(E){var G=E.split(",");var F=[];for(var C=0;C<G.length;C++){var B=G[C];if(B.length==2){F.push([B,null])}else{var D=B.slice(0,-2);var A=B.substr(B.length-2,2);F.push([A,D])}}return F};this.updateEventRecurrence=function(B,C){var D=dotcal.calendar.event.recurrence.createRecurrenceRuleFromUI(C);var A=[];A.push("recurrenceSettings");A.push(D);A.push("r_rule");dotcal.calendar.event.updateEvent("",A)};this.createRecurrenceRuleFromUI=function(C){var G="";if(C){return G}G="";var I=$("#recurrDisplayPeriod").val();G+="FREQ="+I;if(I==dotcal.calendar.event.recurrence.recurrDisplayPeriod.WEEKS){var D=$("#recurrenceSelectable").children(".ui-selected").size();var E=0;if(D>0){G+=";BYDAY="}$("#recurrenceSelectable").children(".ui-selected").each(function(){var J=$(this).text();G+=dotcal.calendar.event.recurrence.monthDisplayFreq[J];E++;if(D>1&&E!=D){G+=","}})}else{if(I==dotcal.calendar.event.recurrence.recurrDisplayPeriod.MONTHS){var B=$("#monthDisplayPeriod").val();var H=$("#monthDisplayFreq").val();if(B>=6){$("#monthDisplayFreq").val(dotcal.calendar.event.recurrence.monthDisplayFreq.Day);B=dotcal.calendar.event.recurrence.getSelectNumberForMonthDisplayPeriodSelect(B);G+=";BYMONTHDAY="+B}else{if(H==dotcal.calendar.event.recurrence.monthDisplayFreq.Day){H=dotcal.calendar.event.recurrence.monthDisplayFreq.Mon;$("#monthDisplayFreq").val(H)}G+=";BYDAY="+B+H}}}var A=$("#recurrDisplayFreq").val();if(A==dotcal.calendar.event.recurrence.recurrDisplayFreq.FOR){G+=";"+dotcal.calendar.event.recurrence.recurrDisplayFreq.FOR+"="+$("#forValue").val()}else{if(A==dotcal.calendar.event.recurrence.recurrDisplayFreq.UNTIL){G+=";"+dotcal.calendar.event.recurrence.recurrDisplayFreq.UNTIL+"="+$("#untilValue").attr("date")}}var F=$("#recurrPeriodTimes").val();if(F>0){G+=";INTERVAL="+F}return G};this.getMonthDisplayPeriodSelect=function(){return"<select class=\"setting\" id=\"monthDisplayPeriod\"><option value=\"1\">First</option><option value=\"2\">Second</option><option value=\"3\">Third</option><option value=\"4\">Forth</option><option value=\"5\">Fifth</option><option value=\"111\">1st</option><option value=\"222\">2nd</option><option value=\"333\">3rd</option><option value=\"444\">4th</option><option value=\"555\">5th</option><option value=\"6\">6th</option><option value=\"7\">7th</option><option value=\"8\">8th</option><option value=\"9\">9th</option><option value=\"10\">10th</option><option value=\"11\">11th</option><option value=\"12\">12th</option><option value=\"13\">13th</option><option value=\"14\">14th</option><option value=\"15\">15th</option><option value=\"16\">16th</option><option value=\"17\">17th</option><option value=\"18\">18th</option><option value=\"19\">19th</option><option value=\"20\">20th</option><option value=\"21\">21st</option><option value=\"22\">22nd</option><option value=\"23\">23rd</option><option value=\"24\">24th</option><option value=\"25\">25th</option><option value=\"26\">26th</option><option value=\"27\">27th</option><option value=\"28\">28th</option><option value=\"29\">29th</option><option value=\"30\">30th</option><option value=\"31\">31st</option></select>"};this.getSelectNumberForMonthDisplayPeriodSelect=function(A){if(A>31){if(A==111){return 1}else{if(A==222){return 2}else{if(A==333){return 3}else{if(A==444){return 4}else{if(A==555){return 5}}}}}}return A}};dotcal.calendar.date=new function(){var A={YEAR:"year",MONTH:"month",DAY:"day",HOUR:"hour",MINUTE:"minute",SECOND:"second",MILLISECOND:"millisecond",QUARTER:"quarter",WEEK:"week",WEEKDAY:"weekday"};var B={d:86400,h:3600,m:60,s:1};this.getFirstSunday=function(C){var D=new Date(C);D.setDate(1);var E=0-D.getDay();D.setDate(D.getDate()+E);return D};this.getLastSaturday=function(C){var D=new Date(C.valueOf());D.setDate(1);D.setMonth(D.getMonth()+1);D.setDate(0);var E=7-D.getDay();D.setDate(D.getDate()+E);return D};this.getFirstSundayOfWeek=function(C){var D=new Date(C.getFullYear(),C.getMonth(),C.getDate());D.setDate(D.getDate()-D.getDay());return D};this.toISO8601Date=function(F,E){var H="";if(E){H=F.getTimezoneOffset();if(H===0){H="Z"}else{var C=parseInt(H/60,10);offHours=dotcal.string.lpad(Math.abs(C)+"","0",2);offHours=C>0?"-"+offHours:"+"+offHours;var G=H%60;G=dotcal.string.lpad(G+"","0",2);H=offHours+":"+G}}var D=fleegix.date.util.strftime(F,"%Y-%m-%dT%T"+H);return D};this.toISO8601DateCosmo=function(C){if(!C){return }return fleegix.date.util.strftime(C,"%Y%m%dT%H%M%S")};this.fromISO8601Date=function(G,H){if(!G){return }var E=A;var C=G.indexOf("T")>-1;var F={};F[E.YEAR]=parseInt(G.substring(0,4),10);F[E.MONTH]=parseInt(G.substring(4,6),10)-1;F[E.DAY]=parseInt(G.substring(6,8),10);if(C){F[E.HOUR]=parseInt(G.substring(9,11),10);F[E.MINUTE]=parseInt(G.substring(11,13),10);F[E.SECOND]=parseInt(G.substring(13,15),10)}else{F[E.HOUR]=0;F[E.MINUTE]=0;F[E.SECOND]=0}var D=new Date(F[E.YEAR],F[E.MONTH],F[E.DAY],F[E.HOUR],F[E.MINUTE],F[E.SECOND]);return D};this.fromISO8601Duration=function(E,C){var F=false;if(E.search(/-/)>-1){F=true}var H=E.toLowerCase().split(/p|t/);E=H.join("");var I=/(\d+)(\D{1})/g;var G;var J;var D=0;var K=new Date(C);if(E){while(H=I.exec(E)){if(H.length){J=B[H[2]];G=parseInt(H[1],10);if(F){D-=(J*G)}else{D+=(J*G)}}}}K.setSeconds(K.getSeconds()+D);return K};this.parseDateForICalDuration=function(F,J){var I=new Date(F);var E=new Date(J);var G=dotcal.calendar.date.daysBetween(F,J);if(G<0){G=0}var H=E.getHours()-I.getHours();var D=E.getMinutes()-I.getMinutes();if(D<0){H--;D=60+D}var C="P";if(G>0){C+=(G+"")+"D"}if(H>0||D>0){C+="T";if(H>0){C+=(H+"")+"H"}if(D>0){C+=(D+"")+"M"}}return C};this.daysBetween=function(G,F){var H=1000*60*60*24;var E=G.getTime();var D=F.getTime();var C=Math.abs(E-D);return Math.round(C/H)};this.getEventIdFromDate=function(C){return fleegix.date.util.strftime(C,"%Y-%m-%d")};this.getEventDateFromId=function(G){var D=G.substr(0,4);var E=G.substr(5,2);var C=G.substr(8,2);var F=new Date();return new Date(D,E-1,C,F.getHours(),F.getMinutes())};this.getFormattedHour=function(D){var C=fleegix.date.util.strftime(D,"%I");if(C.charAt(0)=="0"){C=C.charAt(1)}return C+":"+fleegix.date.util.strftime(D,"%M")+fleegix.date.util.strftime(D,"%p").toLowerCase()};this.getFormattedLongDate=function(D){var E=fleegix.date.util.weekdayLong[D.getDay()];var C=fleegix.date.util.monthLong[D.getMonth()];return E+" - "+C+fleegix.date.util.strftime(D," %d, %Y")};this.getFormattedShortDate=function(D){var E=fleegix.date.util.weekdayShort[D.getDay()];var C=fleegix.date.util.monthLong[D.getMonth()];return E+", "+C+fleegix.date.util.strftime(D," %d")};this.getFormattedShortDateWYear=function(C){return fleegix.date.util.monthShort[C.getMonth()]+" "+fleegix.date.util.strftime(C,"%d, %Y")};this.getFormattedShortTime=function(D){var E="";var C=fleegix.date.util.strftime(D,"%p").toLowerCase().substr(0,1);if(D.getMinutes()===0){E=fleegix.date.util.strftime(D,"%I")}else{E=fleegix.date.util.strftime(D,"%I:%M")}E=E.replace(/^0/,"");if(C=="p"){E+=C}return E};this.getDatePickerFormattedDate=function(C){if(C){return fleegix.date.util.strftime(C,"%Y-%m-%d")}};this.getWeekEasyTime=function(D){var C=new Date(D);if(C.getMinutes()!=30&&C.getMinutes()!==0){if(C.getMinutes()>30){var E=60-C.getMinutes();C.setMinutes(C.getMinutes()+E)}else{C.setMinutes(0)}}return C};this.getStartingTimeEndingDateTime=function(D,C){if(fleegix.date.util.weekdayShort[D.getDay()]==fleegix.date.util.weekdayShort[C.getDay()]){return dotcal.calendar.date.getFormattedHour(D)+"  to "+dotcal.calendar.date.getFormattedHour(C)}else{return dotcal.calendar.date.getFormattedHour(D)+"  to "+dotcal.calendar.date.getFormattedShortDate(C)+", "+dotcal.calendar.date.getFormattedHour(C)}};this.toUTCDateString=function(D){var C=fleegix.date.util.strftime(D,"%Y%m%dT%H%M%SZ");return C};this.getUTCDate=function(C){return new Date(C.getTime()+(C.getTimezoneOffset()*60*1000))};this.getWeekNumber=function(I){if(dotcal.calendar.fiscalYearStartTime){var D=new Date(I);var G=dotcal.calendar.fiscalYearStartTime-1;var C=new Date();var E=C.getFullYear();if(D.getMonth()<G){E--}var F=new Date(E,G,1,0,0);var H=0;while(F<D){H++;F.setDate(F.getDate()+1)}return Math.ceil(H/7)+1}};this.getLikelyLargestMonthForRange=function(J,F){var E=new Date(J);var D={};var I={};while(E<F){if(D[E.getMonth()]){D[E.getMonth()]++}else{D[E.getMonth()]=1;I[E.getMonth()]=E.getFullYear()}E.setDate(E.getDate()+1)}var H=null;for(var C in D){if(H){if(D[C]>D[H]){H=C}}else{H=C}}var G=new Date(parseInt(H,10)+1+"/1/"+I[H]);return G};this.getLastDayOfMonth=function(D){var C=new Date(D.getFullYear(),D.getMonth()+1,0);return C.getDate()};this.getTimezoneName=function(){var C=new Date(Date.UTC(2005,6,30,0,0,0,0));var F=-1*C.getTimezoneOffset();var D=new Date(Date.UTC(2005,12,30,0,0,0,0));var E=-1*D.getTimezoneOffset();if(-660==F&&-660==E){return"Pacific/Midway"}if(-600==F&&-600==E){return"Pacific/Tahiti"}if(-570==F&&-570==E){return"Pacific/Marquesas"}if(-540==F&&-600==E){return"America/Adak"}if(-540==F&&-540==E){return"Pacific/Gambier"}if(-480==F&&-540==E){return"US/Alaska"}if(-480==F&&-480==E){return"Pacific/Pitcairn"}if(-420==F&&-480==E){return"US/Pacific"}if(-420==F&&-420==E){return"US/Arizona"}if(-360==F&&-420==E){return"US/Mountain"}if(-360==F&&-360==E){return"America/Guatemala"}if(-360==F&&-300==E){return"Pacific/Easter"}if(-300==F&&-360==E){return"US/Central"}if(-300==F&&-300==E){return"America/Bogota"}if(-240==F&&-300==E){return"US/Eastern"}if(-240==F&&-240==E){return"America/Caracas"}if(-240==F&&-180==E){return"America/Santiago"}if(-180==F&&-240==E){return"Canada/Atlantic"}if(-180==F&&-180==E){return"America/Montevideo"}if(-180==F&&-120==E){return"America/Sao_Paulo"}if(-150==F&&-210==E){return"America/St_Johns"}if(-120==F&&-180==E){return"America/Godthab"}if(-120==F&&-120==E){return"America/Noronha"}if(-60==F&&-60==E){return"Atlantic/Cape_Verde"}if(0===F&&-60==E){return"Atlantic/Azores"}if(0===F&&0===E){return"Africa/Casablanca"}if(60==F&&0===E){return"Europe/London"}if(60==F&&60==E){return"Africa/Algiers"}if(60==F&&120==E){return"Africa/Windhoek"}if(120==F&&60==E){return"Europe/Amsterdam"}if(120==F&&120==E){return"Africa/Harare"}if(180==F&&120==E){return"Europe/Athens"}if(180==F&&180==E){return"Africa/Nairobi"}if(240==F&&180==E){return"Europe/Moscow"}if(240==F&&240==E){return"Asia/Dubai"}if(270==F&&210==E){return"Asia/Tehran"}if(270==F&&270==E){return"Asia/Kabul"}if(300==F&&240==E){return"Asia/Baku"}if(300==F&&300==E){return"Asia/Karachi"}if(330==F&&330==E){return"Asia/Calcutta"}if(345==F&&345==E){return"Asia/Katmandu"}if(360==F&&300==E){return"Asia/Yekaterinburg"}if(360==F&&360==E){return"Asia/Colombo"}if(390==F&&390==E){return"Asia/Rangoon"}if(420==F&&360==E){return"Asia/Almaty"}if(420==F&&420==E){return"Asia/Bangkok"}if(480==F&&420==E){return"Asia/Krasnoyarsk"}if(480==F&&480==E){return"Australia/Perth"}if(540==F&&480==E){return"Asia/Irkutsk"}if(540==F&&540==E){return"Asia/Tokyo"}if(570==F&&570==E){return"Australia/Darwin"}if(570==F&&630==E){return"Australia/Adelaide"}if(600==F&&540==E){return"Asia/Yakutsk"}if(600==F&&600==E){return"Australia/Brisbane"}if(600==F&&660==E){return"Australia/Sydney"}if(630==F&&660==E){return"Australia/Lord_Howe"}if(660==F&&600==E){return"Asia/Vladivostok"}if(660==F&&660==E){return"Pacific/Guadalcanal"}if(690==F&&690==E){return"Pacific/Norfolk"}if(720==F&&660==E){return"Asia/Magadan"}if(720==F&&720==E){return"Pacific/Fiji"}if(720==F&&780==E){return"Pacific/Auckland"}if(765==F&&825==E){return"Pacific/Chatham"}if(780==F&&780==E){return"Pacific/Enderbury"}if(840==F&&840==E){return"Pacific/Kiritimati"}return"US/Pacific"}};dotcal.calendar.views=new function(){this.viewTypes={YEAR:"year",MONTH:"month",WEEK:"week",DAY:"day"};this.viewModes={BOX:"box",LIST:"list"};this.currentUI={EMBED:"embed",CALENDAR:"render"};this.currDate=new Date();this.currDate.setHours(0);this.currDate.setMinutes(0);this.currDate.setSeconds(0);this.currMode=this.viewModes.BOX;this.currView=this.viewTypes.MONTH;this.ui=null;this.firstDisplayDate=null;this.lastDisplayDate=null;this.displayBoxEventTime={MONTH:true,WEEK:true,DAY:true};this.expandedView=false;this.initViewPreferences=function(){dotcal.calendar.views.currMode=dotcal.user.currUser.view_preferences.mode;if(dotcal.calendar.views.currMode==dotcal.calendar.views.viewModes.LIST){$("#ns-list-view").html("Grid View")}if(dotcal.user.currUser.view_preferences.view=="single"){dotcal.calendar.render.multiView=false}else{if(dotcal.user.currUser.view_preferences.view=="multi"){dotcal.calendar.render.multiView=true;$("#ns-tabs-view").addClass("ui-state-active").html("Single View").attr("title","Single Calendar View")}}dotcal.calendar.views.currView=dotcal.user.currUser.view_preferences.zoom;if(dotcal.user.currUser.fiscal_year_starting){dotcal.calendar.fiscalYearStartTime=dotcal.user.currUser.fiscal_year_starting}if(dotcal.user.currUser.histogram=="1"){dotcal.calendar.render.populateHistogram=true}};this.setFirstAndLastDisplayDates=function(E,F,C){var B=false;var D=false;if(F){B=true}if(C){D=true}if(!F){if(dotcal.calendar.views.currView==dotcal.calendar.views.viewTypes.MONTH){F=dotcal.calendar.date.getFirstSunday(E)}else{if(dotcal.calendar.views.currView==dotcal.calendar.views.viewTypes.YEAR){F=new Date(E.getFullYear(),"0","1")}else{if(dotcal.calendar.views.currView==dotcal.calendar.views.viewTypes.DAY){dotcal.calendar.views.resetCurrDateTimeToMidnight();F=new Date(E)}}}if(dotcal.calendar.views.currView==dotcal.calendar.views.viewTypes.WEEK){dotcal.calendar.views.resetCurrDateTimeToMidnight();F=dotcal.calendar.date.getFirstSundayOfWeek(E);F.setHours(E.getHours())}}if(!C){if(dotcal.calendar.views.currView==dotcal.calendar.views.viewTypes.MONTH){if(dotcal.calendar.views.viewModes.LIST==dotcal.calendar.views.currMode){C=new Date(E);C.setDate(1);C.setMonth(C.getMonth()+3);C=dotcal.calendar.date.getLastSaturday(C)}else{C=dotcal.calendar.date.getLastSaturday(E)}}else{if(dotcal.calendar.views.currView==dotcal.calendar.views.viewTypes.YEAR){C=new Date(E.getFullYear(),"11","1")}else{if(dotcal.calendar.views.currView==dotcal.calendar.views.viewTypes.DAY){C=new Date(F);C.setHours(C.getHours()+24)}else{if(dotcal.calendar.views.currView==dotcal.calendar.views.viewTypes.WEEK){dotcal.calendar.views.resetCurrDateTimeToMidnight();C=new Date(F);C.setDate(C.getDate()+7)}}}}}if(dotcal.calendar.views.currView==dotcal.calendar.views.viewTypes.MONTH&&dotcal.calendar.views.ui==dotcal.calendar.views.currentUI.CALENDAR){if(!B&&!D){var A=dotcal.calendar.date.daysBetween(E,C);if(A<15){F.setDate(F.getDate()+14);C.setDate(C.getDate()+14)}}}dotcal.calendar.views.firstDisplayDate=F;dotcal.calendar.views.lastDisplayDate=C};this.resetCurrDateTimeToMidnight=function(){this.currDate.setHours(0);this.currDate.setMinutes(0);this.currDate.setSeconds(0)}};dotcal.calendar.views.util=new function(){this.getViewTypeFromPosition=function(A){var B=null;for(var C in dotcal.calendar.views.viewTypes){if(dotcal.calendar.views.viewTypes.hasOwnProperty(C)){B=dotcal.calendar.views.viewTypes[C];if(dotcal.calendar.views.box[B].getPosition()==A){return B}}}};this.moveTo=function(A,C,B){var D=dotcal.calendar.views.currView;dotcal.calendar.views.currDate=B;dotcal.calendar.views.currView=A;$("#view #bar").slider("value",dotcal.calendar.views.box[A].getPosition());dotcal.calendar.render.render();dotcal.calendar.views.util.resetHistogram(B);dotcal.calendar.render.getCollectionAndDrawEvents();dotcal.calendar.render.setProperty("zoom",A)};this.resetHistogram=function(D){var E=new Date(D);var B=new Date(D);var C=Math.ceil($("#histogram").width()/80);B.setMonth(B.getMonth()-C);var F=dotcal.calendar.views.box[dotcal.calendar.views.currView].histogramDateFormatting(E);var A=dotcal.calendar.views.box[dotcal.calendar.views.currView].histogramDateFormatting(B);$("#histogram").histogram("option","mode",dotcal.calendar.views[dotcal.calendar.views.currMode][dotcal.calendar.views.currView].getPosition());$("#histogram").histogram("option","current",F);$("#histogram").histogram("option","position",A);$("#histogram").histogram("redraw")}};dotcal.calendar.views.box={};dotcal.calendar.views.list={};dotcal.calendar.views.box.month=new function(){this.monthWeeks=[];this.monthStart=null;this.monthEnd=null;this.position=1;this.getPosition=function(){return this.position};this.getDateText=function(A){return fleegix.date.util.monthLong[A.getMonth()]+" "+A.getFullYear()};this.getNavButtonValues=function(){return["Previous Month","Previous Week","Next Week","Next Month"]};this.rePopulateCell=function(A,B){this.unpopulate();this.populate(A,B)};this.convertIdToDate=function(D){var B=dotcal.calendar.date.getEventDateFromId(D);var A=dotcal.calendar.date.getWeekEasyTime(new Date());var C=new Date(B.getFullYear(),B.getMonth(),B.getDate(),A.getHours(),A.getMinutes());return C};this.colorizeEvents=function(A){$("[collection="+A.id+"]").children(".innerWrap").addClass("color").css("background-color",A.event_color)};this.histogramDateFormatting=function(A){var B=fleegix.date.util.strftime(A,"%Y-%m-%d-%H-%M-%S");return B.substr(0,7)};this.unpopulate=function(){dotcal.calendar.views.box.day.unpopulate()};this.render=function(F,B,E,C){this.monthWeeks=[];var N=new Date(E);var H=new Date();var P="";if(dotcal.calendar.views.ui==dotcal.calendar.views.currentUI.CALENDAR){P=$("<table class=\"month ui-widget-content\" style=\"background: none transparent;\" cellspacing=\"0\" cellpadding=\"0\"></table>").appendTo(B)}else{P=$("<table class=\"month ui-widget-content\" cellspacing=\"0\" cellpadding=\"0\"></table>").appendTo(B)}var O=$("<thead></thead>").appendTo(P);var K=$("<tr class=\"monthHeader\" valign=\"middle\" align=\"center\"></tr>").appendTo(O);var G=null;if(dotcal.calendar.fiscalYearStartTime){$("<th class=\"weekDisplayDay weekDay ui-state-hover\">Week</th>").appendTo(K)}for(var M=0;M<fleegix.date.util.weekdayLong.length;M++){G=fleegix.date.util.weekdayShort[M];$("<th class=\"weekDay ui-state-hover\">"+G+"</th>").appendTo(K)}if(!dotcal.calendar.fiscalYearStartTime){$(".monthHeader .weekDay:first").addClass("ui-state-hover first")}$(".monthHeader .weekDay:last").addClass("ui-state-hover last");var S=null;S=$("<tbody></tbody>");S.appendTo(P);var Q=0;var J=function(T){tr=$("<tr id=\"monthRow_"+T+"\" class=\"monthRow\"></tr>").appendTo(S);Q++};var D;var L;var A;while(N.getTime()<C.getTime()){D=dotcal.calendar.date.getEventIdFromDate(N);if((N.getMonth()%2)===0){oddEven=" even ui-state-default"}else{oddEven=" odd ui-state-hover"}if(N.getDay()===0){if((Q==5||Q==6)&&(N.getFullYear()==C.getFullYear()&&N.getMonth()==C.getMonth()&&N.getDate()==C.getDate())){break}J(Q);if(dotcal.calendar.fiscalYearStartTime){var I=dotcal.calendar.date.getWeekNumber(N);$("<td id=\"week-"+dotcal.calendar.date.getEventIdFromDate(N)+"\" class=\"weekDisplayCell ui-state-hover\" valign=\"middle\" align=\"center\"><span>"+I+"</span></td>").appendTo(tr)}}A="cell";if(N.getDay()==6){A+=" last"}var R="";if(fleegix.date.util.strftime(N,"%d").replace(/^0/,"")==1){R="<div class=\"monthName\" align=\"center\">"+fleegix.date.util.monthLong[N.getMonth()]+"</div>"}L=$("<td id=\""+D+"\" class=\""+A+oddEven+"\"><div class=\"header\"><div class=\"buttons\"></div><div id=\"date_"+D+"\" class=\"date\">"+fleegix.date.util.strftime(N,"%d").replace(/^0/,"")+"</div>"+R+"</div></td>");L.appendTo(tr);if(dotcal.calendar.views.ui==dotcal.calendar.views.currentUI.CALENDAR){dotcal.calendar.event.addDroppableActionsToCalendarCell(L);dotcal.calendar.event.addEventCreateToDOMNode(L)}if(H.getDate()==N.getDate()&&H.getMonth()==N.getMonth()&&H.getFullYear()==N.getFullYear()){L.removeClass("ui-state-default");L.removeClass("ui-state-hover");L.addClass("ui-state-highlight")}N.setDate(N.getDate()+1)}if(Q==5){$("<div id=\"monthRow_spacer\" class=\"ui-widget-content\"></div>").appendTo(B)}if(dotcal.calendar.views.ui==dotcal.calendar.views.currentUI.CALENDAR){$(".date").click(function(){var U=$(this).attr("id").replace(/date_/,"");var T=dotcal.calendar.date.getEventDateFromId(U);dotcal.calendar.views.util.moveTo(dotcal.calendar.views.viewTypes.DAY,dotcal.calendar.views.viewModes.BOX,T)})}if(dotcal.calendar.fiscalYearStartTime){$(".weekDisplayCell").click(function(){var U=$(this).attr("id").replace(/week-/,"");var T=dotcal.calendar.views.box.week.convertIdToDate(U);dotcal.calendar.views.util.moveTo(dotcal.calendar.views.viewTypes.WEEK,dotcal.calendar.views.viewModes.BOX,T)})}};this.populate=function(G,I,E){this.monthStart=new Date(dotcal.calendar.views.firstDisplayDate);this.monthEnd=new Date(dotcal.calendar.views.lastDisplayDate);var H=null;var L=null;if(dotcal.calendar.views.ui==dotcal.calendar.views.currentUI.EMBED){L=2}else{L=4}if((dotcal.calendar.views.ui==dotcal.calendar.views.currentUI.CALENDAR)&&dotcal.calendar.render.multiView){if(this.monthWeeks.length===0){this.createMonthWeeks()}}else{this.createMonthWeeks()}this.populateWeeks(I);for(H=0;H<this.monthWeeks.length;H++){this.tileEventsForWeek(H)}var J=0;var C=false;if(E){C=true}for(H=0;H<this.monthWeeks.length;H++){var D=this.monthWeeks[H];var M;for(var F=0;F<D.data.length;F++){var A=D.data[F];J=0;var B=dotcal.calendar.date.getEventIdFromDate(A.dtstart);$("#"+B).find("*[collection]").each(function(O){J++});var N=false;if(A.rowForWeek[H]<=L){N=true}if(N&&($("#"+A.id+"_draggable").length===0||A.multipleDisplayOK)){this.populateEvent(A,H,C,N)}else{this.populateEvent(A,H,C,N)}if(!N){if($("#"+B+" .header .buttons").children(".more").length===0&&$("#"+B+" .header .buttons").children(".more-txt").length===0){var K=null;if($("#"+B+" .header").children(".monthName").length===0){K=$("<a id=\"more-"+B+"\" bref=\"&nbsp;\" name=\"more-"+B+"\" class=\"more-txt\">more</a>")}else{K=$("<span id=\"more-"+B+"\" bref=\"&nbsp;\" name=\"more-"+B+"\" class=\"more ui-icon ui-icon-circle-triangle-s\"></span>")}K.appendTo("#"+B+" .header .buttons");K.tomnoddy({blowBubble:dotcal.calendar.event.drawMoreBubbleInsides});K.tomnoddy("option","blow",500)}}}}};this.populateEvent=function(B,E,A,C){var D=dotcal.calendar.event.placeEventDIV(B,A,"#calendar",dotcal.calendar.views.displayBoxEventTime.MONTH);this.positionEventDIV(D,B,E);if(!C){D.hide()}};this.positionEventDIV=function(D,A,C){var B=0;D.css("position","absolute");if(dotcal.calendar.fiscalYearStartTime){D.css("left",(13.714*A.startColForWeek[C])+"%");if($.browser.msie){D.css("margin-left","4.2%")}else{D.css("margin-left","4%")}D.css("width",(13.714*A.colWidthForWeek[C])+"%")}else{D.css("left",(14.285*A.startColForWeek[C])+"%");D.css("width",(14.285*A.colWidthForWeek[C])+"%")}if(dotcal.calendar.views.ui==dotcal.calendar.views.currentUI.EMBED){if($.browser.safari||$.browser.msie){B=(6.95*C)}else{B=(6.9*C)}}else{if($.browser.safari||$.browser.msie){B=(10.96*C)}else{B=(10.9*C)}}if($.browser.msie&&$.browser.version.substring(0,1)==="6"){B+=(1.82*A.rowForWeek[C])+4.2}else{B+=(1.7*A.rowForWeek[C])+4.2}D.css("top",B+"em")};this.getMiniCal=function(F,G){var B=dotcal.calendar.date.getFirstSunday(F);var E=dotcal.calendar.date.getLastSaturday(F);var H=new Date();var I=G.split("-");var C="miniCal_"+I[1]+"-"+I[2];var A=$("<div id=\""+C+"\" class=\"miniCal\"></div>").appendTo(G);var D=$("<div id=\""+dotcal.calendar.date.getEventIdFromDate(F)+"_nav\" class=\"miniCalHeader\">"+fleegix.date.util.monthLong[F.getMonth()]+"</div>").appendTo("#"+C);D.click(function(){var K=$(this).attr("id").replace(/_nav/,"");var J=dotcal.calendar.date.getEventDateFromId(K);dotcal.calendar.views.util.moveTo(dotcal.calendar.views.viewTypes.MONTH,dotcal.calendar.views.viewModes.BOX,J)});if(F.getFullYear()==H.getFullYear()&&F.getMonth()==H.getMonth()&&F.getDate()==H.getDate()){}this.render(F,A,B,E)};this.createMonthWeeks=function(){var A=new Date(this.monthStart);var B=new Date(this.monthStart);B.setDate(B.getDate()+7);var C=0;while(A<this.monthEnd){this.monthWeeks[C]={start:new Date(A),end:new Date(B),data:[]};A.setDate(A.getDate()+7);B.setDate(B.getDate()+7);C++}};this.populateWeeks=function(G){for(var F=0;G.events.length>F;F++){var I=G.events[F];if(I.dtstart.getTime()>this.monthEnd.getTime()){return }var C=new Date(I.dtstart);var E=new Date(I.dtend);C.setHours(0);C.setMinutes(0);E.setHours(0);E.setMinutes(0);var J=fleegix.date.util.diff(this.monthStart,C,fleegix.date.util.dateParts.DAY);if(J<0&&(I.dtend.getTime()<this.monthStart.getTime())){continue}var D=parseInt(J/7,10);if(D<0){D=0}var H=fleegix.date.util.diff(C,E,fleegix.date.util.dateParts.DAY)+1;if(I.duration=="P1D"){H=1}if(H>1&&D>=0){var B;for(var A=D;A<this.monthWeeks.length;A++){B=this.monthWeeks[A];if(I.dtend.getTime()>B.start.getTime()){I.multipleDisplayOK=true;B.data.push(I)}}}else{if(this.monthWeeks[D]&&D>=0){this.monthWeeks[D].data.push(I)}}I.rowForWeek=[];I.startColForWeek=[];I.colWidthForWeek=[]}};this.tileEventsForWeek=function(B){var C=this.monthWeeks[B];var K=[[],[],[],[],[],[],[]];var G=function(P,O,N){var M;for(M=O;M<N+1;M++){if(K[M][P]){return false}}for(M=O;M<N+1;M++){K[M][P]=1}return true};var J;var A;var I;var L;var D;var H;var E;for(var F=0;F<C.data.length;F++){J=C.data[F];D=J.dtstart;H=J.dtend;A=0;I=0;A=(D.getTime()<C.start.getTime())?0:D.getDay();I=(H.getTime()>C.end.getTime())?6:H.getDay();J.colWidthForWeek[B]=I-A+1;if(J.duration=="P1D"||J.colWidthForWeek[B]===0){J.colWidthForWeek[B]=1;I=A}J.startColForWeek[B]=A;L=0;E=false;while(!E){if(G(L,A,I)){E=true;J.rowForWeek[B]=L}else{E=false;L++}}}};this.goBackShort=function(D,B){var A=dotcal.calendar.views[dotcal.calendar.views.currMode][dotcal.calendar.views.currView].getMoveUpDate(D);var C=dotcal.calendar.views[dotcal.calendar.views.currMode][dotcal.calendar.views.currView].getMoveUpDate(B);dotcal.calendar[dotcal.calendar.views.ui].render(null,A,C);dotcal.calendar[dotcal.calendar.views.ui].getCollectionAndDrawEvents(dotcal.calendar.currCollectionID,A,C)};this.goForwardShort=function(D,B){var A=dotcal.calendar.views[dotcal.calendar.views.currMode][dotcal.calendar.views.currView].getMoveDownDate(D);var C=dotcal.calendar.views[dotcal.calendar.views.currMode][dotcal.calendar.views.currView].getMoveDownDate(B);dotcal.calendar[dotcal.calendar.views.ui].render(null,A,C);dotcal.calendar[dotcal.calendar.views.ui].getCollectionAndDrawEvents(dotcal.calendar.currCollectionID,A,C)};this.goBackLong=function(D,B){dotcal.calendar.views.currDate.setDate(1);dotcal.calendar.views.currDate.setMonth(dotcal.calendar.views.currDate.getMonth()-1);var A=dotcal.calendar.date.getFirstSunday(dotcal.calendar.views.currDate);var C=dotcal.calendar.date.getLastSaturday(dotcal.calendar.views.currDate);dotcal.calendar[dotcal.calendar.views.ui].render(null,A,C);dotcal.calendar[dotcal.calendar.views.ui].getCollectionAndDrawEvents(dotcal.calendar.currCollectionID,A,C)};this.goForwardLong=function(D,B){dotcal.calendar.views.currDate.setDate(1);dotcal.calendar.views.currDate.setMonth(dotcal.calendar.views.currDate.getMonth()+1);var A=dotcal.calendar.date.getFirstSunday(dotcal.calendar.views.currDate);var C=dotcal.calendar.date.getLastSaturday(dotcal.calendar.views.currDate);dotcal.calendar[dotcal.calendar.views.ui].render(null,A,C);dotcal.calendar[dotcal.calendar.views.ui].getCollectionAndDrawEvents(dotcal.calendar.currCollectionID,A,C)};this.getMoveUpDate=function(B){var A=new Date(B);A.setDate(A.getDate()-7);return A};this.getMoveDownDate=function(B){var A=new Date(B);A.setDate(A.getDate()+7);return A};this.getMoveRightEndDate=function(B,A){};this.getMoveRightStartDate=function(C,B){var A=new Date(B);return A};this.getMoveLeftStartDate=function(B,A){}};dotcal.calendar.views.list.month=new function(){this.position=dotcal.calendar.views.box.month.position;this.getPosition=function(){return this.position};this.getDateText=function(E){var B=$("#listContent").children(".listParent");var D=null;if(B.length>0){D=$(B[0]).attr("id").replace(/listParent_/,"")}var C="";if(D){var F=dotcal.calendar.date.getEventDateFromId(D);var A;var G="small";if(G=="small"){A=""}else{A=" - "+dotcal.calendar.date.getFormattedShortDateWYear(dotcal.calendar.views.lastDisplayDate)}C=dotcal.calendar.date.getFormattedShortDateWYear(F)+A}else{C=".. to "+dotcal.calendar.date.getFormattedShortDateWYear(dotcal.calendar.views.lastDisplayDate)}return C};this.getNavButtonValues=function(){return["Go Back An Event","Go Back An Event","Go To Next Event","Go To Next Event"]};this.rePopulateCell=function(A,B){this.unpopulate();$("#listView").remove();this.render(dotcal.calendar.views.currDate,$("#calendar"));this.populate(dotcal.calendar.views.currDate,B)};this.colorizeEvents=function(A){};this.convertIdToDate=function(A){return dotcal.calendar.views.box.day.convertIdToDate(A)};this.unpopulate=function(){$(".listParent").unbind("tomnoddy");$(".listParent").remove()};this.render=function(C,F,E,A){var D=null;if(dotcal.calendar.views.ui==dotcal.calendar.views.currentUI.EMBED){D=$("<div id=\"listView\" class=\"ui-widget-content\"></div>").appendTo(F)}else{D=$("<div id=\"listView\" class=\"ui-widget-content ui-corner-all\"></div>").appendTo(F)}var B=$("<ul id=\"expandCollapse\"></ul>").appendTo(D);$("<li><button class=\"expandList ui-state-default ui-corner-all\" title=\"Expand all entries in the list\">Expand All</button></li>").appendTo(B);$("<li><button class=\"collapseList ui-state-default ui-corner-all\" title=\"Collapse all entries in the list\">Collapse All</button></li>").appendTo(B);$("<div class=\"clear\"/>").appendTo(D);$(".ui-state-default").hover(function(){$(this).addClass("ui-state-hover")},function(){$(this).removeClass("ui-state-hover")});$("<div id=\"listContent\"></div>").appendTo(D);$(".expandList").click(function(){$(".listEventInfo").show();$(".listEventToggle").removeClass("ui-icon-circle-plus").addClass("ui-icon-circle-minus")});$(".collapseList").click(function(){$(".listEventInfo").hide();$(".listEventToggle").removeClass("ui-icon-circle-minus").addClass("ui-icon-circle-plus")})};this.populate=function(N,W,X){var H=$("#listContent");var Q=dotcal.calendar.event.getEventsForTodayAndBeyond(N,W);if(!Q||Q.events.length===0){if($("#noEvents").length===0){$("<p id=\"noEvents\" class=\"ui-state-error ui-corner-all\" style=\"padding: 5px; background-image: none;\">There are no upcoming events to display for this view.</p>").appendTo(H)}return false}$("#noEvents").remove();var I=dotcal.calendar.event.groupAllEventsOfSameDateTogether(Q);for(var c in I){if(I.hasOwnProperty(c)){var S=$("<div id=\"listParent_"+c+"\" class=\"listParent\"></div>").appendTo(H);var g=$("<div class=\"listTitle ui-state-hover ui-corner-all clearfix\">"+dotcal.calendar.date.getFormattedLongDate(I[c][0].dtstart)+"</div>").appendTo(S);if(dotcal.calendar.views.ui==dotcal.calendar.views.currentUI.CALENDAR){var K=$("<button id=\"allday_"+dotcal.calendar.date.getEventIdFromDate(I[c][0].dtstart)+"\" class=\"ui-state-default ui-corner-all\" style=\"float: right;\">Create Event</button>");$(g).prepend(K);dotcal.calendar.event.addEventCreateToDOMNode(K,"click")}var F=$("<ul id=\"listParentListNode_"+c+"\" class=\"listDetails\"></ul>").appendTo(S);for(var Z=0;Z<I[c].length;Z++){var Y=I[c][Z];var L=$("<li class=\"listChildItem clearfix\"></li>").appendTo(F);var R="&nbsp;";if(Y.duration!="P1D"){R=dotcal.calendar.date.getFormattedShortTime(Y.dtstart)}$("<span class=\"listEventTime\"><strong>"+R+"</strong></span>").appendTo(L);var M=null;if(!Y.summary){M="(No title)"}else{M=Y.summary}var B=null;if(Y.duration!="P1D"){B=dotcal.calendar.date.getStartingTimeEndingDateTime(Y.dtstart,Y.dtend)}else{B="All Day"}var U="";if(!dotcal.calendar.views.expandedView){U="ui-icon-circle-plus"}else{U="ui-icon-circle-minus"}$("<span class=\"listEventToggle ui-icon "+U+"\"></span><span id=\"bid-"+Y.id+"\" event_id=\""+Y.id+"\" bref=\"&nbsp;\" class=\"listEventTitle\">"+M+" ("+B+")</span>").appendTo(L);var b=$("<div id=\"listEventInfo_"+Y.id+"\" class=\"listEventInfo ui-widget-content clearfix\"></div>").appendTo(L);if(!dotcal.calendar.views.expandedView){b.hide()}if(Y.duration!="P1D"){var A=$("<div class=\"listEventItem\"></div>").appendTo(b);$("<span class=\"listEventLabel\"><strong>When:  </strong></span>").appendTo(A);$("<span id=\"listEventValue\">"+dotcal.calendar.date.getStartingTimeEndingDateTime(Y.dtstart,Y.dtend)+"</span>").appendTo(A)}if(Y.venue){var P=$("<div class=\"listEventItem\"></div>");P.appendTo(b);$("<span class=\"listEventLabel\"><strong>Place:  </strong></span>").appendTo(P);$("<span id=\"listEventValue\">"+Y.venue+"</span>").appendTo(P)}if(Y.location){var V=$("<div class=\"listEventItem\"></div>");V.appendTo(b);var C="http://maps.google.com/?q="+encodeURIComponent(Y.location);var a=Y.location+" <a href=\""+C+"\" target=\"_blank\">(<strong>map</strong>)</a>";$("<span class=\"listEventLabel\"><strong>Where:  </strong></span>").appendTo(V);$("<span id=\"listEventValue\">"+a+"</span>").appendTo(V)}if(Y.url){var E=$("<div class=\"listEventItem\"></div>");E.appendTo(b);var G="<a href=\""+Y.url+"\">"+Y.url+"</a>";$("<span class=\"listEventLabel\"><strong>Website:  </strong></span>").appendTo(E);$("<span id=\"listEventValue\">"+G+"</span>").appendTo(E)}if(Y.body){var O=$("<div class=\"listEventItem\"></div>").appendTo(b);$("<span class=\"listEventLabel\"><strong>Description:  </strong></span>").appendTo(O);$("<span id=\"listEventValue\">"+Y.body+"</span>").appendTo(O)}var h=$("<div class=\"subscribe listEventItem clearfix\"></div>");h.appendTo(b);$("<span class=\"listEventLabel txt\"><strong>Add this event to my:  </strong></span>").appendTo(h);var d=$("<span class=\"listEventValue share\"></span>");d.appendTo(h);dotcal.calendar.event.attachSharingToDOMNode(d,Y);var J=$("<div class=\"subscribe listEventItem clearfix\"></div>");J.appendTo(b);$("<span class=\"listEventLabel txt\"><strong>Share with my Friends:  </strong></span>").appendTo(J);var D=$("<span class=\"listEventValue share\"></span>");D.appendTo(J);dotcal.calendar.event.attachSocialNetworksToDOMNode(D,Y);var T=dotcal.calendar.event.drawEventBubbleInsides;if(W.type!=dotcal.calendar.types.NORMAL||dotcal.calendar.views.ui==dotcal.calendar.views.currentUI.EMBED){T=dotcal.calendar.event.drawReadOnlyEventBubbleInsides}if(dotcal.calendar.views.ui==dotcal.calendar.views.currentUI.CALENDAR){$("#bid-"+Y.id).tomnoddy({blowBubble:T})}else{if(dotcal.calendar.views.ui==dotcal.calendar.views.currentUI.EMBED){$("#bid-"+Y.id).tomnoddy({blowBubble:T})}}}}}$(".listEventToggle").bind("click",function(i){if($(this).parent().children(".listEventInfo").is(":hidden")){$(this).removeClass("ui-icon-circle-plus").addClass("ui-icon-circle-minus");$(this).parent().children(".listEventInfo").show()}else{if($(this).parent().children(".listEventInfo").is(":visible")){$(this).removeClass("ui-icon-circle-minus").addClass("ui-icon-circle-plus");$(this).parent().children(".listEventInfo").hide()}}});$(".ui-state-default").hover(function(){$(this).addClass("ui-state-hover")},function(){$(this).removeClass("ui-state-hover")});$(".listEventTitle").hover(function(){$(this).addClass("underline")},function(){$(this).removeClass("underline")});if(Q.events.length>0){dotcal.calendar.views.currDate=new Date(Q.events[0].dtstart);dotcal.calendar.views.currDate.setHours(0);dotcal.calendar.views.currDate.setMinutes(0);dotcal.calendar.views.currDate.setSeconds(0)}};this.goBackShort=function(H,B){var G=dotcal.calendar.getCurrentCollection();var F=null;var C=new Date(dotcal.calendar.views.currDate.valueOf());for(var E in G.events){if(G.events.hasOwnProperty(E)){if(C.getDate()<dotcal.calendar.views.currDate.getDate()&&C.getMonth()==dotcal.calendar.views.currDate.getMonth()){F=new Date(C.valueOf())}C=new Date(G.events[E].dtstart.valueOf())}}if(F&&dotcal.calendar.views.currDate.getMonth()==F.getMonth()&&dotcal.calendar.views.currDate.getFullYear()==F.getFullYear()){dotcal.calendar.views.currDate.setDate(F.getDate())}else{dotcal.calendar.views.currDate.setDate(0)}var A=new Date(F);var D=new Date(A);D.setMonth(D.getMonth()+1);dotcal.calendar[dotcal.calendar.views.ui].render(null,A,D);dotcal.calendar[dotcal.calendar.views.ui].getCollectionAndDrawEvents(dotcal.calendar.currCollectionID)};this.goForwardShort=function(B,E){var G=dotcal.calendar.getCurrentCollection();var F=dotcal.calendar.views.currDate;var J=dotcal.calendar.event.getEventsForTodayAndBeyond(dotcal.calendar.views.currDate,G);var H=dotcal.calendar.event.groupAllEventsOfSameDateTogether(J);var D=null;for(var I in H){if(H.hasOwnProperty(I)){I=H[I][0];if(I.dtstart.getFullYear()>F.getFullYear()||I.dtstart.getMonth()>F.getMonth()||I.dtstart.getDate()>F.getDate()){D=new Date(I.dtstart);break}}}if(D&&dotcal.calendar.views.currDate.getMonth()==D.getMonth()&&dotcal.calendar.views.currDate.getFullYear()==D.getFullYear()&&dotcal.calendar.views.currDate.getDate()<D.getDate()){dotcal.calendar.views.currDate.setDate(D.getDate())}else{dotcal.calendar.views.currDate.setDate(dotcal.calendar.date.getLastDayOfMonth(dotcal.calendar.views.currDate)+1)}var A=new Date(D);var C=new Date(A);C.setMonth(C.getMonth()+1);dotcal.calendar[dotcal.calendar.views.ui].render(null,A,C);dotcal.calendar[dotcal.calendar.views.ui].getCollectionAndDrawEvents(dotcal.calendar.currCollectionID)};this.goBackLong=function(B,A){this.goBackShort(B,A)};this.goForwardLong=function(B,A){this.goForwardShort(B,A)};this.getMoveUpDate=function(A){return dotcal.calendar.views.box.month.getMoveUpDate(A)};this.getMoveDownDate=function(A){return dotcal.calendar.views.box.month.getMoveDownDate(A)};this.getMoveRightEndDate=function(B,A){return dotcal.calendar.views.box.month.getMoveRightEndDate(B,A)};this.getMoveRightStartDate=function(B,A){return dotcal.calendar.views.box.month.getMoveRightStartDate(B,A)};this.getMoveLeftStartDate=function(B,A){return dotcal.calendar.views.box.month.getMoveLeftStartDate(B,A)}};dotcal.calendar.views.box.day=new function(){this.scrollTopSet=false;this.position=3;this.getPosition=function(){return this.position};this.getDateText=function(A){return dotcal.calendar.date.getFormattedLongDate(A)};this.getNavButtonValues=function(){return["Previous Day","Previous Day","Next  Day","Next Day"]};this.convertIdToDate=function(G){var D=G.substr(0,4);var E=G.substr(5,2);var C=G.substr(8,2);var B=G.substr(11,2);var F=G.substr(14,2);var A=new Date(D,E-1,C,B,F);return A};this.histogramDateFormatting=function(A){var B=fleegix.date.util.strftime(A,"%Y-%m-%d-%H-%M-%S");return B.substr(0,13)};this.rePopulateCell=function(C,E){var G=dotcal.calendar.event.getFullEventsByDateForCollection(C,E);var H=[];var I=G.events;for(var F in I){if(I.hasOwnProperty(F)){var D=dotcal.calendar.date.getWeekEasyTime(I[F].dtstart);if(D.getHours()==C.getHours()&&D.getMinutes()==C.getMinutes()){H.push(I[F])}}}var B=this.getHourHalfID(C);$("#"+B).children().remove();var A=dotcal.calendar.getCollectionFromEvents(H);this.populate(C,A)};this.colorizeEvents=function(A){$("[collection="+A.id+"]").addClass("ui-state-active").css("background",A.event_color).css("background-image","none")};this.unpopulate=function(){if(dotcal.calendar.collections.length!==0){$("[collection]").remove();$(".more-txt").remove();$(".cell").unbind("tomnoddy")}};this.render=function(D,F,B,C){var K=$("<table cellpadding=\"0\" cellspacing=\"0\"></table>").appendTo(F);var I=$("<thead></thead>").appendTo(K);var G=$("<tr id=\"dayHeader\" valign=\"middle\" align=\"left\"><th class=\"timeHeader ui-state-hover\">Time</th></tr>").appendTo(I);var E=$("<tbody></tbody>").appendTo(K);var L=$("<tr id=\"allDay\" valign=\"top\" align=\"left\"></tr>").appendTo(E);$("<td id=\"allDayHeader\" class=\"ui-widget-header\" valign=\"middle\">All<br />Day</td>").appendTo(L);var H=$("<td><div class=\"ui-widget-header\"><table cellpadding=\"0\" cellspacing=\"0\"><tr valign=\"top\" align=\"left\"></tr></table></div></td>").appendTo(L);var J=$("<tr id=\"days\"><td colspan=\"2\"><div class=\"scroll ui-widget-content\"><table id=\"hours\" cellpadding=\"0\" cellspacing=\"0\"></table></div></td></tr>").appendTo(E);var A=$(J).children().children().children("table");dotcal.calendar.views.box.day.renderDayEventTimes(D,A,B,C);dotcal.calendar.views.box.day.renderDayEventContainers(D,A,B,C);$(".dayHeader:last").addClass("ui-state-hover last")};this.renderDayEventTimes=function(E,H,G,A){var F=new Date(G);var C=new Date(A);var B=null;while(F<C){if(F.getMinutes()===0){B=fleegix.date.util.strftime(F,"%I%p").replace(/^0/,"")}else{B=""}var D=$("<tr id=\""+fleegix.date.util.strftime(F,"%k-%M").replace(/ /,"")+"\" valign=\"top\" align=\"left\"></tr>").appendTo(H);if(!B){B="&nbsp;"}$("<td class=\"timeOfDay ui-state-hover\" valign=\"middle\"><span>"+B+"</span></td>").appendTo(D);F.setMinutes(F.getMinutes()+30)}};this.renderDayEventContainers=function(F,G,B,D){var E=new Date(B);var J=new Date(D);var C=dotcal.calendar.date.getEventIdFromDate(F);var H=$("<td id=\"allday_"+dotcal.calendar.date.getEventIdFromDate(F)+"\" class=\"allDayCell cell ui-widget-header\"></td>");H.appendTo("#allDay table tr");if(dotcal.calendar.views.ui==dotcal.calendar.views.currentUI.CALENDAR){dotcal.calendar.event.addDroppableActionsToCalendarCell(H);dotcal.calendar.event.addEventCreateToDOMNode(H)}$("<th id=\"header_"+C+"\" class=\"dayHeader ui-state-hover\">"+fleegix.date.util.weekdayShort[B.getDay()]+"<span class=\"date\">"+fleegix.date.util.strftime(B,"%m")+"/"+fleegix.date.util.strftime(B,"%e").replace(/ /,"")+"</span></th>").appendTo("#dayHeader");var K=new Date();var A=dotcal.calendar.date.getWeekEasyTime(K);var I=null;while(E<J){I=$("<td id=\""+this.getHourHalfID(E)+"\" class=\"cell dayEvents ui-state-default\" valign=\"top\"></td>");I.appendTo("#"+fleegix.date.util.strftime(E,"%k-%M").replace(/ /,""));if(dotcal.calendar.views.ui==dotcal.calendar.views.currentUI.CALENDAR){dotcal.calendar.event.addEventCreateToDOMNode(I);dotcal.calendar.event.addDroppableActionsToCalendarCell(I)}if(A.getFullYear()==E.getFullYear()&&A.getMonth()==E.getMonth()&&A.getDate()==E.getDate()&&A.getHours()==E.getHours()&&A.getMinutes()==E.getMinutes()){I.removeClass("ui-state-default");I.removeClass("ui-state-hover");I.addClass("ui-state-highlight")}E.setMinutes(E.getMinutes()+30)}if(dotcal.calendar.views.ui==dotcal.calendar.views.currentUI.CALENDAR){$(".dayHeader").click(function(){var M=$(this).attr("id").replace(/header_/,"");var L=dotcal.calendar.date.getEventDateFromId(M);dotcal.calendar.views.util.moveTo(dotcal.calendar.views.viewTypes.DAY,dotcal.calendar.views.viewModes.BOX,L)})}};this.populate=function(G,H,F){var D=null;var E=false;if(F){E=true}var C=H.events;for(var B=0;B<C.length;B++){D=C[B];var A=dotcal.calendar.date.getWeekEasyTime(D.dtstart);if(E){this.populateDayEvents(D,A,H.event_color)}else{this.populateDayEvents(D,A,null)}}if(dotcal.calendar.views.ui==dotcal.calendar.views.currentUI.CALENDAR){if(!dotcal.calendar.render.multiView){dotcal.calendar.views.box.day.scrollTopSet=false}}if(!dotcal.calendar.views.box.day.scrollTopSet&&H.events.length>0){for(B=0;H.events.length>B;B++){if(H.events[B].duration!="P1D"){dotcal.calendar.views.box.day.scrollTopSet=true;$(".scroll").scrollTop(H.events[B].dtstart.getHours()*45)}}}};this.populateDayEvents=function(C,B,A){if(!B){B=C.dtstart}var D="";if(C.duration=="P1D"){D=dotcal.calendar.event.placeEventDIV(C,A,"#allday_"+dotcal.calendar.date.getEventIdFromDate(C.dtstart),dotcal.calendar.views.displayBoxEventTime.DAY)}else{D=dotcal.calendar.event.placeEventDIV(C,A,"#"+this.getHourHalfID(B),dotcal.calendar.views.displayBoxEventTime.DAY)}return D};this.getHourHalfID=function(A){return dotcal.calendar.date.getEventIdFromDate(A)+"-"+fleegix.date.util.strftime(A,"%H-%M")};this.goBackShort=function(B,A){dotcal.calendar.views.box.day.goBackLong(B,A)};this.goForwardShort=function(B,A){dotcal.calendar.views.box.day.goForwardLong(B,A)};this.goBackLong=function(D,B){dotcal.calendar.views.currDate=new Date(D);dotcal.calendar.views.currDate.setDate(dotcal.calendar.views.currDate.getDate()-1);var A=new Date(dotcal.calendar.views.currDate);var C=new Date(D);dotcal.calendar[dotcal.calendar.views.ui].render(null,A,C);dotcal.calendar[dotcal.calendar.views.ui].getCollectionAndDrawEvents(dotcal.calendar.currCollectionID,A,C)};this.goForwardLong=function(D,B){dotcal.calendar.views.currDate=new Date(B);var A=new Date(B);var C=new Date(B);C.setDate(C.getDate()+1);dotcal.calendar[dotcal.calendar.views.ui].render(null,A,C);dotcal.calendar[dotcal.calendar.views.ui].getCollectionAndDrawEvents(dotcal.calendar.currCollectionID,A,C)};this.getMoveUpDate=function(B){var A=new Date(B);A.setMinutes(A.getMinutes()-60);return A};this.getMoveDownDate=function(B){var A=new Date(B);A.setMinutes(A.getMinutes()+60);return A};this.getMoveRightEndDate=function(B,A){};this.getMoveRightStartDate=function(C,B){var A=new Date(B);return A};this.getMoveLeftStartDate=function(B,A){}};dotcal.calendar.views.box.week=new function(){this.position=2;this.getPosition=function(){return this.position};this.getDateText=function(A){return"Week of "+fleegix.date.util.strftime(A,"%m/%e/%Y").replace(/ /,"")};this.getNavButtonValues=function(){return["Previous Week","Previous Week","Next Week","Next Week"]};this.rePopulateCell=function(A,B){return dotcal.calendar.views.box.day.rePopulateCell(A,B)};this.colorizeEvents=function(A){dotcal.calendar.views.box.day.colorizeEvents(A)};this.convertIdToDate=function(A){return dotcal.calendar.views.box.day.convertIdToDate(A)};this.histogramDateFormatting=function(A){var B=fleegix.date.util.strftime(A,"%Y-%m-%d-%H-%M-%S");return B.substr(0,10)};this.unpopulate=function(){dotcal.calendar.views.box.day.unpopulate()};this.render=function(E,G,B,C){var O=$("<table cellpadding=\"0\" cellspacing=\"0\"></table>").appendTo(G);var L=$("<thead></thead>").appendTo(O);var H=$("<tr id=\"dayHeader\" valign=\"middle\" align=\"left\"><th class=\"timeHeader ui-state-hover\">Time</th></tr>").appendTo(L);var F=$("<tbody></tbody>").appendTo(O);var P=$("<tr id=\"allDay\" valign=\"top\" align=\"left\"></tr>").appendTo(F);$("<td id=\"allDayHeader\" class=\"ui-widget-header\" valign=\"middle\">All<br />Day</td>").appendTo(P);var K=$("<td colspan=\"7\"><div style=\"/*see ticket #1510*/padding-right:16px;\" class=\"ui-widget-header\"><table cellpadding=\"0\" cellspacing=\"0\"><tr valign=\"top\" align=\"left\"></tr></table></div></td>").appendTo(P);var N=$("<tr id=\"days\"><td colspan=\"8\"><div class=\"scroll ui-widget-content\"><table id=\"hours\" cellpadding=\"0\" cellspacing=\"0\"></table></div></td></tr>").appendTo(F);var A=$(N).children().children().children("table");var J=new Date(B);var M=new Date(E);var I=new Date(B);I.setHours(I.getHours()+24);dotcal.calendar.views.box.day.renderDayEventTimes(E,A,B,I);for(var D=0;D<7;D++){dotcal.calendar.views.box.day.renderDayEventContainers(J,A,J,I);M.setDate(M.getDate()+1);J.setDate(J.getDate()+1);I.setDate(I.getDate()+1)}$(".dayHeader:last").addClass("ui-state-hover last")};this.populate=function(E,F,D){var A=dotcal.calendar.date.getFirstSundayOfWeek(E);for(var B=0;B<7;B++){var C=dotcal.calendar.event.getFullEventsByDateForCollection(A,F);C.event_color=F.event_color;dotcal.calendar.views.box.day.populate(A,C,D);A.setDate(A.getDate()+1)}};this.goBackShort=function(B,A){dotcal.calendar.views.box.week.goBackLong(B,A)};this.goForwardShort=function(B,A){dotcal.calendar.views.box.week.goForwardLong(B,A)};this.goBackLong=function(D,B){var A=new Date(D);A.setDate(A.getDate()-7);var C=new Date(B);C.setDate(C.getDate()-7);dotcal.calendar.views.currDate=new Date(A);dotcal.calendar[dotcal.calendar.views.ui].render(null,A,C);dotcal.calendar[dotcal.calendar.views.ui].getCollectionAndDrawEvents(dotcal.calendar.currCollectionID,A,C)};this.goForwardLong=function(D,B){var A=new Date(D);A.setDate(A.getDate()+7);var C=new Date(B);C.setDate(C.getDate()+7);dotcal.calendar.views.currDate=new Date(A);dotcal.calendar[dotcal.calendar.views.ui].render(null,A,C);dotcal.calendar[dotcal.calendar.views.ui].getCollectionAndDrawEvents(dotcal.calendar.currCollectionID,A,C)};this.getMoveUpDate=function(A){return dotcal.calendar.views.box.day.getMoveUpDate(A)};this.getMoveDownDate=function(A){return dotcal.calendar.views.box.day.getMoveDownDate(A)};this.getMoveRightEndDate=function(C,B){var A=new Date(B);A.setDate(A.getDate()+7);return A};this.getMoveRightStartDate=function(C,B){var A=new Date(B);A.setDate(A.getDate()+1);return A};this.getMoveLeftStartDate=function(C,B){var A=new Date(C);A.setDate(A.getDate()-7);return A}};dotcal.calendar.embed=new function(){dotcal.calendar.views.ui=dotcal.calendar.views.currentUI.EMBED;this.init=function(){dotcal.ui.setJQueryDOMConstaints();if(window.defaultView){if(window.defaultView==dotcal.calendar.views.viewTypes.MONTH){dotcal.calendar.views.currView=dotcal.calendar.views.viewTypes.MONTH;dotcal.calendar.views.currMode=dotcal.calendar.views.viewModes.BOX;$("#"+dotcal.calendar.views.currView.toLowerCase()).addClass("ui-state-active");$("#calendarViewSelect button").removeClass("ui-state-active");$(this).addClass("ui-state-active");dotcal.calendar.embed.render()}else{if(window.defaultView==dotcal.calendar.views.viewTypes.WEEK){dotcal.calendar.views.currView=dotcal.calendar.views.viewTypes.WEEK;dotcal.calendar.views.currMode=dotcal.calendar.views.viewModes.BOX;$("#"+dotcal.calendar.views.currView.toLowerCase()).addClass("ui-state-active");$(this).addClass("ui-state-active");dotcal.calendar.embed.render()}else{if(window.defaultView=="list"){dotcal.calendar.views.currView=dotcal.calendar.views.viewTypes.MONTH;dotcal.calendar.views.currMode=dotcal.calendar.views.viewModes.LIST;$("#"+dotcal.calendar.views.currMode.toLowerCase()).addClass("ui-state-active");$(this).addClass("ui-state-active");dotcal.calendar.embed.render();$(".expandList").click(function(){$(".listEventInfo").show();$(".listEventToggle").removeClass("ui-icon-circle-plus").addClass("ui-icon-circle-minus")});$(".collapseList").click(function(){$(".listEventInfo").hide();$(".listEventToggle").removeClass("ui-icon-circle-minus").addClass("ui-icon-circle-plus")});$(this).addClass("ui-state-active");dotcal.calendar.views.currView=dotcal.calendar.views.viewTypes.MONTH;dotcal.calendar.views.currMode=dotcal.calendar.views.viewModes.LIST;dotcal.calendar.embed.render()}else{dotcal.calendar.views.currView=dotcal.calendar.views.viewTypes.MONTH;dotcal.calendar.views.currMode=dotcal.calendar.views.viewModes.BOX;$("#"+dotcal.calendar.views.currView.toLowerCase()).addClass("ui-state-active");$("#calendarViewSelect button").removeClass("ui-state-active");$(this).addClass("ui-state-active");dotcal.calendar.embed.render()}}}}var A=dotcal.calendar.parseCollectionForUse(window.initCollection);dotcal.calendar.collections.push(A);dotcal.calendar.currCollectionID=A.id;dotcal.calendar.embed.populate(dotcal.calendar.views.currDate,A);this.initWidgetButtons()};this.getWebCalURL=function(){var A=dotcal.calendar.getCurrentCollection();var C=dotcal.calendar.ticket.getTicketFromCollectionID(A.id,dotcal.calendar.ticket.permission.READ);var B=window.surl.replace(/http/,"webcal")+"webcal/calendar/"+C+"/";B=B.replace(/webcals/,"webcal");return B};this.render=function(C,E,A){if(C){dotcal.calendar.views.currDate=C}if($("#calendar").length>0){$("#calendar").remove()}dotcal.calendar.views.setFirstAndLastDisplayDates(dotcal.calendar.views.currDate,E,A);var D=$("<div id=\"calendar\" class=\"ui-corner-all\"></div>");D.appendTo("#content");D.addClass(dotcal.calendar.views.currView+"View");dotcal.calendar.views[dotcal.calendar.views.currMode][dotcal.calendar.views.currView].render(dotcal.calendar.views.currDate,D,dotcal.calendar.views.firstDisplayDate,dotcal.calendar.views.lastDisplayDate);var B=dotcal.calendar.views[dotcal.calendar.views.currMode][dotcal.calendar.views.currView].getNavButtonValues();$("#calViewLeft").attr("title",B[0]);$("#calViewUp").attr("title",B[1]);$("#calViewDown").attr("title",B[2]);$("#calViewRight").attr("title",B[3])};this.getCollectionAndDrawEvents=function(C,F,A){if(!C){C=dotcal.calendar.currCollectionID}dotcal.calendar.views.setFirstAndLastDisplayDates(dotcal.calendar.views.currDate,F,A);var B=encodeURIComponent(dotcal.calendar.date.toISO8601Date(dotcal.calendar.views.firstDisplayDate));var E=encodeURIComponent(dotcal.calendar.date.toISO8601Date(dotcal.calendar.views.lastDisplayDate));var D=dotcal.calendar.ticket.getTicketFromCollectionID(C,dotcal.calendar.ticket.permission.READ);$.get("/embed/get_embed_collection",{start:B,end:E,u:D},function(H){var G=dotcal.calendar.parseCollectionForUse(H);dotcal.calendar.collections=[];dotcal.calendar.collections.push(G);dotcal.calendar.currCollectionID=G.id;dotcal.calendar.embed.populate(F,G)})};this.populate=function(A,D){if(!A){A=dotcal.calendar.views.currDate}if(!D){D=dotcal.calendar.getCurrentCollection()}if(dotcal.calendar.views.currView==dotcal.calendar.views.viewTypes.MONTH){A=dotcal.calendar.date.getLikelyLargestMonthForRange(dotcal.calendar.views.firstDisplayDate,dotcal.calendar.views.lastDisplayDate)}var B=dotcal.calendar.views[dotcal.calendar.views.currMode][dotcal.calendar.views.currView];B.populate(dotcal.calendar.views.currDate,D,false);$("#calendarNavName").html(B.getDateText(A));var C=$("#eventDetails").dialog({bgiframe:true,width:400,height:200,modal:true,closeOnEscape:true,position:["center",100],resizable:false,autoOpen:false,buttons:{"Done":function(){$(this).dialog("Close")}}});$(".event .event-time .time, .event .event-title .title").hover(function(){$(this).addClass("underline")},function(){$(this).removeClass("underline")});dotcal.ui.setHREFBlank()};this.openDialog=function(D){this.closeDialog();var C=D||{};var B=C.content||"";var A=$("#eventDetails");A.innerHTML="";if(typeof B=="string"){A.innerHTML=B}else{A.append(B)}$("#eventDetails").dialog({title:C.title,bgiframe:true,width:400,height:200,modal:false,closeOnEscape:true,resizable:false,autoOpen:false,buttons:{"Okay":function(){$(this).dialog("close")}}});$("#eventDetails").dialog("open");this.dialog=$("#eventDetails");this.setHREFBlank()};this.closeDialog=function(){$("#eventDetails").dialog("close");this.dialog=null};this.initWidgetButtons=function(){$("#calViewLeft").click(function(){dotcal.calendar.views[dotcal.calendar.views.currMode][dotcal.calendar.views.currView].goBackLong(dotcal.calendar.views.firstDisplayDate,dotcal.calendar.views.lastDisplayDate)});$("#calViewUp").click(function(){dotcal.calendar.views[dotcal.calendar.views.currMode][dotcal.calendar.views.currView].goBackShort(dotcal.calendar.views.firstDisplayDate,dotcal.calendar.views.lastDisplayDate)});$("#calViewDown").click(function(){dotcal.calendar.views[dotcal.calendar.views.currMode][dotcal.calendar.views.currView].goForwardShort(dotcal.calendar.views.firstDisplayDate,dotcal.calendar.views.lastDisplayDate)});$("#calViewRight").click(function(){dotcal.calendar.views[dotcal.calendar.views.currMode][dotcal.calendar.views.currView].goForwardLong(dotcal.calendar.views.firstDisplayDate,dotcal.calendar.views.lastDisplayDate)});$("#calViewToday").click(function(){dotcal.calendar.views.currDate=new Date();dotcal.calendar.views.currDate.setHours(0);dotcal.calendar.views.currDate.setMinutes(0);dotcal.calendar.views.currDate.setSeconds(0);dotcal.calendar.embed.render();dotcal.calendar.embed.getCollectionAndDrawEvents()});$("#month").click(function(){$("#calendarViewSelect button").removeClass("ui-state-active");$(this).addClass("ui-state-active");dotcal.calendar.views.currView=dotcal.calendar.views.viewTypes.MONTH;dotcal.calendar.views.currMode=dotcal.calendar.views.viewModes.BOX;dotcal.calendar.embed.render();dotcal.calendar.embed.getCollectionAndDrawEvents()});$("#list").click(function(){$("#calendarViewSelect button").removeClass("ui-state-active");$(this).addClass("ui-state-active");dotcal.calendar.views.currView=dotcal.calendar.views.viewTypes.MONTH;dotcal.calendar.views.currMode=dotcal.calendar.views.viewModes.LIST;dotcal.calendar.embed.render();dotcal.calendar.embed.getCollectionAndDrawEvents()});$("#week").click(function(){$("#calendarViewSelect button").removeClass("ui-state-active");$(this).addClass("ui-state-active");dotcal.calendar.views.currView=dotcal.calendar.views.viewTypes.WEEK;dotcal.calendar.views.currMode=dotcal.calendar.views.viewModes.BOX;dotcal.calendar.embed.render();dotcal.calendar.embed.getCollectionAndDrawEvents()});if(dotcal.calendar.views.currMode==dotcal.calendar.views.viewModes.BOX){$("#calendarViewSelect button").removeClass("ui-state-active");$("#"+dotcal.calendar.views.currView.toLowerCase()).addClass("ui-state-active")}var G=dotcal.calendar.parseCollectionForUse(window.initCollection);dotcal.calendar.collections.push(G);dotcal.calendar.currCollectionID=G.id;var A=dotcal.calendar.ticket.getTicketFromCollectionID(G.id,dotcal.calendar.ticket.permission.READ);var I=window.surl+"webcal/calendar/"+A+"/";var C=dotcal.calendar.embed.getWebCalURL();var F="/calendar/subscribe?csub="+I+"&t="+G.title;var B=$("<a title=\"Add this calendar to your dotCal account!\" href=\""+F+"\" target=\"_blank\"><img class=\"png\" style=\"border-style: none;\" src=\"/stylesheets/dotcal/images/calendar_buttons/dotcalbutton.png\" alt=\"\"/></a> <a href=\"http://www.google.com/calendar/render?cid="+encodeURIComponent(I)+"\" title=\"Subscribe to this calendar with Google Calendar\" target=\"_blank\"><img src=\"/stylesheets/dotcal/images/calendar_buttons/googlebutton.png\" class=\"png\" width=\"18\" height=\"18\" border=\"0\"/></a> <a class=\"yahooLink\" href=\"#\" title=\"Subscribe to this calendar with Yahoo!\"><img src=\"/stylesheets/dotcal/images/calendar_buttons/yahoobutton.png\" class=\"png\" border=\"0\"/></a> <a href=\""+C+"\" title=\"Subscribe to this calendar with your mobile device\"><img src=\"/stylesheets/dotcal/images/calendar_buttons/phonebutton.png\" class=\"png\" width=\"20\" height=\"20\" border=\"0\"/></a> <a href=\""+C+"\" title=\"Subscribe to this calendar with Apple iCal\"><img src=\"/stylesheets/dotcal/images/calendar_buttons/icalbutton.png\" class=\"png\" width=\"20\" height=\"20\" border=\"0\"/></a> <a class=\"outlookLink\" href=\"#\" title=\"Subscribe to this calendar with Outlook\"><img src=\"/stylesheets/dotcal/images/calendar_buttons/outlookbutton.png\" class=\"png\" width=\"20\" height=\"20\" border=\"0\"/></a> <a href=\""+C+"\" title=\"Subscribe to this calendar with Mozilla Thunderbird\"><img src=\"/stylesheets/dotcal/images/calendar_buttons/thunderbirdbutton.png\" class=\"png\" width=\"20\" height=\"20\" border=\"0\"/></a> ");B.appendTo(".calSubscribe .share");$("#mobile-device-subscribe-link").attr("href",C);var H=$("#outlook_version").dialog({bgiframe:true,width:400,height:200,modal:true,closeOnEscape:true,position:["center",100],resizable:false,autoOpen:false,buttons:{"Done":function(){$(this).dialog("close")}}});var D=$("#mobile_subscriptions").dialog({bgiframe:true,width:400,height:275,modal:true,closeOnEscape:true,position:["center",100],resizable:false,autoOpen:false,buttons:{"Done":function(){$(this).dialog("close")}}});var E=$("#yahooDialog").dialog({bgiframe:true,width:400,height:200,modal:true,closeOnEscape:true,position:["center",100],resizable:false,autoOpen:false,buttons:{"Done":function(){$(this).dialog("close")}}});$(".yahooLink").click(function(){E.dialog("open")});$(".outlookLink").click(function(){var J=dotcal.calendar.embed.getWebCalURL();$("#outlook2007Link").attr("href",J);$("#outlook2003Link").attr("href","http://dotcal.com/dotcal-support-microsoft-outlook-2003-advanced-options?calurl="+J);H.dialog("open")});$(".mobileDeviceLink").attr("href",I)}}