/******************************
* グローバルメニュー画像読み込み処理【サイバーショット用】
*******************************/
if(document.images) {
	//画像保存フォルダ名
	dImgPath = "/www/cyber-shot/images/common/";
	productName = "cyber-shot/";
	currentPage = 1000;		// dummy No.
	
	var aImg = new Array();
	
	//****** ATTENTION!! ***********************************
	//メニュー項目一覧(aMenuList)とページ識別情報(aPathList)は
	//データが連動してますのでメニュー追加時は、両方に追加してください！
	//また、並び順をあわせてください！
	//******************************************************

	//メニュー項目一覧
	var aMenuList = new Array(
		"sidemenu_sm1",				/*  1. 重要なお知らせ		*/
		"sidemenu_sm2",				/*  2. 製品別サポート		*/
		"sidemenu_sm3",				/*  3. Ｑ＆Ａ				*/
		"sidemenu_sm4",				/*  4. ダウンロード			*/
		"sidemenu_sm5",				/*  5. ＯＳ対応情報			*/
		"sidemenu_sm6",				/*  6. パソコンとつなぐ		*/
		"sidemenu_sm7",				/*  7. キーワード検索			*/
		"sidemenu_sm8",				/*  7. ソフトウェア			*/
		//"sidemenu_sm9",				/*  9. ソフトウェアサポート		*/
		"sidemenu_sm11",			/* 11. 取説ダウンロード 	*/
		"sidemenu_sm12"	,			/* 12. バッテリーについて	*/	
		"sidemenu_vista",
		"sidemenu_disc",			/*  7. ブルーレイ/DVDを作る	*/
		"sidemenu_repair1",
		"sidemenu_repair2",
		"sidemenu_app1",
		"sidemenu_app2",
		"sidemenu_app3",
		"sidemenu_app4",
		"sidemenu_app5",
		"sidemenu_app6",
		"lm_bt_top",
		"lm_bt_info",
		"lm_bt_qa",
		"lm_bt_download",
		"lm_bt_osinfo",
		//"lm_bt_soft",
		//"lm_bt_pccon",
		"lm_bt_attsoft",
		"lm_bt_pcimport",
		"lm_bt_camera",
		"lm_bt_tvcon",
		"lm_bt_tvwatch",
		"lm_bt_ms",
		"lm_bt_customer"				/*  USBカスタマー登録		*/
	);
	

/**********
	//画像読込み
	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(
		"information/",
		"products/",
		"qasearch/",
		"download/",
		"osinfo/",
		"pcconnect/",
		"disearch.cgi",
		"software/",
		//"disoft/",
		"sidemenu_sm11",
		"battery/",
		"sidemenu_vista",
		"disc/",
		"repair_service/",
		"inquiry/",
		"sidemenu_app1",
		"benri/",
		"sidemenu_app3",
		"sidemenu_app4",
		"memorystick/",
		"sidemenu_app6",
		"index.html",
		"infomation.html",
		"qa.html",
		"download.html",
		"osinfo.html",
		"software.html",
		"pcconnect.html",
		"cameraconnect.html"
	);
}

/******************************
* カレントページの画像を反転させる処理（<BODY onLoad="initImage()">で使用）
*******************************/
function initImage() {

	// ページのURLを取得
    strURL = document.URL;
//	strURL = "http://lprweb2.cv.sony.co.jp/www/cyber-shot/products/dsc-p7/osinfo.html"	// for DEBUG
//	alert(strURL.substr(strURL.lastIndexOf(productName) + productName.length));		// for DEBUG
	// productName以下のパスを切り出す処理
	lastName = strURL.substr(strURL.lastIndexOf(productName) + productName.length);

	// ローカルページとの混同防止
	if( lastName == "index.html" ) {		// トップページ（/www/cyber-shot/index.html）
	//	alert("トップページかもね？");		// for DEBUG
		currentPage = 1000;					// インデックスNo.をクリア(Dummy)
		return;
	}

	ignoreFlag = 0;
	// 製品別ローカルページでなければ…
	if( lastName.indexOf("products/dsc-") == -1 && lastName.indexOf("products/mvc-") == -1 &&
		lastName.indexOf("products/phd-") == -1 && lastName.indexOf("products/dskit-") == -1 &&
		lastName.indexOf("products/gps-") == -1 && lastName.indexOf("products/benri") == -1 &&
		lastName.indexOf("products/dpf-") == -1 &&
		lastName != "index.html" && lastName.indexOf("disearch.cgi") == -1 ) {
//		lastName != "index.html" && lastName != "disearch.cgi" ) {
		// 最初の"/"から後半をトリミングする
		lastName = lastName.substr(0, lastName.indexOf("/") + 1);
		ignoreFlag = 1;					// ローカルメニューを無視
	}
	else {	// ローカルページの場合は最後のファイル名を取り出す
//		if( lastName.indexOf("products/benri") == -1 ) {
		if( lastName.indexOf("products/benri") == -1 && lastName.indexOf("disearch.cgi") == -1 ) {
			lastName = lastName.substr(lastName.lastIndexOf("/") + 1);
		}
	}

	//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(/\?.*/, "");
	}

//	alert(lastName);					// for DEBUG

	imgNum = 1000;
	// 製品別トップページ（ローカルページ）は「TOP」ボタンを反転させておく
	if( lastName == "index.html" ) {		// 製品別トップページ
		currentPage = 2;					// 「製品別サポート」のインデックスNo.を設定
		//lastName = "products/";				// 名前も偽称
		lastName = "index.html";				// 名前も偽称
	}

	//2006.05.18 add by Fujihara
	if( lastName == "battery/" || lastName.substring(-1, 8) == "battery/" ) {				// バッテリー
		currentPage = 23;					// 「Q&A」のインデックスNo.を設定
		lastName = "battery/";				// 名前も偽称
	}

	//2006.01.25 add by Fujihara
	//パソコンとつなぐ
	if ( lastName.substring(-1, 10) == "pcconnect_" ){
		currentPage = 22;					// ローカル「パソコンとつなぐ」のインデックスNo.を設定
		lastName = "pcconnect.html";		// 名前も偽称
	}

	// Q&A検索結果ページ対策（暫定）
//alert(lastName.substring(-1, 3));
	if( lastName == "qa/" || lastName.substring(-1, 3) == "qa/" ) {				// Q&Aページ
		currentPage = 3;					// 「Q&A」のインデックスNo.を設定
		lastName = "qasearch/";				// 名前も偽称
	}
	// Q&Aインデックスページ対策（暫定）
	if( lastName.indexOf("qa_") != -1 ) {	// Q&Aインデックスページ
		currentPage = 16;					// ローカル「Q&A」のインデックスNo.を設定
		lastName = "qa.html";				// 名前も偽称
	}
	// キーワード検索ページ対策（暫定）
	if( lastName.indexOf("disearch.cgi") != -1 ) {	// キーワード検索ページ
		currentPage = 6;					// キーワード検索のインデックスNo.を設定
		lastName = "disearch.cgi";			// 名前も偽称
	}
	// 簡単ガイドページ対策（暫定）
	if( lastName.indexOf("products/benri") != -1 ) {	// 簡単ガイドインデックスページ
		currentPage = 10;					// 「簡単ガイド」のインデックスNo.を設定
		lastName = "benri/";				// 名前も偽称
	}
	// Q&A末端ページ対策（暫定）
	if( lastName == "solution/" || lastName.substring(-1, 9) == "solution/" ) {		// Q&A末端ページ
		currentPage = 3;					// 「Q&A」のインデックスNo.を設定
		lastName = "qasearch/";				// 名前も偽称
	}
	// パス(ファイル名)の比較＆インデックスNo.の取り出し
	for(n = 0; n < aPathList.length; n++) {
		if(aPathList[n] == lastName) {
//			alert("(" + n + ") " + aPathList[n]);		// for DEBUG
			imgNum = n;
			break;
		}
	}

	currentPage = imgNum;				// インデックスNo.をカレントページとする

//	alert(currentPage);					// for DEBUG
//	alert(imgNum);						// for DEBUG

//	sleep(1);
	// カレントページのメニューボタンを反転する
	if(currentPage != 1000) {
		if ( document.getElementById(aMenuList[imgNum]) ) {
			//document.images[aMenuList[imgNum]].src = aImg[imgNum][1].src;
			document.getElementById(aMenuList[imgNum]).style.backgroundColor = "#C8C8F1";
		}
	}
}

/******************************
* Sleep
*******************************/
//function sleep(num) {
//	window.setTimeout("sleep()", 1000);
//}

/******************************
* 画像ファイル差し替え
*******************************/
function chgimg(dName, dNum) {
	
	if(document.images) {
		for(i = 0 ; i < aMenuList.length; i++){
			if(aMenuList[i] == dName){
				dImgNum = i;
				break;
			}
		}
		
		// カレントページと同じ番号の場合は画像入れ替えをしない
		if(dImgNum == currentPage) {
			return;								// 関数を抜ける
		}
		// 画像入れ替え
		document.images[dName].src = aImg[dImgNum][dNum].src;
	}
}

/******************************
* ポップアップウィンドウを開く
*******************************/
function NewWinOpen(dUrl,dName,dWidth,dHeight,dEtc){
	dStatus = "width=" + dWidth + ",height=" + dHeight + ",resizable=yes";
	
	if(dEtc != ""){
		dStatus += "," + dEtc;
	}
	
	newwin = window.open(dUrl, "_blank", dStatus);
//	newwin = window.open(dUrl, dName, dStatus);
	newwin.focus();
	return false;
	
}

/******************************
* ご意見の確認ダイアログ
*******************************/

function msg(){
if(window.confirm('いただいたご意見・ご要望に対して当社より回答することはできませんので、あらかじめご了承ください。')) {
  window.location.href = "/cgi-bin/cyber-shot/feedback/index.cgi";
//return true;
} else return false;
}