﻿/// <reference path="jquery-1.11.1.js" />


/*生成日历插件*/
$(document).ready(function () {
    JqCal("2014-8-19", true, "#chart");
    JqCalAuto(true, "#chart2");
    JqCalAuto(false, "#chart3");
});
function JqCal(date, isCN, divId) {
    ///<summary>绘制给定日期的样式图</summary>
    ///<para="date">字符串日期,形如:2014-08-09,切记要补全0</para>
    ///<para="isCN">是否显示中文星期</para>
    ///<para="divId">日期控件显示位置div</para>
    $(divId).html("<div class='divcal' id='divcal'><div class='divCalYearMonth' id='divCalYearMonthId'></div><div class='divCalDay' id='divCalDay'></div><div class='divCalClear' id='divCalClear'>--------</div><div class='divCalWeek' id='divCalWeek'></div></div>");
    var weekindex = new Date(date).getDay();
    date = date.split("-");
    $(divId).children().find(".divCalYearMonth").html(date[0] + "-" + date[1]);
    $(divId).children().find(".divCalDay").html(date[2]);
    var weekname= new Array('Sunday',"Monday","Tuesday",'Wednesday','Thursday','Friday','Saturday');
    if (isCN) {
        weekname = new Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六");
    }
    $(divId).children().find(".divCalWeek").html(weekname[weekindex]);
    console.log(weekindex);
}

function JqCalAuto(isCN, divId) {
    ///<summary>自动绘制当前时间样式图</summary>
    ///<para="isCN">是否显示中文星期</para>
    ///<para="divId">日期控件显示位置div</para>
    $(divId).html("<div class='divcal' id='divcal'><div class='divCalYearMonth' id='divCalYearMonthId'></div><div class='divCalDay' id='divCalDay'></div><div class='divCalClear' id='divCalClear'>--------</div><div class='divCalWeek' id='divCalWeek'></div></div>");
    var date = new Date();
    $(divId).children().find(".divCalYearMonth").html(date.getFullYear()+ "-" + (parseInt(date.getMonth())+1));
    $(divId).children().find(".divCalDay").html(date.getDate());
    var weekname = new Array('Sunday', "Monday", "Tuesday", 'Wednesday', 'Thursday', 'Friday', 'Saturday');
    if (isCN) {
        weekname = new Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六");
    }
    $(divId).children().find(".divCalWeek").html(weekname[date.getDay()]);    
}
@@ -100,11 +100,11 @@
 2014
--8-
+,8,
 19%22,
@@ -726,17 +726,17 @@
 .split(%22
--
+,
 %22);%0A    
@@ -905,73 +905,44 @@
 'Sun
-day
 ',%22Mon
-day
 %22,%22Tue
-sday
 %22,'Wed
-nesday
 ','Thu
-rsday
 ','Fri
-day
 ','Sat
-urday
 ');%0A
@@ -1792,79 +1792,50 @@
 'Sun
-day
 ', %22Mon
-day
 %22, %22Tue
-sday
 %22, 'Wed
-nesday
 ', 'Thu
-rsday
 ', 'Fri
-day
 ', 'Sat
-urday
 ');%0A

fix date type bug