
//ショールームトップ カレンダー表示切替用---------------------------

function calendar_next(){
	document.getElementById('cal_prev').style.display = 'none';
	document.getElementById('cal_next').style.display = 'block';
}

function calendar_prev(){
	document.getElementById('cal_next').style.display = 'none';
	document.getElementById('cal_prev').style.display = 'block';
}

//USTREAMアイコン切り替え（配信開始時刻、配信終了時刻）-------------

function ust_online(evStartStr,evEndStr){
	nowDate		= new Date();
	nowYear		= new String(nowDate.getFullYear());
	nowMonth	= new String(nowDate.getMonth() + 1);
	nowDates	= new String(nowDate.getDate());
	nowHour		= new String(nowDate.getHours());
	nowMinute	= new String(nowDate.getMinutes());

	nowMonth	= setStrLength(nowMonth,2,'0');
	nowDates	= setStrLength(nowDates,2,'0');
	nowHour		= setStrLength(nowHour,2,'0');
	nowMinute	= setStrLength(nowMinute,2,'0');
	nowDateStr	= nowYear + nowMonth + nowDates + nowHour + nowMinute;

	nowDateInt	= eval(nowDateStr);
	evStartInt	= eval(evStartStr);
	evEndInt	= eval(evEndStr);

	if(nowDateInt >= evEndInt){
		return(['offline'],['after'])
		}

	if(nowDateInt >= evStartInt){
		document.write('<img src="/showroom/image/icon_ustream_online.gif" alt="USTREAM配信中" />');
		return(['onilne'],['now'])
	} else {
		document.write('<img src="/showroom/image/icon_ustream_offline.gif" alt="USTREAM配信予定" />');
		return(['offline'],['before']);
	}
	
}

//文字列長整形（処理対象文字列、処理後文字長、不足分埋め文字）----------

function setStrLength(targetStr,targetLength,targetChar){
	var i;
	tgStrLength = targetStr.length;
	if(tgStrLength >= targetLength){return(targetStr)}	//処理不要または長いときはそのまま返す

	targetLength = targetLength - tgStrLength;
	for(i=0;i<targetLength;i++){
		targetStr = targetChar + targetStr;		//指定された文字長さになるまで指定の文字を付ける
	}
	return(targetStr);
}
