/*
 * tinycal v2.2
 *
 * copyright (c) 2008-2009 Kjell-Inge Gustafsson kigkonsult
 * www.kigkonsult.se/tinycal/index.php
 * ical@kigkonsult.se
 * updated 20090118
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * tinycal function javascript
 *
**/
Date.prototype.getRealMonth=function(){return this.getMonth()+1};Date.prototype.getWeek=function(k){k=k||0;var e,g,i,p,f,o,n,j,d,l,q,h,b,c;e=this.getFullYear();g=this.getMonth();i=this.getDate();p=new Date(e,g,i);f=p.getDay();if((0==f)&&(1==k)){f=7}o=(0==k)?3:4;while(f!=o){i+=(f<o)?+1:-1;p.setFullYear(e,g,i);e=p.getFullYear();g=p.getMonth();i=p.getDate();f=p.getDay();if((0==f)&&(1==k)){f=7}}g+=1;n=Math.floor((14-(g))/12);j=e+4800-n;d=(g)+(12*n)-3;l=i+Math.floor(((153*d)+2)/5)+(365*j)+Math.floor(j/4)-Math.floor(j/100)+Math.floor(j/400)-32045;q=(l+31741-(l%7))%146097%36524%1461;h=Math.floor(q/1460);b=((q-h)%365)+h;c=Math.floor(b/7)+1;return new Array(c,e,g)};Date.prototype.setDateFirstDayOfWeek=function(d){var b,a,c,e;d=d||0;b=this.getFullYear();a=this.getMonth();c=this.getDate();e=this.getDay();if((1==d)&&(0==e)){e=7}while(e>d){this.setFullYear(b,a,(c-1));b=this.getFullYear();a=this.getMonth();c=this.getDate();e=this.getDay()}};Date.prototype.getDayix=function(a,b){var c;b=b||a.tcDay;this.setFullYear(a.tcYear,(a.tcMonth-1),b);c=this.getDay()+1;if(1==a.tcWeekStart){if(1==c){c=8}c-=1}return c};function tclastDayInMonth(b,c){var a,e;a=new Date(b,(c-1),1);for(e=31;e>27;e--){a.setFullYear(b,(c-1),e);if(c==a.getRealMonth()){return e}}}function v(b,a){a=a||1;return"tc"+a+"_"+b}function vtcid(b){var a=b.indexOf("_");return(2<a)?b.substring(2,a):1}function tcobj(b){this.tcid=b||1;this.tctest=0;this.tcWeekStart=1;this.tcDaystartHour=8;this.tcDayendHour=17;this.tcStartView="month";this.tcAllowedViews=new Array("month","week","day","comp","list","download");this.tcordnoMax=null;this.tcUID=null;this.tcUrl=null;this.tcData1=null;this.tccomptype=null;var a=new Date();this.tcYear=a.getFullYear();this.tcMonth=a.getRealMonth();this.tcDay=a.getDate();this.tcWeekno=a.getWeek(this.tcWeekStart)[0];this.v=v;this.vtcid=vtcid}function tcget(e,b,a){var d=v(e,b),c;if(!$(d)){return null}if($(d).innerHTML){c=$(d).innerHTML}else{c=$F(d)}if(a){return parseInt(c,10)}else{return c}}function tcgetcfg(d,c,e){var b=tcget("config",d),f=b.split("|"),a=new tcobj();a.tcid=d;a.tcView=f[0];a.tcYear=parseInt(f[1],10);a.tcMonth=parseInt(f[2],10);a.tcDay=parseInt(f[3],10);a.tcWeekno=parseInt(f[4],10);a.tcWeekStart=parseInt(f[5],10);a.tcDaystartHour=parseInt(f[6],10);a.tcDayendHour=parseInt(f[7],10);a.tcUrl=f[8];a.tcData1=f[9];a.tccomptype=f[10];a.tcordnoMax=f[11];a.tcUID=f[12];a.tcmonthOk=f[13];a.tcweekOk=f[14];a.tcdayOk=f[15];a.tccompOk=f[16];a.tclistOk=f[17];a.tcListItems=parseInt(f[18],10);a.tcColWidth=parseInt(f[19],10);a.tcdlMonthOk=parseInt(f[20],10);a.tcdlWeekOk=parseInt(f[21],10);a.tcdlDayOk=parseInt(f[22],10);a.tcdlCompOk=parseInt(f[23],10);a.tcdlListOk=parseInt(f[24],10);a.tcdlTotalOk=parseInt(f[25],10);a.oddrowbgcolor=f[26];a.tcCompProps=f[27];a.tcListProps=f[28];a.tctest=parseInt(f[29]||"",10);c=c||a.tctest;e=e||"";if(c<=a.tctest){tctest(a,e+" - getcfg out")}return a}function tcputcfg(a,c,e){var b="|",d="";d+=a.tcView;d+=b+a.tcYear;d+=b+a.tcMonth;d+=b+a.tcDay;d+=b+a.tcWeekno;d+=b+a.tcWeekStart;d+=b+a.tcDaystartHour;d+=b+a.tcDayendHour;d+=b+a.tcUrl;d+=b+a.tcData1;d+=b+a.tccomptype;d+=b+a.tcordnoMax;d+=b+a.tcUID;d+=b+a.tcmonthOk;d+=b+a.tcweekOk;d+=b+a.tcdayOk;d+=b+a.tccompOk;d+=b+a.tclistOk;d+=b+a.tcListItems;d+=b+a.tcColWidth;d+=b+a.tcdlMonthOk;d+=b+a.tcdlWeekOk;d+=b+a.tcdlDayOk;d+=b+a.tcdlCompOk;d+=b+a.tcdlListOk;d+=b+a.tcdlTotalOk;d+=b+a.oddrowbgcolor;d+=b+a.tcCompProps;d+=b+a.tcListProps;d+=b+a.tctest;tcput("config",a.tcid,d);c=c||a.tctest;e=e||"";if(c<=a.tctest){tctest(a,e+" - putcfg out")}}function tcput(f,a,b){var d=$(v(f,a));b=b||"";if(!d){alert("tcput ERROR 1\ntcid="+a+"\nsuffix="+f+"\nvalue="+b)}if("INPUT"==d.nodeName){d.value=b}else{try{d.innerHTML=b}catch(c){alert("tcput ERROR 2\nid="+d.id+"\nnodeName="+d.nodeName)}}}function tcaddElem(b,d,a,f,c){var g,e;if(/MSIE (\d+\.\d+);/.test(navigator.userAgent)){e="<"+d;if(null!=a){a.each(function(h){e+=" "+h.key+'="'+h.value+'"'})}if(("input"==d)&&f){e+=' value="'+f+'"'}e+=">";g=document.createElement(e);if(("input"!=d)&&f){g.innerHTML=f}}else{if(!f){f=""}g=document.createElement(d);if(null!=a){a.each(function(h){g.setAttribute(h.key,h.value)})}if("input"==d){g.value=f}else{if(f>""){g.innerHTML=f}}}$(b).appendChild(g);if(g.id&&c){tcsetStls(g.id,c)}}function tcsetStls(b,a){if("">=a){return}b=$(b).id;a.split(";").each(function(c){if("">=c){return}var d="",e="";d=c.split(":");d[0].split("-").each(function(f){if("">=e){e=f}else{e+=f.substr(0,1).toUpperCase()+f.substr(1)}});if(("textAlign"==e)&&(/MSIE (\d+\.\d+);/.test(navigator.userAgent))){b=$(b).ancestors()[0].id;if("TD"!=$(b).nodeName){$(b).align=d[1]}}else{$(b).style[e]=d[1]}})}function tcclearComp(a){if(1<=a.tctest){tctest(a,"clearComp start")}tcRemoveEvListCont(a.tcid,"c");$(v("c",a.tcid)).immediateDescendants().each(function(b){b.remove()});tcsetStls(v("c",a.tcid),"background-color:white")}function tcclearList(a){if(1<=a.tctest){tctest(a,"clearList start")}tcRemoveEvListCont(a.tcid,"l");$(v("l",a.tcid)).immediateDescendants().each(function(b){b.remove()})}function tcclearDay(a){if(1<=a.tctest){tctest(a,"clearDay start")}tcRemoveEvListCont(a.tcid,"d");var d=v("dtr",a.tcid),c,b;for(b=(a.tcDaystartHour-1);b<=(a.tcDayendHour+1);b++){c=d+b+"data";$(c).immediateDescendants().each(function(f){f.remove()});$(c).setAttribute("cntno",0)}}function tcclearMonth(a){if(1<=a.tctest){tctest(a,"clearMonth start")}tcRemoveEvListCont(a.tcid,"m");var d,c,e,b;for(e=1;e<7;e++){d="mtr"+e;tcput(d+"0w",a.tcid);tcput(d+"0y",a.tcid);for(b=1;b<8;b++){c=d+b+"data";tcsetStls(v(c,a.tcid),"color:#606060;fontWeight:normal");$(v(c,a.tcid)).title="";tcput(c,a.tcid)}}}function tcclearWeek(a){if(1<=a.tctest){tctest(a,"clearWeek start")}tcRemoveEvListCont(a.tcid,"w");var f=v("wtr",a.tcid),d,b,g,e;for(g=1;g<8;g++){tcput("wtrh1"+g+"Dd",a.tcid);tcput("wtrh1"+g+"Dy",a.tcid);tcput("wtrh1"+g+"Dm",a.tcid)}for(e=(a.tcDaystartHour-1);e<=(a.tcDayendHour+1);e++){d=f+e;for(g=1;g<8;g++){b=d+g+"data";$(b).immediateDescendants().each(function(c){c.remove()});$(b).setAttribute("cntno",0)}}}function tccreComp(a){if(1<=a.tctest){tctest(a,"createcomp start")}tcclearComp(a);if(2<=a.tctest){tctest(a,"createComp out")}}function tccreList(a){if(1<=a.tctest){tctest(a,"createList start")}tcclearList(a);if(2<=a.tctest){tctest(a,"createList out")}}function tccreDay(a){if(1<=a.tctest){tctest(a,"createDay start")}var b=new Date(),d=b.getDayix(a),c=tclang("wDaysArr",d,a.tcWeekStart);tcput("htr01",a.tcid,c+"&nbsp;"+a.tcDay+"/"+a.tcMonth+"&nbsp;"+a.tcYear);tcclearDay(a);if(2<=a.tctest){tctest(a,"createDay out")}}function tccreMonth(a){if(1<=a.tctest){tctest(a,"createMonth start")}var h=tclang("wMonth",(a.tcMonth-1)),b=new Date(a.tcYear,(a.tcMonth-1),1),c,e,g,f,d;tcclearMonth(a);tcput("htr01",a.tcid,h+" "+a.tcYear);b.setDateFirstDayOfWeek(a.tcWeekStart);c=b.getWeek(a.tcWeekStart);for(f=1;f<7;f++){e="mtr"+f;tcput(e+"0w",a.tcid,c[0]);tcput(e+"0y",a.tcid,c[1]);b.setFullYear(b.getFullYear(),b.getMonth(),(b.getDate()+7));c=b.getWeek(a.tcWeekStart)}g=b.getDayix(a,1);for(d=1,f=1;d<=31;d++){b.setFullYear(a.tcYear,(a.tcMonth-1),d);if(a.tcMonth!=b.getRealMonth()){break}e="mtr"+f+g+"data";tcput(e,a.tcid,d);if(0!=a.tcdayOk){tcCreateEvListFx(a.tcid,"m",v(e,a.tcid),"day")}g+=1;if(8==g){f+=1;g=1}}if($(v("mtr61data",a.tcid)).empty()){tcput("mtr60w",a.tcid);tcput("mtr60y",a.tcid)}if($(v("mtr51data",a.tcid)).empty()){tcput("mtr50w",a.tcid);tcput("mtr50y",a.tcid)}if(2<=a.tctest){tctest(a,"createMonth out")}}function tccreWeek(d){if(1<=d.tctest){tctest(d,"createWeek start")}var e=new Date(d.tcYear,(d.tcMonth-1),d.tcDay),b,a,f,g;tcput("htr01",d.tcid,tclang("week")+" "+d.tcWeekno+" "+d.tcYear);tcclearWeek(d);e.setDateFirstDayOfWeek(d.tcWeekStart);b=d.tcYear=e.getFullYear();a=d.tcMonth=e.getRealMonth();f=d.tcDay=e.getDate();tcput("wtrh10H",d.tcid,tclang("wMonth",(d.tcMonth-1)));for(g=1;g<8;g++){tcput("wtrh1"+g+"Dd",d.tcid,f);tcput("wtrh1"+g+"Dy",d.tcid,b);tcput("wtrh1"+g+"Dm",d.tcid,a);if(7>g){e.setFullYear(b,(a-1),(f+1));b=e.getFullYear();a=e.getRealMonth();f=e.getDate();weekday=e.getDay();if(3==(weekday-d.tcWeekStart)){d.tcYear=b;d.tcMonth=a;d.tcDay=f}}}tcputcfg(d,2,"createWeek out")}function tcinit(b){b.tctest=0||b.tctest;if(1<=b.tctest){tctest(b,"init start")}var g=v("div",b.tcid),f,a,d,i="|",e="",c="",h="";document.writeln("\n<div id='"+g+"'></div>");if(b.tcdivStyle){tcsetStls(g,b.tcdivStyle)}b.tcDaystartHour=(!b.tcDaystartHour||isNaN(b.tcDaystartHour))?1:parseInt(b.tcDaystartHour,10);if(1>b.tcDaystartHour){b.tcDaystartHour=1}b.tcDayendHour=(!b.tcDayendHour||isNaN(b.tcDayendHour))?23:parseInt(b.tcDayendHour,10);if(1>b.tcDayendHour||23<=b.tcDayendHour){b.tcDayendHour=23}if(b.tcDaystartHour>b.tcDayendHour){f=b.tcDaystartHour;b.tcDaystartHour=b.tcDayendHour;b.tcDayendHour=f}if((!b.tccomptype)||((b.tccomptype!="vevent")&&(b.tccomptype!="vjournal")&&(b.tccomptype!="vtodo"))){b.tccomptype="vevent"}b.tcordnoMax=b.tcordnoMax||"0-0";b.tcUID=b.tcUID||"";b.tcmonthOk=0;b.tcweekOk=0;b.tcdayOk=0;b.tccompOk=0;b.tclistOk=0;b.tcdownloadOk=0;b.tcView=b.tcStartView||"month";a=false;if(!b.tcAllowedViews){b.tcAllowedViews=new Array("month")}b.tcAllowedViews.each(function(j){switch(j){case"download":b.tcdownloadOk=1;break;case"comp":b.tccompOk=1;break;case"list":b.tclistOk=1;if("list"==b.tcView){a=true}break;case"day":b.tcdayOk=1;if("day"==b.tcView){a=true}break;case"week":b.tcweekOk=1;if("week"==b.tcView){a=true}break;default:case"month":b.tcmonthOk=1;if("month"==b.tcView){a=true}break}});if(true!=a){if(1==b.tcmonthOk){b.tcView="month"}else{if(1==b.tcweekOk){b.tcView="week"}else{if(1==b.tcdayOk){b.tcView="day"}else{if(1==b.tclistOk){b.tcView="list"}else{alert("No start View defined/no views allowed!!\nInit aborted!!");return}}}}}b.tcListItems=(!b.tcListItems||isNaN(b.tcListItems))?5:parseInt(b.tcListItems,10);b.tcColWidth=(!b.tcColWidth||isNaN(b.tcColWidth))?25:parseInt(b.tcColWidth,10);b.tcdlMonthOk=0;b.tcdlWeekOk=0;b.tcdlDayOk=0;b.tcdlCompOk=0;b.tcdlListOk=0;b.tcdlTotalOk=0;if((1==b.tcdownloadOk)&&b.tcAllowedDownloads.size()){b.tcAllowedDownloads.each(function(j){switch(j){case"month":b.tcdlMonthOk=1;break;case"week":b.tcdlWeekOk=1;break;case"day":b.tcdlDayOk=1;break;case"comp":b.tcdlCompOk=1;break;case"list":b.tcdlListOk=1;break;default:case"total":b.tcdlTotalOk=1;break}})}if((1==b.tccompOk)&&b.tcCompProps.size()){b.tcCompProps.each(function(j){switch(j){case"summary":c+="a";break;case"SUMMARY":c+="A";break;case"time":c+="b";break;case"TIME":c+="B";break;case"completed":c+="c";break;case"COMPLETED":c+="C";break;case"priority":c+="d";break;case"PRIORITY":c+="D";break;case"description":c+="e";break;case"DESCRIPTION":c+="E";break;case"url":c+="f";break;case"URL":c+="F";break;case"percent":c+="g";break;case"PERCENT":c+="G";break;case"class":c+="h";break;case"CLASS":c+="H";break;case"location":c+="i";break;case"LOCATION":c+="I";break;case"resources":c+="j";break;case"RESOURCES":c+="J";break;case"organizer":c+="k";break;case"ORGANIZER":c+="K";break;case"contact":c+="l";break;case"CONTACT":c+="L";break;case"attendee":c+="m";break;case"ATTENDEE":c+="M";break;case"transp":c+="n";break;case"TRANSP":c+="N";break;case"categories":c+="o";break;case"CATEGORIES":c+="O";break;case"comment":c+="p";break;case"COMMENT":c+="P";break;case"order":c+="q";break;case"ORDER":c+="Q";break;case"recurrent":c+="r";break;case"RECURRENT":c+="R";break;case"uid":c+="s";break;case"UID":c+="S";break;case"created":c+="t";break;case"CREATED":c+="T";break;case"last_modified":c+="u";break;case"LAST_MODIFIED":c+="U";break}})}if((1==b.tclistOk)&&b.tcListProps.size()){b.tcListProps.each(function(j){switch(j){case"summary":h+="a";break;case"SUMMARY":h+="A";break;case"time":h+="b";break;case"TIME":h+="B";break;case"priority":h+="d";break;case"PRIORITY":h+="D";break;case"url":h+="f";break;case"URL":h+="F";break;case"location":h+="i";break;case"LOCATION":h+="I";break;case"resources":h+="j";break;case"RESOURCES":h+="J";break;case"categories":h+="o";break;case"CATEGORIES":h+="O";break}})}b.tcheaderStyle=b.tcheaderStyle||"";b.tcmenuStyle=(b.tcmenuStyle)||"";if(b.tclabelStyle){b.tclabelStyle+=";letter-spacing:0.1em;font-family:arial,sans-serif;font-size:x-small;font-weight:lighter"}else{b.tclabelStyle="letter-spacing:0.1em;font-family:arial,sans-serif;font-size:x-small;font-weight:lighter"}b.tcoddrowStyle=b.tcoddrowStyle||"";if("background-color"==b.tcoddrowStyle.substring(0,16)){e=b.tcoddrowStyle.split(";")[0].split(":")[1]}d=b.tcView;d+=i+b.tcYear;d+=i+b.tcMonth;d+=i+b.tcDay;d+=i+b.tcWeekno;d+=i+b.tcWeekStart;d+=i+b.tcDaystartHour;d+=i+b.tcDayendHour;d+=i+b.tcUrl;d+=i+b.tcData1;d+=i+b.tccomptype;d+=i+b.tcordnoMax;d+=i+b.tcUID;d+=i+b.tcmonthOk;d+=i+b.tcweekOk;d+=i+b.tcdayOk;d+=i+b.tccompOk;d+=i+b.tclistOk;d+=i+b.tcListItems;d+=i+b.tcColWidth;d+=i+b.tcdlMonthOk;d+=i+b.tcdlWeekOk;d+=i+b.tcdlDayOk;d+=i+b.tcdlCompOk;d+=i+b.tcdlListOk;d+=i+b.tcdlTotalOk;d+=i+e;d+=i+c;d+=i+h;d+=i+b.tctest;f=b.v("config",b.tcid);tcaddElem(g,"input",$H({id:f,type:"hidden"}),d);if(1<=d.tctest){tctest(d,"init :\nparent="+g+"\nid="+f)}if(!tcfxeh[b.tcid]){tcfxeh[b.tcid]=new Hash()}tcrndrHeader(b);if(0!=b.tcmonthOk){tcrndrMonth(b)}if(0!=b.tcweekOk){tcrndrWeek(b)}if(0!=b.tcdayOk){tcrndrDay(b)}if(0!=b.tclistOk){tcrndrList(b)}if(0!=b.tccompOk){tcrndrComp(b)}if((0!=b.tcdlMonthOk)||(0!=b.tcdlWeekOk)||(0!=b.tcdlDayOk)||(0!=b.tcdlCompOk)||(0!=b.tcdlListOk)||(0!=b.tcdlTotalOk)){tcrndrDL(b)}tchideAllBoxes(b.tcid);tcrndrBottom(b);switch(b.tcView){case"comp":tcupdComp(b);break;case"list":tcupdList(b);break;case"day":tcupdDay(b);break;case"week":tcupdWeek(b);break;default:case"month":tcupdMonth(b);break}if(2<=b.tctest){tctest(b,"init out")}}function tcrndrBottom(b){if(1<=b.tctest){tctest(b,"renderBottom start")}tcCreateEvListCont(b.tcid,"b");var g=b.v("div",b.tcid),f=b.v("b",b.tcid),e,d,a,c;tcaddElem(g,"div",$H({id:f}),null,"text-align:center;background-color:#ffffff");c="color:black;font-family:arial,sans-serif;font-size:xx-small;letter-spacing:0.2em;text-decoration:none";e=f+"1";tcaddElem(f,"div",$H({id:e,title:tclang("about")}),"kigkonsult&nbsp;-&nbsp;tinycal&nbsp;v2.2",b.tclabelStyle+";"+c);tcCreateEvListFx(b.tcid,"b",e,"b2");$(e).hide();e=f+"2";tcaddElem(f,"div",$H({id:e}));tcaddElem(e,"br");d=e+"0a";tcaddElem(e,"span",$H({id:d,title:tclang("close")}),"tinycal&nbsp;v2.2",c);tcCreateEvListFx(b.tcid,"b",d,"b1");tcaddElem(e,"br");d=e+"0b";tcaddElem(e,"span",$H({id:d}),"&copy;&nbsp;2008&nbsp;kigkonsult",c);tcCreateEvListFx(b.tcid,"b",d,"b1");tcaddElem(e,"br");tcaddElem(e,"br");a=$H({id:e+"1",href:"http://www.kigkonsult.se/iCalcreator/index.php",title:"kigkonsult.se/iCalcreator",target:"_blank"});tcaddElem(e,"a",a,"iCalcreator&nbsp;v2.6",c);a=$H({id:e+"1l",href:"http://www.kigkonsult.se/downloads/dl.php?f=LGPL",title:"LGPL",target:"_blank"});tcaddElem(e,"a",a,"&nbsp;LGPL",c);tcaddElem(e,"br");tcaddElem(e,"br");a=$H({id:e+"2",href:"http://www.prototypejs.org/",title:"prototypejs.org",target:"_blank"});tcaddElem(e,"a",a,"Prototype&nbsp;v1.5.0",c);a=$H({id:e+"2l",href:"http://creativecommons.org/licenses/by-sa/3.0/",title:"creativecommons.org",target:"_blank"});tcaddElem(e,"a",a,"&nbsp;CC&nbsp;BY-SA",c);tcaddElem(e,"br");tcaddElem(e,"br");a=$H({id:e+"3",href:"http://www.kigkonsult.se/tinycal/index.php",title:"kigkonsult.se/tinycal",target:"_blank"});tcaddElem(e,"a",a,"tinycal&nbsp;v2.2",c);a=$H({id:e+"3l",href:"http://www.kigkonsult.se/downloads/dl.php?f=GPL",title:"GPL",target:"_blank"});tcaddElem(e,"a",a,"&nbsp;GPL",c);if(2<=b.tctest){tctest(b,"RenderBottom out")}}function tcrndrHeader(b){if(1<=b.tctest){tctest(b,"renderHeader start")}tcCreateEvListCont(b.tcid,"h");var h=b.v("div",b.tcid),g,f,e,d,c,a;if(b.tcheaderText){g=b.v("divT",b.tcid);c=(b.tcheaderStyle)?b.tcheaderStyle+";text-align:center":"text-align:center";tcaddElem(h,"div",$H({id:g}),b.tcheaderText,c)}g=b.v("h",b.tcid);tcaddElem(h,"div",$H({id:g}),null,b.tcmenuStyle);f=g+"tt";tcaddElem(g,"table",$H({id:f}),null,"border-collapse:collapse;width:100%");e=g+"t";tcaddElem(f,"tbody",$H({id:e}));d=e+"r0";tcaddElem(e,"tr",$H({id:d}));tcaddElem(d,"td",$H({id:d+"0"}));tcrndrHeaderImg(b.tcid,d+"0","menuPrev",tclang("previous"),"./images/prev.png","11px","go",null);a=Math.floor($(h).getWidth()*(110/218));c="text-align:center;width:"+a+"px;vertical-align:middle";if(b.tclabelStyle){c=b.tclabelStyle+";"+c}tcaddElem(d,"td",$H({id:d+"1"}),null,c);tcaddElem(d,"td",$H({id:d+"2"}));tcrndrHeaderImg(b.tcid,d+"2","menuNext",tclang("next"),"./images/next.png","11px","go",null);if(0!=b.tclistOk){tcrndrHeaderImg(b.tcid,d+"2","menuList",tclang("list"),"./images/list.png","16px","list","margin-left: 3px")}if(0!=b.tcdayOk){tcrndrHeaderImg(b.tcid,d+"2","menuDay",tclang("day"),"./images/day.png","16px","day","margin-left: 3px")}if(0!=b.tcweekOk){tcrndrHeaderImg(b.tcid,d+"2","menuWeek",tclang("week"),"./images/week.png","16px","week","margin-left: 3px")}if(0!=b.tcmonthOk){tcrndrHeaderImg(b.tcid,d+"2","menuMonth",tclang("month"),"./images/month.png","16px","month","margin-left: 3px")}if(2<=b.tctest){tctest(b,"renderHeader out")}}function tcrndrHeaderImg(c,f,b,i,a,h,g,e){var d=v(b,c);tcaddElem(f,"img",$H({id:d,src:a,title:i,height:"16px",width:h}),null,e);tcCreateEvListFx(c,"h",d,g)}function tcrndrComp(a){if(1<=a.tctest){tctest(a,"renderComp start")}tcCreateEvListCont(a.tcid,"c");var c=a.v("div",a.tcid),b=a.v("c",a.tcid);tcaddElem(c,"div",$H({id:b}));$(b).hide();if(2<=a.tctest){tctest(a,"renderComp out")}}function tcrndrList(a){if(1<=a.tctest){tctest(a,"renderList start")}tcCreateEvListCont(a.tcid,"l");var c=a.v("div",a.tcid),b=a.v("l",a.tcid);tcaddElem(c,"div",$H({id:b}));$(b).hide();if(2<=a.tctest){tctest(a,"renderList out")}}function tcrndrDay(b){if(1<=b.tctest){tctest(b,"renderDay start")}tcCreateEvListCont(b.tcid,"d");var j=b.v("div",b.tcid),i=b.v("d",b.tcid),k,g,f,e,l,d,m,c,a;tcaddElem(j,"div",$H({id:i}));k=i+"tt";tcaddElem(i,"table",$H({id:k}),null,"border-collapse:collapse;width:100%");g=i+"t";tcaddElem(k,"tbody",$H({id:g}));d=Math.floor($(j).getWidth()*(18/218));l="width:"+d+"px;borderRight:gray dotted thin;vertical-align:top;text-align:right";if(b.tclabelStyle){l=b.tclabelStyle+";"+l}c=$(j).getWidth()-d;d=(/MSIE (\d+\.\d+);/.test(navigator.userAgent))?"10pt":"small";m="width:"+c+"px;font:"+d+" arial,sans-serif;text-align:left";for(a=(b.tcDaystartHour-1),rownr=1;a<=(b.tcDayendHour+1);a++,rownr++){f=g+"r"+a;tcaddElem(g,"tr",$H({id:f}));if((0==(rownr%2))&&b.tcoddrowStyle){tcsetStls(f,b.tcoddrowStyle)}e=(a<b.tcDaystartHour)?"&nbsp;":(a>b.tcDayendHour)?"&nbsp;":a;tcaddElem(f,"td",$H({id:f+"H"}),e,l);tcaddElem(f,"td",$H({id:f+"data"}),null,m)}$(i).hide();if(2<=b.tctest){tctest(b,"renderDay out")}}function tcrndrMonth(d){if(1<=d.tctest){tctest(d,"renderMonth start")}tcCreateEvListCont(d.tcid,"m");var l=d.v("div",d.tcid),j=d.v("m",d.tcid),m,i,h,f,e,b,k,g,a;tcaddElem(l,"div",$H({id:j}));m=j+"tt";tcaddElem(j,"table",$H({id:m}),null,"border-collapse:collapse;width:100%;font-family: arial,sans-serif");i=j+"t";tcaddElem(m,"tbody",$H({id:i,align:"right"}));h=i+"r0";tcaddElem(i,"tr",$H({id:h}));f=h+"0D";b="vertical-align:top";if(d.tclabelStyle){b=d.tclabelStyle+";"+b}tcaddElem(h,"th",$H({id:f}),null,b);k=Math.floor($(l).getWidth()*(18/218));$(f).style.width=k+"px";k=Math.floor($(l).getWidth()*(26/218));b="width:"+k+"px;borderBottom:gray dotted thin;vertical-align:top";if(d.tclabelStyle){b=d.tclabelStyle+";"+b}for(g=1;g<8;g++){f=h+"0"+g+"D";tcaddElem(h,"th",$H({id:f}),tclang("wDaysArr",g,d.tcWeekStart),b)}b="borderRight:gray dotted thin;vertical-align:top";if(d.tclabelStyle){b=d.tclabelStyle+";"+b}for(a=1;a<7;a++){h=i+"r"+a;if(0==(a%2)){tcaddElem(i,"tr",$H({id:h}),null,d.tcoddrowStyle)}else{tcaddElem(i,"tr",$H({id:h}))}f=i+"r"+a+"0yw";tcaddElem(h,"td",$H({id:f}),null,b);e=i+"r"+a+"0w";tcaddElem(f,"span",$H({id:e}));e=i+"r"+a+"0y";tcaddElem(f,"input",$H({id:e,type:"hidden"}));if(0!=d.tcweekOk){tcCreateEvListFx(d.tcid,"h",f,"week")}for(g=1;g<8;g++){f=i+"r"+a+g+"data";tcaddElem(h,"td",$H({id:f}),null,null,"color:#606060")}}$(j).hide();if(2<=d.tctest){tctest(d,"renderMonth out")}}function tcrndrWeek(d){if(1<=d.tctest){tctest(d,"renderWeek start")}tcCreateEvListCont(d.tcid,"w");var l=d.v("div",d.tcid),j=d.v("w",d.tcid),m,i,h,f,e,k,b,g,a;tcaddElem(l,"div",$H({id:j}),null,null,b);m=j+"tt";tcaddElem(j,"table",$H({id:m}),null,"border-collapse:collapse;width:100%");i=j+"t";tcaddElem(m,"tbody",$H({id:i,align:"center"}));h=i+"rh0";tcaddElem(i,"tr",$H({id:h}));f=h+"0";k=Math.floor($(l).getWidth()*(18/218));b="width:"+k+"px;vertical-align:top";if(d.tclabelStyle){b=d.tclabelStyle+";"+b}tcaddElem(h,"th",$H({id:f}),null,b);k=Math.floor($(l).getWidth()*(26/218));b="width:"+k+"px;vertical-align:top";if(d.tclabelStyle){b=d.tclabelStyle+";"+b}for(g=1;g<8;g++){f=h+g;tcaddElem(h,"th",$H({id:f}),tclang("wDaysArr",g,d.tcWeekStart),b)}h=i+"rh1";tcaddElem(i,"tr",$H({id:h}));f=h+"0H";b="fontSize:0.60em;letterSpacing:0.08em;vertical-align:top";if(d.tclabelStyle){b=d.tclabelStyle+";"+b}tcaddElem(h,"td",$H({id:f}),null,b);b="border-bottom:gray dotted thin;vertical-align:top";if(d.tclabelStyle){b=d.tclabelStyle+";"+b}for(g=1;g<8;g++){f=h+g+"Dymd";tcaddElem(h,"td",$H({id:f}),null,b);e=h+g+"Dd";tcaddElem(f,"span",$H({id:e}));e=h+g+"Dy";tcaddElem(f,"input",$H({id:e,type:"hidden"}));e=h+g+"Dm";tcaddElem(f,"input",$H({id:e,type:"hidden"}));if(0!=d.tcdayOk){tcCreateEvListFx(d.tcid,"h",f,"day")}}b="vertical-align:top";if(d.tclabelStyle){b=d.tclabelStyle+";"+b}for(a=(d.tcDaystartHour-1),rownr=2;a<=(d.tcDayendHour+1);a++,rownr++){h=i+"r"+a;if(1==(rownr%2)){tcaddElem(i,"tr",$H({id:h}),null,d.tcoddrowStyle)}else{tcaddElem(i,"tr",$H({id:h}))}k=(a<d.tcDaystartHour)?"&nbsp;":(a>d.tcDayendHour)?"&nbsp;":a;f=h+"H";tcaddElem(h,"td",$H({id:f,align:"right"}),k,b);for(g=1;g<8;g++){f=h+g+"data";tcaddElem(h,"td",$H({id:f}),null,"border-left:gray dotted thin")}}$(j).hide();if(2<=d.tctest){tctest(d,"renderWeek out")}}function tcrndrDL(b){if(1<=b.tctest){tctest(b,"renderDL start")}var i=b.v("div",b.tcid),h=b.v("dl",b.tcid),g=b.v("dlt",b.tcid),f=b.v("dltt",b.tcid),e=b.v("dlr",b.tcid),d=b.v("dlcl",b.tcid),c=b.v("dlcr",b.tcid),a="border-bottom:gray dotted thin;border-top:gray dotted thin";if(b.tclabelStyle){a=b.tclabelStyle+";"+a}tcaddElem(i,"div",$H({id:h}),null,a);tcaddElem(h,"table",$H({id:g}),null,"border-collapse:collapse;width:100%");tcaddElem(g,"tbody",$H({id:f}));tcaddElem(f,"tr",$H({id:e}));a="color:black;font-family:arial,sans-serif;font-size:xx-small;letter-spacing:0.1em;";if(0!=b.tcdlTotalOk){tcaddElem(e,"td",$H({id:d,align:"left",title:b.tcData1}));attr=$H({id:d+"img",src:"./images/dl.png",height:"12px",width:"12px"});tcaddElem(d,"img",attr,null,"margin-right:3px");tcaddElem(d,"span",$H({id:d+"txt"}),tclang("download"),a);tcCreateEvListFx(b.tcid,"h",d,"dlcl")}if((0!=b.tcdlMonthOk)||(0!=b.tcdlWeekOk)||(0!=b.tcdlDayOk)||(0!=b.tcdlCompOk)||(0!=b.tcdlListOk)){tcaddElem(e,"td",$H({id:c,align:"right",title:tclang("download")}));tcaddElem(c,"span",$H({id:c+"txt"}),b.tcData1,a);attr=$H({id:c+"img",src:"./images/dl.png",height:"12px",width:"12px"});tcaddElem(c,"img",attr,null,"margin-left:3px");tcCreateEvListFx(b.tcid,"h",c,"dlcr")}}function tcsetHgt(b){b=tcgetcfg(b.tcid,1,"tcsetHgt start");var a=0,d,c;if($(v("divT",b.tcid))){a+=$(v("divT",b.tcid)).getHeight()}a+=$(v("h",b.tcid)).getHeight();d=a;switch(b.tcView){case"comp":a+=$(v("c",b.tcid)).getHeight();break;case"list":a+=$(v("l",b.tcid)).getHeight();break;case"day":a+=$(v("d",b.tcid)).getHeight();break;case"week":a+=$(v("w",b.tcid)).getHeight();break;default:case"month":a+=$(v("m",b.tcid)).getHeight();break}if((0!=b.tcdlMonthOk)||(0!=b.tcdlWeekOk)||(0!=b.tcdlDayOk)||(0!=b.tcdlCompOk)||(0!=b.tcdlListOk)||(0!=b.tcdlTotalOk)){a+=$(v("dl",b.tcid)).getHeight()}c=a;a+=$(v("b",b.tcid)).getHeight();if(170>a){a=170}$(v("div",b.tcid)).style.height=a+"px";if(2<=b.tctest){tctest(b,"tcsetHgt out, height="+a+"px")}}function tcgo(e){var a=tcgetcfg(vtcid(this.id),1,"tcgo in via "+this.id),d=null,c=null,b;switch(a.tcView){case"comp":case"list":d=(v("menuPrev",a.tcid)==this.id)?1:null;c=(v("menuNext",a.tcid)==this.id)?1:null;break;case"day":a.tcDay+=(v("menuPrev",a.tcid)==this.id)?-1:+1;break;case"week":a.tcDay+=(v("menuPrev",a.tcid)==this.id)?-7:+7;break;default:case"month":a.tcMonth+=(v("menuPrev",a.tcid)==this.id)?-1:+1;if(((4==a.tcMonth)||(6==a.tcMonth)||(9==a.tcMonth)||(11==a.tcMonth))&&(31==a.tcDay)){a.tcDay=30}else{if((2==a.tcMonth)&&(28<a.tcDay)){a.tcDay=28}}break}b=new Date(a.tcYear,(a.tcMonth-1),a.tcDay);a.tcYear=b.getFullYear();a.tcMonth=b.getRealMonth();a.tcDay=b.getDate();a.tcWeekno=b.getWeek(a.tcWeekStart)[0];tcputcfg(a,2,"go before view "+a.tcView);tchideBottomBox(a.tcid);tchideAllBoxes(a.tcid);switch(a.tcView){case"comp":tcupdComp(a,d,c);break;case"list":tcupdList(a,d,c);break;case"day":tcupdDay(a);break;case"week":tcupdWeek(a);break;default:case"month":tcupdMonth(a);break}}function tcselComp(g){var a=tcgetcfg(vtcid(this.id),1,"tcselComp in fr "+this.id),c,f,b,e,d;if(1!=a.tccompOk){return}d=$(this.id).getAttribute("omYU")||"";c=v("wtr",a.tcid);f=c.length;b=v("l",a.tcid);e=b.length;d=d.split("*",4);if((b==this.id.substr(0,e))||(c==this.id.substr(0,f))){a.tcYear=d[2].substr(0,4);a.tcMonth=d[2].substr(4,2);if("0"==a.tcMonth.substr(0,1)){a.tcMonth=a.tcMonth.substr(1)}a.tcDay=d[2].substr(6,2);if("0"==a.tcDay.substr(0,1)){a.tcDay=a.tcDay.substr(1)}}a.tcordnoMax=d[0]+"-"+d[1];a.tcUID=d[3];a.tcView="comp";tcputcfg(a,2,"tcselComp out fr "+this.id);tcupdComp(a)}function tcselList(c){var a=tcgetcfg(vtcid(this.id),1,"tcselList in fr "+this.id),b;if("list"==a.tcView){tcevShowBox(a.tcid,"l");return}if("0"==a.tcordnoMax){return}if(1!=a.tclistOk){return}a.tcordnoMax="";switch(a.tcView){case"day":a.tcUID="";break;case"week":b=new Date(a.tcYear,(a.tcMonth-1),a.tcDay);b.setDateFirstDayOfWeek(a.tcWeekStart);a.tcYear=b.getFullYear();a.tcMonth=b.getRealMonth();a.tcDay=b.getDate();a.tcUID="";break;case"month":a.tcDay=1;a.tcUID="";default:case"comp":case"list":break}a.tcView="list";tcputcfg(a,2,"tcselList out fr "+this.id);tcupdList(a)}function tcselDay(c){var a=tcgetcfg(vtcid(this.id),1,"tcselDay in fr "+this.id),e,d,b,f,g;if("day"==a.tcView){tcevShowBox(a.tcid,"d");return}if(1!=a.tcdayOk){return}e=v("mtr",a.tcid);d=e.length;b=v("wtrh1",a.tcid);f=b.length;if(e==this.id.substr(0,d)){if(!this.innerHTML){return}a.tcDay=this.innerHTML;if(1<=a.tctest){tctest(a,"tcselDay from month view")}}else{if(b==this.id.substr(0,f)){g=this.id.substr(v("",a.tcid).length,6);a.tcYear=tcget(g+"Dy",a.tcid,true);a.tcMonth=tcget(g+"Dm",a.tcid,true);a.tcDay=tcget(g+"Dd",a.tcid,true);if(1<=a.tctest){tctest(a,"tcselDay from week view")}}}a.tcView="day";a.tcordnoMax="";a.tcUID="";tcputcfg(a,2,"tcselDay out fr "+this.id);tcupdDay(a)}function tcselMonth(b){var a=tcgetcfg(vtcid(this.id),1,"tcselMonth in fr "+this.id);if("month"==a.tcView){tcevShowBox(a.tcid,"m");return}if(1!=a.tcmonthOk){return}a.tcView="month";a.tcordnoMax="";a.tcUID="";tcputcfg(a,2,"tcselMonth out fr "+this.id);tcupdMonth(a)}function tcselWeek(d){var a=tcgetcfg(vtcid(this.id),1,"tcselWeek in fr "+this.id),e,c,b;if("week"==a.tcView){tcevShowBox(a.tcid,"w");return}if(1!=a.tcweekOk){return}if(v("menuWeek",a.tcid)!=this.id){e=this.id.substr(v("",a.tcid).length,5);a.tcWeekno=tcget(e+"w",a.tcid,true);a.tcYear=tcget(e+"y",a.tcid,true);c=(0==a.tcWeekStart)?3:4;b=new Date(a.tcYear,0,((a.tcWeekno*7)-7+c));a.tcYear=b.getFullYear();a.tcMonth=b.getRealMonth();a.tcDay=b.getDate();if(1<=a.tctest){tctest(a,"tcselWeek from month view")}}a.tcView="week";a.tcordnoMax="";a.tcUID="";tcputcfg(a,2,"tcselWeek out fr "+this.id);tcupdWeek(a)}function tcupdComp(a,f,d){a=tcgetcfg(a.tcid,1,"tcupdComp start");tchideAllBoxes(a.tcid);tccreComp(a);var c,h,g=v("c",a.tcid),e=g+"cl",b;tcaddElem(g,"div",$H({id:e}),tclang("loading"),"font:small arial");tchideBottomBox(a.tcid);$(v("c",a.tcid)).show();tcsetHgt(a);c=tcInitUrl(a,"c")+"&UID="+a.tcUID;c+=(f)?"&prev=1&cnt=1":(d)?"&next=1&cnt=1":"";if(2<=a.tctest){tctest(a,"tcupdComp url=\n"+c.substr(0,100)+"\n"+c.substr(100))}h=v("div",a.tcid);$(h).style.cursor="wait";b=new Ajax.Request(c,{method:"get",onFailure:function(i){tcajaxError(i.statusText,a);$(h).style.cursor="default"},onComplete:function(i){tcloadComp(i.responseXML,a);$(h).style.cursor="default"}})}function tcloadComp(c,e){var t=tcxml2arr(c,e),b,n,m,l=0,o=0,q,d,s,h,r,k,g,f,a,j;if(0>=t.size()){$(v("c",e.tcid)).hide();if(0!=e.tcdayOk){e.tcView="day";tcputcfg(e,2,"tcloadComp return to day");tcupdDay(e)}else{if(0!=e.tcweekOk){e.tcView="week";tcputcfg(e,2,"tcloadComp return to week");tcupdWeek(e)}else{if(0!=e.tcmonthOk){e.tcView="month";tcputcfg(e,2,"tcloadComp return to month");tcupdMonth(e)}}}return}tccreComp(e);o=0;for(q in t){for(d in t[q]){for(s in t[q][d]){l++;b=t[q][d][s];if(b.xcurday){e.tcYear=b.xcurday.substr(0,4);e.tcMonth=parseInt(b.xcurday.substr(4,2),10);e.tcDay=parseInt(b.xcurday.substr(6,2),10)}if(b.xsort){e.tcordnoMax=b.xsort}if(b.uid){e.tcUID=b.uid}m=(b.priority&&tcPrioColors[b.priority])?tcPrioColors[b.priority]:false;for(h=0,r=e.tcCompProps.length;h<r;++h){k=e.tcCompProps.substr(h,1);g=false;n="";switch(k){case"A":g=tclang("summary");case"a":if(b.summary){tcloadProp("c",e.tcid,++o,g,1,b.summary,m,e.tcColWidth,e.oddrowbgcolor)}break;case"B":g=tclang("time");case"b":if(b.dtstart){n=(b.recurrent)?b.recurrent:b.dtstart;n=tcfmtdtstartdtend(n,b.dtend);if(n){tcloadProp("c",e.tcid,++o,g,null,n,m,e.tcColWidth,e.oddrowbgcolor)}}break;case"C":g=tclang("completed");case"c":if(b.completed){tcloadProp("c",e.tcid,++o,g,null,b.completed.substr(8,2)+"."+b.completed.substr(10,2),m,e.tcColWidth,e.oddrowbgcolor)}break;case"D":g=tclang("priority");case"d":if(b.priority&&m){tcloadProp("c",e.tcid,++o,g,4,b.priority+" - "+tclang("priorityText",b.priority),m,e.tcColWidth,e.oddrowbgcolor)}break;case"E":g=tclang("description");case"e":if(b.description){b.description.each(function(p,i){n+=(i)?"\n":"";n+=p});tcloadProp("c",e.tcid,++o,g,1,n,m,e.tcColWidth,e.oddrowbgcolor)}break;case"F":g=tclang("url");case"f":if(b.url){tcloadProp("c",e.tcid,++o,g,3,b.url,m,e.tcColWidth,e.oddrowbgcolor)}break;case"G":g=tclang("percent");case"g":if(b.percent){tcloadProp("c",e.tcid,++o,g,null,b.percent+"%",m,e.tcColWidth,e.oddrowbgcolor)}break;case"H":g=tclang("class");case"h":if(b["class"]){tcloadProp("c",e.tcid,++o,g,null,b["class"],m,e.tcColWidth,e.oddrowbgcolor)}break;case"I":g=tclang("location");case"i":if(b.location){tcloadProp("c",e.tcid,++o,g,1,b.location,m,e.tcColWidth,e.oddrowbgcolor)}break;case"J":g=tclang("resources");case"j":if(b.resources){b.resources.each(function(p,i){n+=(i)?"\n":"";n+=p});tcloadProp("c",e.tcid,++o,g,1,n,m,e.tcColWidth,e.oddrowbgcolor)}break;case"K":g=tclang("organizer");case"k":if(b.organizer){tcloadProp("c",e.tcid,++o,g,2,b.organizer,m,e.tcColWidth,e.oddrowbgcolor)}break;case"L":g=tclang("contact");case"l":if(b.contact){n="";b.contact.each(function(p,i){n+=(i)?"\n":"";n+=p});tcloadProp("c",e.tcid,++o,g,1,n,m,e.tcColWidth,e.oddrowbgcolor)}break;case"M":g=tclang("attendee");case"m":if(b.attendee){b.attendee.each(function(p,i){n+=(i)?"\n":"";n+=p});tcloadProp("c",e.tcid,++o,g,2,n,m,e.tcColWidth,e.oddrowbgcolor)}break;case"N":g=tclang("transp");case"n":if(b.transp){tcloadProp("c",e.tcid,++o,g,null,b.transp,m,e.tcColWidth,e.oddrowbgcolor)}break;case"O":g=tclang("categories");case"o":if(b.categories){b.categories.each(function(p,i){n+=(i)?"\n":"";n+=p});tcloadProp("c",e.tcid,++o,g,1,n,m,e.tcColWidth,e.oddrowbgcolor)}break;case"P":g=tclang("comment");case"p":if(b.comment){b.comment.each(function(p,i){n+=(i)?"\n":"";n+=p});tcloadProp("c",e.tcid,++o,g,1,n,m,e.tcColWidth,e.oddrowbgcolor)}break;case"Q":g=tclang("order");case"q":if(b.xsort&&!b.recurrent){ordnoMax=b.xsort.split("*");n=parseInt(ordnoMax[0],10);n+=" ("+parseInt(ordnoMax[1],10)+")";tcloadProp("c",e.tcid,++o,g,null,n,m,e.tcColWidth,e.oddrowbgcolor)}break;case"R":g=tclang("recurrent");case"r":if(b.recurrent&&(b.recurrent.substr(0,8)!=b.dtstart.substr(0,8))){n="("+b.dtstart.substr(0,8)+" "+b.xsort+")";tcloadProp("c",e.tcid,++o,g,1,n,m,e.tcColWidth,e.oddrowbgcolor)}break;case"S":g=tclang("uid");case"s":if(b.uid){n=b.uid.substring(0,e.tcColWidth-1)+"\n"+b.uid.substring(e.tcColWidth-1);tcloadProp("c",e.tcid,++o,g,2,n,m,e.tcColWidth,e.oddrowbgcolor)}break;case"T":g=tclang("created");case"t":if(b.created){n=b.created.substr(0,8)+" "+b.created.substr(8,2)+"."+b.created.substr(10,2)+" GMT";tcloadProp("c",e.tcid,++o,g,1,n,m,e.tcColWidth,e.oddrowbgcolor)}break;case"U":g=tclang("last_modified");case"u":if(b.last_modified){n=b.last_modified.substr(0,8)+" "+b.last_modified.substr(8,2)+"."+b.last_modified.substr(10,2)+" GMT";tcloadProp("c",e.tcid,++o,g,1,n,m,e.tcColWidth,e.oddrowbgcolor)}break}}}}}f=new Date();a=f.getDayix(e);j=tclang("wDaysArr",a,e.tcWeekStart);tcput("htr01",e.tcid,j+"&nbsp;"+e.tcDay+"/"+e.tcMonth+"&nbsp;"+e.tcYear);if(0<l){if(0!=e.tcdlTotalOk){$(v("dlcl",e.tcid)).show()}if(0!=e.tcdlCompOk){$(v("dlcrtxt",e.tcid)).innerHTML=tclang("download");$(v("dlcr",e.tcid)).show()}}tcputcfg(e,2,"tcloadComp 10 out");tcsetHgt(e)}function tcloadProp(g,e,f,n,c,o,d,b,k){var m=v(g+f,e),j=m+"value",a="background-color:",h=o,l;a+=(0==(f%2)&&k)?k:"white";a+=";padding:0px 5px 5px 2px;text-align:left";tcaddElem(v(g,e),"div",$H({id:m}),null,a);if(n){a="border:gray dotted thin;font:xx-small arial,sans-serif;letter-spacing:0.3em;margin:2px 3px 0px 0px;padding:0px 3px 0px 5px;vertical-align:45%";tcaddElem(m,"span",$H({id:m+"label"}),n,a);if((0<c)&&(c<4)){tcaddElem(m,"br")}}l=(/MSIE (\d+\.\d+);/.test(navigator.userAgent))?"10pt":"small";a=((4==c)&&d)?"font:"+l+" arial,sans-serif;borderBottom:medium solid "+d:"font:"+l+" arial,sans-serif";if(3==c){if("http://"==h.substr(0,7).toLowerCase()){h=h.substr(7)}if("www."==h.substr(0,4).toLowerCase()){h=h.substr(4)}if(b<h.length){h=h.substr(0,(b-2))+".."}tcaddElem(m,"a",$H({id:j,href:o,title:o.substr(7),target:"_blank"}),h,a)}else{if(b<o.length){l=(2==c)?false:true;o=tcsplitLine(o,b,l)}tcaddElem(m,"span",$H({id:j}),o,a)}}function tcupdList(a,g,f){a=tcgetcfg(a.tcid,1,"tcupdList start");tchideAllBoxes(a.tcid);tccreList(a);var e=v("l",a.tcid),c=e+"ll",d,h=v("div",a.tcid),b;tcaddElem(e,"div",$H({id:c}),tclang("loading"),"font:small arial");tchideBottomBox(a.tcid);$(v("l",a.tcid)).show();tcsetHgt(a);d=tcInitUrl(a,"l")+"&cnt="+a.tcListItems;if(""<a.tcUID){d+="&UID="+a.tcUID}if(g){d+="&prev=1"}else{if(f){d+="&next=1"}}if(2<=a.tctest){tctest(a,"tcupdList url=\n"+d.substr(0,100)+"\n"+d.substr(100))}$(h).style.cursor="wait";b=new Ajax.Request(d,{method:"get",onFailure:function(i){tcajaxError(i.statusText,a);$(h).style.cursor="default"},onComplete:function(i){tcloadList(i.responseXML,a);$(h).style.cursor="default"}})}function tcloadList(d,e){var s,m,u,c,t,a=v("l",e.tcid),r,f,z,y,q,o=0,g,b,l,k,w,n,h;s=d.getElementsByTagName("vcalendar")[0];m=$A(s.getElementsByTagName(e.tccomptype));e.tcordnoMax="";if(0>=m.size()){$(a).hide();if(0!=e.tcdayOk){e.tcView="day";tcputcfg(e,2,"tcloadList return to day");tcupdDay(e)}else{if(0!=e.tcweekOk){e.tcView="week";tcputcfg(e,2,"tcloadList return to week");tcupdWeek(e)}else{if(0!=e.tcmonthOk){e.tcView="month";tcputcfg(e,2,"tcloadList return to month");tcupdMonth(e)}}}return}for(u=0;u<m.size();u++){c=$A(m[u].getElementsByTagName("*"));if(0>=c.size()){continue}comp=new Hash();for(t=0;t<c.size();t++){if(!c[t].hasChildNodes()){continue}propValue=("url"!=c[t].tagName)?c[t].firstChild.nodeValue:"";switch(c[t].tagName){case"x-sort":comp.xsort=propValue;break;case"x-current-day":comp.xcurday=propValue;break;case"location":case"priority":case"summary":case"uid":comp[c[t].tagName]=propValue;break;case"x-url":comp.url=propValue;break;case"dtstart":comp.dtstart=propValue.substr(0,8);if(8<propValue.length){comp.dtstart+=propValue.substr(9)}break;case"x-current-dtstart":comp.recurrent=propValue.substr(0,4)+propValue.substr(5,2)+propValue.substr(8,2);if(10<propValue.length){comp.recurrent+=propValue.substr(11,2)+propValue.substr(14,2)+propValue.substr(17,2)}break;case"dtend":case"due":comp.dtend=propValue.substr(0,8);if(8<propValue.length){comp.dtend+=propValue.substr(9)}break;case"x-current-dtend":comp.dtend=propValue.substr(0,4)+propValue.substr(5,2)+propValue.substr(8,2);if(10<propValue.length){comp.dtend+=propValue.substr(11,2)+propValue.substr(14,2)+propValue.substr(17,2)}break;case"categories":case"resources":if(comp[c[t].tagName]){comp[c[t].tagName][comp[c[t].tagName].size()]=propValue}else{comp[c[t].tagName]=new Array(propValue)}break}}if((comp.dtend&&(9>comp.dtend.length))&&(comp.dtend!=comp.dtstart.substr(0,8))){g=new Date(parseInt(comp.dtend.substr(0,4),10),(parseInt(comp.dtend.substr(4,2),10)-1),(parseInt(comp.dtend.substr(6,2),10)-1));comp.dtend=g.getFullYear();k=g.getRealMonth();comp.dtend+=(10>k)?"0"+k:""+k;k=g.getDate();comp.dtend+=(10>k)?"0"+k:""+k}m[u]=comp}tccreList(e);for(u=0;u<m.size();u++){o+=1;c=m[u];f=c.xsort+"*"+c.xcurday+"*"+c.uid;y=(0==(o%2)&&e.oddrowbgcolor)?";background-color:"+e.oddrowbgcolor:";background-color:#ffffff";z=a+o;tcaddElem(a,"div",$H({id:z,omYU:f}),null,y);q=(c.priority&&tcPrioColors[c.priority])?tcPrioColors[c.priority]:false;if(2>o){e.tcordnoMax=c.xsort;e.tcYear=c.xcurday.substr(0,4);e.tcMonth=parseInt(c.xcurday.substr(4,2),10);e.tcDay=parseInt(c.xcurday.substr(6,2),10);g=new Date();b=g.getDayix(e);l=tclang("wDaysArr",b,e.tcWeekStart);e.tcUID=c.uid;tcput("htr01",e.tcid,l+"&nbsp;"+e.tcDay+"/"+e.tcMonth+"&nbsp;"+e.tcYear)}for(k=0,w=e.tcListProps.length;k<w;++k){n=e.tcListProps.substr(k,1);h=false;switch(n){case"A":h=tclang("summary");case"a":if(c.summary){tcloadProp("l"+o,e.tcid,(((k+1)*100)+o),h,1,c.summary,q,e.tcColWidth,e.oddrowbgcolor)}break;case"B":h=tclang("time");case"b":if(c.recurrent&&(c.recurrent.substr(0,8)!=c.dtstart.substr(0,8))&&(c.recurrent.substr(0,8)!=c.xcurday)){if(c.dtend&&(c.dtend.substr(0,8)==c.xcurday)){r="--"+tcfmtDate(c.dtend)+" "+tcfmtTime(c.dtend)+" ["+tcfmtDate(c.recurrent)+"-]"}else{r="-"+tcfmtDate(c.xcurday)+"- ["+tcfmtDate(c.recurrent)+"-"+tcfmtDate(c.dtend)+"]"}}else{if(c.recurrent&&(c.recurrent.substr(0,8)!=c.dtstart.substr(0,8))){r=tcfmtdtstartdtend(c.recurrent,c.dtend,true)}else{if(!c.recurrent&&(c.dtstart.substr(0,8)!=c.xcurday)){if(c.dtend&&(c.dtend.substr(0,8)==c.xcurday)){r="--"+tcfmtDate(c.dtend)+" "+tcfmtTime(c.dtend)+" ["+tcfmtDate(c.dtstart)+"-]"}else{r="-"+tcfmtDate(c.xcurday)+"- ["+tcfmtDate(c.dtstart)+"-"+tcfmtDate(c.dtend)+"]"}}else{if(c.dtend&&(c.dtstart.substr(0,8)==c.dtend.substr(0,8))){r=tcfmtdtstartdtend(c.dtstart,c.dtend,true)}else{if(c.dtend){r=tcfmtDate(c.dtstart)+" "+tcfmtTime(c.dtstart)+" [-"+tcfmtDate(c.dtend)+"]"}else{r=tcfmtdtstartdtend(c.dtstart,false,true)}}}}}tcloadProp("l"+o,e.tcid,(((k+1)*100)+o),h,null,r,q,e.tcColWidth,e.oddrowbgcolor);break;case"D":h=tclang("priority");case"d":if(c.priority&&q){tcloadProp("l"+o,e.tcid,(((k+1)*100)+o),h,4,c.priority+" - "+tclang("priorityText",c.priority),q,e.tcColWidth,e.oddrowbgcolor)}break;case"F":h=tclang("url");case"f":if(c.url){tcloadProp("l",e.tcid,((o*1000)+((k+1)*100)+o),h,3,c.url,q,e.tcColWidth,e.oddrowbgcolor)}break;case"I":h=tclang("location");case"i":if(c.location){tcloadProp("l"+o,e.tcid,(((k+1)*100)+o),h,1,c.location,q,e.tcColWidth,e.oddrowbgcolor)}break;case"J":h=tclang("resources");case"j":if(c.resources){r="";c.resources.each(function(j,i){r+=(i)?"\n":"";r+=j});tcloadProp("l"+o,e.tcid,(((k+1)*100)+o),h,1,r,q,e.tcColWidth,e.oddrowbgcolor)}break;case"O":h=tclang("categories");case"o":if(c.categories){r="";c.categories.each(function(j,i){r+=(i)?"\n":"";r+=j});tcloadProp("l"+o,e.tcid,(((k+1)*100)+o),h,1,r,q,e.tcColWidth,e.oddrowbgcolor)}break}}if(0!=e.tccompOk){$(z).title=tclang("open");tcCreateEvListFx(e.tcid,"l",z,"comp")}}if(0<o){if(0!=e.tcdlTotalOk){$(v("dlcl",e.tcid)).show()}if(0!=e.tcdlListOk){$(v("dlcrtxt",e.tcid)).innerHTML=tclang("download")+tclang("list");$(v("dlcr",e.tcid)).show()}}tcputcfg(e,2,"tcloadList date+ordnoMax upd");tcsetHgt(e)}function tcupdDay(a){var c,d,b;a=tcgetcfg(a.tcid,1,"tcupdDay start");tchideAllBoxes(a.tcid);tccreDay(a);tchideBottomBox(a.tcid);$(v("d",a.tcid)).show();tcsetHgt(a);c=tcInitUrl(a,"d")+"&toY="+a.tcYear+"&toM="+a.tcMonth+"&toD="+a.tcDay;if(2<=a.tctest){tctest(a,"tcupdDay url=\n"+c.substr(0,100)+"\n"+c.substr(100))}d=v("div",a.tcid);$(d).style.cursor="wait";b=new Ajax.Request(c,{method:"get",onFailure:function(e){tcajaxError(e.statusText,a);$(d).style.cursor="default"},onComplete:function(e){tcloadDay(e.responseXML,a);$(d).style.cursor="default"}})}function tcloadDay(g,h){var e=tcxml2arr(g,h),c,l,d,a,f,j,i,b,k=0;if(0>=e.size()){h.tcordnoMax="0";tcputcfg(h,2,"tcloadDay ordnoMax=0");tcsetHgt(h);return}h.tcordnoMax="";c=""+h.tcYear;c+=(10>h.tcMonth)?"0"+h.tcMonth:""+h.tcMonth;c+=(10>h.tcDay)?"0"+h.tcDay:""+h.tcDay;e.each(function(m){if(c!=m.key){return}f=-1;m.value.each(function(n){a=tcgetDayHour(h,n.key);j=v("dtr"+a+"data",h.tcid);if(f!=a){l=parseInt($(j).getAttribute("cntno"),10)||0;f=a}n.value.each(function(o){k++;l+=1;if(1<l){tcaddElem(j,"br")}else{if("">=h.tcordnoMax){h.tcordnoMax=o.value.xsort;tcputcfg(h,2,"tcloadDay ordnoMax upd")}}i=v("dtr"+a+"data"+l,h.tcid);b=o.value.xsort+"*"+o.value.xcurday+"*"+o.value.uid;d=(o.value.priority&&tcPrioColors[o.value.priority])?"color:"+tcPrioColors[o.value.priority]:"";if(h.tcColWidth<o.value.summary.length){o.value.summary=tcsplitLine(o.value.summary,h.tcColWidth)}tcaddElem(j,"span",$H({id:i,omYU:b}),o.value.summary,d);if(0!=h.tccompOk){$(i).title=tclang("open");tcCreateEvListFx(h.tcid,"d",i,"comp")}});$(j).setAttribute("cntno",l)})});if(0<k){if(0!=h.tcdlTotalOk){$(v("dlcl",h.tcid)).show()}if(0!=h.tcdlDayOk){$(v("dlcrtxt",h.tcid)).innerHTML=tclang("day")+" "+h.tcDay;$(v("dlcr",h.tcid)).show()}}tcsetHgt(h)}function tcupdMonth(a){var c,f,b,e;a=tcgetcfg(a.tcid,1,"tcupdMonth start");tchideAllBoxes(a.tcid);tccreMonth(a);tchideBottomBox(a.tcid);$(v("m",a.tcid)).show();tcsetHgt(a);e=a.tcDay;a.tcDay=1;c=tcInitUrl(a,"m")+"&toY="+a.tcYear+"&toM="+a.tcMonth+"&toD="+tclastDayInMonth(a.tcYear,a.tcMonth);a.tcDay=e;if(2<=a.tctest){tctest(a,"tcupdMonth url=\n"+c.substr(0,100)+"\n"+c.substr(100))}f=v("div",a.tcid);$(f).style.cursor="wait";b=new Ajax.Request(c,{method:"get",onFailure:function(d){tcajaxError(d.statusText,a);$(f).style.cursor="default"},onComplete:function(d){tcloadMonth(d.responseXML,a);$(f).style.cursor="default"}})}function tcloadMonth(h,k){var g=tcxml2arr(h,k),n=new Date(),m,e,j,a,d,b,c,l=0,f,o;if(0>=g.size()){k.tcordnoMax="0";tcputcfg(k,2,"tcloadMonth cfg save");tcsetHgt(k);return}k.tcordnoMax="";d=g.keys().first();m=g[d];d=m.keys().first();e=m[d];d=e.keys().first();j=e[d];k.tcordnoMax=j.xsort;tcputcfg(k,1,"tcloadMonth cfg save");a=n.getDayix(k,1);for(f=1,o=1;f<=31;f++){n.setFullYear(k.tcYear,(k.tcMonth-1),f);if(k.tcMonth!=n.getRealMonth()){break}d=k.tcYear;d+=(10>k.tcMonth)?"0"+k.tcMonth:""+k.tcMonth;d+=(10>f)?"0"+f:""+f;if(g[d]){l++;b=v("mtr"+o+""+a+"data",k.tcid);tcsetStls(b,"color:black;font-weight:bolder");c=0;g[d].each(function(i){i.value.each(function(p){c+=1})});if(0<c){$(b).title=c}}a+=1;if(8==a){o+=1;a=1}}if(0<l){if(0!=k.tcdlTotalOk){$(v("dlcl",k.tcid)).show()}if(0!=k.tcdlMonthOk){$(v("dlcrtxt",k.tcid)).innerHTML=tclang("wMonth",(k.tcMonth-1));$(v("dlcr",k.tcid)).show()}}tcsetHgt(k)}function tcupdWeek(a){var e,d,c,f,b;a=tcgetcfg(a.tcid,1,"tcupdWeek start");tchideAllBoxes(a.tcid);tccreWeek(a);tchideBottomBox(a.tcid);$(v("w",a.tcid)).show();tcsetHgt(a);c=new Date(a.tcYear,(a.tcMonth-1),a.tcDay);e=a;c.setDateFirstDayOfWeek(e.tcWeekStart);e.tcDay=c.getDate();e.tcMonth=c.getRealMonth();e.tcYear=c.getFullYear();d=tcInitUrl(e,"w");c.setFullYear(e.tcYear,(e.tcMonth-1),(e.tcDay+6));e.tcYear=c.getFullYear();e.tcMonth=c.getRealMonth();e.tcDay=c.getDate();d+="&toY="+e.tcYear+"&toM="+e.tcMonth+"&toD="+e.tcDay;if(1<=a.tctest){tctest(a,"tcupdWeek url=\n"+d.substr(0,100)+"\n"+d.substr(100))}f=v("div",a.tcid);$(f).style.cursor="wait";b=new Ajax.Request(d,{method:"get",onFailure:function(g){tcajaxError(g.statusText);$(f).style.cursor="default"},onComplete:function(g){tcloadWeek(g.responseXML,a);$(f).style.cursor="default"}})}function tcloadWeek(h,i){var g=tcxml2arr(h,i),p,n,a,k,j,e,f,l,d,o,b,m=0;if(0>=g.size()){i.tcordnoMax="0";tcputcfg(i,2,"tcloadWeek cfg save");tcsetHgt(i);return}i.tcordnoMax="";p=new Date(i.tcYear,(i.tcMonth-1),i.tcDay);p.setDateFirstDayOfWeek(i.tcWeekStart);i.tcDay=p.getDate();i.tcMonth=p.getRealMonth();i.tcYear=p.getFullYear();f="font-size:x-small";for(l=1;l<8;l++){d=i.tcYear;d+=(10>i.tcMonth)?"0"+i.tcMonth:""+i.tcMonth;d+=(10>i.tcDay)?"0"+i.tcDay:""+i.tcDay;if(g[d]){n=g[d];n.each(function(c){a=("0"==c.key.substr(0,1))?c.key.substr(1):c.key;a=tcgetDayHour(i,c.key);k=v("wtr"+a+l+"data",i.tcid);o=parseInt($(k).getAttribute("cntno"),10)||0;c.value.each(function(q){m++;o++;j=v("wtr"+a+l+"data"+o,i.tcid);e=(q.value.priority&&tcPrioColors[q.value.priority])?";color:"+tcPrioColors[q.value.priority]:"";b=q.value.xsort+"*"+q.value.xcurday+"*"+q.value.uid;tcaddElem(k,"span",$H({id:j,omYU:b}),"&diams; ",f+e);if("">=i.tcordnoMax){i.tcordnoMax=q.value.xsort;tcputcfg(i,2,"tcloadWeek cfg save")}if(0!=i.tccompOk){$(j).title=q.value.summary;tcCreateEvListFx(i.tcid,"w",j,"comp")}});$(v("wtr"+a+l+"data",i.tcid)).setAttribute("cntno",o)})}p.setFullYear(i.tcYear,(i.tcMonth-1),(i.tcDay+1));i.tcYear=p.getFullYear();i.tcMonth=p.getRealMonth();i.tcDay=p.getDate()}if(0<m){if(0!=i.tcdlTotalOk){$(v("dlcl",i.tcid)).show()}if(0!=i.tcdlWeekOk){$(v("dlcrtxt",i.tcid)).innerHTML=tclang("week")+" "+i.tcWeekno;$(v("dlcr",i.tcid)).show()}}tcsetHgt(i)}function tcxml2arr(c,g){var n=null,m,C,s,q,t,A,z,w,u,b,r,e,y,p,f,d,a,B,D,o,h,l;n=c.getElementsByTagName("vcalendar")[0];m=$A(n.getElementsByTagName(g.tccomptype));C=new Hash();if(!m.size()){return C}s=m.size();if(1>s){return C}for(t=0;t<s;t++){A=null;z=null;w=null;u=null;y=new Hash();b=$A(m[t].getElementsByTagName("*"));if(!b.size()){continue}q=b.size();if(1>q){continue}for(r=0;r<q;r++){if(!b[r].hasChildNodes()){continue}e=("url"!=b[r].tagName)?b[r].firstChild.nodeValue:"";switch(b[r].tagName){case"exdate":case"exrule":case"rdate":case"rrule":case"sequence":case"status":break;case"x-sort":y.xsort=e;break;case"class":case"location":case"percent":case"priority":case"summary":case"transp":case"uid":y[b[r].tagName]=e;break;case"x-url":y.url=e;break;case"completed":case"created":case"dtstamp":y[b[r].tagName]=e.substr(0,8)+e.substr(9);break;case"last-modified":if(e.substr(0,8)+e.substr(9)!=y.created){y.last_modified=e.substr(0,8)+e.substr(9)}break;case"x-current-day":A=e;y.xcurday=A;if((y.dtstart.substr(0,8)!=A)&&(!y.recurrent||y.recurrent.substr(0,8)!=A)){z=(10>g.tcDaystartHour)?"0"+(g.tcDaystartHour-1):(g.tcDaystartHour-1)}else{if(8<y.dtstart.length){z=y.dtstart.substr(8,2)}else{if(y.recurrent&&(8<y.recurrent.length)){z=y.recurrent.substr(8,2)}else{z=(10>g.tcDaystartHour)?"0"+(g.tcDaystartHour-1):(g.tcDaystartHour-1)}}}break;case"dtstart":y.dtstart=e.substr(0,8);if(8<e.length){y.dtstart+=e.substr(9)}break;case"x-current-dtstart":y.recurrent=e.substr(0,4)+e.substr(5,2)+e.substr(8,2);if(10<e.length){y.recurrent+=e.substr(11,2)+e.substr(14,2)+e.substr(17,2)}break;case"dtend":case"due":y.dtend=e.substr(0,8);if(8<e.length){y.dtend+=e.substr(9)}break;case"x-current-dtend":y.dtend=e.substr(0,4)+e.substr(5,2)+e.substr(8,2);if(10<e.length){y.dtend+=e.substr(11,2)+e.substr(14,2)+e.substr(17,2)}break;case"duration":p="";f=d=a=B=0;D=e.length;for(o=0;o<D;o++){switch(e.charAt(o)){case"P":case"T":break;case"W":f+=(""<p)?(7*parseInt(p,10)):0;p="";break;case"D":f+=(""<p)?parseInt(p,10):0;p="";break;case"H":d+=(""<p)?parseInt(p,10):0;p="";break;case"M":a+=(""<p)?parseInt(p,10):0;p="";break;case"S":B+=(""<p)?parseInt(p,10):0;p="";break;default:p+=""+e.charAt(o);break}}y[b[r].tagName]=new Array(f,d,a,B);break;case"organizer":if("mailto:"==e.substr(0,7).toLowerCase()){e=e.substr(7)}y[b[r].tagName]=e;break;case"attendee":case"contact":if("mailto:"==e.substr(0,7).toLowerCase()){e=e.substr(7)}case"categories":case"comment":case"description":case"resources":if(y[b[r].tagName]){y[b[r].tagName][y[b[r].tagName].size()]=e}else{y[b[r].tagName]=new Array(e)}break}}if((y.dtend&&(9>y.dtend.length))&&(y.dtend!=y.dtstart.substr(0,8))){h=new Date(parseInt(y.dtend.substr(0,4),10),(parseInt(y.dtend.substr(4,2),10)-1),(parseInt(y.dtend.substr(6,2),10)-1));y.dtend=h.getFullYear();l=h.getRealMonth();y.dtend+=(10>l)?"0"+l:""+l;l=h.getDate();y.dtend+=(10>l)?"0"+l:""+l}l=(y.recurrent)?y.recurrent:y.dtstart;if(l&&y.duration&&("vjournal"!=g.tccomptype)){y.dtend=tcdur2time(l,y.duration,g)}if(y.duration){y.remove("duration")}if(y.dtend&&(9>y.dtend.length)&&(y.dtend==y.dtstart)){y.remove("dtend")}if(!C[A]){C[A]=new Hash()}if("0"==z.substr(0,1)){z=z.substr(1)}if(!C[A][z]){C[A][z]=new Hash()}w=C[A][z].size();C[A][z][w]=y}if(2<=g.tctest){alert("tcxml2arr out, No days:"+C.size())}return C}function tcdur2time(i,c,e){var g=i.substr(0,4),a=parseInt(i.substr(4,2),10),f=parseInt(i.substr(6,2),10),j,h,b,k;f+=parseInt(c[0],10);j=(8<i.length)?parseInt(i.substr(8,2),10):0;j+=parseInt(c[1],10);h=(8<i.length)?parseInt(i.substr(10,2),10):0;h+=parseInt(c[2],10);b=(8<i.length)?parseInt(i.substr(12,2),10):0;b+=parseInt(c[3],10);k=new Date(g,(a-1),f,j,h,b);j=k.getHours();if(10>j){j="0"+j}h=k.getMinutes();if(10>h){h="0"+h}b=k.getSeconds();if(10>b){b="0"+b}if(("00"==j)&&("00"==h)&&("00"==b)){k=new Date(g,(a-1),(f-1),24,0,0);j="24"}g=k.getFullYear();a=k.getRealMonth();if(10>a){a="0"+a}f=k.getDate();if(10>f){f="0"+f}return""+g+a+f+j+h+b}function tccurpntr(a){$(this.id).style.cursor="pointer"}function tccurdef(a){$(this.id).style.cursor="default"}function tcshowBottomBox(b){var a=tcgetcfg(vtcid(this.id),1,"tcshowBottomBox in fr "+this.id);tchideAllBoxes(a.tcid);$(v("b1",a.tcid)).hide();$(v("b2",a.tcid)).show()}function tchideBottomBox(a){$(v("b1",a)).show();$(v("b2",a)).hide()}function tchideBottomBox2(b){var a=tcgetcfg(vtcid(this.id),1,"tchideBottomBox2 in fr "+this.id);tchideBottomBox(a.tcid);switch(a.tcView){case"comp":$(v("c",a.tcid)).show();break;case"list":$(v("l",a.tcid)).show();break;case"day":$(v("d",a.tcid)).show();break;case"week":$(v("w",a.tcid)).show();break;default:case"month":$(v("m",a.tcid)).show();break}if(0!=a.tcdlTotalOk){$(v("dlcl",a.tcid)).show()}if(((0!=a.tcdlMonthOk)&&("month"==a.tcView))||((0!=a.tcdlWeekOk)&&("week"==a.tcView))||((0!=a.tcdlDayOk)&&("day"==a.tcView))||((0!=a.tcdlCompOk)&&("comp"==a.tcView))||((0!=a.tcdlListOk)&&("list"==a.tcView))){$(v("dlcr",a.tcid)).show()}}function tchideAllBoxes(a){["c","l","d","w","m","dlcl","dlcr"].each(function(b){if($(v(b,a))){$(v(b,a)).hide()}})}function tcevShowBox(a,b){var c=v(b,a);if("block"!=$(c).style.display){tchideBottomBox(a);$(c).show()}}function tcsplitLine(e,d,b){b=b||false;var a="",c,f;while(d<e.length){c=e.substring(0,d);f=c.lastIndexOf("\n");if(-1!=f){a+=c.substr(0,f)+"<br/>";f+=1;e=(f<e.length)?e.substring(f):"";while((0<e.length)&&(" "==e.substring(f,1))){e=e.substring(f);f+=1}continue}f=c.lastIndexOf(" ");if((-1!=f)&&(1<e.length)){a+=c.substr(0,f)+"<br/>";e=((f+1)<e.length)?e.substring(f+1):"";continue}f=d-1;a+=c.substr(0,f);a+=(b)?"-<br/>":"<br/>";e=(f<e.length)?e.substring(f):""}return a+e}function tcajaxError(b,a){if(1<=a.tctest){tctest(a,"Ajax - tinycal ERROR when fetching data:\n"+b)}}function tcfmtDate(a){var b=("0"!=a.substr(6,1))?a.substr(6,2):a.substr(7,1);b+="/";b+=("0"!=a.substr(4,1))?a.substr(4,2):a.substr(5,1);return b}function tcfmtTime(a){return a.substr(8,2)+"."+a.substr(10,2)}function tcfmtdtstartdtend(b,a,c){c=c||false;var d="";if(c){d=b.substr(6,2);if("0"==d.substr(0,1)){d=d.substr(1,1)}d+="/";if("0"==b.substr(4,1)){d+=b.substr(5,1)}else{d+=b.substr(4,2)}d+=" "}if(a){if(b.substr(0,8)==a.substr(0,8)){if(8<b.length){d+=tcfmtTime(b);if(8<a.length){d+=" - "+tcfmtTime(a)}}}else{d=tcfmtDate(b);if(8<b.length){d+=" "+tcfmtTime(b)}d+=" - "+tcfmtDate(a);if(8<a.length){d+=" "+tcfmtTime(a)}}}else{if(8<b.length){d=tcfmtTime(b)}}return d}function tcgetDayHour(b,a){if(a<b.tcDaystartHour){a=b.tcDaystartHour-1}else{if(a>b.tcDayendHour){a=b.tcDayendHour+1}}return a}function tcInitUrl(a,c){c=c||"f";var b=location.protocol+"//"+a.tcUrl;b+="?tcid="+a.tcid+"&scope="+c;b+="&comptype="+a.tccomptype+"&d1="+a.tcData1;b+="&frY="+a.tcYear+"&frM="+a.tcMonth+"&frD="+a.tcDay;return b}var tcfxeh=new Hash();function tcRemoveEvListCont(b,a){["mouseover","mouseout","click"].each(function(c){if(tcfxeh[b][a][c]&&(0<tcfxeh[b][a][c].size())){tcfxeh[b][a][c].each(function(d){Event.stopObserving(d.key,c,d.value)})}});tcCreateEvListCont(b,a)}function tcCreateEvListCont(b,a){if(!tcfxeh[b][a]){tcfxeh[b][a]=new Hash()}["mouseover","mouseout","click"].each(function(c){tcfxeh[b][a][c]=new Hash()})}function tcCreateEvListFx(e,d,h,g){var a,c,f=false,b;tcfxeh[e][d]["mouseover"][h]=tccurpntr.bindAsEventListener($(h));Event.observe(h,"mouseover",tcfxeh[e][d]["mouseover"][h]);tcfxeh[e][d]["mouseout"][h]=tccurdef.bindAsEventListener($(h));Event.observe(h,"mouseout",tcfxeh[e][d]["mouseout"][h]);switch(g){case"go":tcfxeh[e][d]["click"][h]=tcgo.bindAsEventListener($(h));break;case"comp":tcfxeh[e][d]["click"][h]=tcselComp.bindAsEventListener($(h));break;case"list":tcfxeh[e][d]["click"][h]=tcselList.bindAsEventListener($(h));break;case"day":tcfxeh[e][d]["click"][h]=tcselDay.bindAsEventListener($(h));break;case"week":tcfxeh[e][d]["click"][h]=tcselWeek.bindAsEventListener($(h));break;case"month":tcfxeh[e][d]["click"][h]=tcselMonth.bindAsEventListener($(h));break;case"dlcl":case"dlcr":tcfxeh[e][d]["click"][h]=function(i){a=tcgetcfg(vtcid(h),1,"download in fr "+h);c=tcInitUrl(a,"f")+"&download=";f=false;if(("dlcl"==g)&&(1==a.tcdlTotalOk)){c+="1";f=true}else{if("dlcr"==g){switch(a.tcView){case"month":if(1==a.tcdlMonthOk){a.tcDay=1;c=tcInitUrl(a,"f")+"&toY="+a.tcYear+"&toM="+a.tcMonth+"&toD="+tclastDayInMonth(a.tcYear,a.tcMonth)+"&download=2";f=true}break;case"week":if(1==a.tcdlWeekOk){b=new Date();b.setFullYear(a.tcYear,(a.tcMonth-1),a.tcDay);b.setDateFirstDayOfWeek(a.tcWeekStart);a.tcYear=b.getFullYear();a.tcMonth=b.getRealMonth();a.tcDay=b.getDate();c=tcInitUrl(a,"f");b.setFullYear(a.tcYear,(a.tcMonth-1),(a.tcDay+6));c+="&toY="+b.getFullYear()+"&toM="+b.getRealMonth()+"&toD="+b.getDate()+"&download=3";f=true}break;case"day":if(1==a.tcdlDayOk){c+="4&toY="+a.tcYear+"&toM="+a.tcMonth+"&toD="+a.tcDay;f=true}break;case"list":if(1==a.tcdlListOk){c+="5&cnt="+a.tcListItems;if(""<a.tcUID){c+="&UID="+a.tcUID}f=true}break;case"comp":if(1==a.tcdlCompOk){c+="6&cnt=1&UID="+a.tcUID;f=true}break}}}if(f){location.href=c}};break;case"b1":tcfxeh[e][d]["click"][h]=tchideBottomBox2.bindAsEventListener($(h));break;case"b2":tcfxeh[e][d]["click"][h]=tcshowBottomBox.bindAsEventListener($(h));break;default:break}Event.observe(h,"click",tcfxeh[e][d]["click"][h])}function tctest(c,e){var b=e,a,d;for(a in c){d=new String(c[a]);b+="\n"+a+" = "+d.substr(0,50)}alert(b)};