$(function(){
	/* Japanese initialisation for the jQuery UI date picker plugin. */
	/* Written by Kentaro SATO (kentaro@ranvis.com). */
	$.datepicker.regional['ja'] = {
		closeText: '閉じる',
		prevText: '&#x3c;前',
		nextText: '次&#x3e;',
		currentText: '今日',
		monthNames: ['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月'],
		monthNamesShort: ['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月'],
		dayNames: ['日曜日','月曜日','火曜日','水曜日','木曜日','金曜日','土曜日'],
		dayNamesShort: ['日','月','火','水','木','金','土'],
		dayNamesMin: ['日','月','火','水','木','金','土'],
		weekHeader: '週',
		dateFormat: 'yy/mm/dd' ,
		firstDay: 0,
		isRTL: false,
		changeMonth: true,
		changeYear: true,
		showMonthAfterYear: true,
		yearSuffix: '',
		yearRange: '-70:+5'};
	$.datepicker.setDefaults($.datepicker.regional['ja']);
	
	$.datepicker.setDefaults({
		beforeShow: function () {setTimeout(setWeekendColor, 100);},
		onChangeMonthYear: function () {setTimeout(setWeekendColor, 100);}
	});
	
	
	//表示色変更関数。
	function setWeekendColor() {
		//土日の色変更
		var tr = $("table.ui-datepicker-calendar > tbody > tr");
		for (var i = 0; i < tr.length; i++) {
			if (tr[i].firstChild.firstChild.style)
				tr[i].firstChild.firstChild.style.color = "red";    //sunday
			if (tr[i].lastChild.firstChild.style)
				tr[i].lastChild.firstChild.style.color = "blue";    //saturday
		}

		//曜日登録情報色変更関数。
//		setDayOfWeekColor();
	}	
});
