var pathCalendar = "/DC_MultiViewCal"; dc_subjects = ""; dc_locations = ""; /*! jQuery v1.7.2 jquery.com | jquery.org/license */ (function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cu(a){if(!cj[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ck||(ck=c.createElement("iframe"),ck.frameBorder=ck.width=ck.height=0),b.appendChild(ck);if(!cl||!ck.createElement)cl=(ck.contentWindow||ck.contentDocument).document,cl.write((f.support.boxModel?"":"")+""),cl.close();d=cl.createElement(a),cl.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ck)}cj[a]=e}return cj[a]}function ct(a,b){var c={};f.each(cp.concat.apply([],cp.slice(0,b)),function(){c[this]=a});return c}function cs(){cq=b}function cr(){setTimeout(cs,0);return cq=f.now()}function ci(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ch(){try{return new a.XMLHttpRequest}catch(b){}}function cb(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g0){if(c!=="border")for(;e=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?+d:j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.2",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a!=null&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){if(typeof c!="string"||!c)return null;var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c
a",d=p.getElementsByTagName("*"),e=p.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=p.getElementsByTagName("input")[0],b={leadingWhitespace:p.firstChild.nodeType===3,tbody:!p.getElementsByTagName("tbody").length,htmlSerialize:!!p.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:p.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,pixelMargin:!0},f.boxModel=b.boxModel=c.compatMode==="CSS1Compat",i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete p.test}catch(r){b.deleteExpando=!1}!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent("onclick",function(){b.noCloneEvent=!1}),p.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),i.setAttribute("name","t"),p.appendChild(i),j=c.createDocumentFragment(),j.appendChild(p.lastChild),b.checkClone=j.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,j.removeChild(i),j.appendChild(p);if(p.attachEvent)for(n in{submit:1,change:1,focusin:1})m="on"+n,o=m in p,o||(p.setAttribute(m,"return;"),o=typeof p[m]=="function"),b[n+"Bubbles"]=o;j.removeChild(p),j=g=h=p=i=null,f(function(){var d,e,g,h,i,j,l,m,n,q,r,s,t,u=c.getElementsByTagName("body")[0];!u||(m=1,t="padding:0;margin:0;border:",r="position:absolute;top:0;left:0;width:1px;height:1px;",s=t+"0;visibility:hidden;",n="style='"+r+t+"5px solid #000;",q="
"+""+"
",d=c.createElement("div"),d.style.cssText=s+"width:0;height:0;position:static;top:0;margin-top:"+m+"px",u.insertBefore(d,u.firstChild),p=c.createElement("div"),d.appendChild(p),p.innerHTML="
t
",k=p.getElementsByTagName("td"),o=k[0].offsetHeight===0,k[0].style.display="",k[1].style.display="none",b.reliableHiddenOffsets=o&&k[0].offsetHeight===0,a.getComputedStyle&&(p.innerHTML="",l=c.createElement("div"),l.style.width="0",l.style.marginRight="0",p.style.width="2px",p.appendChild(l),b.reliableMarginRight=(parseInt((a.getComputedStyle(l,null)||{marginRight:0}).marginRight,10)||0)===0),typeof p.style.zoom!="undefined"&&(p.innerHTML="",p.style.width=p.style.padding="1px",p.style.border=0,p.style.overflow="hidden",p.style.display="inline",p.style.zoom=1,b.inlineBlockNeedsLayout=p.offsetWidth===3,p.style.display="block",p.style.overflow="visible",p.innerHTML="
",b.shrinkWrapBlocks=p.offsetWidth!==3),p.style.cssText=r+s,p.innerHTML=q,e=p.firstChild,g=e.firstChild,i=e.nextSibling.firstChild.firstChild,j={doesNotAddBorder:g.offsetTop!==5,doesAddBorderForTableAndCells:i.offsetTop===5},g.style.position="fixed",g.style.top="20px",j.fixedPosition=g.offsetTop===20||g.offsetTop===15,g.style.position=g.style.top="",e.style.overflow="hidden",e.style.position="relative",j.subtractsBorderForOverflowNotVisible=g.offsetTop===-5,j.doesNotIncludeMarginInBodyOffset=u.offsetTop!==m,a.getComputedStyle&&(p.style.marginTop="1%",b.pixelMargin=(a.getComputedStyle(p,null)||{marginTop:0}).marginTop!=="1%"),typeof d.style.zoom!="undefined"&&(d.style.zoom=1),u.removeChild(d),l=p=d=null,f.extend(b,j))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e1,null,!1)},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,b){a&&(b=(b||"fx")+"mark",f._data(a,b,(f._data(a,b)||0)+1))},_unmark:function(a,b,c){a!==!0&&(c=b,b=a,a=!1);if(b){c=c||"fx";var d=c+"mark",e=a?0:(f._data(b,d)||1)-1;e?f._data(b,d,e):(f.removeData(b,d,!0),n(b,c,"mark"))}},queue:function(a,b,c){var d;if(a){b=(b||"fx")+"queue",d=f._data(a,b),c&&(!d||f.isArray(c)?d=f._data(a,b,f.makeArray(c)):d.push(c));return d||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e={};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),f._data(a,b+".run",e),d.call(a,function(){f.dequeue(a,b)},e)),c.length||(f.removeData(a,b+"queue "+b+".run",!0),n(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){var d=2;typeof a!="string"&&(c=a,a="fx",d--);if(arguments.length1)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,f.prop,a,b,arguments.length>1)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(p);for(c=0,d=this.length;c-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.type]||f.valHooks[this.nodeName.toLowerCase()];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.type]||f.valHooks[g.nodeName.toLowerCase()];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h,i=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;i=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/(?:^|\s)hover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function( a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")};f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler,g=p.selector),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;le&&j.push({elem:this,matches:d.slice(e)});for(k=0;k0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));o.match.globalPOS=p;var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h0)for(h=g;h=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/]","i"),bd=/checked\s*(?:[^=]|=\s*.checked.)/i,be=/\/(java|ecma)script/i,bf=/^\s*",""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div
","
"]),f.fn.extend({text:function(a){return f.access(this,function(a){return a===b?f.text(this):this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f .clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){return f.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return c.nodeType===1?c.innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1>");try{for(;d1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||f.isXMLDoc(a)||!bc.test("<"+a.nodeName+">")?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g,h,i,j=[];b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);for(var k=0,l;(l=a[k])!=null;k++){typeof l=="number"&&(l+="");if(!l)continue;if(typeof l=="string")if(!_.test(l))l=b.createTextNode(l);else{l=l.replace(Y,"<$1>");var m=(Z.exec(l)||["",""])[1].toLowerCase(),n=bg[m]||bg._default,o=n[0],p=b.createElement("div"),q=bh.childNodes,r;b===c?bh.appendChild(p):U(b).appendChild(p),p.innerHTML=n[1]+l+n[2];while(o--)p=p.lastChild;if(!f.support.tbody){var s=$.test(l),t=m==="table"&&!s?p.firstChild&&p.firstChild.childNodes:n[1]===""&&!s?p.childNodes:[];for(i=t.length-1;i>=0;--i)f.nodeName(t[i],"tbody")&&!t[i].childNodes.length&&t[i].parentNode.removeChild(t[i])}!f.support.leadingWhitespace&&X.test(l)&&p.insertBefore(b.createTextNode(X.exec(l)[0]),p.firstChild),l=p.childNodes,p&&(p.parentNode.removeChild(p),q.length>0&&(r=q[q.length-1],r&&r.parentNode&&r.parentNode.removeChild(r)))}var u;if(!f.support.appendChecked)if(l[0]&&typeof (u=l.length)=="number")for(i=0;i1)},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=by(a,"opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d,h==="string"&&(g=bu.exec(d))&&(d=+(g[1]+1)*+g[2]+parseFloat(f.css(a,c)),h="number");if(d==null||h==="number"&&isNaN(d))return;h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(by)return by(a,c)},swap:function(a,b,c){var d={},e,f;for(f in b)d[f]=a.style[f],a.style[f]=b[f];e=c.call(a);for(f in b)a.style[f]=d[f];return e}}),f.curCSS=f.css,c.defaultView&&c.defaultView.getComputedStyle&&(bz=function(a,b){var c,d,e,g,h=a.style;b=b.replace(br,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b))),!f.support.pixelMargin&&e&&bv.test(b)&&bt.test(c)&&(g=h.width,h.width=c,c=e.width,h.width=g);return c}),c.documentElement.currentStyle&&(bA=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f==null&&g&&(e=g[b])&&(f=e),bt.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),by=bz||bA,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){if(c)return a.offsetWidth!==0?bB(a,b,d):f.swap(a,bw,function(){return bB(a,b,d)})},set:function(a,b){return bs.test(b)?b+"px":b}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bq.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bp,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bp.test(g)?g.replace(bp,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){return f.swap(a,{display:"inline-block"},function(){return b?by(a,"margin-right"):a.style.marginRight})}})}),f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)}),f.each({margin:"",padding:"",border:"Width"},function(a,b){f.cssHooks[a+b]={expand:function(c){var d,e=typeof c=="string"?c.split(" "):[c],f={};for(d=0;d<4;d++)f[a+bx[d]+b]=e[d]||e[d-2]||e[0];return f}}});var bC=/%20/g,bD=/\[\]$/,bE=/\r?\n/g,bF=/#.*$/,bG=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bH=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bI=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bJ=/^(?:GET|HEAD)$/,bK=/^\/\//,bL=/\?/,bM=/)<[^<]*)*<\/script>/gi,bN=/^(?:select|textarea)/i,bO=/\s+/,bP=/([?&])_=[^&]*/,bQ=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bR=f.fn.load,bS={},bT={},bU,bV,bW=["*/"]+["*"];try{bU=e.href}catch(bX){bU=c.createElement("a"),bU.href="",bU=bU.href}bV=bQ.exec(bU.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bR)return bR.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
").append(c.replace(bM,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bN.test(this.nodeName)||bH.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bE,"\r\n")}}):{name:b.name,value:c.replace(bE,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b$(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b$(a,b);return a},ajaxSettings:{url:bU,isLocal:bI.test(bV[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bW},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bY(bS),ajaxTransport:bY(bT),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?ca(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cb(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bG.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bF,"").replace(bK,bV[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bO),d.crossDomain==null&&(r=bQ.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bV[1]&&r[2]==bV[2]&&(r[3]||(r[1]==="http:"?80:443))==(bV[3]||(bV[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),bZ(bS,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bJ.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bL.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bP,"$1_="+x);d.url=y+(y===d.url?(bL.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bW+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=bZ(bT,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)b_(g,a[g],c,e);return d.join("&").replace(bC,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cc=f.now(),cd=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cc++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=typeof b.data=="string"&&/^application\/x\-www\-form\-urlencoded/.test(b.contentType);if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(cd.test(b.url)||e&&cd.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(cd,l),b.url===j&&(e&&(k=k.replace(cd,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var ce=a.ActiveXObject?function(){for(var a in cg)cg[a](0,1)}:!1,cf=0,cg;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ch()||ci()}:ch,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,ce&&delete cg[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n);try{m.text=h.responseText}catch(a){}try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cf,ce&&(cg||(cg={},f(a).unload(ce)),cg[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cj={},ck,cl,cm=/^(?:toggle|show|hide)$/,cn=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,co,cp=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cq;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(ct("show",3),a,b,c);for(var g=0,h=this.length;g=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,c){var d=/Y/.test(c);f.fn[a]=function(e){return f.access(this,function(a,e,g){var h=cy(a);if(g===b)return h?c in h?h[c]:f.support.boxModel&&h.document.documentElement[e]||h.document.body[e]:a[e];h?h.scrollTo(d?f(h).scrollLeft():g,d?g:f(h).scrollTop()):a[e]=g},a,e,arguments.length,null)}}),f.each({Height:"height",Width:"width"},function(a,c){var d="client"+a,e="scroll"+a,g="offset"+a;f.fn["inner"+a]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,c,"padding")):this[c]():null},f.fn["outer"+a]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,c,a?"margin":"border")):this[c]():null},f.fn[c]=function(a){return f.access(this,function(a,c,h){var i,j,k,l;if(f.isWindow(a)){i=a.document,j=i.documentElement[d];return f.support.boxModel&&j||i.body&&i.body[d]||j}if(a.nodeType===9){i=a.documentElement;if(i[d]>=i[e])return i[d];return Math.max(a.body[e],i[e],a.body[g],i[g])}if(h===b){k=f.css(a,c),l=parseFloat(k);return f.isNumeric(l)?l:k}f(a).css(c,h)},c,a,arguments.length,null)}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window); ; /*! jQuery UI - v1.8.20 - 2012-04-30 * https://github.com/jquery/jquery-ui * Includes: jquery.ui.core.js * Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ (function(a,b){function c(b,c){var e=b.nodeName.toLowerCase();if("area"===e){var f=b.parentNode,g=f.name,h;return!b.href||!g||f.nodeName.toLowerCase()!=="map"?!1:(h=a("img[usemap=#"+g+"]")[0],!!h&&d(h))}return(/input|select|textarea|button|object/.test(e)?!b.disabled:"a"==e?b.href||c:c)&&d(b)}function d(b){return!a(b).parents().andSelf().filter(function(){return a.curCSS(this,"visibility")==="hidden"||a.expr.filters.hidden(this)}).length}a.ui=a.ui||{};if(a.ui.version)return;a.extend(a.ui,{version:"1.8.20",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}}),a.fn.extend({propAttr:a.fn.prop||a.fn.attr,_focus:a.fn.focus,focus:function(b,c){return typeof b=="number"?this.each(function(){var d=this;setTimeout(function(){a(d).focus(),c&&c.call(d)},b)}):this._focus.apply(this,arguments)},scrollParent:function(){var b;return a.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?b=this.parents().filter(function(){return/(relative|absolute|fixed)/.test(a.curCSS(this,"position",1))&&/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0):b=this.parents().filter(function(){return/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0),/fixed/.test(this.css("position"))||!b.length?a(document):b},zIndex:function(c){if(c!==b)return this.css("zIndex",c);if(this.length){var d=a(this[0]),e,f;while(d.length&&d[0]!==document){e=d.css("position");if(e==="absolute"||e==="relative"||e==="fixed"){f=parseInt(d.css("zIndex"),10);if(!isNaN(f)&&f!==0)return f}d=d.parent()}}return 0},disableSelection:function(){return this.bind((a.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),a.each(["Width","Height"],function(c,d){function h(b,c,d,f){return a.each(e,function(){c-=parseFloat(a.curCSS(b,"padding"+this,!0))||0,d&&(c-=parseFloat(a.curCSS(b,"border"+this+"Width",!0))||0),f&&(c-=parseFloat(a.curCSS(b,"margin"+this,!0))||0)}),c}var e=d==="Width"?["Left","Right"]:["Top","Bottom"],f=d.toLowerCase(),g={innerWidth:a.fn.innerWidth,innerHeight:a.fn.innerHeight,outerWidth:a.fn.outerWidth,outerHeight:a.fn.outerHeight};a.fn["inner"+d]=function(c){return c===b?g["inner"+d].call(this):this.each(function(){a(this).css(f,h(this,c)+"px")})},a.fn["outer"+d]=function(b,c){return typeof b!="number"?g["outer"+d].call(this,b):this.each(function(){a(this).css(f,h(this,b,!0,c)+"px")})}}),a.extend(a.expr[":"],{data:function(b,c,d){return!!a.data(b,d[3])},focusable:function(b){return c(b,!isNaN(a.attr(b,"tabindex")))},tabbable:function(b){var d=a.attr(b,"tabindex"),e=isNaN(d);return(e||d>=0)&&c(b,!e)}}),a(function(){var b=document.body,c=b.appendChild(c=document.createElement("div"));c.offsetHeight,a.extend(c.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0}),a.support.minHeight=c.offsetHeight===100,a.support.selectstart="onselectstart"in c,b.removeChild(c).style.display="none"}),a.extend(a.ui,{plugin:{add:function(b,c,d){var e=a.ui[b].prototype;for(var f in d)e.plugins[f]=e.plugins[f]||[],e.plugins[f].push([c,d[f]])},call:function(a,b,c){var d=a.plugins[b];if(!d||!a.element[0].parentNode)return;for(var e=0;e0?!0:(b[d]=1,e=b[d]>0,b[d]=0,e)},isOverAxis:function(a,b,c){return a>b&&a=9||!!b.button?this._mouseStarted?(this._mouseDrag(b),b.preventDefault()):(this._mouseDistanceMet(b)&&this._mouseDelayMet(b)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,b)!==!1,this._mouseStarted?this._mouseDrag(b):this._mouseUp(b)),!this._mouseStarted):this._mouseUp(b)},_mouseUp:function(b){return a(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,b.target==this._mouseDownEvent.target&&a.data(b.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(b)),!1},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(a){return this.mouseDelayMet},_mouseStart:function(a){},_mouseDrag:function(a){},_mouseStop:function(a){},_mouseCapture:function(a){return!0}})})(jQuery);;/*! jQuery UI - v1.8.20 - 2012-04-30 * https://github.com/jquery/jquery-ui * Includes: jquery.ui.position.js * Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ (function(a,b){a.ui=a.ui||{};var c=/left|center|right/,d=/top|center|bottom/,e="center",f={},g=a.fn.position,h=a.fn.offset;a.fn.position=function(b){if(!b||!b.of)return g.apply(this,arguments);b=a.extend({},b);var h=a(b.of),i=h[0],j=(b.collision||"flip").split(" "),k=b.offset?b.offset.split(" "):[0,0],l,m,n;return i.nodeType===9?(l=h.width(),m=h.height(),n={top:0,left:0}):i.setTimeout?(l=h.width(),m=h.height(),n={top:h.scrollTop(),left:h.scrollLeft()}):i.preventDefault?(b.at="left top",l=m=0,n={top:b.of.pageY,left:b.of.pageX}):(l=h.outerWidth(),m=h.outerHeight(),n=h.offset()),a.each(["my","at"],function(){var a=(b[this]||"").split(" ");a.length===1&&(a=c.test(a[0])?a.concat([e]):d.test(a[0])?[e].concat(a):[e,e]),a[0]=c.test(a[0])?a[0]:e,a[1]=d.test(a[1])?a[1]:e,b[this]=a}),j.length===1&&(j[1]=j[0]),k[0]=parseInt(k[0],10)||0,k.length===1&&(k[1]=k[0]),k[1]=parseInt(k[1],10)||0,b.at[0]==="right"?n.left+=l:b.at[0]===e&&(n.left+=l/2),b.at[1]==="bottom"?n.top+=m:b.at[1]===e&&(n.top+=m/2),n.left+=k[0],n.top+=k[1],this.each(function(){var c=a(this),d=c.outerWidth(),g=c.outerHeight(),h=parseInt(a.curCSS(this,"marginLeft",!0))||0,i=parseInt(a.curCSS(this,"marginTop",!0))||0,o=d+h+(parseInt(a.curCSS(this,"marginRight",!0))||0),p=g+i+(parseInt(a.curCSS(this,"marginBottom",!0))||0),q=a.extend({},n),r;b.my[0]==="right"?q.left-=d:b.my[0]===e&&(q.left-=d/2),b.my[1]==="bottom"?q.top-=g:b.my[1]===e&&(q.top-=g/2),f.fractions||(q.left=Math.round(q.left),q.top=Math.round(q.top)),r={left:q.left-h,top:q.top-i},a.each(["left","top"],function(c,e){a.ui.position[j[c]]&&a.ui.position[j[c]][e](q,{targetWidth:l,targetHeight:m,elemWidth:d,elemHeight:g,collisionPosition:r,collisionWidth:o,collisionHeight:p,offset:k,my:b.my,at:b.at})}),a.fn.bgiframe&&c.bgiframe(),c.offset(a.extend(q,{using:b.using}))})},a.ui.position={fit:{left:function(b,c){var d=a(window),e=c.collisionPosition.left+c.collisionWidth-d.width()-d.scrollLeft();b.left=e>0?b.left-e:Math.max(b.left-c.collisionPosition.left,b.left)},top:function(b,c){var d=a(window),e=c.collisionPosition.top+c.collisionHeight-d.height()-d.scrollTop();b.top=e>0?b.top-e:Math.max(b.top-c.collisionPosition.top,b.top)}},flip:{left:function(b,c){if(c.at[0]===e)return;var d=a(window),f=c.collisionPosition.left+c.collisionWidth-d.width()-d.scrollLeft(),g=c.my[0]==="left"?-c.elemWidth:c.my[0]==="right"?c.elemWidth:0,h=c.at[0]==="left"?c.targetWidth:-c.targetWidth,i=-2*c.offset[0];b.left+=c.collisionPosition.left<0?g+h+i:f>0?g+h+i:0},top:function(b,c){if(c.at[1]===e)return;var d=a(window),f=c.collisionPosition.top+c.collisionHeight-d.height()-d.scrollTop(),g=c.my[1]==="top"?-c.elemHeight:c.my[1]==="bottom"?c.elemHeight:0,h=c.at[1]==="top"?c.targetHeight:-c.targetHeight,i=-2*c.offset[1];b.top+=c.collisionPosition.top<0?g+h+i:f>0?g+h+i:0}}},a.offset.setOffset||(a.offset.setOffset=function(b,c){/static/.test(a.curCSS(b,"position"))&&(b.style.position="relative");var d=a(b),e=d.offset(),f=parseInt(a.curCSS(b,"top",!0),10)||0,g=parseInt(a.curCSS(b,"left",!0),10)||0,h={top:c.top-e.top+f,left:c.left-e.left+g};"using"in c?c.using.call(b,h):d.css(h)},a.fn.offset=function(b){var c=this[0];return!c||!c.ownerDocument?null:b?this.each(function(){a.offset.setOffset(this,b)}):h.call(this)}),function(){var b=document.getElementsByTagName("body")[0],c=document.createElement("div"),d,e,g,h,i;d=document.createElement(b?"div":"body"),g={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},b&&a.extend(g,{position:"absolute",left:"-1000px",top:"-1000px"});for(var j in g)d.style[j]=g[j];d.appendChild(c),e=b||document.documentElement,e.insertBefore(d,e.firstChild),c.style.cssText="position: absolute; left: 10.7432222px; top: 10.432325px; height: 30px; width: 201px;",h=a(c).offset(function(a,b){return b}).offset(),d.innerHTML="",e.removeChild(d),i=h.top+h.left+(b?2e3:0),f.fractions=i>21&&i<22}()})(jQuery);;/*! jQuery UI - v1.8.20 - 2012-04-30 * https://github.com/jquery/jquery-ui * Includes: jquery.ui.draggable.js * Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ (function(a,b){a.widget("ui.draggable",a.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1},_create:function(){this.options.helper=="original"&&!/^(?:r|a|f)/.test(this.element.css("position"))&&(this.element[0].style.position="relative"),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._mouseInit()},destroy:function(){if(!this.element.data("draggable"))return;return this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._mouseDestroy(),this},_mouseCapture:function(b){var c=this.options;return this.helper||c.disabled||a(b.target).is(".ui-resizable-handle")?!1:(this.handle=this._getHandle(b),this.handle?(c.iframeFix&&a(c.iframeFix===!0?"iframe":c.iframeFix).each(function(){a('
').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1e3}).css(a(this).offset()).appendTo("body")}),!0):!1)},_mouseStart:function(b){var c=this.options;return this.helper=this._createHelper(b),this._cacheHelperProportions(),a.ui.ddmanager&&(a.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(),this.offset=this.positionAbs=this.element.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},a.extend(this.offset,{click:{left:b.pageX-this.offset.left,top:b.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.originalPosition=this.position=this._generatePosition(b),this.originalPageX=b.pageX,this.originalPageY=b.pageY,c.cursorAt&&this._adjustOffsetFromHelper(c.cursorAt),c.containment&&this._setContainment(),this._trigger("start",b)===!1?(this._clear(),!1):(this._cacheHelperProportions(),a.ui.ddmanager&&!c.dropBehaviour&&a.ui.ddmanager.prepareOffsets(this,b),this.helper.addClass("ui-draggable-dragging"),this._mouseDrag(b,!0),a.ui.ddmanager&&a.ui.ddmanager.dragStart(this,b),!0)},_mouseDrag:function(b,c){this.position=this._generatePosition(b),this.positionAbs=this._convertPositionTo("absolute");if(!c){var d=this._uiHash();if(this._trigger("drag",b,d)===!1)return this._mouseUp({}),!1;this.position=d.position}if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";return a.ui.ddmanager&&a.ui.ddmanager.drag(this,b),!1},_mouseStop:function(b){var c=!1;a.ui.ddmanager&&!this.options.dropBehaviour&&(c=a.ui.ddmanager.drop(this,b)),this.dropped&&(c=this.dropped,this.dropped=!1);var d=this.element[0],e=!1;while(d&&(d=d.parentNode))d==document&&(e=!0);if(!e&&this.options.helper==="original")return!1;if(this.options.revert=="invalid"&&!c||this.options.revert=="valid"&&c||this.options.revert===!0||a.isFunction(this.options.revert)&&this.options.revert.call(this.element,c)){var f=this;a(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){f._trigger("stop",b)!==!1&&f._clear()})}else this._trigger("stop",b)!==!1&&this._clear();return!1},_mouseUp:function(b){return this.options.iframeFix===!0&&a("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)}),a.ui.ddmanager&&a.ui.ddmanager.dragStop(this,b),a.ui.mouse.prototype._mouseUp.call(this,b)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(b){var c=!this.options.handle||!a(this.options.handle,this.element).length?!0:!1;return a(this.options.handle,this.element).find("*").andSelf().each(function(){this==b.target&&(c=!0)}),c},_createHelper:function(b){var c=this.options,d=a.isFunction(c.helper)?a(c.helper.apply(this.element[0],[b])):c.helper=="clone"?this.element.clone().removeAttr("id"):this.element;return d.parents("body").length||d.appendTo(c.appendTo=="parent"?this.element[0].parentNode:c.appendTo),d[0]!=this.element[0]&&!/(fixed|absolute)/.test(d.css("position"))&&d.css("position","absolute"),d},_adjustOffsetFromHelper:function(b){typeof b=="string"&&(b=b.split(" ")),a.isArray(b)&&(b={left:+b[0],top:+b[1]||0}),"left"in b&&(this.offset.click.left=b.left+this.margins.left),"right"in b&&(this.offset.click.left=this.helperProportions.width-b.right+this.margins.left),"top"in b&&(this.offset.click.top=b.top+this.margins.top),"bottom"in b&&(this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var b=this.offsetParent.offset();this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])&&(b.left+=this.scrollParent.scrollLeft(),b.top+=this.scrollParent.scrollTop());if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&a.browser.msie)b={top:0,left:0};return{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.element.position();return{top:a.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var b=this.options;b.containment=="parent"&&(b.containment=this.helper[0].parentNode);if(b.containment=="document"||b.containment=="window")this.containment=[b.containment=="document"?0:a(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,b.containment=="document"?0:a(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,(b.containment=="document"?0:a(window).scrollLeft())+a(b.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(b.containment=="document"?0:a(window).scrollTop())+(a(b.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(b.containment)&&b.containment.constructor!=Array){var c=a(b.containment),d=c[0];if(!d)return;var e=c.offset(),f=a(d).css("overflow")!="hidden";this.containment=[(parseInt(a(d).css("borderLeftWidth"),10)||0)+(parseInt(a(d).css("paddingLeft"),10)||0),(parseInt(a(d).css("borderTopWidth"),10)||0)+(parseInt(a(d).css("paddingTop"),10)||0),(f?Math.max(d.scrollWidth,d.offsetWidth):d.offsetWidth)-(parseInt(a(d).css("borderLeftWidth"),10)||0)-(parseInt(a(d).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(f?Math.max(d.scrollHeight,d.offsetHeight):d.offsetHeight)-(parseInt(a(d).css("borderTopWidth"),10)||0)-(parseInt(a(d).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relative_container=c}else b.containment.constructor==Array&&(this.containment=b.containment)},_convertPositionTo:function(b,c){c||(c=this.position);var d=b=="absolute"?1:-1,e=this.options,f=this.cssPosition=="absolute"&&(this.scrollParent[0]==document||!a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=/(html|body)/i.test(f[0].tagName);return{top:c.top+this.offset.relative.top*d+this.offset.parent.top*d-(a.browser.safari&&a.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():g?0:f.scrollTop())*d),left:c.left+this.offset.relative.left*d+this.offset.parent.left*d-(a.browser.safari&&a.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:f.scrollLeft())*d)}},_generatePosition:function(b){var c=this.options,d=this.cssPosition=="absolute"&&(this.scrollParent[0]==document||!a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,e=/(html|body)/i.test(d[0].tagName),f=b.pageX,g=b.pageY;if(this.originalPosition){var h;if(this.containment){if(this.relative_container){var i=this.relative_container.offset();h=[this.containment[0]+i.left,this.containment[1]+i.top,this.containment[2]+i.left,this.containment[3]+i.top]}else h=this.containment;b.pageX-this.offset.click.lefth[2]&&(f=h[2]+this.offset.click.left),b.pageY-this.offset.click.top>h[3]&&(g=h[3]+this.offset.click.top)}if(c.grid){var j=c.grid[1]?this.originalPageY+Math.round((g-this.originalPageY)/c.grid[1])*c.grid[1]:this.originalPageY;g=h?j-this.offset.click.toph[3]?j-this.offset.click.toph[2]?k-this.offset.click.left=0;k--){var l=d.snapElements[k].left,m=l+d.snapElements[k].width,n=d.snapElements[k].top,o=n+d.snapElements[k].height;if(!(l-f=k&&g<=l||h>=k&&h<=l||gl)&&(e>=i&&e<=j||f>=i&&f<=j||ej);default:return!1}},a.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(b,c){var d=a.ui.ddmanager.droppables[b.options.scope]||[],e=c?c.type:null,f=(b.currentItem||b.element).find(":data(droppable)").andSelf();g:for(var h=0;h
').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=!0,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=c.handles||(a(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se");if(this.handles.constructor==String){this.handles=="all"&&(this.handles="n,e,s,w,se,sw,ne,nw");var d=this.handles.split(",");this.handles={};for(var e=0;e');h.css({zIndex:c.zIndex}),"se"==f&&h.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[f]=".ui-resizable-"+f,this.element.append(h)}}this._renderAxis=function(b){b=b||this.element;for(var c in this.handles){this.handles[c].constructor==String&&(this.handles[c]=a(this.handles[c],this.element).show());if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var d=a(this.handles[c],this.element),e=0;e=/sw|ne|nw|se|n|s/.test(c)?d.outerHeight():d.outerWidth();var f=["padding",/ne|nw|n/.test(c)?"Top":/se|sw|s/.test(c)?"Bottom":/^e$/.test(c)?"Right":"Left"].join("");b.css(f,e),this._proportionallyResize()}if(!a(this.handles[c]).length)continue}},this._renderAxis(this.element),this._handles=a(".ui-resizable-handle",this.element).disableSelection(),this._handles.mouseover(function(){if(!b.resizing){if(this.className)var a=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);b.axis=a&&a[1]?a[1]:"se"}}),c.autoHide&&(this._handles.hide(),a(this.element).addClass("ui-resizable-autohide").hover(function(){if(c.disabled)return;a(this).removeClass("ui-resizable-autohide"),b._handles.show()},function(){if(c.disabled)return;b.resizing||(a(this).addClass("ui-resizable-autohide"),b._handles.hide())})),this._mouseInit()},destroy:function(){this._mouseDestroy();var b=function(b){a(b).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){b(this.element);var c=this.element;c.after(this.originalElement.css({position:c.css("position"),width:c.outerWidth(),height:c.outerHeight(),top:c.css("top"),left:c.css("left")})).remove()}return this.originalElement.css("resize",this.originalResizeStyle),b(this.originalElement),this},_mouseCapture:function(b){var c=!1;for(var d in this.handles)a(this.handles[d])[0]==b.target&&(c=!0);return!this.options.disabled&&c},_mouseStart:function(b){var d=this.options,e=this.element.position(),f=this.element;this.resizing=!0,this.documentScroll={top:a(document).scrollTop(),left:a(document).scrollLeft()},(f.is(".ui-draggable")||/absolute/.test(f.css("position")))&&f.css({position:"absolute",top:e.top,left:e.left}),this._renderProxy();var g=c(this.helper.css("left")),h=c(this.helper.css("top"));d.containment&&(g+=a(d.containment).scrollLeft()||0,h+=a(d.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:g,top:h},this.size=this._helper?{width:f.outerWidth(),height:f.outerHeight()}:{width:f.width(),height:f.height()},this.originalSize=this._helper?{width:f.outerWidth(),height:f.outerHeight()}:{width:f.width(),height:f.height()},this.originalPosition={left:g,top:h},this.sizeDiff={width:f.outerWidth()-f.width(),height:f.outerHeight()-f.height()},this.originalMousePosition={left:b.pageX,top:b.pageY},this.aspectRatio=typeof d.aspectRatio=="number"?d.aspectRatio:this.originalSize.width/this.originalSize.height||1;var i=a(".ui-resizable-"+this.axis).css("cursor");return a("body").css("cursor",i=="auto"?this.axis+"-resize":i),f.addClass("ui-resizable-resizing"),this._propagate("start",b),!0},_mouseDrag:function(b){var c=this.helper,d=this.options,e={},f=this,g=this.originalMousePosition,h=this.axis,i=b.pageX-g.left||0,j=b.pageY-g.top||0,k=this._change[h];if(!k)return!1;var l=k.apply(this,[b,i,j]),m=a.browser.msie&&a.browser.version<7,n=this.sizeDiff;this._updateVirtualBoundaries(b.shiftKey);if(this._aspectRatio||b.shiftKey)l=this._updateRatio(l,b);return l=this._respectSize(l,b),this._propagate("resize",b),c.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"}),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),this._updateCache(l),this._trigger("resize",b,this.ui()),!1},_mouseStop:function(b){this.resizing=!1;var c=this.options,d=this;if(this._helper){var e=this._proportionallyResizeElements,f=e.length&&/textarea/i.test(e[0].nodeName),g=f&&a.ui.hasScroll(e[0],"left")?0:d.sizeDiff.height,h=f?0:d.sizeDiff.width,i={width:d.helper.width()-h,height:d.helper.height()-g},j=parseInt(d.element.css("left"),10)+(d.position.left-d.originalPosition.left)||null,k=parseInt(d.element.css("top"),10)+(d.position.top-d.originalPosition.top)||null;c.animate||this.element.css(a.extend(i,{top:k,left:j})),d.helper.height(d.size.height),d.helper.width(d.size.width),this._helper&&!c.animate&&this._proportionallyResize()}return a("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",b),this._helper&&this.helper.remove(),!1},_updateVirtualBoundaries:function(a){var b=this.options,c,e,f,g,h;h={minWidth:d(b.minWidth)?b.minWidth:0,maxWidth:d(b.maxWidth)?b.maxWidth:Infinity,minHeight:d(b.minHeight)?b.minHeight:0,maxHeight:d(b.maxHeight)?b.maxHeight:Infinity};if(this._aspectRatio||a)c=h.minHeight*this.aspectRatio,f=h.minWidth/this.aspectRatio,e=h.maxHeight*this.aspectRatio,g=h.maxWidth/this.aspectRatio,c>h.minWidth&&(h.minWidth=c),f>h.minHeight&&(h.minHeight=f),ea.width,k=d(a.height)&&e.minHeight&&e.minHeight>a.height;j&&(a.width=e.minWidth),k&&(a.height=e.minHeight),h&&(a.width=e.maxWidth),i&&(a.height=e.maxHeight);var l=this.originalPosition.left+this.originalSize.width,m=this.position.top+this.size.height,n=/sw|nw|w/.test(g),o=/nw|ne|n/.test(g);j&&n&&(a.left=l-e.minWidth),h&&n&&(a.left=l-e.maxWidth),k&&o&&(a.top=m-e.minHeight),i&&o&&(a.top=m-e.maxHeight);var p=!a.width&&!a.height;return p&&!a.left&&a.top?a.top=null:p&&!a.top&&a.left&&(a.left=null),a},_proportionallyResize:function(){var b=this.options;if(!this._proportionallyResizeElements.length)return;var c=this.helper||this.element;for(var d=0;d');var d=a.browser.msie&&a.browser.version<7,e=d?1:0,f=d?2:-1;this.helper.addClass(this._helper).css({width:this.element.outerWidth()+f,height:this.element.outerHeight()+f,position:"absolute",left:this.elementOffset.left-e+"px",top:this.elementOffset.top-e+"px",zIndex:++c.zIndex}),this.helper.appendTo("body").disableSelection()}else this.helper=this.element},_change:{e:function(a,b,c){return{width:this.originalSize.width+b}},w:function(a,b,c){var d=this.options,e=this.originalSize,f=this.originalPosition;return{left:f.left+b,width:e.width-b}},n:function(a,b,c){var d=this.options,e=this.originalSize,f=this.originalPosition;return{top:f.top+c,height:e.height-c}},s:function(a,b,c){return{height:this.originalSize.height+c}},se:function(b,c,d){return a.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[b,c,d]))},sw:function(b,c,d){return a.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[b,c,d]))},ne:function(b,c,d){return a.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[b,c,d]))},nw:function(b,c,d){return a.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[b,c,d]))}},_propagate:function(b,c){a.ui.plugin.call(this,b,[c,this.ui()]),b!="resize"&&this._trigger(b,c,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}}}),a.extend(a.ui.resizable,{version:"1.8.20"}),a.ui.plugin.add("resizable","alsoResize",{start:function(b,c){var d=a(this).data("resizable"),e=d.options,f=function(b){a(b).each(function(){var b=a(this);b.data("resizable-alsoresize",{width:parseInt(b.width(),10),height:parseInt(b.height(),10),left:parseInt(b.css("left"),10),top:parseInt(b.css("top"),10)})})};typeof e.alsoResize=="object"&&!e.alsoResize.parentNode?e.alsoResize.length?(e.alsoResize=e.alsoResize[0],f(e.alsoResize)):a.each(e.alsoResize,function(a){f(a)}):f(e.alsoResize)},resize:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d.originalSize,g=d.originalPosition,h={height:d.size.height-f.height||0,width:d.size.width-f.width||0,top:d.position.top-g.top||0,left:d.position.left-g.left||0},i=function(b,d){a(b).each(function(){var b=a(this),e=a(this).data("resizable-alsoresize"),f={},g=d&&d.length?d:b.parents(c.originalElement[0]).length?["width","height"]:["width","height","top","left"];a.each(g,function(a,b){var c=(e[b]||0)+(h[b]||0);c&&c>=0&&(f[b]=c||null)}),b.css(f)})};typeof e.alsoResize=="object"&&!e.alsoResize.nodeType?a.each(e.alsoResize,function(a,b){i(a,b)}):i(e.alsoResize)},stop:function(b,c){a(this).removeData("resizable-alsoresize")}}),a.ui.plugin.add("resizable","animate",{stop:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d._proportionallyResizeElements,g=f.length&&/textarea/i.test(f[0].nodeName),h=g&&a.ui.hasScroll(f[0],"left")?0:d.sizeDiff.height,i=g?0:d.sizeDiff.width,j={width:d.size.width-i,height:d.size.height-h},k=parseInt(d.element.css("left"),10)+(d.position.left-d.originalPosition.left)||null,l=parseInt(d.element.css("top"),10)+(d.position.top-d.originalPosition.top)||null;d.element.animate(a.extend(j,l&&k?{top:l,left:k}:{}),{duration:e.animateDuration,easing:e.animateEasing,step:function(){var c={width:parseInt(d.element.css("width"),10),height:parseInt(d.element.css("height"),10),top:parseInt(d.element.css("top"),10),left:parseInt(d.element.css("left"),10)};f&&f.length&&a(f[0]).css({width:c.width,height:c.height}),d._updateCache(c),d._propagate("resize",b)}})}}),a.ui.plugin.add("resizable","containment",{start:function(b,d){var e=a(this).data("resizable"),f=e.options,g=e.element,h=f.containment,i=h instanceof a?h.get(0):/parent/.test(h)?g.parent().get(0):h;if(!i)return;e.containerElement=a(i);if(/document/.test(h)||h==document)e.containerOffset={left:0,top:0},e.containerPosition={left:0,top:0},e.parentData={element:a(document),left:0,top:0,width:a(document).width(),height:a(document).height()||document.body.parentNode.scrollHeight};else{var j=a(i),k=[];a(["Top","Right","Left","Bottom"]).each(function(a,b){k[a]=c(j.css("padding"+b))}),e.containerOffset=j.offset(),e.containerPosition=j.position(),e.containerSize={height:j.innerHeight()-k[3],width:j.innerWidth()-k[1]};var l=e.containerOffset,m=e.containerSize.height,n=e.containerSize.width,o=a.ui.hasScroll(i,"left")?i.scrollWidth:n,p=a.ui.hasScroll(i)?i.scrollHeight:m;e.parentData={element:i,left:l.left,top:l.top,width:o,height:p}}},resize:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d.containerSize,g=d.containerOffset,h=d.size,i=d.position,j=d._aspectRatio||b.shiftKey,k={top:0,left:0},l=d.containerElement;l[0]!=document&&/static/.test(l.css("position"))&&(k=g),i.left<(d._helper?g.left:0)&&(d.size.width=d.size.width+(d._helper?d.position.left-g.left:d.position.left-k.left),j&&(d.size.height=d.size.width/d.aspectRatio),d.position.left=e.helper?g.left:0),i.top<(d._helper?g.top:0)&&(d.size.height=d.size.height+(d._helper?d.position.top-g.top:d.position.top),j&&(d.size.width=d.size.height*d.aspectRatio),d.position.top=d._helper?g.top:0),d.offset.left=d.parentData.left+d.position.left,d.offset.top=d.parentData.top+d.position.top;var m=Math.abs((d._helper?d.offset.left-k.left:d.offset.left-k.left)+d.sizeDiff.width),n=Math.abs((d._helper?d.offset.top-k.top:d.offset.top-g.top)+d.sizeDiff.height),o=d.containerElement.get(0)==d.element.parent().get(0),p=/relative|absolute/.test(d.containerElement.css("position"));o&&p&&(m-=d.parentData.left),m+d.size.width>=d.parentData.width&&(d.size.width=d.parentData.width-m,j&&(d.size.height=d.size.width/d.aspectRatio)),n+d.size.height>=d.parentData.height&&(d.size.height=d.parentData.height-n,j&&(d.size.width=d.size.height*d.aspectRatio))},stop:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d.position,g=d.containerOffset,h=d.containerPosition,i=d.containerElement,j=a(d.helper),k=j.offset(),l=j.outerWidth()-d.sizeDiff.width,m=j.outerHeight()-d.sizeDiff.height;d._helper&&!e.animate&&/relative/.test(i.css("position"))&&a(this).css({left:k.left-h.left-g.left,width:l,height:m}),d._helper&&!e.animate&&/static/.test(i.css("position"))&&a(this).css({left:k.left-h.left-g.left,width:l,height:m})}}),a.ui.plugin.add("resizable","ghost",{start:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d.size;d.ghost=d.originalElement.clone(),d.ghost.css({opacity:.25,display:"block",position:"relative",height:f.height,width:f.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof e.ghost=="string"?e.ghost:""),d.ghost.appendTo(d.helper)},resize:function(b,c){var d=a(this).data("resizable"),e=d.options;d.ghost&&d.ghost.css({position:"relative",height:d.size.height,width:d.size.width})},stop:function(b,c){var d=a(this).data("resizable"),e=d.options;d.ghost&&d.helper&&d.helper.get(0).removeChild(d.ghost.get(0))}}),a.ui.plugin.add("resizable","grid",{resize:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d.size,g=d.originalSize,h=d.originalPosition,i=d.axis,j=e._aspectRatio||b.shiftKey;e.grid=typeof e.grid=="number"?[e.grid,e.grid]:e.grid;var k=Math.round((f.width-g.width)/(e.grid[0]||1))*(e.grid[0]||1),l=Math.round((f.height-g.height)/(e.grid[1]||1))*(e.grid[1]||1);/^(se|s|e)$/.test(i)?(d.size.width=g.width+k,d.size.height=g.height+l):/^(ne)$/.test(i)?(d.size.width=g.width+k,d.size.height=g.height+l,d.position.top=h.top-l):/^(sw)$/.test(i)?(d.size.width=g.width+k,d.size.height=g.height+l,d.position.left=h.left-k):(d.size.width=g.width+k,d.size.height=g.height+l,d.position.top=h.top-l,d.position.left=h.left-k)}});var c=function(a){return parseInt(a,10)||0},d=function(a){return!isNaN(parseInt(a,10))}})(jQuery);;/*! jQuery UI - v1.8.20 - 2012-04-30 * https://github.com/jquery/jquery-ui * Includes: jquery.ui.selectable.js * Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ (function(a,b){a.widget("ui.selectable",a.ui.mouse,{options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch"},_create:function(){var b=this;this.element.addClass("ui-selectable"),this.dragged=!1;var c;this.refresh=function(){c=a(b.options.filter,b.element[0]),c.addClass("ui-selectee"),c.each(function(){var b=a(this),c=b.offset();a.data(this,"selectable-item",{element:this,$element:b,left:c.left,top:c.top,right:c.left+b.outerWidth(),bottom:c.top+b.outerHeight(),startselected:!1,selected:b.hasClass("ui-selected"),selecting:b.hasClass("ui-selecting"),unselecting:b.hasClass("ui-unselecting")})})},this.refresh(),this.selectees=c.addClass("ui-selectee"),this._mouseInit(),this.helper=a("
")},destroy:function(){return this.selectees.removeClass("ui-selectee").removeData("selectable-item"),this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable"),this._mouseDestroy(),this},_mouseStart:function(b){var c=this;this.opos=[b.pageX,b.pageY];if(this.options.disabled)return;var d=this.options;this.selectees=a(d.filter,this.element[0]),this._trigger("start",b),a(d.appendTo).append(this.helper),this.helper.css({left:b.clientX,top:b.clientY,width:0,height:0}),d.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var d=a.data(this,"selectable-item");d.startselected=!0,!b.metaKey&&!b.ctrlKey&&(d.$element.removeClass("ui-selected"),d.selected=!1,d.$element.addClass("ui-unselecting"),d.unselecting=!0,c._trigger("unselecting",b,{unselecting:d.element}))}),a(b.target).parents().andSelf().each(function(){var d=a.data(this,"selectable-item");if(d){var e=!b.metaKey&&!b.ctrlKey||!d.$element.hasClass("ui-selected");return d.$element.removeClass(e?"ui-unselecting":"ui-selected").addClass(e?"ui-selecting":"ui-unselecting"),d.unselecting=!e,d.selecting=e,d.selected=e,e?c._trigger("selecting",b,{selecting:d.element}):c._trigger("unselecting",b,{unselecting:d.element}),!1}})},_mouseDrag:function(b){var c=this;this.dragged=!0;if(this.options.disabled)return;var d=this.options,e=this.opos[0],f=this.opos[1],g=b.pageX,h=b.pageY;if(e>g){var i=g;g=e,e=i}if(f>h){var i=h;h=f,f=i}return this.helper.css({left:e,top:f,width:g-e,height:h-f}),this.selectees.each(function(){var i=a.data(this,"selectable-item");if(!i||i.element==c.element[0])return;var j=!1;d.tolerance=="touch"?j=!(i.left>g||i.righth||i.bottome&&i.rightf&&i.bottom *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3},_create:function(){var a=this.options;this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.floating=this.items.length?a.axis==="x"||/left|right/.test(this.items[0].item.css("float"))||/inline|table-cell/.test(this.items[0].item.css("display")):!1,this.offset=this.element.offset(),this._mouseInit(),this.ready=!0},destroy:function(){a.Widget.prototype.destroy.call(this),this.element.removeClass("ui-sortable ui-sortable-disabled"),this._mouseDestroy();for(var b=this.items.length-1;b>=0;b--)this.items[b].item.removeData(this.widgetName+"-item");return this},_setOption:function(b,c){b==="disabled"?(this.options[b]=c,this.widget()[c?"addClass":"removeClass"]("ui-sortable-disabled")):a.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(b,c){var d=this;if(this.reverting)return!1;if(this.options.disabled||this.options.type=="static")return!1;this._refreshItems(b);var e=null,f=this,g=a(b.target).parents().each(function(){if(a.data(this,d.widgetName+"-item")==f)return e=a(this),!1});a.data(b.target,d.widgetName+"-item")==f&&(e=a(b.target));if(!e)return!1;if(this.options.handle&&!c){var h=!1;a(this.options.handle,e).find("*").andSelf().each(function(){this==b.target&&(h=!0)});if(!h)return!1}return this.currentItem=e,this._removeCurrentsFromItems(),!0},_mouseStart:function(b,c,d){var e=this.options,f=this;this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(b),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),a.extend(this.offset,{click:{left:b.pageX-this.offset.left,top:b.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.originalPosition=this._generatePosition(b),this.originalPageX=b.pageX,this.originalPageY=b.pageY,e.cursorAt&&this._adjustOffsetFromHelper(e.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!=this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),e.containment&&this._setContainment(),e.cursor&&(a("body").css("cursor")&&(this._storedCursor=a("body").css("cursor")),a("body").css("cursor",e.cursor)),e.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",e.opacity)),e.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",e.zIndex)),this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",b,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions();if(!d)for(var g=this.containers.length-1;g>=0;g--)this.containers[g]._trigger("activate",b,f._uiHash(this));return a.ui.ddmanager&&(a.ui.ddmanager.current=this),a.ui.ddmanager&&!e.dropBehaviour&&a.ui.ddmanager.prepareOffsets(this,b),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(b),!0},_mouseDrag:function(b){this.position=this._generatePosition(b),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs);if(this.options.scroll){var c=this.options,d=!1;this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-b.pageY=0;e--){var f=this.items[e],g=f.item[0],h=this._intersectsWithPointer(f);if(!h)continue;if(g!=this.currentItem[0]&&this.placeholder[h==1?"next":"prev"]()[0]!=g&&!a.ui.contains(this.placeholder[0],g)&&(this.options.type=="semi-dynamic"?!a.ui.contains(this.element[0],g):!0)){this.direction=h==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(f))this._rearrange(b,f);else break;this._trigger("change",b,this._uiHash());break}}return this._contactContainers(b),a.ui.ddmanager&&a.ui.ddmanager.drag(this,b),this._trigger("sort",b,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(b,c){if(!b)return;a.ui.ddmanager&&!this.options.dropBehaviour&&a.ui.ddmanager.drop(this,b);if(this.options.revert){var d=this,e=d.placeholder.offset();d.reverting=!0,a(this.helper).animate({left:e.left-this.offset.parent.left-d.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:e.top-this.offset.parent.top-d.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){d._clear(b)})}else this._clear(b,c);return!1},cancel:function(){var b=this;if(this.dragging){this._mouseUp({target:null}),this.options.helper=="original"?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var c=this.containers.length-1;c>=0;c--)this.containers[c]._trigger("deactivate",null,b._uiHash(this)),this.containers[c].containerCache.over&&(this.containers[c]._trigger("out",null,b._uiHash(this)),this.containers[c].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.options.helper!="original"&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),a.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?a(this.domPosition.prev).after(this.currentItem):a(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(b){var c=this._getItemsAsjQuery(b&&b.connected),d=[];return b=b||{},a(c).each(function(){var c=(a(b.item||this).attr(b.attribute||"id")||"").match(b.expression||/(.+)[-=_](.+)/);c&&d.push((b.key||c[1]+"[]")+"="+(b.key&&b.expression?c[1]:c[2]))}),!d.length&&b.key&&d.push(b.key+"="),d.join("&")},toArray:function(b){var c=this._getItemsAsjQuery(b&&b.connected),d=[];return b=b||{},c.each(function(){d.push(a(b.item||this).attr(b.attribute||"id")||"")}),d},_intersectsWith:function(a){var b=this.positionAbs.left,c=b+this.helperProportions.width,d=this.positionAbs.top,e=d+this.helperProportions.height,f=a.left,g=f+a.width,h=a.top,i=h+a.height,j=this.offset.click.top,k=this.offset.click.left,l=d+j>h&&d+jf&&b+ka[this.floating?"width":"height"]?l:f0?"down":"up")},_getDragHorizontalDirection:function(){var a=this.positionAbs.left-this.lastPositionAbs.left;return a!=0&&(a>0?"right":"left")},refresh:function(a){return this._refreshItems(a),this.refreshPositions(),this},_connectWith:function(){var a=this.options;return a.connectWith.constructor==String?[a.connectWith]:a.connectWith},_getItemsAsjQuery:function(b){var c=this,d=[],e=[],f=this._connectWith();if(f&&b)for(var g=f.length-1;g>=0;g--){var h=a(f[g]);for(var i=h.length-1;i>=0;i--){var j=a.data(h[i],this.widgetName);j&&j!=this&&!j.options.disabled&&e.push([a.isFunction(j.options.items)?j.options.items.call(j.element):a(j.options.items,j.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),j])}}e.push([a.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):a(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]);for(var g=e.length-1;g>=0;g--)e[g][0].each(function(){d.push(this)});return a(d)},_removeCurrentsFromItems:function(){var a=this.currentItem.find(":data("+this.widgetName+"-item)");for(var b=0;b=0;g--){var h=a(f[g]);for(var i=h.length-1;i>=0;i--){var j=a.data(h[i],this.widgetName);j&&j!=this&&!j.options.disabled&&(e.push([a.isFunction(j.options.items)?j.options.items.call(j.element[0],b,{item:this.currentItem}):a(j.options.items,j.element),j]),this.containers.push(j))}}for(var g=e.length-1;g>=0;g--){var k=e[g][1],l=e[g][0];for(var i=0,m=l.length;i=0;c--){var d=this.items[c];if(d.instance!=this.currentContainer&&this.currentContainer&&d.item[0]!=this.currentItem[0])continue;var e=this.options.toleranceElement?a(this.options.toleranceElement,d.item):d.item;b||(d.width=e.outerWidth(),d.height=e.outerHeight());var f=e.offset();d.left=f.left,d.top=f.top}if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(var c=this.containers.length-1;c>=0;c--){var f=this.containers[c].element.offset();this.containers[c].containerCache.left=f.left,this.containers[c].containerCache.top=f.top,this.containers[c].containerCache.width=this.containers[c].element.outerWidth(),this.containers[c].containerCache.height=this.containers[c].element.outerHeight()}return this},_createPlaceholder:function(b){var c=b||this,d=c.options;if(!d.placeholder||d.placeholder.constructor==String){var e=d.placeholder;d.placeholder={element:function(){var b=a(document.createElement(c.currentItem[0].nodeName)).addClass(e||c.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];return e||(b.style.visibility="hidden"),b},update:function(a,b){if(e&&!d.forcePlaceholderSize)return;b.height()||b.height(c.currentItem.innerHeight()-parseInt(c.currentItem.css("paddingTop")||0,10)-parseInt(c.currentItem.css("paddingBottom")||0,10)),b.width()||b.width(c.currentItem.innerWidth()-parseInt(c.currentItem.css("paddingLeft")||0,10)-parseInt(c.currentItem.css("paddingRight")||0,10))}}}c.placeholder=a(d.placeholder.element.call(c.element,c.currentItem)),c.currentItem.after(c.placeholder),d.placeholder.update(c,c.placeholder)},_contactContainers:function(b){var c=null,d=null;for(var e=this.containers.length-1;e>=0;e--){if(a.ui.contains(this.currentItem[0],this.containers[e].element[0]))continue;if(this._intersectsWith(this.containers[e].containerCache)){if(c&&a.ui.contains(this.containers[e].element[0],c.element[0]))continue;c=this.containers[e],d=e}else this.containers[e].containerCache.over&&(this.containers[e]._trigger("out",b,this._uiHash(this)),this.containers[e].containerCache.over=0)}if(!c)return;if(this.containers.length===1)this.containers[d]._trigger("over",b,this._uiHash(this)),this.containers[d].containerCache.over=1;else if(this.currentContainer!=this.containers[d]){var f=1e4,g=null,h=this.positionAbs[this.containers[d].floating?"left":"top"];for(var i=this.items.length-1;i>=0;i--){if(!a.ui.contains(this.containers[d].element[0],this.items[i].item[0]))continue;var j=this.items[i][this.containers[d].floating?"left":"top"];Math.abs(j-h)this.containment[2]&&(f=this.containment[2]+this.offset.click.left),b.pageY-this.offset.click.top>this.containment[3]&&(g=this.containment[3]+this.offset.click.top));if(c.grid){var h=this.originalPageY+Math.round((g-this.originalPageY)/c.grid[1])*c.grid[1];g=this.containment?h-this.offset.click.topthis.containment[3]?h-this.offset.click.topthis.containment[2]?i-this.offset.click.left=0;f--)a.ui.contains(this.containers[f].element[0],this.currentItem[0])&&!c&&(d.push(function(a){return function(b){a._trigger("receive",b,this._uiHash(this))}}.call(this,this.containers[f])),d.push(function(a){return function(b){a._trigger("update",b,this._uiHash(this))}}.call(this,this.containers[f])))}for(var f=this.containers.length-1;f>=0;f--)c||d.push(function(a){return function(b){a._trigger("deactivate",b,this._uiHash(this))}}.call(this,this.containers[f])),this.containers[f].containerCache.over&&(d.push(function(a){return function(b){a._trigger("out",b,this._uiHash(this))}}.call(this,this.containers[f])),this.containers[f].containerCache.over=0);this._storedCursor&&a("body").css("cursor",this._storedCursor),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex),this.dragging=!1;if(this.cancelHelperRemoval){if(!c){this._trigger("beforeStop",b,this._uiHash());for(var f=0;f li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:!1,navigationFilter:function(){return this.href.toLowerCase()===location.href.toLowerCase()}},_create:function(){var b=this,c=b.options;b.running=0,b.element.addClass("ui-accordion ui-widget ui-helper-reset").children("li").addClass("ui-accordion-li-fix"),b.headers=b.element.find(c.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){if(c.disabled)return;a(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){if(c.disabled)return;a(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){if(c.disabled)return;a(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){if(c.disabled)return;a(this).removeClass("ui-state-focus")}),b.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");if(c.navigation){var d=b.element.find("a").filter(c.navigationFilter).eq(0);if(d.length){var e=d.closest(".ui-accordion-header");e.length?b.active=e:b.active=d.closest(".ui-accordion-content").prev()}}b.active=b._findActive(b.active||c.active).addClass("ui-state-default ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top"),b.active.next().addClass("ui-accordion-content-active"),b._createIcons(),b.resize(),b.element.attr("role","tablist"),b.headers.attr("role","tab").bind("keydown.accordion",function(a){return b._keydown(a)}).next().attr("role","tabpanel"),b.headers.not(b.active||"").attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).next().hide(),b.active.length?b.active.attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}):b.headers.eq(0).attr("tabIndex",0),a.browser.safari||b.headers.find("a").attr("tabIndex",-1),c.event&&b.headers.bind(c.event.split(" ").join(".accordion ")+".accordion",function(a){b._clickHandler.call(b,a,this),a.preventDefault()})},_createIcons:function(){var b=this.options;b.icons&&(a("").addClass("ui-icon "+b.icons.header).prependTo(this.headers),this.active.children(".ui-icon").toggleClass(b.icons.header).toggleClass(b.icons.headerSelected),this.element.addClass("ui-accordion-icons"))},_destroyIcons:function(){this.headers.children(".ui-icon").remove(),this.element.removeClass("ui-accordion-icons")},destroy:function(){var b=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role"),this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("tabIndex"),this.headers.find("a").removeAttr("tabIndex"),this._destroyIcons();var c=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled");return(b.autoHeight||b.fillHeight)&&c.css("height",""),a.Widget.prototype.destroy.call(this)},_setOption:function(b,c){a.Widget.prototype._setOption.apply(this,arguments),b=="active"&&this.activate(c),b=="icons"&&(this._destroyIcons(),c&&this._createIcons()),b=="disabled"&&this.headers.add(this.headers.next())[c?"addClass":"removeClass"]("ui-accordion-disabled ui-state-disabled")},_keydown:function(b){if(this.options.disabled||b.altKey||b.ctrlKey)return;var c=a.ui.keyCode,d=this.headers.length,e=this.headers.index(b.target),f=!1;switch(b.keyCode){case c.RIGHT:case c.DOWN:f=this.headers[(e+1)%d];break;case c.LEFT:case c.UP:f=this.headers[(e-1+d)%d];break;case c.SPACE:case c.ENTER:this._clickHandler({target:b.target},b.target),b.preventDefault()}return f?(a(b.target).attr("tabIndex",-1),a(f).attr("tabIndex",0),f.focus(),!1):!0},resize:function(){var b=this.options,c;if(b.fillSpace){if(a.browser.msie){var d=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}c=this.element.parent().height(),a.browser.msie&&this.element.parent().css("overflow",d),this.headers.each(function(){c-=a(this).outerHeight(!0)}),this.headers.next().each(function(){a(this).height(Math.max(0,c-a(this).innerHeight()+a(this).height()))}).css("overflow","auto")}else b.autoHeight&&(c=0,this.headers.next().each(function(){c=Math.max(c,a(this).height("").height())}).height(c));return this},activate:function(a){this.options.active=a;var b=this._findActive(a)[0];return this._clickHandler({target:b},b),this},_findActive:function(b){return b?typeof b=="number"?this.headers.filter(":eq("+b+")"):this.headers.not(this.headers.not(b)):b===!1?a([]):this.headers.filter(":eq(0)")},_clickHandler:function(b,c){var d=this.options;if(d.disabled)return;if(!b.target){if(!d.collapsible)return;this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header),this.active.next().addClass("ui-accordion-content-active");var e=this.active.next(),f={options:d,newHeader:a([]),oldHeader:d.active,newContent:a([]),oldContent:e},g=this.active=a([]);this._toggle(g,e,f);return}var h=a(b.currentTarget||c),i=h[0]===this.active[0];d.active=d.collapsible&&i?!1:this.headers.index(h);if(this.running||!d.collapsible&&i)return;var j=this.active,g=h.next(),e=this.active.next(),f={options:d,newHeader:i&&d.collapsible?a([]):h,oldHeader:this.active,newContent:i&&d.collapsible?a([]):g,oldContent:e},k=this.headers.index(this.active[0])>this.headers.index(h[0]);this.active=i?a([]):h,this._toggle(g,e,f,i,k),j.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header),i||(h.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").children(".ui-icon").removeClass(d.icons.header).addClass(d.icons.headerSelected),h.next().addClass("ui-accordion-content-active"));return},_toggle:function(b,c,d,e,f){var g=this,h=g.options;g.toShow=b,g.toHide=c,g.data=d;var i=function(){if(!g)return;return g._completed.apply(g,arguments)};g._trigger("changestart",null,g.data),g.running=c.size()===0?b.size():c.size();if(h.animated){var j={};h.collapsible&&e?j={toShow:a([]),toHide:c,complete:i,down:f,autoHeight:h.autoHeight||h.fillSpace}:j={toShow:b,toHide:c,complete:i,down:f,autoHeight:h.autoHeight||h.fillSpace},h.proxied||(h.proxied=h.animated),h.proxiedDuration||(h.proxiedDuration=h.duration),h.animated=a.isFunction(h.proxied)?h.proxied(j):h.proxied,h.duration=a.isFunction(h.proxiedDuration)?h.proxiedDuration(j):h.proxiedDuration;var k=a.ui.accordion.animations,l=h.duration,m=h.animated;m&&!k[m]&&!a.easing[m]&&(m="slide"),k[m]||(k[m]=function(a){this.slide(a,{easing:m,duration:l||700})}),k[m](j)}else h.collapsible&&e?b.toggle():(c.hide(),b.show()),i(!0);c.prev().attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).blur(),b.prev().attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}).focus()},_completed:function(a){this.running=a?0:--this.running;if(this.running)return;this.options.clearStyle&&this.toShow.add(this.toHide).css({height:"",overflow:""}),this.toHide.removeClass("ui-accordion-content-active"),this.toHide.length&&(this.toHide.parent()[0].className=this.toHide.parent()[0].className),this._trigger("change",null,this.data)}}),a.extend(a.ui.accordion,{version:"1.8.20",animations:{slide:function(b,c){b=a.extend({easing:"swing",duration:300},b,c);if(!b.toHide.size()){b.toShow.animate({height:"show",paddingTop:"show",paddingBottom:"show"},b);return}if(!b.toShow.size()){b.toHide.animate({height:"hide",paddingTop:"hide",paddingBottom:"hide"},b);return}var d=b.toShow.css("overflow"),e=0,f={},g={},h=["height","paddingTop","paddingBottom"],i,j=b.toShow;i=j[0].style.width,j.width(j.parent().width()-parseFloat(j.css("paddingLeft"))-parseFloat(j.css("paddingRight"))-(parseFloat(j.css("borderLeftWidth"))||0)-(parseFloat(j.css("borderRightWidth"))||0)),a.each(h,function(c,d){g[d]="hide";var e=(""+a.css(b.toShow[0],d)).match(/^([\d+-.]+)(.*)$/);f[d]={value:e[1],unit:e[2]||"px"}}),b.toShow.css({height:0,overflow:"hidden"}).show(),b.toHide.filter(":hidden").each(b.complete).end().filter(":visible").animate(g,{step:function(a,c){c.prop=="height"&&(e=c.end-c.start===0?0:(c.now-c.start)/(c.end-c.start)),b.toShow[0].style[c.prop]=e*f[c.prop].value+f[c.prop].unit},duration:b.duration,easing:b.easing,complete:function(){b.autoHeight||b.toShow.css("height",""),b.toShow.css({width:i,overflow:d}),b.complete()}})},bounceslide:function(a){this.slide(a,{easing:a.down?"easeOutBounce":"swing",duration:a.down?1e3:200})}}})})(jQuery);;/*! jQuery UI - v1.8.20 - 2012-04-30 * https://github.com/jquery/jquery-ui * Includes: jquery.ui.autocomplete.js * Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ (function(a,b){var c=0;a.widget("ui.autocomplete",{options:{appendTo:"body",autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null},pending:0,_create:function(){var b=this,c=this.element[0].ownerDocument,d;this.isMultiLine=this.element.is("textarea"),this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(c){if(b.options.disabled||b.element.propAttr("readOnly"))return;d=!1;var e=a.ui.keyCode;switch(c.keyCode){case e.PAGE_UP:b._move("previousPage",c);break;case e.PAGE_DOWN:b._move("nextPage",c);break;case e.UP:b._keyEvent("previous",c);break;case e.DOWN:b._keyEvent("next",c);break;case e.ENTER:case e.NUMPAD_ENTER:b.menu.active&&(d=!0,c.preventDefault());case e.TAB:if(!b.menu.active)return;b.menu.select(c);break;case e.ESCAPE:b.element.val(b.term),b.close(c);break;default:clearTimeout(b.searching),b.searching=setTimeout(function(){b.term!=b.element.val()&&(b.selectedItem=null,b.search(null,c))},b.options.delay)}}).bind("keypress.autocomplete",function(a){d&&(d=!1,a.preventDefault())}).bind("focus.autocomplete",function(){if(b.options.disabled)return;b.selectedItem=null,b.previous=b.element.val()}).bind("blur.autocomplete",function(a){if(b.options.disabled)return;clearTimeout(b.searching),b.closing=setTimeout(function(){b.close(a),b._change(a)},150)}),this._initSource(),this.menu=a("
    ").addClass("ui-autocomplete").appendTo(a(this.options.appendTo||"body",c)[0]).mousedown(function(c){var d=b.menu.element[0];a(c.target).closest(".ui-menu-item").length||setTimeout(function(){a(document).one("mousedown",function(c){c.target!==b.element[0]&&c.target!==d&&!a.ui.contains(d,c.target)&&b.close()})},1),setTimeout(function(){clearTimeout(b.closing)},13)}).menu({focus:function(a,c){var d=c.item.data("item.autocomplete");!1!==b._trigger("focus",a,{item:d})&&/^key/.test(a.originalEvent.type)&&b.element.val(d.value)},selected:function(a,d){var e=d.item.data("item.autocomplete"),f=b.previous;b.element[0]!==c.activeElement&&(b.element.focus(),b.previous=f,setTimeout(function(){b.previous=f,b.selectedItem=e},1)),!1!==b._trigger("select",a,{item:e})&&b.element.val(e.value),b.term=b.element.val(),b.close(a),b.selectedItem=e},blur:function(a,c){b.menu.element.is(":visible")&&b.element.val()!==b.term&&b.element.val(b.term)}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data("menu"),a.fn.bgiframe&&this.menu.element.bgiframe(),b.beforeunloadHandler=function(){b.element.removeAttr("autocomplete")},a(window).bind("beforeunload",b.beforeunloadHandler)},destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup"),this.menu.element.remove(),a(window).unbind("beforeunload",this.beforeunloadHandler),a.Widget.prototype.destroy.call(this)},_setOption:function(b,c){a.Widget.prototype._setOption.apply(this,arguments),b==="source"&&this._initSource(),b==="appendTo"&&this.menu.element.appendTo(a(c||"body",this.element[0].ownerDocument)[0]),b==="disabled"&&c&&this.xhr&&this.xhr.abort()},_initSource:function(){var b=this,c,d;a.isArray(this.options.source)?(c=this.options.source,this.source=function(b,d){d(a.ui.autocomplete.filter(c,b.term))}):typeof this.options.source=="string"?(d=this.options.source,this.source=function(c,e){b.xhr&&b.xhr.abort(),b.xhr=a.ajax({url:d,data:c,dataType:"json",success:function(a,b){e(a)},error:function(){e([])}})}):this.source=this.options.source},search:function(a,b){a=a!=null?a:this.element.val(),this.term=this.element.val();if(a.length").data("item.autocomplete",c).append(a("").text(c.label)).appendTo(b)},_move:function(a,b){if(!this.menu.element.is(":visible")){this.search(null,b);return}if(this.menu.first()&&/^previous/.test(a)||this.menu.last()&&/^next/.test(a)){this.element.val(this.term),this.menu.deactivate();return}this.menu[a](b)},widget:function(){return this.menu.element},_keyEvent:function(a,b){if(!this.isMultiLine||this.menu.element.is(":visible"))this._move(a,b),b.preventDefault()}}),a.extend(a.ui.autocomplete,{escapeRegex:function(a){return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")},filter:function(b,c){var d=new RegExp(a.ui.autocomplete.escapeRegex(c),"i");return a.grep(b,function(a){return d.test(a.label||a.value||a)})}})})(jQuery),function(a){a.widget("ui.menu",{_create:function(){var b=this;this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox","aria-activedescendant":"ui-active-menuitem"}).click(function(c){if(!a(c.target).closest(".ui-menu-item a").length)return;c.preventDefault(),b.select(c)}),this.refresh()},refresh:function(){var b=this,c=this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem");c.children("a").addClass("ui-corner-all").attr("tabindex",-1).mouseenter(function(c){b.activate(c,a(this).parent())}).mouseleave(function(){b.deactivate()})},activate:function(a,b){this.deactivate();if(this.hasScroll()){var c=b.offset().top-this.element.offset().top,d=this.element.scrollTop(),e=this.element.height();c<0?this.element.scrollTop(d+c):c>=e&&this.element.scrollTop(d+c-e+b.height())}this.active=b.eq(0).children("a").addClass("ui-state-hover").attr("id","ui-active-menuitem").end(),this._trigger("focus",a,{item:b})},deactivate:function(){if(!this.active)return;this.active.children("a").removeClass("ui-state-hover").removeAttr("id"),this._trigger("blur"),this.active=null},next:function(a){this.move("next",".ui-menu-item:first",a)},previous:function(a){this.move("prev",".ui-menu-item:last",a)},first:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},last:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},move:function(a,b,c){if(!this.active){this.activate(c,this.element.children(b));return}var d=this.active[a+"All"](".ui-menu-item").eq(0);d.length?this.activate(c,d):this.activate(c,this.element.children(b))},nextPage:function(b){if(this.hasScroll()){if(!this.active||this.last()){this.activate(b,this.element.children(".ui-menu-item:first"));return}var c=this.active.offset().top,d=this.element.height(),e=this.element.children(".ui-menu-item").filter(function(){var b=a(this).offset().top-c-d+a(this).height();return b<10&&b>-10});e.length||(e=this.element.children(".ui-menu-item:last")),this.activate(b,e)}else this.activate(b,this.element.children(".ui-menu-item").filter(!this.active||this.last()?":first":":last"))},previousPage:function(b){if(this.hasScroll()){if(!this.active||this.first()){this.activate(b,this.element.children(".ui-menu-item:last"));return}var c=this.active.offset().top,d=this.element.height(),e=this.element.children(".ui-menu-item").filter(function(){var b=a(this).offset().top-c+d-a(this).height();return b<10&&b>-10});e.length||(e=this.element.children(".ui-menu-item:first")),this.activate(b,e)}else this.activate(b,this.element.children(".ui-menu-item").filter(!this.active||this.first()?":last":":first"))},hasScroll:function(){return this.element.height()",this.element[0].ownerDocument).addClass("ui-button-text").html(this.options.label).appendTo(b.empty()).text(),d=this.options.icons,e=d.primary&&d.secondary,f=[];d.primary||d.secondary?(this.options.text&&f.push("ui-button-text-icon"+(e?"s":d.primary?"-primary":"-secondary")),d.primary&&b.prepend(""),d.secondary&&b.append(""),this.options.text||(f.push(e?"ui-button-icons-only":"ui-button-icon-only"),this.hasTitle||b.attr("title",c))):f.push("ui-button-text-only"),b.addClass(f.join(" "))}}),a.widget("ui.buttonset",{options:{items:":button, :submit, :reset, :checkbox, :radio, a, :data(button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(b,c){b==="disabled"&&this.buttons.button("option",b,c),a.Widget.prototype._setOption.apply(this,arguments)},refresh:function(){var b=this.element.css("direction")==="rtl";this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return a(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(b?"ui-corner-right":"ui-corner-left").end().filter(":last").addClass(b?"ui-corner-left":"ui-corner-right").end().end()},destroy:function(){this.element.removeClass("ui-buttonset"),this.buttons.map(function(){return a(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy"),a.Widget.prototype.destroy.call(this)}})})(jQuery);;/*! jQuery UI - v1.8.20 - 2012-04-30 * https://github.com/jquery/jquery-ui * Includes: jquery.ui.dialog.js * Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ (function(a,b){var c="ui-dialog ui-widget ui-widget-content ui-corner-all ",d={buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},e={maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0},f=a.attrFn||{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0,click:!0};a.widget("ui.dialog",{options:{autoOpen:!0,buttons:{},closeOnEscape:!0,closeText:"close",dialogClass:"",draggable:!0,hide:null,height:"auto",maxHeight:!1,maxWidth:!1,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",collision:"fit",using:function(b){var c=a(this).css(b).offset().top;c<0&&a(this).css("top",b.top-c)}},resizable:!0,show:null,stack:!0,title:"",width:300,zIndex:1e3},_create:function(){this.originalTitle=this.element.attr("title"),typeof this.originalTitle!="string"&&(this.originalTitle=""),this.options.title=this.options.title||this.originalTitle;var b=this,d=b.options,e=d.title||" ",f=a.ui.dialog.getTitleId(b.element),g=(b.uiDialog=a("
    ")).appendTo(document.body).hide().addClass(c+d.dialogClass).css({zIndex:d.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(c){d.closeOnEscape&&!c.isDefaultPrevented()&&c.keyCode&&c.keyCode===a.ui.keyCode.ESCAPE&&(b.close(c),c.preventDefault())}).attr({role:"dialog","aria-labelledby":f}).mousedown(function(a){b.moveToTop(!1,a)}),h=b.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(g),i=(b.uiDialogTitlebar=a("
    ")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(g),j=a('').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){j.addClass("ui-state-hover")},function(){j.removeClass("ui-state-hover")}).focus(function(){j.addClass("ui-state-focus")}).blur(function(){j.removeClass("ui-state-focus")}).click(function(a){return b.close(a),!1}).appendTo(i),k=(b.uiDialogTitlebarCloseText=a("")).addClass("ui-icon ui-icon-closethick").text(d.closeText).appendTo(j),l=a("").addClass("ui-dialog-title").attr("id",f).html(e).prependTo(i);a.isFunction(d.beforeclose)&&!a.isFunction(d.beforeClose)&&(d.beforeClose=d.beforeclose),i.find("*").add(i).disableSelection(),d.draggable&&a.fn.draggable&&b._makeDraggable(),d.resizable&&a.fn.resizable&&b._makeResizable(),b._createButtons(d.buttons),b._isOpen=!1,a.fn.bgiframe&&g.bgiframe()},_init:function(){this.options.autoOpen&&this.open()},destroy:function(){var a=this;return a.overlay&&a.overlay.destroy(),a.uiDialog.hide(),a.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body"),a.uiDialog.remove(),a.originalTitle&&a.element.attr("title",a.originalTitle),a},widget:function(){return this.uiDialog},close:function(b){var c=this,d,e;if(!1===c._trigger("beforeClose",b))return;return c.overlay&&c.overlay.destroy(),c.uiDialog.unbind("keypress.ui-dialog"),c._isOpen=!1,c.options.hide?c.uiDialog.hide(c.options.hide,function(){c._trigger("close",b)}):(c.uiDialog.hide(),c._trigger("close",b)),a.ui.dialog.overlay.resize(),c.options.modal&&(d=0,a(".ui-dialog").each(function(){this!==c.uiDialog[0]&&(e=a(this).css("z-index"),isNaN(e)||(d=Math.max(d,e)))}),a.ui.dialog.maxZ=d),c},isOpen:function(){return this._isOpen},moveToTop:function(b,c){var d=this,e=d.options,f;return e.modal&&!b||!e.stack&&!e.modal?d._trigger("focus",c):(e.zIndex>a.ui.dialog.maxZ&&(a.ui.dialog.maxZ=e.zIndex),d.overlay&&(a.ui.dialog.maxZ+=1,d.overlay.$el.css("z-index",a.ui.dialog.overlay.maxZ=a.ui.dialog.maxZ)),f={scrollTop:d.element.scrollTop(),scrollLeft:d.element.scrollLeft()},a.ui.dialog.maxZ+=1,d.uiDialog.css("z-index",a.ui.dialog.maxZ),d.element.attr(f),d._trigger("focus",c),d)},open:function(){if(this._isOpen)return;var b=this,c=b.options,d=b.uiDialog;return b.overlay=c.modal?new a.ui.dialog.overlay(b):null,b._size(),b._position(c.position),d.show(c.show),b.moveToTop(!0),c.modal&&d.bind("keydown.ui-dialog",function(b){if(b.keyCode!==a.ui.keyCode.TAB)return;var c=a(":tabbable",this),d=c.filter(":first"),e=c.filter(":last");if(b.target===e[0]&&!b.shiftKey)return d.focus(1),!1;if(b.target===d[0]&&b.shiftKey)return e.focus(1),!1}),a(b.element.find(":tabbable").get().concat(d.find(".ui-dialog-buttonpane :tabbable").get().concat(d.get()))).eq(0).focus(),b._isOpen=!0,b._trigger("open"),b},_createButtons:function(b){var c=this,d=!1,e=a("
    ").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),g=a("
    ").addClass("ui-dialog-buttonset").appendTo(e);c.uiDialog.find(".ui-dialog-buttonpane").remove(),typeof b=="object"&&b!==null&&a.each(b,function(){return!(d=!0)}),d&&(a.each(b,function(b,d){d=a.isFunction(d)?{click:d,text:b}:d;var e=a('').click(function(){d.click.apply(c.element[0],arguments)}).appendTo(g);a.each(d,function(a,b){if(a==="click")return;a in f?e[a](b):e.attr(a,b)}),a.fn.button&&e.button()}),e.appendTo(c.uiDialog))},_makeDraggable:function(){function f(a){return{position:a.position,offset:a.offset}}var b=this,c=b.options,d=a(document),e;b.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(d,g){e=c.height==="auto"?"auto":a(this).height(),a(this).height(a(this).height()).addClass("ui-dialog-dragging"),b._trigger("dragStart",d,f(g))},drag:function(a,c){b._trigger("drag",a,f(c))},stop:function(g,h){c.position=[h.position.left-d.scrollLeft(),h.position.top-d.scrollTop()],a(this).removeClass("ui-dialog-dragging").height(e),b._trigger("dragStop",g,f(h)),a.ui.dialog.overlay.resize()}})},_makeResizable:function(c){function h(a){return{originalPosition:a.originalPosition,originalSize:a.originalSize,position:a.position,size:a.size}}c=c===b?this.options.resizable:c;var d=this,e=d.options,f=d.uiDialog.css("position"),g=typeof c=="string"?c:"n,e,s,w,se,sw,ne,nw";d.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:d.element,maxWidth:e.maxWidth,maxHeight:e.maxHeight,minWidth:e.minWidth,minHeight:d._minHeight(),handles:g,start:function(b,c){a(this).addClass("ui-dialog-resizing"),d._trigger("resizeStart",b,h(c))},resize:function(a,b){d._trigger("resize",a,h(b))},stop:function(b,c){a(this).removeClass("ui-dialog-resizing"),e.height=a(this).height(),e.width=a(this).width(),d._trigger("resizeStop",b,h(c)),a.ui.dialog.overlay.resize()}}).css("position",f).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_minHeight:function(){var a=this.options;return a.height==="auto"?a.minHeight:Math.min(a.minHeight,a.height)},_position:function(b){var c=[],d=[0,0],e;if(b){if(typeof b=="string"||typeof b=="object"&&"0"in b)c=b.split?b.split(" "):[b[0],b[1]],c.length===1&&(c[1]=c[0]),a.each(["left","top"],function(a,b){+c[a]===c[a]&&(d[a]=c[a],c[a]=b)}),b={my:c.join(" "),at:c.join(" "),offset:d.join(" ")};b=a.extend({},a.ui.dialog.prototype.options.position,b)}else b=a.ui.dialog.prototype.options.position;e=this.uiDialog.is(":visible"),e||this.uiDialog.show(),this.uiDialog.css({top:0,left:0}).position(a.extend({of:window},b)),e||this.uiDialog.hide()},_setOptions:function(b){var c=this,f={},g=!1;a.each(b,function(a,b){c._setOption(a,b),a in d&&(g=!0),a in e&&(f[a]=b)}),g&&this._size(),this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option",f)},_setOption:function(b,d){var e=this,f=e.uiDialog;switch(b){case"beforeclose":b="beforeClose";break;case"buttons":e._createButtons(d);break;case"closeText":e.uiDialogTitlebarCloseText.text(""+d);break;case"dialogClass":f.removeClass(e.options.dialogClass).addClass(c+d);break;case"disabled":d?f.addClass("ui-dialog-disabled"):f.removeClass("ui-dialog-disabled");break;case"draggable":var g=f.is(":data(draggable)");g&&!d&&f.draggable("destroy"),!g&&d&&e._makeDraggable();break;case"position":e._position(d);break;case"resizable":var h=f.is(":data(resizable)");h&&!d&&f.resizable("destroy"),h&&typeof d=="string"&&f.resizable("option","handles",d),!h&&d!==!1&&e._makeResizable(d);break;case"title":a(".ui-dialog-title",e.uiDialogTitlebar).html(""+(d||" "))}a.Widget.prototype._setOption.apply(e,arguments)},_size:function(){var b=this.options,c,d,e=this.uiDialog.is(":visible");this.element.show().css({width:"auto",minHeight:0,height:0}),b.minWidth>b.width&&(b.width=b.minWidth),c=this.uiDialog.css({height:"auto",width:b.width}).height(),d=Math.max(0,b.minHeight-c);if(b.height==="auto")if(a.support.minHeight)this.element.css({minHeight:d,height:"auto"});else{this.uiDialog.show();var f=this.element.css("height","auto").height();e||this.uiDialog.hide(),this.element.height(Math.max(f,d))}else this.element.height(Math.max(b.height-c,0));this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())}}),a.extend(a.ui.dialog,{version:"1.8.20",uuid:0,maxZ:0,getTitleId:function(a){var b=a.attr("id");return b||(this.uuid+=1,b=this.uuid),"ui-dialog-title-"+b},overlay:function(b){this.$el=a.ui.dialog.overlay.create(b)}}),a.extend(a.ui.dialog.overlay,{instances:[],oldInstances:[],maxZ:0,events:a.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(a){return a+".dialog-overlay"}).join(" "),create:function(b){this.instances.length===0&&(setTimeout(function(){a.ui.dialog.overlay.instances.length&&a(document).bind(a.ui.dialog.overlay.events,function(b){if(a(b.target).zIndex()").addClass("ui-widget-overlay")).appendTo(document.body).css({width:this.width(),height:this.height()});return a.fn.bgiframe&&c.bgiframe(),this.instances.push(c),c},destroy:function(b){var c=a.inArray(b,this.instances);c!=-1&&this.oldInstances.push(this.instances.splice(c,1)[0]),this.instances.length===0&&a([document,window]).unbind(".dialog-overlay"),b.remove();var d=0;a.each(this.instances,function(){d=Math.max(d,this.css("z-index"))}),this.maxZ=d},height:function(){var b,c;return a.browser.msie&&a.browser.version<7?(b=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight),c=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight),b").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+(d.range==="min"||d.range==="max"?" ui-slider-range-"+d.range:"")));for(var i=e.length;ic&&(f=c,g=a(this),i=b)}),c.range===!0&&this.values(1)===c.min&&(i+=1,g=a(this.handles[i])),j=this._start(b,i),j===!1?!1:(this._mouseSliding=!0,h._handleIndex=i,g.addClass("ui-state-active").focus(),k=g.offset(),l=!a(b.target).parents().andSelf().is(".ui-slider-handle"),this._clickOffset=l?{left:0,top:0}:{left:b.pageX-k.left-g.width()/2,top:b.pageY-k.top-g.height()/2-(parseInt(g.css("borderTopWidth"),10)||0)-(parseInt(g.css("borderBottomWidth"),10)||0)+(parseInt(g.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(b,i,e),this._animateOff=!0,!0))},_mouseStart:function(a){return!0},_mouseDrag:function(a){var b={x:a.pageX,y:a.pageY},c=this._normValueFromMouse(b);return this._slide(a,this._handleIndex,c),!1},_mouseStop:function(a){return this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(a,this._handleIndex),this._change(a,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(a){var b,c,d,e,f;return this.orientation==="horizontal"?(b=this.elementSize.width,c=a.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(b=this.elementSize.height,c=a.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),d=c/b,d>1&&(d=1),d<0&&(d=0),this.orientation==="vertical"&&(d=1-d),e=this._valueMax()-this._valueMin(),f=this._valueMin()+d*e,this._trimAlignValue(f)},_start:function(a,b){var c={handle:this.handles[b],value:this.value()};return this.options.values&&this.options.values.length&&(c.value=this.values(b),c.values=this.values()),this._trigger("start",a,c)},_slide:function(a,b,c){var d,e,f;this.options.values&&this.options.values.length?(d=this.values(b?0:1),this.options.values.length===2&&this.options.range===!0&&(b===0&&c>d||b===1&&c1){this.options.values[b]=this._trimAlignValue(c),this._refreshValue(),this._change(null,b);return}if(!arguments.length)return this._values();if(!a.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(b):this.value();d=this.options.values,e=arguments[0];for(f=0;f=this._valueMax())return this._valueMax();var b=this.options.step>0?this.options.step:1,c=(a-this._valueMin())%b,d=a-c;return Math.abs(c)*2>=b&&(d+=c>0?b:-b),parseFloat(d.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var b=this.options.range,c=this.options,d=this,e=this._animateOff?!1:c.animate,f,g={},h,i,j,k;this.options.values&&this.options.values.length?this.handles.each(function(b,i){f=(d.values(b)-d._valueMin())/(d._valueMax()-d._valueMin())*100,g[d.orientation==="horizontal"?"left":"bottom"]=f+"%",a(this).stop(1,1)[e?"animate":"css"](g,c.animate),d.options.range===!0&&(d.orientation==="horizontal"?(b===0&&d.range.stop(1,1)[e?"animate":"css"]({left:f+"%"},c.animate),b===1&&d.range[e?"animate":"css"]({width:f-h+"%"},{queue:!1,duration:c.animate})):(b===0&&d.range.stop(1,1)[e?"animate":"css"]({bottom:f+"%"},c.animate),b===1&&d.range[e?"animate":"css"]({height:f-h+"%"},{queue:!1,duration:c.animate}))),h=f}):(i=this.value(),j=this._valueMin(),k=this._valueMax(),f=k!==j?(i-j)/(k-j)*100:0,g[d.orientation==="horizontal"?"left":"bottom"]=f+"%",this.handle.stop(1,1)[e?"animate":"css"](g,c.animate),b==="min"&&this.orientation==="horizontal"&&this.range.stop(1,1)[e?"animate":"css"]({width:f+"%"},c.animate),b==="max"&&this.orientation==="horizontal"&&this.range[e?"animate":"css"]({width:100-f+"%"},{queue:!1,duration:c.animate}),b==="min"&&this.orientation==="vertical"&&this.range.stop(1,1)[e?"animate":"css"]({height:f+"%"},c.animate),b==="max"&&this.orientation==="vertical"&&this.range[e?"animate":"css"]({height:100-f+"%"},{queue:!1,duration:c.animate}))}}),a.extend(a.ui.slider,{version:"1.8.20"})})(jQuery);;/*! jQuery UI - v1.8.20 - 2012-04-30 * https://github.com/jquery/jquery-ui * Includes: jquery.ui.tabs.js * Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ (function(a,b){function e(){return++c}function f(){return++d}var c=0,d=0;a.widget("ui.tabs",{options:{add:null,ajaxOptions:null,cache:!1,cookie:null,collapsible:!1,disable:null,disabled:[],enable:null,event:"click",fx:null,idPrefix:"ui-tabs-",load:null,panelTemplate:"
    ",remove:null,select:null,show:null,spinner:"Loading…",tabTemplate:"
  • #{label}
  • "},_create:function(){this._tabify(!0)},_setOption:function(a,b){if(a=="selected"){if(this.options.collapsible&&b==this.options.selected)return;this.select(b)}else this.options[a]=b,this._tabify()},_tabId:function(a){return a.title&&a.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF-]/g,"")||this.options.idPrefix+e()},_sanitizeSelector:function(a){return a.replace(/:/g,"\\:")},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+f());return a.cookie.apply(null,[b].concat(a.makeArray(arguments)))},_ui:function(a,b){return{tab:a,panel:b,index:this.anchors.index(a)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b=a(this);b.html(b.data("label.tabs")).removeData("label.tabs")})},_tabify:function(c){function m(b,c){b.css("display",""),!a.support.opacity&&c.opacity&&b[0].style.removeAttribute("filter")}var d=this,e=this.options,f=/^#.+/;this.list=this.element.find("ol,ul").eq(0),this.lis=a(" > li:has(a[href])",this.list),this.anchors=this.lis.map(function(){return a("a",this)[0]}),this.panels=a([]),this.anchors.each(function(b,c){var g=a(c).attr("href"),h=g.split("#")[0],i;h&&(h===location.toString().split("#")[0]||(i=a("base")[0])&&h===i.href)&&(g=c.hash,c.href=g);if(f.test(g))d.panels=d.panels.add(d.element.find(d._sanitizeSelector(g)));else if(g&&g!=="#"){a.data(c,"href.tabs",g),a.data(c,"load.tabs",g.replace(/#.*$/,""));var j=d._tabId(c);c.href="#"+j;var k=d.element.find("#"+j);k.length||(k=a(e.panelTemplate).attr("id",j).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(d.panels[b-1]||d.list),k.data("destroy.tabs",!0)),d.panels=d.panels.add(k)}else e.disabled.push(b)}),c?(this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all"),this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"),this.lis.addClass("ui-state-default ui-corner-top"),this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom"),e.selected===b?(location.hash&&this.anchors.each(function(a,b){if(b.hash==location.hash)return e.selected=a,!1}),typeof e.selected!="number"&&e.cookie&&(e.selected=parseInt(d._cookie(),10)),typeof e.selected!="number"&&this.lis.filter(".ui-tabs-selected").length&&(e.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))),e.selected=e.selected||(this.lis.length?0:-1)):e.selected===null&&(e.selected=-1),e.selected=e.selected>=0&&this.anchors[e.selected]||e.selected<0?e.selected:0,e.disabled=a.unique(e.disabled.concat(a.map(this.lis.filter(".ui-state-disabled"),function(a,b){return d.lis.index(a)}))).sort(),a.inArray(e.selected,e.disabled)!=-1&&e.disabled.splice(a.inArray(e.selected,e.disabled),1),this.panels.addClass("ui-tabs-hide"),this.lis.removeClass("ui-tabs-selected ui-state-active"),e.selected>=0&&this.anchors.length&&(d.element.find(d._sanitizeSelector(d.anchors[e.selected].hash)).removeClass("ui-tabs-hide"),this.lis.eq(e.selected).addClass("ui-tabs-selected ui-state-active"),d.element.queue("tabs",function(){d._trigger("show",null,d._ui(d.anchors[e.selected],d.element.find(d._sanitizeSelector(d.anchors[e.selected].hash))[0]))}),this.load(e.selected)),a(window).bind("unload",function(){d.lis.add(d.anchors).unbind(".tabs"),d.lis=d.anchors=d.panels=null})):e.selected=this.lis.index(this.lis.filter(".ui-tabs-selected")),this.element[e.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible"),e.cookie&&this._cookie(e.selected,e.cookie);for(var g=0,h;h=this.lis[g];g++)a(h)[a.inArray(g,e.disabled)!=-1&&!a(h).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled");e.cache===!1&&this.anchors.removeData("cache.tabs"),this.lis.add(this.anchors).unbind(".tabs");if(e.event!=="mouseover"){var i=function(a,b){b.is(":not(.ui-state-disabled)")&&b.addClass("ui-state-"+a)},j=function(a,b){b.removeClass("ui-state-"+a)};this.lis.bind("mouseover.tabs",function(){i("hover",a(this))}),this.lis.bind("mouseout.tabs",function(){j("hover",a(this))}),this.anchors.bind("focus.tabs",function(){i("focus",a(this).closest("li"))}),this.anchors.bind("blur.tabs",function(){j("focus",a(this).closest("li"))})}var k,l;e.fx&&(a.isArray(e.fx)?(k=e.fx[0],l=e.fx[1]):k=l=e.fx);var n=l?function(b,c){a(b).closest("li").addClass("ui-tabs-selected ui-state-active"),c.hide().removeClass("ui-tabs-hide").animate(l,l.duration||"normal",function(){m(c,l),d._trigger("show",null,d._ui(b,c[0]))})}:function(b,c){a(b).closest("li").addClass("ui-tabs-selected ui-state-active"),c.removeClass("ui-tabs-hide"),d._trigger("show",null,d._ui(b,c[0]))},o=k?function(a,b){b.animate(k,k.duration||"normal",function(){d.lis.removeClass("ui-tabs-selected ui-state-active"),b.addClass("ui-tabs-hide"),m(b,k),d.element.dequeue("tabs")})}:function(a,b,c){d.lis.removeClass("ui-tabs-selected ui-state-active"),b.addClass("ui-tabs-hide"),d.element.dequeue("tabs")};this.anchors.bind(e.event+".tabs",function(){var b=this,c=a(b).closest("li"),f=d.panels.filter(":not(.ui-tabs-hide)"),g=d.element.find(d._sanitizeSelector(b.hash));if(c.hasClass("ui-tabs-selected")&&!e.collapsible||c.hasClass("ui-state-disabled")||c.hasClass("ui-state-processing")||d.panels.filter(":animated").length||d._trigger("select",null,d._ui(this,g[0]))===!1)return this.blur(),!1;e.selected=d.anchors.index(this),d.abort();if(e.collapsible){if(c.hasClass("ui-tabs-selected"))return e.selected=-1,e.cookie&&d._cookie(e.selected,e.cookie),d.element.queue("tabs",function(){o(b,f)}).dequeue("tabs"),this.blur(),!1;if(!f.length)return e.cookie&&d._cookie(e.selected,e.cookie),d.element.queue("tabs",function(){n(b,g)}),d.load(d.anchors.index(this)),this.blur(),!1}e.cookie&&d._cookie(e.selected,e.cookie);if(g.length)f.length&&d.element.queue("tabs",function(){o(b,f)}),d.element.queue("tabs",function(){n(b,g)}),d.load(d.anchors.index(this));else throw"jQuery UI Tabs: Mismatching fragment identifier.";a.browser.msie&&this.blur()}),this.anchors.bind("click.tabs",function(){return!1})},_getIndex:function(a){return typeof a=="string"&&(a=this.anchors.index(this.anchors.filter("[href$='"+a+"']"))),a},destroy:function(){var b=this.options;return this.abort(),this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs"),this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"),this.anchors.each(function(){var b=a.data(this,"href.tabs");b&&(this.href=b);var c=a(this).unbind(".tabs");a.each(["href","load","cache"],function(a,b){c.removeData(b+".tabs")})}),this.lis.unbind(".tabs").add(this.panels).each(function(){a.data(this,"destroy.tabs")?a(this).remove():a(this).removeClass(["ui-state-default","ui-corner-top","ui-tabs-selected","ui-state-active","ui-state-hover","ui-state-focus","ui-state-disabled","ui-tabs-panel","ui-widget-content","ui-corner-bottom","ui-tabs-hide"].join(" "))}),b.cookie&&this._cookie(null,b.cookie),this},add:function(c,d,e){e===b&&(e=this.anchors.length);var f=this,g=this.options,h=a(g.tabTemplate.replace(/#\{href\}/g,c).replace(/#\{label\}/g,d)),i=c.indexOf("#")?this._tabId(a("a",h)[0]):c.replace("#","");h.addClass("ui-state-default ui-corner-top").data("destroy.tabs",!0);var j=f.element.find("#"+i);return j.length||(j=a(g.panelTemplate).attr("id",i).data("destroy.tabs",!0)),j.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide"),e>=this.lis.length?(h.appendTo(this.list),j.appendTo(this.list[0].parentNode)):(h.insertBefore(this.lis[e]),j.insertBefore(this.panels[e])),g.disabled=a.map(g.disabled,function(a,b){return a>=e?++a:a}),this._tabify(),this.anchors.length==1&&(g.selected=0,h.addClass("ui-tabs-selected ui-state-active"),j.removeClass("ui-tabs-hide"),this.element.queue("tabs",function(){f._trigger("show",null,f._ui(f.anchors[0],f.panels[0]))}),this.load(0)),this._trigger("add",null,this._ui(this.anchors[e],this.panels[e])),this},remove:function(b){b=this._getIndex(b);var c=this.options,d=this.lis.eq(b).remove(),e=this.panels.eq(b).remove();return d.hasClass("ui-tabs-selected")&&this.anchors.length>1&&this.select(b+(b+1=b?--a:a}),this._tabify(),this._trigger("remove",null,this._ui(d.find("a")[0],e[0])),this},enable:function(b){b=this._getIndex(b);var c=this.options;if(a.inArray(b,c.disabled)==-1)return;return this.lis.eq(b).removeClass("ui-state-disabled"),c.disabled=a.grep(c.disabled,function(a,c){return a!=b}),this._trigger("enable",null,this._ui(this.anchors[b],this.panels[b])),this},disable:function(a){a=this._getIndex(a);var b=this,c=this.options;return a!=c.selected&&(this.lis.eq(a).addClass("ui-state-disabled"),c.disabled.push(a),c.disabled.sort(),this._trigger("disable",null,this._ui(this.anchors[a],this.panels[a]))),this},select:function(a){a=this._getIndex(a);if(a==-1)if(this.options.collapsible&&this.options.selected!=-1)a=this.options.selected;else return this;return this.anchors.eq(a).trigger(this.options.event+".tabs"),this},load:function(b){b=this._getIndex(b);var c=this,d=this.options,e=this.anchors.eq(b)[0],f=a.data(e,"load.tabs");this.abort();if(!f||this.element.queue("tabs").length!==0&&a.data(e,"cache.tabs")){this.element.dequeue("tabs");return}this.lis.eq(b).addClass("ui-state-processing");if(d.spinner){var g=a("span",e);g.data("label.tabs",g.html()).html(d.spinner)}return this.xhr=a.ajax(a.extend({},d.ajaxOptions,{url:f,success:function(f,g){c.element.find(c._sanitizeSelector(e.hash)).html(f),c._cleanup(),d.cache&&a.data(e,"cache.tabs",!0),c._trigger("load",null,c._ui(c.anchors[b],c.panels[b]));try{d.ajaxOptions.success(f,g)}catch(h){}},error:function(a,f,g){c._cleanup(),c._trigger("load",null,c._ui(c.anchors[b],c.panels[b]));try{d.ajaxOptions.error(a,f,b,e)}catch(g){}}})),c.element.dequeue("tabs"),this},abort:function(){return this.element.queue([]),this.panels.stop(!1,!0),this.element.queue("tabs",this.element.queue("tabs").splice(-2,2)),this.xhr&&(this.xhr.abort(),delete this.xhr),this._cleanup(),this},url:function(a,b){return this.anchors.eq(a).removeData("cache.tabs").data("load.tabs",b),this},length:function(){return this.anchors.length}}),a.extend(a.ui.tabs,{version:"1.8.20"}),a.extend(a.ui.tabs.prototype,{rotation:null,rotate:function(a,b){var c=this,d=this.options,e=c._rotate||(c._rotate=function(b){clearTimeout(c.rotation),c.rotation=setTimeout(function(){var a=d.selected;c.select(++a'))}function bindHover(a){var b="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return a.bind("mouseout",function(a){var c=$(a.target).closest(b);if(!c.length)return;c.removeClass("ui-state-hover ui-datepicker-prev-hover ui-datepicker-next-hover")}).bind("mouseover",function(c){var d=$(c.target).closest(b);if($.datepicker._isDisabledDatepicker(instActive.inline?a.parent()[0]:instActive.input[0])||!d.length)return;d.parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),d.addClass("ui-state-hover"),d.hasClass("ui-datepicker-prev")&&d.addClass("ui-datepicker-prev-hover"),d.hasClass("ui-datepicker-next")&&d.addClass("ui-datepicker-next-hover")})}function extendRemove(a,b){$.extend(a,b);for(var c in b)if(b[c]==null||b[c]==undefined)a[c]=b[c];return a}function isArray(a){return a&&($.browser.safari&&typeof a=="object"&&a.length||a.constructor&&a.constructor.toString().match(/\Array\(\)/))}$.extend($.ui,{datepicker:{version:"1.8.20"}});var PROP_NAME="datepicker",dpuuid=(new Date).getTime(),instActive;$.extend(Datepicker.prototype,{markerClassName:"hasDatepicker",maxRows:4,log:function(){this.debug&&console.log.apply("",arguments)},_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(a){return extendRemove(this._defaults,a||{}),this},_attachDatepicker:function(target,settings){var inlineSettings=null;for(var attrName in this._defaults){var attrValue=target.getAttribute("date:"+attrName);if(attrValue){inlineSettings=inlineSettings||{};try{inlineSettings[attrName]=eval(attrValue)}catch(err){inlineSettings[attrName]=attrValue}}}var nodeName=target.nodeName.toLowerCase(),inline=nodeName=="div"||nodeName=="span";target.id||(this.uuid+=1,target.id="dp"+this.uuid);var inst=this._newInst($(target),inline);inst.settings=$.extend({},settings||{},inlineSettings||{}),nodeName=="input"?this._connectDatepicker(target,inst):inline&&this._inlineDatepicker(target,inst)},_newInst:function(a,b){var c=a[0].id.replace(/([^A-Za-z0-9_-])/g,"\\\\$1");return{id:c,input:a,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:b,dpDiv:b?bindHover($('
    ')):this.dpDiv}},_connectDatepicker:function(a,b){var c=$(a);b.append=$([]),b.trigger=$([]);if(c.hasClass(this.markerClassName))return;this._attachments(c,b),c.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",function(a,c,d){b.settings[c]=d}).bind("getData.datepicker",function(a,c){return this._get(b,c)}),this._autoSize(b),$.data(a,PROP_NAME,b),b.settings.disabled&&this._disableDatepicker(a)},_attachments:function(a,b){var c=this._get(b,"appendText"),d=this._get(b,"isRTL");b.append&&b.append.remove(),c&&(b.append=$(''+c+""),a[d?"before":"after"](b.append)),a.unbind("focus",this._showDatepicker),b.trigger&&b.trigger.remove();var e=this._get(b,"showOn");(e=="focus"||e=="both")&&a.focus(this._showDatepicker);if(e=="button"||e=="both"){var f=this._get(b,"buttonText"),g=this._get(b,"buttonImage");b.trigger=$(this._get(b,"buttonImageOnly")?$("").addClass(this._triggerClass).attr({src:g,alt:f,title:f}):$('').addClass(this._triggerClass).html(g==""?f:$("").attr({src:g,alt:f,title:f}))),a[d?"before":"after"](b.trigger),b.trigger.click(function(){return $.datepicker._datepickerShowing&&$.datepicker._lastInput==a[0]?$.datepicker._hideDatepicker():$.datepicker._datepickerShowing&&$.datepicker._lastInput!=a[0]?($.datepicker._hideDatepicker(),$.datepicker._showDatepicker(a[0])):$.datepicker._showDatepicker(a[0]),!1})}},_autoSize:function(a){if(this._get(a,"autoSize")&&!a.inline){var b=new Date(2009,11,20),c=this._get(a,"dateFormat");if(c.match(/[DM]/)){var d=function(a){var b=0,c=0;for(var d=0;db&&(b=a[d].length,c=d);return c};b.setMonth(d(this._get(a,c.match(/MM/)?"monthNames":"monthNamesShort"))),b.setDate(d(this._get(a,c.match(/DD/)?"dayNames":"dayNamesShort"))+20-b.getDay())}a.input.attr("size",this._formatDate(a,b).length)}},_inlineDatepicker:function(a,b){var c=$(a);if(c.hasClass(this.markerClassName))return;c.addClass(this.markerClassName).append(b.dpDiv).bind("setData.datepicker",function(a,c,d){b.settings[c]=d}).bind("getData.datepicker",function(a,c){return this._get(b,c)}),$.data(a,PROP_NAME,b),this._setDate(b,this._getDefaultDate(b),!0),this._updateDatepicker(b),this._updateAlternate(b),b.settings.disabled&&this._disableDatepicker(a),b.dpDiv.css("display","block")},_dialogDatepicker:function(a,b,c,d,e){var f=this._dialogInst;if(!f){this.uuid+=1;var g="dp"+this.uuid;this._dialogInput=$(''),this._dialogInput.keydown(this._doKeyDown),$("body").append(this._dialogInput),f=this._dialogInst=this._newInst(this._dialogInput,!1),f.settings={},$.data(this._dialogInput[0],PROP_NAME,f)}extendRemove(f.settings,d||{}),b=b&&b.constructor==Date?this._formatDate(f,b):b,this._dialogInput.val(b),this._pos=e?e.length?e:[e.pageX,e.pageY]:null;if(!this._pos){var h=document.documentElement.clientWidth,i=document.documentElement.clientHeight,j=document.documentElement.scrollLeft||document.body.scrollLeft,k=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[h/2-100+j,i/2-150+k]}return this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),f.settings.onSelect=c,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),$.blockUI&&$.blockUI(this.dpDiv),$.data(this._dialogInput[0],PROP_NAME,f),this},_destroyDatepicker:function(a){var b=$(a),c=$.data(a,PROP_NAME);if(!b.hasClass(this.markerClassName))return;var d=a.nodeName.toLowerCase();$.removeData(a,PROP_NAME),d=="input"?(c.append.remove(),c.trigger.remove(),b.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):(d=="div"||d=="span")&&b.removeClass(this.markerClassName).empty()},_enableDatepicker:function(a){var b=$(a),c=$.data(a,PROP_NAME);if(!b.hasClass(this.markerClassName))return;var d=a.nodeName.toLowerCase();if(d=="input")a.disabled=!1,c.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""});else if(d=="div"||d=="span"){var e=b.children("."+this._inlineClass);e.children().removeClass("ui-state-disabled"),e.find("select.ui-datepicker-month, select.ui-datepicker-year").removeAttr("disabled")}this._disabledInputs=$.map(this._disabledInputs,function(b){return b==a?null:b})},_disableDatepicker:function(a){var b=$(a),c=$.data(a,PROP_NAME);if(!b.hasClass(this.markerClassName))return;var d=a.nodeName.toLowerCase();if(d=="input")a.disabled=!0,c.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"});else if(d=="div"||d=="span"){var e=b.children("."+this._inlineClass);e.children().addClass("ui-state-disabled"),e.find("select.ui-datepicker-month, select.ui-datepicker-year").attr("disabled","disabled")}this._disabledInputs=$.map(this._disabledInputs,function(b){return b==a?null:b}),this._disabledInputs[this._disabledInputs.length]=a},_isDisabledDatepicker:function(a){if(!a)return!1;for(var b=0;b-1}},_doKeyUp:function(a){var b=$.datepicker._getInst(a.target);if(b.input.val()!=b.lastVal)try{var c=$.datepicker.parseDate($.datepicker._get(b,"dateFormat"),b.input?b.input.val():null,$.datepicker._getFormatConfig(b));c&&($.datepicker._setDateFromField(b),$.datepicker._updateAlternate(b),$.datepicker._updateDatepicker(b))}catch(d){$.datepicker.log(d)}return!0},_showDatepicker:function(a){a=a.target||a,a.nodeName.toLowerCase()!="input"&&(a=$("input",a.parentNode)[0]);if($.datepicker._isDisabledDatepicker(a)||$.datepicker._lastInput==a)return;var b=$.datepicker._getInst(a);$.datepicker._curInst&&$.datepicker._curInst!=b&&($.datepicker._curInst.dpDiv.stop(!0,!0),b&&$.datepicker._datepickerShowing&&$.datepicker._hideDatepicker($.datepicker._curInst.input[0]));var c=$.datepicker._get(b,"beforeShow"),d=c?c.apply(a,[a,b]):{};if(d===!1)return;extendRemove(b.settings,d),b.lastVal=null,$.datepicker._lastInput=a,$.datepicker._setDateFromField(b),$.datepicker._inDialog&&(a.value=""),$.datepicker._pos||($.datepicker._pos=$.datepicker._findPos(a),$.datepicker._pos[1]+=a.offsetHeight);var e=!1;$(a).parents().each(function(){return e|=$(this).css("position")=="fixed",!e}),e&&$.browser.opera&&($.datepicker._pos[0]-=document.documentElement.scrollLeft,$.datepicker._pos[1]-=document.documentElement.scrollTop);var f={left:$.datepicker._pos[0],top:$.datepicker._pos[1]};$.datepicker._pos=null,b.dpDiv.empty(),b.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),$.datepicker._updateDatepicker(b),f=$.datepicker._checkOffset(b,f,e),b.dpDiv.css({position:$.datepicker._inDialog&&$.blockUI?"static":e?"fixed":"absolute",display:"none",left:f.left+"px",top:f.top+"px"});if(!b.inline){var g=$.datepicker._get(b,"showAnim"),h=$.datepicker._get(b,"duration"),i=function(){var a=b.dpDiv.find("iframe.ui-datepicker-cover");if(!!a.length){var c=$.datepicker._getBorders(b.dpDiv);a.css({left:-c[0],top:-c[1],width:b.dpDiv.outerWidth(),height:b.dpDiv.outerHeight()})}};b.dpDiv.zIndex($(a).zIndex()+1),$.datepicker._datepickerShowing=!0,$.effects&&$.effects[g]?b.dpDiv.show(g,$.datepicker._get(b,"showOptions"),h,i):b.dpDiv[g||"show"](g?h:null,i),(!g||!h)&&i(),b.input.is(":visible")&&!b.input.is(":disabled")&&b.input.focus(),$.datepicker._curInst=b}},_updateDatepicker:function(a){var b=this;b.maxRows=4;var c=$.datepicker._getBorders(a.dpDiv);instActive=a,a.dpDiv.empty().append(this._generateHTML(a));var d=a.dpDiv.find("iframe.ui-datepicker-cover");!d.length||d.css({left:-c[0],top:-c[1],width:a.dpDiv.outerWidth(),height:a.dpDiv.outerHeight()}),a.dpDiv.find("."+this._dayOverClass+" a").mouseover();var e=this._getNumberOfMonths(a),f=e[1],g=17;a.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),f>1&&a.dpDiv.addClass("ui-datepicker-multi-"+f).css("width",g*f+"em"),a.dpDiv[(e[0]!=1||e[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi"),a.dpDiv[(this._get(a,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),a==$.datepicker._curInst&&$.datepicker._datepickerShowing&&a.input&&a.input.is(":visible")&&!a.input.is(":disabled")&&a.input[0]!=document.activeElement&&a.input.focus();if(a.yearshtml){var h=a.yearshtml;setTimeout(function(){h===a.yearshtml&&a.yearshtml&&a.dpDiv.find("select.ui-datepicker-year:first").replaceWith(a.yearshtml),h=a.yearshtml=null},0)}},_getBorders:function(a){var b=function(a){return{thin:1,medium:2,thick:3}[a]||a};return[parseFloat(b(a.css("border-left-width"))),parseFloat(b(a.css("border-top-width")))]},_checkOffset:function(a,b,c){var d=a.dpDiv.outerWidth(),e=a.dpDiv.outerHeight(),f=a.input?a.input.outerWidth():0,g=a.input?a.input.outerHeight():0,h=document.documentElement.clientWidth+$(document).scrollLeft(),i=document.documentElement.clientHeight+$(document).scrollTop();return b.left-=this._get(a,"isRTL")?d-f:0,b.left-=c&&b.left==a.input.offset().left?$(document).scrollLeft():0,b.top-=c&&b.top==a.input.offset().top+g?$(document).scrollTop():0,b.left-=Math.min(b.left,b.left+d>h&&h>d?Math.abs(b.left+d-h):0),b.top-=Math.min(b.top,b.top+e>i&&i>e?Math.abs(e+g):0),b},_findPos:function(a){var b=this._getInst(a),c=this._get(b,"isRTL");while(a&&(a.type=="hidden"||a.nodeType!=1||$.expr.filters.hidden(a)))a=a[c?"previousSibling":"nextSibling"];var d=$(a).offset();return[d.left,d.top]},_hideDatepicker:function(a){var b=this._curInst;if(!b||a&&b!=$.data(a,PROP_NAME))return;if(this._datepickerShowing){var c=this._get(b,"showAnim"),d=this._get(b,"duration"),e=function(){$.datepicker._tidyDialog(b)};$.effects&&$.effects[c]?b.dpDiv.hide(c,$.datepicker._get(b,"showOptions"),d,e):b.dpDiv[c=="slideDown"?"slideUp":c=="fadeIn"?"fadeOut":"hide"](c?d:null,e),c||e(),this._datepickerShowing=!1;var f=this._get(b,"onClose");f&&f.apply(b.input?b.input[0]:null,[b.input?b.input.val():"",b]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),$.blockUI&&($.unblockUI(),$("body").append(this.dpDiv))),this._inDialog=!1}},_tidyDialog:function(a){a.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(a){if(!$.datepicker._curInst)return;var b=$(a.target),c=$.datepicker._getInst(b[0]);(b[0].id!=$.datepicker._mainDivId&&b.parents("#"+$.datepicker._mainDivId).length==0&&!b.hasClass($.datepicker.markerClassName)&&!b.closest("."+$.datepicker._triggerClass).length&&$.datepicker._datepickerShowing&&(!$.datepicker._inDialog||!$.blockUI)||b.hasClass($.datepicker.markerClassName)&&$.datepicker._curInst!=c)&&$.datepicker._hideDatepicker()},_adjustDate:function(a,b,c){var d=$(a),e=this._getInst(d[0]);if(this._isDisabledDatepicker(d[0]))return;this._adjustInstDate(e,b+(c=="M"?this._get(e,"showCurrentAtPos"):0),c),this._updateDatepicker(e)},_gotoToday:function(a){var b=$(a),c=this._getInst(b[0]);if(this._get(c,"gotoCurrent")&&c.currentDay)c.selectedDay=c.currentDay,c.drawMonth=c.selectedMonth=c.currentMonth,c.drawYear=c.selectedYear=c.currentYear;else{var d=new Date;c.selectedDay=d.getDate(),c.drawMonth=c.selectedMonth=d.getMonth(),c.drawYear=c.selectedYear=d.getFullYear()}this._notifyChange(c),this._adjustDate(b)},_selectMonthYear:function(a,b,c){var d=$(a),e=this._getInst(d[0]);e["selected"+(c=="M"?"Month":"Year")]=e["draw"+(c=="M"?"Month":"Year")]=parseInt(b.options[b.selectedIndex].value,10),this._notifyChange(e),this._adjustDate(d)},_selectDay:function(a,b,c,d){var e=$(a);if($(d).hasClass(this._unselectableClass)||this._isDisabledDatepicker(e[0]))return;var f=this._getInst(e[0]);f.selectedDay=f.currentDay=$("a",d).html(),f.selectedMonth=f.currentMonth=b,f.selectedYear=f.currentYear=c,this._selectDate(a,this._formatDate(f,f.currentDay,f.currentMonth,f.currentYear))},_clearDate:function(a){var b=$(a),c=this._getInst(b[0]);this._selectDate(b,"")},_selectDate:function(a,b){var c=$(a),d=this._getInst(c[0]);b=b!=null?b:this._formatDate(d),d.input&&d.input.val(b),this._updateAlternate(d);var e=this._get(d,"onSelect");e?e.apply(d.input?d.input[0]:null,[b,d]):d.input&&d.input.trigger("change"),d.inline?this._updateDatepicker(d):(this._hideDatepicker(),this._lastInput=d.input[0],typeof d.input[0]!="object"&&d.input.focus(),this._lastInput=null)},_updateAlternate:function(a){var b=this._get(a,"altField");if(b){var c=this._get(a,"altFormat")||this._get(a,"dateFormat"),d=this._getDate(a),e=this.formatDate(c,d,this._getFormatConfig(a));$(b).each(function(){$(this).val(e)})}},noWeekends:function(a){var b=a.getDay();return[b>0&&b<6,""]},iso8601Week:function(a){var b=new Date(a.getTime());b.setDate(b.getDate()+4-(b.getDay()||7));var c=b.getTime();return b.setMonth(0),b.setDate(1),Math.floor(Math.round((c-b)/864e5)/7)+1},parseDate:function(a,b,c){if(a==null||b==null)throw"Invalid arguments";b=typeof b=="object"?b.toString():b+"";if(b=="")return null;var d=(c?c.shortYearCutoff:null)||this._defaults.shortYearCutoff;d=typeof d!="string"?d:(new Date).getFullYear()%100+parseInt(d,10);var e=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,f=(c?c.dayNames:null)||this._defaults.dayNames,g=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,h=(c?c.monthNames:null)||this._defaults.monthNames,i=-1,j=-1,k=-1,l=-1,m=!1,n=function(b){var c=s+1-1){j=1,k=l;do{var u=this._getDaysInMonth(i,j-1);if(k<=u)break;j++,k-=u}while(!0)}var t=this._daylightSavingAdjust(new Date(i,j-1,k));if(t.getFullYear()!=i||t.getMonth()+1!=j||t.getDate()!=k)throw"Invalid date";return t},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*24*60*60*1e7,formatDate:function(a,b,c){if(!b)return"";var d=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,e=(c?c.dayNames:null)||this._defaults.dayNames,f=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,g=(c?c.monthNames:null)||this._defaults.monthNames,h=function(b){var c=m+112?a.getHours()+2:0),a):null},_setDate:function(a,b,c){var d=!b,e=a.selectedMonth,f=a.selectedYear,g=this._restrictMinMax(a,this._determineDate(a,b,new Date));a.selectedDay=a.currentDay=g.getDate(),a.drawMonth=a.selectedMonth=a.currentMonth=g.getMonth(),a.drawYear=a.selectedYear=a.currentYear=g.getFullYear(),(e!=a.selectedMonth||f!=a.selectedYear)&&!c&&this._notifyChange(a),this._adjustInstDate(a),a.input&&a.input.val(d?"":this._formatDate(a))},_getDate:function(a){var b=!a.currentYear||a.input&&a.input.val()==""?null:this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return b},_generateHTML:function(a){var b=new Date;b=this._daylightSavingAdjust(new Date(b.getFullYear(),b.getMonth(),b.getDate()));var c=this._get(a,"isRTL"),d=this._get(a,"showButtonPanel"),e=this._get(a,"hideIfNoPrevNext"),f=this._get(a,"navigationAsDateFormat"),g=this._getNumberOfMonths(a),h=this._get(a,"showCurrentAtPos"),i=this._get(a,"stepMonths"),j=g[0]!=1||g[1]!=1,k=this._daylightSavingAdjust(a.currentDay?new Date(a.currentYear,a.currentMonth,a.currentDay):new Date(9999,9,9)),l=this._getMinMaxDate(a,"min"),m=this._getMinMaxDate(a,"max"),n=a.drawMonth-h,o=a.drawYear;n<0&&(n+=12,o--);if(m){var p=this._daylightSavingAdjust(new Date(m.getFullYear(),m.getMonth()-g[0]*g[1]+1,m.getDate()));p=l&&pp)n--,n<0&&(n=11,o--)}a.drawMonth=n,a.drawYear=o;var q=this._get(a,"prevText");q=f?this.formatDate(q,this._daylightSavingAdjust(new Date(o,n-i,1)),this._getFormatConfig(a)):q;var r=this._canAdjustMonth(a,-1,o,n)?''+q+"":e?"":''+q+"",s=this._get(a,"nextText");s=f?this.formatDate(s,this._daylightSavingAdjust(new Date(o,n+i,1)),this._getFormatConfig(a)):s;var t=this._canAdjustMonth(a,1,o,n)?''+s+"":e?"":''+s+"",u=this._get(a,"currentText"),v=this._get(a,"gotoCurrent")&&a.currentDay?k:b;u=f?this.formatDate(u,v,this._getFormatConfig(a)):u;var w=a.inline?"":'",x=d?'
    '+(c?w:"")+(this._isInRange(a,v)?'":"")+(c?"":w)+"
    ":"",y=parseInt(this._get(a,"firstDay"),10);y=isNaN(y)?0:y;var z=this._get(a,"showWeek"),A=this._get(a,"dayNames"),B=this._get(a,"dayNamesShort"),C=this._get(a,"dayNamesMin"),D=this._get(a,"monthNames"),E=this._get(a,"monthNamesShort"),F=this._get(a,"beforeShowDay"),G=this._get(a,"showOtherMonths"),H=this._get(a,"selectOtherMonths"),I=this._get(a,"calculateWeek")||this.iso8601Week,J=this._getDefaultDate(a),K="";for(var L=0;L1)switch(N){case 0:Q+=" ui-datepicker-group-first",P=" ui-corner-"+(c?"right":"left");break;case g[1]-1:Q+=" ui-datepicker-group-last",P=" ui-corner-"+(c?"left":"right");break;default:Q+=" ui-datepicker-group-middle",P=""}Q+='">'}Q+='
    '+(/all|left/.test(P)&&L==0?c?t:r:"")+(/all|right/.test(P)&&L==0?c?r:t:"")+this._generateMonthYearHeader(a,n,o,l,m,L>0||N>0,D,E)+'
    '+"";var R=z?'":"";for(var S=0;S<7;S++){var T=(S+y)%7;R+="=5?' class="ui-datepicker-week-end"':"")+">"+''+C[T]+""}Q+=R+"";var U=this._getDaysInMonth(o,n);o==a.selectedYear&&n==a.selectedMonth&&(a.selectedDay=Math.min(a.selectedDay,U));var V=(this._getFirstDayOfMonth(o,n)-y+7)%7,W=Math.ceil((V+U)/7),X=j?this.maxRows>W?this.maxRows:W:W;this.maxRows=X;var Y=this._daylightSavingAdjust(new Date(o,n,1-V));for(var Z=0;Z";var _=z?'":"";for(var S=0;S<7;S++){var ba=F?F.apply(a.input?a.input[0]:null,[Y]):[!0,""],bb=Y.getMonth()!=n,bc=bb&&!H||!ba[0]||l&&Ym;_+='",Y.setDate(Y.getDate()+1),Y=this._daylightSavingAdjust(Y)}Q+=_+""}n++,n>11&&(n=0,o++),Q+="
    '+this._get(a,"weekHeader")+"
    '+this._get(a,"calculateWeek")(Y)+""+(bb&&!G?" ":bc?''+Y.getDate()+"":''+Y.getDate()+"")+"
    "+(j?""+(g[0]>0&&N==g[1]-1?'
    ':""):""),M+=Q}K+=M}return K+=x+($.browser.msie&&parseInt($.browser.version,10)<7&&!a.inline?'':""),a._keyEvent=!1,K},_generateMonthYearHeader:function(a,b,c,d,e,f,g,h){var i=this._get(a,"changeMonth"),j=this._get(a,"changeYear"),k=this._get(a,"showMonthAfterYear"),l='
    ',m="";if(f||!i)m+=''+g[b]+"";else{var n=d&&d.getFullYear()==c,o=e&&e.getFullYear()==c;m+='"}k||(l+=m+(f||!i||!j?" ":""));if(!a.yearshtml){a.yearshtml="";if(f||!j)l+=''+c+"";else{var q=this._get(a,"yearRange").split(":"),r=(new Date).getFullYear(),s=function(a){var b=a.match(/c[+-].*/)?c+parseInt(a.substring(1),10):a.match(/[+-].*/)?r+parseInt(a,10):parseInt(a,10);return isNaN(b)?r:b},t=s(q[0]),u=Math.max(t,s(q[1]||""));t=d?Math.max(t,d.getFullYear()):t,u=e?Math.min(u,e.getFullYear()):u,a.yearshtml+='",l+=a.yearshtml,a.yearshtml=null}}return l+=this._get(a,"yearSuffix"),k&&(l+=(f||!i||!j?" ":"")+m),l+="
    ",l},_adjustInstDate:function(a,b,c){var d=a.drawYear+(c=="Y"?b:0),e=a.drawMonth+(c=="M"?b:0),f=Math.min(a.selectedDay,this._getDaysInMonth(d,e))+(c=="D"?b:0),g=this._restrictMinMax(a,this._daylightSavingAdjust(new Date(d,e,f)));a.selectedDay=g.getDate(),a.drawMonth=a.selectedMonth=g.getMonth(),a.drawYear=a.selectedYear=g.getFullYear(),(c=="M"||c=="Y")&&this._notifyChange(a)},_restrictMinMax:function(a,b){var c=this._getMinMaxDate(a,"min"),d=this._getMinMaxDate(a,"max"),e=c&&bd?d:e,e},_notifyChange:function(a){var b=this._get(a,"onChangeMonthYear");b&&b.apply(a.input?a.input[0]:null,[a.selectedYear,a.selectedMonth+1,a])},_getNumberOfMonths:function(a){var b=this._get(a,"numberOfMonths");return b==null?[1,1]:typeof b=="number"?[1,b]:b},_getMinMaxDate:function(a,b){return this._determineDate(a,this._get(a,b+"Date"),null)},_getDaysInMonth:function(a,b){return 32-this._daylightSavingAdjust(new Date(a,b,32)).getDate()},_getFirstDayOfMonth:function(a,b){return(new Date(a,b,1)).getDay()},_canAdjustMonth:function(a,b,c,d){var e=this._getNumberOfMonths(a),f=this._daylightSavingAdjust(new Date(c,d+(b<0?b:e[0]*e[1]),1));return b<0&&f.setDate(this._getDaysInMonth(f.getFullYear(),f.getMonth())),this._isInRange(a,f)},_isInRange:function(a,b){var c=this._getMinMaxDate(a,"min"),d=this._getMinMaxDate(a,"max");return(!c||b.getTime()>=c.getTime())&&(!d||b.getTime()<=d.getTime())},_getFormatConfig:function(a){var b=this._get(a,"shortYearCutoff");return b=typeof b!="string"?b:(new Date).getFullYear()%100+parseInt(b,10),{shortYearCutoff:b,dayNamesShort:this._get(a,"dayNamesShort"),dayNames:this._get(a,"dayNames"),monthNamesShort:this._get(a,"monthNamesShort"),monthNames:this._get(a,"monthNames")}},_formatDate:function(a,b,c,d){b||(a.currentDay=a.selectedDay,a.currentMonth=a.selectedMonth,a.currentYear=a.selectedYear);var e=b?typeof b=="object"?b:this._daylightSavingAdjust(new Date(d,c,b)):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return this.formatDate(this._get(a,"dateFormat"),e,this._getFormatConfig(a))}}),$.fn.datepicker=function(a){if(!this.length)return this;$.datepicker.initialized||($(document).mousedown($.datepicker._checkExternalClick).find("body").append($.datepicker.dpDiv),$.datepicker.initialized=!0);var b=Array.prototype.slice.call(arguments,1);return typeof a!="string"||a!="isDisabled"&&a!="getDate"&&a!="widget"?a=="option"&&arguments.length==2&&typeof arguments[1]=="string"?$.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this[0]].concat(b)):this.each(function(){typeof a=="string"?$.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this].concat(b)):$.datepicker._attachDatepicker(this,a)}):$.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this[0]].concat(b))},$.datepicker=new Datepicker,$.datepicker.initialized=!1,$.datepicker.uuid=(new Date).getTime(),$.datepicker.version="1.8.20",window["DP_jQuery_"+dpuuid]=$})(jQuery);;/*! jQuery UI - v1.8.20 - 2012-04-30 * https://github.com/jquery/jquery-ui * Includes: jquery.ui.progressbar.js * Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ (function(a,b){a.widget("ui.progressbar",{options:{value:0,max:100},min:0,_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min,"aria-valuemax":this.options.max,"aria-valuenow":this._value()}),this.valueDiv=a("
    ").appendTo(this.element),this.oldValue=this._value(),this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.valueDiv.remove(),a.Widget.prototype.destroy.apply(this,arguments)},value:function(a){return a===b?this._value():(this._setOption("value",a),this)},_setOption:function(b,c){b==="value"&&(this.options.value=c,this._refreshValue(),this._value()===this.options.max&&this._trigger("complete")),a.Widget.prototype._setOption.apply(this,arguments)},_value:function(){var a=this.options.value;return typeof a!="number"&&(a=0),Math.min(this.options.max,Math.max(this.min,a))},_percentage:function(){return 100*this._value()/this.options.max},_refreshValue:function(){var a=this.value(),b=this._percentage();this.oldValue!==a&&(this.oldValue=a,this._trigger("change")),this.valueDiv.toggle(a>this.min).toggleClass("ui-corner-right",a===this.options.max).width(b.toFixed(0)+"%"),this.element.attr("aria-valuenow",a)}}),a.extend(a.ui.progressbar,{version:"1.8.20"})})(jQuery);;/*! jQuery UI - v1.8.20 - 2012-04-30 * https://github.com/jquery/jquery-ui * Includes: jquery.effects.core.js * Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ jQuery.effects||function(a,b){function c(b){var c;return b&&b.constructor==Array&&b.length==3?b:(c=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(b))?[parseInt(c[1],10),parseInt(c[2],10),parseInt(c[3],10)]:(c=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(b))?[parseFloat(c[1])*2.55,parseFloat(c[2])*2.55,parseFloat(c[3])*2.55]:(c=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(b))?[parseInt(c[1],16),parseInt(c[2],16),parseInt(c[3],16)]:(c=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(b))?[parseInt(c[1]+c[1],16),parseInt(c[2]+c[2],16),parseInt(c[3]+c[3],16)]:(c=/rgba\(0, 0, 0, 0\)/.exec(b))?e.transparent:e[a.trim(b).toLowerCase()]}function d(b,d){var e;do{e=a.curCSS(b,d);if(e!=""&&e!="transparent"||a.nodeName(b,"body"))break;d="backgroundColor"}while(b=b.parentNode);return c(e)}function h(){var a=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle,b={},c,d;if(a&&a.length&&a[0]&&a[a[0]]){var e=a.length;while(e--)c=a[e],typeof a[c]=="string"&&(d=c.replace(/\-(\w)/g,function(a,b){return b.toUpperCase()}),b[d]=a[c])}else for(c in a)typeof a[c]=="string"&&(b[c]=a[c]);return b}function i(b){var c,d;for(c in b)d=b[c],(d==null||a.isFunction(d)||c in g||/scrollbar/.test(c)||!/color/i.test(c)&&isNaN(parseFloat(d)))&&delete b[c];return b}function j(a,b){var c={_:0},d;for(d in b)a[d]!=b[d]&&(c[d]=b[d]);return c}function k(b,c,d,e){typeof b=="object"&&(e=c,d=null,c=b,b=c.effect),a.isFunction(c)&&(e=c,d=null,c={});if(typeof c=="number"||a.fx.speeds[c])e=d,d=c,c={};return a.isFunction(d)&&(e=d,d=null),c=c||{},d=d||c.duration,d=a.fx.off?0:typeof d=="number"?d:d in a.fx.speeds?a.fx.speeds[d]:a.fx.speeds._default,e=e||c.complete,[b,c,d,e]}function l(b){return!b||typeof b=="number"||a.fx.speeds[b]?!0:typeof b=="string"&&!a.effects[b]?!0:!1}a.effects={},a.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","borderColor","color","outlineColor"],function(b,e){a.fx.step[e]=function(a){a.colorInit||(a.start=d(a.elem,e),a.end=c(a.end),a.colorInit=!0),a.elem.style[e]="rgb("+Math.max(Math.min(parseInt(a.pos*(a.end[0]-a.start[0])+a.start[0],10),255),0)+","+Math.max(Math.min(parseInt(a.pos*(a.end[1]-a.start[1])+a.start[1],10),255),0)+","+Math.max(Math.min(parseInt(a.pos*(a.end[2]-a.start[2])+a.start[2],10),255),0)+")"}});var e={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},f=["add","remove","toggle"],g={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};a.effects.animateClass=function(b,c,d,e){return a.isFunction(d)&&(e=d,d=null),this.queue(function(){var g=a(this),k=g.attr("style")||" ",l=i(h.call(this)),m,n=g.attr("class")||"";a.each(f,function(a,c){b[c]&&g[c+"Class"](b[c])}),m=i(h.call(this)),g.attr("class",n),g.animate(j(l,m),{queue:!1,duration:c,easing:d,complete:function(){a.each(f,function(a,c){b[c]&&g[c+"Class"](b[c])}),typeof g.attr("style")=="object"?(g.attr("style").cssText="",g.attr("style").cssText=k):g.attr("style",k),e&&e.apply(this,arguments),a.dequeue(this)}})})},a.fn.extend({_addClass:a.fn.addClass,addClass:function(b,c,d,e){return c?a.effects.animateClass.apply(this,[{add:b},c,d,e]):this._addClass(b)},_removeClass:a.fn.removeClass,removeClass:function(b,c,d,e){return c?a.effects.animateClass.apply(this,[{remove:b},c,d,e]):this._removeClass(b)},_toggleClass:a.fn.toggleClass,toggleClass:function(c,d,e,f,g){return typeof d=="boolean"||d===b?e?a.effects.animateClass.apply(this,[d?{add:c}:{remove:c},e,f,g]):this._toggleClass(c,d):a.effects.animateClass.apply(this,[{toggle:c},d,e,f])},switchClass:function(b,c,d,e,f){return a.effects.animateClass.apply(this,[{add:c,remove:b},d,e,f])}}),a.extend(a.effects,{version:"1.8.20",save:function(a,b){for(var c=0;c").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),e=document.activeElement;return b.wrap(d),(b[0]===e||a.contains(b[0],e))&&a(e).focus(),d=b.parent(),b.css("position")=="static"?(d.css({position:"relative"}),b.css({position:"relative"})):(a.extend(c,{position:b.css("position"),zIndex:b.css("z-index")}),a.each(["top","left","bottom","right"],function(a,d){c[d]=b.css(d),isNaN(parseInt(c[d],10))&&(c[d]="auto")}),b.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),d.css(c).show()},removeWrapper:function(b){var c,d=document.activeElement;return b.parent().is(".ui-effects-wrapper")?(c=b.parent().replaceWith(b),(b[0]===d||a.contains(b[0],d))&&a(d).focus(),c):b},setTransition:function(b,c,d,e){return e=e||{},a.each(c,function(a,c){var f=b.cssUnit(c);f[0]>0&&(e[c]=f[0]*d+f[1])}),e}}),a.fn.extend({effect:function(b,c,d,e){var f=k.apply(this,arguments),g={options:f[1],duration:f[2],callback:f[3]},h=g.options.mode,i=a.effects[b];return a.fx.off||!i?h?this[h](g.duration,g.callback):this.each(function(){g.callback&&g.callback.call(this)}):i.call(this,g)},_show:a.fn.show,show:function(a){if(l(a))return this._show.apply(this,arguments);var b=k.apply(this,arguments);return b[1].mode="show",this.effect.apply(this,b)},_hide:a.fn.hide,hide:function(a){if(l(a))return this._hide.apply(this,arguments);var b=k.apply(this,arguments);return b[1].mode="hide",this.effect.apply(this,b)},__toggle:a.fn.toggle,toggle:function(b){if(l(b)||typeof b=="boolean"||a.isFunction(b))return this.__toggle.apply(this,arguments);var c=k.apply(this,arguments);return c[1].mode="toggle",this.effect.apply(this,c)},cssUnit:function(b){var c=this.css(b),d=[];return a.each(["em","px","%","pt"],function(a,b){c.indexOf(b)>0&&(d=[parseFloat(c),b])}),d}}),a.easing.jswing=a.easing.swing,a.extend(a.easing,{def:"easeOutQuad",swing:function(b,c,d,e,f){return a.easing[a.easing.def](b,c,d,e,f)},easeInQuad:function(a,b,c,d,e){return d*(b/=e)*b+c},easeOutQuad:function(a,b,c,d,e){return-d*(b/=e)*(b-2)+c},easeInOutQuad:function(a,b,c,d,e){return(b/=e/2)<1?d/2*b*b+c:-d/2*(--b*(b-2)-1)+c},easeInCubic:function(a,b,c,d,e){return d*(b/=e)*b*b+c},easeOutCubic:function(a,b,c,d,e){return d*((b=b/e-1)*b*b+1)+c},easeInOutCubic:function(a,b,c,d,e){return(b/=e/2)<1?d/2*b*b*b+c:d/2*((b-=2)*b*b+2)+c},easeInQuart:function(a,b,c,d,e){return d*(b/=e)*b*b*b+c},easeOutQuart:function(a,b,c,d,e){return-d*((b=b/e-1)*b*b*b-1)+c},easeInOutQuart:function(a,b,c,d,e){return(b/=e/2)<1?d/2*b*b*b*b+c:-d/2*((b-=2)*b*b*b-2)+c},easeInQuint:function(a,b,c,d,e){return d*(b/=e)*b*b*b*b+c},easeOutQuint:function(a,b,c,d,e){return d*((b=b/e-1)*b*b*b*b+1)+c},easeInOutQuint:function(a,b,c,d,e){return(b/=e/2)<1?d/2*b*b*b*b*b+c:d/2*((b-=2)*b*b*b*b+2)+c},easeInSine:function(a,b,c,d,e){return-d*Math.cos(b/e*(Math.PI/2))+d+c},easeOutSine:function(a,b,c,d,e){return d*Math.sin(b/e*(Math.PI/2))+c},easeInOutSine:function(a,b,c,d,e){return-d/2*(Math.cos(Math.PI*b/e)-1)+c},easeInExpo:function(a,b,c,d,e){return b==0?c:d*Math.pow(2,10*(b/e-1))+c},easeOutExpo:function(a,b,c,d,e){return b==e?c+d:d*(-Math.pow(2,-10*b/e)+1)+c},easeInOutExpo:function(a,b,c,d,e){return b==0?c:b==e?c+d:(b/=e/2)<1?d/2*Math.pow(2,10*(b-1))+c:d/2*(-Math.pow(2,-10*--b)+2)+c},easeInCirc:function(a,b,c,d,e){return-d*(Math.sqrt(1-(b/=e)*b)-1)+c},easeOutCirc:function(a,b,c,d,e){return d*Math.sqrt(1-(b=b/e-1)*b)+c},easeInOutCirc:function(a,b,c,d,e){return(b/=e/2)<1?-d/2*(Math.sqrt(1-b*b)-1)+c:d/2*(Math.sqrt(1-(b-=2)*b)+1)+c},easeInElastic:function(a,b,c,d,e){var f=1.70158,g=0,h=d;if(b==0)return c;if((b/=e)==1)return c+d;g||(g=e*.3);if(h").css({position:"absolute",visibility:"visible",left:-j*(g/d),top:-i*(h/c)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:g/d,height:h/c,left:f.left+j*(g/d)+(b.options.mode=="show"?(j-Math.floor(d/2))*(g/d):0),top:f.top+i*(h/c)+(b.options.mode=="show"?(i-Math.floor(c/2))*(h/c):0),opacity:b.options.mode=="show"?0:1}).animate({left:f.left+j*(g/d)+(b.options.mode=="show"?0:(j-Math.floor(d/2))*(g/d)),top:f.top+i*(h/c)+(b.options.mode=="show"?0:(i-Math.floor(c/2))*(h/c)),opacity:b.options.mode=="show"?1:0},b.duration||500);setTimeout(function(){b.options.mode=="show"?e.css({visibility:"visible"}):e.css({visibility:"visible"}).hide(),b.callback&&b.callback.apply(e[0]),e.dequeue(),a("div.ui-effects-explode").remove()},b.duration||500)})}})(jQuery);;/*! jQuery UI - v1.8.20 - 2012-04-30 * https://github.com/jquery/jquery-ui * Includes: jquery.effects.fade.js * Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ (function(a,b){a.effects.fade=function(b){return this.queue(function(){var c=a(this),d=a.effects.setMode(c,b.options.mode||"hide");c.animate({opacity:d},{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){b.callback&&b.callback.apply(this,arguments),c.dequeue()}})})}})(jQuery);;/*! jQuery UI - v1.8.20 - 2012-04-30 * https://github.com/jquery/jquery-ui * Includes: jquery.effects.fold.js * Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ (function(a,b){a.effects.fold=function(b){return this.queue(function(){var c=a(this),d=["position","top","bottom","left","right"],e=a.effects.setMode(c,b.options.mode||"hide"),f=b.options.size||15,g=!!b.options.horizFirst,h=b.duration?b.duration/2:a.fx.speeds._default/2;a.effects.save(c,d),c.show();var i=a.effects.createWrapper(c).css({overflow:"hidden"}),j=e=="show"!=g,k=j?["width","height"]:["height","width"],l=j?[i.width(),i.height()]:[i.height(),i.width()],m=/([0-9]+)%/.exec(f);m&&(f=parseInt(m[1],10)/100*l[e=="hide"?0:1]),e=="show"&&i.css(g?{height:0,width:f}:{height:f,width:0});var n={},p={};n[k[0]]=e=="show"?l[0]:f,p[k[1]]=e=="show"?l[1]:0,i.animate(n,h,b.options.easing).animate(p,h,b.options.easing,function(){e=="hide"&&c.hide(),a.effects.restore(c,d),a.effects.removeWrapper(c),b.callback&&b.callback.apply(c[0],arguments),c.dequeue()})})}})(jQuery);;/*! jQuery UI - v1.8.20 - 2012-04-30 * https://github.com/jquery/jquery-ui * Includes: jquery.effects.highlight.js * Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ (function(a,b){a.effects.highlight=function(b){return this.queue(function(){var c=a(this),d=["backgroundImage","backgroundColor","opacity"],e=a.effects.setMode(c,b.options.mode||"show"),f={backgroundColor:c.css("backgroundColor")};e=="hide"&&(f.opacity=0),a.effects.save(c,d),c.show().css({backgroundImage:"none",backgroundColor:b.options.color||"#ffff99"}).animate(f,{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){e=="hide"&&c.hide(),a.effects.restore(c,d),e=="show"&&!a.support.opacity&&this.style.removeAttribute("filter"),b.callback&&b.callback.apply(this,arguments),c.dequeue()}})})}})(jQuery);;/*! jQuery UI - v1.8.20 - 2012-04-30 * https://github.com/jquery/jquery-ui * Includes: jquery.effects.pulsate.js * Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ (function(a,b){a.effects.pulsate=function(b){return this.queue(function(){var c=a(this),d=a.effects.setMode(c,b.options.mode||"show"),e=(b.options.times||5)*2-1,f=b.duration?b.duration/2:a.fx.speeds._default/2,g=c.is(":visible"),h=0;g||(c.css("opacity",0).show(),h=1),(d=="hide"&&g||d=="show"&&!g)&&e--;for(var i=0;i').appendTo(document.body).addClass(b.options.className).css({top:g.top,left:g.left,height:c.innerHeight(),width:c.innerWidth(),position:"absolute"}).animate(f,b.duration,b.options.easing,function(){h.remove(),b.callback&&b.callback.apply(c[0],arguments),c.dequeue()})})}})(jQuery);; ; // Underscore.js 1.3.3 // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore is freely distributable under the MIT license. // Portions of Underscore are inspired or borrowed from Prototype, // Oliver Steele's Functional, and John Resig's Micro-Templating. // For all details and documentation: // http://documentcloud.github.com/underscore (function() { // Baseline setup // -------------- // Establish the root object, `window` in the browser, or `global` on the server. var root = this; // Save the previous value of the `_` variable. var previousUnderscore = root._; // Establish the object that gets returned to break out of a loop iteration. var breaker = {}; // Save bytes in the minified (but not gzipped) version: var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype; // Create quick reference variables for speed access to core prototypes. var slice = ArrayProto.slice, unshift = ArrayProto.unshift, toString = ObjProto.toString, hasOwnProperty = ObjProto.hasOwnProperty; // All **ECMAScript 5** native function implementations that we hope to use // are declared here. var nativeForEach = ArrayProto.forEach, nativeMap = ArrayProto.map, nativeReduce = ArrayProto.reduce, nativeReduceRight = ArrayProto.reduceRight, nativeFilter = ArrayProto.filter, nativeEvery = ArrayProto.every, nativeSome = ArrayProto.some, nativeIndexOf = ArrayProto.indexOf, nativeLastIndexOf = ArrayProto.lastIndexOf, nativeIsArray = Array.isArray, nativeKeys = Object.keys, nativeBind = FuncProto.bind; // Create a safe reference to the Underscore object for use below. var _ = function(obj) { return new wrapper(obj); }; // Export the Underscore object for **Node.js**, with // backwards-compatibility for the old `require()` API. If we're in // the browser, add `_` as a global object via a string identifier, // for Closure Compiler "advanced" mode. if (typeof exports !== 'undefined') { if (typeof module !== 'undefined' && module.exports) { exports = module.exports = _; } exports._ = _; } else { root['_'] = _; } // Current version. _.VERSION = '1.3.3'; // Collection Functions // -------------------- // The cornerstone, an `each` implementation, aka `forEach`. // Handles objects with the built-in `forEach`, arrays, and raw objects. // Delegates to **ECMAScript 5**'s native `forEach` if available. var each = _.each = _.forEach = function(obj, iterator, context) { if (obj == null) return; if (nativeForEach && obj.forEach === nativeForEach) { obj.forEach(iterator, context); } else if (obj.length === +obj.length) { for (var i = 0, l = obj.length; i < l; i++) { if (i in obj && iterator.call(context, obj[i], i, obj) === breaker) return; } } else { for (var key in obj) { if (_.has(obj, key)) { if (iterator.call(context, obj[key], key, obj) === breaker) return; } } } }; // Return the results of applying the iterator to each element. // Delegates to **ECMAScript 5**'s native `map` if available. _.map = _.collect = function(obj, iterator, context) { var results = []; if (obj == null) return results; if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context); each(obj, function(value, index, list) { results[results.length] = iterator.call(context, value, index, list); }); if (obj.length === +obj.length) results.length = obj.length; return results; }; // **Reduce** builds up a single result from a list of values, aka `inject`, // or `foldl`. Delegates to **ECMAScript 5**'s native `reduce` if available. _.reduce = _.foldl = _.inject = function(obj, iterator, memo, context) { var initial = arguments.length > 2; if (obj == null) obj = []; if (nativeReduce && obj.reduce === nativeReduce) { if (context) iterator = _.bind(iterator, context); return initial ? obj.reduce(iterator, memo) : obj.reduce(iterator); } each(obj, function(value, index, list) { if (!initial) { memo = value; initial = true; } else { memo = iterator.call(context, memo, value, index, list); } }); if (!initial) throw new TypeError('Reduce of empty array with no initial value'); return memo; }; // The right-associative version of reduce, also known as `foldr`. // Delegates to **ECMAScript 5**'s native `reduceRight` if available. _.reduceRight = _.foldr = function(obj, iterator, memo, context) { var initial = arguments.length > 2; if (obj == null) obj = []; if (nativeReduceRight && obj.reduceRight === nativeReduceRight) { if (context) iterator = _.bind(iterator, context); return initial ? obj.reduceRight(iterator, memo) : obj.reduceRight(iterator); } var reversed = _.toArray(obj).reverse(); if (context && !initial) iterator = _.bind(iterator, context); return initial ? _.reduce(reversed, iterator, memo, context) : _.reduce(reversed, iterator); }; // Return the first value which passes a truth test. Aliased as `detect`. _.find = _.detect = function(obj, iterator, context) { var result; any(obj, function(value, index, list) { if (iterator.call(context, value, index, list)) { result = value; return true; } }); return result; }; // Return all the elements that pass a truth test. // Delegates to **ECMAScript 5**'s native `filter` if available. // Aliased as `select`. _.filter = _.select = function(obj, iterator, context) { var results = []; if (obj == null) return results; if (nativeFilter && obj.filter === nativeFilter) return obj.filter(iterator, context); each(obj, function(value, index, list) { if (iterator.call(context, value, index, list)) results[results.length] = value; }); return results; }; // Return all the elements for which a truth test fails. _.reject = function(obj, iterator, context) { var results = []; if (obj == null) return results; each(obj, function(value, index, list) { if (!iterator.call(context, value, index, list)) results[results.length] = value; }); return results; }; // Determine whether all of the elements match a truth test. // Delegates to **ECMAScript 5**'s native `every` if available. // Aliased as `all`. _.every = _.all = function(obj, iterator, context) { var result = true; if (obj == null) return result; if (nativeEvery && obj.every === nativeEvery) return obj.every(iterator, context); each(obj, function(value, index, list) { if (!(result = result && iterator.call(context, value, index, list))) return breaker; }); return !!result; }; // Determine if at least one element in the object matches a truth test. // Delegates to **ECMAScript 5**'s native `some` if available. // Aliased as `any`. var any = _.some = _.any = function(obj, iterator, context) { iterator || (iterator = _.identity); var result = false; if (obj == null) return result; if (nativeSome && obj.some === nativeSome) return obj.some(iterator, context); each(obj, function(value, index, list) { if (result || (result = iterator.call(context, value, index, list))) return breaker; }); return !!result; }; // Determine if a given value is included in the array or object using `===`. // Aliased as `contains`. _.include = _.contains = function(obj, target) { var found = false; if (obj == null) return found; if (nativeIndexOf && obj.indexOf === nativeIndexOf) return obj.indexOf(target) != -1; found = any(obj, function(value) { return value === target; }); return found; }; // Invoke a method (with arguments) on every item in a collection. _.invoke = function(obj, method) { var args = slice.call(arguments, 2); return _.map(obj, function(value) { return (_.isFunction(method) ? method || value : value[method]).apply(value, args); }); }; // Convenience version of a common use case of `map`: fetching a property. _.pluck = function(obj, key) { return _.map(obj, function(value){ return value[key]; }); }; // Return the maximum element or (element-based computation). _.max = function(obj, iterator, context) { if (!iterator && _.isArray(obj) && obj[0] === +obj[0]) return Math.max.apply(Math, obj); if (!iterator && _.isEmpty(obj)) return -Infinity; var result = {computed : -Infinity}; each(obj, function(value, index, list) { var computed = iterator ? iterator.call(context, value, index, list) : value; computed >= result.computed && (result = {value : value, computed : computed}); }); return result.value; }; // Return the minimum element (or element-based computation). _.min = function(obj, iterator, context) { if (!iterator && _.isArray(obj) && obj[0] === +obj[0]) return Math.min.apply(Math, obj); if (!iterator && _.isEmpty(obj)) return Infinity; var result = {computed : Infinity}; each(obj, function(value, index, list) { var computed = iterator ? iterator.call(context, value, index, list) : value; computed < result.computed && (result = {value : value, computed : computed}); }); return result.value; }; // Shuffle an array. _.shuffle = function(obj) { var shuffled = [], rand; each(obj, function(value, index, list) { rand = Math.floor(Math.random() * (index + 1)); shuffled[index] = shuffled[rand]; shuffled[rand] = value; }); return shuffled; }; // Sort the object's values by a criterion produced by an iterator. _.sortBy = function(obj, val, context) { var iterator = _.isFunction(val) ? val : function(obj) { return obj[val]; }; return _.pluck(_.map(obj, function(value, index, list) { return { value : value, criteria : iterator.call(context, value, index, list) }; }).sort(function(left, right) { var a = left.criteria, b = right.criteria; if (a === void 0) return 1; if (b === void 0) return -1; return a < b ? -1 : a > b ? 1 : 0; }), 'value'); }; // Groups the object's values by a criterion. Pass either a string attribute // to group by, or a function that returns the criterion. _.groupBy = function(obj, val) { var result = {}; var iterator = _.isFunction(val) ? val : function(obj) { return obj[val]; }; each(obj, function(value, index) { var key = iterator(value, index); (result[key] || (result[key] = [])).push(value); }); return result; }; // Use a comparator function to figure out at what index an object should // be inserted so as to maintain order. Uses binary search. _.sortedIndex = function(array, obj, iterator) { iterator || (iterator = _.identity); var low = 0, high = array.length; while (low < high) { var mid = (low + high) >> 1; iterator(array[mid]) < iterator(obj) ? low = mid + 1 : high = mid; } return low; }; // Safely convert anything iterable into a real, live array. _.toArray = function(obj) { if (!obj) return []; if (_.isArray(obj)) return slice.call(obj); if (_.isArguments(obj)) return slice.call(obj); if (obj.toArray && _.isFunction(obj.toArray)) return obj.toArray(); return _.values(obj); }; // Return the number of elements in an object. _.size = function(obj) { return _.isArray(obj) ? obj.length : _.keys(obj).length; }; // Array Functions // --------------- // Get the first element of an array. Passing **n** will return the first N // values in the array. Aliased as `head` and `take`. The **guard** check // allows it to work with `_.map`. _.first = _.head = _.take = function(array, n, guard) { return (n != null) && !guard ? slice.call(array, 0, n) : array[0]; }; // Returns everything but the last entry of the array. Especcialy useful on // the arguments object. Passing **n** will return all the values in // the array, excluding the last N. The **guard** check allows it to work with // `_.map`. _.initial = function(array, n, guard) { return slice.call(array, 0, array.length - ((n == null) || guard ? 1 : n)); }; // Get the last element of an array. Passing **n** will return the last N // values in the array. The **guard** check allows it to work with `_.map`. _.last = function(array, n, guard) { if ((n != null) && !guard) { return slice.call(array, Math.max(array.length - n, 0)); } else { return array[array.length - 1]; } }; // Returns everything but the first entry of the array. Aliased as `tail`. // Especially useful on the arguments object. Passing an **index** will return // the rest of the values in the array from that index onward. The **guard** // check allows it to work with `_.map`. _.rest = _.tail = function(array, index, guard) { return slice.call(array, (index == null) || guard ? 1 : index); }; // Trim out all falsy values from an array. _.compact = function(array) { return _.filter(array, function(value){ return !!value; }); }; // Return a completely flattened version of an array. _.flatten = function(array, shallow) { return _.reduce(array, function(memo, value) { if (_.isArray(value)) return memo.concat(shallow ? value : _.flatten(value)); memo[memo.length] = value; return memo; }, []); }; // Return a version of the array that does not contain the specified value(s). _.without = function(array) { return _.difference(array, slice.call(arguments, 1)); }; // Produce a duplicate-free version of the array. If the array has already // been sorted, you have the option of using a faster algorithm. // Aliased as `unique`. _.uniq = _.unique = function(array, isSorted, iterator) { var initial = iterator ? _.map(array, iterator) : array; var results = []; // The `isSorted` flag is irrelevant if the array only contains two elements. if (array.length < 3) isSorted = true; _.reduce(initial, function (memo, value, index) { if (isSorted ? _.last(memo) !== value || !memo.length : !_.include(memo, value)) { memo.push(value); results.push(array[index]); } return memo; }, []); return results; }; // Produce an array that contains the union: each distinct element from all of // the passed-in arrays. _.union = function() { return _.uniq(_.flatten(arguments, true)); }; // Produce an array that contains every item shared between all the // passed-in arrays. (Aliased as "intersect" for back-compat.) _.intersection = _.intersect = function(array) { var rest = slice.call(arguments, 1); return _.filter(_.uniq(array), function(item) { return _.every(rest, function(other) { return _.indexOf(other, item) >= 0; }); }); }; // Take the difference between one array and a number of other arrays. // Only the elements present in just the first array will remain. _.difference = function(array) { var rest = _.flatten(slice.call(arguments, 1), true); return _.filter(array, function(value){ return !_.include(rest, value); }); }; // Zip together multiple lists into a single array -- elements that share // an index go together. _.zip = function() { var args = slice.call(arguments); var length = _.max(_.pluck(args, 'length')); var results = new Array(length); for (var i = 0; i < length; i++) results[i] = _.pluck(args, "" + i); return results; }; // If the browser doesn't supply us with indexOf (I'm looking at you, **MSIE**), // we need this function. Return the position of the first occurrence of an // item in an array, or -1 if the item is not included in the array. // Delegates to **ECMAScript 5**'s native `indexOf` if available. // If the array is large and already in sort order, pass `true` // for **isSorted** to use binary search. _.indexOf = function(array, item, isSorted) { if (array == null) return -1; var i, l; if (isSorted) { i = _.sortedIndex(array, item); return array[i] === item ? i : -1; } if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item); for (i = 0, l = array.length; i < l; i++) if (i in array && array[i] === item) return i; return -1; }; // Delegates to **ECMAScript 5**'s native `lastIndexOf` if available. _.lastIndexOf = function(array, item) { if (array == null) return -1; if (nativeLastIndexOf && array.lastIndexOf === nativeLastIndexOf) return array.lastIndexOf(item); var i = array.length; while (i--) if (i in array && array[i] === item) return i; return -1; }; // Generate an integer Array containing an arithmetic progression. A port of // the native Python `range()` function. See // [the Python documentation](http://docs.python.org/library/functions.html#range). _.range = function(start, stop, step) { if (arguments.length <= 1) { stop = start || 0; start = 0; } step = arguments[2] || 1; var len = Math.max(Math.ceil((stop - start) / step), 0); var idx = 0; var range = new Array(len); while(idx < len) { range[idx++] = start; start += step; } return range; }; // Function (ahem) Functions // ------------------ // Reusable constructor function for prototype setting. var ctor = function(){}; // Create a function bound to a given object (assigning `this`, and arguments, // optionally). Binding with arguments is also known as `curry`. // Delegates to **ECMAScript 5**'s native `Function.bind` if available. // We check for `func.bind` first, to fail fast when `func` is undefined. _.bind = function bind(func, context) { var bound, args; if (func.bind === nativeBind && nativeBind) return nativeBind.apply(func, slice.call(arguments, 1)); if (!_.isFunction(func)) throw new TypeError; args = slice.call(arguments, 2); return bound = function() { if (!(this instanceof bound)) return func.apply(context, args.concat(slice.call(arguments))); ctor.prototype = func.prototype; var self = new ctor; var result = func.apply(self, args.concat(slice.call(arguments))); if (Object(result) === result) return result; return self; }; }; // Bind all of an object's methods to that object. Useful for ensuring that // all callbacks defined on an object belong to it. _.bindAll = function(obj) { var funcs = slice.call(arguments, 1); if (funcs.length == 0) funcs = _.functions(obj); each(funcs, function(f) { obj[f] = _.bind(obj[f], obj); }); return obj; }; // Memoize an expensive function by storing its results. _.memoize = function(func, hasher) { var memo = {}; hasher || (hasher = _.identity); return function() { var key = hasher.apply(this, arguments); return _.has(memo, key) ? memo[key] : (memo[key] = func.apply(this, arguments)); }; }; // Delays a function for the given number of milliseconds, and then calls // it with the arguments supplied. _.delay = function(func, wait) { var args = slice.call(arguments, 2); return setTimeout(function(){ return func.apply(null, args); }, wait); }; // Defers a function, scheduling it to run after the current call stack has // cleared. _.defer = function(func) { return _.delay.apply(_, [func, 1].concat(slice.call(arguments, 1))); }; // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. _.throttle = function(func, wait) { var context, args, timeout, throttling, more, result; var whenDone = _.debounce(function(){ more = throttling = false; }, wait); return function() { context = this; args = arguments; var later = function() { timeout = null; if (more) func.apply(context, args); whenDone(); }; if (!timeout) timeout = setTimeout(later, wait); if (throttling) { more = true; } else { result = func.apply(context, args); } whenDone(); throttling = true; return result; }; }; // Returns a function, that, as long as it continues to be invoked, will not // be triggered. The function will be called after it stops being called for // N milliseconds. If `immediate` is passed, trigger the function on the // leading edge, instead of the trailing. _.debounce = function(func, wait, immediate) { var timeout; return function() { var context = this, args = arguments; var later = function() { timeout = null; if (!immediate) func.apply(context, args); }; if (immediate && !timeout) func.apply(context, args); clearTimeout(timeout); timeout = setTimeout(later, wait); }; }; // Returns a function that will be executed at most one time, no matter how // often you call it. Useful for lazy initialization. _.once = function(func) { var ran = false, memo; return function() { if (ran) return memo; ran = true; return memo = func.apply(this, arguments); }; }; // Returns the first function passed as an argument to the second, // allowing you to adjust arguments, run code before and after, and // conditionally execute the original function. _.wrap = function(func, wrapper) { return function() { var args = [func].concat(slice.call(arguments, 0)); return wrapper.apply(this, args); }; }; // Returns a function that is the composition of a list of functions, each // consuming the return value of the function that follows. _.compose = function() { var funcs = arguments; return function() { var args = arguments; for (var i = funcs.length - 1; i >= 0; i--) { args = [funcs[i].apply(this, args)]; } return args[0]; }; }; // Returns a function that will only be executed after being called N times. _.after = function(times, func) { if (times <= 0) return func(); return function() { if (--times < 1) { return func.apply(this, arguments); } }; }; // Object Functions // ---------------- // Retrieve the names of an object's properties. // Delegates to **ECMAScript 5**'s native `Object.keys` _.keys = nativeKeys || function(obj) { if (obj !== Object(obj)) throw new TypeError('Invalid object'); var keys = []; for (var key in obj) if (_.has(obj, key)) keys[keys.length] = key; return keys; }; // Retrieve the values of an object's properties. _.values = function(obj) { return _.map(obj, _.identity); }; // Return a sorted list of the function names available on the object. // Aliased as `methods` _.functions = _.methods = function(obj) { var names = []; for (var key in obj) { if (_.isFunction(obj[key])) names.push(key); } return names.sort(); }; // Extend a given object with all the properties in passed-in object(s). _.extend = function(obj) { each(slice.call(arguments, 1), function(source) { for (var prop in source) { obj[prop] = source[prop]; } }); return obj; }; // Return a copy of the object only containing the whitelisted properties. _.pick = function(obj) { var result = {}; each(_.flatten(slice.call(arguments, 1)), function(key) { if (key in obj) result[key] = obj[key]; }); return result; }; // Fill in a given object with default properties. _.defaults = function(obj) { each(slice.call(arguments, 1), function(source) { for (var prop in source) { if (obj[prop] == null) obj[prop] = source[prop]; } }); return obj; }; // Create a (shallow-cloned) duplicate of an object. _.clone = function(obj) { if (!_.isObject(obj)) return obj; return _.isArray(obj) ? obj.slice() : _.extend({}, obj); }; // Invokes interceptor with the obj, and then returns obj. // The primary purpose of this method is to "tap into" a method chain, in // order to perform operations on intermediate results within the chain. _.tap = function(obj, interceptor) { interceptor(obj); return obj; }; // Internal recursive comparison function. function eq(a, b, stack) { // Identical objects are equal. `0 === -0`, but they aren't identical. // See the Harmony `egal` proposal: http://wiki.ecmascript.org/doku.php?id=harmony:egal. if (a === b) return a !== 0 || 1 / a == 1 / b; // A strict comparison is necessary because `null == undefined`. if (a == null || b == null) return a === b; // Unwrap any wrapped objects. if (a._chain) a = a._wrapped; if (b._chain) b = b._wrapped; // Invoke a custom `isEqual` method if one is provided. if (a.isEqual && _.isFunction(a.isEqual)) return a.isEqual(b); if (b.isEqual && _.isFunction(b.isEqual)) return b.isEqual(a); // Compare `[[Class]]` names. var className = toString.call(a); if (className != toString.call(b)) return false; switch (className) { // Strings, numbers, dates, and booleans are compared by value. case '[object String]': // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is // equivalent to `new String("5")`. return a == String(b); case '[object Number]': // `NaN`s are equivalent, but non-reflexive. An `egal` comparison is performed for // other numeric values. return a != +a ? b != +b : (a == 0 ? 1 / a == 1 / b : a == +b); case '[object Date]': case '[object Boolean]': // Coerce dates and booleans to numeric primitive values. Dates are compared by their // millisecond representations. Note that invalid dates with millisecond representations // of `NaN` are not equivalent. return +a == +b; // RegExps are compared by their source patterns and flags. case '[object RegExp]': return a.source == b.source && a.global == b.global && a.multiline == b.multiline && a.ignoreCase == b.ignoreCase; } if (typeof a != 'object' || typeof b != 'object') return false; // Assume equality for cyclic structures. The algorithm for detecting cyclic // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`. var length = stack.length; while (length--) { // Linear search. Performance is inversely proportional to the number of // unique nested structures. if (stack[length] == a) return true; } // Add the first object to the stack of traversed objects. stack.push(a); var size = 0, result = true; // Recursively compare objects and arrays. if (className == '[object Array]') { // Compare array lengths to determine if a deep comparison is necessary. size = a.length; result = size == b.length; if (result) { // Deep compare the contents, ignoring non-numeric properties. while (size--) { // Ensure commutative equality for sparse arrays. if (!(result = size in a == size in b && eq(a[size], b[size], stack))) break; } } } else { // Objects with different constructors are not equivalent. if ('constructor' in a != 'constructor' in b || a.constructor != b.constructor) return false; // Deep compare objects. for (var key in a) { if (_.has(a, key)) { // Count the expected number of properties. size++; // Deep compare each member. if (!(result = _.has(b, key) && eq(a[key], b[key], stack))) break; } } // Ensure that both objects contain the same number of properties. if (result) { for (key in b) { if (_.has(b, key) && !(size--)) break; } result = !size; } } // Remove the first object from the stack of traversed objects. stack.pop(); return result; } // Perform a deep comparison to check if two objects are equal. _.isEqual = function(a, b) { return eq(a, b, []); }; // Is a given array, string, or object empty? // An "empty" object has no enumerable own-properties. _.isEmpty = function(obj) { if (obj == null) return true; if (_.isArray(obj) || _.isString(obj)) return obj.length === 0; for (var key in obj) if (_.has(obj, key)) return false; return true; }; // Is a given value a DOM element? _.isElement = function(obj) { return !!(obj && obj.nodeType == 1); }; // Is a given value an array? // Delegates to ECMA5's native Array.isArray _.isArray = nativeIsArray || function(obj) { return toString.call(obj) == '[object Array]'; }; // Is a given variable an object? _.isObject = function(obj) { return obj === Object(obj); }; // Is a given variable an arguments object? _.isArguments = function(obj) { return toString.call(obj) == '[object Arguments]'; }; if (!_.isArguments(arguments)) { _.isArguments = function(obj) { return !!(obj && _.has(obj, 'callee')); }; } // Is a given value a function? _.isFunction = function(obj) { return toString.call(obj) == '[object Function]'; }; // Is a given value a string? _.isString = function(obj) { return toString.call(obj) == '[object String]'; }; // Is a given value a number? _.isNumber = function(obj) { return toString.call(obj) == '[object Number]'; }; // Is a given object a finite number? _.isFinite = function(obj) { return _.isNumber(obj) && isFinite(obj); }; // Is the given value `NaN`? _.isNaN = function(obj) { // `NaN` is the only value for which `===` is not reflexive. return obj !== obj; }; // Is a given value a boolean? _.isBoolean = function(obj) { return obj === true || obj === false || toString.call(obj) == '[object Boolean]'; }; // Is a given value a date? _.isDate = function(obj) { return toString.call(obj) == '[object Date]'; }; // Is the given value a regular expression? _.isRegExp = function(obj) { return toString.call(obj) == '[object RegExp]'; }; // Is a given value equal to null? _.isNull = function(obj) { return obj === null; }; // Is a given variable undefined? _.isUndefined = function(obj) { return obj === void 0; }; // Has own property? _.has = function(obj, key) { return hasOwnProperty.call(obj, key); }; // Utility Functions // ----------------- // Run Underscore.js in *noConflict* mode, returning the `_` variable to its // previous owner. Returns a reference to the Underscore object. _.noConflict = function() { root._ = previousUnderscore; return this; }; // Keep the identity function around for default iterators. _.identity = function(value) { return value; }; // Run a function **n** times. _.times = function (n, iterator, context) { for (var i = 0; i < n; i++) iterator.call(context, i); }; // Escape a string for HTML interpolation. _.escape = function(string) { return (''+string).replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"').replace(/'/g, ''').replace(/\//g,'/'); }; // If the value of the named property is a function then invoke it; // otherwise, return it. _.result = function(object, property) { if (object == null) return null; var value = object[property]; return _.isFunction(value) ? value.call(object) : value; }; // Add your own custom functions to the Underscore object, ensuring that // they're correctly added to the OOP wrapper as well. _.mixin = function(obj) { each(_.functions(obj), function(name){ addToWrapper(name, _[name] = obj[name]); }); }; // Generate a unique integer id (unique within the entire client session). // Useful for temporary DOM ids. var idCounter = 0; _.uniqueId = function(prefix) { var id = idCounter++; return prefix ? prefix + id : id; }; // By default, Underscore uses ERB-style template delimiters, change the // following template settings to use alternative delimiters. _.templateSettings = { evaluate : /<%([\s\S]+?)%>/g, interpolate : /<%=([\s\S]+?)%>/g, escape : /<%-([\s\S]+?)%>/g }; // When customizing `templateSettings`, if you don't want to define an // interpolation, evaluation or escaping regex, we need one that is // guaranteed not to match. var noMatch = /.^/; // Certain characters need to be escaped so that they can be put into a // string literal. var escapes = { '\\': '\\', "'": "'", 'r': '\r', 'n': '\n', 't': '\t', 'u2028': '\u2028', 'u2029': '\u2029' }; for (var p in escapes) escapes[escapes[p]] = p; var escaper = /\\|'|\r|\n|\t|\u2028|\u2029/g; var unescaper = /\\(\\|'|r|n|t|u2028|u2029)/g; // Within an interpolation, evaluation, or escaping, remove HTML escaping // that had been previously added. var unescape = function(code) { return code.replace(unescaper, function(match, escape) { return escapes[escape]; }); }; // JavaScript micro-templating, similar to John Resig's implementation. // Underscore templating handles arbitrary delimiters, preserves whitespace, // and correctly escapes quotes within interpolated code. _.template = function(text, data, settings) { settings = _.defaults(settings || {}, _.templateSettings); // Compile the template source, taking care to escape characters that // cannot be included in a string literal and then unescape them in code // blocks. var source = "__p+='" + text .replace(escaper, function(match) { return '\\' + escapes[match]; }) .replace(settings.escape || noMatch, function(match, code) { return "'+\n_.escape(" + unescape(code) + ")+\n'"; }) .replace(settings.interpolate || noMatch, function(match, code) { return "'+\n(" + unescape(code) + ")+\n'"; }) .replace(settings.evaluate || noMatch, function(match, code) { return "';\n" + unescape(code) + "\n;__p+='"; }) + "';\n"; // If a variable is not specified, place data values in local scope. if (!settings.variable) source = 'with(obj||{}){\n' + source + '}\n'; source = "var __p='';" + "var print=function(){__p+=Array.prototype.join.call(arguments, '')};\n" + source + "return __p;\n"; var render = new Function(settings.variable || 'obj', '_', source); if (data) return render(data, _); var template = function(data) { return render.call(this, data, _); }; // Provide the compiled function source as a convenience for build time // precompilation. template.source = 'function(' + (settings.variable || 'obj') + '){\n' + source + '}'; return template; }; // Add a "chain" function, which will delegate to the wrapper. _.chain = function(obj) { return _(obj).chain(); }; // The OOP Wrapper // --------------- // If Underscore is called as a function, it returns a wrapped object that // can be used OO-style. This wrapper holds altered versions of all the // underscore functions. Wrapped objects may be chained. var wrapper = function(obj) { this._wrapped = obj; }; // Expose `wrapper.prototype` as `_.prototype` _.prototype = wrapper.prototype; // Helper function to continue chaining intermediate results. var result = function(obj, chain) { return chain ? _(obj).chain() : obj; }; // A method to easily add functions to the OOP wrapper. var addToWrapper = function(name, func) { wrapper.prototype[name] = function() { var args = slice.call(arguments); unshift.call(args, this._wrapped); return result(func.apply(_, args), this._chain); }; }; // Add all of the Underscore functions to the wrapper object. _.mixin(_); // Add all mutator Array functions to the wrapper. each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) { var method = ArrayProto[name]; wrapper.prototype[name] = function() { var wrapped = this._wrapped; method.apply(wrapped, arguments); var length = wrapped.length; if ((name == 'shift' || name == 'splice') && length === 0) delete wrapped[0]; return result(wrapped, this._chain); }; }); // Add all accessor Array functions to the wrapper. each(['concat', 'join', 'slice'], function(name) { var method = ArrayProto[name]; wrapper.prototype[name] = function() { return result(method.apply(this._wrapped, arguments), this._chain); }; }); // Start chaining a wrapped Underscore object. wrapper.prototype.chain = function() { this._chain = true; return this; }; // Extracts the result from a wrapped and chained object. wrapper.prototype.value = function() { return this._wrapped; }; }).call(this); ; /*! * rrule.js - Library for working with recurrence rules for calendar dates. * v1.0.0-beta * https://github.com/jkbr/rrule * * Copyright 2010, Jakub Roztocil and Lars Schoning * Licenced under the BSD licence. * https://github.com/jkbr/rrule/blob/master/LICENCE * * Based on: * python-dateutil - Extensions to the standard Python datetime module. * Copyright (c) 2003-2011 - Gustavo Niemeyer * Copyright (c) 2012 - Tomi Pieviläinen * https://github.com/jkbr/rrule/blob/master/LICENCE * */ (function(root){ var serverSide = typeof module !== 'undefined' && module.exports; var _; if (serverSide) { _ = require('underscore'); } else if (!(_ = root._)) { throw 'You need to include underscore.js for rrule to work.' } var getnlp = function() { if (!getnlp._nlp) { if (serverSide) { // Lazy, runtime import to avoid circular refs. getnlp._nlp = require('./nlp') } else if (!(getnlp._nlp = root._RRuleNLP)) { throw 'You need to include rrule/nlp.js ' + 'for fromText/toText to work.' } } return getnlp._nlp; } //============================================================================= // Date utilities //============================================================================= /** * General date-related utilities. * Also handles several incompatibilities between JavaScript and Python * */ var dateutil = { MONTH_DAYS: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], /** * Number of milliseconds of one day */ ONE_DAY: 1000 * 60 * 60 * 24, /** * @see: */ MAXYEAR: 9999, /** * Python uses 1-Jan-1 as the base for calculating ordinals but we don't * want to confuse the JS engine with milliseconds > Number.MAX_NUMBER, * therefore we use 1-Jan-1970 instead */ ORDINAL_BASE: new Date(1970, 0, 1), /** * Python: MO-SU: 0 - 6 * JS: SU-SAT 0 - 6 */ PY_WEEKDAYS: [6, 0, 1, 2, 3, 4, 5], /** * py_date.timetuple()[7] */ getYearDay: function(date) { var dateNoTime = new Date( date.getFullYear(), date.getMonth(), date.getDate()); return Math.ceil( (dateNoTime - new Date(date.getFullYear(), 0, 1)) / dateutil.ONE_DAY) + 1; }, isLeapYear: function(year) { if (year instanceof Date) { year = year.getFullYear(); } return ((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0); }, /** * @return {Number} the date's timezone offset in ms */ tzOffset: function(date) { return date.getTimezoneOffset() * 60 * 1000 }, /** * @see: */ daysBetween: function(date1, date2) { // The number of milliseconds in one day // Convert both dates to milliseconds var date1_ms = date1.getTime() - dateutil.tzOffset(date1); var date2_ms = date2.getTime() - dateutil.tzOffset(date2); // Calculate the difference in milliseconds var difference_ms = Math.abs(date1_ms - date2_ms); // Convert back to days and return return Math.round(difference_ms / dateutil.ONE_DAY); }, /** * @see: */ toOrdinal: function(date) { return dateutil.daysBetween(date, dateutil.ORDINAL_BASE); }, /** * @see - */ fromOrdinal: function(ordinal) { var millisecsFromBase = ordinal * dateutil.ONE_DAY; return new Date(dateutil.ORDINAL_BASE.getTime() - dateutil.tzOffset(dateutil.ORDINAL_BASE) + millisecsFromBase + dateutil.tzOffset(new Date(millisecsFromBase))); }, /** * @see: */ monthRange: function(year, month) { var date = new Date(year, month, 1); return [dateutil.getWeekday(date), dateutil.getMonthDays(date)]; }, getMonthDays: function(date) { var month = date.getMonth(); return month == 1 && dateutil.isLeapYear(date) ? 29 : dateutil.MONTH_DAYS[month]; }, /** * @return {Number} python-like weekday */ getWeekday: function(date) { return dateutil.PY_WEEKDAYS[date.getDay()]; }, /** * @see: */ combine: function(date, time) { time = time || date; return new Date( date.getFullYear(), date.getMonth(), date.getDate(), time.getHours(), time.getMinutes(), time.getSeconds() ); }, clone: function(date) { var dolly = new Date(date.getTime()); dolly.setMilliseconds(0); return dolly; }, cloneDates: function(dates) { var clones = []; for (var i = 0; i < dates.length; i++) { clones.push(dateutil.clone(dates[i])); } return clones; }, /** * Sorts an array of Date or dateutil.Time objects */ sort: function(dates) { dates.sort(function(a, b){ return a.getTime() - b.getTime(); }); }, timeToUntilString: function(time) { var date = new Date(time); var comp, comps = [ date.getUTCFullYear(), date.getUTCMonth() + 1, date.getUTCDate(), 'T', date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds(), 'Z' ]; for (var i = 0; i < comps.length; i++) { comp = comps[i]; if (!/[TZ]/.test(comp) && comp < 10) { comps[i] = '0' + String(comp); } } return comps.join(''); } }; dateutil.Time = function(hour, minute, second) { this.hour = hour; this.minute = minute; this.second = second; }; dateutil.Time.prototype = { getHours: function() { return this.hour; }, getMinutes: function() { return this.minute; }, getSeconds: function() { return this.second; }, getTime: function() { return ((this.hour * 60 * 60) + (this.minute * 60) + this.second) * 1000; } }; //============================================================================= // Helper functions //============================================================================= /** * Simplified version of python's range() */ var range = function(start, end) { if (arguments.length === 1) { end = start; start = 0; } var rang = []; for (var i = start; i < end; i++) { rang.push(i); } return rang; }; var repeat = function(value, times) { var i = 0, array = []; if (value instanceof Array) { for (; i < times; i++) { array[i] = [].concat(value); } } else { for (; i < times; i++) { array[i] = value; } } return array; }; /** * closure/goog/math/math.js:modulo * Copyright 2006 The Closure Library Authors. * The % operator in JavaScript returns the remainder of a / b, but differs from * some other languages in that the result will have the same sign as the * dividend. For example, -1 % 8 == -1, whereas in some other languages * (such as Python) the result would be 7. This function emulates the more * correct modulo behavior, which is useful for certain applications such as * calculating an offset index in a circular list. * * @param {number} a The dividend. * @param {number} b The divisor. * @return {number} a % b where the result is between 0 and b (either 0 <= x < b * or b < x <= 0, depending on the sign of b). */ var pymod = function(a, b) { var r = a % b; // If r and b differ in sign, add b to wrap the result to the correct sign. return (r * b < 0) ? r + b : r; }; /** * @see: */ var divmod = function(a, b) { return {div: Math.floor(a / b), mod: pymod(a, b)}; }; /** * Python-like boolean * @return {Boolean} value of an object/primitive, taking into account * the fact that in Python an empty list's/tuple's * boolean value is False, whereas in JS it's true */ var plb = function(obj) { return (obj instanceof Array && obj.length == 0) ? false : Boolean(obj); }; //============================================================================= // Date masks //============================================================================= // Every mask is 7 days longer to handle cross-year weekly periods. var M366MASK = [].concat( repeat(1, 31), repeat(2, 29), repeat(3, 31), repeat(4, 30), repeat(5, 31), repeat(6, 30), repeat(7, 31), repeat(8, 31), repeat(9, 30), repeat(10, 31), repeat(11, 30), repeat(12, 31), repeat(1, 7) ); var M365MASK = [].concat(M366MASK); var M29 = range(1, 30), M30 = range(1, 31), M31 = range(1, 32); var MDAY366MASK = [].concat( M31, M29, M31, M30, M31, M30, M31, M31, M30, M31, M30, M31, M31.slice(0, 7) ); var MDAY365MASK = [].concat(MDAY366MASK); M29 = range(-29, 0); M30 = range(-30, 0); M31 = range(-31, 0); var NMDAY366MASK = [].concat( M31, M29, M31, M30, M31, M30, M31, M31, M30, M31, M30, M31, M31.slice(0, 7) ); var NMDAY365MASK = [].concat(NMDAY366MASK); var M366RANGE = [0,31,60,91,121,152,182,213,244,274,305,335,366]; var M365RANGE = [0,31,59,90,120,151,181,212,243,273,304,334,365]; var WDAYMASK = (function() { for (var wdaymask = [], i = 0; i < 55; i++) { wdaymask = wdaymask.concat(range(7)); } return wdaymask; }()); M29 = M30 = M31 = null; M365MASK = M365MASK.slice(0, 58).concat(M365MASK.slice(59, M365MASK.length)); MDAY365MASK = MDAY365MASK.slice(0, 58).concat(MDAY365MASK.slice(59)); NMDAY365MASK = NMDAY365MASK.slice(0, 31).concat(NMDAY365MASK.slice(32)); //============================================================================= // Weekday //============================================================================= var Weekday = function(weekday, n) { if (n === 0) { throw 'Can\'t create weekday with n == 0'; } this.weekday = weekday; this.n = n; }; Weekday.prototype = { // __call__ - Cannot call the object directly, do it through // e.g. RRule.TH.clone(-1) instead, clone: function(n) { return this.n == n ? this : new Weekday(this.weekday, n); }, // __eq__ equals: function(other) { return this.weekday == other.weekday && this.n == other.n; }, // __repr__ toString: function() { var s = ['MO', 'TU', 'WE', 'TH', 'FR', 'SA', 'SU'][this.weekday]; if (this.n) { s = (this.n > 0 ? '+' : '') + String(this.n) + s; } return s; }, getJsWeekday: function() { return this.weekday == 6 ? 0 : this.weekday + 1; } }; //============================================================================= // RRule //============================================================================= /** * * @param {String} freq - one of RRule.YEARLY, RRule.MONTHLY, ... * @param {Object?} options - see * @constructor */ var RRule = function(freq, options) { // RFC string this._string = null; this._cache = { all: false, before: [], after: [], between: [] }; var defaults = { cache: true, dtstart: null, interval: 1, wkst: 0, count: null, until: null, bysetpos: null, bymonth: null, bymonthday: null, byyearday: null, byweekno: null, byweekday: null, byhour: null, byminute: null, bysecond: null, // not implemented: byeaster: null }; var invalid = _(options) .chain() .keys() .reject(function(name){ return _.has(defaults, name) }) .value(); if (invalid.length) { throw 'Invalid options: ' + invalid.join(', ') } // used by toString() this.origOptions = _.clone(options); var opts; this.freq = freq; this.options = opts = _.extend(defaults, options); if (opts.byeaster !== null) { throw new Error('byeaster not implemented'); } if (!opts.dtstart) { opts.dtstart = new Date(); opts.dtstart.setMilliseconds(0); } if (opts.wkst === null) { opts.wkst = RRule.MO.weekday; } else if (typeof opts.wkst == 'number') { // cool, just keep it like that } else { opts.wkst = opts.wkst.weekday; } if (opts.bysetpos !== null) { if (typeof opts.bysetpos == 'number') { opts.bysetpos = [opts.bysetpos]; } for (var i = 0; i < opts.bysetpos.length; i++) { var v = opts.bysetpos[i]; if (v == 0 || !(-366 <= v && v <= 366)) { throw 'bysetpos must be between 1 and 366, or between -366 and -1'; } } } if (!(plb(opts.byweekno) || plb(opts.byyearday) || plb(opts.bymonthday) || opts.byweekday !== null || opts.byeaster !== null)) { switch (this.freq) { case RRule.YEARLY: if (!opts.bymonth) { opts.bymonth = opts.dtstart.getMonth() + 1; } opts.bymonthday = opts.dtstart.getDate(); break; case RRule.MONTHLY: opts.bymonthday = opts.dtstart.getDate(); break; case RRule.WEEKLY: opts.byweekday = dateutil.getWeekday( opts.dtstart); break; } } // bymonth if (opts.bymonth !== null && !(opts.bymonth instanceof Array)) { opts.bymonth = [opts.bymonth]; } // byyearday if (opts.byyearday !== null && !(opts.byyearday instanceof Array)) { opts.byyearday = [opts.byyearday]; } // bymonthday if (opts.bymonthday === null) { opts.bymonthday = []; opts.bynmonthday = []; } else if (opts.bymonthday instanceof Array) { var bymonthday = [], bynmonthday = []; for (i = 0; i < opts.bymonthday.length; i++) { var v = opts.bymonthday[i]; if (v > 0) { bymonthday.push(v); } else if (v < 0) { bynmonthday.push(v); } } opts.bymonthday = bymonthday; opts.bynmonthday = bynmonthday; } else { if (opts.bymonthday < 0) { opts.bynmonthday = [opts.bymonthday]; opts.bymonthday = []; } else { opts.bynmonthday = []; opts.bymonthday = [opts.bymonthday]; } } // byweekno if (opts.byweekno !== null && !(opts.byweekno instanceof Array)) { opts.byweekno = [opts.byweekno]; } // byweekday / bynweekday if (opts.byweekday === null) { opts.bynweekday = null; } else if (typeof opts.byweekday == 'number') { opts.byweekday = [opts.byweekday]; opts.bynweekday = null; } else if (opts.byweekday instanceof Weekday) { if (!opts.byweekday.n || this.freq > RRule.MONTHLY) { opts.byweekday = [opts.byweekday.weekday]; opts.bynweekday = null; } else { opts.bynweekday = [ [opts.byweekday.weekday, opts.byweekday.n] ]; opts.byweekday = null; } } else { var byweekday = [], bynweekday = []; for (i = 0; i < opts.byweekday.length; i++) { var wday = opts.byweekday[i]; if (typeof wday == 'number') { byweekday.push(wday); } else if (!wday.n || this.freq > RRule.MONTHLY) { byweekday.push(wday.weekday); } else { bynweekday.push([wday.weekday, wday.n]); } } opts.byweekday = plb(byweekday) ? byweekday : null; opts.bynweekday = plb(bynweekday) ? bynweekday : null; } // byhour if (opts.byhour === null) { opts.byhour = (this.freq < RRule.HOURLY) ? [opts.dtstart.getHours()] : null; } else if (typeof opts.byhour == 'number') { opts.byhour = [opts.byhour]; } // byminute if (opts.byminute === null) { opts.byminute = (this.freq < RRule.MINUTELY) ? [opts.dtstart.getMinutes()] : null; } else if (typeof opts.byminute == 'number') { opts.byminute = [opts.byminute]; } // bysecond if (opts.bysecond === null) { opts.bysecond = (this.freq < RRule.SECONDLY) ? [opts.dtstart.getSeconds()] : null; } else if (typeof opts.bysecond == 'number') { opts.bysecond = [opts.bysecond]; } if (this.freq >= RRule.HOURLY) { this.timeset = null; } else { this.timeset = []; for (i = 0; i < opts.byhour.length; i++) { var hour = opts.byhour[i]; for (var j = 0; j < opts.byminute.length; j++) { var minute = opts.byminute[j]; for (var k = 0; k < opts.bysecond.length; k++) { var second = opts.bysecond[k]; // python: // datetime.time(hour, minute, second, // tzinfo=self._tzinfo)) this.timeset.push(new dateutil.Time(hour, minute, second)); } } } dateutil.sort(this.timeset); } }; //}}} // RRule class 'constants' RRule.FREQUENCIES = [ 'YEARLY', 'MONTHLY', 'WEEKLY', 'DAILY', 'HOURLY', 'MINUTELY', 'SECONDLY' ]; RRule.YEARLY = 0; RRule.MONTHLY = 1; RRule.WEEKLY = 2; RRule.DAILY = 3; RRule.HOURLY = 4; RRule.MINUTELY = 5; RRule.SECONDLY = 6; RRule.MO = new Weekday(0); RRule.TU = new Weekday(1); RRule.WE = new Weekday(2); RRule.TH = new Weekday(3); RRule.FR = new Weekday(4); RRule.SA = new Weekday(5); RRule.SU = new Weekday(6); RRule.fromText = function(text, dtstart, language) { return getnlp().fromText(text, dtstart, language) } RRule.prototype = { /** * @param {Function} iterator - optional function that will be called * on each date that is added. It can return false * to stop the iteration. * @return Array containing all recurrences. */ all: function(iterator) { if (iterator) { return this._iter(new CallbackIterResult('all', {}, iterator)); } else { var result = this._cacheGet('all'); if (result === false) { result = this._iter(new IterResult('all', {})); this._cacheAdd('all', result); } return result; } }, /** * Returns all the occurrences of the rrule between after and before. * The inc keyword defines what happens if after and/or before are * themselves occurrences. With inc == True, they will be included in the * list, if they are found in the recurrence set. * @return Array */ between: function(after, before, inc, iterator) { var args = { before: before, after: after, inc: inc } if (iterator) { return this._iter( new CallbackIterResult('between', args, iterator)); } else { var result = this._cacheGet('between', args); if (result === false) { result = this._iter(new IterResult('between', args)); this._cacheAdd('between', result, args); } return result; } }, /** * Returns the last recurrence before the given datetime instance. * The inc keyword defines what happens if dt is an occurrence. * With inc == True, if dt itself is an occurrence, it will be returned. * @return Date or null */ before: function(dt, inc) { var args = { dt: dt, inc: inc }, result = this._cacheGet('before', args); if (result === false) { result = this._iter(new IterResult('before', args)); this._cacheAdd('before', result, args); } return result; }, /** * Returns the first recurrence after the given datetime instance. * The inc keyword defines what happens if dt is an occurrence. * With inc == True, if dt itself is an occurrence, it will be returned. * @return Date or null */ after: function(dt, inc) { var args = { dt: dt, inc: inc }, result = this._cacheGet('after', args); if (result === false) { result = this._iter(new IterResult('after', args)); this._cacheAdd('after', result, args); } return result; }, /** * Returns the number of recurrences in this set. It will have go trough * the whole recurrence, if this hasn't been done before. */ count: function() { return this.all().length; }, /** * Converts the rrule into its string representation * @see * @return String */ toString: function() { var attrs = [], key, keys, value, origValue, currentValue, strValues; if (this._string) { return this._string; } keys = [ 'byhour', 'byminute', 'bymonth', 'bymonthday', 'bysecond', 'bysetpos', 'byweekday', 'byweekno', 'byyearday', 'count', 'interval', 'until', 'wkst' ]; attrs.push(['FREQ', RRule.FREQUENCIES[this.freq]]); for (var i = 0; i < keys.length; i++) { key = keys[i]; // Only attributes specified in the options argument // passed to the constructor will be included in the string // representation if (typeof this.origOptions[key] == 'undefined') { continue; } // Do not modify the currentValue array, use this instead // to store string values strValues = []; // Some values are taken from the original options array // (this.origOptions), and some from the modified version // (this.options). currentValue = this.options[key]; origValue = this.origOptions[key]; key = key.toUpperCase(); switch (key) { case 'WKST': value = new Weekday(currentValue).toString(); break; case 'BYWEEKDAY': key = 'BYDAY'; // XXX: always use origValue, this won't work as expected // when byweekday contains +n and also -n value = (currentValue === null) ? this.options.bynweekday : currentValue; for (var wday, j = 0; j < value.length; j++) { wday = value[j]; if (wday instanceof Array) { wday = new Weekday(wday[0], wday[1]); } else { wday = new Weekday(wday); } strValues[j] = wday.toString(); } value = strValues; break; case'UNTIL': value = dateutil.timeToUntilString(currentValue); break; default: if (origValue instanceof Array) { for (var j = 0; j < origValue.length; j++) { strValues[j] = String(origValue[j]); } value = strValues; } else { value = String(origValue); } } attrs.push([key, value]); } var strings = []; for (var i = 0; i < attrs.length; i++) { var attr = attrs[i]; strings.push(attr[0] + '=' + attr[1].toString()); } this._string = strings.join(';'); return this._string; }, /** * Will convert all rules described in nlp:ToText * to text. */ toText: function(today, gettext, language) { if (!_.has(this, '_text')) { this._text = getnlp().toText(this, today, gettext, language); } return this._text; }, isFullyConvertibleToText: function() { return getnlp().isFullyConvertible(this) }, /** * @param {String} what - all/before/after/between * @param {Array,Date} value - an array of dates, one date, or null * @param {Object?} args - _iter arguments */ _cacheAdd: function(what, value, args) { if (!this.options.cache) return; if (value) { value = (value instanceof Date) ? dateutil.clone(value) : dateutil.cloneDates(value); } if (what == 'all') { this._cache.all = value; } else { args._value = value; this._cache[what].push(args); } }, /** * @return false - not in the cache * null - cached, but zero occurrences (before/after) * Date - cached (before/after) * [] - cached, but zero occurrences (all/between) * [Date1, DateN] - cached (all/between) */ _cacheGet: function(what, args) { if (!this.options.cache) { return false; } var cached = false; if (what == 'all') { cached = this._cache.all; } else { // Let's see whether we've already called the // 'what' method with the same 'args' loopItems: for (var item, i = 0; i < this._cache[what].length; i++) { item = this._cache[what][i]; for (var k in args) { if (args.hasOwnProperty(k) && String(args[k]) != String(item[k])) { continue loopItems; } } cached = item._value; break; } } if (!cached && this._cache.all) { // Not in the cache, but we already know all the occurrences, // so we can find the correct dates from the cached ones. var iterResult = new IterResult(what, args); for (var i = 0; i < this._cache.all.length; i++) { if (!iterResult.accept(this._cache.all[i])) { break; } } cached = iterResult.getValue(); this._cacheAdd(what, cached, args); } return cached instanceof Array ? dateutil.cloneDates(cached) : (cached instanceof Date ? dateutil.clone(cached) : cached); }, /** * @return a RRule instance with the same freq and options * as this one (cache is not cloned) */ clone: function() { return new RRule(this.freq, this.origOptions); }, _iter: function(iterResult) { /* Since JavaScript doesn't have the python's yield operator (<1.7), we use the IterResult object that tells us when to stop iterating. */ var dtstart = this.options.dtstart; var year = dtstart.getFullYear(), month = dtstart.getMonth() + 1, day = dtstart.getDate(), hour = dtstart.getHours(), minute = dtstart.getMinutes(), second = dtstart.getSeconds(), weekday = dateutil.getWeekday(dtstart), yearday = dateutil.getYearDay(dtstart); // Some local variables to speed things up a bit var freq = this.freq, interval = this.options.interval, wkst = this.options.wkst, until = this.options.until, bymonth = this.options.bymonth, byweekno = this.options.byweekno, byyearday = this.options.byyearday, byweekday = this.options.byweekday, byeaster = this.options.byeaster, bymonthday = this.options.bymonthday, bynmonthday = this.options.bynmonthday, bysetpos = this.options.bysetpos, byhour = this.options.byhour, byminute = this.options.byminute, bysecond = this.options.bysecond; var ii = new Iterinfo(this); ii.rebuild(year, month); var getdayset = {}; getdayset[RRule.YEARLY] = ii.ydayset; getdayset[RRule.MONTHLY] = ii.mdayset; getdayset[RRule.WEEKLY] = ii.wdayset; getdayset[RRule.DAILY] = ii.ddayset; getdayset[RRule.HOURLY] = ii.ddayset; getdayset[RRule.MINUTELY] = ii.ddayset; getdayset[RRule.SECONDLY] = ii.ddayset; getdayset = getdayset[freq]; var timeset; if (freq < RRule.HOURLY) { timeset = this.timeset; } else { var gettimeset = {}; gettimeset[RRule.HOURLY] = ii.htimeset; gettimeset[RRule.MINUTELY] = ii.mtimeset; gettimeset[RRule.SECONDLY] = ii.stimeset; gettimeset = gettimeset[freq]; if ((freq >= RRule.HOURLY && plb(byhour) && !_.include(byhour, hour)) || (freq >= RRule.MINUTELY && plb(byminute) && !_.include(byminute, minute)) || (freq >= RRule.SECONDLY && plb(bysecond) && !_.include(bysecond, minute))) { timeset = []; } else { timeset = gettimeset.call(ii, hour, minute, second); } } var filtered, total = 0, count = this.options.count; var iterNo = 0; var i, j, k, dm, div, mod, tmp, pos, dayset, start, end, fixday; while (true) { // Get dayset with the right frequency tmp = getdayset.call(ii, year, month, day); dayset = tmp[0]; start = tmp[1]; end = tmp[2]; // Do the "hard" work ;-) filtered = false; for (j = start; j < end; j++) { i = dayset[j]; if ((plb(bymonth) && !_.include(bymonth, ii.mmask[i])) || (plb(byweekno) && !ii.wnomask[i]) || (plb(byweekday) && !_.include(byweekday, ii.wdaymask[i])) || (plb(ii.nwdaymask) && !ii.nwdaymask[i]) || (plb(byeaster) && !ii.eastermask[i]) || ( (plb(bymonthday) || plb(bynmonthday)) && !_.include(bymonthday, ii.mdaymask[i]) && !_.include(bynmonthday, ii.nmdaymask[i]) ) || ( plb(byyearday) && ( ( i < ii.yearlen && !_.include(byyearday, i + 1) && !_.include(byyearday, -ii.yearlen + i) ) || ( i >= ii.yearlen && !_.include(byyearday, i + 1 - ii.yearlen) && !_.include(byyearday, -ii.nextyearlen + i - ii.yearlen) ) ) ) ) { dayset[i] = null; filtered = true; } } // Output results if (plb(bysetpos) && plb(timeset)) { var daypos, timepos, poslist = []; for (i, j = 0; j < bysetpos.length; j++) { var pos = bysetpos[j]; if (pos < 0) { daypos = Math.floor(pos / timeset.length); timepos = pymod(pos, timeset.length); } else { daypos = Math.floor((pos - 1) / timeset.length); timepos = pymod((pos - 1), timeset.length); } try { tmp = []; for (k = start; k < end; k++) { var val = dayset[k]; if (val === null) { continue; } tmp.push(val); } if (daypos < 0) { // we're trying to emulate python's aList[-n] i = tmp.slice(daypos)[0]; } else { i = tmp[daypos]; } var time = timeset[timepos]; var date = dateutil.fromOrdinal(ii.yearordinal + i); var res = dateutil.combine(date, time); // XXX: can this ever be in the array? // - compare the actual date instead? if (!_.include(poslist, res)) { poslist.push(res); } } catch (e) {} } dateutil.sort(poslist); for (j = 0; j < poslist.length; j++) { var res = poslist[j]; if (until && res > until) { this._len = total; return iterResult.getValue(); } else if (res >= dtstart) { ++total; if (!iterResult.accept(res)) { return iterResult.getValue(); } if (count) { --count; if (!count) { this._len = total; return iterResult.getValue(); } } } } } else { for (j = start; j < end; j++) { i = dayset[j]; if (i !== null) { var date = dateutil.fromOrdinal(ii.yearordinal + i); for (k = 0; k < timeset.length; k++) { var time = timeset[k]; var res = dateutil.combine(date, time); if (until && res > until) { this._len = total; return iterResult.getValue(); } else if (res >= dtstart) { ++total; if (!iterResult.accept(res)) { return iterResult.getValue(); } if (count) { --count; if (!count) { this._len = total; return iterResult.getValue(); } } } } } } } // Handle frequency and interval fixday = false; if (freq == RRule.YEARLY) { year += interval; if (year > dateutil.MAXYEAR) { this._len = total; return iterResult.getValue(); } ii.rebuild(year, month); } else if (freq == RRule.MONTHLY) { month += interval; if (month > 12) { div = Math.floor(month / 12); mod = pymod(month, 12); month = mod; year += div; if (month == 0) { month = 12; --year; } if (year > dateutil.MAXYEAR) { this._len = total; return iterResult.getValue(); } } ii.rebuild(year, month); } else if (freq == RRule.WEEKLY) { if (wkst > weekday) { day += -(weekday + 1 + (6 - wkst)) + interval * 7; } else { day += -(weekday - wkst) + interval * 7; } weekday = wkst; fixday = true; } else if (freq == RRule.DAILY) { day += interval; fixday = true; } else if (freq == RRule.HOURLY) { if (filtered) { // Jump to one iteration before next day hour += Math.floor((23 - hour) / interval) * interval; } while (true) { hour += interval; dm = divmod(hour, 24); div = dm.div; mod = dm.mod; if (div) { hour = mod; day += div; fixday = true; } if (!plb(byhour) || _.include(byhour, hour)) { break; } } timeset = gettimeset.call(ii, hour, minute, second); } else if (freq == RRule.MINUTELY) { if (filtered) { // Jump to one iteration before next day minute += Math.floor( (1439 - (hour * 60 + minute)) / interval) * interval; } while(true) { minute += interval; dm = divmod(minute, 60); div = dm.div; mod = dm.mod; if (div) { minute = mod; hour += div; dm = divmod(hour, 24); div = dm.div; mod = dm.mod; if (div) { hour = mod; day += div; fixday = true; filtered = false; } } if ((!plb(byhour) || _.include(byhour, hour)) && (!plb(byminute) || _.include(byminute, minute))) { break; } } timeset = gettimeset.call(ii, hour, minute, second); } else if (freq == RRule.SECONDLY) { if (filtered) { // Jump to one iteration before next day second += Math.floor( (86399 - (hour * 3600 + minute * 60 + second)) / interval) * interval; } while (true) { second += interval; dm = divmod(second, 60); div = dm.div; mod = dm.mod; if (div) { second = mod; minute += div; dm = divmod(minute, 60); div = dm.div; mod = dm.mod; if (div) { minute = mod; hour += div; dm = divmod(hour, 24); div = dm.div; mod = dm.mod; if (div) { hour = mod; day += div; fixday = true; } } } if ((!plb(byhour) || _.include(byhour, hour)) && (!plb(byminute) || _.include(byminute, minute)) && (!plb(bysecond) || _.include(bysecond, second))) { break; } } timeset = gettimeset.call(ii, hour, minute, second); } if (fixday && day > 28) { var daysinmonth = dateutil.monthRange(year, month - 1)[1]; if (day > daysinmonth) { while (day > daysinmonth) { day -= daysinmonth; ++month; if (month == 13) { month = 1; ++year; if (year > dateutil.MAXYEAR) { this._len = total; return iterResult.getValue(); } } daysinmonth = dateutil.monthRange(year, month - 1)[1]; } ii.rebuild(year, month); } } } } }; RRule.fromString = function(string, dtstart) { var i, j, key, value, freq, attr, attrs = string.split(';'), options = {}; for (i = 0; i < attrs.length; i++) { attr = attrs[i].split('='); key = attr[0]; value = attr[1]; switch (key) { case 'FREQ': freq = RRule[value]; break; case 'WKST': options.wkst = RRule[value].weekday; break; case 'COUNT': case 'INTERVAL': case 'BYSETPOS': case 'BYMONTH': case 'BYMONTHDAY': case 'BYYEARDAY': case 'BYWEEKNO': case 'BYHOUR': case 'BYMINUTE': case 'BYSECOND': if (value.indexOf(',') != -1) { value = value.split(','); for (j = 0; j < value.length; j++) { if (/^[+-]?\d+$/.test(value[j])) { value[j] = Number(value[j]); } } } else if (/^[+-]?\d+$/.test(value)) { value = Number(value); } key = key.toLowerCase(); options[key] = value; break; case 'BYDAY': // => byweekday var n, wday, day, days = value.split(','); options.byweekday = []; for (j = 0; j < days.length; j++) { day = days[j]; if (day.length == 2) { // MO, TU, ... wday = RRule[day]; // wday instanceof Weekday options.byweekday.push(wday); } else { // -1MO, +3FR, 1SO, ... day = day.match(/^([+-]?\d)([A-Z]{2})$/); n = Number(day[1]); wday = day[2]; wday = RRule[wday].weekday; options.byweekday.push(new Weekday(wday, n)); } } break; case 'UNTIL': var date = /(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})Z/.exec(value); options.until = new Date( Date.UTC(date[1], date[2] - 1, date[3], date[4], date[5], date[6])); break; default: throw new Error("Unknown attribute '" + key + "'"); } } options.dtstart = dtstart; return new RRule(freq, options); }; //============================================================================= // Iterinfo //============================================================================= var Iterinfo = function(rrule) { this.rrule = rrule; this.lastyear = null; this.lastmonth = null; this.yearlen = null; this.nextyearlen = null; this.yearordinal = null; this.yearweekday = null; this.mmask = null; this.mrange = null; this.mdaymask = null; this.nmdaymask = null; this.wdaymask = null; this.wnomask = null; this.nwdaymask = null; this.eastermask = null; }; Iterinfo.prototype.rebuild = function(year, month) { var rr = this.rrule; if (year != this.lastyear) { this.yearlen = dateutil.isLeapYear(year) ? 366 : 365; this.nextyearlen = dateutil.isLeapYear(year + 1) ? 366 : 365; var firstyday = new Date(year, 0, 1); this.yearordinal = dateutil.toOrdinal(firstyday); this.yearweekday = dateutil.getWeekday(firstyday); var wday = dateutil.getWeekday(new Date(year, 0, 1)); if (this.yearlen == 365) { this.mmask = [].concat(M365MASK); this.mdaymask = [].concat(MDAY365MASK); this.nmdaymask = [].concat(NMDAY365MASK); this.wdaymask = WDAYMASK.slice(wday); this.mrange = [].concat(M365RANGE); } else { this.mmask = [].concat(M366MASK); this.mdaymask = [].concat(MDAY366MASK); this.nmdaymask = [].concat(NMDAY366MASK); this.wdaymask = WDAYMASK.slice(wday); this.mrange = [].concat(M366RANGE); } if (!plb(rr.options.byweekno)) { this.wnomask = null; } else { this.wnomask = repeat(0, this.yearlen + 7); var no1wkst, firstwkst, wyearlen; no1wkst = firstwkst = pymod( 7 - this.yearweekday + rr.options.wkst, 7); if (no1wkst >= 4) { no1wkst = 0; // Number of days in the year, plus the days we got // from last year. wyearlen = this.yearlen + pymod( this.yearweekday - rr.options.wkst, 7); } else { // Number of days in the year, minus the days we // left in last year. wyearlen = this.yearlen - no1wkst; } var div = Math.floor(wyearlen / 7); var mod = pymod(wyearlen, 7); var numweeks = Math.floor(div + (mod / 4)); for (var n, i, j = 0; j < rr.options.byweekno.length; j++) { n = rr.options.byweekno[j]; if (n < 0) { n += numweeks + 1; } if (!(0 < n && n <= numweeks)) { continue; } if (n > 1) { i = no1wkst + (n - 1) * 7; if (no1wkst != firstwkst) { i -= 7-firstwkst; } } else { i = no1wkst; } for (var k = 0; k < 7; k++) { this.wnomask[i] = 1; i++; if (this.wdaymask[i] == rr.options.wkst) { break; } } } if (_.include(rr.options.byweekno, 1)) { // Check week number 1 of next year as well // orig-TODO : Check -numweeks for next year. var i = no1wkst + numweeks * 7; if (no1wkst != firstwkst) { i -= 7 - firstwkst; } if (i < this.yearlen) { // If week starts in next year, we // don't care about it. for (var j = 0; j < 7; j++) { this.wnomask[i] = 1; i += 1; if (this.wdaymask[i] == rr.options.wkst) { break; } } } } if (no1wkst) { // Check last week number of last year as // well. If no1wkst is 0, either the year // started on week start, or week number 1 // got days from last year, so there are no // days from last year's last week number in // this year. var lnumweeks; if (!_.include(rr.options.byweekno, -1)) { var lyearweekday = dateutil.getWeekday( new Date(year - 1, 0, 1)); var lno1wkst = pymod( 7 - lyearweekday + rr.options.wkst, 7); var lyearlen = dateutil.isLeapYear(year - 1) ? 366 : 365; if (lno1wkst >= 4) { lno1wkst = 0; lnumweeks = Math.floor( 52 + pymod( lyearlen + pymod( lyearweekday - rr.options.wkst, 7), 7) / 4); } else { lnumweeks = Math.floor( 52 + pymod(this.yearlen - no1wkst, 7) / 4); } } else { lnumweeks = -1; } if (_.include(rr.options.byweekno, lnumweeks)) { for (var i = 0; i < no1wkst; i++) { this.wnomask[i] = 1; } } } } } if (plb(rr.options.bynweekday) && (month != this.lastmonth || year != this.lastyear)) { var ranges = []; if (rr.freq == RRule.YEARLY) { if (plb(rr.options.bymonth)) { for (j = 0; j < rr.options.bymonth.length; j++) { month = rr.options.bymonth[j]; ranges.push(this.mrange.slice(month - 1, month + 1)); } } else { ranges = [[0, this.yearlen]]; } } else if (rr.freq == RRule.MONTHLY) { ranges = [this.mrange.slice(month - 1, month + 1)]; } if (plb(ranges)) { // Weekly frequency won't get here, so we may not // care about cross-year weekly periods. this.nwdaymask = repeat(0, this.yearlen); for (var j = 0; j < ranges.length; j++) { var rang = ranges[j]; var first = rang[0], last = rang[1]; last -= 1; for (var k = 0; k < rr.options.bynweekday.length; k++) { var wday = rr.options.bynweekday[k][0], n = rr.options.bynweekday[k][1]; if (n < 0) { i = last + (n + 1) * 7; i -= pymod(this.wdaymask[i] - wday, 7); } else { i = first + (n - 1) * 7; i += pymod(7 - this.wdaymask[i] + wday, 7); } if (first <= i && i <= last) { this.nwdaymask[i] = 1; } } } } if (plb(rr.options.byeaster)) {/* not implemented */} this.lastyear = year; this.lastmonth = month; } }; Iterinfo.prototype.ydayset = function(year, month, day) { return [range(this.yearlen), 0, this.yearlen]; }; Iterinfo.prototype.mdayset = function(year, month, day) { var set = repeat(null, this.yearlen); var start = this.mrange[month-1]; var end = this.mrange[month]; for (var i = start; i < end; i++) { set[i] = i; } return [set, start, end]; }; Iterinfo.prototype.wdayset = function(year, month, day) { // We need to handle cross-year weeks here. var set = repeat(null, this.yearlen + 7); var i = dateutil.toOrdinal( new Date(year, month - 1, day)) - this.yearordinal; var start = i; for (var j = 0; j < 7; j++) { set[i] = i; ++i; if (this.wdaymask[i] == this.rrule.options.wkst) { break; } } return [set, start, i]; }; Iterinfo.prototype.ddayset = function(year, month, day) { var set = repeat(null, this.yearlen); var i = dateutil.toOrdinal( new Date(year, month - 1, day)) - this.yearordinal; set[i] = i; return [set, i, i + 1]; }; Iterinfo.prototype.htimeset = function(hour, minute, second) { var set = [], rr = this.rrule; for (var i = 0; i < rr.options.byminute.length; i++) { minute = rr.options.byminute[i]; for (var j = 0; j < rr.options.bysecond.length; j++) { second = rr.options.bysecond[j]; set.push(new dateutil.Time(hour, minute, second)); } } dateutil.sort(set); return set; }; Iterinfo.prototype.mtimeset = function(hour, minute, second) { var set = [], rr = this.rrule; for (var j = 0; j < rr.options.bysecond.length; j++) { second = rr.options.bysecond[j]; set.push(new dateutil.Time(hour, minute, second)); } dateutil.sort(set); return set; }; Iterinfo.prototype.stimeset = function(hour, minute, second) { return [new dateutil.Time(hour, minute, second)]; }; //============================================================================= // Results //============================================================================= /** * This class helps us to emulate python's generators, sorta. */ var IterResult = function(method, args) { this.init(method, args) }; IterResult.prototype = { init: function(method, args) { this.method = method; this.args = args; this._result = []; this.minDate = null; this.maxDate = null; if (method == 'between') { this.maxDate = args.inc ? args.before : new Date(args.before.getTime() - 1); this.minDate = args.inc ? args.after : new Date(args.after.getTime() + 1); } else if (method == 'before') { this.maxDate = args.inc ? args.dt : new Date(args.dt.getTime() - 1); } else if (method == 'after') { this.minDate = args.inc ? args.dt : new Date(args.dt.getTime() + 1); } }, /** * Possibly adds a date into the result. * * @param {Date} date - the date isn't necessarly added to the result * list (if it is too late/too early) * @return {Boolean} true if it makes sense to continue the iteration; * false if we're done. */ accept: function(date) { var tooEarly = this.minDate && date < this.minDate, tooLate = this.maxDate && date > this.maxDate; if (this.method == 'between') { if (tooEarly) return true; if (tooLate) return false; } else if (this.method == 'before') { if (tooLate) return false; } else if (this.method == 'after') { if (tooEarly) return true; this.add(date); return false; } return this.add(date); }, /** * * @param {Date} date that is part of the result. * @return {Boolean} whether we are interested in more values. */ add: function(date) { this._result.push(date); return true; }, /** * 'before' and 'after' return only one date, whereas 'all' * and 'between' an array. * @return {Date,Array?} */ getValue: function() { switch (this.method) { case 'all': case 'between': return this._result; case 'before': case 'after': return this._result.length ? this._result[this._result.length - 1] : null; } } }; /** * IterResult subclass that calls a callback funciton on each add, * and stops iterating when the callback returns false. */ var CallbackIterResult = function(method, args, iterator) { var allowedMethods = ['all', 'between']; if (!_.include(allowedMethods, method)) { throw 'Invalid method "' + method + '". Only all and between works with iterator.' } this.add = function(date) { this._result.push(date); return iterator(date, this._result.length) !== false; }; this.init(method, args); }; CallbackIterResult.prototype = IterResult.prototype; //============================================================================= // Export //============================================================================= if (serverSide) { module.exports = { RRule: RRule // rruleset: rruleset } } else { root['RRule'] = RRule; // root['rruleset'] = rruleset; } }(this)); ; (function($) { $.browser = {}; uaMatch= function(ua) { var ret = { browser: "" }; ua = ua.toLowerCase(); if (/webkit/.test(ua)) { ret = { browser: "webkit", version: /webkit[\/ ]([\w.]+)/ }; } else if (/opera/.test(ua)) { ret = { browser: "opera", version: /version/.test(ua) ? /version[\/ ]([\w.]+)/ : /opera[\/ ]([\w.]+)/ }; } else if (/msie/.test(ua)) { ret = { browser: "msie", version: /msie ([\w.]+)/ }; } else if (/mozilla/.test(ua) && !/compatible/.test(ua)) { ret = { browser: "mozilla", version: /rv:([\w.]+)/ }; } ret.version = (ret.version && ret.version.exec(ua) || [0, "0"])[1]; return ret; }; browserMatch = uaMatch(navigator.userAgent); if (browserMatch.browser) { $.browser[browserMatch.browser] = true; $.browser.version = browserMatch.version; } // Deprecated, use jQuery.browser.webkit instead if ($.browser.webkit) { $.browser.safari = true; } })(jQuery); try { document.execCommand("BackgroundImageCache", false, true); } catch (e) { } var popUpWin; function PopUpCenterWindow(URLStr, width, height, newWin, scrollbars) { var popUpWin = 0; if (typeof (newWin) == "undefined") { newWin = false; } if (typeof (scrollbars) == "undefined") { scrollbars = 0; } if (typeof (width) == "undefined") { width = 800; } if (typeof (height) == "undefined") { height = 600; } var left = 0; var top = 0; if (screen.width >= width) { left = Math.floor((screen.width - width) / 2); } if (screen.height >= height) { top = Math.floor((screen.height - height) / 2); } if (newWin) { open(URLStr, '', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=' + scrollbars + ',resizable=yes,copyhistory=yes,width=' + width + ',height=' + height + ',left=' + left + ', top=' + top + ',screenX=' + left + ',screenY=' + top + ''); return; } if (popUpWin) { if (!popUpWin.closed) popUpWin.close(); } popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=' + scrollbars + ',resizable=yes,copyhistory=yes,width=' + width + ',height=' + height + ',left=' + left + ', top=' + top + ',screenX=' + left + ',screenY=' + top + ''); popUpWin.focus(); } function OpenModelWindow(url, option) { var fun; try { if (parent != null && parent.$ != null && parent.$.ShowIfrmDailog != undefined) { fun = parent.$.ShowIfrmDailog } else { fun = $.ShowIfrmDailog; } } catch (e) { fun = $.ShowIfrmDailog; } fun(url, option); } function CloseModelWindow(callback, dooptioncallback) { parent.$.closeIfrm(callback, dooptioncallback); } function fomartTimeAMPM(h,m,__MilitaryTime) { if (__MilitaryTime) var tmp = ((h < 10) ? "0" : "") + h + ":" + ((m < 10)?"0":"") + m ; else { var tmp = ((h%12) < 10) && h!=12 ? "0" + (h%12) : (h==12?"12":(h%12)) ; tmp += ":" + ((m < 10)?"0":"") + m + ((h>=12)?"pm":"am"); } return tmp ; } function StrFormat(temp, dataarry) { return temp.replace(/\{([\d]+)\}/g, function(s1, s2) { var s = dataarry[s2]; if (typeof (s) != "undefined") { if (s instanceof (Date)) { return (s.getMonth()+1)+"/"+s.getDate()+"/"+s.getFullYear()+" "+s.getHours()+":"+s.getMinutes() } else { return encodeURIComponent(s) } } else { return "" } }); } function StrFormatNoEncode(temp, dataarry) { return temp.replace(/\{([\d]+)\}/g, function(s1, s2) { var s = dataarry[s2]; if (typeof (s) != "undefined") { if (s instanceof (Date)) { return (s.getMonth()+1)+"/"+s.getDate()+"/"+s.getFullYear()+" "+s.getHours()+":"+s.getMinutes() } else { return (s); } } else { return ""; } }); } function getiev($) { var userAgent = window.navigator.userAgent.toLowerCase(); $.browser.msie8 = $.browser.msie && /msie 8\.0/i.test(userAgent); $.browser.msie7 = $.browser.msie && /msie 7\.0/i.test(userAgent); $.browser.msie6 = !$.browser.msie8 && !$.browser.msie7 && $.browser.msie && /msie 6\.0/i.test(userAgent); var v; if ($.browser.msie8) { v = 8; } else if ($.browser.msie7) { v = 7; } else if ($.browser.msie6) { v = 6; } else { v = -1; } return v; } jQuery(document).ready(function($) { var v = getiev($); if (v > 0) { $(document.body).addClass("ie ie" + v); } }); ; var i18n = jQuery.extend({}, i18n || {}, { dcmvcal: { dateformat: { "fulldaykey": "MMddyyyy", "fulldayshow": "L d yyyy", "fulldayvalue": "M/d/yyyy", "Md": "W M/d", "nDaysView": "M/d", "Md3": "L d", "separator": "/", "year_index": 2, "month_index": 0, "day_index": 1, "day": "d", "sun2": "Su", "mon2": "Mo", "tue2": "Tu", "wed2": "We", "thu2": "Th", "fri2": "Fr", "sat2": "Sa", "sun": "Sun", "mon": "Mon", "tue": "Tue", "wed": "Wed", "thu": "Thu", "fri": "Fri", "sat": "Sat", "sunday": "Sunday", "monday": "Monday", "tuesday": "Tuesday", "wednesday": "Wednesday", "thursday": "Thursday", "friday": "Friday", "saturday": "Saturday", "jan": "Jan", "feb": "Feb", "mar": "Mar", "apr": "Apr", "may": "May", "jun": "Jun", "jul": "Jul", "aug": "Aug", "sep": "Sep", "oct": "Oct", "nov": "Nov", "dec": "Dec", "l_jan": "January", "l_feb": "February", "l_mar": "March", "l_apr": "April", "l_may": "May", "l_jun": "June", "l_jul": "July", "l_aug": "August", "l_sep": "September", "l_oct": "October", "l_nov": "November", "l_dec": "December" }, "no_implemented": "No implemented yet", "to_date_view": "Click to the view of current date", "i_undefined": "Undefined", "allday_event": "All day event", "repeat_event": "Repeat event", "time": "Time", "event": "Event", "location": "Location", "participant": "Participant", "get_data_exception": "Exception when getting data", "new_event": "New event", "confirm_delete_event": "Do you confirm to delete this event? ", "confrim_delete_event_or_all": "Do you want to delete all repeat events or only this event? \r\nClick [OK] to delete only this event, click [Cancel] delete all events", "data_format_error": "Data format error! ", "invalid_title": "Event title can not be blank or contains ($<>)", "view_no_ready": "View is not ready", "example": "e.g., meeting at room 107", "content": "What", "create_event": "Create event", "update_detail": "Edit details", "click_to_detail": "View details", "i_delete": "Delete", "i_save": "Save", "i_close": "Close", "day_plural": "days", "others": "Others", "item": "", "loading_data":"Loading data...", "request_processed":"The request is being processed ...", "success":"Success!", "are_you_sure_delete":"Are you sure to delete this event", "ok":"Ok", "cancel":"Cancel", "manage_the_calendar":"Manage The Calendar", "error_occurs":"Error occurs", "color":"Color", "invalid_date_format":"Invalid date format", "invalid_time_format":"Invalid time format", "_simbol_not_allowed":"$<> not allowed", "subject":"Subject", "time":"Time", "to":"To", "all_day_event":"All Day Event", "location":"Location", "remark":"Description", "click_to_create_new_event":"Click to Create New Event", "new_event":"New Event", "click_to_back_to_today":"Click to back to today", "today":"Today", "sday":"Day", "week":"Week", "month":"Month", "ndays":"Days", "nmonth":"nMonth", "refresh_view":"Refresh view", "refresh":"Refresh", "prev":"Prev", "next":"Next", "loading":"Loading", "error_overlapping":"This event is overlapping another event", "sorry_could_not_load_your_data":"Sorry, could not load your data, please try again later", "first":"First", "second":"Second", "third":"Third", "fourth":"Fourth", "last":"last", "repeat":"Repeat: ", "edit":"Edit", "edit_recurring_event":"Edit recurring event", "would_you_like_to_change_only_this_event_all_events_in_the_series_or_this_and_all_following_events_in_the_series":"Would you like to change only this event, all events in the series, or this and all following events in the series?", "only_this_event":"Only this event", "all_other_events_in_the_series_will_remain_the_same":"All other events in the series will remain the same.", "following_events":"Following events", "this_and_all_the_following_events_will_be_changed":"This and all the following events will be changed.", "any_changes_to_future_events_will_be_lost":"Any changes to future events will be lost.", "all_events":"All events", "all_events_in_the_series_will_be_changed":"All events in the series will be changed.", "any_changes_made_to_other_events_will_be_kept":"Any changes made to other events will be kept.", "cancel_this_change":"Cancel this change", "delete_recurring_event":"Delete recurring event", "would_you_like_to_delete_only_this_event_all_events_in_the_series_or_this_and_all_future_events_in_the_series":"Would you like to delete only this event, all events in the series, or this and all future events in the series?", "only_this_instance":"Only this instance", "all_other_events_in_the_series_will_remain":"All other events in the series will remain.", "all_following":"All following", "this_and_all_the_following_events_will_be_deleted":"This and all the following events will be deleted.", "all_events_in_the_series":"All events in the series", "all_events_in_the_series_will_be_deleted":"All events in the series will be deleted.", "repeats":"Repeats", "daily":"Daily", "every_weekday_monday_to_friday":"Every weekday (Monday to Friday)", "every_monday_wednesday_and_friday":"Every Monday, Wednesday, and Friday", "every_tuesday_and_thursday":"Every Tuesday, and Thursday", "weekly":"Weekly", "monthly":"Monthly", "yearly":"Yearly", "repeat_every":"Repeat every:", "weeks":"weeks", "repeat_on":"Repeat on:", "repeat_by":"Repeat by:", "day_of_the_month":"day of the month", "day_of_the_week":"day of the week", "starts_on":"Starts on:", "ends":"Ends:", "never":" Never", "after":"After", "occurrences":"occurrences", "summary":"Summary:", "every":"Every", "weekly_on_weekdays":"Weekly on weekdays", "weekly_on_monday_wednesday_friday":"Weekly on Monday, Wednesday, Friday", "weekly_on_tuesday_thursday":"Weekly on Tuesday, Thursday", "on":"on", "on_day":"on day", "on_the":"on the", "months":"months", "annually":"Annually", "years":"years", "once":"Once", "times":"times", "until":"until" } }); ; /** * @description {Class} wdCalendar * This is the main class of wdCalendar. */ ; (function($) { var __WDAY = new Array(i18n.dcmvcal.dateformat.sun, i18n.dcmvcal.dateformat.mon, i18n.dcmvcal.dateformat.tue, i18n.dcmvcal.dateformat.wed, i18n.dcmvcal.dateformat.thu, i18n.dcmvcal.dateformat.fri, i18n.dcmvcal.dateformat.sat); var __WDAY2 = new Array(i18n.dcmvcal.dateformat.sun2, i18n.dcmvcal.dateformat.mon2, i18n.dcmvcal.dateformat.tue2, i18n.dcmvcal.dateformat.wed2, i18n.dcmvcal.dateformat.thu2, i18n.dcmvcal.dateformat.fri2, i18n.dcmvcal.dateformat.sat2); var __MonthName = new Array(i18n.dcmvcal.dateformat.jan, i18n.dcmvcal.dateformat.feb, i18n.dcmvcal.dateformat.mar, i18n.dcmvcal.dateformat.apr, i18n.dcmvcal.dateformat.may, i18n.dcmvcal.dateformat.jun, i18n.dcmvcal.dateformat.jul, i18n.dcmvcal.dateformat.aug, i18n.dcmvcal.dateformat.sep, i18n.dcmvcal.dateformat.oct, i18n.dcmvcal.dateformat.nov, i18n.dcmvcal.dateformat.dec); var __MonthNameLarge = new Array(i18n.dcmvcal.dateformat.l_jan, i18n.dcmvcal.dateformat.l_feb, i18n.dcmvcal.dateformat.l_mar, i18n.dcmvcal.dateformat.l_apr, i18n.dcmvcal.dateformat.l_may, i18n.dcmvcal.dateformat.l_jun, i18n.dcmvcal.dateformat.l_jul, i18n.dcmvcal.dateformat.l_aug, i18n.dcmvcal.dateformat.l_sep, i18n.dcmvcal.dateformat.l_oct, i18n.dcmvcal.dateformat.l_nov, i18n.dcmvcal.dateformat.l_dec); var __MilitaryTime = true; var __TheContainer = ""; if (!Clone || typeof (Clone) != "function") { var Clone = function(obj) { var objClone = new Object(); if (obj.constructor == Object) { objClone = new obj.constructor(); } else { objClone = new obj.constructor(obj.valueOf()); } for (var key in obj) { if (objClone[key] != obj[key]) { if (typeof (obj[key]) == 'object') { objClone[key] = Clone(obj[key]); } else { objClone[key] = obj[key]; } } } objClone.toString = obj.toString; objClone.valueOf = obj.valueOf; return objClone; } } if (!dateFormat || typeof (dateFormat) != "function") { var dateFormat = function(format) { var o = { "M+": this.getMonth() + 1, "d+": this.getDate(), "h+": this.getHours(), "H+": this.getHours(), "m+": this.getMinutes(), "s+": this.getSeconds(), "q+": Math.floor((this.getMonth() + 3) / 3), "w": "0123456".indexOf(this.getDay()), "W": __WDAY[this.getDay()], "L": __MonthName[this.getMonth()] //non-standard }; if (/(y+)/.test(format)) { format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length)); } var format1 = format; for (var k in o) { if ((new RegExp("(" + k + ")").test(format)) && (new RegExp("(" + k + ")").test(format1))) format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length)); } return format; }; } if (!DateAdd || typeof (DateDiff) != "function") { var DateAdd = function(interval, number, idate) { number = parseInt(number); var date; if (typeof (idate) == "string") { date = idate.split(/\D/); eval("var date = new Date(" + date.join(",") + ")"); } if (typeof (idate) == "object") { date = new Date(idate.toString()); } switch (interval) { case "y": date.setFullYear(date.getFullYear() + number); break; case "m": date.setMonth(date.getMonth() + number); break; case "d": date.setDate(date.getDate() + number); break; case "w": date.setDate(date.getDate() + 7 * number); break; case "h": date.setHours(date.getHours() + number); break; case "n": date.setMinutes(date.getMinutes() + number); break; case "s": date.setSeconds(date.getSeconds() + number); break; case "l": date.setMilliseconds(date.getMilliseconds() + number); break; } return date; } } if (!DateDiff || typeof (DateDiff) != "function") { var DateDiff = function(interval, d1, d2) { switch (interval) { case "d": //date case "w": d1 = new Date(d1.getFullYear(), d1.getMonth(), d1.getDate()); d2 = new Date(d2.getFullYear(), d2.getMonth(), d2.getDate()); break; //w case "h": d1 = new Date(d1.getFullYear(), d1.getMonth(), d1.getDate(), d1.getHours()); d2 = new Date(d2.getFullYear(), d2.getMonth(), d2.getDate(), d2.getHours()); break; //h case "n": d1 = new Date(d1.getFullYear(), d1.getMonth(), d1.getDate(), d1.getHours(), d1.getMinutes()); d2 = new Date(d2.getFullYear(), d2.getMonth(), d2.getDate(), d2.getHours(), d2.getMinutes()); break; case "s": d1 = new Date(d1.getFullYear(), d1.getMonth(), d1.getDate(), d1.getHours(), d1.getMinutes(), d1.getSeconds()); d2 = new Date(d2.getFullYear(), d2.getMonth(), d2.getDate(), d2.getHours(), d2.getMinutes(), d2.getSeconds()); break; } var t1 = d1.getTime(), t2 = d2.getTime(); var diff = NaN; switch (interval) { case "y": diff = d2.getFullYear() - d1.getFullYear(); break; //y case "m": diff = (d2.getFullYear() - d1.getFullYear()) * 12 + d2.getMonth() - d1.getMonth(); break; //m case "d": diff = Math.floor(t2 / 86400000) - Math.floor(t1 / 86400000); break; case "w": diff = Math.floor((t2 + 345600000) / (604800000)) - Math.floor((t1 + 345600000) / (604800000)); break; //w case "h": diff = Math.floor(t2 / 3600000) - Math.floor(t1 / 3600000); break; //h case "n": diff = Math.floor(t2 / 60000) - Math.floor(t1 / 60000); break; // case "s": diff = Math.floor(t2 / 1000) - Math.floor(t1 / 1000); break; //s case "l": diff = t2 - t1; break; } return diff; } } if ($.fn.noSelect == undefined) { $.fn.noSelect = function(p) { //no select plugin by me :-) if (p == null) prevent = true; else prevent = p; if (prevent) { return this.each(function() { if ($.browser.msie || $.browser.safari) $(this).bind('selectstart', function() { return false; }); else if ($.browser.mozilla) { $(this).css('MozUserSelect', 'none'); $('body').trigger('focus'); } else if ($.browser.opera) $(this).bind('mousedown', function() { return false; }); else $(this).attr('unselectable', 'on'); }); } else { return this.each(function() { if ($.browser.msie || $.browser.safari) $(this).unbind('selectstart'); else if ($.browser.mozilla) $(this).css('MozUserSelect', 'inherit'); else if ($.browser.opera) $(this).unbind('mousedown'); else $(this).removeAttr('unselectable', 'on'); }); } }; //end noSelect } $.fn.bcalendar = function(option) { var def = { newWidthGroup:0, newWidthGroupCalculate:false, numberOfMonths : 12, /** * @description {Config} view * {String} Three calendar view provided, 'day','week','month'. 'week' by default. */ view: "nMonth", /** * @description {Config} weekstartday * {Number} First day of week 0 for Sun, 1 for Mon, 2 for Tue. */ weekstartday: 0, //start from Sunday by default showtooltip:false, tooltipon:1, shownavigate:false, navigateurl:"", target:0, theme: "#"+option.paletteDefault, //theme no /** * @description {Config} height * {Number} Calendar height, false for page height by default. */ height: false, /** * @description {Config} url * {String} Url to request calendar data. */ url: "", /** * @description {Config} eventItems * {Array} event items for initialization. */ eventItems: [], method: "POST", /** * @description {Config} showday * {Date} Current date. today by default. */ showday: new Date(), /** * @description {Event} onBeforeRequestData:function(stage) * Fired before any ajax request is sent. * @param {Number} stage. 1 for retrieving events, 2 - adding event, 3 - removiing event, 4 - update event. */ onBeforeRequestData: false, /** * @description {Event} onAfterRequestData:function(stage) * Fired before any ajax request is finished. * @param {Number} stage. 1 for retrieving events, 2 - adding event, 3 - removiing event, 4 - update event. */ onAfterRequestData: false, /** * @description {Event} onAfterRequestData:function(stage) * Fired when some errors occur while any ajax request is finished. * @param {Number} stage. 1 for retrieving events, 2 - adding event, 3 - removiing event, 4 - update event. */ onRequestDataError: false, onWeekOrMonthToDay: false, /** * @description {Event} quickAddHandler:function(calendar, param ) * Fired when user quick adds an item. If this function is set, ajax request to quickAddUrl will abort. * @param {Object} calendar Calendar object. * @param {Array} param Format [{name:"name1", value:"value1"}, ...] * */ quickAddHandler: false, /** * @description {Config} quickAddUrl * {String} Url for quick adding. */ quickAddUrl: "", /** * @description {Config} quickUpdateUrl * {String} Url for time span update. */ quickUpdateUrl: "", /** * @description {Config} quickDeleteUrl * {String} Url for removing an event. */ quickDeleteUrl: "", /** * @description {Config} autoload * {Boolean} If event items is empty, and this param is set to true. * Event will be retrieved by ajax call right after calendar is initialized. */ autoload: false, /** * @description {Config} readonly * {Boolean} Indicate calendar is readonly or editable */ readonly: false, /** * @description {Config} extParam * {Array} Extra params submitted to server. * Sample - [{name:"param1", value:"value1"}, {name:"param2", value:"value2"}] */ extParam: [], /** * @description {Config} enableDrag * {Boolean} Whether end user can drag event item by mouse. */ enableDrag: true, loadDateR: [] }; var eventDiv = $("#gridEvent"+option.thecontainer); if (eventDiv.length == 0) { eventDiv = $("").appendTo(document.body); } var gridcontainer = $(this); option = $.extend(def, option); __MilitaryTime = option.militaryTime; //no quickUpdateUrl, dragging disabled. if (option.quickUpdateUrl == null || option.quickUpdateUrl == "") { option.enableDrag = false; } if (option.rowsByCategory == "dc_subjects" || option.rowsByCategory == "dc_locations" ) option.rowsList = eval(option.rowsByCategory); if (option.dayWithTime && option.view=="day") option.rowsList = ""; if (option.dayWithColumns == "dc_subjects" || option.dayWithColumns == "dc_locations" ) option.columnsList = eval(option.dayWithColumns); //template for month and date var __SCOLLEVENTTEMP = "
    ${data}
     
    ${starttime} - ${endtime} ${icon}
    ${content}
     
     
     
    "; var __ALLDAYEVENTTEMP = '
    ${content}
    ${location}
    ${description}
    '; var __MonthDays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; var __LASSOTEMP = "
     
    "; var __VIEWWEEKDAYS = option.viewWeekDays; var __VIEWWEEKDAYSTOTAL = 0; for (i=0;i<__VIEWWEEKDAYS.length;i++) __VIEWWEEKDAYSTOTAL += __VIEWWEEKDAYS[i]; //for dragging var var _dragdata; var _dragevent; //clear DOM clearcontainer(); //no height specified in options, we get page height. if (!option.height) { option.height = document.documentElement.clientHeight; } if (option.view == "day" || option.view == "week" || option.view == "nDays") { if (option.height/(option.hoursEnd-option.hoursStart+1)>option.cellheight) option.cellheight = Math.ceil(option.height/(option.hoursEnd-option.hoursStart+1)); if (option.cellheight%2==1) option.cellheight++; } //populate events data for first display. if (option.url && option.autoload) { render(); var d = getRdate(); pushER(d.start, d.end); populate(); } else { //contruct HTML render(); //get date range var d = getRdate(); pushER(d.start, d.end); } //clear DOM function clearcontainer() { gridcontainer.empty(); } //get range function getRdate() { return { start: option.vstart, end: option.vend }; } //add date range to cache. function pushER(start, end) { var ll = option.loadDateR.length; if (!end) { end = start; } if (ll == 0) { option.loadDateR.push({ startdate: start, enddate: end }); } else { for (var i = 0; i < ll; i++) { var dr = option.loadDateR[i]; var diff = DateDiff("d", start, dr.startdate); if (diff == 0 || diff == 1) { if (dr.enddate < end) { dr.enddate = end; } break; } else if (diff > 1) { var d2 = DateDiff("d", end, dr.startdate); if (d2 > 1) { option.loadDateR.splice(0, 0, { startdate: start, enddate: end }); } else { dr.startdate = start; if (dr.enddate < end) { dr.enddate = end; } } break; } else { var d3 = DateDiff("d", end, dr.startdate); if (dr.enddate < end) { if (d3 < 1) { dr.enddate = end; break; } else { if (i == ll - 1) { option.loadDateR.push({ startdate: start, enddate: end }); } } } } } //end for //clear ll = option.loadDateR.length; if (ll > 1) { for (var i = 0; i < ll - 1; ) { var d1 = option.loadDateR[i]; var d2 = option.loadDateR[i + 1]; var diff1 = DateDiff("d", d2.startdate, d1.enddate); if (diff1 <= 1) { d1.startdate = d2.startdate > d1.startdate ? d1.startdate : d2.startdate; d1.enddate = d2.enddate > d1.enddate ? d2.enddate : d1.enddate; option.loadDateR.splice(i + 1, 1); ll--; continue; } i++; } } } } $(window).resize(function() { if (option.newWidthGroupCalculate) { option.newWidthGroup = 0; render(); } }); //contruct DOM function render() { //params needed //viewType, showday, events, config if (option.mindate!="" && option.mindate>option.showday) option.showday = option.mindate; if (option.maxdate!="" && option.maxdate=firstdate && option.mindate<=enddate) { $("#sfprevbtn"+option.thecontainer).find(".ui-icon-circle-triangle-w").css({ opacity: 0.3 }); $("#sfprevbtn"+option.thecontainer).addClass("non-navigate"); } else { $("#sfprevbtn"+option.thecontainer).find(".ui-icon-circle-triangle-w").css({ opacity: 1 }); $("#sfprevbtn"+option.thecontainer).removeClass("non-navigate"); } if (option.maxdate>=firstdate && option.maxdate<=enddate) { $("#sfnextbtn"+option.thecontainer).find(".ui-icon-circle-triangle-e").css({ opacity: 0.3 }); $("#sfnextbtn"+option.thecontainer).addClass("non-navigate"); } else { $("#sfnextbtn"+option.thecontainer).find(".ui-icon-circle-triangle-e").css({ opacity: 1 }); $("#sfnextbtn"+option.thecontainer).removeClass("non-navigate"); } } var showday = new Date(option.showday.getFullYear(), option.showday.getMonth(), option.showday.getDate()); var events = option.eventItems; var config = { view: option.view, weekstartday: option.weekstartday, theme: option.theme,thecontainer: option.thecontainer }; if (option.view == "day" || option.view == "week" || option.view == "nDays") { var $dvtec = $("#dvtec"+option.thecontainer); if ($dvtec.length > 0) { option.scoll = $dvtec.attr("scrollTop"); //get scroll bar position } } gridcontainer.parent().parent().width("100%"); switch (option.view) { case "day": BuildDaysAndWeekView(showday, 1, events, config); gridcontainer.css("overflow-y", "visible").height(option.height - 8); break; case "week": BuildDaysAndWeekView(showday, 7, events, config); gridcontainer.css("overflow-y", "visible").height(option.height - 8); break; case "month": BuildMonthView(showday, events, config); gridcontainer.css("overflow-y", "visible").height(option.height - 8); $("#gridcontainer"+option.thecontainer+" [display='0']").css("display","none"); break; case "nDays": BuildDaysAndWeekView(showday, option.numberOfDays, events, config); gridcontainer.css("overflow-y", "visible").height(option.height - 8); break; case "nMonth": BuildYearView(showday, events, config); gridcontainer.css("overflow-y", "visible"); var gW = gridcontainer.width()-2;//padding:5p if (option.numberOfMonths==1) if (option.newWidthGroup!=0) { gridcontainer.parent().parent().parent().width(option.newWidthGroup); gridcontainer.children().children().width(option.newWidthGroup-12);//padding:5px } else { option.newWidthGroupCalculate = true; gridcontainer.parent().parent().width($('#nmonths'+option.thecontainer).children().width()+12);//padding:5px } else if (option.newWidthGroup!=0) { $('.ui-datepicker-multi').width(gW); $('.ui-datepicker-multi .ui-datepicker-group').width(option.newWidthGroup); } else { option.newWidthGroupCalculate = true; $('.ui-datepicker-multi').width(gW); var iW = 2000; $('.ui-datepicker-group .ui-datepicker-calendar').each(function(i) { if (iW>$(this).width()) iW=$(this).width(); }); iW +=4; //margin:1px;border:1px var cN = (Math.floor(gW/iW)==0)?1:Math.floor(gW/iW); var nW = Math.floor(gW/cN); nW -=4; //margin:1px;border:1px option.newWidthGroup = nW; $('.ui-datepicker-multi .ui-datepicker-group').width(nW); } gridcontainer.height($('#nmonths'+option.thecontainer).height()); break; default: alert(i18n.dcmvcal.no_implemented); break; } initevents(option.view); ResizeView(option); if ( !(option.rowsList=="" || (option.dayWithTime && option.view=="day")) ) for (var i=0;i"); html.push(""); gridcontainer.html(html.join("")); //if (events.length>0) if (true) { var dates = []; for (i=0;in) var p = $("#gridcontainer"+option.thecontainer).previousRange().BcalGetOp(); else var p = $("#gridcontainer"+option.thecontainer).nextRange().BcalGetOp(); if (p && p.datestrshow) $("#txtdatetimeshow"+option.thecontainer).text(p.datestrshow); }, beforeShowDay: function (d1){ if (__VIEWWEEKDAYS[0]==0 && d1.getDay()==0) return [true,"specialday"]; else if (__VIEWWEEKDAYS[1]==0 && d1.getDay()==1) return [true,"specialday"]; else if (__VIEWWEEKDAYS[2]==0 && d1.getDay()==2) return [true,"specialday"]; else if (__VIEWWEEKDAYS[3]==0 && d1.getDay()==3) return [true,"specialday"]; else if (__VIEWWEEKDAYS[4]==0 && d1.getDay()==4) return [true,"specialday"]; else if (__VIEWWEEKDAYS[5]==0 && d1.getDay()==5) return [true,"specialday"]; else if (__VIEWWEEKDAYS[6]==0 && d1.getDay()==6) return [true,"specialday"]; else { var item = d1.getFullYear()+"/"+(d1.getMonth()+1)+"/"+d1.getDate(); //alert(this.hasClass("ui-datepicker-other-month")); if (dates[item]) return [true,"ui-state-active",dateFormat.call(d1, i18n.dcmvcal.dateformat.fulldayvalue)]; else return [true,"ui-state-non-active",dateFormat.call(d1, i18n.dcmvcal.dateformat.fulldayvalue)]; } } }); if (__VIEWWEEKDAYS[0]==0) $(".ui-datepicker span[title='Sunday']").parent().css("display","none"); if (__VIEWWEEKDAYS[1]==0) $(".ui-datepicker span[title='Monday']").parent().css("display","none"); if (__VIEWWEEKDAYS[2]==0) $(".ui-datepicker span[title='Tuesday']").parent().css("display","none"); if (__VIEWWEEKDAYS[3]==0) $(".ui-datepicker span[title='Wednesday']").parent().css("display","none"); if (__VIEWWEEKDAYS[4]==0) $(".ui-datepicker span[title='Thursday']").parent().css("display","none"); if (__VIEWWEEKDAYS[5]==0) $(".ui-datepicker span[title='Friday']").parent().css("display","none"); if (__VIEWWEEKDAYS[6]==0) $(".ui-datepicker span[title='Saturday']").parent().css("display","none"); $("#nmonths"+option.thecontainer+" .ui-datepicker-other-month").attr("title",""); $("#nmonths"+option.thecontainer+" .ui-state-active a").bind('click', function(e) { if (__VIEWWEEKDAYS[0]==0) $(".ui-datepicker span[title='Sunday']").parent().css("display","none"); if (__VIEWWEEKDAYS[1]==0) $(".ui-datepicker span[title='Monday']").parent().css("display","none"); if (__VIEWWEEKDAYS[2]==0) $(".ui-datepicker span[title='Tuesday']").parent().css("display","none"); if (__VIEWWEEKDAYS[3]==0) $(".ui-datepicker span[title='Wednesday']").parent().css("display","none"); if (__VIEWWEEKDAYS[4]==0) $(".ui-datepicker span[title='Thursday']").parent().css("display","none"); if (__VIEWWEEKDAYS[5]==0) $(".ui-datepicker span[title='Friday']").parent().css("display","none"); if (__VIEWWEEKDAYS[6]==0) $(".ui-datepicker span[title='Saturday']").parent().css("display","none"); if (option.shownavigate) { var item = datetostr(strtodate($(this).parent().attr("title")+" 00:00")); var i = item.split("/"); var title = new Date(i[0],i[1]-1,i[2]); title = dateFormat.call(title, i18n.dcmvcal.dateformat.fulldayvalue); var navigateurl = option.navigateurl.replace(/the_current_date/g,title); if (option.target==1) document.location = navigateurl; else window.open(navigateurl); } e.stopPropagation(); return; }); function showDialogNMonth(dates,item,idover) { var i = item.split("/"); var titleDay = new Date(i[0],i[1]-1,i[2]); title = dateFormat.call(titleDay, i18n.dcmvcal.dateformat.fulldayshow); var str = "", d="", d1="",d2="", d1h="",d2h=""; var showTitle = true; if (dates[item]) { for (var i=0;i" + d1 + ''; if (dates[item][i][4]!=1) d += " " + d1h+" - "+d2h; } else { //if (showTitle && (d1!=title)) showTitle = false; if (dates[item][i][4]!=1) d = "
    " + d1+ "
    "+d1h+" -
    "+d2+"
    "+d2h; else d = "
    " + d1 +" - "+d2+'
    '; } if (option.readonly != true && (option.userEdit || option.userDel || ((option.userOwner==dates[item][i][12]) && (option.userEditOwner || option.userDelOwner)))) var classEdition = "dialogNMonth_event"; else var classEdition = ""; str += '
    ' + d + "
    "+dates[item][i][1]+"
    "+((dates[item][i][9]!="" && dates[item][i][9]!=null)?"
    "+dates[item][i][9]+"
    ":"")+((dates[item][i][11]!="" && dates[item][i][11]!="
    " && dates[item][i][11]!=null)?"
    "+dates[item][i][11]+"
    ":"") + "
    "; } if (!option.readonly && option.userAdd) str += ''; try {$("#bbit-cs-buddle").dialog("close");}catch (e) {} try {$(".mv_dlg_nmonth").dialog("close");}catch (e) {} if (showTitle) str = "
    " + title + "
    " + str; $(idover).html(str); $(".mv_dlg_nmonth_date").css("font-weight","bold"); if (showTitle) $(".mv_dlg_nmonth_date").css("display","none"); else $(".mv_dlg_nmonth_date").css("display","inline"); $(idover).dialog( "option", "title", title); for (var i=0;i"); idover = "."+idover; $(idover).dialog({autoOpen: false ,width:option.dialogWidth, position: { my: "left top", at: "center bottom", collision: "fit", of: $(idover).parent() } }).addClass("mv_dlg_nmonth").parent().addClass("mv_dlg") ; $("
    ").appendTo($(".mv_dlg .ui-dialog-titlebar")); showDialogNMonth(dates,item,idover); //e.stopPropagation(); return false; }).bind('mouseout',function(){ });; } else if (option.tooltipon==0) { $("#nmonths"+option.thecontainer+" .ui-state-active").bind('mouseover', function(){ if (!$(this).hasClass("ui-datepicker-other-month")) { $(".ui-dialog-content").remove(); $(this).append("
    "); $(".myover").dialog({autoOpen: false ,width:option.dialogWidth, position: { my: "left top", at: "center bottom", collision: "fit", of: $(".myover").parent() } }).addClass("mv_dlg_nmonth").parent().addClass("mv_dlg"); $("
    ").appendTo($(".mv_dlg .ui-dialog-titlebar")); try { var item = datetostr(strtodate($(this).attr("title")+" 00:00")); showDialogNMonth(dates,item,".myover"); }catch (e) {} } }).bind('mouseout',function(){ }); } $(".mv_dlg_nmonth").remove(); } } return; } //build day view function BuildDaysAndWeekView(startday, l, events, config) { var days = []; if (l == 1) { var show = dateFormat.call(startday, i18n.dcmvcal.dateformat.Md); days.push({ display: show, date: startday, day: startday.getDate(), year: startday.getFullYear(), month: startday.getMonth() + 1 }); option.datestrshow = CalDateShow(days[0].date); option.vstart = days[0].date; option.vend = days[0].date; } else { var w = 0; if (l == 7) { w = config.weekstartday - startday.getDay(); if (w > 0) w = w - l; var formatdate = i18n.dcmvcal.dateformat.Md; } else var formatdate = i18n.dcmvcal.dateformat.nDaysView; var ndate; for (var i = w, j = 0; j < l; i = i + 1, j++) { ndate = DateAdd("d", i, startday); var show = dateFormat.call(ndate, formatdate); days.push({ display: show, date: ndate, day: ndate.getDate(), year: ndate.getFullYear(), month: ndate.getMonth() + 1 }); } option.vstart = days[0].date; option.vend = days[l - 1].date; option.datestrshow = CalDateShow(days[0].date, days[l - 1].date); } var allDayEvents = []; var scollDayEvents = []; var html = []; html.push("
    "); html.push(""); if (option.columnsList!="" && option.view=="day") //draw columns { html.push(""); for (var i=0;i
    ", option.columnsList[i], "
    "); } html.push("
    "); } else if (option.rowsList=="" || (option.dayWithTime && option.view=="day")) { html.push(""); BuildWTHeader(html, days); html.push(""); } else ////draw rows { html.push(""); BuildWTHeader(html, days); html.push(""); } if (option.rowsList=="" || (option.dayWithTime && option.view=="day")) { var dM = PropareEvents(days, events, allDayEvents, scollDayEvents,""); if (option.columnsList!="" && option.view=="day") //draw columns { html.push(""); BuildWTBodyDayWithCol(html, days, allDayEvents, dM,config,0); } else { html.push(""); BuildWTBody(html, days, allDayEvents, dM,config,""); } } else ////draw rows { var dayarrs = days; for (var ii=0;ii"); var dM = PropareEvents(days, events, allDayEvents, scollDayEvents,option.rowsList[ii],""); var dMax = dM; var sufix = ii; if (option.columnsList!="" && option.view=="day") //draw columns { BuildWTBodyDayWithCol(html, days, allDayEvents, dM,config,ii); } else { BuildWTBody(html, days, allDayEvents, dM,config,ii,""); } } } html.push("
    "+days[0].display+" 
      
      
     
    "+option.rowsList[ii]+"
    "); html.push("
    "); if (option.rowsList=="" || (option.dayWithTime && option.view=="day")) { html.push("
    "); html.push(""); BuildDayScollEventheader(html, days, scollDayEvents,config); if (option.columnsList!="" && option.view=="day") //draw columns BuildDayScollEventbodyWithCol(html, days, scollDayEvents,config); else BuildDayScollEventbody(html, days, scollDayEvents,config); html.push("
    "); } gridcontainer.html(html.join("")); html = null; } //build month view function BuildMonthView(showday, events, config) { var cc = "
    "; var html = []; html.push(cc); //build header html.push("
    "); html.push(""); for (var i = config.weekstartday, j = 0; j < 7; i++, j++) { if (i > 6) i = 0; var p = { dayname: __WDAY[i] }; if (__VIEWWEEKDAYS[i]!=0) html.push("
    ", __WDAY[i], ""); } html.push("
    "); html.push("
    "); var bH = GetMonthViewBodyHeight() - GetMonthViewHeaderHeight(); html.push("
    "); BuilderMonthBody(html, showday, config.weekstartday, events, bH,config); html.push("
    "); gridcontainer.html(html.join("")); html = null; $("#cal-month-closebtn"+config.thecontainer).click(closeCc); } function closeCc() { $("#cal-month-cc"+option.thecontainer).css("visibility", "hidden"); } //all-day event, including more-than-one-day events function PropareEvents(dayarrs, events, aDE, sDE,filter) { var l = dayarrs.length; var el = events.length; var fE = []; var deB = aDE; var deA = sDE; var startRange = dayarrs[0].date; var endRange = dayarrs[dayarrs.length-1].date; endRange = new Date(endRange.getFullYear(),endRange.getMonth(),endRange.getDate(),23,59,59); for (var j = 0; j < el; j++) { var sD = events[j][2]; var eD = events[j][3]; var diff = DateDiff("d", sD, eD); if (diff > 0 && !(events[j][4] == 1)) { if (sD < startRange) { //start date out of range sD = startRange; } if (eD > endRange) { //end date out of range eD = endRange; } var stmp = sD; for (sD;sD<=eD;sD = DateAdd("d", 1, sD)) { var s = {}; s.event = events[j]; s.day = sD.getDate(); s.year = sD.getFullYear(); s.month = sD.getMonth() + 1; if (option.rowsList=="" || (option.dayWithTime && option.view=="day")) s.allday = events[j][4] == 1; else s.allday = 1; s.crossday = events[j][5] == 1; s.reevent = events[j][6];// == 1; //Recurring event s.daystr = [s.year, s.month, s.day].join("/"); s.noResizer = true; s.st = {}; if (sD>events[j][2]) { s.st.hour = 0; s.st.minute = 0; s.noStarttime = true; } else { s.st.hour = sD.getHours(); s.st.minute = sD.getMinutes(); } s.st.p = s.st.hour * 60 + s.st.minute; // start time s.et = {}; if (DateAdd("d", 1, sD)=option.hoursStart) && (s.st.hour<=option.hoursEnd) )) //if ( filter=="" || (filter!="" && ((option.rowsByCategory=="dc_locations" && events[j][9]==filter) || (option.rowsByCategory=="dc_subjects" && events[j][1]==filter)) ) ) fE.push(s); } } else { var s = {}; s.event = events[j]; s.day = sD.getDate(); s.year = sD.getFullYear(); s.month = sD.getMonth() + 1; if (option.rowsList=="" || (option.dayWithTime && option.view=="day")) s.allday = events[j][4] == 1; else s.allday = 1; s.crossday = events[j][5] == 1; s.reevent = events[j][6];// == 1; //Recurring event s.daystr = [s.year, s.month, s.day].join("/"); s.st = {}; s.st.hour = sD.getHours(); s.st.minute = sD.getMinutes(); s.st.p = s.st.hour * 60 + s.st.minute; // start time s.et = {}; s.et.hour = eD.getHours(); s.et.minute = eD.getMinutes(); s.et.p = s.et.hour * 60 + s.et.minute; // end time if (s.allday || ( (s.st.hour>=option.hoursStart) && (s.st.hour<=option.hoursEnd) )) if ( filter=="" || (filter!="" && ((option.rowsByCategory=="dc_locations" && events[j][9]==filter) || (option.rowsByCategory=="dc_subjects" && events[j][1]==filter)) ) ) fE.push(s); } } var dMax = 0; for (var i = 0; i < l; i++) { var da = dayarrs[i]; deA[i] = []; deB[i] = []; da.daystr = da.year + "/" + da.month + "/" + da.day; for (var j = 0; j < fE.length; j++) { if (!fE[j].crossday && !fE[j].allday) { if (da.daystr == fE[j].daystr) deA[i].push(fE[j]); } else { if (da.daystr == fE[j].daystr) { deB[i].push(fE[j]); dMax++; } else { if (i == 0 && da.date >= fE[j].event[2] && da.date <= fE[j].event[3])//first more-than-one-day event { deB[i].push(fE[j]); dMax++; } } } } } var lrdate = dayarrs[l - 1].date; for (var i = 0; i < l; i++) { //to deal with more-than-one-day event var de = deB[i]; if (de.length > 0) { // for (var j = 0; j < de.length; j++) { var end = DateDiff("d", lrdate, de[j].event[3]) > 0 ? lrdate : de[j].event[3]; de[j].colSpan = 0; for (var x=dayarrs[i].date;x<=end;x=DateAdd("d", 1, x)) de[j].colSpan += __VIEWWEEKDAYS[x.getDay()]; //de[j].colSpan = DateDiff("d", dayarrs[i].date, end) + 1; } } de = null; } //for all-day events for (var i = 0; i < l; i++) { var de = deA[i]; if (de.length > 0) { var x = []; var y = []; var D = []; var dl = de.length; var Ia; for (var j = 0; j < dl; ++j) { var ge = de[j]; for (var La = ge.st.p, Ia = 0; y[Ia] > La; ) Ia++; ge.PO = Ia; ge.ne = []; //PO is how many events before this one y[Ia] = ge.et.p || 1440; x[Ia] = ge; if (!D[Ia]) { D[Ia] = []; } D[Ia].push(ge); if (Ia != 0) { ge.pe = [x[Ia - 1]]; //previous event x[Ia - 1].ne.push(ge); //next event } for (Ia = Ia + 1; y[Ia] <= La; ) Ia++; if (x[Ia]) { var k = x[Ia]; ge.ne.push(k); k.pe.push(ge); } ge.width = 1 / (ge.PO + 1); ge.left = 1 - ge.width; } var k = Array.prototype.concat.apply([], D); x = y = D = null; var t = k.length; for (var y = t; y--; ) { var H = 1; var La = 0; var x = k[y]; for (var D = x.ne.length; D--; ) { var Ia = x.ne[D]; La = Math.max(La, Ia.VL); H = Math.min(H, Ia.left) } x.VL = La + 1; x.width = H / (x.PO + 1); x.left = H - x.width; } for (var y = 0; y < t; y++) { var x = k[y]; x.left = 0; if (x.pe) for (var D = x.pe.length; D--; ) { var H = x.pe[D]; x.left = Math.max(x.left, H.left + H.width); } var p = (1 - x.left) / x.VL; x.width = Math.max(x.width, p); x.aQ = Math.min(1 - x.left, x.width + 0.7 * p); //width offset } de = null; deA[i] = k; } } return dMax; } function BuildWTHeader(ht, dayarrs) { //1: //ht.push("", " "); for (var i = 0; i < dayarrs.length; i++) { var ev, title, cl; if (dayarrs.length == 1) { ev = ""; title = ""; cl = ""; } else { ev = ""; // "onclick=\"javascript:FunProxy('week2day',event,this);\""; title = i18n.dcmvcal.to_date_view; cl = "wk-daylink"; } if (dayarrs.length == 1 || __VIEWWEEKDAYS[dayarrs[i].date.getDay()]) ht.push("
    ", dayarrs[i].display, "
    "); } //ht.push(" "); //ht.push(""); //end tr1; } function BuildWTBodyDayWithCol(ht, dayarrs, events, dMax,config,sufix) { var xx = sufix; ht.push("
    "); sufix = ' row="'+sufix+'"'; if (dMax == 0) { ht.push(""); for (var i=0;i "); ht.push(""); } else { var l = events.length; var el = 0; var x = []; for (var j = 0; j < l; j++) { x.push(0); } var ev = new Array(); var evlength = 0; for (var j = 0; ((el < dMax) && (j < dMax)); j++) { for (var h = 0; h < l; ) { var e = events[h][x[h]]; for (var ii=0;ii";; if (ev[ii].length > evlength) evlength = ev[ii].length; el++; } } } h++; } } for (var j = 0; j < evlength; j++) { ht.push(""); for (var ii=0;ii "); ht.push(""); } ht.push(""); for (var ii=0;ii "); } ht.push(""); } ht.push("
    "); // stgrid end //wvAd end //td2 end //tr2 end //3: ht.push(""); ht.push(" 1) { if (option.view == "week") ht.push(" colSpan='",__VIEWWEEKDAYSTOTAL+2, "'"); else ht.push(" colSpan='",option.numberOfDays+2, "'"); } ht.push(">"); ht.push(""); } function BuildWTBody(ht, dayarrs, events, dMax,config,sufix) { //2: ht.push(" 1) { if (option.view == "week") ht.push(" colSpan='",__VIEWWEEKDAYSTOTAL, "'"); //dayarrs.length else ht.push(" colSpan='",option.numberOfDays, "'"); //dayarrs.length } //onclick=\"javascript:FunProxy('rowhandler',event,this);\" ht.push(">
    "); sufix = ' row="'+sufix+'"'; if (dMax == 0) { ht.push(""); for (var i = 0; i < dayarrs.length; i++) { if (__VIEWWEEKDAYS[i]!=0) ht.push(""); } ht.push(""); } else { var l = events.length; var el = 0; var x = []; for (var j = 0; j < l; j++) { x.push(0); } //var c = tc(); for (var j = 0; ((el < dMax) && (j < dMax)); j++) { ht.push(""); for (var h = 0; h < l; ) { var e = events[h][x[h]]; var tmp_h = h; if (__VIEWWEEKDAYS[((dayarrs[tmp_h].date.getDay())%option.numberOfDays)]!=0) ht.push(""); } ht.push(""); } ht.push(""); for (var h = 0; h < l; h++) { if (__VIEWWEEKDAYS[((dayarrs[h].date.getDay())%option.numberOfDays)]!=0) ht.push(""); } ht.push(""); } ht.push("
     
    ", t); t = null; el++; } else { if (__VIEWWEEKDAYS[((dayarrs[tmp_h].date.getDay())%option.numberOfDays)]!=0) ht.push(" st-s' ch='qkadd' abbr='", dateFormat.call(dayarrs[h].date, i18n.dcmvcal.dateformat.fulldayvalue), "' axis='00:00'> "); h++; } if (__VIEWWEEKDAYS[((dayarrs[tmp_h].date.getDay())%option.numberOfDays)]!=0) ht.push("
     
    "); // stgrid end //wvAd end //td2 end //tr2 end //3: ht.push(""); ht.push(" 1) { if (option.view == "week") ht.push(" colSpan='",__VIEWWEEKDAYSTOTAL+2, "'"); else ht.push(" colSpan='",option.numberOfDays+2, "'"); } ht.push(">"); ht.push(""); } function BuildDayScollEventheader(ht, dayarrs, events,config) { //1: ht.push(""); ht.push(""); ht.push(" 1) { if (option.view == "week") ht.push(" colSpan='",__VIEWWEEKDAYSTOTAL, "'"); else ht.push(" colSpan='",option.numberOfDays, "'"); } else if (option.columnsList!="" && option.view=="day") ht.push(" colSpan='",option.columnsList.length, "'"); ht.push(" >
    "); var hh = option.cellheight/2 - 1 ; for (var i = option.hoursStart; i <= option.hoursEnd; i++) { //for (var i = 0; i < 24; i++) { ht.push("
    "); } ht.push("
    "); //2: ht.push(""); ht.push(""); //get current time var now = new Date(); var h = now.getHours(); var m = now.getMinutes(); var mHg = gP(h, m) - 4; //make middle alignment vertically ht.push("
    "); var tmt = ""; for (var i = option.hoursStart; i <= option.hoursEnd; i++) { tmt = fomartTimeAMPM(i,0,__MilitaryTime); ht.push("
    ", tmt, "
    "); } ht.push(""); } function BuildDayScollEventbody(ht, dayarrs, events,config) { var now = new Date(); var h = now.getHours(); var m = now.getMinutes(); var mHg = gP(h, m) - 4; //make middle alignment vertically var l = dayarrs.length; for (var i = 0; i < l; i++) { if (__VIEWWEEKDAYS[dayarrs[i].date.getDay()]!=0) { ht.push(""); var istoday = dateFormat.call(dayarrs[i].date, "yyyyMMdd") == dateFormat.call(new Date(), "yyyyMMdd"); // Today if (istoday) { ht.push("
     
    "); } //var eventC = $(eventWrap); //onclick=\"javascript:FunProxy('rowhandler',event,this);\" ht.push("
    "); BuildEvents(ht, events[i], dayarrs[i]); ht.push("
    "); ht.push("
    "); if (istoday) { var mhh = mHg + 4; ht.push("
    "); } ht.push("
    "); ht.push(""); } } ht.push(""); } function BuildDayScollEventbodyWithCol(ht, dayarrs, events,config) { var i = 0; //for (var j = 0; j < events[i].length; j++) // alert(events[i][j].event[1]+"--------"+events[i][j].event[9]); var now = new Date(); var h = now.getHours(); var m = now.getMinutes(); var mHg = gP(h, m) - 4; //make middle alignment vertically var l = dayarrs.length; var i = 0; { for (var ii=0;ii"); var istoday = dateFormat.call(dayarrs[i].date, "yyyyMMdd") == dateFormat.call(new Date(), "yyyyMMdd"); // Today if (istoday) { ht.push("
     
    "); } ht.push("
    "); var eventbyColumns = new Array(); for (var j = 0; j < events[i].length; j++) { var e = events[i][j]; e.left = 0; e.aQ = 1; //alert(e); if ( ((option.dayWithColumns=="dc_locations" && e.event[9]==option.columnsList[ii]) || (option.dayWithColumns=="dc_subjects" && e.event[1]==option.columnsList[ii])) ) eventbyColumns[eventbyColumns.length] = e; } BuildEvents(ht, eventbyColumns, dayarrs[i]); ht.push("
    "); ht.push("
    "); if (istoday) { var mhh = mHg + 4; ht.push("
    "); } ht.push("
    "); ht.push(""); } } ht.push(""); } //show events to calendar function BuildEvents(hv, events, sday) { for (var i = 0; i < events.length; i++) { var c; //if (events[i].event[7] && events[i].event[7] >= 0) { c = tc(events[i].event[7]); //theme //} //else { // c = tc(); //default theme //} var tt = BuildDayEvent(c, events[i], i); hv.push(tt); } } function getTitle(event) { var timeshow, locationshow, attendsshow, eventshow; var showtime = event[4] != 1; eventshow = event[1]; var startformat = getymformat(event[2], null, showtime, true); var endformat = getymformat(event[3], event[2], showtime, true); timeshow = dateFormat.call(event[2], startformat) + " - " + dateFormat.call(event[3], endformat); locationshow = (event[9] != undefined && event[9] != "") ? ($.browser.mozilla?"":"\r\n")+i18n.dcmvcal.location + ":" + event[9] : ""; attendsshow = (event[10] != undefined && event[10] != "") ? event[10] : ""; var ret = []; if (event[4] == 1) { ret.push("[" + i18n.dcmvcal.allday_event + "]",$.browser.mozilla?"":"\r\n" ); } else { if (event[5] == 1) { ret.push("[" + i18n.dcmvcal.repeat_event + "]",$.browser.mozilla?"":"\r\n"); } } ret.push(i18n.dcmvcal.time + ":", timeshow, $.browser.mozilla?"":"\r\n", i18n.dcmvcal.event + ":", eventshow, locationshow); if (attendsshow != "") { ret.push($.browser.mozilla?"":"\r\n", i18n.dcmvcal.participant + ":", attendsshow); } return ret.join(""); } function BuildDayEvent(theme, e, index) { var p = { bdcolor: theme[0], bgcolor2: theme[0], bgcolor1: theme[2], width: "70%", icon: "", title: "", data: "" }; if (e.noStarttime) p.starttime = ""; else p.starttime = fomartTimeAMPM(e.st.hour,e.st.minute,__MilitaryTime); if (e.noResizer) p.endtime = ""; else p.endtime = fomartTimeAMPM(e.et.hour,e.et.minute,__MilitaryTime); p.content = e.event[1]; p.title = getTitle(e.event); p.data = e.event.join("$"); var icons = []; icons.push(" "); if (e.reevent) { icons.push(" "); } p.icon = icons.join(""); var sP = gP(e.st.hour, e.st.minute); var eP = gP(e.et.hour, e.et.minute); p.top = sP + "px"; p.left = (e.left * 100) + "%"; p.width = (e.aQ * 100) + "%"; p.height = (eP - sP - 4); p.i = index; if (option.enableDrag && e.event[8] == 1 && !e.noResizer) { p.drag = "drag"; p.redisplay = "block"; } else { p.drag = ""; p.redisplay = "none"; } p.userEdition = ( ((option.userOwner==e.event[12]) && (option.userEditOwner || option.userDelOwner))?"uEdition":"" ); var newtemp = Tp(__SCOLLEVENTTEMP, p); p = null; return newtemp; } //get body height in month view function GetMonthViewBodyHeight() { return option.height; } function GetMonthViewHeaderHeight() { return 26; } function BuilderMonthBody(htb, showday, startday, events, bodyHeight,config) { var firstdate = new Date(showday.getFullYear(), showday.getMonth(), 1); var diffday = startday - firstdate.getDay(); var showmonth = showday.getMonth(); if (diffday > 0) { diffday -= 7; } var startdate = DateAdd("d", diffday, firstdate); var enddate = DateAdd("d", 34, startdate); var rc = 5; if (enddate.getFullYear() == showday.getFullYear() && enddate.getMonth() == showday.getMonth() && enddate.getDate() < __MonthDays[showmonth]) { enddate = DateAdd("d", 7, enddate); rc = 6; } option.vstart = startdate; option.vend = enddate; option.datestrshow = CalDateShow(startdate, enddate); bodyHeight = bodyHeight - 18 * rc; var rowheight = bodyHeight / rc; var roweventcount = parseInt(rowheight / 21); if (rowheight % 21 > 15) { roweventcount++; } var p = 100 / rc; var formatevents = []; var hastdata = formartEventsInHashtable(events, startday, 7, startdate, enddate); var B = []; var C = []; for (var j = 0; j < rc; j++) { var k = 0; formatevents[j] = b = []; for (var i = 0; i < 7; i++) { var newkeyDate = DateAdd("d", j * 7 + i, startdate); C[j * 7 + i] = newkeyDate; var newkey = dateFormat.call(newkeyDate, i18n.dcmvcal.dateformat.fulldaykey); b[i] = hastdata[newkey]; if (b[i] && b[i].length > 0) { k += b[i].length; } } B[j] = k; } //var c = tc(); eventDiv.data("mvdata", formatevents); for (var j = 0; j < rc; j++) { //onclick=\"javascript:FunProxy('rowhandler',event,this);\" htb.push("
    "); htb.push(""); var dMax = B[j]; for (var i = 0; i < 7; i++) { var day = C[j * 7 + i]; if (__VIEWWEEKDAYS[i]!=0) { htb.push(""); } } //bgtable htb.push("
    "); } else { htb.push(" class=\"st-bg\">"); } htb.push(" 
    "); //stgrid htb.push(""); //title tr htb.push(""); var titletemp = ""; for (var i = 0; i < 7; i++) { var o = { titleClass: "", dayshow: "", display:__VIEWWEEKDAYS[(startday+i)%7]+"i"+i }; var day = C[j * 7 + i]; if (dateFormat.call(day, "yyyyMMdd") == dateFormat.call(new Date(), "yyyyMMdd")) { o.titleClass = " st-dtitle-today"; } if (day.getMonth() != showmonth) { o.titleClass = " st-dtitle-nonmonth"; } o.title = dateFormat.call(day, i18n.dcmvcal.dateformat.fulldayshow); if (day.getDate() == 1) { if (day.getMonth == 0) { o.dayshow = dateFormat.call(day, i18n.dcmvcal.dateformat.fulldayshow); } else { o.dayshow = dateFormat.call(day, i18n.dcmvcal.dateformat.Md3); } } else { o.dayshow = day.getDate(); } o.abbr = dateFormat.call(day, i18n.dcmvcal.dateformat.fulldayvalue); if (__VIEWWEEKDAYS[(startday+i)%7]!=0) htb.push(Tp(titletemp, o)); } htb.push(""); var sfirstday = C[j * 7]; if (formatevents[j][i]) alert(formatevents[j][i].colSpan); BuildMonthRow(htb, formatevents[j], dMax, roweventcount, sfirstday,startday); //htb=htb.concat(rowHtml); rowHtml = null; htb.push("
    ${dayshow}
    "); //month-row htb.push("
    "); } formatevents = B = C = hastdata = null; //return htb; } //formate datetime function formartEventsInHashtable(events, startday, daylength, rbdate, redate) { var hast = new Object(); var l = events.length; for (var i = 0; i < l; i++) { var sD = events[i][2]; var eD = events[i][3]; var diff = DateDiff("d", sD, eD); var s = {}; s.event = events[i]; s.day = sD.getDate(); s.year = sD.getFullYear(); s.month = sD.getMonth() + 1; s.allday = events[i][4] == 1; s.crossday = events[i][5] == 1; s.reevent = events[i][6];// == 1; //Recurring event s.daystr = s.year + "/" + s.month + "/" + s.day; s.st = {}; s.st.hour = sD.getHours(); s.st.minute = sD.getMinutes(); s.st.p = s.st.hour * 60 + s.st.minute; // start time position s.et = {}; s.et.hour = eD.getHours(); s.et.minute = eD.getMinutes(); s.et.p = s.et.hour * 60 + s.et.minute; // end time postition if (diff > 0) { if (sD < rbdate) { //start date out of range sD = rbdate; } if (eD > redate) { //end date out of range eD = redate; } var f = startday - sD.getDay(); if (f > 0) { f -= daylength; } sD = new Date(sD.getFullYear(), sD.getMonth(), sD.getDate()); var sdtemp = DateAdd("d", f, sD); for (; sdtemp <= eD; sD = sdtemp = DateAdd("d", daylength, sdtemp)) { var d = Clone(s); while (!__VIEWWEEKDAYS[sD.getDay()] && sdtemp <= eD) { sD = DateAdd("d", 1, sD); } var key = dateFormat.call(sD, i18n.dcmvcal.dateformat.fulldaykey); var x = DateDiff("d", sdtemp, eD); var y = DateDiff("d", sdtemp, sD); if (hast[key] == null) { hast[key] = []; } //d.colSpan = (x >= daylength) ? daylength - DateDiff("d", sdtemp, sD) : DateDiff("d", sD, eD) + 1; if (x >= daylength) { if (y==0) d.colSpan = __VIEWWEEKDAYSTOTAL else { var sdtemp2 = DateAdd("d", daylength, sdtemp); d.colSpan = 0; for (var x=sD;x 0) hast[key].push(d); d = null; } } else { var key = dateFormat.call(events[i][2], i18n.dcmvcal.dateformat.fulldaykey); if (hast[key] == null) { hast[key] = []; } s.colSpan = 1; hast[key].push(s); } s = null; } return hast; } function BuildMonthRow(htr, events, dMax, sc, day,startday) { var x = []; var y = []; var z = []; var cday = []; var l = events.length; var el = 0; //var c = tc(); for (var j = 0; j < l; j++) { x.push(0); y.push(0); z.push(0); cday.push(DateAdd("d", j, day)); } for (var j = 0; j < l; j++) { var ec = events[j] ? events[j].length : 0; y[j] += ec; for (var k = 0; k < ec; k++) { var e = events[j][k]; //alert(e.colSpan); if (e && e.colSpan > 1) { for (var m = 1; m < e.colSpan; m++) { y[j + m]++; } } } } //var htr=[]; var tdtemp = "${html}"; var tmp_h = 0; for (var j = 0; j < sc && el < dMax; j++) { htr.push(""); //var gridtr = $(__TRTEMP); for (var h = 0; h < l; ) { var cdisplay = 0; var e = events[h] ? events[h][x[h]] : undefined; var tempdata = { "class": "", axis: "", ch: "", title: "", abbr: "", html: "", otherAttr: "", click: "javascript:void(0);" }; var tempCss = ["st-c"]; if (e) { x[h] = x[h] + 1; //last event of the day var bs = false; if (z[h] + 1 == y[h] && e.colSpan == 1) { bs = true; } if (!bs && j == (sc - 1) && z[h] < y[h]) { el++;//here $.extend(tempdata, { "axis": h, ch: "more", "abbr": dateFormat.call(cday[h], i18n.dcmvcal.dateformat.fulldayvalue), html: i18n.dcmvcal.others + (y[h] - z[h]) + i18n.dcmvcal.item, click: "javascript:alert('more event');" }); tempCss.push("st-more st-moreul"); h++; } else { tempdata.html = BuildMonthDayEvent(e, cday[h], l - h); tempdata.ch = "show"; if (e.colSpan > 1) { tempdata.otherAttr = " colSpan='" + e.colSpan + "'"; for (var m = 0; m < e.colSpan; m++) { z[h + m] = z[h + m] + 1; } var zz = 0; for (var p=0; p 0) { $.extend(tempdata, { "axis": h, ch: "more", "abbr": dateFormat.call(cday[h], i18n.dcmvcal.dateformat.fulldayvalue), html: i18n.dcmvcal.others + (y[h] - z[h]) + i18n.dcmvcal.item, click: "javascript:alert('more event');" }); tempCss.push("st-more st-moreul"); h++; } else { cdisplay = 1; $.extend(tempdata, { html: " ", ch: "qkadd", display:1, "axis": "00:00", "abbr": dateFormat.call(cday[h], i18n.dcmvcal.dateformat.fulldayvalue), title: "" }); tempCss.push("st-s"); tmp_h = h; h++; } } tempdata.cssclass = tempCss.join(" "); tempCss = null; if (cdisplay==0) htr.push(Tp(tdtemp, tempdata)); else if (__VIEWWEEKDAYS[((cday[tmp_h].getDay())%7)]!=0) htr.push(Tp(tdtemp, tempdata)); tempdata = null; } htr.push(""); } x = y = z = cday = null; //return htr; } function BuildMonthDayEvent(e, cday, length) { var theme; //if (e.event[7] && e.event[7] >= 0) { theme = tc(e.event[7]); //} //else { // theme = tc(); //} var p = { color: theme[2], title: "", extendClass: "", extendHTML: "", data: "" }; p.title = getTitle(e.event); p.id = "bbit_cal_event_" + e.event[0]; if (option.enableDrag && e.event[8] == 1) { p.eclass = "drag"; } else { p.eclass = "cal_" + e.event[0]; } p.data = e.event.join("$"); var sp = "${content}"; var i = " "; var i2 = " "; var ml = "
    "; var mr = "
    "; var arrm = []; var sf = e.event[2] < cday; var ef = DateDiff("d", cday, e.event[3]) >= length; //e.event[3] >= DateAdd("d", 1, cday); if (sf || ef) { if (sf) { arrm.push(ml); p.extendClass = "st-ad-mpad "; } if (ef) { arrm.push(mr); } p.extendHTML = arrm.join(""); } var cen; if (!e.allday && !sf) { cen = fomartTimeAMPM(e.st.hour,e.st.minute,__MilitaryTime) + " " + e.event[1]; } else { cen = e.event[1]; } var content = []; content.push(Tp(sp, { content: cen })); content.push(i); if (e.reevent) { content.push(i2); } p.content = content.join(""); p.location = (e.event[9]!=null)?e.event[9]:""; p.description = (e.event[11]!=null)?e.event[11]:""; p.userEdition = ( ((option.userOwner==e.event[12]) && (option.userEditOwner || option.userDelOwner))?"uEdition":"" ); return Tp(__ALLDAYEVENTTEMP, p); } //to populate the data function populate() { if (option.isloading) { return true; } if (option.url && option.url != "") { option.isloading = true; //clearcontainer(); if (option.onBeforeRequestData && $.isFunction(option.onBeforeRequestData)) { option.onBeforeRequestData(1); } var zone = new Date().getTimezoneOffset() / 60 * -1; var param = [ { name: "showdate", value: dateFormat.call(option.showday, "M/d/yyyy HH:mm") }, { name: "startdate", value: dateFormat.call(option.vstart, "M/d/yyyy HH:mm") }, { name: "enddate", value: dateFormat.call(option.vend, "M/d/yyyy HH:mm") }, { name: "viewtype", value: option.view }, { name: "timezone", value: zone } ]; if (option.extParam) { for (var pi = 0; pi < option.extParam.length; pi++) { param[param.length] = option.extParam[pi]; } } $.ajax({ type: option.method, // url: option.url, data: param, //dataType: "text", // fixed jquery 1.4 not support Ms Date Json Format /Date(@Tickets)/ dataType: "json", dataFilter: function(data, type) { //return data.replace(/"\\\/(Date\([0-9-]+\))\\\/"/gi, "new $1"); return data; }, success: function(data) {//function(datastr) { //datastr =datastr.replace(/"\\\/(Date\([0-9-]+\))\\\/"/gi, 'new $1'); //var data = (new Function("return " + datastr))(); if (data != null && data.error != null) { if (option.onRequestDataError) { option.onRequestDataError(1, data); } } else { try { data["start"] = parseDate(data["start"]); data["end"] = parseDate(data["end"]); $.each(data.events, function(index, value) { value[2] = parseDate(value[2]); value[3] = parseDate(value[3]); }); responseData(data, data.start, data.end); pushER(data.start, data.end); } catch (e) { } } if (option.onAfterRequestData && $.isFunction(option.onAfterRequestData)) { option.onAfterRequestData(1); } option.isloading = false; }, error: function(data) { try { if (option.onRequestDataError) { option.onRequestDataError(1, data); } else { alert(i18n.dcmvcal.get_data_exception); } if (option.onAfterRequestData && $.isFunction(option.onAfterRequestData)) { option.onAfterRequestData(1); } option.isloading = false; } catch (e) { } } }); } else { alert("url" + i18n.dcmvcal.i_undefined); } } function responseData(data, start, end) { var events,v,r,ne,tmp,tmpArray=new Array(),excludeEvents=new Array(); for (var i=0;i 0) { events = data.events.sort(function(l, r) { return l[2] > r[2] ? 1 : -1; }); } else { events = []; } } else { events = data.events; } ConcatEvents(events, start, end); render(); } function clearrepeat(events, start, end) { var jl = events.length; if (jl > 0) { var es = events[0][2]; var el = events[jl - 1][2]; for (var i = 0, l = option.eventItems.length; i < l; i++) { if (option.eventItems[i][2] > el || jl == 0) { break; } if (option.eventItems[i][2] >= es) { for (var j = 0; j < jl; j++) { if ((option.eventItems[i][0] == events[j][0]) && (option.eventItems[i][2].toString() == events[j][2].toString()) && (option.eventItems[i][2] < start)) { events.splice(j, 1); //for duplicated event jl--; break; } } } } } } function ConcatEvents(events, start, end) { if (!events) { events = []; } if (events) { if (option.eventItems.length == 0) { option.eventItems = events; } else { //remove duplicated one clearrepeat(events, start, end); var l = events.length; var sl = option.eventItems.length; var sI = -1; var eI = sl; var s = start; var e = end; if (option.eventItems[0][2] > e) { option.eventItems = events.concat(option.eventItems); return; } if (option.eventItems[sl - 1][2] < s) { option.eventItems = option.eventItems.concat(events); return; } for (var i = 0; i < sl; i++) { if (option.eventItems[i][2] >= s && sI < 0) { sI = i; continue; } if (option.eventItems[i][2] > e) { eI = i; break; } } var e1 = sI <= 0 ? [] : option.eventItems.slice(0, sI); var e2 = eI == sl ? [] : option.eventItems.slice(eI); option.eventItems = [].concat(e1, events, e2); events = e1 = e2 = null; } } } //utils goes here function weekormonthtoday(e) { $('#show'+option.view+"btn"+option.thecontainer).removeClass("ui-state-active"); var th = $(this); var daystr = th.attr("abbr"); option.showday = strtodate(daystr + " 00:00"); option.view = "day"; $('#show'+option.view+"btn"+option.thecontainer).addClass("ui-state-active"); render(); if (option.onweekormonthtoday) { option.onweekormonthtoday(option); } return false; } function move_mv_dlg(){ $(".mv_dlg").css("top",parseFloat($(".mv_dlg").css("top"))+17); $(".mv_dlg").css("left",parseFloat($(".mv_dlg").css("left"))-29); $(".mv_dlg").css("height","0px"); } function parseDate(str){ var s = str.split(" "); var s0 = s[0].split("/"); var s1 = s[1].split(":"); return new Date(s0[2]*1, s0[0]*1-1, s0[1]*1,s1[0]*1,s1[1]*1); } function gP(h, m) { //return h * 42 + parseInt(m / 60 * 42); if (h>option.hoursEnd) return (option.hoursEnd-option.hoursStart+1) * option.cellheight ; else return (h-option.hoursStart) * option.cellheight + parseInt(m / 60 * option.cellheight); } function gW(ts1, ts2) { var t1 = ts1 / option.cellheight; var t2 = parseInt(t1) + option.hoursStart; var t3 = t1 - t2 >= 0.5 ? 30 : 0; var t4 = ts2 / option.cellheight; var t5 = parseInt(t4) + option.hoursStart; var t6 = t4 - t5 >= 0.5 ? 30 : 0; return { sh: t2, sm: t3, eh: t5, em: t6, h: ts2 - ts1 }; } function gH(y1, y2, pt) { var sy1 = Math.min(y1, y2); var sy2 = Math.max(y1, y2); var t1 = (sy1 - pt) / option.cellheight; var t2 = parseInt(t1) + option.hoursStart; var t3 = t1 - t2 >= 0.5 ? 30 : 0; var t4 = (sy2 - pt) / option.cellheight; var t5 = parseInt(t4) + option.hoursStart; var t6 = t4 - t5 >= 0.5 ? 30 : 0; return { sh: t2, sm: t3, eh: t5, em: t6, h: sy2 - sy1 }; } function pZero(n) { return n < 10 ? "0" + n : "" + n; } //to get color list array function tc(d) { function zc(c, i) { var d = "666666888888aaaaaabbbbbbdddddda32929cc3333d96666e69999f0c2c2b1365fdd4477e67399eea2bbf5c7d67a367a994499b373b3cca2cce1c7e15229a36633cc8c66d9b399e6d1c2f029527a336699668cb399b3ccc2d1e12952a33366cc668cd999b3e6c2d1f01b887a22aa9959bfb391d5ccbde6e128754e32926265ad8999c9b1c2dfd00d78131096184cb05288cb8cb8e0ba52880066aa008cbf40b3d580d1e6b388880eaaaa11bfbf4dd5d588e6e6b8ab8b00d6ae00e0c240ebd780f3e7b3be6d00ee8800f2a640f7c480fadcb3b1440edd5511e6804deeaa88f5ccb8865a5aa87070be9494d4b8b8e5d4d47057708c6d8ca992a9c6b6c6ddd3dd4e5d6c6274878997a5b1bac3d0d6db5a69867083a894a2beb8c1d4d4dae54a716c5c8d8785aaa5aec6c3cedddb6e6e41898951a7a77dc4c4a8dcdccb8d6f47b08b59c4a883d8c5ace7dcce"; return "#" + d.substring(c * 30 + i * 6, c * 30 + (i + 1) * 6); } var c = d != null && d != undefined ? d : option.theme; d = d != null && d != undefined && d != -1 ? d : option.theme; return [d,d,d,d]; } function Tp(temp, dataarry) { return temp.replace(/\$\{([\w]+)\}/g, function(s1, s2) { var s = dataarry[s2]; if (typeof (s) != "undefined") { return s; } else { return s1; } }); } function Ta(temp, dataarry) { return temp.replace(/\{([\d])\}/g, function(s1, s2) { var s = dataarry[s2]; if (typeof (s) != "undefined") { return encodeURIComponent(s); } else { return ""; } }); } function fomartTimeShow(h) { //return h < 10 ? "0" + h + ":00" : h + ":00";//ampm var tmp = ((h%12) < 10) && h!=12 ? "0" + (h%12) + ":00" : (h==12?"12":(h%12)) + ":00"; tmp += " " + ((h>=12)?"pm":"am"); return tmp ; } function getymformat(date, comparedate, isshowtime, isshowweek, showcompare) { var showyear = isshowtime != undefined ? (date.getFullYear() != new Date().getFullYear()) : true; var showmonth = true; var showday = true; var showtime = isshowtime || false; var showweek = isshowweek || false; if (comparedate) { showyear = comparedate.getFullYear() != date.getFullYear(); //showmonth = comparedate.getFullYear() != date.getFullYear() || date.getMonth() != comparedate.getMonth(); if (comparedate.getFullYear() == date.getFullYear() && date.getMonth() == comparedate.getMonth() && date.getDate() == comparedate.getDate() ) { showyear = showmonth = showday = showweek = false; } } var a = []; if (showyear) { a.push(i18n.dcmvcal.dateformat.fulldayshow) } else if (showmonth) { a.push(i18n.dcmvcal.dateformat.Md3) } else if (showday) { a.push(i18n.dcmvcal.dateformat.day); } a.push(showweek ? " (W)" : "", showtime ? " HH:mm" : ""); return a.join(""); } function CalDateShow(startday, endday, isshowtime, isshowweek) { if (!endday) { return dateFormat.call(startday, getymformat(startday,null,isshowtime)); } else { var strstart= dateFormat.call(startday, getymformat(startday, null, isshowtime, isshowweek)); var strend=dateFormat.call(endday, getymformat(endday, startday, isshowtime, isshowweek)); var join = (strend!=""? " - ":""); return [strstart,strend].join(join); } } function dochange() { var d = getRdate(); var loaded = checkInEr(d.start, d.end); //if (!loaded) { populate(); } } function checkInEr(start, end) { var ll = option.loadDateR.length; if (ll == 0) { return false; } var r = false; var r2 = false; for (var i = 0; i < ll; i++) { r = false, r2 = false; var dr = option.loadDateR[i]; if (start >= dr.startdate && start <= dr.enddate) { r = true; } if (dateFormat.call(start, "yyyyMMdd") == dateFormat.call(dr.startdate, "yyyyMMdd") || dateFormat.call(start, "yyyyMMdd") == dateFormat.call(dr.enddate, "yyyyMMdd")) { r = true; } if (!end) { r2 = true; } else { if (end >= dr.startdate && end <= dr.enddate) { r2 = true; } if (dateFormat.call(end, "yyyyMMdd") == dateFormat.call(dr.startdate, "yyyyMMdd") || dateFormat.call(end, "yyyyMMdd") == dateFormat.call(dr.enddate, "yyyyMMdd")) { r2 = true; } } if (r && r2) { break; } } return r && r2; } function buildtempdayevent(sh, sm, eh, em, h, title, w, resize, thindex) { //var theme = thindex != undefined && thindex >= 0 ? tc(thindex) : tc(); var theme = thindex != undefined ? tc(thindex) : tc(); var newtemp = Tp(__SCOLLEVENTTEMP, { bdcolor: theme[0], bgcolor2: theme[0], bgcolor1: theme[2], data: "", starttime: [pZero(sh), pZero(sm)].join(":"), endtime: [pZero(eh), pZero(em)].join(":"), content: title ? title : i18n.dcmvcal.new_event, title: title ? title : i18n.dcmvcal.new_event, icon: " ", top: "0px", left: "", width: w ? w : "100%", height: h - 4, i: "-1", drag: "drag-chip", redisplay: resize ? "block" : "none" }); return newtemp; } function getdata(chip) { var hddata = chip.find("div.dhdV"); if (hddata.length == 1) { var str = hddata.html(); return parseED(str.split("$")); } return null; } function parseED(data) { if (data.length > 6) { var e = []; e.push(data[0], data[1], new Date(data[2]), new Date(data[3]), parseInt(data[4]), parseInt(data[5]), (data[6]), data[7] != undefined ? parseInt(data[7]) : -1, data[8] != undefined ? parseInt(data[8]) : 0); for (var i=9;i maxLeft) { tleft = x - 200 <= 0 ? 10 : x - 200; ttop = y - 159 <= 0 ? 10 : y - 159; if (tleft + 400 >= maxLeft) { tleft = maxLeft - 410; } if (ttop + 164 >= maxTop) { ttop = maxTop - 165; } ishide = true; } return { left: tleft, top: ttop, hide: ishide }; } function dayshow(e, data) { if (data == undefined) { data = getdata($(this)); } if (data != null) { if (option.quickDeleteUrl != "" && data[8] == 1 && ( (option.readonly != true) || (option.readonly == true && option.showtooltipdwm) || (option.readonly == true && option.showtooltipdwm_mouseover) )) { var csbuddle = '
    ' +'
    ' +'
    ' +'
    ' +'
    '; if (option.readonly != true && (option.userEdit || option.userDel || ((option.userOwner==data[12]) && (option.userEditOwner || option.userDelOwner)))) { csbuddle +='
    '; if (option.userDel || ((option.userOwner==data[12]) && (option.userDelOwner))) { ///no delete from recurring events if (!(data[6]!="" && data[6] != null && data[6] != undefined)) csbuddle +='[ '+ i18n.dcmvcal.i_delete + ' ] '; } if (option.userEdit || ((option.userOwner==data[12]) && (option.userEditOwner))) csbuddle +=' '+ i18n.dcmvcal.update_detail + ' >>'; csbuddle +='
    '; } csbuddle +='
    '; $("#bbit-cal-buddle").remove(); $(".mv_dlg").remove(); $("#bbit-cs-buddle").remove(); var bud = $("#bbit-cs-buddle"); if (bud.length == 0) { // bud = $(csbuddle).appendTo(document.body); bud.dialog({width:300,resizable: false, position: { my: "left top", at: "center bottom", collision: "fit", of: $(this) }}) $("#bbit-cs-buddle").parent().addClass("mv_dlg"); $("
    ").appendTo($(".mv_dlg .ui-dialog-titlebar")); move_mv_dlg(); var calbutton = $("#bbit-cs-delete"); var lbtn = $("#bbit-cs-editLink"); var closebtn = $("#bubbleClose2").click(function() { try {$("#bbit-cs-buddle").dialog("close");}catch (e) {} }); calbutton.click(function() { var data = $("#bbit-cs-buddle").data("cdata"); if (option.DeleteCmdhandler && $.isFunction(option.DeleteCmdhandler)) { option.DeleteCmdhandler.call(this, data, quickd); } //else { // if (confirm(i18n.dcmvcal.confirm_delete_event + "?")) { // var s = 0; //0 single event , 1 for Recurring event // if (data[6] == 1) { // if (confirm(i18n.dcmvcal.confrim_delete_event_or_all)) { // s = 0; // } // else { // s = 1; // } // } // else { // s = 0; // } // quickd(s); // } //} }); lbtn.click(function(e) { $("#bbit-cs-buddle").dialog("destroy"); if (!option.EditCmdhandler) { alert("EditCmdhandler" + i18n.dcmvcal.i_undefined); } else { if (option.EditCmdhandler && $.isFunction(option.EditCmdhandler)) { option.EditCmdhandler.call(this, $("#bbit-cs-buddle").data("cdata")); } } return false; }); bud.click(function(e) { e.stopPropagation(); return; }); } var ss = []; var iscos = DateDiff("d", data[2], data[3]) != 0; ss.push(dateFormat.call(data[2], i18n.dcmvcal.dateformat.fulldayshow)); if (data[4] != 1) { ss.push(" ",fomartTimeAMPM(data[2].getHours(),data[2].getMinutes(),__MilitaryTime)) } if (iscos) { ss.push(" - ", dateFormat.call(data[3], i18n.dcmvcal.dateformat.fulldayshow)); if (data[4] != 1) { ss.push(" ",fomartTimeAMPM(data[3].getHours(),data[3].getMinutes(),__MilitaryTime)) } } else if (data[4] != 1) ss.push(" - ",fomartTimeAMPM(data[3].getHours(),data[3].getMinutes(),__MilitaryTime)); var ts = $("#bbit-cs-buddle-timeshow").html(ss.join("")); $("#bbit-cs-id").val(data[0]); $("#bbit-cs-title").html(data[1]); $("#bbit-cs-location").html(data[9]); $("#bbit-cs-description").html(data[11]); bud.data("cdata", data); //bud.css({ "visibility": "visible", left: pos.left, top: pos.top }); $(document).one("click", function() { try {$("#bbit-cs-buddle").dialog("close");}catch (e) {} }); } else { if (!option.ViewCmdhandler) { alert("ViewCmdhandler" + i18n.dcmvcal.i_undefined); } else { if (option.ViewCmdhandler && $.isFunction(option.ViewCmdhandler)) { option.ViewCmdhandler.call(this, data); } } } } else { alert(i18n.dcmvcal.data_format_error); } return false; } function moreshow(mv) { var me = $(this); var divIndex = mv.id.split('_')[1]; var pdiv = $(mv); var offsetMe = me.position(); var offsetP = pdiv.position(); var width = (me.width() + 2) * 1.5; var top = offsetP.top + 15; var left = offsetMe.left; var daystr = $(this).attr("abbr"); var day = strtodate(daystr + " 00:00"); var cc = $("#cal-month-cc"+option.thecontainer); var ccontent = $("#cal-month-cc-content"+option.thecontainer+" table tbody"); var ctitle = $("#cal-month-cc-title"+option.thecontainer); ctitle.html(dateFormat.call(day, i18n.dcmvcal.dateformat.Md3) + " " + __WDAY[day.getDay()]); ccontent.empty(); //var c = tc()[2]; var edata = $("#gridEvent"+option.thecontainer).data("mvdata"); var events = edata[divIndex]; var index = parseInt(this.axis); var htm = []; for (var i = 0; i <= index; i++) { var ec = events[i] ? events[i].length : 0; for (var j = 0; j < ec; j++) { var e = events[i][j]; if (e) { if ((e.colSpan + i - 1) >= index) { htm.push(""); htm.push(BuildMonthDayEvent(e, day, 1)); htm.push(""); } } } } ccontent.html(htm.join("")); //click ccontent.find("div.rb-o").each(function(i) { $(this).click(dayshow); if (option.showtooltipdwm_mouseover) { $(this).mouseover(dayshow); $(this).mouseout(function() {try {$("#bbit-cs-buddle").dialog("close");}catch (e) {}}); } }); edata = events = null; var height = cc.height(); var maxleft = document.documentElement.clientWidth; var maxtop = document.documentElement.clientHeight; if (left + width >= maxleft) { left = offsetMe.left - (me.width() + 2) * 0.5; } if (top + height >= maxtop) { top = maxtop - height - 2; } var newOff = { left: left, top: top, width: width, "visibility": "visible" };//"z-index": 180, cc.css(newOff); $(document).one("click", closeCc); return false; } function dayupdate(data, start, end) { if (option.quickUpdateUrl != "" && data[8] == 1 && option.readonly != true && option.userEdit) { if (option.isloading) { return false; } option.isloading = true; var id = data[0]; var os = data[2]; var od = data[3]; var zone = new Date().getTimezoneOffset() / 60 * -1; var param = [{ "name": "calendarId", value: id }, { "name": "CalendarStartTime", value: dateFormat.call(start, "M/d/yyyy HH:mm") }, { "name": "CalendarEndTime", value: dateFormat.call(end, "M/d/yyyy HH:mm") }, { "name": "timezone", value: zone } ]; var d; if (option.quickUpdateHandler && $.isFunction(option.quickUpdateHandler)) { option.quickUpdateHandler.call(this, param); } else { option.onBeforeRequestData && option.onBeforeRequestData(4); $.post(option.quickUpdateUrl, param, function(data) { if (data) { if (data.IsSuccess == true) { option.isloading = false; option.onAfterRequestData && option.onAfterRequestData(4); } else { option.onRequestDataError && option.onRequestDataError(4, data); option.isloading = false; d = rebyKey(id, true); d[2] = os; d[3] = od; Ind(d); render(); d = null; option.onAfterRequestData && option.onAfterRequestData(4); } } }, "json"); d = rebyKey(id, true); if (d) { d[2] = start; d[3] = end; } Ind(d); render(); } } } function quickadd(start, end, isallday, pos) { if ((!option.quickAddHandler && option.quickAddUrl == "") || option.readonly || !option.userAdd) { return; } $("#bbit-cal-buddle").remove(); $(".mv_dlg").remove(); $("#bbit-cs-buddle").remove(); var buddle = $("#bbit-cal-buddle"); if (buddle.length == 0) { var temparr = []; temparr.push('
    '); temparr.push('
    ',i18n.dcmvcal.event,'
    '); temparr.push(i18n.dcmvcal.time, ':
    '); temparr.push(i18n.dcmvcal.content, ':
    '); if (dc_subjects && dc_subjects!="") { temparr.push(''); } else temparr.push(''); temparr.push('
    '); temparr.push(i18n.dcmvcal.example, '
    '); temparr.push('
    ', i18n.dcmvcal.create_event, '
    '); temparr.push(i18n.dcmvcal.update_detail, ' >>
    '); var tempquickAddHanler = temparr.join(""); temparr = null; $(document.body).append(tempquickAddHanler); try {$("#bbit-cs-buddle").dialog("close");}catch (e) {} buddle = $("#bbit-cal-buddle"); if (option.view!="nMonth") var pp = { my: "left top", at: "center bottom", collision: "fit", of: ($(".drag-chip").length>0)?$(".drag-chip"):$(".drag-lasso") }; else pp = { my: "left top", at: "center bottom", collision: "fit", of:$("#nmonths"+option.thecontainer+" .ui-state-non-active[title='"+dateFormat.call(start, i18n.dcmvcal.dateformat.fulldayvalue)+"']") }; buddle.dialog({width:300,resizable: false, position:pp }); buddle.dialog( "open" ); move_mv_dlg(); $("#bbit-cal-buddle").parent().addClass("mv_dlg"); $("
    ").appendTo($(".mv_dlg .ui-dialog-titlebar")); var calbutton = $("#bbit-cal-quickAddBTN"); var lbtn = $("#bbit-cal-editLink"); var closebtn = $("#bubbleClose1").click(function() { $("#bbit-cal-buddle").dialog( "close" ); realsedragevent(); }); calbutton.click(function(e) { if (option.isloading) { return false; } option.isloading = true; var what = $("#bbit-cal-what").val(); var datestart = $("#bbit-cal-start").val(); var dateend = $("#bbit-cal-end").val(); var allday = $("#bbit-cal-allday").val(); var f = /^[^\$\<\>]+$/.test(what); if (!f) { alert(i18n.dcmvcal.invalid_title); $("#bbit-cal-what").focus(); option.isloading = false; return false; } var zone = new Date().getTimezoneOffset() / 60 * -1; var param = [{ "name": "CalendarTitle", value: what }, { "name": "CalendarStartTime", value: datestart }, { "name": "CalendarEndTime", value: dateend }, { "name": "IsAllDayEvent", value: allday }, { "name": "location", value: ( (dc_locations && dc_locations!="")?dc_locations[0]:"") }, { "name": "timezone", value: zone}]; if (option.extParam) { for (var pi = 0; pi < option.extParam.length; pi++) { param[param.length] = option.extParam[pi]; } } if (option.quickAddHandler && $.isFunction(option.quickAddHandler)) { option.quickAddHandler.call(this, param); $("#bbit-cal-buddle").dialog( "close" ); realsedragevent(); } else { $("#bbit-cal-buddle").dialog( "close" ); var newdata = []; var tId = -1; option.onBeforeRequestData && option.onBeforeRequestData(2); $.post(option.quickAddUrl, param, function(data) { if (data) { if (data.IsSuccess == true) { option.isloading = false; newdata.push(-1, what); var sd = str_MdyyyyHHmm_todate(datestart); var ed = str_MdyyyyHHmm_todate(dateend); var diff = DateDiff("d", sd, ed); newdata.push(sd, ed, allday == "1" ? 1 : 0, diff > 0 ? 1 : 0, 0); newdata.push(-1, 0, ((dc_locations && dc_locations!="")?dc_locations[0]:""), ""); tId = Ind(newdata); option.eventItems[tId][0] = data.Data; option.eventItems[tId][8] = 1; render(); option.onAfterRequestData && option.onAfterRequestData(2); } else { option.onRequestDataError && option.onRequestDataError(2, data); option.isloading = false; option.onAfterRequestData && option.onAfterRequestData(2); } } }, "json"); realsedragevent(); render(); } }); lbtn.click(function(e) { $("#bbit-cal-buddle").dialog( "destroy" ); if (!option.EditCmdhandler) { alert("EditCmdhandler" + i18n.dcmvcal.i_undefined); } else { if (option.EditCmdhandler && $.isFunction(option.EditCmdhandler)) { option.EditCmdhandler.call(this, ['0', $("#bbit-cal-what").val(), $("#bbit-cal-start").val(), $("#bbit-cal-end").val(), $("#bbit-cal-allday").val()]); } realsedragevent(); } return false; }); buddle.mousedown(function(e) { return false }); } var dateshow = CalDateShow(start, end, !isallday, true); $("#bbit-cal-buddle-timeshow").html(dateshow); var calwhat = $("#bbit-cal-what").val(""); $("#bbit-cal-allday").val(isallday ? "1" : "0"); $("#bbit-cal-start").val(dateFormat.call(start, "M/d/yyyy HH:mm")); $("#bbit-cal-end").val(dateFormat.call(end, "M/d/yyyy HH:mm")); buddle.css({ "visibility": "visible"}); var postmp = $("#bbit-cal-buddle").dialog( "option", "position"); postmp.at = "center bottom" $("#bbit-cal-buddle").dialog( "option", "position",postmp); $("#bbit-cal-buddle").dialog( "open" ); move_mv_dlg(); calwhat.blur().focus(); //add 2010-01-26 blur() fixed chrome $(document).one("mousedown", function() { $("#bbit-cal-buddle").dialog( "close" ); realsedragevent(); }); return false; } //format datestring to Date Type function strtodate(str) { var arr = str.split(" "); var arr2 = arr[0].split(i18n.dcmvcal.dateformat.separator); var arr3 = arr[1].split(":"); var y = arr2[i18n.dcmvcal.dateformat.year_index]; var m = arr2[i18n.dcmvcal.dateformat.month_index].indexOf("0") == 0 ? arr2[i18n.dcmvcal.dateformat.month_index].substr(1, 1) : arr2[i18n.dcmvcal.dateformat.month_index]; var d = arr2[i18n.dcmvcal.dateformat.day_index].indexOf("0") == 0 ? arr2[i18n.dcmvcal.dateformat.day_index].substr(1, 1) : arr2[i18n.dcmvcal.dateformat.day_index]; var h = arr3[0].indexOf("0") == 0 ? arr3[0].substr(1, 1) : arr3[0]; var n = arr3[1].indexOf("0") == 0 ? arr3[1].substr(1, 1) : arr3[1]; return new Date(y, parseInt(m) - 1, d, h, n); } //str yyyy/m/d function datetostr(d) { return d.getFullYear()+"/"+(d.getMonth()+1)+"/"+d.getDate(); } function str_MdyyyyHHmm_todate(str) { var arr = str.split(" "); var arr2 = arr[0].split("/"); var arr3 = arr[1].split(":"); var y = arr2[2]; var m = arr2[0].indexOf("0") == 0 ? arr2[0].substr(1, 1) : arr2[0]; var d = arr2[1].indexOf("0") == 0 ? arr2[1].substr(1, 1) : arr2[1]; var h = arr3[0].indexOf("0") == 0 ? arr3[0].substr(1, 1) : arr3[0]; var n = arr3[1].indexOf("0") == 0 ? arr3[1].substr(1, 1) : arr3[1]; return new Date(y, parseInt(m) - 1, d, h, n); } function rebyKey(key, remove) { if (option.eventItems && option.eventItems.length > 0) { var sl = option.eventItems.length; var i = -1; for (var j = 0; j < sl; j++) { if (option.eventItems[j][0] == key) { i = j; break; } } if (i >= 0) { var t = option.eventItems[i]; if (remove) { option.eventItems.splice(i, 1); } return t; } } return null; } function Ind(event, i) { var d = 0; if (!i) { if (option.eventItems && option.eventItems.length > 0) { var sl = option.eventItems.length; var s = event[2]; var d1 = s.getTime() - option.eventItems[0][2].getTime(); var d2 = option.eventItems[sl - 1][2].getTime() - s.getTime(); var diff = d1 - d2; if (d1 < 0 || diff < 0) { for (var j = 0; j < sl; j++) { if (option.eventItems[j][2] >= s) { i = j; break; } } } else if (d2 < 0) { i = sl; } else { for (var j = sl - 1; j >= 0; j--) { if (option.eventItems[j][2] < s) { i = j + 1; break; } } } } else { i = 0; } } else { d = 1; } if (option.eventItems && option.eventItems.length > 0) { if (i == option.eventItems.length) { option.eventItems.push(event); } else { option.eventItems.splice(i, d, event); } } else { option.eventItems = [event]; } return i; } function ResizeView(config) { var _MH = document.documentElement.clientHeight; var _viewType = option.view; if (_viewType == "day" || _viewType == "week" || _viewType == "nDays") { var $dvwkcontaienr = $("#dvwkcontaienr"+config.thecontainer); var $dvtec = $("#dvtec"+config.thecontainer); if (($dvwkcontaienr.length == 0 || $dvtec.length == 0) && (option.rowsList=="" || (option.dayWithTime && option.view=="day")) ) { alert(i18n.dcmvcal.view_no_ready); return; } var dvwkH = $dvwkcontaienr.height() + 2; var calH = option.height - 8 - dvwkH; $dvtec.height(calH); if (typeof (option.scoll) == "undefined") { var currentday = new Date(); var h = currentday.getHours(); var m = currentday.getMinutes(); var th = gP(h, m); var ch = $dvtec.attr("clientHeight"); var sh = th - 0.5 * ch; var ph = $dvtec.attr("scrollHeight"); if (sh < 0) sh = 0; if (sh > ph - ch) sh = ph - ch - 10 * (23 - h); $dvtec.attr("scrollTop", sh); } else { $dvtec.attr("scrollTop", option.scoll); } } else if (_viewType == "month") { //Resize GridContainer } } function returnfalse() { return false; } function initevents(viewtype) { if (viewtype == "week" || viewtype == "day" || viewtype == "nDays") { $("div.chip", gridcontainer).each(function(i) { var chip = $(this); chip.click(dayshow); if (option.showtooltipdwm_mouseover) { chip.mouseover(dayshow); chip.mouseout(function() {try {$("#bbit-cs-buddle").dialog("close");}catch (e) {}}); } if (chip.hasClass("drag")) { chip.mousedown(function(e) { dragStart.call(this, "dw3", e); return false; }); //resize chip.find("div.resizer").mousedown(function(e) { dragStart.call($(this).parent().parent(), "dw4", e); return false; }); } else { chip.mousedown(returnfalse) } }); $("div.rb-o", gridcontainer).each(function(i) { var chip = $(this); chip.click(dayshow); if (option.showtooltipdwm_mouseover) { chip.mouseover(dayshow); chip.mouseout(function() {try {$("#bbit-cs-buddle").dialog("close");}catch (e) {}}); } if (chip.hasClass("drag") && (viewtype == "week" || viewtype == "nDays" ) ) { //drag; chip.mousedown(function(e) { dragStart.call(this, {dw5:"dw5",row:chip.attr("row")}, e); return false; }); } else { chip.mousedown(returnfalse) } }); if (option.readonly == false && option.userAdd) { $("td.tg-col", gridcontainer).each(function(i) { $(this).mousedown(function(e) { dragStart.call(this, "dw1", e); return false; }); }); $("#weekViewAllDaywk"+option.thecontainer).mousedown(function(e) { dragStart.call(this, "dw2", e); return false; }); if ( !(option.rowsList=="" || (option.dayWithTime && option.view=="day")) ) for (var i=0;i l / 2 + 1) { pw++; } var xa = []; var ya = []; var di = 0; for (var i = 0; i < l; i++) { xa.push({ s: i * pw + left, e: (i + 1) * pw + left }); if (moffset.left >= xa[i].s && moffset.left < xa[i].e) { di = i; } } var fdi = { x: di, y: 0, di: di }; ya.push({ s: top, e: top + h }); var data = getdata(obj); var dp = DateDiff("d", data[2], data[3]) + 1; _dragdata = { type: 6, target: obj, sx: e.pageX, sy: e.pageY, data: data, xa: xa, ya: ya, fdi: fdi, h: h, dp: dp, pw: pw }; //}catch (e) {} break; case "m1": var w = obj.width(); var offset = obj.offset(); var left = offset.left; var top = offset.top; var l = __VIEWWEEKDAYSTOTAL; var yl = obj.children().length; var py = w % l; var pw = parseInt(w / l); if (py > l / 2 + 1) { pw++; } var h = $("#mvrow"+option.thecontainer+"_0").height(); /**var xa = []; var ya = []; for (var i = 0; i < l; i++) { xa.push({ s: i * pw + left, e: (i + 1) * pw + left }); }*/ var xa = []; var ya = []; for (var i = 0; i < l; i++) { xa.push({ s: i * pw + left, e: (i + 1) * pw + left }); } for (var i = 0; i < yl; i++) { ya.push({ s: i * h + top, e: (i + 1) * h + top }); } _dragdata = { type: 3, target: obj, sx: e.pageX, sy: e.pageY, pw: pw, xa: xa, ya: ya, h: h }; break; case "m2": var row0 = $("#mvrow"+option.thecontainer+"_0"); var row1 = $("#mvrow"+option.thecontainer+"_1"); var w = row0.width(); var offset = row0.offset(); var diffset = row1.offset(); var moffset = obj.offset(); var h = diffset.top - offset.top; var left = offset.left; var top = offset.top; var l = 7; var yl = row0.parent().children().length; var py = w % l; var pw = parseInt(w / l); if (py > l / 2 + 1) { pw++; } var xa = []; var ya = []; var xi = 0; var yi = 0; for (var i = 0; i < l; i++) { xa.push({ s: i * pw + left, e: (i + 1) * pw + left }); if (moffset.left >= xa[i].s && moffset.left < xa[i].e) { xi = i; } } for (var i = 0; i < yl; i++) { ya.push({ s: i * h + top, e: (i + 1) * h + top }); if (moffset.top >= ya[i].s && moffset.top < ya[i].e) { yi = i; } } var fdi = { x: xi, y: yi, di: yi * 7 + xi }; var data = getdata(obj); var dp = DateDiff("d", data[2], data[3]) + 1; _dragdata = { type: 7, target: obj, sx: e.pageX, sy: e.pageY, data: data, xa: xa, ya: ya, fdi: fdi, h: h, dp: dp, pw: pw }; break; } $('body').noSelect(); } function dragMove(e) { if (_dragdata) { //if (e.pageX < 0 || e.pageY < 0 // || e.pageX > document.documentElement.clientWidth // || e.pageY >= document.documentElement.clientHeight) { // dragEnd(e); // return false; //} var d = _dragdata; switch (d.type) { case 1: var sy = d.sy; var y = e.pageY; var diffy = y - sy; if (diffy > 11 || diffy < -11 || d.cpwrap) { if (diffy == 0) { diffy = 21; } var dy = diffy % 21; if (dy != 0) { diffy = dy > 0 ? diffy + 21 - dy : diffy - 21 - dy; y = d.sy + diffy; if (diffy < 0) { sy = sy + 21; } } if (!d.tp) { d.tp = $(d.target).offset().top; } var gh = gH(sy, y, d.tp); var ny = gP(gh.sh, gh.sm); var tempdata; if (!d.cpwrap) { tempdata = buildtempdayevent(gh.sh, gh.sm, gh.eh, gh.em, gh.h); var cpwrap = $("
    ").html(tempdata); $(d.target).find("div.tg-col-overlaywrapper").append(cpwrap); d.cpwrap = cpwrap; } else { if (d.cgh.sh != gh.sh || d.cgh.eh != gh.eh || d.cgh.sm != gh.sm || d.cgh.em != gh.em) { tempdata = buildtempdayevent(gh.sh, gh.sm, gh.eh, gh.em, gh.h); d.cpwrap.css("top", ny + "px").html(tempdata); } } d.cgh = gh; } break; case 2: var sx = d.sx; var x = e.pageX; var diffx = x - sx; if (diffx > 5 || diffx < -5 || d.lasso) { if (!d.lasso) { d.lasso = $("
    "); $(document.body).append(d.lasso); } if (!d.sdi) { d.sdi = getdi(d.xa, d.ya, sx, d.sy); } var ndi = getdi(d.xa, d.ya, x, e.pageY); if (!d.fdi || d.fdi.di != ndi.di) { addlasso(d.lasso, d.sdi, ndi, d.xa, d.ya, d.h); } d.fdi = ndi; } break; case 3: var sx = d.sx; var x = e.pageX; var sy = d.sy; var y = e.pageY; var diffx = x - sx; var diffy = y - sy; if (diffx > 5 || diffx < -5 || diffy < -5 || diffy > 5 || d.lasso) { if (!d.lasso) { d.lasso = $("
    "); $(document.body).append(d.lasso); } if (!d.sdi) { d.sdi = getdi(d.xa, d.ya, sx, sy); } var ndi = getdi(d.xa, d.ya, x, y); if (!d.fdi || d.fdi.di != ndi.di) { addlasso(d.lasso, d.sdi, ndi, d.xa, d.ya, d.h); } d.fdi = ndi; } break; case 4: var data = d.data; if (data != null && data[8] == 1) { var sx = d.sx; var x = e.pageX; var sy = d.sy; var y = e.pageY; var diffx = x - sx; var diffy = y - sy; if (diffx > 5 || diffx < -5 || diffy > 5 || diffy < -5 || d.cpwrap) { var gh, ny, tempdata; if (!d.cpwrap) { gh = { sh: data[2].getHours(), sm: data[2].getMinutes(), eh: data[3].getHours(), em: data[3].getMinutes(), h: d.h }; d.target.hide(); ny = gP(gh.sh, gh.sm); d.top = ny; tempdata = buildtempdayevent(gh.sh, gh.sm, gh.eh, gh.em, gh.h, data[1], false, false, data[7]); var cpwrap = $("
    ").html(tempdata); var evid = d.target.parent().attr("id").replace("tgCol"+option.thecontainer, "#tgOver"+option.thecontainer); $(evid).append(cpwrap); d.cpwrap = cpwrap; d.ny = ny; } else { var pd = 0; if (x < d.pXMin) { pd = -1; } else if (x > d.pXMax) { pd = 1; } if (pd != 0) { d.cdi = d.cdi + pd; var ov = $("#tgOver"+option.thecontainer + d.cdi); if (ov.length == 1) { d.pXMin = d.pXMin + d.pw * pd; d.pXMax = d.pXMax + d.pw * pd; ov.append(d.cpwrap); } else { d.cdi = d.cdi - pd; } } ny = d.top + diffy; var pny = ny % 21; if (pny != 0) { ny = ny - pny; } if (d.ny != ny) { //log.info("ny=" + ny); gh = gW(ny, ny + d.h); //log.info("sh=" + gh.sh + ",sm=" + gh.sm); tempdata = buildtempdayevent(gh.sh, gh.sm, gh.eh, gh.em, gh.h, data[1], false, false, data[7]); d.cpwrap.css("top", ny + "px").html(tempdata); } d.ny = ny; } } } break; case 5: var data = d.data; if (data != null && data[8] == 1) { var sy = d.sy; var y = e.pageY; var diffy = y - sy; if (diffy != 0 || d.cpwrap) { var gh, ny, tempdata; if (!d.cpwrap) { gh = { sh: data[2].getHours(), sm: data[2].getMinutes(), eh: data[3].getHours(), em: data[3].getMinutes(), h: d.h }; d.target.hide(); ny = gP(gh.sh, gh.sm); d.top = ny; tempdata = buildtempdayevent(gh.sh, gh.sm, gh.eh, gh.em, gh.h, data[1], "100%", true, data[7]); var cpwrap = $("
    ").html(tempdata); var evid = d.target.parent().attr("id").replace("tgCol"+option.thecontainer, "#tgOver"+option.thecontainer); $(evid).append(cpwrap); d.cpwrap = cpwrap; } else { nh = d.h + diffy; var pnh = nh % 21; nh = pnh > 1 ? nh - pnh + 21 : nh - pnh; if (d.nh != nh) { var sp = gP(data[2].getHours(), data[2].getMinutes()); var ep = sp + nh; gh = gW(d.top, d.top + nh); tempdata = buildtempdayevent(gh.sh, gh.sm, gh.eh, gh.em, gh.h, data[1], "100%", true, data[7]); d.cpwrap.html(tempdata); } d.nh = nh; } } } break; case 6: var sx = d.sx; var x = e.pageX; var y = e.pageY; var diffx = x - sx; if (diffx > 5 || diffx < -5 || d.lasso) { if (!d.lasso) { var w1 = d.dp > 1 ? (d.pw - 4) * 1.5 : (d.pw - 4); var cp = d.target.clone(); if (d.dp > 1) { cp.find("div.rb-i>span").prepend("(" + d.dp + " " + i18n.dcmvcal.day_plural + ") "); } var cpwrap = $("
    ").append(cp).appendTo(document.body); d.cpwrap = cpwrap; d.lasso = $("
    "); $(document.body).append(d.lasso); cp = cpwrap = null; } fixcppostion(d.cpwrap, e, d.xa, d.ya); var ndi = getdi(d.xa, d.ya, x, e.pageY); if (!d.cdi || d.cdi.di != ndi.di) { addlasso(d.lasso, ndi, { x: ndi.x, y: ndi.y, di: ndi.di + d.dp - 1 }, d.xa, d.ya, d.h); } d.cdi = ndi; } break; case 7: var sx = d.sx; var sy = d.sy; var x = e.pageX; var y = e.pageY; var diffx = x - sx; var diffy = y - sy; if (diffx > 5 || diffx < -5 || diffy > 5 || diffy < -5 || d.lasso) { if (!d.lasso) { var w1 = d.dp > 1 ? (d.pw - 4) * 1.5 : (d.pw - 4); var cp = d.target.clone(); if (d.dp > 1) { cp.find("div.rb-i>span").prepend("(" + d.dp + " " + i18n.dcmvcal.day_plural + ") "); } var cpwrap = $("
    ").append(cp).appendTo(document.body); d.cpwrap = cpwrap; d.lasso = $("
    "); $(document.body).append(d.lasso); cp = cpwrap = null; } fixcppostion(d.cpwrap, e, d.xa, d.ya); var ndi = getdi(d.xa, d.ya, x, e.pageY); if (!d.cdi || d.cdi.di != ndi.di) { addlasso(d.lasso, ndi, { x: ndi.x, y: ndi.y, di: ndi.di + d.dp - 1 }, d.xa, d.ya, d.h); } d.cdi = ndi; } break; } } return false; } function dragEnd(e) { if (_dragdata) { var d = _dragdata; switch (d.type) { case 1: //day view var wrapid = new Date().getTime(); tp = d.target.offset().top; if (!d.cpwrap) { var gh = gH(d.sy, d.sy + option.cellheight, tp); var ny = gP(gh.sh, gh.sm); var tempdata = buildtempdayevent(gh.sh, gh.sm, gh.eh, gh.em, gh.h); d.cpwrap = $("
    ").html(tempdata); $(d.target).find("div.tg-col-overlaywrapper").append(d.cpwrap); d.cgh = gh; } var pos = d.cpwrap.offset(); pos.left = pos.left + 30; d.cpwrap.attr("id", wrapid); var start = strtodate(d.target.attr("abbr") + " " + d.cgh.sh + ":" + d.cgh.sm); var end = strtodate(d.target.attr("abbr") + " " + d.cgh.eh + ":" + d.cgh.em); _dragevent = function() { $("#" + wrapid).remove(); $("#bbit-cal-buddle").dialog( "close" ); }; quickadd(start, end, false, pos); break; case 2: //week view case 3: //month view var source = e.srcElement || e.target; var lassoid = new Date().getTime(); if (!d.lasso) { if ($(source).hasClass("monthdayshow")) { weekormonthtoday.call($(source).parent()[0],e); break; } d.fdi = d.sdi = getdi(d.xa, d.ya, d.sx, d.sy); d.lasso = $("
    "); $(document.body).append(d.lasso); addlasso(d.lasso, d.sdi, d.fdi, d.xa, d.ya, d.h); } d.lasso.attr("id", lassoid); var si = Math.min(d.fdi.di, d.sdi.di); var ei = Math.max(d.fdi.di, d.sdi.di); var firstday = option.vstart; var zz = 0; for (var p=0; (p<=si);) { var x = DateAdd("d", zz, firstday); p += __VIEWWEEKDAYS[x.getDay()]; zz++; } zz--; si = zz; ei = zz; var start = DateAdd("d", si, firstday); var end = DateAdd("d", ei, firstday); _dragevent = function() { $("#" + lassoid).remove(); }; quickadd(start, end, true, { left: e.pageX, top: e.pageY }); break; case 4: // event moving if (d.cpwrap) { var start = DateAdd("d", d.cdi, option.vstart); var end = DateAdd("d", d.cdi, option.vstart); var gh = gW(d.ny, d.ny + d.h); start.setHours(gh.sh, gh.sm); end.setHours(gh.eh, gh.em); if (start.getTime() == d.data[2].getTime() && end.getTime() == d.data[3].getTime()) { d.cpwrap.remove(); d.target.show(); } else { dayupdate(d.data, start, end); } } break; case 5: //Resize if (d.cpwrap) { var start = new Date(d.data[2].toString()); var end = new Date(d.data[3].toString()); var gh = gW(d.top, d.top + nh); start.setHours(gh.sh, gh.sm); end.setHours(gh.eh, gh.em); if (start.getTime() == d.data[2].getTime() && end.getTime() == d.data[3].getTime()) { d.cpwrap.remove(); d.target.show(); } else { dayupdate(d.data, start, end); } } break; case 6: case 7: if (d.lasso) { d.cpwrap.remove(); d.lasso.remove(); var start = new Date(d.data[2].toString()); var end = new Date(d.data[3].toString()); var currrentdate = DateAdd("d", d.cdi.di, option.vstart); var diff = DateDiff("d", start, currrentdate); start = DateAdd("d", diff, start); end = DateAdd("d", diff, end); if (start.getTime() != d.data[2].getTime() || end.getTime() != d.data[3].getTime()) { dayupdate(d.data, start, end); } } break; } d = _dragdata = null; $('body').noSelect(false); return false; } } function getdi(xa, ya, x, y) { var ty = 0; var tx = 0; var lx = 0; var ly = 0; if (xa && xa.length != 0) { lx = xa.length; if (x >= xa[lx - 1].e) { tx = lx - 1; } else { for (var i = 0; i < lx; i++) { if (x > xa[i].s && x <= xa[i].e) { tx = i; break; } } } } if (ya && ya.length != 0) { ly = ya.length; if (y >= ya[ly - 1].e) { ty = ly - 1; } else { for (var j = 0; j < ly; j++) { if (y > ya[j].s && y <= ya[j].e) { ty = j; break; } } } } return { x: tx, y: ty, di: ty * lx + tx }; } function addlasso(lasso, sdi, edi, xa, ya, height) { var diff = sdi.di > edi.di ? sdi.di - edi.di : edi.di - sdi.di; diff++; var sp = sdi.di > edi.di ? edi : sdi; var ep = sdi.di > edi.di ? sdi : edi; var l = xa.length > 0 ? xa.length : 1; var h = ya.length > 0 ? ya.length : 1; var play = []; var width = xa[0].e - xa[0].s+1; var i = sp.x; var j = sp.y; var max = Math.min(document.documentElement.clientWidth, xa[l - 1].e) - 2; while (j < h && diff > 0) { var left = xa[i].s; var d = i + diff > l ? l - i : diff; var wid = width * d; //while (left + wid >= max) { // wid--; //} play.push(Tp(__LASSOTEMP, { left: left+1, top: ya[j].s+4, height: height, width: wid })); i = 0; diff = diff - d; j++; } lasso.html(play.join("")); } function fixcppostion(cpwrap, e, xa, ya) { var x = e.pageX - 6; var y = e.pageY - 4; var w = cpwrap.width(); var h = 21; var lmin = xa[0].s + 6; var tmin = ya[0].s + 4; var lmax = xa[xa.length - 1].e - w - 2; var tmax = ya[ya.length - 1].e - h - 2; if (x > lmax) { x = lmax; } if (x <= lmin) { x = lmin + 1; } if (y <= tmin) { y = tmin + 1; } if (y > tmax) { y = tmax; } cpwrap.css({ left: x, top: y }); } $(document) .mousemove(dragMove) .mouseup(dragEnd); //.mouseout(dragEnd); var c = { sv: function(view) { //switch view if (view == option.view) { return; } clearcontainer(); option.view = view; render(); dochange(); }, rf: function() { populate(); }, gt: function(d) { if (!d) { d = new Date(); } option.showday = d; render(); dochange(); }, pv: function() { switch (option.view) { case "day": option.showday = DateAdd("d", -1, option.showday); break; case "week": option.showday = DateAdd("w", -1, option.showday); break; case "nDays": option.showday = DateAdd("d",(-1 * option.numberOfDays), option.showday); break; case "month": case "nMonth": option.showday = DateAdd("m", -1, option.showday); break; } render(); dochange(); }, nt: function() { switch (option.view) { case "day": option.showday = DateAdd("d", 1, option.showday); break; case "week": option.showday = DateAdd("w", 1, option.showday); break; case "nDays": option.showday = DateAdd("d", option.numberOfDays, option.showday); break; case "month": case "nMonth": var od = option.showday.getDate(); option.showday = DateAdd("m", 1, option.showday); var nd = option.showday.getDate(); if(od !=nd) //we go to the next month { option.showday= DateAdd("d", 0-nd, option.showday); //last day of last month } break; } render(); dochange(); }, go: function() { return option; }, so: function(p) { option = $.extend(option, p); } }; this[0].bcal = c; return this; }; /** * @description {Method} swtichView To switch to another view. * @param {String} view View name, one of 'day', 'week', 'month'. */ $.fn.swtichView = function(view) { $(".mv_dlg").remove(); return this.each(function() { if (this.bcal) { this.bcal.sv(view); } }) }; /** * @description {Method} reload To reload event of current time range. */ $.fn.reload = function() { return this.each(function() { if (this.bcal) { this.bcal.rf(); } }) }; /** * @description {Method} gotoDate To go to a range containing date. * If view is week, it will go to a week containing date. * If view is month, it will got to a month containing date. * @param {Date} date. Date to go. */ $.fn.gotoDate = function(d) { return this.each(function() { if (this.bcal) { this.bcal.gt(d); } }) }; /** * @description {Method} previousRange To go to previous date range. * If view is week, it will go to previous week. * If view is month, it will got to previous month. */ $.fn.previousRange = function() { return this.each(function() { if (this.bcal) { this.bcal.pv(); } }) }; /** * @description {Method} nextRange To go to next date range. * If view is week, it will go to next week. * If view is month, it will got to next month. */ $.fn.nextRange = function() { return this.each(function() { if (this.bcal) { this.bcal.nt(); } }) }; $.fn.BcalGetOp = function() { if (this[0].bcal) { return this[0].bcal.go(); } return null; }; $.fn.BcalSetOp = function(p) { if (this[0].bcal) { return this[0].bcal.so(p); } }; })(jQuery); ; (function(a) { a.alerts = { verticalOffset: -75, horizontalOffset: 0, repositionOnResize: true, overlayOpacity: 0.50, overlayColor: "#FFF", draggable: true, okButton: "OK", cancelButton: "Cancel", dialogClass: null, alert: function(b, c, d) { if (c == null) { c = "OK" } a.alerts._show(c, b, null, "alert", function(e) { if (d) { d(e) } }, null, null, null, null) }, confirm: function(b, c, d) { if (c == null) { c = "Are you sure" } a.alerts._show(c, b, null, "confirm", function(e) { if (d) { d(e) } }, null, null, null, null) }, prompt: function(b, c, d, e) { if (d == null) { d = "Please enter something" } a.alerts._show(d, b, c, "prompt", function(f) { if (e) { e(f) } }, null, null, null, null) }, openBox: function(f, g, b, c, e, d, i) { if (g == null) { g = "Information" } a.alerts._show(g, f, null, "openBox", function(h) { if (i) { i(h) } }, b, c, e, d) }, overAlert: function(c, b) { a.alerts._overShow(c, b) }, _overShow: function(d, c) { if (c == null) { c = 3000 } var b = c + 600; a("body").append(''); a("#over_message").text(d).html(a("#over_message").text().replace(/\n/g, "
    ")); if (a.alerts.dialogClass) { a("#over_container").addClass(a.alerts.dialogClass) } var e = (a.browser.msie && parseInt(a.browser.version) <= 6) ? "absolute" : "fixed"; a("#over_container").css({ position: e, zIndex: 99999, width: 350, padding: 0, margin: 0 }).show("fast"); a("#over_container").css({ minWidth: a("#over_container").outerWidth(), maxWidth: a("#over_container").outerWidth() }); a.alerts._overReposition(); setTimeout(function() { a("#over_container").hide("fast") }, c); setTimeout(function() { a("#over_container").remove() }, b) }, _overReposition: function() { var c = 4; var b = ((a(window).width() / 2) - (a("#over_container").outerWidth() / 2)) + a.alerts.horizontalOffset; if (c < 0) { c = 0 } if (b < 0) { b = 0 } if (a.browser.msie && parseInt(a.browser.version) <= 6) { c = c + a(window).scrollTop() } if (a.browser.msie && parseInt(a.browser.version) <= 6) { b = b - 175 } a("#over_container").css({ top: c + "px", left: b + "px" }); a("#popup_overlay").height(a(document).height()) }, _show: function(j, b, k, g, m, l, c, f, n) { a.alerts._hide(); a.alerts._overlay("show"); a("body").append(''); if (a.alerts.dialogClass) { a("#popup_container").addClass(a.alerts.dialogClass) } var i = (a.browser.msie && parseInt(a.browser.version) <= 6) ? "absolute" : "fixed"; a("#popup_container").css({ position: i, zIndex: 99999, padding: 0, margin: 0 }).show(); a("#popup_title").text(j); a("#popup_content").addClass(g); if (g != "openBox") { a("#popup_message").text(b).html(a("#popup_message").text().replace(/\n/g, "
    ")) } a("#popup_container").css({}); a.alerts._reposition(); a.alerts._maintainPosition(true); switch (g) { case "alert": a("#popup_message").after(''); a("#popup_ok").click(function() { a.alerts._hide(); m(true) }); a("#popup_ok").focus().keypress(function(h) { if (h.keyCode == 13 || h.keyCode == 27) { a("#popup_ok").trigger("click") } }); break; case "confirm": a("#popup_message").after(''); a("#popup_ok").click(function() { a.alerts._hide(); if (m) { m(true) } }); a("#popup_cancel").click(function() { a.alerts._hide(); if (m) { m(false) } }); a("#popup_ok").focus(); a("#popup_ok, #popup_cancel").keypress(function(h) { if (h.keyCode == 13) { a("#popup_ok").trigger("click") } if (h.keyCode == 27) { a("#popup_cancel").trigger("click") } }); break; case "prompt": a("#popup_message").append('
    ').after(''); a("#popup_prompt").width(a("#popup_message").width() - 10); a("#popup_ok").click(function() { var e = a("#popup_prompt").val(); a.alerts._hide(); if (m) { m(e) } }); a("#popup_cancel").click(function() { a.alerts._hide(); if (m) { m(null) } }); a("#popup_prompt, #popup_ok, #popup_cancel").keypress(function(h) { if (h.keyCode == 13) { a("#popup_ok").trigger("click") } if (h.keyCode == 27) { a("#popup_cancel").trigger("click") } }); if (k) { a("#popup_prompt").val(k) } a("#popup_prompt").focus().select(); break; case "openBox": a("#popup_message").append(a(b).html()); if (l) { a("#popup_container").css({ width: l + "px" }) } if (c) { a("#popup_container").css({ height: c + "px" }); a("#popup_message").css({ height: (c - 48) + "px" }) } a.alerts._reposition(); if (f) { a(f).click(function() { a.alerts._hide(); if (m) { m(true) } }) } if (n) { a(n).click(function() { a.alerts._hide(); return false; if (m) { m(false) } }) } break } a("#popup_close").click(function() { a.alerts._hide(); if (m) { m() } }); if (a.alerts.draggable) { try { a("#popup_container").draggable({ handle: a("#popup_title") }); a("#popup_title").css({ cursor: "move" }) } catch (d) { } } }, _hide: function() { a("#popup_container").remove(); a.alerts._overlay("hide"); a.alerts._maintainPosition(false) }, _overlay: function(b) { switch (b) { case "show": a.alerts._overlay("hide"); a("BODY").append(''); a("#popup_overlay").css({ position: "absolute", zIndex: 99998, top: "0px", left: "0px", width: "100%", height: a(document).height(), background: a.alerts.overlayColor, opacity: a.alerts.overlayOpacity }); break; case "hide": a("#popup_overlay").remove(); break } }, _reposition: function() { var c = ((a(window).height() / 2) - (a("#popup_container").height() / 2)) + a.alerts.verticalOffset; var b = ((a(window).width() / 2) - (a("#popup_container").width() / 2)) + a.alerts.horizontalOffset; if (c < 0) { c = 0 } if (b < 0) { b = 0 } if (a.browser.msie && parseInt(a.browser.version) <= 6) { c = c + a(window).scrollTop() } a("#popup_container").css({ top: c + "px", left: b + "px" }); a("#popup_overlay").height(a(document).height()) }, _maintainPosition: function(b) { if (a.alerts.repositionOnResize) { switch (b) { case true: a(window).bind("resize", a.alerts._reposition); break; case false: a(window).unbind("resize", a.alerts._reposition); break } } } }; hiAlert = function(b, c, d) { a.alerts.alert(b, c, d) }; hiConfirm = function(b, c, d) { a.alerts.confirm(b, c, d) }; hiPrompt = function(b, c, d, e) { a.alerts.prompt(b, c, d, e) }; hiBox = function(f, g, b, c, e, d, i) { a.alerts.openBox(f, g, b, c, e, d, i) }; hiOverAlert = function(c, b) { a.alerts.overAlert(c, b) } })(jQuery); ; $jc = jQuery.noConflict(); function initMultiViewCal(container,calendarId,config) { $jc(document).ready(function($jc) { (function( $jc ) { var def = { numberOfMonths:6, viewNew : config.bnew, viewToday : config.btoday, viewDay : false, viewWeek : false, viewMonth : false, viewNMonth : false, viewNDays : false, numberOfDays : 10, viewRefresh : config.brefresh, viewNavigation : config.bnavigation, view: config.viewdefault, //'day','week','month','nMonth','nDays' weekstartday:config.start_weekday, showtooltip:false, tooltipon:1, shownavigate:false, navigateurl:config.url, target:0, cssStyle:"ui-darkness", readonly:!config.edition, nmonths:12, dialogWidth:300, dialogCloseAuto:false, height:0, showtooltipdwm:false, viewWeekDays:[1,1,1,1,1,1,1], militaryTime:true, path:"", hoursStart:0, hoursEnd:23, cellheight:42, rowsByCategory:"", rowsList:"", dayWithColumns:"", dayWithTime:true, thecontainer:container, userAdd:false, userEdit:false, userDel:false, userEditOwner:true, userDelOwner:true, userOwner:43, columnsList:false, rowsList:false, palette:0, paletteDefault:"f00" } if (config.rowsByCategory!="" && !config.dayWithTime) config.dayWithTime = false; config = $jc.extend(def, config); if (!config.userAdd) config.viewNew = false; var tabs = 0; if (config.viewNew && !config.readonly) tabs++; if (config.viewToday) tabs++; if (config.viewDay) tabs++; if (config.viewWeek) tabs++; if (config.viewMonth) tabs++; if (config.viewNDays) tabs++; if (config.viewNMonth) tabs++; if (config.viewRefresh) tabs++; if (config.viewNavigation) tabs++; var string = '
    '+ ((tabs>1)? '
    '+ ((config.viewNew && !config.readonly)? '
    '+ '
    '+i18n.dcmvcal.new_event+'
    '+ '
    ':'')+ ((config.viewRefresh)? '
    '+ '
    '+i18n.dcmvcal.refresh+'
    '+ '
    ':'')+ ((config.viewToday)? '
    '+ '
    '+ '
    '+i18n.dcmvcal.today+'
    '+ '
    ':'')+ ((config.viewDay)? '
    '+ '
    '+ '
    '+i18n.dcmvcal.sday+'
    '+ '
    ':'')+ ((config.viewNDays)? '
    '+ '
    '+i18n.dcmvcal.ndays+'
    '+ '
    ':'')+ ((config.viewWeek)? '
    '+ '
    '+i18n.dcmvcal.week+'
    '+ '
    ':'')+ ((config.viewMonth)? '
    '+ '
    '+i18n.dcmvcal.month+'
    '+ '
    ':'')+ ((config.viewNMonth)? '
    '+ '
    '+i18n.dcmvcal.nmonth+'
    '+ '
    ':'')+ ((config.viewNavigation)? '
    '+ '
    '+ ' '+ '
    '+ '
    '+ ' '+ '
    '+ '
    '+ '
    '+ ' '+ ' '+i18n.dcmvcal.loading+''+ '
    '+ '
    ':'')+ ((config.export_ical_button)? '
    '+ '
    iCal
    '+ '
    ':'')+ '
    ':'')+ '
    '+ '
    '+ '
    '+ '
    '+ ' '+ ' '+ '
    '+ '
    '+ '
    '; var $container = $jc("#"+container); $container.html(string); var DATA_FEED_URL = pathCalendar+"/php/datafeed.php?1=1"; var DATA_EDIT_URL = pathCalendar+"/php/edit.php?month_index="+i18n.dcmvcal.dateformat.month_index+"&delete="+((config.userDel)?"1":"0")+"&palette="+config.palette+"&paletteDefault="+config.paletteDefault+"&calid="+calendarId; var op = { numberOfMonths:config.numberOfMonths, view: config.view, readonly:config.readonly, weekstartday: config.weekstartday, showtooltip:config.showtooltip, tooltipon:config.tooltipon, shownavigate:config.shownavigate, navigateurl:config.navigateurl, target:config.target, showday: new Date(), EditCmdhandler:Edit, DeleteCmdhandler:Delete, ViewCmdhandler:View, onWeekOrMonthToDay:wtd, onBeforeRequestData: cal_beforerequest, onAfterRequestData: cal_afterrequest, onRequestDataError: cal_onerror, autoload:true, url: DATA_FEED_URL + "&method=list&calid="+calendarId, quickAddUrl: DATA_FEED_URL + "&month_index="+i18n.dcmvcal.dateformat.month_index+"&method=add&calid="+calendarId, quickUpdateUrl: DATA_FEED_URL + "&method=update&calid="+calendarId, quickDeleteUrl: DATA_FEED_URL + "&method=remove&calid="+calendarId, dialogWidth:config.dialogWidth, dialogCloseAuto:config.dialogCloseAuto, height:config.height }; op = $jc.extend(config, op); if (op.startdate && (op.startdate.length>=8) && (op.startdate.length<=10)) { var i = op.startdate.split("-"); op.startdate = new Date(i[0]*1,i[1]*1-1,i[2]*1); op.showday = op.startdate; } else op.mindate = ""; if (op.mindate && (op.mindate.length>=8) && (op.mindate.length<=10)) { var i = op.mindate.split("-"); op.mindate = new Date(i[0]*1,i[1]*1-1,i[2]*1); } else op.mindate = ""; if (op.maxdate && (op.maxdate.length>=8) && (op.maxdate.length<=10)) { var i = op.maxdate.split("-"); op.maxdate = new Date(i[0]*1,i[1]*1-1,i[2]*1); } else op.maxdate = ""; var $dv = $jc("#calhead"+op.thecontainer); var _MH = document.documentElement.clientHeight; var dvH = $dv.height() + 2; //op.height = _MH - dvH; //op.height = "100%"; op.eventItems =[]; //setTimeout("alert('ok')",3000); var p = $jc("#gridcontainer"+op.thecontainer).bcalendar(op).BcalGetOp(); if (p && p.datestrshow) { $jc("#txtdatetimeshow"+op.thecontainer).text(p.datestrshow); } $jc("#caltoolbar"+op.thecontainer).noSelect(); try { $jc("#hdtxtshow"+op.thecontainer).datepicker({ picker: "#txtdatetimeshow"+op.thecontainer, showtarget: $jc("#txtdatetimeshow"+op.thecontainer), onReturn:function(r){ var p = $jc("#gridcontainer"+op.thecontainer).gotoDate(r).BcalGetOp(); if (p && p.datestrshow) { $jc("#txtdatetimeshow"+op.thecontainer).text(p.datestrshow); } } }); } catch(e){}; function cal_beforerequest(type) { var t=i18n.dcmvcal.loading_data; switch(type) { case 1: t=i18n.dcmvcal.loading_data; break; case 2: case 3: case 4: t=i18n.dcmvcal.request_processed; break; } $jc("#errorpannel"+op.thecontainer).hide(); $jc("#loadingpannel"+op.thecontainer).html(t); $jc("#loadingpannel"+op.thecontainer).show(); } function cal_afterrequest(type) { switch(type) { case 1: $jc("#loadingpannel"+op.thecontainer).hide(); break; case 2: case 3: case 4: $jc("#loadingpannel"+op.thecontainer).html(i18n.dcmvcal.success); window.setTimeout(function(){ $jc("#loadingpannel"+op.thecontainer).hide();},2000); break; } } function cal_onerror(type,data) { if (type!=2) $jc("#errorpannel"+op.thecontainer).show(); if (data.Msg=='OVERLAPPING') alert(i18n.dcmvcal.error_overlapping); else alert(data.Msg); } function Edit(data) { var eurl=DATA_EDIT_URL+"&r="+Math.random()+"&mt="+(config.militaryTime?"true":"false")+"&css="+config.cssStyle+"&lang="+config.language+"&weekstartday="+config.weekstartday+"&hoursStart="+config.hoursStart+"&hoursEnd="+config.hoursEnd+"&id={0}&start={2}&end={3}&isallday={4}&title={1}"; if(data) { var url = StrFormat(eurl,data); showEditEvent(url); } } function View(data) { var str = ""; $jc.each(data, function(i, item){ str += "[" + i + "]: " + item + "\n"; }); } function Delete(data,callback) { $jc.alerts.okButton=i18n.dcmvcal.ok; $jc.alerts.cancelButton=i18n.dcmvcal.cancel; hiConfirm(i18n.dcmvcal.are_you_sure_delete, 'Confirm',function(r){ r && callback(0,data[0]);}); } function wtd(p) { if (p && p.datestrshow) { $jc("#txtdatetimeshow"+op.thecontainer).text(p.datestrshow); } $jc("#caltoolbar"+op.thecontainer+" div.ui-state-active").each(function() { $jc(this).removeClass("ui-state-active"); }) $jc("#showdaybtn"+op.thecontainer).addClass("ui-state-active"); } //to show day view try { $jc("#showdaybtn"+op.thecontainer).click(function(e) { $jc("#caltoolbar"+op.thecontainer+" div.ui-state-active").each(function() { $jc(this).removeClass("ui-state-active"); }) $jc(this).addClass("ui-state-active"); var p = $jc("#gridcontainer"+op.thecontainer).swtichView("day").BcalGetOp(); if (p && p.datestrshow) { $jc("#txtdatetimeshow"+op.thecontainer).text(p.datestrshow); } }); } catch(e){}; //to show week view try { $jc("#showweekbtn"+op.thecontainer).click(function(e) { $jc("#caltoolbar"+op.thecontainer+" div.ui-state-active").each(function() { $jc(this).removeClass("ui-state-active"); }) $jc(this).addClass("ui-state-active"); var p = $jc("#gridcontainer"+op.thecontainer).swtichView("week").BcalGetOp(); if (p && p.datestrshow) { $jc("#txtdatetimeshow"+op.thecontainer).text(p.datestrshow); } }); } catch(e){}; //to show month view try { $jc("#showmonthbtn"+op.thecontainer).click(function(e) { $jc("#caltoolbar"+op.thecontainer+" div.ui-state-active").each(function() { $jc(this).removeClass("ui-state-active"); }) $jc(this).addClass("ui-state-active"); var p = $jc("#gridcontainer"+op.thecontainer).swtichView("month").BcalGetOp(); if (p && p.datestrshow) { $jc("#txtdatetimeshow"+op.thecontainer).text(p.datestrshow); } }); } catch(e){}; //to show nDays view try { $jc("#shownDaysbtn"+op.thecontainer).click(function(e) { $jc("#caltoolbar"+op.thecontainer+" div.ui-state-active").each(function() { $jc(this).removeClass("ui-state-active"); }) $jc(this).addClass("ui-state-active"); var p = $jc("#gridcontainer"+op.thecontainer).swtichView("nDays").BcalGetOp(); if (p && p.datestrshow) { $jc("#txtdatetimeshow"+op.thecontainer).text(p.datestrshow); } }); } catch(e){}; //to show nMonth view try { $jc("#shownMonthbtn"+op.thecontainer).click(function(e) { $jc("#caltoolbar"+op.thecontainer+" div.ui-state-active").each(function() { $jc(this).removeClass("ui-state-active"); }) $jc(this).addClass("ui-state-active"); var p = $jc("#gridcontainer"+op.thecontainer).swtichView("nMonth").BcalGetOp(); if (p && p.datestrshow) { $jc("#txtdatetimeshow"+op.thecontainer).text(p.datestrshow); } }); } catch(e){}; try { $jc("#showreflashbtn"+op.thecontainer).click(function(e){ $jc("#gridcontainer"+op.thecontainer).reload(); }); } catch(e){}; try { $jc("#shownICALbtn"+op.thecontainer).click(function(e){ window.location = DATA_FEED_URL.replace("load","ical")+"&id="+calendarId; }); } catch(e){}; function showEditEvent(url) { var width = 600; var height = 480; try { $jc("#editEvent").remove(); var content = '