\n\t\t\t{props.mode == 'months' ? this.renderMonths(props) : null}\n\t\t\t{props.mode == 'years' ? this.renderYears(props) : null}\n\t\t\t{props.mode == 'days' ? this.renderDays(props) : null}\n\t\t\t
Calendar.hideCalendar()}>{props.close_label}\n\t\t
);\n\t}\n\n\tcomponentDidMount()\n\t{\n\t\tthis.componentDidUpdate();\n\t}\n\n\tcomponentDidUpdate()\n\t{\n\t\t// Position the div in the correct location...\n\t\tvar input = this.props.input;\n\t\tvar div = Calendar.box;\n\t\tvar xy = getOffset(input);\n\t\tvar height = input.clientHeight||input.offsetHeight;\n\t\tvar ww = document.body.clientWidth||document.documentElement.clientWidth;\n\t\tvar wh = document.body.clientHeight||document.documentElement.clientHeight;\n\t\tif (xy.left-1+div.offsetWidth > ww)\n\t\t\tdiv.style.left = (ww-div.offsetWidth-1)+\"px\";\n\t\telse\n\t\t\tdiv.style.left = (xy.left-1)+\"px\";\n\t\tif (div.offsetHeight + xy.top+height-1 >= wh &&\n\t\t\txy.top-div.offsetHeight >= 0)\n\t\t\tdiv.style.top = (xy.top-div.offsetHeight)+'px';\n\t\telse\n\t\t\tdiv.style.top = (xy.top+height-1)+\"px\";\n\t}\n\n\t/// Called when the user clicks on a date in the calendar.\n\tselectDate(year, month, day)\n\t{\n\t\tvar i = this.props.input;\n\t\tvar t = i.value.split(/\\s+/, 2)[1]||'';\n\t\tmonth = Number(month)+1;\n\t\tif (this.props.callback)\n\t\t{\n\t\t\t// Safari does not understand new Date('YYYY-MM-DD HH:MM:SS')\n\t\t\tt = t ? t.split(/:/) : null;\n\t\t\tt = t ? new Date(year-0, month-1, day-0, t[0]-0, t[1]-0, t[2]-0) : new Date(year-0, month-1, day-0);\n\t\t\tvar c = this.props.callback;\n\t\t\tc(new Date(t));\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (month < 10)\n\t\t\t\tmonth = '0'+month;\n\t\t\tif (day < 10)\n\t\t\t\tday = '0'+day;\n\t\t\tt = (this.format == 'Y-m-d' ? year + '-' + month + '-' + day : day + '.' + month + '.' + year) + (t ? ' '+t : '');\n\t\t\ti.value = t;\n\t\t\tif (\"Event\" in window)\n\t\t\t{\n\t\t\t\tvar evt = document.createEvent('Event');\n\t\t\t\tevt.initEvent('change', true, true);\n\t\t\t\ti.dispatchEvent(evt);\n\t\t\t}\n\t\t\telse\n\t\t\t\ti.fireEvent(\"onchange\");\n\t\t}\n\t\tCalendar.hideCalendar();\n\t}\n\n\tshowMonths(year)\n\t{\n\t\tthis.props.onChangeProps({ year, mode: 'months' });\n\t}\n\n\tshowYears(year)\n\t{\n\t\tthis.props.onChangeProps({ year, mode: 'years' });\n\t}\n\n\tshowDays(year, month)\n\t{\n\t\tthis.props.onChangeProps({ year, month, mode: 'days' });\n\t}\n\n\trenderMonths(props)\n\t{\n\t\tvar year = props.year;\n\t\tvar cur_y = props.today.getFullYear();\n\t\tvar cur_m = props.today.getMonth();\n\t\tvar sel_m = props.selected.getFullYear() == year ? props.selected.getMonth() : -1;\n\t\tvar months = [ [ 0, 1, 2 ], [ 3, 4, 5 ], [ 6, 7, 8 ], [ 9, 10, 11 ] ];\n\t\treturn (