// JavaScript Document

/**
 * 読み込み時にウィンドウ名を上書きする
 *
 * @return	void
 */
window.onload = function ()
{
	if (! window.opener) {
		window.name	= 'cosmetoMainFrame';
	}
}


/**
 * 同名商品をポップアップで表示する
 *
 * @param	string		移動先URL
 * @return	void
 */
function openSameProduct(url) {
	var win = window.open(
		url,
		'winSameProduct',
		'scrollbars=yes,width=520,height=520,resizable=yes'
		);
	win.focus();
}


/**
 * フォームを画像やリンクテキストで送信する
 *
 * @param	string		対象フォームのname属性
 * @param	string		送信ボタンの代替テキスト
 * @return	void
 */
function formSubmit(formName, submitValue)
{
	var form	= document.forms[formName];
	form.submitBtn.value	= submitValue;
	form.submit();
}


/**
 * 再入荷時連絡希望のフォームを表示する
 *
 * @param	string		再入荷連絡希望URL
 * @return	void
 */
function openRearrivalAlert(url)
{
	// メインウィンドウからの操作だったら、
	// サブウィンドウをポップアップする。
	if (window.name == 'cosmetoMainFrame') {
		var win = window.open(
			url,
			'winRearrivalAlert',
			'scrollbars=yes,width=600,height=600,resizable=yes'
			);
		win.focus();
	// 既にサブウィンドウ内での処理だったら、
	// ウィンドウ名を変更して対象URLに移動する。
	} else {
		window.name		= 'winRearrivalAlert';
		window.resizeTo(width=600, height=600);
		location.href	= url;
	}
}


/**
 * ツリー式メニュー表示
 * @param	tName	表示用ツリーブロックメニュー
 *
 *
 */

function treeMenu(tName)
{
	tMenu = document.getElementById(tName).style;
	if (tMenu.display == 'none') tMenu.display = "block";
	else tMenu.display = "none";
}
