function linkOfficial(url) {
//親ウィンドウが存在しない場合
	if(!window.opener || window.opener.closed) {
	window.self.location.href = url;
	} else {
	window.close();
	}
}

/*この方法でも可能
function linkOfficial(url){
if(window.name == "popwin" | window.name == "formwin"){
window.close();
} else {
window.self.location.href = url;
}
}
*/


//popup win setting

function popWin(url,name){
//現在開いているウィンドウ幅サイズを取得し、そのサイズで新規ウィンドウを開く

var winW;
var winH = screen.availHeight;

// IE以外
if ((!document.all || window.opera) && document.getElementById) {
	winW=window.innerWidth;
}
// WinIE 6以上・標準モード
else if (document.getElementById && (document.compatMode=='CSS1Compat')) {
	winW=document.documentElement.clientWidth+17;
}
// WinIE 5以下
else if (document.all) {
	winW=document.body.clientWidth+17;
}
// その他(非対応)
else {
	winW=1000;
}

var subWin=window.open(url,name,"toolbar=1,scrollbars=1,resizable=1,menubar=1,location=1,status=1,directories=0");
subWin.focus();
subWin.resizeTo(winW, winH);
return subWin;
}

/* IEだと「アクセスが拒否されました」とエラーが出るのでpreview.htmlからリダイレクトにする。
理由は、同一サイトでもwindow.open+絶対パスで開こうとすると、別サイトと認識してしまうとの事。
※ NG記述例
function preview(){ popWin("https://www.presidio.jp/preview/perfect/","formwin");}
*/
function preview(){ popWin("preview.html","formwin");}
function news(){ popWin("news.html","popwin");}
function theaters(){ popWin("theaters.html","popwin");}
function howto(){ popWin("news.html#howto","popwin");}
function hands(){ popWin("tokyuhands.html","popwin");}
function special(){ popWin("special.html","popwin");}
function special01(){ popWin("special.html#sp01","popwin");}
function special02(){ popWin("special.html#sp02","popwin");}
function special03(){ popWin("special.html#sp03","popwin");}
function special04(){ popWin("special.html#sp04","popwin");}
function special05(){ popWin("special.html#sp05","popwin");}



/*
//Full Screen setting
function enterSite(){
	var fullwin = window.open("main.html","MainWin","toolbar=0,scrollbars=1,resizable=1,menubar=0,location=0,status=0,directories=0,left=0,top=0");
	fullwin.moveTo(0, 0);
	fullwin.resizeTo(screen.availWidth, screen.availHeight);
	fullwin.focus();
	//return fullwin;
}
*/

function enterSite(url){

var wLrgWin=1280;
var hLrgWin=832;
var wSmlWin=screen.availWidth;
var hSmlWin=screen.availHeight;

var l=(screen.width-wLrgWin)/2;
var t=-20+(screen.height-hLrgWin)/2;

if ( screen.width > 1280 || screen.height > 1024) {
window.focus();
window.open(url,"MainWin","toolbar=0,scrollbars=1,resizable=1,menubar=0,location=0,status=1,directories=0,left="+l+",top="+t+",width="+wLrgWin+",height="+hLrgWin);
}
else if ( screen.width <= 1280 || screen.height <= 1024) {
window.focus();
window.open(url,"MainWin","toolbar=0,scrollbars=1,resizable=1,menubar=0,location=0,status=0,directories=0,left=0,top=0,width="+wSmlWin+",height="+hSmlWin);
}

}