Zapatec.Setup=function(){};Zapatec.Setup.test=true;Zapatec.Calendar.setup=function(B){function E(J,K){if(typeof B[J]=="undefined"){B[J]=K;}}E("inputField",null);E("displayArea",null);E("button",null);E("eventName","click");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("disableFdowChange",false);if((B.numberMonths>12)||(B.numberMonths<1)){B.numberMonths=1;}else{E("numberMonths",1);}if(B.numberMonths>1){B.showOthers=false;}B.numberMonths=parseInt(B.numberMonths,10);if((B.controlMonth>B.numberMonths)||(B.controlMonth<1)){B.controlMonth=1;}else{E("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);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:\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("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("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;}}function G(K){var J=K.params;var M=(K.dateClicked||J.electric);if(M&&J.flat){if(typeof J.flatCallback=="function"){if(!J.multiple){J.flatCallback(K);}}else{alert("No flatCallback given -- doing nothing.");}return false;}if(M&&J.inputField){J.inputField.value=K.currentDate.print(J.ifFormat);if(typeof J.inputField.onchange=="function"){J.inputField.onchange();}}if(M&&J.displayArea){J.displayArea.innerHTML=K.currentDate.print(J.daFormat);}if(M&&J.singleClick&&K.dateClicked){K.callCloseHandler();}if(M&&typeof J.onUpdate=="function"){J.onUpdate(K);}if(J.saveDate){var L=J.cookiePrefix;Zapatec.Utils.writeCookie(L,J.inputField.value,null,"/",J.saveDate);}}if(B.flat!=null){if(typeof B.flat=="string"){B.flat=document.getElementById(B.flat);}if(!B.flat){alert("Calendar.setup:\n  Flat specified but can't find parent.");return false;}var A=new Zapatec.Calendar(B.firstDay,B.date,B.onSelect||G);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;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 I=B.button||B.displayArea||B.inputField;I["on"+B.eventName]=function(){var J=B.inputField||B.displayArea;if(I.blur){I.blur();}var M=B.inputField?B.ifFormat:B.daFormat;var O=false;var N=window.calendar;if(!(N&&B.cache)){window.calendar=N=new Zapatec.Calendar(B.firstDay,B.date,B.onSelect||G,B.onClose||function(P){if(B.cache){P.hide();}else{P.destroy();}});N.disableFdowClick=B.disableFdowChange;N.showsTime=B.showsTime;N.time24=(B.timeFormat=="24");N.timeInterval=B.timeInterval;N.weekNumbers=B.weekNumbers;N.numberMonths=B.numberMonths;N.controlMonth=B.controlMonth;N.vertical=B.vertical;N.monthsInRow=B.monthsInRow;N.historyDateFormat=B.ifFormat||B.daFormat;N.helpButton=!B.noHelp;O=true;}else{if(B.date){N.setDate(B.date);}N.hide();}if(B.multiple){N.setMultipleDates(B.multiple);}N.showsOtherMonths=B.showOthers;N.yearStep=B.step;N.setRange(B.range[0],B.range[1]);N.params=B;N.setDateStatusHandler(B.dateStatusFunc);N.getDateText=B.dateText;N.setDateFormat(M);if(O){N.create();}if(J){var K;if(J.value){K=J.value;}else{K=J.innerHTML;}if(K!=""){var L=Date.parseDate(J.value||J.innerHTML,M);if(L!=null){N.setDate(L);}}}if(!B.position){N.showAtElement(B.button||B.displayArea||B.inputField,B.align);}else{N.showAt(B.position[0],B.position[1]);}return false;};if(B.closeEventName){I["on"+B.closeEventName]=function(){if(window.calendar){window.calendar.callCloseHandler();}};}return A;};