(function(a){a.extend({minical:new function(){var c;var e;var g;var d;var b={startDate:null,endDate:null,firstDayOfWeek:1,navLinks:{p:"&laquo;",n:"&raquo;"},onMonthChanging:function(m,n){return true},onMonthChanged:function(m,n){return true},onEventClick:function(n,m){return true},locale:{days:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sun"],months:["January","February","March","April","May","June","July","August","September","October","November","December"]}};var j=function(m){return new Date(m.substring(6,10),m.substring(2,4)-1,m.substring(4,6))};var i=function(n){var o=((n.getMonth()+1)<10)?"0"+(n.getMonth()+1):(n.getMonth()+1);var m=(n.getDate()<10)?"0"+n.getDate():n.getDate();return"c_"+o+m+n.getFullYear()};var l=function(m){if(Date.prototype.tempDate){return}Date.prototype.tempDate=null;Date.prototype.months=b.locale.months;Date.prototype.days=b.locale.days;Date.prototype.toShortDateString=function(){return(this.getMonth()+1)+"/"+this.getDate()+"/"+this.getFullYear()};Date.prototype.addDays=function(o){this.setDate(this.getDate()+o);this.tempDate=this.getDate()};Date.prototype.getMaxDays=function(){var o=new Date(Date.parse(this)),p=28,n;n=o.getMonth();p=28;while(o.getMonth()==n){p++;o.setDate(p)}return p-1}};var k=function(x,C){var K=new Date();var L;var n=b.startDate!=null?new Date(b.startDate.getFullYear(),b.startDate.getMonth(),1):null;var G=b.endDate!=null?new Date(b.endDate.getFullYear(),b.endDate.getMonth(),1):null;if(C==undefined){L=new Date(K.getFullYear(),K.getMonth(),1);if(n!=null&&L.getTime()<n.getTime()){L=n}else{if(G!=null&&L.getTime()>G.getTime()){L=G}}}else{L=C;L.setDate(1)}g=L;var M=L.getMonth()==0?new Date(L.getFullYear()-1,11,1):new Date(L.getFullYear(),L.getMonth()-1,1);if(n!=null&&n.getTime()>M.getTime()){var q=a('<div class="MonthNavPrev">'+b.navLinks.p+"</div>")}else{var q=a('<div class="MonthNavPrev"><a href="" class="link-prev">'+b.navLinks.p+"</a></div>").click(function(){f(x,M);return false})}var m=L.getMonth()==11?new Date(L.getFullYear()+1,0,1):new Date(L.getFullYear(),L.getMonth()+1,1);if(G!=null&&new Date(G.getFullYear(),G.getMonth(),1)<m.getTime()){var H=a('<div class="MonthNavNext">'+b.navLinks.n+"</div>")}else{var H=jQuery('<div class="MonthNavNext"><a href="" class="link-next">'+b.navLinks.n+"</a></div>").click(function(){f(x,m);return false})}var z=jQuery('<tr><td colspan="7"><div class="FormHeader MonthNavigation"></div></td></tr>');a(".MonthNavigation",z).append(H);a(".MonthNavigation",z).append(q);a(".MonthNavigation",z).append(a('<div class="MonthName"></div>').append(b.locale.months[L.getMonth()]+" "+L.getFullYear()));var w=jQuery("<tr></tr>");for(var E=b.firstDayOfWeek;E<b.firstDayOfWeek+7;E++){var o=E%7;var v=b.locale.days[o];w.append('<th title="'+v+'" class="DateHeader'+(o==0||o==6?" Weekend":"")+'"><span>'+v+"</span></th>")}w=jQuery("<thead></thead>").append(w);w=w.prepend(z);var p=jQuery('<tbody id="CalendarBody"></tbody>');var s=(L.getMonth()==K.getMonth()&&L.getFullYear()==K.getFullYear());var J=L.getMaxDays();var r=b.firstDayOfWeek-L.getDay();if(r>0){r-=7}var y=(J+Math.abs(r));c=new Date(L.getFullYear(),L.getMonth(),r+1);e=new Date(L.getFullYear(),L.getMonth()+1,(7-(y%=7))==7?0:(7-(y%=7)));var F=new Date(c.getFullYear(),c.getMonth(),c.getDate());var u=0;do{var D=jQuery("<tr></tr>");for(var E=0;E<7;E++){var A=F.getDate();var o=(b.firstDayOfWeek+E)%7;var B={"class":"DateBox"+(o==0||o==6?" Weekend ":""),date:F.toShortDateString(),id:i(F)};if(r<0||r>=J){A=""}else{L.setDate(r+1)}if(s&&r+1==K.getDate()){dayStr=r+1;B["class"]+=" Today"}D.append(jQuery("<td></td>").attr(B).append(A));r++;u++;F.addDays(1)}p.append(D)}while(r<J);var I=a('<table cellpadding="0" tablespacing="0"></table>');I=I.append(w,p);x.hide();x.html(I);x.fadeIn("fast")};var h=function(m){if(d&&d.length>0){a.each(d,function(){var p=this;if((p.Date>=c)&&(p.Date<=e)&&(p.Date.getMonth()==g.getMonth())){var n=a("#"+i(p.Date),a(m));if(p.Before!==undefined&&p.Before!=""){n.prepend(p.Before)}if(p.After!==undefined&&p.After!=""){n.append(p.After)}if(p.URL!==undefined&&p.URL!=""){var o=a('<a href="'+p.URL+'"></a>').click(function(){b.onEventClick(m,p)});n.wrapInner(o)}if(p.Tooltip!==undefined&&p.Tooltip!=""){n.attr("title",p.Tooltip.title).tooltip(p.Tooltip.options)}if(p.Class!==undefined&&p.Class!=""){n.addClass(p.Class)}n.addClass("Event")}})}};var f=function(m,n){b.onMonthChanging(m,n);k(m,n);b.onMonthChanged(m,n);h(m)};this.construct=function(n,o){var p=this;var m=new Date();this.empty();n=a.extend(b,n);l(n);k(p);if(o){d=o;h(p)}}}});a.fn.extend({minical:a.minical.construct})})(jQuery);