﻿/*--displayChange-----------------------------------*/
function displayChange01(n,m){
	var news_num = m;
	for(i=0;i<news_num;i++){
		if(i==n){
			document.getElementById("news"+i).style.display = "block";
		}else{
			document.getElementById("news"+i).style.display = "none";
		}
	}
}


/*--open window-----------------------------------*/
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


/*--mail verify check-----------------------------------*/
function checkmail(){
	if(document.form1.メールアドレス.value!=document.form1.メールアドレス確認用.value){
		alert("メールアドレスが同一ではありません");
	return false;
	}else{return true;}
}


/*	showDate	*/
var yobi = new Array( "Sun", "Mon", "Tues", "Wed", "Thur", "Fri", "Sat" );

function showDate(){
	if( !document.getElementById ) return;
	var obj = document.getElementById( "showDate" );
	var now = new Date();				<!--  変数nowに現在時刻を取出す  -->
	var y = now.getFullYear();
	var m = now.getMonth() + 1;	if( m < 10 ) m = "0" + m;	<!--  月は0～11なので1を足す  -->
	var d = now.getDate();	if( d < 10 ) d = "0" + d;
	var yo = yobi[ now.getDay() ];			<!--  getDayが返す0～6の値に配列yobiを対応させる  -->
	var h = now.getHours();	if( h < 10 ) h = "0" + h;
	var n = now.getMinutes();	if( n < 10 ) n = "0" + n;
	var s = now.getSeconds();	if( s < 10 ) s = "0" + s;
	var timestr = y + "年" + m + "月" + d + "日"　+ " " + h + ":" + n;
	/*var timestr = y + "/" + m + "/" + d + "(" + yo + ")" + h + ":" + n + ":" + s;*/
	obj.value = timestr;
	setTimeout( "showDate();", 1000 );
}


/*--BBS verify check-----------------------------------*/
function checkBbs(){
	var bbsTitle = document.form1.title.value;
	if(bbsTitle){
		return true;
	}else{
		alert("タイトルを入力してください。");
		return false;
	}
}


/*--The number of the letters restrictions / テキストエリアの文字数制限（リンクを追加する）--*/

function limitChars(target,maxlength) {
	var count = maxlength - target.value.length;
	var objError = document.getElementById( "error" );

	if ( target.value.length > maxlength ) {
		objError.innerHTML = "制限は<span>100</span>文字です。これ以上入力できません。";
		target.value = target.value.substr(0,maxlength);
	}　else {
		objError.innerHTML = "残り" + count + "文字";
	}
    target.focus();
}

