function alphaAPI(c,a,d,b,f,e,g){this.element=typeof(c)=="object"?c:document.getElementById(c);this.fadeInDelay=a||40;this.fadeOutDelay=d||this.fadeInDelay;this.startAlpha=b;this.stopAlpha=f;if(typeof(this.element.filters)=="object"){if(typeof(this.element.filters.alpha)=="undefined"){this.element.style.filter+="alpha(opacity=100)"}}this.offsetTime=(e||0)*1000;this.deltaAlpha=g||10;this.timer=null;this.paused=false;this.started=false;this.cycle=false;this.command=function(){};return this}alphaAPI.prototype.repeat=function(a){this.cycle=a?true:false};alphaAPI.prototype.setAlphaBy=function(a){this.setAlpha(this.getAlpha()+a)};alphaAPI.prototype.toggle=function(){if(!this.started){this.start()}else{if(this.paused){this.unpause()}else{this.pause()}}};alphaAPI.prototype.timeout=function(b,a){this.command=b;this.timer=setTimeout(b,a)};alphaAPI.prototype.setAlpha=function(a){if(typeof(this.element.filters)=="object"){this.element.filters.alpha.opacity=a}else{if(this.element.style.setProperty){this.element.style.setProperty("opacity",a/100,"");this.element.style.setProperty("-moz-opacity",a/100,"");this.element.style.setProperty("-khtml-opacity",a/100,"")}}};alphaAPI.prototype.getAlpha=function(){if(typeof(this.element.filters)=="object"){return this.element.filters.alpha.opacity}else{if(this.element.style.getPropertyValue){var a=this.element.style.getPropertyValue("opacity");if(a==""){a=this.element.style.getPropertyValue("-moz-opacity")}if(a==""){a=this.element.style.getPropertyValue("-khtml-opacity")}return a*100}}return 100};alphaAPI.prototype.start=function(){this.started=true;this.setAlpha(this.startAlpha);if(this.startAlpha>this.stopAlpha){var a=this;this.timeout(function(){a.fadeOut()},this.offsetTime)}else{var a=this;this.timeout(function(){a.fadeIn()},this.offsetTime)}};alphaAPI.prototype.stop=function(){this.started=false;this.setAlpha(this.stopAlpha);this.stopTimer();this.command=function(){}};alphaAPI.prototype.reset=function(){this.started=false;this.setAlpha(this.startAlpha);this.stopTimer();this.command=function(){}};alphaAPI.prototype.pause=function(){this.paused=true;this.stopTimer()};alphaAPI.prototype.unpause=function(){this.paused=false;if(!this.started){this.start()}else{this.command()}};alphaAPI.prototype.stopTimer=function(){clearTimeout(this.timer);this.timer=null};alphaAPI.prototype.fadeOut=function(){this.stopTimer();if(this.getAlpha()>this.stopAlpha){this.setAlphaBy(-1*this.deltaAlpha);var a=this;this.timeout(function(){a.fadeOut()},this.fadeOutDelay)}else{if(this.cycle){var a=this;this.timeout(function(){a.fadeIn()},this.fadeInDelay)}else{this.started=false}}};alphaAPI.prototype.fadeIn=function(){this.stopTimer();if(this.getAlpha()<this.startAlpha){this.setAlphaBy(this.deltaAlpha);var a=this;this.timeout(function(){a.fadeIn()},this.fadeInDelay)}else{if(this.cycle){var a=this;this.timeout(function(){a.fadeOut()},this.fadeOutDelay)}else{this.started=false}}};var EVENT_FORM="event-form";var FORM_EVENT="form-event";var HIDDEN_CLASS="hidden";var WORKING_CLASS="working";var UPDATE_FAILED_CLASS="update-failed";var DELETE_CLASS="delete";var ELEMENT_NODE=1;var AJAX_SUCCESS="success";var DEFAULT_CALENDAR="Home";var DEFAULT_CALENDAR_NUM="2";var NEW_EVENT_TEXT="***NEW_EVENT_TEXT***";var calendar;var allDays;var allEvents;var calendars;var savedX;var savedY;var savedPart;var baseURL;var defaultCalendar;var defaultCalendarNum;function init(){try{baseURL=document.getElementById("baseURL").title;calendar=document.getElementById("calendar");initCalendars();initEvents();initFormatting();initShowHideCalendars()}catch(a){throw (a)}}function initCalendars(){var f=document.getElementById("calendars");var c=f.getElementsByTagName("input");calendars=new Array();for(var a=0;a<c.length;a++){var b=c[a];var e=b.parentNode.parentNode;var d=b.name.substring(5);calendars[a+1]=new Object();calendars[a+1].name=d;calendars[a+1].isWebCal=hasClass(e,"webcal");if(hasClass(e,"default")){defaultCalendar=d;defaultCalendarNum=a+1}}}function initShowHideCalendars(){var f=document.getElementById("calendars");var d=f.getElementsByTagName("input");var e=f.getElementsByTagName("label");for(var c=0;c<d.length;c++){var a=d[c];a.onmouseup=showHideCalendar;var b=e[c];b.onmouseup=showHideCalendar2}}function showHideCalendar(){try{var a=this;var h=a.name.substring(5);var g=document.getElementById("calendar");var b=getElementsByClass(g,"cal-"+h);for(var d=0;d<b.length;d++){var c=b[d];if(!a.checked){removeClass(c,HIDDEN_CLASS)}else{addClass(c,HIDDEN_CLASS)}}}catch(f){throw (f)}}function showHideCalendar2(){try{var b=this;var a=document.getElementById("view-"+b.innerHTML);var i=a.name.substring(5);var h=document.getElementById("calendar");var c=getElementsByClass(h,"cal-"+i);for(var f=0;f<c.length;f++){var d=c[f];if(!a.checked){removeClass(d,HIDDEN_CLASS)}else{addClass(d,HIDDEN_CLASS)}}}catch(g){throw (g)}}function doScrollCalendar(b){try{var f=getElementsByClass(calendar,"week");var d=f[0];var c=f[f.length-1];if(b<0){d.parentNode.removeChild(d);var a=d;c.parentNode.insertBefore(a,c.nextSibling)}else{if(b>0){c.parentNode.removeChild(c);var a=c;d.parentNode.insertBefore(a,d)}}}catch(g){throw (g)}}function initFormatting(){if(browser!="Internet Explorer"){window.onresize=function(){format()};format()}}function format(){try{formatFades()}catch(a){throw (a)}}function formatFades(){var c=getElementsByClass(calendar,"more");for(var a=0;a<c.length;a++){var d=c[a];var b=d.parentNode.offsetWidth-1;d.style.width=b+"px"}}function formatSingleDays(){var h=getElementsByClass(calendar,"single-day");for(var e=0;e<h.length;e++){var d=h[e];var b=findPosY(d);var c=getSingleDayWeek(d);var g=findPosY(c);var f=g+c.offsetHeight;var a=f-b;d.style.height=a+"px"}}function getSingleDayWeek(b){var a=b;while(a!=null&&!hasClass(a,"week")){a=a.parentNode}return a}function initEvents(){var d=getElementsByClass(calendar,"week");allDays=new Array();for(var c=0;c<d.length;c++){var a=d[c];var e=a.getElementsByTagName("th");for(var b=0;b<e.length;b++){allDays[allDays.length]=e[b]}}}function initAllEvents(a){var b=a.length;for(var d=0;d<b;d++){var c=a[d];initEvent(c)}}function initEvent(b){var a=getCalNo(b);if(!isWebCal(a)){addClass(b,"editable");b.onmouseover=function(d){mouseOverEvent(d,this)};b.onmouseout=function(d){mouseOutEvent(d,this)};b.onmousedown=function(d){mouseDownEvent(d,this)};var c=getEventText(b);c.onmouseover=function(d){mouseOverEvent(d,this.parentNode.parentNode)};c.onmouseout=function(d){mouseOutEvent(d,this.parentNode.parentNode)};c.onmousedown=function(d){mouseDownEvent(d,this.parentNode.parentNode)};b.ondrag=function(){return false};b.onselectstart=function(){return false}}}function unInitEvent(a){removeClass(a,"editable");a.onmouseover=null;a.onmouseout=null;a.onmousedown=null;var b=getEventText(a);b.onmouseover=null;b.onmouseout=null;b.onmousedown=null;a.ondrag=null;a.onselectstart=null}function isWebCal(a){return calendars[a].isWebCal}function findMouseX(b){var a=0;if(!b){var b=window.event}if(b.pageX){a=b.pageX}else{if(b.clientX){a=b.clientX+document.documentElement.scrollLeft}}return a}function findMouseY(a){var b=0;if(!a){var a=window.event}if(a.pageY){b=a.pageY}else{if(a.clientY){b=a.clientY+document.documentElement.scrollTop}}return b}function isSingleDayEvent(a){return hasClass(a.parentNode,"single-day")}function getEventDate(b){var a=b.parentNode;return getSingleDayDate(a)}function getSingleDayDate(a){var b=a.getAttributeNode("id").nodeValue;return b.substring(4)}function getFormInput(a){return a.getElementsByTagName("input")[0]}function getInputEvent(a){return a.parentNode.parentNode}function getFormEvent(a){return a.parentNode}function getEventForm(a){return a.getElementsByTagName("form")[0]}function getEventText(a){return getElementsByClass(a,"text")[0]}function getTextEvent(a){return a.parentNode.parentNode}function getEventDesc(a){return getElementsByClass(a,"description")[0]}function getEventUid(b){var a=-1;if(b.getAttributeNode("id")&&b.getAttributeNode("id").nodeValue!=""){a=b.getAttributeNode("id").nodeValue}return a}window.onload=init;var SEP="(^|$| )";function hasClass(a,b){var c=new RegExp(SEP+b+SEP);return c.test(a.className)}function addClass(b,a){if(!hasClass(b,a)){b.className+=" "+a}}function removeClass(c,a){var b=new RegExp(SEP+a+SEP);c.className=c.className.replace(b," ")}function replaceClass(d,c,a){var b=new RegExp(SEP+c+SEP);d.className=d.className.replace(b,a)}function getElementsByClass(b,a){var f=new Array();var e=b.getElementsByTagName("*");for(var d=0;d<e.length;d++){var c=e[d];if(hasClass(c,a)){f[f.length]=c}}return f};function delay(c){var b=new Date().getTime();var a=b;while((a-b)<c){a=new Date().getTime()}}function pause(c){var b="window.setTimeout( function () { window.close(); }, "+c+");";var a=window.showModalDialog('javascript:document.writeln("<script>'+b+'<\/script>")')}function findPosX(a){var b=0;if(a.offsetParent){while(a){b+=a.offsetLeft;a=a.offsetParent}}else{if(a.x){b+=a.x}}return b}function findPosY(b){var a=0;if(b.offsetParent){while(b){a+=b.offsetTop;b=b.offsetParent}}else{if(b.y){a+=b.y}}return a}String.prototype.trim=function(){var d=/^\s+|\s+$/,b=this.split(/\n/g),c=b.length;while(c-->0){b[c]=b[c].replace(d,"")}return b.join("\n")};var detect=navigator.userAgent.toLowerCase();var OS,browser,version,total,thestring;if(checkIt("konqueror")){browser="Konqueror";OS="Linux"}else{if(checkIt("safari")){browser="Safari"}else{if(checkIt("omniweb")){browser="OmniWeb"}else{if(checkIt("opera")){browser="Opera"}else{if(checkIt("webtv")){browser="WebTV"}else{if(checkIt("icab")){browser="iCab"}else{if(checkIt("msie")){browser="Internet Explorer"}else{if(!checkIt("compatible")){browser="Netscape Navigator";version=detect.charAt(8)}else{browser="An unknown browser"}}}}}}}}if(!version){version=detect.charAt(place+thestring.length)}if(!OS){if(checkIt("linux")){OS="Linux"}else{if(checkIt("x11")){OS="Unix"}else{if(checkIt("mac")){OS="Mac"}else{if(checkIt("win")){OS="Windows"}else{OS="an unknown operating system"}}}}}function checkIt(a){place=detect.indexOf(a)+1;thestring=a;return place};