var bFox = navigator.userAgent.indexOf("Firefox") != -1;
var bSafari = navigator.userAgent.indexOf("Safari") != -1;
var bOpera = navigator.userAgent.indexOf(" Opera") != -1;
var bIE = navigator.userAgent.indexOf("MSIE") != -1;
//var bNetscape = navigator.userAgent.indexOf("Netscape") != -1;

//スクロールなし。
function openNoScWin(wUrl, wWidth, wHeight){
	var wObj;
	var wName;
	scWidthCenter = screen.availWidth / 2;
	scHeightCenter = screen.availHeight / 2;
	wOption = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=" + wWidth + ",height=" + wHeight + ",left=" + (scWidthCenter - (wWidth / 2)) + ",top=" + (scHeightCenter - (wHeight / 2));
	wName = "sub" + wWidth + "_" + wHeight;
	wObj = window.open(wUrl,wName,wOption);
	wObj.focus();
}

//スクロールあり。
function openScWin(wUrl, wWidth, wHeight){
	var wObj;
	var wName;
	if(navigator.appVersion.indexOf("Mac") > -1){
		if(bIE && !bOpera){
			wWidth -= 1;
		} else if(bSafari){
			wWidth += 15;
			wHeight += 1;
		}else if(bFox){
			wWidth += 15;
		}else{
			wWidth += 15;
		}
	} else{
		if(bIE && !bOpera){
			wWidth += 16;
		} else if(bFox){
			wWidth += 16;
		}else{
			wWidth += 16;
		}
	}
	scWidthCenter = screen.availWidth / 2;
	scHeightCenter = screen.availHeight / 2;
	wOption = "width=" + wWidth + ",height=" + wHeight + ",left=" + (scWidthCenter - (wWidth / 2)) + ",top=" + (scHeightCenter - (wHeight / 2)) + ",scrollbars=yes";
	wName = "sub" + wWidth + "_" + wHeight;
	wObj = window.open(wUrl, wName, wOption);
	wObj.focus();
}


function changeParURL(wUrl){
	bCheck = CheckParWin();
	if(bCheck){
		window.opener.focus();
		window.opener.location.href = wUrl;
	}else{
		openMainWin(wUrl);
	}
}

function openMainWin(wUrl){
	var wObj;
	wObj = window.open(wUrl,'Main');
	wObj.focus();
}

function CheckParWin(){
	var bOpen = false;
	if ((navigator.userAgent.indexOf("Mac") > -1)){
		if(window.opener) bOpen = true;
	}else{
		if (window.opener&&!window.opener.closed) bOpen = true;
	}
	return bOpen;
}