/******************************
* グローバルメニュー画像読み込み処理【PMB用】
*******************************/
if(document.images) {
	//画像保存フォルダ名
	dImgPath = "/www/disoft/int/pmb/images/common/";
	productName = "/www/disoft/int/pmb/";
	currentPage = 1000;		    // dummy No.
	currentPage_lm = 1000;		// dummy No.
	
	var aImg = new Array();
	//var aLmImg = new Array();

	//****** ATTENTION!! ***********************************
	//メニュー項目一覧(aMenuList)とページ識別情報(aPathList)は
	//データが連動してますのでメニュー追加時は、両方に追加してください！
	//また、並び順をあわせてください！
	//******************************************************
	
	//メニュー項目一覧
	var aMenuList = new Array(
		"bt_top",    //GM:TOP
		"bt_check",    //GM:確認方法
		"bt_ver",   //GM:バージョン別機能一覧
		"bt_top", //GM:できること
		"bt_trouble", //GM:トラブルシューティング
		"bt_inquiry", //GM:お問い合わせ
		"bt_guide", //GM:できること
		"bt_sd_info",         //LM:最新情報
		"bt_sd_introduction", //LM:機能紹介
		"bt_sd_osinfo",       //LM:動作環境
		"bt_sd_download",     //LM:ダウンロード
		"bt_sd_qa",           //LM:FAQ
		"bt_sd_onlineguide"  //LM:オンラインガイド
	);
	
	//画像読込み
	for(i = 0 ; i < aMenuList.length; i++){
		dNum = i
		aArray = aImg;

		aArray[dNum] = new Array();
		aArray[dNum][0] = new Image();
		aArray[dNum][0].src = dImgPath + aMenuList[i] + ".gif";
		aArray[dNum][1] = new Image();
		aArray[dNum][1].src = dImgPath + aMenuList[i] + "_on.gif";
	}

	//メニューに対応したページ識別情報(パス)を設定
	var aPathList = new Array(
		"index.html",
		"check/",
		"ver/",
		"index.html",
		"trouble/",
		"inquiry/",
		"feature/",
		"index.html",
		"introduction.html",
		"osinfo.html",
		"download.html",
		"qa.html",
		"guide.html"
	);
	
}

/******************************
* カレントページの画像（グローバルメニュー、ローカルメニュー）を反転させる処理【PMB用】
*（<BODY onLoad="initImage()">で使用）
*******************************/
function initImage() {

  localFlag = 0;  //ローカルメニューのありなし
  lastName = "";
  lastName_lm = "";

	// ページのURLを取得
  strURL = document.URL;
//	strURL = "http://lprweb2.cv.sony.co.jp/www/disoft/int/pmb/products/2100/index.html"	// for DEBUG
//	alert(strURL.substr(strURL.lastIndexOf(productName) + productName.length));		// for DEBUG
	// productName以下のパスを切り出す処理
	lastName = strURL.substr(strURL.lastIndexOf(productName) + productName.length);

//alert("lastName:" + lastName);					// for DEBUG

/****************
	// トップページの場合 ⇒ 反転の必要なし
	if( lastName == "index.html" ) {		// トップページ（/www/disoft/int/pmb/index.html）
		alert("トップページかもね？");		// for DEBUG
		currentPage = 1000;					// インデックスNo.をクリア(Dummy)
		return;
	}
****************/

	//2006.07.10 add by Fujihara
	//ソフトウェアページのアンカー対応 "#"以降は削除
	if (lastName.indexOf("#")){
		lastName = lastName.replace(/#.*/, "");
	}

	//2007.01.31 add by Fujihara
	//RSSのクエリー対応 "?"以降は削除
	if (lastName.indexOf("?")){
		lastName = lastName.replace(/\?.*/, "");
	}

  //ローカルページメニュー用
  //バージョン別ローカルページか
  if (lastName.match(/products\/\d+/i)){

    //alert("ローカルページ");

    localFlag = 1;
		// ローカルページの場合は最後のファイル名を取り出す
		lastName_lm = lastName.substr(lastName.lastIndexOf("/") + 1);


  	//2008.01.16 add by Fujihara
  	//機能紹介
  	if ( lastName_lm.substring(-1, 13) == "introduction_" ){
  		lastName_lm = "introduction.html";		// 名前も偽称
  	}

  }

	// トップページ以外の場合
	if( lastName != "index.html" ) {		// トップページ（/www/disoft/int/pmb/index.html）

	  //グローバルメニュー用
		// 最初の"/"から後半をトリミングする
		lastName = lastName.substr(0, lastName.indexOf("/") + 1);

	}

	//alert("lastName:" + lastName + ", lastName_lm:" + lastName_lm);					// for DEBUG

	imgNum = 1000;
	imgNum_lm = 1000;

	// パス(ファイル名)の比較＆インデックスNo.の取り出し
	for(n = 0; n < aPathList.length; n++) {

    // グローバルメニュー用
		if(aPathList[n] == lastName) {
//			alert("(" + n + ") " + aPathList[n]);		// for DEBUG
      // インデックスNo.をカレントページとする
			imgNum = n;
      if (localFlag == 0){
			  break;
      }
		}

    // ローカルメニュー用
		if((localFlag == 1) && (aPathList[n] == lastName_lm)) {
//	alert("imgNum:" + imgNum + ", imgNum_lm:" + imgNum_lm);					// for DEBUG
      // インデックスNo.をカレントページとする
			imgNum_lm = n;
			break;
		}

	}
//  alert("localFlag:" + localFlag);
//	alert("imgNum:" + imgNum + ", imgNum_lm:" + imgNum_lm);					// for DEBUG


	currentPage = imgNum;				      // インデックスNo.をカレントページとする
	currentPage_lm = imgNum_lm;				// インデックスNo.をカレントページとする

//	alert(currentPage);					// for DEBUG
//	alert(imgNum);						// for DEBUG
//	sleep(1);

	// グローバルメニューのボタンを反転する
	if(currentPage != 1000) {
		if ( document.images[aMenuList[currentPage]] ) {
			document.images[aMenuList[currentPage]].src = aImg[currentPage][1].src;
		}
	}

	// ローカルメニューのボタンを反転する
	if((localFlag == 1) && (currentPage_lm != 1000)) {
		if ( document.images[aMenuList[currentPage_lm]] ) {
			document.images[aMenuList[currentPage_lm]].src = aImg[currentPage_lm][1].src;
		}
	}




}

/******************************
* 画像ファイル差し替え【PMB用】
*******************************/
function chgimg(dName, dNum) {

	if(document.images) {
		for(i = 0 ; i < aMenuList.length; i++){
			if(aMenuList[i] == dName){
				dImgNum = i;
				break;
			}
		}
		
		// カレントページと同じ番号の場合は画像入れ替えをしない
		if((dImgNum == currentPage) || (dImgNum == currentPage_lm)){
			return;								// 関数を抜ける
		}
		// 画像入れ替え
		document.images[dName].src = aImg[dImgNum][dNum].src;
	}

}

/******************************
* 別ウィンドウ表示
*******************************/
function NewWinOpen(dUrl,dName,dWidth,dHeight,dEtc){
	dStatus = "width=" + dWidth + ",height=" + dHeight;
	
	if(dEtc != ""){
		dStatus += "," + dEtc;
	}
	
	newwin = window.open(dUrl, "_blank", dStatus);
//	newwin = window.open(dUrl, dName, dStatus);
	newwin.focus();
	return false;
	
}



