//======================================================================
//2003/02/25　T.Maruyama
//======================================================================
//コンテンツが存在するフォルダによってアクティブになるメニューを変更する
//
//　↓locationを取得
//　↓locationをsplitで分割
//　↓ルートフォルダ名を基準にfor文でコンテンツ名（＝フォルダ名）を取得
//　↓設定コンテンツ名の配列＋for文でメニューを書き出し
//　↓設定コンテンツ名の配列＋と取得コンテンツ名が一致したらアクティブ状態で出力
//======================================================================

//**********初期設定**********

//ルートフォルダの設定
rootFolder ="njp"

//設定コンテンツの設定
//※増やす場合は必ずフォルダ名と同じ名前を付ける
//※配列の順番＝メニューの順番
var NjpContents = new Array();
	NjpContents[0] = "programinfo";
	NjpContents[1] = "ticket";
	NjpContents[2] = "profile";
	NjpContents[3] = "discography";
	NjpContents[4] = "patronage";
	NjpContents[5] = "office";
	NjpContents[6] = "link";
	NjpContents[7] = "auditioninfo";

//※ALT用
var NjpContentsAlt = new Array();
	NjpContentsAlt[0] = "公演情報";
	NjpContentsAlt[1] = "チケット問合＆申込";
	NjpContentsAlt[2] = "プロフィール";
	NjpContentsAlt[3] = "ディスコグラフィー";
	NjpContentsAlt[4] = "パトロネージュ";
	NjpContentsAlt[5] = "事務局案内";
	NjpContentsAlt[6] = "リンク";
	NjpContentsAlt[7] = "オーディション＆採用情報";

//**********初期設定**********


//locationを取得し分割を行う
URLstr = new String(self.location);
var spCntStr = URLstr.split("/");


//分割数を取得
spNum = spCntStr.length;
spNum = spNum - 1;


//ルートフォルダ名と一致した場合、次の配列がコンテンツフォルダ
i = 0;
ContName = "";

for(i=0; i<spNum; i++){
	if(spCntStr[i] == rootFolder){
		break;
	}
}

ContName = spCntStr[i+1];


//現在のコンテンツ数を取得
var	NjpContentsNum = NjpContents.length;


var autoActiveMenu = '<TABLE border="0" width="108" cellpadding="0" cellspacing="0" background="../img/1dot.gif">';
	autoActiveMenu +='<TR><TD background="../img/1dot.gif"><IMG src="../img/1dot.gif" width="108" height="16"></TD></TR>';

	i = 0;
	for (i=0; i<NjpContentsNum; i++){

		if(ContName != NjpContents[i]){
			autoActiveMenu +='<TR><TD><A href="../' + NjpContents[i] + '/' + NjpContents[i] + '.html" onmouseover="BtnMouseOverLow(\'' + NjpContents[i] + '\')" onmouseout="BtnMouseOutLow(\'' + NjpContents[i] + '\')"><IMG src="../img/b_' + NjpContents[i] + '.gif" width="108" border="0" alt="' + NjpContentsAlt[i] + '" name="' + NjpContents[i] + '"></A></TD></TR>';
			autoActiveMenu +='<TR><TD bgcolor="#1d3955"><IMG src="../img/1dot.gif" width="108" height="1"></TD></TR>';
		}else{
			autoActiveMenu +='<TR><TD><A href="../' + NjpContents[i] + '/' + NjpContents[i] + '.html"><IMG src="../img/b_' + NjpContents[i] + '_a.gif" width="108" border="0" alt="' + NjpContentsAlt[i] + '"></A></TD></TR>';
			autoActiveMenu +='<TR><TD bgcolor="#1d3955"><IMG src="../img/1dot.gif" width="108" height="1"></TD></TR>';
		}
	}

	autoActiveMenu +='<TR><TD><A href="../index02.html" onmouseover="BtnMouseOverLow(\'top\');" onmouseout="BtnMouseOutLow(\'top\');"><IMG src="../img/b_top.gif" width="108" height="17" border="0" alt="トップへ" name="top"></A></TD></TR>';
	autoActiveMenu +='<TR><TD bgcolor="#1d3955"><IMG src="../img/1dot.gif" width="108" height="1"></TD></TR>';
	autoActiveMenu +='<TR><TD><IMG src="../img/1dot.gif" width="108" height="100"></TD></TR>';
	autoActiveMenu +='</TABLE>';





//======================================================================
//2003/02/25　T.Maruyama
//======================================================================
//NEWのイメージを一定期間表示させる
//======================================================================

function SetDay(Set_Year,Set_Month,Set_Date){

	//===============初期設定ここから===============//
	//NEWの表示期限を設定

	var LimitDay = 7;	//日

	//===============初期設定ここまで===============//


	//日付オブジェクト生成
	var TodayObj = new Date();

	//現在までの日数
	var Today_mSec = TodayObj.getTime()
	var Today_Total = Math.round((Today_mSec/1000)/86400);


	//***** セット日の日付オブジェクト生成 *****//
	var SetDayObj = new Date();
	SetDayObj.setYear(Set_Year);
	SetDayObj.setMonth(Set_Month-1);
	SetDayObj.setDate(Set_Date);


	//***** セット日までの日数 *****//
	var SetDay_mSec = SetDayObj.getTime()
	var SetDay_Total = Math.round((SetDay_mSec/1000)/86400);


	//***** セット日からの経過日数 *****//
	var Prog_Day = Today_Total - SetDay_Total;
	
	if(Prog_Day < LimitDay+1){
		document.write('<IMG src="./img/icon_new.gif" width="16" height="5" alt="NEW" vspace="3">');
	}else{
		document.write('<IMG src="./img/1dot.gif" width="16" height="5" vspace="3">');
	}

}




//======================================================================
//イメージスワップ下層用
//======================================================================

//PreLoad
loadImage = new Image();
loadImage.src = "img/b_programinfo_a.gif";
loadImage.src = "img/b_ticket_a.gif";
loadImage.src = "img/b_profile_a.gif";
loadImage.src = "img/b_discography_a.gif";
loadImage.src = "img/b_patronage_a.gif";
loadImage.src = "img/b_office_a.gif";
loadImage.src = "img/b_link_a.gif";
loadImage.src = "img/b_auditioninfo_a.gif";
loadImage.src = "img/b_top_a.gif";


//OnMouseOver
function BtnMouseOverLow(imgName){

	//alert(imgName);

	if (document.images){
		document[imgName].src="../img/b_" + imgName + "_a.gif";
	}


}

function BtnMouseOutLow(imgName){

	//alert(imgName);

	if (document.images){
		document[imgName].src="../img/b_" + imgName + ".gif";
	}


}


//======================================================================
//イメージスワップ
//======================================================================


//OnMouseOver
function BtnMouseOver(imgName){

	//alert(imgName);

	if (document.images){
		document[imgName].src="img/b_" + imgName + "_a.gif";
	}


}

function BtnMouseOut(imgName){

	//alert(imgName);

	if (document.images){
		document[imgName].src="img/b_" + imgName + ".gif";
	}


}

//======================================================================
//イメージスワップMAPアイコン用
//======================================================================

//OnMouseOver
function BtnMouseOverMap(imgName){

	//alert(imgName);

	if (document.images){
		document[imgName].src="img/b_map_a.gif";
	}


}

function BtnMouseOutMap(imgName){

	//alert(imgName);

	if (document.images){
		document[imgName].src="img/b_map.gif";
	}


}

//======================================================================
//イメージスワップアクセスアイコン用
//======================================================================

//OnMouseOver
function BtnMouseOverAcs(imgName){

	//alert(imgName);

	if (document.images){
		document[imgName].src="img/b_acsess_a.gif";
	}


}

function BtnMouseOutAcs(imgName){

	//alert(imgName);

	if (document.images){
		document[imgName].src="img/b_acsess.gif";
	}


}


//======================================================================
//Windowオープン
//======================================================================

function opWin(url,name,width,height){
	newWin = window.open(url,name,"width=" + width + ",height=" + height + ",scrollbars=yes,resizable=yes");
	newWin.focus();
}

//======================================================================
//チケット用：親ウィンドウ変更
//======================================================================

function changeOpWin(){

	if(window.opener.closed){
		window.open("../ticket/ticket.html","newWindow");
		
	}else{
		window.opener.location = "../ticket/ticket.html";
	}
}

//======================================================================
//ページ先頭へ
//======================================================================

var Mac = navigator.appVersion.indexOf('Mac',0) != -1;
var Win = navigator.appVersion.indexOf('Win',0) != -1;
var IE  = navigator.appName.indexOf("Microsoft Internet Explorer",0) != -1;
var NN  = navigator.appName.indexOf("Netscape",0) != -1;
var GE  = navigator.userAgent.indexOf("Gecko") != -1;


// Scroll Move

function movePosition(){

  position = Math.floor(position*0.8);

	if( position > 0.1 ){

		window.scrollTo(0,position)
		setTimeout("gotoPageTop()",50);

	}else{

		window.scrollTo(0,0)

	}
}


function gotoPageTop(){
  if( IE ){
    position = document.body.scrollTop;
  } else {
    position = window.pageYOffset;
  }
  
  movePosition()
}