var saveOnClick=false;var saveMethod;function initDateChoosers(){$$("input.dateChooser:not([class~=processed])").each(function(B){initDateChooser(B)})}function initDateChooser(I){I=$(I).addClassName("processed");var K=new Element("div",{"class":"smallCalendar calendar"});var M=new Element("div",{"class":"calendarWrapper"});var H=I.positionedOffset();I.wrap("div",{"class":"dateChooserWrapper"}).insert(M.insert(K));K.setStyle({marginTop:"-180px"});M.setStyle({position:"absolute",top:(H.top+I.getDimensions().height)+"px",left:(H.left)+"px",overflow:"hidden",zIndex:500});var N=toggleDateChooser.curry(K,M,I);$(I).observe("click",N);$(I).up().next("img.dateAnchor").observe("click",N);var J=initCalendar(K);J.updateelement=updateDateFunc.curry(I,J);var L=new Date(I.value);if(!isNaN(L)){J.setCurrentDate(L)}}function toggleDateChooser(D,E,F){(D.hasClassName("expanded")==true)?hideDateChooser(D,E,F):showDateChooser(D,E,F)}function showDateChooser(G,H,F){var E=F.positionedOffset();if(null!=$(F).readAttribute("hideSelects")){$(F).readAttribute("hideSelects").split(",").each(function(A){$(A).style.visibility="hidden"})}H.setStyle({position:"absolute",top:(E.top+F.getDimensions().height)+"px",left:(E.left)+"px",overflow:"hidden",zIndex:5});G.addClassName("expanded").morph({marginTop:"0px"},{duration:0.5});if((!window.XMLHttpRequest)&&document.getElementById("paymentType")!=null){document.getElementById("paymentType").style.visibility="hidden"}}function hideDateChooser(D,E,F){if((!window.XMLHttpRequest)&&document.getElementById("paymentType")!=null){document.getElementById("paymentType").style.visibility="visible"}D.removeClassName("expanded").morph({marginTop:"-180px"},{duration:0.5,afterFinish:function(){if(null!=$(F).readAttribute("hideSelects")){$(F).readAttribute("hideSelects").split(",").each(function(A){$(A).style.visibility="visible"})}}})}function updateDateFunc(target,cal,date){var m=date.getMonth()+1;var d=date.getDate();var y=date.getFullYear();m=(m<10)?"0"+m:m;d=(d<10)?"0"+d:d;datestr=m+"/"+d+"/"+y;$(target).value=datestr;if(cal.getDatesByEvent("")){cal.getDatesByEvent("").each(function(date){cal.removeEventsByDate(date)})}cal.setPlannerValue(date,"","selected");hideDateChooser(target.next(".calendarWrapper").select(".calendar")[0],null,target);if(saveOnClick){eval(saveMethod)}};