/* ------------------------------------------------------------
 * 共通 JavaScript 関数
 *
 * 関数一覧：
 * - openNewWindow : 指定されたURLを新規ウィンドウを開く
 * - showAlert : エラーメッセージダイアログ表示１
 * - showAlert2: エラーメッセージダイアログ表示２
 *
 * @author	INTEC
 * @version	2004/01/21(Wed)
 */

/**
 * 指定されたURLを新規ウィンドウで開く。
 * @param 	url 開くページ
 * @param	name ウィンドウ名
 * @param	tb ツールバー表示？(yes/no)
 * @param	mb メニューバー表示？(yes/no)
 * @param	st ステータスバー表示？(yes/no)
 * @param	sc スクロールバー表示？(yes/no)
 * @param	resize サイズ変更可能？(yes/no)
 * @param	wWidth window 幅
 * @param	wHeight window 高さ
 * @return	window オブジェクト
 */
function openNewWindow( url, name, tb, mb, st, sc, resize, wWidth, wHeight ){
	// window オブジェクト
	var newWin;

	//スペース削除
	//wHeight = wHeight.replace(/ \s?|　\s?/g,"");
	//wWidth  = wWidth.replace(/ \s?|　\s?/g,"");

	// open
	newWin = window.open(url,name,"toolbar="+tb+",menubar="+mb+",status="+st+",scrollbars="+sc+",resizable="+resize+",height="+wHeight+",width="+wWidth);
	return newWin;
}

/**
 * アラートを表示する
 * @param	itemindex 項目名インデックス
 * @param	msgindex メッセージインデックス
 * @param	explain 説明文
 */
function showAlert(itemindex,msgindex,explain){
	var sentence = items[itemindex]+msgs[msgindex];
	if( !isEmpty(explain) ){
		sentence = sentence+"\n"+explain;
	}
	alert(sentence);
	return false;
}

/**
 * アラートを表示する
 * @param	itemindex1 項目名インデックス1
 * @param	itemindex2 項目名インデックス2
 * @param	msgindex メッセージインデックス
 * @param	explain 説明文
 */
function showAlert2(itemindex1,itemindex2,msgindex,explain){
	var sentence = items[itemindex1]+items[itemindex2]+msgs[msgindex];
	if( !isEmpty(explain) ){
		sentence = sentence+"\n"+explain;
	}
	alert(sentence);
	return false;
}

/*------------------------------------------------------*/
/*	関数名		:	ImagePreview						*/
/*	処理名		:	画像ファイル表示					*/
/*	パラメータ	:	myWinName	(i) ウインドウ名		*/
/*				:	myTitle		(i) 画面タイトル		*/
/*				:	myImage		(i) 画像ファイル名（パス付き）	*/
/*				:	myComment	(i) コメント					*/
/*				:	myXX		(i) ウインドウ幅		*/
/*				:	myYY		(i) ウインドウ高さ		*/
/*				:	imgWidth	(i) 画像幅				*/
/*				:	imgHeight	(i) 画像高さ			*/
/*	リターン値	:	なし								*/
/*------------------------------------------------------*/

function ImagePreview(myWinName,myTitle,myImage,myComment,myXX,myYY,imgWidth,imgHeight){

	myWinSize = "width=" + myXX + ",height=" + myYY;
	var mnImageWidth = "";
	var mnImageHeight = "";
	if(imgWidth != ""){
		mnImageWidth = "width=\"" + imgWidth + "\"";
	}
	if(imgHeight != ""){
		mnImageHeight = "height=\"" + imgHeight + "\"";
	}
	myWin = window.open("" , myWinName , myWinSize);
	myWin.document.open();
	myWin.document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">');
	myWin.document.write('<html>');
	myWin.document.write('<head>');
	myWin.document.write('<meta http-equiv="content-type" content="text/html; charset=Shift_JIS">');
	myWin.document.write('<title>' , myTitle , '</title>');
	myWin.document.write('</head>');
	myWin.document.write('<body bgcolor="#FFFFFF">');
	myWin.document.write('<center>');
	myWin.document.write('<table border=0 cellspacing=0 cellpadding=0>');
	myWin.document.write('<tr align="center"><td>');
	myWin.document.write('<img src="', myImage , '" ' , mnImageWidth , ' ' , mnImageHeight , '>' );
	myWin.document.write('</td></tr><tr>');
	myWin.document.write('<td><br><font color="#333333" SIZE=2>', myComment , '</font></td>');
	myWin.document.write('</tr><tr><td><br><br><center><a href="javascript:self.close()"><img src="images/close.gif" width="47" height="20" border="0"></a>');
	myWin.document.write('</center></td></tr></table>');
	myWin.document.write('</body>');
	myWin.document.write('</html>');
	myWin.document.close();

}

