function calendar(a) {
    var date = new Date();
    var Monthdays = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
    var Days = new Array("Sun","Mon","Tue","Wed","Thr","Fri","Sat");
    var MonthName = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
    year = date.getYear();
    today = date.getDate();
    //
    if(year<2000){
        year = year+1900;
    }
    if((year%4==0)&&(year%100!=0)||(year%400==0)){
        Monthdays[1] = 29;
    }
    //今月
    if(a == 1){
        thisMonthDays = Monthdays[date.getMonth()];
        Month = MonthName[date.getMonth()];
        mNum = date.getMonth()+1;
    }
    if(a == 2){
        thisMonthDays = Monthdays[date.getMonth()+1];
        Month = MonthName[date.getMonth()+1];
        mNum = date.getMonth()+2;
    }
    //
    if(a == 2){
        date.setMonth(date.getMonth()+1);
        date.setDate(1);
        startday = date.getDay();
    }
    else{
        date.setDate(1);
        startday = date.getDay();
    }
    //年・月日の表示
    document.write('<table border="0" cellspacing="1" cellpadding="0" bgcolor="#bbbbc8" style="border-right:1px solid #ababb3;border-bottom:1px solid #ababb3;">');
    document.write('<tr bgcolor="#bbbbc8"><th colspan="7" height="20"><font color="#ffffff">');
    document.write('<span style="font:bold 14/16px Verdana;letter-spacing:1px;">',Month,'</span>','<b>&nbsp;',year,'-',mNum,'</b>');
    //年表示あり    document.write(year,'-',date.getMonth()+1,'　<b>Rainbow</b> CALENDER');
    document.write('</font></th></tr>');
    //曜日の表示
    document.write('<tr bgcolor="#dddddf">');
    for(i=0;i<7;i++){
        document.write('<th width="19" style="letter-spacing:-0.1em;"><font color="#556677"><small>',Days[i],'</small></font></th>');
    }
    //日にちの表示
    document.write('<tr bgcolor="#ffffff">');
    //空欄
    col = 0;
    for(i=0;i<startday;i++){
        document.write('<td>　</td>');
        col++;
    }
    //
    for(i=1;i<=thisMonthDays;i++){
        document.write('<th style="');
        //
        if((a==1)&&(i==today)){
            document.write('font-weight:bold;font-size:13px;');  //今日
        }
        if(a==1){
            if((col==2)||(i==20)){
                document.write('background:#ffaee5;');  //定休日
            }
        }
        if(a==2){
            if((i==6)||(i==12)||(i==13)||(i==27)){
                document.write('background:#ffaee5;');  //定休日
            }
        }
        if(a==1){
            if((col==0)||(i==11)){
                document.write('color:#ee0000;');  //日曜日・祝祭日
            }
        }
        if(a==2){
            if((col==0)||(i==20)){
                document.write('color:#ee0000;');  //日曜日・祝祭日
            }
        }
        if(col==6){
            document.write('color:#0000ee;');  //土曜日
        }
        else{
            document.write('');  //平日
        }
        document.write('">');
        document.write(i);
        document.write('</th>');
        col++;
        if((col==7) && (i<thisMonthDays)){
            document.write('</tr>\n<tr bgcolor="#ffffff">');
            col=0;
        }
    }
    while(col!=7){
        document.write('<td>　</td>');
        col++;
    }
    document.write('</tr></table>');
}

