/*
 Ajax Event Calendar
 Version: 1.0.3
 (c) 2011 DMXzone.com
 @build 21-04-2011 15:23:06
*/
(function(e){if(!e.console||e.console&&!e.console.log)e.console={log:e.opera&&e.opera.postError?e.opera.postError:function(){}}})(this);
(function(e){function N(e,d){if(e.number<=d.number)return!1;return!0}function I(e){if(typeof e=="string")return e.replace(/("|'|\n|\r|\t)/gi,"\\$1");return e}jQuery.fn.extend({dmxAjaxCalendar:function(e,d){return this.each(function(){typeof e=="string"?this[e].apply(this,d):jQuery.extend(this,new jQuery.dmxAjaxCalendar(this,e))})}});jQuery.dmxAjaxCalendar=function(o,d){function p(a,b){for(var c="",f=0,d=0;f<b;f++)a.substr(d,1)!="&"?(c+=a.substr(d,1),d++):(c+=a.substring(d,a.indexOf(";",d)+1),d=c.length);
return c}function D(a,b){if(e("#"+a+"_ss").length>0)e("#"+a+"_ss").html().indexOf(b)>-1||(e("#"+a+"_ss")[0].styleSheet?e("#"+a+"_ss")[0].styleSheet.cssText+=b:e("#"+a+"_ss").append(b));else{var c=document.createElement("style");c.setAttribute("type","text/css");e(c).attr({id:a+"_ss"});c.styleSheet?c.styleSheet.cssText=b:e(c).html(b);e("head").append(c)}}function E(a,b,c,f,d,m,e,n){m=parseInt(m);typeof n=="undefined"&&(n=-1);c-f==0&&f.setMinutes(f.getMinutes()+30);this.original_id=a;this.ev_id=n;typeof m==
"undefined"||isNaN(m)?m=8:m+=1;this.name=b;this.start=c;this.stop=f;if(typeof d=="undefined"||d==null)d="";this.description=d;this.type=m;typeof e=="undefined"&&(e="#");this.link=e}function C(a,b){var c,f;typeof b=="undefined"&&(b=!0);if(b)(c=a.match(/^(\d{4})-?(\d{2})-?(\d{2})/))?(f=new Date(0),f.setUTCFullYear(c[1]),f.setUTCMonth(c[2]-1),f.setUTCDate(c[3]),(c=a.match(/[T ](\d{2}):?(\d{2}):?(\d{2})(\.(\d+))?((Z|[+-]\d{2})(:?(\d{2}))?)?/))?(f.setUTCHours(c[1]),f.setUTCMinutes(c[2]),f.setUTCSeconds(c[3]),
f.setUTCMilliseconds(c[5]|0),b&&c[7]&&c[7]!=="Z"&&(f.setUTCHours(f.getUTCHours()-parseInt(c[7])),c[9]&&f.setUTCMinutes(f.getUTCMinutes()-parseInt(c[9])))):(f.setHours(0),f.setMinutes(0))):f=new Date(Date.parse(a));else{if(c=a.match(/^(\d{4})-?(\d{2})-?(\d{2})/))if(f=c[1]+"/"+c[2]+"/"+c[3],c=a.match(/[T ](\d{2}):?(\d{2}):?(\d{2})(\.(\d+))?((Z|[+-]\d{2})(:?(\d{2}))?)?/))f+=" "+c[1]+":"+c[2]+":"+c[3];return new Date(f)}return f}var d=jQuery.extend({},jQuery.dmxAjaxCalendar.defaults,d),j,t,i,l,q,z,r,
v,h,w,x,F,s,A,K,L,u,J,k,H,B,y;j=this;t=jQuery(o);jQuery.extend(j,{version:"1.0.0",add_ajax_feed:function(a,b){var c={};c.url=a;c.timezone_offset=b;d.ajax_feeds.push(c)},update_display_type:function(){y=!1;A.removeClass("selected");e(this).addClass("selected");e(this).hasClass("day_button")?j.set_calendar_day(q,l,i,!1):e(this).hasClass("week_button")?j.set_calendar_week(q,l,i,!1):e(this).hasClass("month_button")?j.set_calendar_month(l,i,!1):e(this).hasClass("year_button")&&j.set_calendar_year(i,!1)},
add_google_feed:function(a,b){var c={};c.url=a;c.type=b;d.google_feeds.push(c)},is_date:function(a){return null!=a&&!isNaN(a)&&"undefined"!==typeof a.getDate},go_to:function(a){this.is_date(a)||(typeof a=="string"&&a.indexOf("-")>-1&&(a=a.replace(/-/gi,"/")),a=new Date(a));q=a.getDate();l=a.getMonth();i=a.getFullYear();switch(d.display_type){case 0:this.go_day();break;case 1:this.go_week();break;case 2:this.go_month();break;case 3:this.go_year()}},go_day:function(){y=!1;j.set_calendar_day(q,l,i,!1)},
go_week:function(){y=!1;j.set_calendar_week(q,l,i,!1)},go_month:function(){y=!1;j.set_calendar_month(l,i,!1)},go_year:function(){y=!1;j.set_calendar_year(i,!1)},go_next:function(){B=-1;y=!0;var a=new Date(i,l,q);switch(d.display_type){case 0:a.setDate(a.getDate()+1);j.set_calendar_day(a.getDate(),a.getMonth(),a.getFullYear(),!0);break;case 1:a.setDate(a.getDate()+7);j.set_calendar_week(a.getDate(),a.getMonth(),a.getFullYear(),!0);break;case 2:a.setMonth(a.getMonth()+1);j.set_calendar_month(a.getMonth(),
a.getFullYear(),!0);break;case 3:a.setFullYear(a.getFullYear()+1),j.set_calendar_year(a.getFullYear(),!0)}},refresh:function(){switch(d.display_type){case 0:d.display_type=3;j.set_calendar_day(q,l,i,!0);break;case 1:d.display_type=3;j.set_calendar_week(q,l,i,!0);break;case 2:d.display_type=3;j.set_calendar_month(l,i,!0);break;case 3:d.display_type=1,j.set_calendar_year(i,!0)}},go_prev:function(){var a;y=!0;B=1;switch(d.display_type){case 0:a=new Date(i,l,q);a.setDate(a.getDate()-1);j.set_calendar_day(a.getDate(),
a.getMonth(),a.getFullYear(),!0);break;case 1:a=new Date(i,l,q);a.setDate(a.getDate()-7);j.set_calendar_week(a.getDate(),a.getMonth(),a.getFullYear(),!0);break;case 2:a=new Date(i,l,q);a.setMonth(a.getMonth()-1);j.set_calendar_month(a.getMonth(),a.getFullYear(),!0);break;case 3:a=new Date(i,l,q),a.setFullYear(a.getFullYear()-1),j.set_calendar_year(a.getFullYear(),!0)}},execute_behavior_call:function(a,b,c,f){if(b!=-1){var d,m,e,n,G,M,k,i,j,l,o,p,q,r,s,t,f=h[b].start.getFullYear();d=h[b].start.getMonth()+
1;d<10&&(d="0"+d);m=h[b].start.getDate();m<10&&(m="0"+m);e=h[b].start.getHours();e<10&&(e="0"+e);n=h[b].start.getMinutes();n<10&&(n="0"+n);G=h[b].start.getSeconds();G<10&&(G="0"+G);M=f+"-"+d+"-"+m+" "+e+":"+n+":"+G;k=h[b].stop.getFullYear();i=h[b].stop.getMonth()+1;i<10&&(i="0"+i);j=h[b].stop.getDate();j<10&&(j="0"+j);l=h[b].stop.getHours();l<10&&(l="0"+l);o=h[b].stop.getMinutes();o<10&&(o="0"+o);p=h[b].start.getSeconds();p<10&&(p="0"+p);q=k+"-"+i+"-"+j+" "+l+":"+o+":"+p;r="";if(typeof h[b].description!=
"undefined")r=h[b].description;s="";if(typeof h[b].link!="undefined")s=h[b].link;t="-1";typeof h[b].original_id!="undefined"&&(t=h[b].original_id+"");a=a.replace(/(##id##|\{id\})/gi,I(t));a=a.replace(/(##title##|\{title\})/gi,I(h[b].name));a=a.replace(/(##description##|\{description\})/gi,I(r));a=a.replace(/(##link##|\{link\})/gi,I(s));a=a.replace(/(##start_date##|\{start_date\})/gi,M);a=a.replace(/(##start_year##|\{start_year\})/gi,f);a=a.replace(/(##start_month##|\{start_month\})/gi,d);a=a.replace(/(##start_day##|\{start_day\})/gi,
m);a=a.replace(/(##start_hours##|\{start_hours\})/gi,e);a=a.replace(/(##start_minutes##|\{start_minutes\})/gi,n);a=a.replace(/(##start_seconds##|\{start_seconds\})/gi,G);a=a.replace(/(##stop_date##|\{stop_date\})/gi,q);a=a.replace(/(##stop_year##|\{stop_year\})/gi,k);a=a.replace(/(##stop_month##|\{stop_month\})/gi,i);a=a.replace(/(##stop_day##|\{stop_day\})/gi,j);a=a.replace(/(##stop_hours##|\{stop_hours\})/gi,l);a=a.replace(/(##stop_minutes##|\{stop_minutes\})/gi,o);a=a.replace(/(##stop_seconds##|\{stop_seconds\})/gi,
p)}else typeof f!="undefined"&&f!=""&&(b=f.split("-"),a=a.replace(/(##cur_date##|\{cur_date\})/gi,f),a=a.replace(/(##js_date##|\{js_date\})/gi,"new Date('"+f.replace(/-/gi,"/")+"')"),b.length>2&&(a=a.replace(/(##cur_day##|\{cur_day\})/gi,b[2]),a=a.replace(/(##cur_month##|\{cur_month\})/gi,b[1]),a=a.replace(/(##cur_year##|\{cur_year\})/gi,b[0])));(new Function("with(this) { "+a+"}")).call(c?c:document.body)},load_events:function(){h=[];for(var a=F=0;a<e(o).data("options").google_feeds.length;a++)this.load_from_google_feed_jsonp(e(o).data("options").google_feeds[a].url,
e(o).data("options").google_feeds[a].type);for(a=0;a<e(o).data("options").ajax_feeds.length;a++)this.load_from_ajax_feed(e(o).data("options").ajax_feeds[a].url)},update_display:function(a){typeof a=="undefined"&&(a=!0);switch(d.display_type){case 0:this.set_calendar_day(q,l,i,a);break;case 1:this.set_calendar_week(q,l,i,a);break;case 2:this.set_calendar_month(l,i,a);break;case 3:this.set_calendar_year(i,a)}},update_dates:function(){z=new Date(i,l,q);w=new Date(z.getTime());w.setMonth(w.getMonth()-
3);x=new Date(z.getTime());x.setMonth(x.getMonth()+3)},set_events_filter:function(){},reset_events_filter_array:function(){events_filter_array=[!0,!0,!0,!0,!0,!0,!0,!0,!0]},set_events_filter_array:function(a){events_filter_array[a+1]=!events_filter_array[a+1]},load_from_ajax_feed:function(a){var b,c,f;b=(new Date).getTimezoneOffset()*60;d.display_type!=3?(c=Math.floor(w.getTime()/1E3-b),b=Math.floor(x.getTime()/1E3-b)):(c=Math.floor(Date.UTC(i,0,1)/1E3),b=Math.floor(Date.UTC(i+1,0,1)/1E3));c={start:c,
stop:b};f=this;e.jsonp({url:a,callbackParameter:"callback",data:c,beforeSend:function(){e("#"+e(o).data("options").id+" .dmx_loading").length<1&&e("#"+e(o).data("options").id).append('<div class="dmx_loading" style="position: absolute; top: 0; left:0; height:'+t.outerHeight(!0)+"px; width:"+e(o).outerWidth()+'px; background-color: white; opacity: 0.5; -ms-filter:\'alpha(opacity=50)\'; filter:alpha(opacity=50); -moz-opacity:0.5; text-align: center;" ><p style="position: absolute; top: 51%; left: 45%">'+
"retrieving events".localize()+"</p></div>")},complete:function(){F++;F==d.ajax_feeds.length+d.google_feeds.length&&(d.onFeedsLoaded!=""&&j.execute_feeds_loaded(d.onFeedsLoaded),e(".dmx_loading").remove(),f.update_display())},error:function(){console.log("error reading: "+a)},success:function(a){for(var a=a||[],b=0;b<a.length;++b){var c,e,h,i;c=a[b];e=a[b].event_id;h=new Date(c.start.replace(/-/gi,"/"));i=typeof c.stop!="undefined"&&c.stop?new Date(c.stop.replace(/-/gi,"/")):new Date(c.start.replace(/-/gi,
"/"));if(d.time_conversion.toLowerCase()=="user"&&(!f.is_midnight(h)||!f.is_midnight(i)))h.setMinutes(h.getMinutes()-h.getTimezoneOffset()),i.setMinutes(i.getMinutes()-i.getTimezoneOffset());typeof e=="undefined"&&(e=-1);i<h&&(i=h);c=new E(e,c.title,h,i,c.description,c.type,c.link);f.add_event(c)}}})},parse_google_private:function(a){var b;b={};for(var a=a.substr(a.indexOf("?")+1).split("&"),c=0;c<a.length;c++){var f=a[c].split("=");if(f[0].toLowerCase()=="src")b.src=f[1];if(f[0].toLowerCase()=="pvttk")b.key=
f[1]}return b},load_from_google_feed_jsonp:function(a,b){var c,f,g,m;c=l;d.display_type!=3?(f=new Date(i,c-3,1),c=new Date(i,c+3,1),f=this.toIso8601(f),c=this.toIso8601(c)):(f=i+"-01-01",c=i+1+"-01-01");a.indexOf("://")<0?(a="http://www.google.com/calendar/feeds/"+escape(a)+"/public/full",f={"max-results":150,orderby:"starttime",sortorder:"a","start-min":f,"start-max":c,alt:"json-in-script"}):a.indexOf("pvttk=")<0?(f={v:"1.0",q:a,num:150},a="http://ajax.googleapis.com/ajax/services/feed/load"):(g=
this.parse_google_private(a),typeof g.src!="undefined"&&typeof g.key!="undefined"&&(a="http://www.google.com/calendar/feeds/"+escape(g.src)+"/private-"+g.key+"/full"),f={"max-results":150,orderby:"starttime",sortorder:"a","start-min":f,"start-max":c,alt:"json-in-script"});m=this;e.jsonp({url:a,callbackParameter:"callback",data:f,beforeSend:function(){e("#"+e(o).data("options").id+" .dmx_loading").length<1&&e("#"+e(o).data("options").id).append('<div class="dmx_loading" style="position: absolute; top: 0; left:0; height:'+
t.outerHeight(!0)+"px; width:"+e(o).outerWidth()+'px; background-color: white; opacity: 0.5; -ms-filter:\'alpha(opacity=50)\'; filter:alpha(opacity=50); -moz-opacity:0.5; text-align: center;" ><p style="position: absolute; top: 51%; left: 45%">'+"retrieving events".localize()+"</p></div>")},complete:function(){F++;F==d.ajax_feeds.length+d.google_feeds.length&&(d.onFeedsLoaded!=""&&j.execute_feeds_loaded(d.onFeedsLoaded),e(".dmx_loading").remove(),m.update_display())},success:function(a){var c=a.feed;
if(typeof c=="undefined"){if(a.responseData!=null&&(c=a.responseData.feed,c.type&&(c.type.indexOf("atom")>=0||c.type.indexOf("rss")>=0))){a=c.entries||[];for(c=0;c<a.length;++c){var f,g,e,h;f=a[c];g=new Date(f.publishedDate);e=m.date_add("n",g,30);h=c;if(d.time_conversion.toLowerCase()=="user"&&(!m.is_midnight(g)||!m.is_midnight(e)))g.setMinutes(g.getMinutes()-g.getTimezoneOffset()),e.setMinutes(e.getMinutes()-e.getTimezoneOffset());e<g&&(e=g);g=new E(h,f.title,g,e,f.content,b,f.link);m.add_event(g)}}}else{a=
c.entry||[];for(c=0;c<a.length;++c){f=a[c];for(var i=0;i<f.gd$when.length;++i){var j;e=f.gd$when[i];h=f.gCal$uid.value;j=!1;d.time_conversion.toLowerCase()=="user"&&(j=!0);g=C(e.startTime,j);e=C(e.endTime,j);e<g&&(e=g);g=new E(h,f.title.$t,g,e,f.content.$t,b,f.link[0].href);m.add_event(g)}}}}})},execute_feeds_loaded:function(a){eval(a)},draw_calendar:function(){var a;a=this.get_calendar_header()+'<div class="calendar_content"></div>'+this.get_calendar_footer();t.empty().append(a);u=e(" .calendar_header",
t);J=e(" .calendar_footer",t);k=e(" .calendar_content",t);d.fixed_height&&(a=u.outerHeight(!0),a+=J.outerHeight(!0),k.height(d.height-a));K=e(" .nav_left",t);L=e(" .nav_right",t);typeof d.onPrevious!="undefined"&&d.onPrevious!=""&&K.bind("click",function(){eval(d.onPrevious)});typeof d.onNext!="undefined"&&d.onNext!=""&&L.bind("click",function(){eval(d.onNext)});typeof d.onDay!="undefined"&&d.onDay!=""&&e(".day_button",u).bind("click",function(){eval(d.onDay)});typeof d.onWeek!="undefined"&&d.onWeek!=
""&&e(".week_button",u).bind("click",function(){eval(d.onWeek)});typeof d.onMonth!="undefined"&&d.onMonth!=""&&e(".month_button",u).bind("click",function(){eval(d.onMonth)});typeof d.onYear!="undefined"&&d.onYear!=""&&e(".year_button",u).bind("click",function(){eval(d.onYear)});K.bind("click",j.go_prev);L.bind("click",j.go_next);H=e(".current_date_range",t);A=e(".button",u);A.bind("click",j.update_display_type);a="";for(var b=0;b<d.events_type.length;b++)if(typeof d.events_type[b].color!="undefined"&&
d.events_type[b].color!=""||typeof d.events_type[b].background_color!="undefined"&&d.events_type[b].background_color!="")a+="#"+d.id+" .color-"+(d.events_type[b].number+1)+" {\n",typeof d.events_type[b].background_color!="undefined"&&d.events_type[b].background_color!=""&&(a+="background-color: "+d.events_type[b].background_color+" !important;\n"),typeof d.events_type[b].border_color!="undefined"&&d.events_type[b].border_color!=""&&(a+="border-color: "+d.events_type[b].border_color+" !important;\n"),
typeof d.events_type[b].color!="undefined"&&d.events_type[b].color!=""&&(a+="color: "+d.events_type[b].color+" !important;\n"),a+="}\n",typeof d.events_type[b].color!="undefined"&&d.events_type[b].color!=""&&(a+="#"+d.id+" .color-"+(d.events_type[b].number+1)+" * {\ncolor: "+d.events_type[b].color+" !important;\n}\n");D(d.id,a)},get_legend_html:function(){for(var a='<div class="legend"><table class="legend"><tbody><tr><th colspan="3" class="legend_header">'+"legend".localize()+"</th></tr>",b=!1,c=
0;c<9;c++){c%3==0&&(b=!0,a+="<tr>");if(typeof d.events_type[c]=="undefined")a+="<td>&nbsp;</td>";else{var f="";events_filter_array[c]&&(f=" checked");a+="<td><div style='width: auto;padding-right: 6px' class=\"event color-"+(d.events_type[c].number+1)+' filter"><div class="text-outer"><div class="text"><label style=\'cursor: pointer;\'><input'+f+" type='checkbox' onClick=\"jQuery('#"+d.id+"').dmxAjaxCalendar('set_events_filter_array',["+c+"]); jQuery('#"+d.id+"').dmxAjaxCalendar('update_display', [false]);\" /><bdo dir\""+
d.text_direction+'" >'+d.events_type[c].name+"</bdo></label></div></div></div></td>"}(c+1)%3==0&&(b=!1,a+="</tr>")}b&&(a+="</tr>");a+="</tbody></table></div>";return a},set_current_date:function(a,b,c){i=c;l=b;q=a},set_calendar_day:function(a,b,c,f){typeof f=="undefined"&&(f=!0);q=a;l=b;i=c;var g=new Date(i,l,q),m=new Date(w.getTime());m.setMonth(m.getMonth()+1);var h=new Date(x.getTime());h.setMonth(h.getMonth()-2);if(m-g>0||g-h>0)d.display_type=0,this.update_dates(),this.load_events();else{d.display_type=
0;H.html(this.get_day_date_display(c,b,a));a=this.get_calendar_day_html(a,b,c);A.removeClass("selected");e(".day_button",u).addClass("selected");this.set_dynamic_html(a,f);f=e(".day",k);d.fixed_height?(a=k.height()-e(" .day-header",k).outerHeight(!0)-f.get_space("Top")-f.get_space("Bottom"),f.css("height",a)):f.css("height","auto");a=Math.floor(20*(d.width/800));b=2*a;(navigator.userAgent.toLowerCase().indexOf("safari")>-1||navigator.userAgent.toLowerCase().indexOf("msie")>-1)&&b++;c="#"+d.id+" .day_half_hour {\n";
c+="height: "+a+"px !important;\n";c+="}\n";c+="#"+d.id+" .day li table td.hour{\n";c+="height: "+b+"px !important;\n";c+="}\n";D(d.id,c);this.set_font_size();if(navigator.userAgent.toLowerCase().indexOf("opera")>-1||navigator.userAgent.toLowerCase().indexOf("msie")>-1)a+=e("li table",f).find("td:not(.event_cell):not(.hour)").get_space("top"),a+=e("li table",f).find("td:not(.event_cell):not(.hour)").get_space("bottom");this.fix_event_heights(a);d.use_animation&&this.animate_height(k,s.find(" > div:last"))}},
set_font_size:function(){if(!d.resized){var a=e("*",t).css("font-size"),a=parseInt(a.substr(0,a.length-2)),b=d.width/800,c=e("h3",t).css("font-size"),c=parseInt(c.substr(0,c.length-2))/12,a=Math.max(10,Math.floor(a*b)),b=Math.floor(a*c),c="#"+d.id+" * {";c+="font-size:"+a+"px;\n";c+="}\n";c+="#"+d.id+" h3 {";c+="font-size:"+b+"px;\n";c+="}\n";D(d.id,c)}d.resized=!0},set_calendar_week:function(a,b,c,f){typeof f=="undefined"&&(f=!0);q=a;l=b;i=c;var g=new Date(i,l,q),m=new Date(w.getTime());m.setMonth(m.getMonth()+
1);var h=new Date(x.getTime());h.setMonth(h.getMonth()-2);m-g>0||g-h>0?(d.display_type=1,this.update_dates(),this.load_events()):(d.display_type=1,H.html(this.get_week_range_display(c,b,a)),A.removeClass("selected"),e(".week_button",u).addClass("selected"),c=this.get_calendar_week_html(a,b,c),a=d.width/800,a=Math.floor(20*a),b=2*a,(navigator.userAgent.toLowerCase().indexOf("safari")>-1||navigator.userAgent.toLowerCase().indexOf("msie")>-1)&&b++,this.set_dynamic_html(c,f),f=e(".day",k),d.fixed_height?
(a=k.height()-e(".day-header",k).outerHeight(!0)-f.get_space("Top")-f.get_space("Bottom"),f.css("height",a)):f.css("height","auto"),a=d.width/800,a=Math.floor(20*a),b=2*a,(navigator.userAgent.toLowerCase().indexOf("safari")>-1||navigator.userAgent.toLowerCase().indexOf("msie")>-1)&&b++,c="#"+d.id+" .day_half_hour {\n",c+="height: "+a+"px !important;\n",c+="}\n",c+="#"+d.id+" .day li table td.hour{\n",c+="height: "+b+"px !important;\n",c+="}\n",D(d.id,c),this.set_font_size(),a=e("li table",f).find("td:not(.event_cell):not(.hour)").outerHeight(!0),
this.fix_event_heights(a),d.use_animation&&this.animate_height(k,s.find(" > div:last")))},fix_event_heights:function(a){navigator.userAgent.toLowerCase().indexOf("safari")>-1&&a++;e(".day li table",t).find("td.event_cell").each(function(b,c){$cur_el=e(c);var f;f=$cur_el.attr("rows");f=a*parseInt(f)-$cur_el.get_space("Top")-$cur_el.get_space("Bottom");$event_div=$cur_el.find("div");$cur_el.css("height",f+"px");$event_div.css({height:f-$event_div.get_space("Top")-$event_div.get_space("Bottom")+"px"})})},
get_week_range_display:function(a,b,c){var f=new Date(a,b,c),g=f.getDay();d.week_start==1&&(g==0&&(g=7),g-=1);f.setDate(f.getDate()-g);g=new Date(f.getTime());g.setDate(g.getDate()+6);var e=new Date(a,b,c);e.setDate(e.getDate()-7);b=new Date(a,b,c);b.setDate(b.getDate()+7);pnhtml="";b=f.getMonth();c=g.getMonth();switch(d.date_display_type){case 1:case 3:pnhtml+=f.getDate();b!=c&&(pnhtml+=" "+v[b%12].localize());pnhtml+=" - ";pnhtml+=g.getDate()+" "+v[c%12].localize();break;default:pnhtml+=v[b%12].localize()+
"&nbsp;"+f.getDate()+" - ",b!=c&&(pnhtml+=v[c%12].localize()+" "),pnhtml+=g.getDate()}pnhtml+=", "+a;return pnhtml},get_day_date_display:function(a,b,c){var f=r[(new Date(a,b,c)).getDay()].localize()+", ";switch(d.date_display_type){case 1:case 3:f+=c+"&nbsp;"+v[b%12].localize();break;case 0:case 2:f+=v[b%12].localize()+"&nbsp;"+c;break;default:f+=v[b%12].localize()+"&nbsp;"+c}f+=", "+a;return f},animate_content:function(){typeof B=="undefined"&&(B=-1);var a=d.width,b=e(".scroll_content",k);s.css("left")!=
a&&(d.fixed_height?(b.css("overflow-y","hidden"),s.animate({left:B*a},{duration:d.animation_duration,easing:d.animation_easing,complete:function(){b.css("overflow-y","scroll")}})):s.animate({left:B*a},{duration:d.animation_duration,easing:d.animation_easing,complete:function(){s.find(" > div:first").remove();s.css("left",0);s.find(" > div:last").css("left",0)}}))},create_sliding_divs:function(){var a=document.createElement("div");e(a).attr("id",d.id+"_holder");e(a).css("position","relative");k.empty();
k.append(a);s=e(a)},set_calendar_year:function(a){var b=!1;i!=a&&(i=a,b=!0);if(b||d.display_type!=3)d.display_type=3,this.update_dates(),this.load_events();else{this.set_dynamic_html('<div class="year_content">'+this.get_calendar_year_html(a)+"</div>");b=e(".year_content",k);if(d.fixed_height){var c=k.height()-b.get_space("Top")-b.get_space("Bottom");b.height(c)}H.html(a);A.removeClass("selected");e(".year_button",u).addClass("selected");a=Math.floor(((t.innerWidth()-10)/d.num_columns_year_view-12)/
7);b=".simple_small_month td {";b+="width:"+a+"px !important;\n";b+="height:"+a+"px !important;\n";b+="}\n";b+=".simple_small_month th {";b+="height:"+a+"px !important;\n";b+="}\n";D(d.id,b);this.set_font_size();d.use_animation&&this.animate_height(k,s.find(" > div:last"))}},get_day_month_display:function(a,b){var c="";switch(d.date_display_type){case 0:c+=a+"/"+b;break;case 1:c+=b+"/"+a;break;case 2:c+=a+"-"+b;break;case 3:c+=b+"."+a;break;default:c+=a+"/"+b}return c},set_calendar_month:function(a,
b,c){typeof c=="undefined"&&(c=!0);q=1;l=a;i=b;var f=new Date(i,l,q),g=new Date(w.getTime());g.setMonth(g.getMonth()+1);var m=new Date(x.getTime());m.setMonth(m.getMonth()-2);g-f>0||f-m>0?(d.display_type=2,this.update_dates(),this.load_events()):(d.display_type=2,A.removeClass("selected"),e(".month_button",u).addClass("selected"),u.outerHeight(!0),J.outerHeight(!0),f=e(".month_content",k),this.set_dynamic_html(this.get_calendar_month_html(a,b),c),d.fixed_height&&(c=k.outerHeight(!0)-e(".day-header",
k).outerHeight(!0)-f.get_space("Top")-f.get_space("Bottom"),f.css("height",c),k.css("overflow-y","auto")),H.html(v[a].localize()+" "+b),a=20*(d.width/800),b="#"+d.id+" .month_content td, .month_content th {",b+="height: "+a+"px",b+="}\n",b+="#"+d.id+" .month_content td .event {",b+="height: "+(a-2)+"px",b+="}\n",b+="#"+d.id+" .month_content td .filler-div {",b+="height: "+(a-2)+"px",b+="}\n",D(d.id,b),this.set_font_size(),d.use_animation&&this.animate_height(k,s.find(" > div:last")))},animate_height:function(a,
b){d.fixed_height?a.animate({height:b.outerHeight(!0)},{duration:500,complete:function(){a.css("overflow-y","auto")}}):a.animate({height:b.outerHeight(!0)},{duration:500})},set_dynamic_html:function(a){if(d.use_animation)if(typeof s=="undefined"&&this.create_sliding_divs(),y){var a=e("<div></div>").append(a),b=B*-d.width;a.css({position:"absolute",width:s.width(),top:0,left:b});d.fixed_height&&a.height(k.height());s.append(a);a=u.outerHeight(!0);a+=J.outerHeight(!0);a=d.height-a;if(d.fixed_height&&
(k.height(a),b=e(".day",k),b.length>0)){var c=e(".day-header",k).outerHeight(!0);b.height(a-c)}this.animate_content();y=!1}else $static_div=e("<div></div>").append(a),$static_div.css({position:"absolute",width:s.width(),top:0,left:0}),d.fixed_height&&$static_div.height(k.height()),s.empty().append($static_div),s.css("left",0);else k.html(a),d.fixed_height&&(b=e(" .day",k),a=k.innerHeight(),b.length>0&&(c=e(".day-header",k).outerHeight(!0),b.height(a-c)));typeof d.onEventClick!="undefined"&&d.onEventClick!=
""&&(a=e(".event",k),a.bind("click",function(){var a=e(this).attr("ev_id");j.execute_behavior_call(d.onEventClick,a,this)}),a.css("cursor","pointer"));typeof d.onEventMouseOver!="undefined"&&d.onEventMouseOver!=""&&e(".event",k).bind("mouseover",function(){var a=e(this).attr("ev_id");j.execute_behavior_call(d.onEventMouseOver,a,this)});typeof d.onEventMouseOut!="undefined"&&d.onEventMouseOut!=""&&e(".event",k).bind("mouseout",function(){var a=e(this).attr("ev_id");j.execute_behavior_call(d.onEventMouseOut,
a,this)});for(b=0;b<d.events_type.length;b++)typeof d.events_type[b].number!="undefined"&&d.events_type[b].number!==""&&(a=e(".event-type-"+(d.events_type[b].number+1),k),typeof d.events_type[b].on_click!="undefined"&&d.events_type[b].on_click!=""&&(a.data("event_click_action",d.events_type[b].on_click),a.bind("click",function(){var a=e(this).attr("ev_id");j.execute_behavior_call(e(this).data("event_click_action"),a,this)}),a.css("cursor","pointer")),typeof d.events_type[b].on_mouse_over!="undefined"&&
d.events_type[b].on_mouse_over!=""&&(a.data("event_mouseover_action",d.events_type[b].on_mouse_over),e(".event-type-"+(d.events_type[b].number+1),k).bind("mouseover",function(){var a=e(this).attr("ev_id");j.execute_behavior_call(e(this).data("event_mouseover_action"),a,this)})),typeof d.events_type[b].on_mouse_out!="undefined"&&d.events_type[b].on_mouse_out!=""&&(a.data("event_mouseout_action",d.events_type[b].on_mouse_out),e(".event-type-"+(d.events_type[b].number+1),k).bind("mouseout",function(){var a=
e(this).attr("ev_id");j.execute_behavior_call(e(this).data("event_mouseout_action"),a,this)})));typeof d.onYearFreeDayClick!="undefined"&&d.onYearFreeDayClick!=""&&(a=e(".has_no_event",k),a.bind("click",function(){var a=e(this).attr("cur_date");j.execute_behavior_call(d.onYearFreeDayClick,-1,this,a)}),a.css("cursor","pointer"));typeof d.onYearFreeDayMouseOver!="undefined"&&d.onYearFreeDayMouseOver!=""&&e(".has_no_event",k).bind("mouseover",function(){var a=e(this).attr("cur_date");j.execute_behavior_call(d.onYearFreeDayMouseOver,
-1,this,a)});typeof d.onYearFreeDayMouseOut!="undefined"&&d.onYearFreeDayMouseOut!=""&&e(".has_no_event",k).bind("mouseout",function(){var a=e(this).attr("cur_date");j.execute_behavior_call(d.onYearFreeDayMouseOut,-1,this,a)});typeof d.onYearEventClick!="undefined"&&d.onYearEventClick!=""&&(a=e(".has_event",k),a.bind("click",function(){var a=e(this).attr("cur_date");j.execute_behavior_call(d.onYearEventClick,-1,this,a)}),a.css("cursor","pointer"));typeof d.onYearEventMouseOver!="undefined"&&d.onYearEventMouseOver!=
""&&e(".has_event",k).bind("mouseover",function(){var a=e(this).attr("cur_date");j.execute_behavior_call(d.onYearEventMouseOver,-1,this,a)});typeof d.onYearEventMouseOut!="undefined"&&d.onYearEventMouseOut!=""&&e(".has_event",k).bind("mouseout",function(){var a=e(this).attr("cur_date");j.execute_behavior_call(d.onYearEventMouseOut,-1,this,a)})},get_calendar_day_html:function(a,b,c){var d="";d+=this.get_day_header(a,b,c)+'<div style="clear: both;"></div>'+this.get_day_content(a,b,c);return d},get_calendar_week_html:function(a,
b,c){var d="";d+=this.get_week_header(a,b,c)+this.get_week_content(a,b,c);return d},get_calendar_year_html:function(a){return this.get_year_content_html(a)},get_year_header_html:function(a){return'<div class="calendar_header">'+this.get_prev_next_year_html(a)+"</div>"},get_prev_next_year_html:function(a){var b='<div class="prev_next">',c=new Date(a,1,1);c.setFullYear(c.getFullYear()-1);c=new Date(a,1,1);c.setFullYear(c.getFullYear()+1);b+='<table><tbody><tr><td width="220">'+a+"</td><td>"+this.get_switch_types_html()+
"</td></tr></tbody></table></div>";return b},get_year_content_html:function(a){var b="<div class=\"simple_year_content\"><table  class='simple_year_table'><tbody>",c=this.get_year_events(a);this.create_month_displays(c,a);for(a=0;a<c.length;a++)(a+d.num_columns_year_view)%d.num_columns_year_view==0&&(b+="<tr>"),b+="<td>",b+=this.get_simple_month_html(c,a),b+="</td>",(a+1)%d.num_columns_year_view==0&&(b+="</tr>");b+="</tbody></table></div>";return b},get_simple_month_html:function(a,b){var c="",f=
"",g="";d.allowed_display_types[2]&&(f="onClick='jQuery(\"#"+d.id+'").dmxAjaxCalendar("set_calendar_month",['+b+","+i+"]);'",g=" clickable");c+="<table class='simple_small_month "+g+"'><tbody><tr><th "+f+" colspan='7'>"+v[b].localize()+"</th></tr>";switch(d.week_start){case 0:c+="<tr><td>"+p("sunday".localize(),1)+"</td><td>"+p("monday".localize(),1)+"</td><td>"+p("tuesday".localize(),1)+"</td><td>"+p("wednesday".localize(),1)+"</td><td>"+p("thursday".localize(),1)+"</td><td>"+p("friday".localize(),
1)+"</td><td>"+p("saturday".localize(),1)+"</td></tr>";break;case 1:c+="<tr><td>"+p("monday".localize(),1)+"</td><td>"+p("tuesday".localize(),1)+"</td><td>"+p("wednesday".localize(),1)+"</td><td>"+p("thursday".localize(),1)+"</td><td>"+p("friday".localize(),1)+"</td><td>"+p("saturday".localize(),1)+"</td><td>"+p("sunday".localize(),1)+"</td></tr>"}for(g=0;g<a[b].length;g++){for(var e="",h=0,f=0;a[b][f]==-1;)h++,f++;e=a[b][g]>-1?a[b][g]>0&&a[b][g]<20?"color-"+a[b][g]+" has_event":a[b][g]==20?"has_event":
"has_no_event":"empty_day_cell";(g+7)%7==0&&(c+="<tr>");var n="",f="";if(a[b][g]==-1)n="&nbsp;";else{if(d.allowed_display_types[0]&&a[b][g]>-1&&(typeof d.onYearEventClick=="undefined"||d.onYearEventClick=="")&&(typeof d.onYearFreeDayClick=="undefined"||d.onYearFreeDayClick==""))f="onclick='jQuery(\"#"+d.id+'").dmxAjaxCalendar("set_calendar_day",['+(g-h+1)+", "+b+", "+i+", false]);'",e+=" clickable";n=g-h+1}c+="<td cur_date='"+(i+"-"+(b+1)+"-"+n)+"' "+f+" class='"+e+"'>"+n+"</td>";(g+1)%7==0&&g+1<
a[b].length&&(c+="</tr>")}c+="</tr></tbody></table>";return c},create_month_displays:function(a,b){if(d.week_start==0)for(var c=0;c<a.length;c++){for(var f=(new Date(b,c,1)).getDay(),g=0;g<f;g++)a[c].unshift(-1);for(;a[c].length<42;)a[c].push(-1)}else for(c=0;c<a.length;c++){f=(new Date(b,c,1)).getDay();f==0&&(f=7);f--;for(g=0;g<f;g++)a[c].unshift(-1);for(;a[c].length<42;)a[c].push(-1)}},get_year_events:function(a){for(var b=[],c=0;c<12;c++){for(var d=(new Date(a,c+1,0)).getDate(),g=[],e=0;e<d;e++)g[e]=
this.has_event(a,c,e+1);b[c]=g}return b},has_event:function(a,b,c){var d=!1,g=100,e=new Date(a,b,c),a=new Date(a,b,c);a.setDate(a.getDate()+1);for(b=0;b<h.length;b++)if(events_filter_array[h[b].type]&&h[b].start<a&&h[b].stop>e)if(d){if(h[b].type!=g)return 20}else g=h[b].type,d=!0;return g},get_calendar_header:function(){var a='<div class="calendar_header"><h3>'+d.calendar_name+"</h3>";d.legend_position=="top"&&(a+=this.get_legend_html());a+=this.get_prev_next_html()+"</div>";return a},get_calendar_footer:function(){var a=
'<div class="calendar_footer">';d.legend_position=="bottom"&&(a+=this.get_legend_html());a+="</div>";return a},get_calendar_month_html:function(a,b){l=a;i=b;var c=new Date(b,l,1),f=c.getDay();d.week_start==0?c=new Date(c.getFullYear(),c.getMonth(),c.getDate()-f):(f==0&&(f=7),c=new Date(c.getFullYear(),c.getMonth(),c.getDate()-f+1));f="";f+=this.get_month_header()+'<div class="month_content scroll_content">';for(var g=new Date(c.getFullYear(),c.getMonth(),c.getDate()+7),e=0;e<6;e++)f+=this.get_month_content_html(c,
g),c=new Date(c.getFullYear(),c.getMonth(),c.getDate()+7),g=new Date(g.getFullYear(),g.getMonth(),g.getDate()+7);f+="</div>";return f},get_day_header:function(a,b,c){for(var d=new Date(c,b,a),g=new Date(c,b,a+1),e='<div class="day-header"><table cellspacing="0" border="0" class="header"><tbody><tr><td class=\'day_name\'>'+r[d.getDay()].localize()+" "+this.get_day_month_display(b+1,a)+" </td></tr></tbody></table><div class='all_day_events'><table><tbody>",a=this.get_all_day_events(a,b,c),b=0;b<a.length;b++)c=
"",a[b].start>=d&&(c+=" start"),a[b].stop<=g&&(c+=" end"),e+="<tr><td class='td-m'>"+this.get_event_html(a[b],!1,c)+"</td></tr>";e+="</tbody></table></div></div>";return e},get_all_day_events:function(a,b,c){for(var d=new Date(c,b,a),a=new Date(c,b,a+1),b=[],c=0;c<h.length;c++)if((h[c].start<d&&h[c].stop>d||h[c].start<a&&h[c].stop>a||h[c].start.getTime()==d.getTime()&&h[c].stop.getTime()==a.getTime())&&events_filter_array[h[c].type]){var g=new E(h[c].original_id,h[c].name,h[c].start,h[c].stop,h[c].description,
h[c].type-1,h[c].link,c);b.push(g)}return b},get_week_content:function(a,b,c){a=new Date(c,b,a);b=a.getDay();d.week_start==1&&(b==0&&(b=7),b-=1);a.setDate(a.getDate()-b);c="";if(navigator.userAgent.toLowerCase().indexOf("safari")>-1||navigator.userAgent.toLowerCase().indexOf("msie")>-1)c="style='height: 41px;'";b=new Date(a.getTime());b.setDate(b.getDate()+6);b=k.innerWidth()-d.width*0.1-5;d.fixed_height&&(b-=e.getScrollbarWidth());for(var c='<div class="day scroll_content"><ol><li style=\'width: '+
Math.floor(b*0.1)+"px; overflow: hidden; float: left;'>"+this.get_hours_html(c)+"</li>",f=0;f<7;f++){var g=new Date(a.getTime());g.setDate(g.getDate()+f);var m=this.get_events_columns(this.get_one_day_events(g.getDate(),g.getMonth(),g.getFullYear(),!1));c+=this.get_day_table_html(m,g,Math.floor(b/7))}c+="</ol></div>";return c},get_hours_html:function(a){var b='<table cellspacing="0" border="0"><tbody>';if(d.clock_type==0)for(var c="",f=0,g=0;g<24;g++)c=g<12?"am":"pm",f=g%12,f==0&&(f=12),b+="<tr><td "+
a+" class='hour'>"+f+c+"&nbsp;</td></tr>";else for(g=0;g<24;g++)b+="<tr><td "+a+" class='hour'>"+g+":00&nbsp;</td></tr>";b+="</tbody></table>";return b},get_day_content:function(a,b,c){var f=this.get_events_columns(this.get_one_day_events(a,b,c,!0)),g="";if(navigator.userAgent.toLowerCase().indexOf("safari")>-1||navigator.userAgent.toLowerCase().indexOf("msie")>-1)g="style='height: 41px;'";this.get_all_day_events(a,b,c);var m="",h=e(".calendar_content",t).innerWidth()-d.width*0.1-5;d.fixed_height&&
(h-=e.getScrollbarWidth());m+='<div class="day scroll_content"><ol><li style=\'width: '+Math.floor(h*0.1)+"px; float: left'>"+this.get_hours_html(g)+"</li>";m+=this.get_day_table_html(f,new Date(c,b,a),h);m+="</ol></div>";return m},get_day_table_html:function(a,b,c){for(var f="",g=this.date_add("d",b,1),e=0;e<a.length;e++){var h,n,i;f+="<li style='width: "+Math.floor(c/a.length)+'px; float: left\'><table cellspacing="0" border="0"><tbody>';h=new Date(b.getFullYear(),b.getMonth(),b.getDate(),0,0,0);
n=new Date(b.getFullYear(),b.getMonth(),b.getDate(),0,30,0);for(var j=0;j<a[e].length;j++){for(;this.get_half_hour(a[e][j].start)>h;)i="day_half_hour",d.use_working_hours==!0&&this.get_semi_hours(h)>=d.working_hours_start*2&&this.get_semi_hours(h)<d.working_hours_stop*2&&(i+=" working_hours"),h.getMinutes()==0&&(i+=" mid"),e==a.length-1&&(i+=" last"),f+="<tr><td class='"+i+"'>&nbsp;</td></tr>",h.setMinutes(h.getMinutes()+30),n.setMinutes(n.getMinutes()+30);n=this.get_half_hour(a[e][j].start);h=this.get_half_hour(a[e][j].stop);
n.getTime()==h.getTime()&&h.setMinutes(h.getMinutes()+30);n=this.date_diff("n",n,h)/30;i="";e==a.length-1&&(i+=" last");f+="<tr><td class='event_cell"+i+"' rows='"+n+"'>"+this.get_event_html(a[e][j],!0)+"</td></tr>";h=new Date(h.getTime());n=this.date_add("m",h,30)}for(j=1;h<g&&j<=48;)i="day_half_hour",d.use_working_hours==!0&&this.get_semi_hours(h)>=d.working_hours_start*2&&this.get_semi_hours(h)<d.working_hours_stop*2&&(i+=" working_hours"),h.getMinutes()==0&&(i+=" mid"),e==a.length-1&&(i+=" last"),
f+="<tr><td class='"+i+"'>&nbsp;</td></tr>",h.setMinutes(h.getMinutes()+30),n.setMinutes(n.getMinutes()+30),j++;f+="</tbody></table></li>"}return f},date_add:function(a,b,c){b=new Date(b.getTime());switch(a){case "y":b.setFullYear(b.getFullYear()+c);break;case "m":b.setMonth(b.getMonth()+c);break;case "w":b.setDate(b.getDate()+c*7);break;case "d":b.setDate(b.getDate()+c);break;case "h":b.setHours(b.getHours()+c);break;case "n":b.setMinutes(b.getMinutes()+c);break;case "s":b.setSeconds(b.getSeconds()+
c);break;case "ms":b.setMilliseconds(b.getMilliseconds()+c)}return b},get_semi_hours:function(a){var b=a.getHours()*2;a.getMinutes()>0&&(a.getMinutes()<=30?b++:b+=2);return b},toIso8601:function(a){var b,c,d,g,e,h,i;b=a.getFullYear();c=a.getMonth()+1;d=a.getDate();g=a.getHours();e=a.getMinutes();h=a.getSeconds();i=a.getMilliseconds();a=a.getTimezoneOffset();b=this.pad(b,4)+"-"+this.pad(c)+"-"+this.pad(d);g+e+h+i>0&&(b+="T"+this.pad(g),b+=":"+this.pad(e),b+=":"+this.pad(h),i>0&&(b+="."+this.pad(i,
3)),a!==0?(g=Math.abs(Math.floor(a/60)),e=Math.abs(a%60),b+=a>0?"-":"+",b+=this.pad(g),b+=":"+this.pad(e)):b+="Z");return b},get_time_display:function(a){var b;b=a.getHours();a=a.getMinutes();if(d.clock_type==0){var c=b%12;return(c==0?"12":c)+":"+this.pad(a)+(b<12?"am":"pm")}else return this.pad(b)+":"+this.pad(a)},pad:function(a,b){a=String(a);for(b=b||2;a.length<b;)a="0"+a;return a},get_one_day_events:function(a,b,c){var d,g;d=[];g=new Date(c,b,a);a=new Date(c,b,a+1);for(b=0;b<h.length;b++)h[b].start>=
g&&h[b].stop<=a&&this.date_diff("d",h[b].start,h[b].stop)<1&&events_filter_array[h[b].type]&&(c=new E(h[b].original_id,h[b].name,h[b].start,h[b].stop,h[b].description,h[b].type-1,h[b].link,b),d.push(c));return d},get_events_columns:function(a){this.sort_events_by_start_date(a);var b=[];b.push([]);for(var c=0;c<a.length;c++){for(var d=!1,g=0;g<b.length;g++)if(b[g].length==0){b[g].push(a[c]);d=!0;break}else this.get_half_hour(b[g][b[g].length-1].stop)<=this.get_half_hour(a[c].start)&&(b[g].push(a[c]),
d=!0);d||(b.push([]),b[b.length-1].push(a[c]))}return b},get_half_hour:function(a){return a.getMinutes()>0&&a.getMinutes()<=30?new Date(a.getFullYear(),a.getMonth(),a.getDate(),a.getHours(),30,0,0):a.getMinutes()>30?new Date(a.getFullYear(),a.getMonth(),a.getDate(),a.getHours()+1,0,0,0):new Date(a.getFullYear(),a.getMonth(),a.getDate(),a.getHours(),0,0,0)},sort_events_by_start_date:function(a){a.sort(function(a,c){return a.start-c.start})},get_week_header:function(a,b,c){var f,g,h,i,c=new Date(c,
b,a),a=c.getDay();d.week_start==1&&(a==0&&(a=7),a-=1);c.setDate(c.getDate()-a);a=new Date(c.getTime());b=new Date(c.getTime());b.setDate(b.getDate()+7);f=[];g=[];for(h=0;h<7;h++)f.push(this.get_day_month_display(c.getMonth()+1,c.getDate())),d.allowed_display_types[0]?g.push("onClick='jQuery(\"#"+d.id+'").dmxAjaxCalendar("set_calendar_day",['+c.getDate()+", "+c.getMonth()+", "+c.getFullYear()+"])' class='clickable'"):g.push(""),c.setDate(c.getDate()+1);c=this.get_rows_from_events(this.get_events(new Date(a.getTime()),
new Date(b.getTime()),!0),new Date(a.getTime()),new Date(b.getTime()));h=k.innerWidth()-d.width*0.1-5;d.fixed_height&&(h-=e.getScrollbarWidth());i='<div class="day-header"><div style=\'position: relative; left: '+h*0.1+"px; width: "+h+'px;\'><div><table cellspacing="0" border="0" class="day_names_header"><tbody><tr>';if(d.week_start==0)for(h=0;h<7;h++)i+="<td class='day_name' "+g[h]+" >"+p(r[h].localize(),3)+"<br /> "+f[h]+"</th>";else i+="<td class='day_name' "+g[0]+" >"+p(r[1].localize(),3)+"<br /> "+
f[0]+"</th><td class='day_name' "+g[1]+">"+p(r[2].localize(),3)+"<br /> "+f[1]+"</th><td class='day_name' "+g[2]+">"+p(r[3].localize(),3)+"<br /> "+f[2]+"</th><td class='day_name' "+g[3]+">"+p(r[4].localize(),3)+"<br /> "+f[3]+"</th><td class='day_name' "+g[4]+">"+p(r[5].localize(),3)+"<br /> "+f[4]+"</th><td class='day_name' "+g[5]+">"+p(r[6].localize(),3)+"<br /> "+f[5]+"</th><td class='day_name' "+g[6]+">"+p(r[0].localize(),3)+"<br /> "+f[6]+"</th>";i+='</tr></table></div><div class="multi_day_events"><table><tbody>';
for(h=0;h<c.length;h++){i+="<tr>";var n,j;f=new Date(a.getTime());g=this.date_add("d",f,1);for(j=n=0;g<=b;)if(n<c[h].length&&c[h][n].start<g){var l="";c[h][n].start>=a&&(l+=" start");c[h][n].stop<=b&&(l+=" end");if(c[h][n].stop>=b){i+="<td class='td-m' colspan='"+(7-j)+"'>";i+=this.get_event_html(c[h][n],!1,l);i+="</td>";break}else{var o=this.day_span(f,b<c[h][n].stop?b:c[h][n].stop);j+=o;f.setDate(f.getDate()+o);g.setDate(g.getDate()+o);i+="<td class='td-m' colspan='"+o+"'>";i+=this.get_event_html(c[h][n],
!1,l);i+="</td>";n++}}else i+="<td class='filler-cell'></td>",f.setDate(f.getDate()+1),g.setDate(g.getDate()+1),j++;i+="</tr>"}i+='</tbody></table></div></div><div style="clear: both"></div></div>';return i},get_prev_next_html:function(){var a='<div class="prev_next">';a+='<table><tbody><tr><td valign="middle" width="100" align="left"><input class="nav_left" type="button" value="" />&nbsp;<input class="nav_right" type="button" value="" /></td><td align="left" valign="middle"><span class="current_date_range">&nbsp;</span>&nbsp;</td><td align="right">'+
this.get_switch_types_html()+"</td></tr></tbody></table></div>";return a},get_switch_types_html:function(){var a="";d.allowed_display_types[0]&&(a+='<input class="button day_button" type="button" value="'+"day".localize()+'" />');d.allowed_display_types[1]&&(a+='<input class="button week_button" type="button" value="'+"week".localize()+'" />');d.allowed_display_types[2]&&(a+='<input class="button month_button" type="button" value="'+"month".localize()+'" />');d.allowed_display_types[3]&&(a+='<input class="button year_button" type="button" value="'+
"year".localize()+'" />');return a},get_month_header:function(){var a;if(d.week_start==0){a='<div class="day-header"><table cellspacing="0" border="0" summary="Days of Weeks" class="header"><tbody><tr>';for(var b=0;b<7;b++)a+="<td class='day_name'>"+r[b].localize()+"</td>";a+="</tr></tbody></table></div>"}else a='<div class="day-header"><table cellspacing="0" border="0" summary="Days of Weeks" class="header"><tbody><tr><th>'+r[1].localize()+"</th><th>"+r[2].localize()+"</th><th>"+r[3].localize()+
"</th><th>"+r[4].localize()+"</th><th>"+r[5].localize()+"</th><th>"+r[6].localize()+"</th><th>"+r[0].localize()+"</th></tr></tbody></table></div>";return a},get_week_subheader:function(a){for(var b="<tr>",c=0;c<7;c++){var f,g,e,h,i;c==6?f="last":f="";g=new Date(a.getFullYear(),a.getMonth(),a.getDate()+c);h=e="";d.allowed_display_types[0]&&(h="onClick='jQuery(\"#"+d.id+'").dmxAjaxCalendar("set_calendar_day",['+g.getDate()+", "+g.getMonth()+", "+g.getFullYear()+", false])'",f+=" clickable");g.getDate()==
1&&(e='<span class="month-text">'+p(v[g.getMonth()].localize(),3),e+="</span>");i="";g.getDate()==1&&g.getMonth()==0&&(i+=", "+g.getFullYear());b+="<th "+h+' class="month_day_header '+f+'"><span class="day-number">'+g.getDate()+i+"</span>"+e+"</th>"}b+="</tr>";return b},get_month_content_html:function(a,b){var c,d,g,e;c=new Date(a.getTime());d=new Date(b.getTime());g=new Date(a.getTime());e=new Date(b.getTime());d=this.get_rows_from_events(this.get_events(a,b),c,d);c='<div class="week"><table cellspacing="0" border="0"><tbody>';
c+=this.get_week_subheader(g,e);for(e=0;e<d.length;e++){c+="<tr>";var h,i,j;h=new Date(a.getTime());i=new Date(a.getTime());i.setDate(i.getDate()+1);for(j=g=0;i<=b;)if(g<d[e].length&&d[e][g].start<i){var k="";d[e][g].start>=a&&(k+=" start");d[e][g].stop<=b&&(k+=" end");if(d[e][g].stop>=b){c+="<td class='td-m' colspan='"+(7-j)+"'>";c+=this.get_event_html(d[e][g],!1,k);c+="</td>";break}else{var l=this.day_span(h,b<d[e][g].stop?b:d[e][g].stop);j+=l;h.setDate(h.getDate()+l);i.setDate(i.getDate()+l);c+=
"<td class='td-m' colspan='"+l+"'>";c+=this.get_event_html(d[e][g],!1,k);c+="</td>";g++}}else c+="<td class='filler-cell'></td>",h.setDate(h.getDate()+1),i.setDate(i.getDate()+1),j++;c+="</tr>"}d=4-d.length;for(g=0;g<d;g++){c+="<tr><td class='filler-cell'></td>";for(e=0;e<6;e++)c+="<td class='filler-cell'></td>"}c+="</tr></tbody></table></div>";return c},get_event_html:function(a,b,c){typeof c=="undefined"&&(c="");typeof b=="undefined"&&(b=!1);var f="<div ev_id='"+a.ev_id+"' class=\"event event-type-"+
a.type+" color-"+a.type+c+'">\t<div class="text-outer"><div class="text">',g="";if(c.indexOf("start")>-1&&!this.is_midnight(a.start)&&(d.display_type!=2||d.time_in_month_view))g+="("+this.get_time_display(a.start)+") ";g+=a.name;c=e("<div></div>").text(a.name).html();f+=d.link_google_events?"<a target='_blank' title='"+c+"' href='"+a.link+"'><bdo dir=\""+d.text_direction+'">'+g+"</bdo></a>":"<bdo title='"+c+"' dir=\""+d.text_direction+'">'+g+"</bdo>";b&&(b=this.get_time_display(a.start),g=this.get_time_display(a.stop),
f+="<p>"+b+"-"+g+'</p><p><bdo dir="'+d.text_direction+'">'+a.description+"</bdo></p>");f+="</div></div></div>";return f},day_span:function(a,b){var a=this.get_date_only(a),c=this.date_diff("d",a,b);return Math.max(1,this.is_midnight(b)?c:c+1)},date_diff:function(a,b,c){switch(a){case "y":return c.getFullYear()-b.getFullYear();case "m":return(c.getFullYear()-b.getFullYear())*12+(c.getMonth()-b.getMonth());case "w":return Math.floor((c-b)/6048E5);case "d":return Math.floor((c-b)/864E5);case "h":return Math.floor((c-
b)/36E5);case "n":return Math.floor((c-b)/6E4);case "s":return Math.floor((c-b)/1E3);case "ms":return Math.floor((c-b)/1)}return 0},get_date_only:function(a){return new Date(a.getFullYear(),a.getMonth(),a.getDate())},is_midnight:function(a){return a.getHours()+a.getMinutes()+a.getSeconds()+a.getMilliseconds()===0},get_rows_from_events:function(a,b,c){this.sort_events_by_start_date(a);for(var d=[],e=new Date(b.getTime()),h=[];a.length>0;)if(h.push(a[0]),a[0].stop.getHours()+a[0].stop.getMinutes()+
a[0].stop.getSeconds()==0?(e.setFullYear(a[0].stop.getFullYear()),e.setMonth(a[0].stop.getMonth()),e.setDate(a[0].stop.getDate())):e=new Date(a[0].stop.getFullYear(),a[0].stop.getMonth(),a[0].stop.getDate()+1),a.splice(0,1),e-c>=0)d.push(h),h=[],e=new Date(b.getTime());else{for(var i=!1;e-c<=0;){for(var i=!1,j=0;j<a.length;j++)if(this.compare_date(e,a[j].start)&&(i=!0,h.push(a[j]),a[j].stop.getHours()+a[j].stop.getMinutes()+a[j].stop.getSeconds()==0?e=new Date(a[j].stop.getTime()):(e=new Date(a[j].stop.getTime()),
e.setDate(e.getDate()+1)),a.splice(j,1),e>=c)){d.push(h);h=[];e=new Date(b.getTime());break}i||e.setDate(e.getDate()+1)}i||(h.length>0&&(d.push(h),h=[]),e=new Date(b.getTime()))}return d},compare_date:function(a,b){if(a.getFullYear()==b.getFullYear()&&a.getMonth()==b.getMonth()&&a.getDate()==b.getDate())return!0;return!1},add_event:function(a){h.push(a)},add_year_event:function(a){h.push(a)},get_events:function(a,b,c){typeof multi_and_only=="undefined"&&(multi_and_only=!1);for(var d=[],e=0;e<h.length;e++)if(h[e].start<
b&&h[e].stop>a&&events_filter_array[h[e].type]){var i=new E(h[e].original_id,h[e].name,h[e].start,h[e].stop,h[e].description,h[e].type-1,h[e].link,e);(!c||!this.is_same_date(i.start,i.stop))&&d.push(i)}return d},is_same_date:function(a,b){return a.getDate()==b.getDate()&&this.is_same_month(a,b)},is_same_month:function(a,b){return a.getMonth()==b.getMonth()&&this.is_same_year(a,b)},is_same_year:function(a,b){return a.getFullYear()==b.getFullYear()},get_max_events_on_single_day:function(a,b,c){for(maxCount=
0;b<=c;){var d=this.get_events_on_day(a,b);d>maxCount&&(maxCount=d);b=new Date(b.getFullYear(),b.getMonth(),b.getDate()+1)}return maxCount},get_events_on_day:function(a,b){var c=0,d=new Date(b.getTime());d.setDate(d.getDate()+1);for(var e;e<a.length;e++)a[e].start<d&&a[e].stop>=b&&c++;return c}});e(o).data("options",d);z=new Date;w=new Date;x=new Date;w.setMonth(w.getMonth()-3);x.setMonth(x.getMonth()+3);q=z.getDate();l=z.getMonth();i=z.getFullYear();events_filter_array=[!0,!0,!0,!0,!0,!0,!0,!0,!0];
d.events_type=d.events_type.sort(N);F=0;h=[];v=["january","february","march","april","may","june","july","august","september","october","november","december"];r=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];j.draw_calendar();j.load_events()};jQuery.dmxAjaxCalendar.defaults={id:"dmxCalendar1",calendar_name:"Events Calendar",height:600,fixed_height:!1,width:800,link_google_events:!1,use_working_hours:!1,working_hours_start:0,working_hours_stop:24,week_start:0,num_columns_year_view:4,
animation_duration:500,clock_type:0,date_display_type:0,use_animation:!0,animation_easing:"linear",time_conversion:"none",allowed_display_types:[!0,!0,!0,!0],navigation_position:"inside",legend_position:"bottom",events_type:["Type 1","Type 2","Type 3","Type 4","Type 5","Type 6","Type 7","Type 8","Type 9"],display_type:2,resized:!1,google_feeds:[],ajax_feeds:[],onNext:"",onPrevious:"",onDay:"",onWeek:"",onMonth:"",onYear:"",onEventClick:"",onEventMouseOver:"",onEventMouseOut:"",onFeedsLoaded:"",onYearEventClick:"",
onYearEventMouseOver:"",onYearEventMouseOut:"",onYearFreeDayClick:"",onYearFreeDaytMouseOver:"",onYearFreeDayMouseOut:"",text_direction:"ltr",time_in_month_view:!1};jQuery.fn.extend({get_space:function(e){var d=0,e=e.substr(0,1).toUpperCase()+e.substr(1).toLowerCase();d+=parseInt(this.css("padding"+e))|0;d+=parseInt(this.css("border"+e+"Width"))|0;d+=parseInt(this.css("margin"+e))|0;return d}});var C=0;e.getScrollbarWidth=function(){if(!C)if(e.browser.msie){var o=e('<textarea cols="10" rows="2"></textarea>').css({position:"absolute",
top:-1E3,left:-1E3}).appendTo("body"),d=e('<textarea cols="10" rows="2" style="overflow: hidden;"></textarea>').css({position:"absolute",top:-1E3,left:-1E3}).appendTo("body");C=o.width()-d.width();o.add(d).remove()}else o=e("<div />").css({width:100,height:100,overflow:"auto",position:"absolute",top:-1E3,left:-1E3}).prependTo("body").append("<div />").find("div").css({width:"100%",height:200}),C=100-o.width(),o.parent().remove();return C};String.prototype.localize=function(){var e;if(typeof localized_strings!=
"undefined"&&(e=localized_strings[this]))return e;return this}})(jQuery);

