/*   現在の西暦を返す   */
function showThisYear () {
	myYear  =  new Date();
	if ( !(browserCheck()) ) { document.write ( myYear.getYear() );      }
	else                     { document.write ( myYear.getYear()+1900 ); }
}
/*   西暦年ゲット   */
function getNowYear4(){
	myYear  =  new Date();
	if ( !(browserCheck()) ) { return ( myYear.getYear() );      }
	else                     { return ( myYear.getYear()+1900 ); }
}

/*   ブラウザのチェック IE ならば false , NN ならば true を返す   */
function browserCheck(){
	navi  =  navigator.appName;
	if ( navi.indexOf('Microsoft')<0 ) { return true;  }
	else                               { return false; }
}

/*   画像を変える   */
function changeImage ( iname , imgpath , iname2 , imgpath2 , iname3 , imgpath3 ) {
	Img1      =  new Image ();
	Img1.src  =  imgpath;
	document[iname].src  =  eval ( 'Img1.src' );
	if ( iname2 != undefined && imgpath2 != undefined ) {
		Img2      =  new Image ();
		Img2.src  =  imgpath2;
		document[iname2].src  =  eval ( 'Img2.src' );
	}
	if ( iname3 != undefined && imgpath3 != undefined ) {
		Img3      =  new Image ();
		Img3.src  =  imgpath3;
		document[iname3].src  =  eval ( 'Img3.src' );
	}
}

/*   クッキーの取得   */
function getCookie( key, tmp1, tmp2, xx1, xx2, xx3 ) {
    tmp1 = " " + document.cookie + ";";
    xx1  = xx2 = 0;
    len  = tmp1.length;
    while ( xx1 < len ) {
        xx2  = tmp1.indexOf(";", xx1);
        tmp2 = tmp1.substring(xx1 + 1, xx2);
        xx3  = tmp2.indexOf("=");
        if ( tmp2.substring(0, xx3) == key ) {
            return ( unescape( tmp2.substring( xx3 + 1, xx2 - xx1 - 1 ) ) );
        }
        xx1  = xx2 + 1;
    }
    return("");
}
/* SetCookie */
function setCookie ( keySrc , valSrc ) {
	document.cookie  =  keySrc + "=" + escape( valSrc ) + "; path=/;";
//	location.reload();
//	top.right.location.reload();
}
/*   クッキーのクリア   */
function clearCookie( key ) {
    document.cookie = key + "=" +"; expires=1-Jan-1997 00:00:00;";
}


/* OpenNewWindow */
function openNewWindow( urlSrc , tarSrc , wSrc , hSrc ){
	if ( !wSrc ) { wSrc = 640; }
	if ( !hSrc ) { hSrc = 480; }
	window.open( urlSrc , tarSrc , 'width='+wSrc+',height='+hSrc+',scrollbars=yes,resizable=yes' );
}

/*   漢字変換フォームのアクション   */
function searchSubmit () {
	if ( clearDefault( 'Enter the name.' ) == true ) {
		document.Search.submit();
	}
}
function clearDefault ( defSrc ) {
	if ( document.Search.query.value == defSrc ) {
		document.Search.query.value  = '';
	}
	if ( document.Search.query.value == '' ) {
		alert ( 'Please input the name.' );
		return ( false );
	}
	if ( document.Search.query.value.search(/[\@\:\;\-\\\&\$\"\'\=\.]/i) != -1 ) {
		alert ( 'You input wrong charactors; @-=$&\"\'.' );
		return ( false );
	}
	return ( true );
}
/*   ヘッダタイトルの書き換え   */
function chageHeaderTitle ( titleSrc ) {
	top.HEADER.document.fH.hT.value  = titleSrc;
}

/*   国プルダウンの生成   */
function makeCountrySelect () {
	countryArr  =  new Array (
			'|Please select',
			'1|Algeria',
			'2|Argentina',
			'3|Australia',
			'4|Austria',
			'5|Azerbaijan',
			'6|Bahrain',
			'7|Bangladesh',
			'8|Bardaos',
			'9|Belarus',
			'10|Belgium',
			'11|Bhutan',
			'12|Botswana',
			'13|Brazil',
			'14|Britain',
			'15|Brunei',
			'16|Bulgaria',
			'17|Cambodia',
			'18|Canada',
			'19|Catarrh',
			'20|Chile',
			'21|China',
			'22|Colombia',
			'23|Costa Rica',
			'24|Croatia',
			'25|Cuba',
			'26|Cyprus',
			'27|Czechoslovakia',
			'28|Denmark',
			'29|Djibouti',
			'30|Ecuador',
			'31|Egypt',
			'32|El Salvador',
			'33|Estonia',
			'34|Ethiopia',
			'35|Fiji ',
			'36|Finland',
			'37|France',
			'38|Gabon',
			'39|Germany',
			'40|Ghana',
			'41|Greece',
			'42|Guam',
			'43|Honduras',
			'44|Hong Kong',
			'45|Hungary',
			'46|India',
			'47|Indonesia',
			'48|Iran',
			'49|Iraq',
			'50|Ireland',
			'51|Israel',
			'52|Italy',
			'53|Jamaica',
			'999|Japan',
			'54|Jordan',
			'55|Kenya',
			'56|Kuwait',
			'57|Laos',
			'58|Latvia',
			'59|Lithuania',
			'60|Luxembourg',
			'61|Macao',
			'62|Madagascar',
			'63|Malaysia',
			'64|Maldives',
			'65|Malta',
			'66|Mauritius',
			'67|Mexico',
			'68|Mongolian',
			'69|Morocco',
			'70|Nepal',
			'71|Netherlands',
			'72|New Caledonia',
			'73|New Zealand',
			'74|Nigeria',
			'75|Norway',
			'76|Oman',
			'77|Pakistan',
			'78|Panama',
			'79|Papua New Guinea',
			'80|Paraguay',
			'81|Peru',
			'82|Philippines',
			'83|Poland',
			'84|Portugal',
			'85|Republic Of Ivory Coast',
			'86|Rumania',
			'87|Russia',
			'88|Rwanda',
			'89|Saipan',
			'90|Saudi Arabia',
			'91|Senegal',
			'92|Sierra Leone',
			'93|Singapore',
			'94|Slovakia',
			'95|Slovenia',
			'96|Solomon',
			'97|South Africa',
			'98|South Korea',
			'99|Spain',
			'100|Sri Lanka',
			'101|Sudan',
			'102|Sweden',
			'103|Switzerland',
			'104|Syria',
			'105|Taiwan',
			'106|Tanzania',
			'107|Thailand',
			'108|Togo',
			'109|Trinidad Tobago',
			'110|Tunisia',
			'111|Turkey',
			'112|U.S.',
			'113|Uganda',
			'114|Ukraine',
			'115|United Arab Emirates',
			'116|Uruguay',
			'117|Venezuela',
			'118|Vietnam',
			'119|Zimbabwe'
	);
	var i;
	var lineArr;
	for ( i = 0 ; i < countryArr.length ; i++ ) {
		lineArr  =  countryArr[i].split('|');
		if ( lineArr[0] == '' ) {
			document.write ( '<option value="">'+lineArr[1] );
		} else {
			document.write ( '<option value="'+lineArr[0]+'">'+lineArr[1] );
		}
	}
}

/*   na-wa   */
function searchSubmit () {
	if ( clearDefault( 'Enter the name.' ) == true ) {
		document.Search.submit();
	}
}
function clearDefault ( defSrc ) {
	if ( document.Search.query.value == defSrc ) {
		document.Search.query.value  = '';
	}
	if ( document.Search.query.value == '' ) {
		alert ( 'Please input the name.' );
		return ( false );
	}
	if ( document.Search.query.value.search(/[\@\:\;\-\\\&\$\"\'\=\.]/i) != -1 ) {
		alert ( 'You input wrong charactors; @-=$&\"\'.' );
		return ( false );
	}
	return ( true );
}
function searchSubmitJ () {
	if ( clearDefaultJ( 'Enter the name.' ) == true ) {
		document.Search.submit();
	}
}
function clearDefaultJ ( defSrc ) {
	if ( document.Search.query.value == defSrc ) {
		document.Search.query.value  = '';
	}
	if ( document.Search.query.value == '' ) {
		alert ( '名前を入力してください。' );
		return ( false );
	}
	if ( document.Search.query.value.search(/[\@\:\;\-\\\&\$\"\'\=\.]/i) != -1 ) {
		alert ( '不正な文字列が入力されています。[@-=$&\"\'.]' );
		return ( false );
	}
	return ( true );
}
/*   コラボレータを開く   */
function showCollaborators ( urlSrc , ancSrc , wSrc , hSrc ) {
	ancArr  =  ancSrc.split (',');
	idSrc   =  Math.random();
	var i;
	for ( i = 0 ; i < ancArr.length ; i++ ) {
		document.write ( '<iframe src="' + urlSrc + '?' + idSrc + '#' + ancArr[i] + '" width="' + wSrc +'" ' );
		document.write ( 'height="' + hSrc + '" frameborder="0" border="0" scrolling="NO">' );
		document.write ( 'Your browser cannot see IFRAME.</iframe><br>' );
	}
}
