//■ 01 ■■■■■■■■■■■■■■■■■■■■■■■■■
//	PUBLIC 関数
//■■■■■■■■■■■■■■■■■■■■■■■■■■■■
//---------------------------------------------
// ポップアップウインドウの位置を決めて開く
newWin=""; var width, height;
function OpenWin(URL, W, H, OPTION, TARGET, E){
	var w = W ? W : 410;
	var h = H ? H : 550;
	var option = OPTION ? OPTION : "status=no,scrollbars=yes,toolbar=no,menubar=no,location=no";
	option += ",height=" + h;
	option += ",width=" + w;
	if (E) option += ",top=" + getMouseX(E) - (w);
	if (E) option += ",left=" + getMouseY(E) - (50);

	if( is_open_child(newWin) ) {
		newWin = window.open(URL, TARGET, option);
	} else {
		if( w == width && h == height ) {
			window.open(URL, TARGET, option);
		} else {
			newWin.location.href = URL;
		}
	}
	width = w; height = h;
	newWin.focus();
}

newHelpWin="";
function OpenHelpWin(URL){
	var option	= "status=no,scrollbars=yes,toolbar=no,menubar=no,location=no";
	option		+= ",width=410,height=550"
	if( is_open_child(newWin) ) {
		newHelpWin	= window.open(URL, 'HELPWIN', option);
	} else {
		if( w == width && h == height ) {
			window.open(URL, 'HELPWIN', option);
		} else {
			newHelpWin.location.href = URL;
		}
	}
	newHelpWin.focus();
}

//□ サブ関数 □□□□□□□□□□□□□□□□□□□□□□
//---------------------------------------------
// マウスの位置取得
function getMouseX(E){
	if( document.all ){
		return window.event.screenX;
	} else if ( document.layers || document.getElementById ){
		return E.screenX;
	}
}
function getMouseY(E){
	if( document.all ){
		return window.event.screenY;
	} else if ( document.layers || document.getElementById ){
		return E.screenY;
	}
}
function is_open_child(NW){
    var ua = navigator.userAgent;
    if( !!NW ){
        if( ua.indexOf('MSIE')!=-1 && ua.indexOf('Win')!=-1 ){
            return NW.closed;
        }else {
			return typeof NW.document != 'object'
		}
	} else {
		return true;
	}
}
//---------------------------------------------

