function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages( path ) {
	if (document.images) {
		if( path ){
			sRefPath = path;
		}else{
			sRefPath = '';
		}
		Roland_logo_over = newImage(sRefPath + "images/top_menu/Roland_logo_over.jpg");
		Roland_logo_down = newImage(sRefPath + "images/top_menu/Roland_logo_down.jpg");
		RolandCom_over = newImage(sRefPath + "images/top_menu/Roland_com_over.jpg");
		RolandCom_down = newImage(sRefPath + "images/top_menu/Roland_com_down.jpg");
		products_over = newImage(sRefPath + "images/top_menu/products_over.jpg");
		products_down = newImage(sRefPath + "images/top_menu/products_down.jpg");
		support_over = newImage(sRefPath + "images/top_menu/support_over.jpg");
		support_down = newImage(sRefPath + "images/top_menu/support_down.jpg");
		about_over = newImage(sRefPath + "images/top_menu/about_over.jpg");
		about_down = newImage(sRefPath + "images/top_menu/about_down.jpg");
		debutEvents_down = newImage(sRefPath + "images/top_menu/debutEvents_down.jpg");
		debutEvents_over = newImage(sRefPath + "images/top_menu/debutEvents_over.jpg");
		finder_over = newImage(sRefPath + "images/top_menu/finder_over.jpg");
		finder_down = newImage(sRefPath + "images/top_menu/finder_down.jpg");
		search_button_over = newImage(sRefPath + "images/top_menu/search_button_over.jpg");
		search_button_down = newImage(sRefPath + "images/top_menu/search_button_down.jpg");
		alphabetical_down = newImage(sRefPath + "images/top_menu/alphabetical_down.jpg");
		alphabetical_over = newImage(sRefPath + "images/top_menu/alphabetical_over.jpg");
		search_over = newImage(sRefPath + "images/top_menu/search_over.jpg");
		ctrl_first_over = newImage(sRefPath + "images/ctrl_first_over.jpg");
		ctrl_first_down = newImage(sRefPath + "images/ctrl_first_down.jpg");
		ctrl_prev_over = newImage(sRefPath + "images/ctrl_prev_over.jpg");
		ctrl_prev_down = newImage(sRefPath + "images/ctrl_prev_down.jpg");
		ctrl_next_over = newImage(sRefPath + "images/ctrl_next_over.jpg");
		ctrl_next_down = newImage(sRefPath + "images/ctrl_next_down.jpg");
		ctrl_last_over = newImage(sRefPath + "images/ctrl_last_over.jpg");
		ctrl_last_down = newImage(sRefPath + "images/ctrl_last_down.jpg");

		preloadFlag = true;
	}
}

function swapimg(nam,pal) {
	if(navigator.appVersion.charAt(0) >= "3") {
		document.images[nam].src = pal;	
		return(true);
	}
}

function enlargeimg(nam) {
	if(navigator.appVersion.charAt(0) >= "3") {
		var fn;
		var targetpath;
		var targetname;
		targetpath = document.images[nam].src;
		targetname = targetpath.match(/image_[0-9][0-9]/)
		fn = targetname + '.html';
		window.open(fn,'subwin','menubar=no,toolbar=no,scrollbars=auto,status=no,width=810,height=600,resizable=yes');
		return false;
	}
}

/**************************************************************************
関数名　：画面遷移
関数ID　：goPage
呼出形式：goPage( pSrchBy, sEvnt, sRange, sRngNm )
処理概要：必要な情報を整形し、action で指定されたページに遷移する
引数　　：in : pSrchBy ( evnt | name ) 検索キーが「イベント」か「製品名」
                                       かを指定
          in : sEvnt   検索キーが evnt の場合、イベントレコード番号を指定
          in : sRange  検索キーが evnt で且つ sEvnt 指定なしの場合、イベン
                       ト開始日の期間を "YYYYMMDD-YYYYMMDD" 形式で指定
          in : sRngNm  sRange 指定の場合、その名称を指定する
                       例）"April to June 2003"
改修履歴：2004/11/19, Y.Kubozono, ブランド検索追加
**************************************************************************/
function goPrd( pSrchBy, sEvnt, sRange, sRngNm ){

	// ■faq.cfm
	if( document.fList ){
		if( document.forms[0].sName.value == '' ){
			alert('Please input at least one letter to search.');
			document.forms[0].sName.focus();
			return false;
		}
		document.forms[0].sName.value = document.forms[0].sName.value.toUpperCase();
		document.forms[0].submit();

	// ■ProductFinder
	// 機能のチェックボックスが定義されている場合
	}else if( document.forms[0].sFunc && document.forms[0].sFunc.length > 0 && document.forms[0].sFunc[0].type == 'checkbox' ){
		if( pSrchBy == "name" ){									// Serch By name検索
			// 名前が入力されていない場合
			if( document.forms[0].sName.value == '' ){
				alert('Please input at least one letter to search.');
				document.forms[0].sName.focus();
				return false;
			}
			document.forms[0].sName.value = document.forms[0].sName.value.toUpperCase();
			document.forms[0].sSrchBy.value='name';
		}else{
			for( i = 0, bCheckBoxChecked = false; i < document.forms[0].elements.length; i ++ ){
				if( document.forms[0].elements[i].type == 'checkbox' && document.forms[0].elements[i].checked == true ){
					bCheckBoxChecked = true;
					break;
				}
			}
			// 一つも選択されていない場合
			// ******************** 2004/11/19 Y.Kubozono Update start ********************
			for (var r = 0; r < document.forms[0].sBrnd.length; r++){
				if(document.forms[0].sBrnd[r].checked == true){
				sBrndCd = document.forms[0].sBrnd[r].value;
				}
			}
			if( bCheckBoxChecked == false && sBrndCd == '99999' ){
					alert('Please select \'Keywords\' or \'Function/Standard Icons\' at least one.');
					document.forms[0].sName.focus();
					return false;
			}
			// ******************** 2004/11/19 Y.Kubozono Update end   ********************
			document.forms[0].sSrchBy.value='func';
		}
		document.forms[0].submit();

	// ■Debut Event, template
	// 第四引数が設定されている場合
	}else if( sRngNm ){

		// 検索キーが イベントでない場合
		if( 'evnt' != pSrchBy ){

		// イベントレコード番号が指定されている場合
		}else if( sEvnt ){
			if( document.forms[0].sEvnt ){
				document.forms[0].sEvnt.value = sEvnt;
			}
			if( document.forms[0].sRange ){
				document.forms[0].sRange.value = '';
			}
			if( document.forms[0].sRngNm ){
				document.forms[0].sRngNm.value = '';
			}

		// イベント期間が設定されている場合
		}else if( sRange ){
			if( document.forms[0].sEvnt ){
				document.forms[0].sEvnt.value = '';
			}
			if( document.forms[0].sRange ){
				document.forms[0].sRange.value = sRange;
			}
			if( document.forms[0].sRngNm ){
				document.forms[0].sRngNm.value = sRngNm;
			}
		}

		// Search by Name の値を大文字に
		if( pSrchBy == 'name' ){
			// 名前が入力されていない場合
			if( document.forms[0].sName.value == '' ){
				alert('Please input at least one letter to search.');
				document.forms[0].sName.focus();
				return false;
			}
			document.forms[0].sName.value = document.forms[0].sName.value.toUpperCase();
		}
		document.forms[0].sSrchBy.value = pSrchBy;
		document.forms[0].submit();

		return false;

	// ■Debut Event, template
	// 第四引数が設定されている場合
	}else if( pSrchBy == 'evnt' ){

		// イベント期間が設定されている場合
		if( sRange && sRange != '' ){
			if( document.forms[0].sEvnt ){
				document.forms[0].sEvnt.value = '';
			}
			if( document.forms[0].sRange ){
				document.forms[0].sRange.value = sRange;
			}
			if( document.forms[0].sRngNm ){
				document.forms[0].sRngNm.value = sRngNm;
			}

		}else if( sRange == '' ){
			// 開始件数が定義されている場合
			if( document.forms[0].NSTRW ){
				// sEvnt を表示開始件数と判定
				if( sEvnt ){
					document.forms[0].NSTRW.value = sEvnt;
				}else{
					document.forms[0].NSTRW.value = 1;
				}
			}

		// イベントレコード番号が指定されている場合
		}else if( sEvnt ){
			if( document.forms[0].sEvnt ){
				document.forms[0].sEvnt.value = sEvnt;
			}
			if( document.forms[0].sRange ){
				document.forms[0].sRange.value = '';
			}
			if( document.forms[0].sRngNm ){
				document.forms[0].sRngNm.value = '';
			}
		}

		document.forms[0].sSrchBy.value = pSrchBy;
		document.forms[0].submit();

		return false;

	// 第三引数が定義されている場合
	}else if( sRange ){
		return false;

	// ■Result listing, Alphabetical index
	// 上記以外の場合
	}else{
		// 開始件数が定義されている場合
		if( document.forms[0].NSTRW ){
			// sEvnt を表示開始件数と判定
			if( sEvnt ){
				document.forms[0].NSTRW.value = sEvnt;
			}else{
				document.forms[0].NSTRW.value = 1;
			}
		}

		document.forms[0].sSrchBy.value = pSrchBy;
		if( !pSrchBy || pSrchBy == 'name' ){
			if( document.forms[0].sName.value == '' ){
				alert('Please input at least one letter to search.');
				document.forms[0].sName.focus();
				return false;
			}
		}
		document.forms[0].sName.value = document.forms[0].sName.value.toUpperCase();
		document.forms[0].submit();
	}
}

