
dojo.require("dijit._Calendar");window.calendars={};function setUpDatePicker(id){calendars[id]=new dijit._Calendar({widgetId:id,setItUp:function(){this.hideCal();this.domNode.style.top='0px';this.domNode.style.left='0px';this.domNode.style.position='absolute';this.domNode.style.zIndex='999';this.textBox=dojo.byId('enterDate'+this.widgetId);this.toggler=dojo.byId('toggleDate'+this.widgetId);dojo.body().appendChild(this.domNode);dojo.connect(this.toggler,'onclick',this,this.prepareShowCal);dojo.connect(this,'onValueSelected',this,'onClickValueChange');dojo.connect(this.domNode,'onclick',function(evt){dojo.stopEvent(evt)});}});calendars[id].setItUp();}
dojo.addOnLoad(function(){dijit._Calendar.prototype.hideCal=function(){this.domNode.style.display='none';if(dojo.isIE<=6)showSelects();};dijit._Calendar.prototype.showCal=function(evt){dojo.style(this.domNode,'display','block');if(dojo.isIE<=6)hideSelects();};dijit._Calendar.prototype.prepareShowCal=function(evt){if(!evt){evt=window.event};evt=dojo.fixEvent(evt);this.domNode.style.left=evt.pageX+'px';this.domNode.style.top=evt.pageY+'px';this.showCal();dojo.stopEvent(evt);var thisId=this.widgetId.toString();document.body.onclick=function(evt){hideCal(thisId)};};dijit._Calendar.prototype.onClickValueChange=function(evt){this.textBox.value=convertDate(this.value);setTimeout('hideCal("'+this.widgetId+'")',60);};});function hideCal(id){calendars[id].hideCal();}
function convertDate(date){var month=date.getMonth()+1;if(month<10)month='0'+month;var day=date.getDate();if(day<10)day='0'+day;var year=date.getFullYear();return(month+'/'+day+'/'+year);}
function hideSelects(){q=document.getElementsByTagName('select');for(var i=0;i<q.length;i++){q[i].style.visibility='hidden';}}
function showSelects(){q=document.getElementsByTagName('select');for(var i=0;i<q.length;i++){q[i].style.visibility='visible';}}