function creatDate(date){
var now=new Date(),newdate="",classs="",nowdate=now.getDate();
if (date!='') {
date=date.replace('-','/')+"/"+now.getDate();
newdate=new Date(date)
}else{
newdate=now;
}
var nowMonthFirstday=newdate.getFullYear()+"/"+(+newdate.getMonth()+1)+"/01 00:00:00";
nowMonthFirstday=new Date(nowMonthFirstday).getDay();
if(nowMonthFirstday==0)nowMonthFirstday=7;
var datehtml="<table class='date_table riqitable' width='100%'>";
datehtml+="<thead><tr><th>一</th><th>二</th><th>三</th><th>四</th><th>五</th><th>六</th>";
datehtml+="<th>日</th></tr></thead><tr>";
for (var j = 1; j < nowMonthFirstday; j++) {
datehtml+="<td></td>";
}
for (var i = 1; i < (getCountDays(newdate)+1); i++) {
if ((i+j-2)%7==0) {
datehtml+="</tr>"
}
classs=(i==nowdate)?"nowday":"";
datehtml+="<td><a class='"+classs+"' href='javascript:;'>"+i+"</a></td>";
}
datehtml+="</tr></table>";
return datehtml;
}
function getCountDays(date) {
var curDate = new Date(date);
var curMonth = curDate.getMonth();
curDate.setMonth(curMonth + 1);
curDate.setDate(0);
return curDate.getDate();
}