// ウィンドウ名
var WindowDefaultName   = 'ChildWindow';
// Window初期サイズ
var WindowDefaultWidth  = 800;
var WindowDefaultHeight = 600;
// 親Windowページ移動時の子ウィンドウサイズ
var NoFoucsWindowWidth  = 400;
var NoFoucsWindowHeight = 300;

function OpenChildWindow(url, windowName, width, height){
    // ウィンドウ名
    var _windowName  = (arguments[1] != undefined) ? arguments[1] : WindowDefaultName;
    // サイズ
    var _width  = (arguments[2] != undefined) ? arguments[2] : WindowDefaultWidth;
    var _height = (arguments[3] != undefined) ? arguments[3] : WindowDefaultHeight;
    // 表示位置
    var _windowX = (screen.width - _width) / 2;
    var _windowY = (screen.height - _height) / 3;
    
    var _newWindow = window.open(url, _windowName, 'width=' + _width + ',height=' + _height + ',left=' + _windowX + ',top=' + _windowY + ',scrollbars=yes,resizable=yes,toolbar=yes,status=yes,menubar=yes');
    _newWindow.focus();
}

function LocationParentWindow(url, width, height){
    if(window.opener != undefined){
        window.opener.location.href = url;
        window.opener.focus();
    }
}
