//----------------------------------------------------------
//      Calendar JavaScript                                 
//                       Copyright(C) Y.Miyake              
//----------------------------------------------------------
var calendarZeroPad = true;var calendarSpliter = "/";var calendarPrm1;var calendarPrm2;var calendarPrm3;var calendarType;var calendarTargetYear  ;var calendarTargetMonth ;var dayofmonth = new Array( 31,28,31,30,31,30,31,31,30,31,30,31 );var calendarWin;function Calendar( prm1, prm2, prm3 ){var yy, mm, dd;if( prm3 == undefined ){if( prm2 == undefined ){calendarType = 1;slice = prm1.value.split( calendarSpliter );yy = slice[0];mm = slice[1];dd = slice[2];} else {calendarType = 2;slice = prm1.value.split( calendarSpliter );yy = slice[0];mm = slice[1];dd = prm2.value;}} else {calendarType = 3;yy = prm1.value;mm = prm2.value;dd = prm3.value;}calendarPrm1 = prm1;if( prm2 != undefined ){ calendarPrm2 = prm2; }if( prm3 != undefined ){ calendarPrm3 = prm3; }calendarWin = window.open("", "calendarWin", "width=280,height=270,toolbar=no,titlebar=no,status=no,menubar=no,location=no,directories=no");calendarShow( yy, mm, dd );}function CalendarZeroPad( pad ){if( pad ){calendarZeroPad = true;} else {calendarZeroPad = false;}}function calendarClicked( yy, mm, dd ){if( calendarZeroPad ){if( mm < 10 ) mm = '0' + mm;if( dd < 10 ) dd = '0' + dd;}if( calendarType == 1 ){calendarPrm1.value = yy + '/' + mm + '/' + dd;} else if ( calendarType == 2 ){calendarPrm1.value = yy + '/' + mm;calendarPrm2.value = dd;} else if ( calendarType == 3 ){calendarPrm1.value = yy;calendarPrm2.value = mm;calendarPrm3.value = dd;} else {alert( "内部エラーです" );}calendarZeroPad = true; calendarWin.close();}function calendarClose(){calendarZeroPad = true; window.close();}function calendarNextMonth(){if( calendarTargetMonth >= 12 ){  calendarShow( calendarTargetYear+1, 1 );} else {calendarShow( calendarTargetYear, calendarTargetMonth+1 );}}function calendarPrevMonth(){if( calendarTargetMonth > 1 ){calendarShow( calendarTargetYear, calendarTargetMonth-1 );} else {calendarShow( calendarTargetYear-1, 12 );}}function calendarNextYear(){calendarShow( calendarTargetYear+1, calendarTargetMonth );}function calendarPrevYear(){calendarShow( calendarTargetYear-1, calendarTargetMonth );}function calendarShow( year, month, day ){var markDate = "";var leap = 0;var now = new Date();if( year=='' || year==undefined || year==null ){year  = now.getYear();}if( month==0 || month=='' || month==undefined || month==null ){month = now.getMonth() + 1;}if( day==0 || day=='' || day==undefined || day==null ){day   = now.getDate();}if( year < 100 ) year += 1900;if( year < 1800 ) year = 1800;if( year > 2100 ) year = 2100;leap = 0;if( year % 4 == 0 ){if( year % 100 == 0 ){if( year % 400 == 0 ){leap = 1;}} else {leap = 1;}}if( month > 12 ) month=12;if( month < 1 )  month=1;if( day > 28 && month==2 && leap==1 ){day = 29;} else if( day > dayofmonth[month-1] ){day = dayofmonth[month-1];}if( day < 1 )  day=1;if( day > 31 ) day=31;year  = year * 10 / 10;month = month * 10 / 10;day   = day * 10 / 10;calendarTargetYear  = year;calendarTargetMonth = month;if( day != null ) {markDate = new Date( year, month-1, day );}var firstDate = new Date( year, month-1, 1 );var bgnDate = new Date( firstDate.getTime() - (firstDate.getDay()*1000*3600*24));var htmlText = "";htmlText += '<body leftmargin="10" topmargin="10">';htmlText += '<hr>';htmlText += '<style>';htmlText += '<!---';htmlText += 'body { font-size: 12px;';htmlText += '     }';htmlText += 'table{ font-size: 12px;';htmlText += '       font-family: Arial,sans-serif;';htmlText += '     }';htmlText += 'A:link    { color: #000;';htmlText += '            text-decoration: none}';htmlText += 'A:visited { color: #000;';htmlText += '            text-decoration: none}';htmlText += 'A:hover{';htmlText += '    color:      #f00;';htmlText += '    background-color:   #fdd;';htmlText += '    text-decoration:    underline;';htmlText += '}';htmlText += '.sun      { color: red;';htmlText += '            font-family: Arial,sans-serif;';htmlText += '          }';htmlText += '.sat      { color: blue;';htmlText += '            font-family: Arial,sans-serif;';htmlText += '          }';htmlText += '.wday     { color: black;';htmlText += '            font-family: Arial,sans-serif;';htmlText += '          }';htmlText += '--->';htmlText += '</style>';htmlText += ' <table width="100%" border="0" >';htmlText += '   <tr>';htmlText += '     <td>';htmlText += '         &nbsp;&nbsp;&nbsp;&nbsp;';htmlText += '         <b>' + year + '/</b>';htmlText += '         <span style="{font-size: 150%; font-weight: bold;}">'+ month +'</span>';htmlText += '     </td>';htmlText += '     <td align="right">';htmlText += '        <input type="button" value=" < " onclick="opener.calendarPrevMonth();">';htmlText += '        <input type="button" value=" > " onclick="opener.calendarNextMonth();">';htmlText += '     </td>';htmlText += '     <td>&nbsp;</td>';htmlText += '   </tr>';htmlText += ' </table>';htmlText += '<hr>';htmlText += '<table width="100%" border="0">';htmlText += '<tr>';htmlText += ' <td align="center"><span class="sun" ><b>&nbsp;SUN&nbsp;</span></td>';htmlText += ' <td align="center"><span class="wday"><b>&nbsp;MON&nbsp;</span></td>';htmlText += ' <td align="center"><span class="wday"><b>&nbsp;TUE&nbsp;</span></td>';htmlText += ' <td align="center"><span class="wday"><b>&nbsp;WED&nbsp;</span></td>';htmlText += ' <td align="center"><span class="wday"><b>&nbsp;THU&nbsp;</span></td>';htmlText += ' <td align="center"><span class="wday"><b>&nbsp;FRI&nbsp;</span></td>';htmlText += ' <td align="center"><span class="sat" ><b>&nbsp;SAT&nbsp;</span></td>';htmlText += '</tr>';var row, col, color;var curDate;for( row=0; row<6; row++ ){htmlText += '<tr>';for( col=0; col<7; col++ ){curDate = new Date(bgnDate.getTime() + ((row*7+col)*1000*3600*24));var curMonth = curDate.getMonth()+1;var curDay   = curDate.getDate();var curWeek  = curDate.getDay();var curYear  = curDate.getYear();if( curYear < 2000 ) curYear += 1900;if( markDate!='' && markDate.getTime() == curDate.getTime() ){color = "#f0f0a0";     } else if( curMonth != month ){color = "#CCCCCC";     } else if( curWeek == 0 ){color = "#ffaaaa";     } else if( curWeek == 6 ){color = "#aaaaff";     } else {color = "#f0f0f0";     }dateFmt = curYear + '\',\'' + curMonth + '\',\'' + curDay;htmlText += '<td align="center" bgcolor="' + color + '">';htmlText += '<a href="#" onclick="opener.calendarClicked( \''+dateFmt+'\' );">&nbsp;' + curDay + '&nbsp;</a></td>';}htmlText += '</tr>';nextDate = new Date(curDate.getTime() + (1000*3600*24) );if( nextDate.getMonth()+1 != month ) break;}htmlText += '</table>';htmlText += '<br>';htmlText += '<input type="button" value="閉じる" onClick="window.close();">';htmlText += '</body>';calendarWin.document.open();calendarWin.document.clear();calendarWin.document.write( htmlText );calendarWin.document.close();}function calendarCheckBrowser(){var Win    = navigator.userAgent.indexOf('Win')!=-1;var Mac    = navigator.userAgent.indexOf('Mac')!=-1;var X11    = navigator.userAgent.indexOf('X11')!=-1;var Moz    = navigator.userAgent.indexOf('Gecko')!=-1;var msie   = navigator.userAgent.indexOf('MSIE')!=-1;}