Calendar.setup=function(G){function F(H,I){if(typeof G[H]=="undefined"){G[H]=I}}F("inputField",null);F("displayArea",null);F("button",null);F("eventName","click");F("ifFormat","%Y/%m/%d");F("daFormat","%Y/%m/%d");F("singleClick",true);F("disableFunc",null);F("dateStatusFunc",G.disableFunc);F("dateText",null);F("firstDay",null);F("align","Br");F("range",[1900,2999]);F("weekNumbers",true);F("flat",null);F("flatCallback",null);F("onSelect",null);F("onClose",null);F("onUpdate",null);F("date",null);F("showsTime",false);F("timeFormat","24");F("electric",true);F("step",2);F("position",null);F("cache",false);F("showOthers",false);F("multiple",null);var C=["inputField","displayArea","button"];for(var B in C){if(typeof G[C[B]]=="string"){G[C[B]]=document.getElementById(G[C[B]])}}if(!(G.flat||G.multiple||G.inputField||G.displayArea||G.button)){alert("Calendar.setup:\n  Nothing to setup (no fields found).  Please check your code");return false}if(G.date){G.date=Date.parseDate(G.date,G.inputField?G.ifFormat:G.daFormat)}function A(I){var H=I.params;var J=(I.dateClicked||H.electric);if(J&&H.inputField){H.inputField.value=I.date.print(H.ifFormat);if(typeof H.inputField.onchange=="function"){H.inputField.onchange()}}if(J&&H.displayArea){H.displayArea.innerHTML=I.date.print(H.daFormat)}if(J&&typeof H.onUpdate=="function"){H.onUpdate(I)}if(J&&H.flat){if(typeof H.flatCallback=="function"){H.flatCallback(I)}}if(J&&H.singleClick&&I.dateClicked){I.callCloseHandler()}}if(G.flat!=null){if(typeof G.flat=="string"){G.flat=document.getElementById(G.flat)}if(!G.flat){alert("Calendar.setup:\n  Flat specified but can't find parent.");return false}var E=new Calendar(G.firstDay,G.date,G.onSelect||A);E.showsOtherMonths=G.showOthers;E.showsTime=G.showsTime;E.time24=(G.timeFormat=="24");E.params=G;E.weekNumbers=G.weekNumbers;E.setRange(G.range[0],G.range[1]);E.setDateStatusHandler(G.dateStatusFunc);E.getDateText=G.dateText;if(G.ifFormat){E.setDateFormat(G.ifFormat)}E.create(G.flat);if(G.inputField&&typeof G.inputField.value=="string"){E.parseDate(G.inputField.value)}E.show();return E}var D=G.button||G.displayArea||G.inputField;D["on"+G.eventName]=function(){var H=G.inputField||G.displayArea;var J=G.inputField?G.ifFormat:G.daFormat;var N=false;var L=window.calendar;if(H.value){G.date=Date.parseDate(H.value||H.innerHTML,J)}if(!(L&&G.cache)){window.calendar=L=new Calendar(G.firstDay,G.date,G.onSelect||A,G.onClose||function(O){O.hide()});L.showsTime=G.showsTime;L.time24=(G.timeFormat=="24");L.weekNumbers=G.weekNumbers;N=true}else{if(G.date){L.setDate(G.date)}L.hide()}if(G.multiple){L.multiple={};for(var I=G.multiple.length;--I>=0;){var M=G.multiple[I];var K=M.print("%Y%m%d");L.multiple[K]=M}}L.showsOtherMonths=G.showOthers;L.yearStep=G.step;L.setRange(G.range[0],G.range[1]);L.params=G;L.setDateStatusHandler(G.dateStatusFunc);L.getDateText=G.dateText;L.setDateFormat(J);if(N){L.create()}L.refresh();if(!G.position){L.showAtElement(G.button||G.displayArea||G.inputField,G.align)}else{L.showAt(G.position[0],G.position[1])}return false};return E};Calendar.customized_setup=function(D){function G(J,K){if(typeof D[J]=="undefined"){D[J]=K}}G("inputField",null);G("displayArea",null);G("button",null);G("eventName","click");G("ifFormat","%Y/%m/%d");G("daFormat","%Y/%m/%d");G("singleClick",true);G("disableFunc",null);G("dateStatusFunc",D.disableFunc);G("dateText",null);G("firstDay",null);G("align","Br");G("range",[1900,2999]);G("weekNumbers",true);G("flat",null);G("flatCallback",null);G("onSelect",null);G("onClose",null);G("onUpdate",null);G("date",null);G("showsTime",false);G("timeFormat","24");G("electric",true);G("step",2);G("position",null);G("cache",false);G("showOthers",false);G("multiple",null);var E=["inputField","displayArea","button"];for(var F in E){if(typeof D[E[F]]=="string"){D[E[F]]=document.getElementById(D[E[F]])}}if(!(D.flat||D.multiple||D.inputField||D.displayArea||D.button)){alert("Calendar.setup:\n  Nothing to setup (no fields found).  Please check your code");return false}if(D.date){D.date=Date.parseDate(D.date,D.inputField?D.ifFormat:D.daFormat)}function H(K){var J=K.params;var L=(K.dateClicked||J.electric);if(L&&J.inputField){J.inputField.value=K.date.print(J.ifFormat);if(typeof J.inputField.onchange=="function"){J.inputField.onchange()}}if(L&&J.displayArea){J.displayArea.innerHTML=K.date.print(J.daFormat)}if(L&&typeof J.onUpdate=="function"){J.onUpdate(K)}if(L&&J.flat){if(typeof J.flatCallback=="function"){J.flatCallback(K)}}if(L&&J.singleClick&&K.dateClicked){K.callCloseHandler()}}var C=D.inputField||D.displayArea;var I=D.inputField?D.ifFormat:D.daFormat;var B=false;var A=null;if(C.value){D.date=Date.parseDate(C.value||C.innerHTML,I)}A=new Calendar(D.firstDay,D.date,D.onSelect||H,D.onClose||function(J){J.hide()});A.showsTime=D.showsTime;A.time24=(D.timeFormat=="24");A.weekNumbers=D.weekNumbers;B=true;A.showsOtherMonths=D.showOthers;A.yearStep=D.step;A.setRange(D.range[0],D.range[1]);A.params=D;A.setDateStatusHandler(D.dateStatusFunc);A.getDateText=D.dateText;A.setDateFormat(I);if(B){A.create()}A.refresh();if(!D.position){A.showAtElement(D.button||D.displayArea||D.inputField,D.align)}else{A.showAt(D.position[0],D.position[1])}A.hide();return A};