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="#dddddd">');
    document.write('<tr bgcolor="#cccccc"><th colspan="7" height="20"><font color="#ffffff" style="font:12/14px; Verdana;">');
    document.write('ピーウィーカレンダー',mNum,'月');
    //年表示あり    document.write(year,'-',date.getMonth()+1,'　<b>peewee</b> CALENDER');
    document.write('</font></th></tr>');
    //曜日の表示
    document.write('<tr bgcolor="#dddddf">');
    for(i=0;i<7;i++){
        document.write('<th width="22"><font color="#556677" style="font:12/14px; Verdana;">',Days[i],'</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="font:12/14px; Verdana;');
        //
        if((a==1)&&(i==today)){
            document.write('font-weight:bold;font-size:13px;');  //今日
        }
        if(a==1){
            if((i==1)||(i==2)||(i==8)||(i==9)||(i==15)||(i==22)||(i==23)||(i==24)||(i==29)){
                document.write('background:#fec2c2;');  //水曜日
            }
           

        }
        if(a==2){
            if((i==7)||(i==14)||(i==21)||(i==28)){
                document.write('background:#fec2c2;');  //水曜日
            }
          

        }
        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>');
}

