var ec3={version:"3.2.beta2",today:new Date(),calendars:[],allday:"all day",ELEMENT_NODE:1,TEXT_NODE:3,init:function(){ec3.today_day_num=ec3.today.getDate();ec3.today_month_num=ec3.today.getMonth()+1;ec3.today_year_num=ec3.today.getFullYear();ec3.imgwait=new Image(14,14);ec3.imgwait.src=ec3.myfiles+"/ec_load.gif";ec3.viewpostsfor=ec3.unencode(ec3.viewpostsfor);for(var c=0;c<ec3.month_of_year.length;c++){ec3.month_of_year[c]=ec3.unencode(ec3.month_of_year[c])}for(var b=0;b<ec3.month_abbrev.length;b++){ec3.month_abbrev[b]=ec3.unencode(ec3.month_abbrev[b])}},do_onload:function(b){var c=window.onload;window.onload=function(){if(c){c()}b()}},new_calendar:function(b,c){var d=new ec3.Calendar(b);if(c&&c.hasOwnProperty("hide_logo")){d.hide_logo=c.hide_logo}ec3.do_onload(function(){d.init()});ec3.calendars[b]=d;return d},unencode:function(b){if(!ec3.unencodeDiv){ec3.unencodeDiv=document.createElement("div")}ec3.unencodeDiv.innerHTML=b;return(ec3.unencodeDiv.innerText||ec3.unencodeDiv.firstChild.nodeValue)},get_child_by_tag_name:function(d,e){var c=d.getElementsByTagName(e);if(c){for(var b=0;b<c.length;b++){if(c[b].parentNode==d){return c[b]}}}return 0},calc_day_id:function(b,c,d){if(ec3.today_day_num==b&&ec3.today_month_num==c&&ec3.today_year_num==d){return"today"}else{return"ec3_"+d+"_"+c+"_"+b}},add_class:function(f,c){if(f.className.length==0){f.className=c}else{if(-1==f.className.indexOf(c)){f.className+=" "+c}else{var e=f.className.split(" ");for(var d=0,b=e.length;d<b;d++){if(e[b-d-1]==c){return}}f.className+=" "+c}}},parse_datetime:function(c){if(c&&c.length){var d=c.split(" ");var e=d[0].split("-");var b=d[1].split(":");return new Date(parseInt(e[0],10),parseInt(e[1],10)-1,parseInt(e[2],10),parseInt(b[0],10),parseInt(b[1],10),parseInt(b[2],10))}return null},attr2bool:function(c,d){var e;if(typeof c.getAttributeNode=="function"){var f=c.getAttributeNode(d);return(f&&f.specified&&f.value=="1")?true:false}else{var b=c.getAttribute(d);return(b&&b=="1")?true:false}},extend:function(b,c){for(k in c){b[k]=c[k]}}};ec3.do_onload(function(){ec3.init()});ec3.Calendar=function(b){this.cal_id=b};ec3.Calendar.prototype={hide_logo:false,full_id:function(b){return this.cal_id+"-"+b},short_id:function(b){return b.substr(this.cal_id.length)},getElementById:function(b){return document.getElementById(this.full_id(b))},init:function(){this.reqs=new Array();this.div=document.getElementById(this.cal_id);var g=this.getElementById("ec3_prev");var f=this.getElementById("ec3_next");if(g&&f){var j=new RegExp("[&?]ec3_listing=[eE].*$");var d=j.exec(g.href);if(d){this.is_listing=true}var c=this;g.onclick=function(){c.go_prev();return false};f.onclick=function(){c.go_next();return false};g.href="#";f.href="#"}if(typeof ec3_Popup!="undefined"){var h=this.get_calendars();if(h){for(var e=0,b=h.length;e<b;e++){ec3_Popup.add_tbody(ec3.get_child_by_tag_name(h[e],"tbody"))}}}},create_calendar:function(q,e,n){var s=q.cloneNode(1);var m=e-1;var t=ec3.get_child_by_tag_name(s,"caption");if(t){var p=ec3.get_child_by_tag_name(t,"a");var g=ec3.month_of_year[m]+" "+n;if(p&&p.firstChild&&p.firstChild.nodeType==ec3.TEXT_NODE){if(e<10){p.href=ec3.home+"/?m="+n+"0"+e}else{p.href=ec3.home+"/?m="+n+e}if(this.is_listing){p.href+="&ec3_listing=events"}p.title=ec3.viewpostsfor;p.title=p.title.replace(/%1\$s/,ec3.month_of_year[m]);p.title=p.title.replace(/%2\$s/,n);p.firstChild.data=g}}if(t&&t.firstChild&&t.firstChild.nodeType==ec3.TEXT_NODE){t.firstChild.data=ec3.month_of_year[m]+" "+n}var l=ec3.get_child_by_tag_name(s,"tbody");while(l.lastChild){l.removeChild(l.lastChild)}var h=new Date(n,m,1,12,0,0);var o=document.createElement("tr");var i,d;l.appendChild(o);var b=0;var f=0;while(h.getMonth()==m&&b<40){var r=(h.getDay()+7-ec3.start_of_week)%7;if(f>6){o=document.createElement("tr");l.appendChild(o);f=0}if(f<r){i=document.createElement("td");i.colSpan=r-f;i.className="pad";o.appendChild(i);f=r}i=document.createElement("td");i.ec3_daynum=h.getDate();var j=ec3.calc_day_id(h.getDate(),e,n);i.id=this.full_id(j);if(j=="today"){i.className="ec3_today"}this.new_day(i);o.appendChild(i);f++;b++;h.setDate(h.getDate()+1)}if(f<7){i=document.createElement("td");i.colSpan=7-f;i.className="pad";o.appendChild(i)}if((7-f)>1&&!this.hide_logo){a=document.createElement("a");a.href="http://blog.firetree.net/?ec3_version="+ec3.version;a.title="Event Calendar "+ec3.version;i.style.verticalAlign="bottom";i.appendChild(a);d=document.createElement("div");d.className="ec3_ec";d.align="right";a.appendChild(d)}s.id=this.full_id("ec3_"+n+"_"+e);return s},loadDates:function(d,f){var e=new XMLHttpRequest();if(e){this.reqs.push(e);var b=this;e.onreadystatechange=function(){b.process_xml()};var c=ec3.home+"/?feed=ec3xml&year="+f+"&monthnum="+d;if(this.is_listing){c+="&ec3_listing=events"}e.open("GET",c,true);this.set_spinner(1);e.send(null)}},get_calendars:function(){var b=new Array();for(var d=0;d<this.div.childNodes.length;d++){var e=this.div.childNodes[d];if(e.id&&e.id.search(this.full_id("ec3_[0-9]"))==0&&e.style.display!="none"){b.push(this.div.childNodes[d])}}if(b.length>0){return b}else{return 0}},rewrite_controls:function(d,e){var c=this.getElementById("ec3_prev");if(c&&c.firstChild&&c.firstChild.nodeType==ec3.TEXT_NODE){c.firstChild.data="\u00ab\u00a0"+ec3.month_abbrev[d%12]}var b=this.getElementById("ec3_next");if(b&&b.firstChild&&b.firstChild.nodeType==ec3.TEXT_NODE){b.firstChild.data=ec3.month_abbrev[e%12]+"\u00a0\u00bb"}},set_spinner:function(b){var d=this.getElementById("ec3_spinner");var c=this.getElementById("ec3_publish");if(d){if(b){d.style.display="inline";if(c){c.style.display="none"}}else{d.style.display="none";if(c){c.style.display="inline"}}}},go_prev:function(){var g=this.get_calendars();if(!g){return}var b=g[0].parentNode;var d=this.short_id(g[0].id).split("_");if(d.length<3){return}var f=parseInt(d[1]);var c=parseInt(d[2])-1;if(c==0){c=12;f--}var e=this.getElementById("ec3_"+f+"_"+c);if(e){e.style.display=this.calendar_display}else{e=this.create_calendar(g[0],c,f);b.insertBefore(e,g[0]);this.loadDates(c,f)}this.calendar_display=g[g.length-1].style.display;g[g.length-1].style.display="none";this.rewrite_controls(c+10,c+g.length-1)},go_next:function(){var h=this.get_calendars();if(!h){return}var c=h[0].parentNode;var b=h[h.length-1];var e=this.short_id(b.id).split("_");if(e.length<3){return}var g=parseInt(e[1]);var d=1+parseInt(e[2]);if(d==13){d=1;g++}var f=this.getElementById("ec3_"+g+"_"+d);if(f){f.style.display=this.calendar_display}else{f=this.create_calendar(h[0],d,g);if(b.nextSibling){c.insertBefore(f,b.nextSibling)}else{c.appendChild(f)}this.loadDates(d,g)}this.calendar_display=h[0].style.display;h[0].style.display="none";this.rewrite_controls(d-h.length+11,d)},process_xml:function(){var d=0;for(var b=0;b<this.reqs.length;b++){var c=this.reqs[b];if(c){if(c.readyState==4){this.reqs[b]=0;if(c.status==200){this.update_days(new ec3.xml.Calendar(c.responseXML))}}else{d=1}}}if(!d){while(this.reqs.shift&&this.reqs.length&&!this.reqs[0]){this.reqs.shift()}this.set_spinner(0)}},update_days:function(c){for(var d=0,b=c.day.length;d<b;d++){var f=this.getElementById(c.day[d].id());if(f&&f.ec3_daynum){this.update_day(f,c.day[d])}}if(typeof ec3_Popup!="undefined"){var e=this.getElementById(c.id());if(e){ec3_Popup.add_tbody(ec3.get_child_by_tag_name(e,"tbody"))}}},new_day:function(b){b.appendChild(document.createTextNode(b.ec3_daynum))},update_day:function(e,d){ec3.add_class(e,"ec3_postday");var b=e.removeChild(e.firstChild);var c=document.createElement("a");c.href=d.link();c.title=d.titles();if(d.is_event()){ec3.add_class(e,"ec3_eventday");c.className="eventday"}c.appendChild(b);e.appendChild(c)}};ec3.xml={details:[]};ec3.xml.Calendar=function(b){this.element=b;this.init()};ec3.xml.Calendar.prototype={day:[],init:function(){var d=this.element.getElementsByTagName("day");for(var c=0,b=d.length;c<b;c++){this.day[c]=new ec3.xml.Day(this,d[c])}},id:function(){var b=this.element.getElementsByTagName("month");if(b){return b[0].getAttribute("id")}else{return""}},_detail:function(d){if(!ec3.xml.details[d]){var f=this.element.getElementsByTagName("detail");for(var e=0,b=f.length;e<b;e++){var c=f[e].getAttribute("id");if(c){ec3.xml.details[c]=f[e]}}}return ec3.xml.details[d]}};ec3.xml.Day=function(c,b){this.calendar=c;this.element=b};ec3.xml.Day.prototype={id:function(){return this.element.getAttribute("id")},link:function(){return this.element.getAttribute("link")},titles:function(){return this.element.getAttribute("titles")},is_event:function(){return ec3.attr2bool(this.element,"is_event")},date:function(){var b=this.element.getAttribute("date").split("-");return new Date(parseInt(b[0],10),parseInt(b[1],10)-1,parseInt(b[2],10))},_events:function(c){var e=this.element.getElementsByTagName("event");if(e){for(var d=0,b=e.length;d<b;d++){c.push(new ec3.xml.Event(this,e[d]))}}return c},_posts:function(c){var e=this.element.getElementsByTagName("post");if(e){for(var d=0,b=e.length;d<b;d++){c.push(new ec3.xml.Post(this,e[d]))}}return c},events:function(b){return this._events([])},posts:function(b){return this._posts([])},posts_and_events:function(){var b=[];b=this._posts(b);b=this._events(b);return b}};ec3.xml.Post=function(b,c){this.day=b;this.element=c};ec3.xml.Post.prototype={kind:"post",brief:function(){return""},link:function(){return this._detail().getAttribute("link")},title:function(){return this._detail().getAttribute("title")},excerpt:function(){var b=this._detail().getElementsByTagName("excerpt");if(b){return b[0].firstChild.data}else{return""}},_detail:function(){return this.day.calendar._detail(this.element.getAttribute("post_id"))}};ec3.xml.Event=function(b,c){this.day=b;this.element=c};ec3.extend(ec3.xml.Event.prototype,ec3.xml.Post.prototype);ec3.extend(ec3.xml.Event.prototype,{kind:"event",allday:function(){return ec3.attr2bool(this.element,"allday")},brief:function(){if(this.allday()){return ec3.allday}var b="";var d=this.element.getElementsByTagName("start");var c=this.element.getElementsByTagName("end");if(d&&d.length){b=d[0].getAttribute("time");if(c&&c.length){b+=" - "+c[0].getAttribute("time")}else{b+="..."}}else{if(c&&c.length){b="..."+c[0].getAttribute("time")}else{b="..."+ec3.allday+"..."}}return b}});
