//*****************************************************************************
function createLink(path) {
	if(path == "") {
		path = "./" ;
	}
	filename = createDateNum(1) + ".html" ;
	document.write("<a href=\"" + path + filename + "\">") ;
}

//*****************************************************************************
function lastUpdate() {
	document.write(getUpdatedDay(createDateNum(1))) ;
}

//*****************************************************************************
function showThisWeek() {
	document.write("今週は") ;
	lastUpdate() ;
	document.write("〜" + getUpdatedDay(createDateNum(2))) ;
	document.write("です。") ;
}

//*****************************************************************************
function showUpdate(date, text, url) {
	now = createDateNum(0) ;
	if(!text) {
		text = "『WONDER-WHEEL』『SAKURAS CHAT』『時間うさぎの日記』" ;
	}
	if(!url) {
		url  = "./wonder_island/index.html" ;
	}
	if(now >= date) {
		u_day = getUpdatedDay(date) ;
		document.write("<a href=\"" + url + "\">" + text + "</a>") ;
		document.write("更新しました。" + u_day + "<br>") ;
	}
}
//*****************************************************************************
function getUpdatedDay(date) {
	mon = date.slice(4,6) ;
	if(mon.charAt(0) == "0") {
		mon = mon.slice(1) ;
	}
	day = date.slice(6,8) ;
	if(day.charAt(0) == "0") {
		day = day.slice(1) ;
	}
	return(mon + "/" + day) ;
}

//*****************************************************************************
function createDateNum(param) {
	now_date = new Date() ;
	youbi    = now_date.getDay() ;
	switch(param) {
		case 1 :
			now_date.setTime(now_date.getTime() - (youbi       * 24 * 3600 * 1000)) ;
			break ;
		case 2 :
			now_date.setTime(now_date.getTime() + ((6 - youbi) * 24 * 3600 * 1000)) ;
			break ;
	}
	yy = now_date.getYear() ;
	mm = now_date.getMonth() + 1 ;
	dd = now_date.getDate() ;
	if(yy < 2000) { yy += 1900 ; }
	res_t = new Number(yy * 10000 + mm * 100 + dd) ;
	res   = res_t.toString(10) ;
	return(res) ;
}
