var monthList = ['January','February','March','April','May','June','July','August','September','October','November','December'];
var curDate = new Date(); curDate.setDate(1); curDate.getTheYear = curDate.getFullYear ? curDate.getFullYear : curDate.getYear;
var MWJNS4 = document.layers && !document.all && navigator.mimeTypes['*'];
var opOrEscape = window.opera || ( document.layers && !navigator.mimeTypes['*'] ) || navigator.vendor == 'KDE' || ( document.childNodes && !document.all && !navigator.taintEnabled ) || ( window.ScriptEngine && ScriptEngine() == 'JScript' && navigator.platform == 'Win32' && window.ActiveXObject && !navigator.__ice_version );
function openCalendar(e) {
var sX = 0, sY = 0; if( !e ) { e = window.event; }
if( e && ( e.screenX || e.screenY ) && screen.availWidth ) { sX = e.screenX; sY = e.screenY; }
if( sX > screen.availWidth - 271 ) { sX = screen.availWidth - 271; }
if( sY > screen.availHeight - 308 ) { sY = screen.availHeight - 308; }
doReDraw(sX,sY);
}
function MWJ_dropYear() { curDate.setYear( curDate.getTheYear() - 1 ); doReDraw(); }
function MWJ_raiseYear() { curDate.setYear( curDate.getTheYear() + 1 ); doReDraw(); }
function MWJ_dropMonth() { if( curDate.getMonth() ) { curDate.setMonth( curDate.getMonth() - 1 ); } else { curDate.setMonth(11); curDate.setYear( curDate.getTheYear() - 1 ); } doReDraw(); }
function MWJ_raiseMonth() { if( curDate.getMonth() < 11 ) { curDate.setMonth( curDate.getMonth() + 1 ); } else { curDate.setMonth(0); curDate.setYear( curDate.getTheYear() + 1 ); } doReDraw(); }
function resetDate() { curDate.setTime((new Date()).getTime()); }
function doReDraw(sX,sY) {
var theContent =
'<html><head><title>Date picker</title><style type="text/css"><!--\n'+
'a { text-decoration: none; }\n'+
'td, th { font-family: \'Times New Roman\', Times, Serif; }\n'+
'a.MWJCAL { display: block; width: 100%; font-weight: bold; }\n'+
'a.MWJCAL:hover { background-color: #99ff99; }\n--></style></head>'+
'<body bgcolor="#bfbfbf" text="#ffffff" link="#00007f" alink="#00007f" vlink="#00007f">'+
'<form onsubmit="return false;"><table border="1" cellpadding="2" cellspacing="1" width="233">'+
'<tr><td bgcolor="#ffffff" colspan="7"><table border="0" cellpadding="2" cellspacing="1" width="100%">'+
'<tr><td bgcolor="#323c76">'+(MWJNS4?'<a href="javascript:if( window.opener && window.opener.MWJ_dropYear ) { window.opener.MWJ_dropYear(); } else { window.alert( \'Error:\\nCould not communicate with opening window.\' ); }"><font color="#ffffff"><<</font></a>':'<input type="button" value="<<" onclick="if( window.opener && window.opener.MWJ_dropYear ) { window.opener.MWJ_dropYear(); } else { window.alert( \'Error:\\nCould not communicate with opening window.\' ); }">')+'</td><td bgcolor="#323c76" align="center"><b>'+curDate.getTheYear()+'</b></td><td bgcolor="#323c76" align="right">'+(MWJNS4?'<a href="javascript:if( window.opener && window.opener.MWJ_raiseYear ) { window.opener.MWJ_raiseYear(); } else { window.alert( \'Error:\\nCould not communicate with opening window.\' ); }"><font color="#ffffff">>></font></a>':'<input type="button" value=">>" onclick="if( window.opener && window.opener.MWJ_raiseYear ) { window.opener.MWJ_raiseYear(); } else { window.alert( \'Error:\\nCould not communicate with opening window.\' ); }">')+'</td></tr>'+
'<tr><td bgcolor="#323c76">'+(MWJNS4?'<a href="javascript:if( window.opener && window.opener.MWJ_dropMonth ) { window.opener.MWJ_dropMonth(); } else { window.alert( \'Error:\\nCould not communicate with opening window.\' ); }"><font color="#ffffff"><<</font></a>':'<input type="button" value="<<" onclick="if( window.opener && window.opener.MWJ_dropMonth ) { window.opener.MWJ_dropMonth(); } else { window.alert( \'Error:\\nCould not communicate with opening window.\' ); }">')+'</td><td bgcolor="#323c76" align="center"><b>'+monthList[curDate.getMonth()]+'</b> <font size="-2">[<a href="javascript:if( window.opener && window.opener.resetDate ) { window.opener.resetDate(); window.opener.doReDraw(); } else { window.alert( \'Error:\\nCould not communicate with opening window.\' ); }"><font color="#bbbbff">Go to now</font></a>]</font></td><td bgcolor="#323c76" align="right">'+(MWJNS4?'<a href="javascript:if( window.opener && window.opener.MWJ_raiseMonth ) { window.opener.MWJ_raiseMonth(); } else { window.alert( \'Error:\\nCould not communicate with opening window.\' ); }"><font color="#ffffff">>></font></a>':'<input type="button" value=">>" onclick="if( window.opener && window.opener.MWJ_raiseMonth ) { window.opener.MWJ_raiseMonth(); } else { window.alert( \'Error:\\nCould not communicate with opening window.\' ); }">')+'</td></tr>'+
'</table></td></tr>'+
'<tr><th bgcolor="#6ab49f">Sun</th><th bgcolor="#6ab49f">Mon</th><th bgcolor="#6ab49f">Tue</th><th bgcolor="#6ab49f">Wed</th><th bgcolor="#6ab49f">Thu</th><th bgcolor="#6ab49f">Fri</th><th bgcolor="#6ab49f">Sat</th></tr>'
;
for( var x = 1; x <= [31,((!( curDate.getTheYear() % 4 ) && ( ( curDate.getTheYear() % 100 ) || !( curDate.getTheYear() % 400 ) ))?29:28),31,30,31,30,31,31,30,31,30,31][curDate.getMonth()]; x++ ) {
curDate.setDate(x);
if( x == 1 && curDate.getDay() ) { theContent += '<tr><td colspan="'+curDate.getDay()+'"></td>'; }
theContent += ( ( !curDate.getDay() ) ? '<tr>' : '' ) + '<td align="center" bgcolor="#'+((curDate.getMonth()==(new Date()).getMonth()&&curDate.getYear()==(new Date()).getYear()&&x==(new Date()).getDate())?'ffbbdd':((!curDate.getDay()||curDate.getDay()==6)?'ffffbb':'ffffff'))+'"><a class="MWJCAL" href="javascript:if( window.opener && window.opener.datePickerReturn ) { void(window.opener.setTimeout(\'datePickerReturn('+x+','+(curDate.getMonth()+1)+','+curDate.getTheYear()+');\',1)); window.close(); } else { window.alert( \'Error:\\nCould not communicate with opening window.\' ); }">'+x+'</a></td>';
} curDate.setDate(1);
theContent += '</table></form></body></html>';
var oDoc = window.open( ( opOrEscape ? '' : 'about:blank' ), 'MWJ_TOFR', 'width=259,height=277'+(sY?(',top='+sY):'')+(sX?(',left='+sX):'')+',resizable=1,location=0,menubar=0,scrollbars=0,status=0,toolbar=0' );
oDoc.document.open(); oDoc.document.write(theContent); oDoc.document.close(); window.MWJwinStore = oDoc;
if( oDoc.focus ) { oDoc.focus(); } if( ( sX || sY ) && oDoc.moveTo ) { oDoc.moveTo(sX,sY); }
}
if( !window.onunload ) { window.onunload = function () { if( window.MWJwinStore && !window.MWJwinStore.closed ) { window.MWJwinStore.close(); } }; }