<!--
/////////////////////////////////////////////////////////////////////////////
// 越前ウインドアンサンブル ウェブサイト
// 
// ファイル:tools.js
// 説　　明:ツール集 (JavaScript)
/////////////////////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// 基本設定


/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// 最終更新日用変数宣言＆定義

ArrayDays	= new Array();
ArrayDays[0] = "Sun";
ArrayDays[1] = "Mon";
ArrayDays[2] = "Tue";
ArrayDays[3] = "Wed";
ArrayDays[4] = "Thu";
ArrayDays[5] = "Fri";
ArrayDays[6] = "Sat";


/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// ページタブ用カラー設定

colInvisible = "#AAAAAA";
colVisible	 = "#002277";


/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// ツール関数群

////////////////////////////////////////////////////////////
// func : onChangePage
//		: ページ切り替え
// args : pagename
// ret	: -
function onChangePage( pagename )
{
	action = cgi_base + "disp/display.cgi?" + pagename;
	document.page.action = action;
	document.page.id.value	   = pagename;
	document.page.access.value = "valid";
	document.page.submit();
}

////////////////////////////////////////////////////////////
// func : writeCPF
//		: ページ切り替え用フォーム
// args : 
// ret	: -
function writeCPF()
{
	html =	"<form name=\"page\" action=\"\" method=\"POST\">\n";
	html += "<input type=\"hidden\" name=\"id\" value=\"\">\n";
	html += "<input type=\"hidden\" name=\"access\" value=\"\">\n";
	html += "</form>\n";
	document.write(html);
}

////////////////////////////////////////////////////////////
// func : writeACC
//		: アクセスログ解析
// args : 
// ret	: -
function writeACC()
{
	acc = "";
	acc += "<img src='" + cgi_base + "acc/acclog.cgi?";
	acc += "referrer="+document.referrer+"&";
	acc += "width="+screen.width+"&";
	acc += "height="+screen.height+"&";
	acc += "color="+screen.colorDepth+"'>";
	document.write(acc);
}

////////////////////////////////////////////////////////////
// func : writePageTab
//		: ページタブ
//		: pagetab_XXXX.js でタブ定義を行う (XXXX はページ名)
// args : page
// ret	: -
function writePageTab(page)
{
	html =	"<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";
	html += "<tr bgcolor=\"#FFFFFF\">\n";
	for (i = 0; i < tabContent.length; i++) {
		image = (page == tabLink[i]) ? "on" : "off";
		html += "<td width=\"5\" height=\"25\" background=\"image/tableft_" + image + ".gif\"><img src=\"image/spacer.gif\" width=\"5\" height=\"25\"></td>\n";
		html += "<td width=\"" + tabWidth + "\" height=\"25\" background=\"image/tabtop_" + image + ".gif\" align=\"center\" valign=\"middle\">\n";
		if (tabLink[i] == "") {
			html += "<font color=\"" + colInvisible + "\">" + tabContent[i] + "</font><br>\n";
		} else {
			color = (tabVisible[i] == false) ? colInvisible : colVisible;
			html += "<a href=\"JavaScript:onChangePage('" + tabLink[i] + "')\"><font color=\"" + color + "\">" + tabContent[i] + "</font></a><br>\n";
		}
		html += "</td>\n";
		html += "<td width=\"5\" height=\"25\" background=\"image/tabright_" + image + ".gif\"><img src=\"image/spacer.gif\" width=\"5\" height=\"25\"></td>\n";
	}
	html += "</tr>\n";
	html += "</table>\n";
	document.write(html);
}

/////////////////////////////////////////////////////////////////////////////
// 最終更新日表示関数
function LastModified()
{
	document.write(MakeModified());
}

/////////////////////////////////////////////////////////////////////////////
// 最終更新日表示文字列作成関数
function MakeModified()
{
	var 	str;
	
	lmdate = new Date(document.lastModified);
	
	str = "<font size=\"3\" color=\"#FFFFFF\">";
	str += lmdate.getYear()+1900;
	str += ", ";
	str += lmdate.getMonth()+1;
	str += ", ";
	str += lmdate.getDate();
	str += " mod.";
	str += "　</font>";
	
	return str;
}

/////////////////////////////////////////////////////////////////////////////
// コピーライト表示
function Copyright(nWidth)
{
	var 	szHTML;
	
	szHTML = "";
	
	szHTML += "<script language=\"JavaScript\">DrawLine(" + nWidth + ", 1, \"left\" );</script>";
	szHTML += "<img src=\"image/spacer.gif\" width=\"1\" height=\"5\"><br>";
	szHTML += "<font size=\"3\" color=\"#AAAAAA\">";
	szHTML += "<b>Produced by Echizen Wind Ensemble,</b><br>";
	szHTML += "<b>Administration and Public Relations Department.</b><br>";
	szHTML += "<img src=\"image/spacer.gif\" width=\"1\" height=\"5\"><br>";
	szHTML += "e-mail : <a href=\"mailto:webmaster@ewe.club.ne.jp\"><font color=\"#AAAAAA\">webmaster@ewe.club.ne.jp</font></a><br>";
	szHTML += "<img src=\"image/spacer.gif\" width=\"1\" height=\"5\"><br>";
	szHTML += "<div align=\"right\"><b>Copyright 1998-2008, Echizen Wind Ensemble, All Rights Reserved.</b></div>";
	szHTML += "</font>";
	
	document.write(szHTML);
}

/////////////////////////////////////////////////////////////////////////////
// 地図表示
function MapWindow( nMap )
{
	if ( nMap == 0 ){
		mapwind = window.open("mapshimin.html","MAP","width=500,height=450,resizable=no");
	}
}

/////////////////////////////////////////////////////////////////////////////
// ライン
function DrawLine( nWidth, nHeight, szPos, szCol )
{
	var 	szHtml;

	var 	szWidth;
	if ( nWidth==NaN || nWidth<=0 ) szWidth = "100%";
	else							szWidth = nWidth.toString();
	var 	szHeight;
	if ( nHeight==NaN || nHeight<=0 )	szHeight = "100%";
	else								szHeight = nHeight.toString();
	var 	szLineCol;
	if ( szCol=="" || szCol==null || szCol==NaN )	szLineCol = "#AAAAAA";
	else											szLineCol = szCol;
	

	szHtml = "";
	szHtml += "<div align=\"" + szPos + "\">";
	szHtml += "<table border=\"0\" width=\"" + szWidth + "\" height=\"" + szHeight + "\" cellpadding=\"0\" cellspacing=\"0\" background=\"\">";
	szHtml += "<tr>";
	szHtml += "<td bgcolor=\"" + szLineCol + "\" width=\"" + szWidth + "\" height=\"" + szHeight + "\"><img src=\"image/spacer.gif\" width=\"" + szWidth + "\" height=\"" + szHeight + "\"><br></td>";
	szHtml += "</tr>";
	szHtml += "</table>";
	szHtml += "</div>";
	
	document.write( szHtml );
}

/////////////////////////////////////////////////////////////////////////////
// スクエア
function DrawSquareHead( szTarget, nWidth )
{
	var 	szHtml;
	szHtml = "";
	
	szHtml += "<td width=\"10\" ><img src=\"image/line_" + szTarget + "left.gif\"><br></td>";
	szHtml += "<td width=\""+ nWidth + "\"><img src=\"image/line_" + szTarget + ".gif\" width=\"" + nWidth + "\" height=\"10\"><br></td>";
	szHtml += "<td width=\"10\" ><img src=\"image/line_" + szTarget + "right.gif\"><br></td>";
	
	document.write( szHtml );
}
function DrawSquareSide( szTarget, nHeight )
{
	var 	szHtml;
	szHtml = "";
	
	szHtml += "<td width=\"10\" height=\"" + nHeight + "\"><img src=\"image/line_" + szTarget + ".gif\" width=\"10\" height=\"" + nHeight + "\"><br></td>";
	
	document.write( szHtml );
}


/////////////////////////////////////////////////////////////////////////////
// コンテントヘッダ
function DrawContentHeader( nWidth, szCaption )
{
	var 	szHtml;
	szHtml = "";
	
	szHtml += "<table border=\"0\" width=\"" + nWidth + "\" height=\"20\" cellspacing=\"0\" cellpadding=\"0\">";
	szHtml += "    <tr hright=\"20\">";
	szHtml += "        <td background=\"image/contentheaderbar_left.jpg\" width=\"10\" height=\"20\"><img src=\"image/spacer.gif\" width=\"1\" height=\"1\"><br></td>";
	szHtml += "        <td background=\"image/contentheaderbar_body.jpg\" width=\"" + (nWidth - 20) + "\" height=\"20\" valign=\"middle\"><font color=\"#444444\"><b>" + szCaption + "</b></font><br></td>";
	szHtml += "        <td background=\"image/contentheaderbar_right.jpg\" width=\"10\" height=\"20\"><img src=\"image/spacer.gif\" width=\"1\" height=\"1\"><br></td>";
	szHtml += "    </tr>";
	szHtml += "</table>";
	
	document.write( szHtml );
}

/////////////////////////////////////////////////////////////////////////////
// 更新履歴作成
function makeUpdateHistory()
{
	var		szHtml;
	szHtml = "";
	
	for (i = 0; i < update_history.length; i++) {
		szHtml += "<tr bgcolor=\"#F0FCF0\">\n";
		szHtml += "<td width=\"100\" align=\"center\"><font size=\"-1\" color=\"#666677\">\n";
		if (update_history[i].flag == true) {
			szHtml += "<img src=\"image/mark2.gif\" width=\"12\" height=\"12\" align=\"top\">";
		}
		else {
			szHtml += "<img src=\"image/mark1.gif\" width=\"12\" height=\"12\" align=\"top\">";
		}
		szHtml += update_history[i].date + "\n";
		szHtml += "</font></td>\n";
		szHtml += "<td width=\"480\"><font size=\"-1\" color=\"#666677\">\n";
		szHtml += "　" + update_history[i].content + "\n";
		szHtml += "</font></td>\n";
		szHtml += "</tr>\n";
	}
	
	document.write(szHtml);
}


/////////////////////////////////////////////////////////////////////////////
// Object 配列作成
function makeObjectArray(size)
{
	ref = new Array();
	for (i = 0; i < size; i++ ) {
		ref[i] = new Object();
	}
	return ref;
}


/////////////////////////////////////////////////////////////////////////////
// スケジュールオブジェクト作成
function makeSchedule(mode, newChange, content)
{
	ref = new Object();
	ref.mode		= mode;
	ref.newChange 	= newChange;
	ref.content 	= content;
	return ref;
}


/////////////////////////////////////////////////////////////////////////////
// 更新履歴オブジェクト作成
function makeUpdateObject(date, flag, link, content)
{
	ref = new Object();
	ref.date		= date;
	ref.flag 		= flag;
	ref.link 		= link;
	ref.content 	= content;
	return ref;
}

// -->
