document.open();
document.write('
');
document.close();
document.STWAPI.dep.options.length = deptlist.length + 1;
for ( i = 0; i < deptlist.length; i++ ){
document.STWAPI.dep.options[i+1] = new Option ( deptlist[i].name, deptlist[i].value );
}
document.STWAPI.themes.options.length = themelist.length + 1;
for ( i = 0; i < themelist.length; i++ ){
document.STWAPI.themes.options[i+1] = new Option ( themelist[i].name, themelist[i].value );
}
function go_search(){
var params = '';
var doc = document.STWAPI;
if ( doc.dyear.value && doc.dmonth.value){
params = 'dyear='+doc.dyear.value;
params = params+'&dmonth='+doc.dmonth.value;
if ( doc.dday.value && doc.dday.value){
params = params+'&dday='+doc.dday.value;
}
}
if ( doc.dep.value ){
if ( params != ''){ params = params+'&';}
params = params+'&dep='+doc.dep.value;
}
if ( doc.themes.value ){
if ( params != ''){ params = params+'&';}
var tidx = doc.themes.selectedIndex - 1;
var themetype = themelist[tidx].type;
params = params+themetype+'='+doc.themes.value;
}
if ( doc.p.value ){
if ( params != ''){ params = params+'&';}
params = params+'&p='+doc.p.value;
}
if ( params ){
location.href = 'https://www.canadiancmc.com/?'+params;
}else{
location.href = 'https://www.canadiancmc.com/';
}
}
var dd = new Date("Nov,26 2024");
var ed = new Date("Sep,21 2025");
var yy = dd.getYear();
if ( yy < 2000 ){
yy = yy + 1900;
}
var mm = dd.getMonth() + 1;
var dd = dd.getDate();
var eyy = ed.getYear();
if ( eyy < 2000 ){
eyy = eyy + 1900;
}
var emm = ed.getMonth() + 1;
var edd = ed.getDate();
onload = function(){
var ys = eyy - yy;
for ( iy = 0; iy < ys + 1; iy++ ){
document.STWAPI.dyear.options[iy] = new Option(yy+iy,yy+iy);
}
var cm = 0;
for ( im = 0; im < 12; im++ ){
if ( (im+1) >= mm ){
document.STWAPI.dmonth.options[cm+1] = new Option(strpad(im+1),strpad(im+1));
cm++;
}
}
}
function chg_year(){
document.STWAPI.dmonth.options[0].selected = true;
var sy = document.STWAPI.dyear.value;
var cm = 0;
var select = document.STWAPI.dmonth;
var options = select.options;
for ( var i = options.length -1; 0 < i; --i ){
select.removeChild(options[i]);
}
for ( im = 0; im < 12; im++ ){
if ( sy == yy ){
if ( (im+1) >= mm ){
document.STWAPI.dmonth.options[cm+1] = new Option(strpad(im+1),strpad(im+1));
cm++;
}
}else{
if ( (im+1) <= emm ){
document.STWAPI.dmonth.options[cm+1] = new Option(strpad(im+1),strpad(im+1));
cm++;
}
}
}
chg_day();
}
function chg_day(){
document.STWAPI.dday.options[0].selected = true;
var sm = document.STWAPI.dmonth.value;
var sy = document.STWAPI.dyear.value;
var cd = 0;
var select = document.STWAPI.dday;
var options = select.options;
for ( var i = options.length -1; 0 < i; --i ){
select.removeChild(options[i]);
}
var lm = 0;
if ( yy == sy && mm == sm ){
lm = 1;
}
if ( eyy == sy && emm == sm ){
lm = 2;
}
var ltd = 0;
if ( sm ){
ltd = ed_day(sy,sm);
}
for ( im = 0; im < ltd; im++ ){
if ( lm == 1 && (im+1) >= dd ){
document.STWAPI.dday.options[cd+1] = new Option(strpad(im+1),strpad(im+1));
cd++;
}else if ( lm == 2 && (im+1) <= edd ){
document.STWAPI.dday.options[cd+1] = new Option(strpad(im+1),strpad(im+1));
cd++;
}
if ( !lm ){
document.STWAPI.dday.options[cd+1] = new Option(strpad(im+1),strpad(im+1));
cd++;
}
}
}
function ed_day(y,m){
var bis = y %4;
var ans = 0;
if ( bis == 0 && m == 2 ){
ans = 29;
}else{
if ( m == 2 ){
ans = 28;
}else if ( m == 4 || m == 6 || m == 9 || m == 11 ){
ans = 30;
}else{
ans = 31;
}
}
return ans;
}
function strpad(val){
return (!isNaN(val) && val.toString().length==1)?"0"+val:val;
}