<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

/////////////////////////// 必須入力チェック
function input_required(src) {
	return (src != "");
}

/////////////////////////// 電話番号・FAXチェック
function input_tel(src) {
	return (!src.match(/[^0-9\-]/));
}

/////////////////////////// 半角数字のみチェック
function input_halfnum(src) {
	return( src.match(/[0-9]+/g) == src ) ;
//	return src.match(/[0-9]/);
}
/////////////////////////// 数字のみチェック
function input_num(src) {
	return( src.match(/[[0-9０-９]+/g) == src ) ;
//	return src.match(/[0-9０-９]/);
}

/////////////////////////// 半角英数字のみチェック
function input_halfAlphaNum(src) {
	return(  src.match(/[0-9a-zA-Z]+/g) == src ) ;
//	return src.match(/[0-9a-zA-Z]/);
}

/////////////////////////// 半角文字のみチェック
function input_han(src) {
	return (getByteCount(src) == src.length);
}

/////////////////////////// 英字のみチェック
function input_alpha(src) {
	return src.match(/[a-zA-Zａ-ｚＡ-Ｚ]/);
}

/////////////////////////// 文字のバイト数取得
function getByteCount(src) {
	var count = 0;
	for (i = 0; i < src.length; i++) {
		//全角文字
		if (escape(src.charAt(i)).length >= 4){
			count += 2;
		//半角文字
		}else{
			count++;
		}
	}
	return count;
}

/////////////////////////// 曜日取得
function getWeek( date ){

	if( arguments.length > 0 ){
		date = date ;
	}else{
		 date = null ;
	}
	var now  = new Date( date ) ;
	var week = new Array('日','月','火','水','木','金','土') ;

	return week[now.getDay()] ;

}

/////////////////////////// 和暦⇒西暦変換
function change_year( data_wa, year, month, day ){
	year_sei = year ;
	if( data_wa == 1 ){
		year_sei = year_sei + 1867 ;
		in_date = new Date( year_sei, month, day ) ;
		check_date = new Date( 1868, 9, 7 ) ;
		if( check_date >= in_date ){
				return false ;
		}
		check_date = new Date( 1912, 7, 29 ) ;
		if( check_date < in_date ){
				return false ;
		}
	}else if( data_wa == 2 ){
		year_sei = year_sei + 1911 ;
		in_date = new Date( year_sei, month, day ) ;
		check_date = new Date( 1912, 7, 29 ) ;
		if( check_date >= in_date ){
				return false ;
		}
		check_date = new Date( 1926, 12, 24 ) ;
		if( check_date < in_date ){
				return false ;
		}
	}else if( data_wa == 3 ){
		year_sei = year_sei + 1925 ;
		in_date = new Date( year_sei, month, day ) ;
		check_date = new Date( 1926, 12, 24 ) ;
		if( check_date >= in_date ){
				return false ;
		}
		check_date = new Date( 1989, 1, 7 ) ;
		if( check_date < in_date ){
				return false ;
		}
	}else if( data_wa == 4 ){
		year_sei = year_sei + 1988 ;
		in_date = new Date( year_sei, month, day ) ;
		check_date = new Date( 1989, 1, 7 ) ;
		if( check_date >= in_date ){
			return false ;
		}
	}else{
		return false ;
	}

	return year_sei ;
}

/////////////////////////// 月のチェック
function input_month(src) {
	return ((src >= 1 && src <= 12) || (src >= "１" && src <= "１２"));
}

/////////////////////////// 日付チェック
function date_check( data_wa, year, month, day ){
	year_sei = year ;
	if( data_wa == 1 ){
		if( change_year( data_wa, year, month, day ) ){
			year_sei = year_sei + 1867 ;
		}else{
			return false ;
		}
	}else if( data_wa == 2 ){
		if( change_year( data_wa, year, month, day ) ){
			year_sei = year_sei + 1911 ;
		}else{
			return false ;
		}
	}else if( data_wa == 3){
		if( change_year( data_wa, year, month, day ) ){
			year_sei = year_sei + 1925 ;
		}else{
			return false ;
		}
	}else if( data_wa == 4){
		if( change_year( data_wa, year, month, day ) ){
			year_sei = year_sei + 1988 ;
		}else{
			return false ;
		}
	}else{
		return false ;
	}
	if( month==1 || month==3 || month==5 || month==7 || month==8 || month==10 || month==12 ){
		if( !( day >= 1 && day <= 31 ) ){
			return false ;
		}
	}else if( month==4 || month==6 || month==9 || month==11 ){
		if( !( day >= 1 && day <= 30 ) ){
			return false ;
		}
	}else if( month == 2 ){
		if( year_sei % 4 == 0 ) {
			if( year_sei % 100 == 0 ) {
				if( year_sei % 400 == 0 ){
					// うるう年
					if( !( day >= 1 && day <= 29 ) ){
						return false ;
					}
				} else {
					// 非うるう年
					if( !(day >= 1 && day <= 28 ) ){
						return false ;
					}
				}
			}else{
				// うるう年
				if( !( day >= 1 && day <= 29 ) ){
					return false ;
				}
			}
		}else{
			// 非うるう年
			if( !(day >= 1 && day <= 28 ) ){
				return false ;
			}
		}
	}else{
		return false ;
	}
	return true ;
}

/////////////////////////// 年齢計算
function get_age( birthyear, birthmonth, birthday ){
	var age=0 ;
	now = new Date() ;
	y = now.getYear() ;
	m = now.getMonth() + 1 ;
	d = now.getDate() ;

	if( birthyear > y ){
		return false ;
	}
	if( y < 1900 ){
		y = y + 1900 ;
	}
	if( m < birthmonth ){
		age = y - birthyear - 1 ;
	}
	if( m > birthmonth ){
		age = y - birthyear ;
	}
	if( m == birthmonth ){
		if( d < birthday ){
			age = y - birthyear - 1 ;
		}else{
			age = y - birthyear ;
		}
	}
	return age ;
}

/////////////////////////// メールアドレスチェック
function input_mail(src){
	return src.match( /^[\w\._-]+@[\w\.-]+\.\w{2,}$/);
}

/////////////////////////// 半角英数字記号チェック 
function single_byte_check( Char ){
	var S = escape( Char ) ;
	if( S == Char ){
		return true ;
	}else if( S.length == 3 ){
		code = S.charAt( 1 ) + S.charAt( 2 ) ;
		nm = parseInt( code, 16 ) ;
		if( nm > 0 && nm < 127 ){
			return true ;
		}
	}
}

/////////////////////////// 指定文字数（全角）で改行させる
function trim_ret( ret_byte, txt ){
	j = 0 ;
	str = '' ;
	for( i = 0 ; i < txt.length ; i++ ){
		S = txt.charAt( eval( i ) ) ;
		if( single_byte_check( S ) == true ){
			j ++;
			if( escape( S ) == "%0D" ){
				j = j - ( j % ret_byte ) ;
				str += S ;
			}else{
				if( j % ret_byte == 0 ){
					str += S + unescape( "%0D%0A" ) ;
				}else{
					str += S ;
				}
			}
		}else{
			j += 2 ;
			if( j % ret_byte == 0 ){
				str += S + unescape( "%0D%0A" ) ;
			}else if( (j-1) % ret_byte == 0){
				str += S + unescape( "%0D%0A" ) ;
			}else{
				str += S ;
			}
		}
	}
	return str ;
}
//-->

