Zapatec.Setup=function(){};Zapatec.Setup.test=true;Zapatec.Calendar.setup=function(b){paramsList=["id"];function e(i,l){if(typeof b[i]=="undefined"){b[i]=l}paramsList.push(i)}b.id=Zapatec.Utils.generateID("calendar");e("inputField",null);e("displayArea",null);e("button",null);e("eventName","click");e("closeEventName",null);e("ifFormat","%Y/%m/%d");e("daFormat","%Y/%m/%d");e("singleClick",true);e("disableFunc",null);e("dateStatusFunc",b.disableFunc);e("dateText",null);e("firstDay",null);e("align","Br");e("range",[1900,2999]);e("weekNumbers",true);e("flat",null);e("flatCallback",null);e("onSelect",null);e("onClose",null);e("onUpdate",null);e("date",null);e("showsTime",false);e("sortOrder","asc");e("timeFormat","24");e("timeInterval",null);e("electric",true);e("step",2);e("position",null);e("cache",false);e("showOthers",false);e("multiple",null);e("saveDate",null);e("fdowClick",false);e("titleHtml",null);e("noHelp",false);e("noCloseButton",false);e("disableYearNav",false);e("disableFdowChange",false);if(b.weekNumbers){b.disableFdowChange=true}e("disableDrag",false);e("numberMonths",1);if((b.numberMonths>12)||(b.numberMonths<1)){b.numberMonths=1}if(b.numberMonths>1){b.showOthers=false}b.numberMonths=parseInt(b.numberMonths,10);e("controlMonth",1);if((b.controlMonth>b.numberMonths)||(b.controlMonth<1)){b.controlMonth=1}b.controlMonth=parseInt(b.controlMonth,10);e("vertical",false);if(b.monthsInRow>b.numberMonths){b.monthsInRow=b.numberMonths}e("monthsInRow",b.numberMonths);b.monthsInRow=parseInt(b.monthsInRow,10);e("multiple",false);if(b.multiple){b.singleClick=false}var c=["inputField","displayArea","button"];for(var d in c){if(typeof b[c[d]]=="string"){b[c[d]]=document.getElementById(b[c[d]])}}if(!(b.flat||b.multiple||b.inputField||b.displayArea||b.button)){alert("Calendar.setup '"+b.id+"':\n  Nothing to setup (no fields found).  Please check your code");return false}if(((b.timeInterval)&&((b.timeInterval!==Math.floor(b.timeInterval))||((60%b.timeInterval!==0)&&(b.timeInterval%60!==0))))||(b.timeInterval>360)){alert("'"+b.id+"': timeInterval option can only have the following number of minutes:\n1, 2, 3, 4, 5, 6, 10, 15, 30,  60, 120, 180, 240, 300, 360 ");b.timeInterval=null}if(b.date&&!Date.parse(b.date)){alert("'"+b.id+"' Start Date Invalid: "+b.date+".\nSee date option.\nDefaulting to today.");b.date=null}if(b.saveDate){e("cookiePrefix",window.location.href+"--"+b.button.id);var h=b.cookiePrefix;var f=Zapatec.Utils.getCookie(h);if(f!=null){document.getElementById(b.inputField.id).value=f}}for(var j in b){if(Zapatec.Utils.arrIndexOf(paramsList,j)==-1){alert("Wrong config option: "+j)}}function g(l){var i=l.params;var n=(l.dateClicked||i.electric);if(n&&i.flat){if(typeof i.flatCallback=="function"){if(!i.multiple){i.flatCallback(l)}}else{alert("'"+l.id+"': No flatCallback given -- doing nothing.")}return false}if(n&&i.inputField){i.inputField.value=l.currentDate.print(i.ifFormat);if(typeof i.inputField.onchange=="function"){i.inputField.onchange()}}if(n&&i.displayArea){i.displayArea.innerHTML=l.currentDate.print(i.daFormat)}if(n&&i.singleClick&&l.dateClicked){l.callCloseHandler()}if(n&&typeof i.onUpdate=="function"){i.onUpdate(l)}if(i.saveDate){var m=i.cookiePrefix;Zapatec.Utils.writeCookie(m,i.inputField.value,null,"/",i.saveDate)}}if(b.flat!=null){if(typeof b.flat=="string"){b.flat=document.getElementById(b.flat)}if(!b.flat){alert("Calendar.setup '"+b.id+"':\n  Flat specified but can't find parent.");return false}var a=new Zapatec.Calendar(b.firstDay,b.date,b.onSelect||g);a.id=b.id;a.disableFdowClick=b.disableFdowChange;a.showsOtherMonths=b.showOthers;a.showsTime=b.showsTime;a.time24=(b.timeFormat=="24");a.timeInterval=b.timeInterval;a.params=b;a.weekNumbers=b.weekNumbers;a.sortOrder=b.sortOrder.toLowerCase();a.setRange(b.range[0],b.range[1]);a.setDateStatusHandler(b.dateStatusFunc);a.getDateText=b.dateText;a.numberMonths=b.numberMonths;a.controlMonth=b.controlMonth;a.vertical=b.vertical;a.yearStep=b.step;a.monthsInRow=b.monthsInRow;a.helpButton=!b.noHelp;a.closeButton=!b.noCloseButton;a.yearNav=!b.disableYearNav;if(b.ifFormat){a.setDateFormat(b.ifFormat)}if(b.inputField&&b.inputField.type=="text"&&typeof b.inputField.value=="string"){a.parseDate(b.inputField.value)}if(b.multiple){a.setMultipleDates(b.multiple)}a.create(b.flat);a.show();return a}var k=b.button||b.displayArea||b.inputField;k["on"+b.eventName]=function(){var i=b.inputField||b.displayArea;if(k.blur){k.blur()}var n=b.inputField?b.ifFormat:b.daFormat;var p=false;var o=window.calendar;if(!(o&&b.cache)){window.calendar=o=new Zapatec.Calendar(b.firstDay,b.date,b.onSelect||g,b.onClose||function(q){if(b.cache){q.hide()}else{q.destroy()}});o.id=b.id;o.disableFdowClick=b.disableFdowChange;o.showsTime=b.showsTime;o.time24=(b.timeFormat=="24");o.timeInterval=b.timeInterval;o.weekNumbers=b.weekNumbers;o.numberMonths=b.numberMonths;o.controlMonth=b.controlMonth;o.vertical=b.vertical;o.monthsInRow=b.monthsInRow;o.historyDateFormat=b.ifFormat||b.daFormat;o.helpButton=!b.noHelp;o.disableDrag=b.disableDrag;o.closeButton=!b.noCloseButton;o.yearNav=!b.disableYearNav;p=true}else{if(b.date){o.setDate(b.date)}o.hide()}if(b.multiple){o.setMultipleDates(b.multiple)}o.showsOtherMonths=b.showOthers;o.yearStep=b.step;o.setRange(b.range[0],b.range[1]);o.params=b;o.setDateStatusHandler(b.dateStatusFunc);o.getDateText=b.dateText;o.setDateFormat(n);if(p){o.create()}if(i){var l;if(i.value){l=i.value}else{l=i.innerHTML}if(l!=""){var m=Date.parseDate(i.value||i.innerHTML,n);if(m!=null){o.setDate(m)}}}if(!b.position){o.showAtElement(b.button||b.displayArea||b.inputField,b.align)}else{o.showAt(b.position[0],b.position[1])}return false};if(b.closeEventName){k["on"+b.closeEventName]=function(){if(window.calendar){window.calendar.callCloseHandler()}}}return a};