// ERROR CHECK +++++++++++++++++++++++++++++++++++++++++++//
function ErrorCheck1(){ 
	var str = "";
	var queryValue = document.searchform1.query.value;
	if ((queryValue == "") || (queryValue.search(/[^ 　]/g) == -1)){
		str = "検索ワードを入力してください\n";
	}
	if(str != ""){
		alert (str);
	return false;
	}
}


// ERROR CHECK2 ++++++++++++++++++++++++++++++++++++++++++//
function ErrorCheck2(){ 
	var str = "";
	var queryValue = document.searchform2.query.value;
	if ((queryValue == "") || (queryValue.search(/[^ 　]/g) == -1)){
		str = "検索ワードを入力してください\n";
	}
	if(str != ""){
		alert (str);
	return false;
	}
}


// map window open +++++++++++++++++++++++++++++++++++++++//
function MapWin(theURL) {
	MapWindow=window.open(theURL,"nomurakougeimap","width=350,height=480,toolbar=0,location=0,status=0,menubar=1,scrollbars=1,resizable=1");
	MapWindow.focus();
}

// map window open +++++++++++++++++++++++++++++++++++++++//
function estMapWin(theURL) {
	MapWindow=window.open(theURL,"nomurakougeimap","width=350,height=490,toolbar=0,location=0,status=0,menubar=1,scrollbars=1,resizable=1");
	MapWindow.focus();
}

function est_lMapWin(theURL) {
	MapWindow=window.open(theURL,"nomurakougeimap","width=500,height=640,toolbar=0,location=0,status=0,menubar=1,scrollbars=1,resizable=1");
	MapWindow.focus();
}

function park_MapWin(theURL) {
	MapWindow=window.open(theURL,"nomurakougeimap","width=645,height=640,toolbar=0,location=0,status=0,menubar=1,scrollbars=1,resizable=1");
	MapWindow.focus();
}

// mail window open +++++++++++++++++++++++++++++++++++++++//
function MailWin(theURL) {
	MailWindow=window.open(theURL,"mailform","width=650,height=490,toolbar=1,location=0,status=0,menubar=1,scrollbars=1,resizable=1");
	MailWindow.focus();
}

function florWin() {
	window.open("flow_list.html","","WIDTH=583,HEIGHT=424");
}

function contactWin(theURL) {
	contactWindow=window.open(theURL,"contactform","width=610,height=550,toolbar=1,location=0,status=0,menubar=1,scrollbars=1,resizable=1");
	contactWindow.focus();
}


// REPORT ++++++++++++++++++++++++++++++++++++++++++++++++//
function report() {
	document.write("<img src='/cgi-bin/access/report.cgi?");
	document.write("dir=default","&amp;");
	document.write("pix=",screen.width,"x",screen.height,"&amp;");
	document.write("ref=",document.referrer);
	document.write("' width='1' height='1' alt=''>");
}
function outputswf(path,bgcolor,w,h,vars){
	if(vars == undefined){ vers = ""; }
	var tagStr = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+w+'" height="'+h+'" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0">';
	tagStr += '<param name="allowScriptAccess" value="sameDomain">';
	tagStr += '<param name="movie" value="'+path+'">';
	tagStr += '<param name="quality" value="high">';
	tagStr += '<param name="bgcolor" value="'+bgcolor+'">';
	tagStr += '<param name="flashvars" value="'+vars+'">';
	tagStr += '<embed src="'+path+'" name="fContent" flashvars="'+vars+'" bgcolor="'+bgcolor+'" width="'+w+'" height="'+h+'" quality="high" align="middle" play="true" quality="high" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">';
	tagStr += '<\/embed>';
	tagStr += '<\/object>';
	document.write(tagStr);
}


// achievements ++++++++++++++++++++++++++++++++++++++++++++++++//
document.writeln("<style>#year {display: none;}</style>");

function setStyle(){
	var STYLE = "<style>${id} {display: none;}</style>";
	var hash = location.hash;
	if(hash){
		var year = setSelected(hash);
	}
	
	var id = document.getElementById("year");
	var a = id.getElementsByTagName("a");
	var len = a.length;
	
	var names = new Array();
	
	for(var i=0; i<len; i++){
		var cls = a[i].parentNode.className;
		
		if(cls !='selected'){
			var hash = a[i].hash;
			names.push(hash);
		}
		
		var href = a[i].href;
		href = href.replace("#archive-", "#");
		a[i].href = href;
	}
	
	STYLE = STYLE.replace("${id}", names.join(","));
	document.writeln(STYLE);
	id.style.display = "block";
}

function setSelected(h){
	var hash = h;
	hash = hash.slice(hash.indexOf("#")+1);
	
	var id = document.getElementById("year");
	var a = id.getElementsByTagName("a");
	var len = a.length;
	
	for(var i=0; i<len; i++){
		var year = a[i].hash;
		
		if(year.indexOf("-")>-1){
			year = year.slice(year.indexOf("-")+1);
		}else {
			year = year.slice(year.indexOf("#")+1);
		}
		
		if(year == hash){
			a[i].parentNode.className = 'selected';
		}else {
			var cls = a[i].parentNode.className;
			a[i].parentNode.className = cls.replace('selected', '');
		}
	}
}

function switchYear(){
	var id = document.getElementById("year");
	var a = id.getElementsByTagName("a");
	var len = a.length;
	
	for(var i=0; i<len; i++){
		var year = a[i];
		
		year.onclick = function(){
			var name = this.hash;
			name = name.slice(name.indexOf("#")+1);
			displayArchive(name);
			setSelected(name);
		}
	}
}

function displayArchive(name){	
	var id = document.getElementById("year");
	var a = id.getElementsByTagName("a");
	var len = a.length;
	
	for(var i=0; i<len; i++){
		var year = a[i].hash;
		year = year.slice(year.indexOf("#")+1);
		
		var archive = document.getElementById("archive-" + year);
		
		if(archive){
			if(year == name){
				archive.style.display = "block";
			}else {
				archive.style.display = "none";
			}
		}
	}
}
