ECCART.common.util.Date = {

    setDate : function (selectName, ymd) {
        var selectOption = document.getElementsByName(selectName)[0];
        selectName = ECCART.common.util.String.ucfirst(selectName);

        if(selectOption){
            var beforeValue = selectOption.value;
            selectOption.value = ymd;

            if($F(selectOption) != ymd){
                alert("ご指定の日付は、指定することができません。\n別な日付を指定してください。");
                selectOption.value = beforeValue;
            }
        } else {
            var yearOption = document.getElementsByName("yearOf" + selectName)[0];
            var monthOption = document.getElementsByName("monthOf" + selectName)[0];
            var dateOption = document.getElementsByName("dateOf" + selectName)[0];

            var array = ymd.split("-");
            var year = array[0];
            var month = array[1];
            var date = array[2];

            if(yearOption)
            yearOption.value = year;
            if(monthOption)
            monthOption.value = month;
            if(dateOption)
            dateOption.value = date;
        }
    },

    checkToday : function (p_prefix) {
        var prefix = typeof p_prefix == 'undefined' ? '' : p_prefix;
        var today = new Date();
        var year = today.getYear();
        var month = today.getMonth() + 1;
        var date = today.getDate();
        if (year < 2000) { year += 1900; }
        if (month < 10) { month = "0" + month; }
        if (date < 10) { date = "0" + date; }
        var id = prefix + year + "-" + month + "-" + date;
        Element.addClassName(id, 'xc_calendarToday calendarHighlight');
    }

}
