
//--ウインドウ有無確認関数
function win_closed(winVar) { 
  var ua = navigator.userAgent
  if(!!winVar)
      if((ua.indexOf('Gecko')!=-1 || ua.indexOf('MSIE 4')!=-1) && ua.indexOf('Win')!=-1) 
           return winVar.closed
      else return typeof winVar.document != 'object'
  else return true
}

//--ウィンドウフルサイズ関数
function resizeWindowFull(){
  var osName = navigator.appVersion;
  var browser = navigator.appName;

    if(osName.indexOf('Safari')!=-1){
	moveTo(0,0);
	resizeTo(screen.width,screen.height-22);
    }else{
	if(osName.indexOf('Mac')!=-1){
		if(browser.charAt(0)=="M"){
			moveTo(0,0);
			resizeTo(screen.width,screen.height);
		}else{
			moveTo(0,0);
			resizeTo(screen.width,screen.height-43);
		}
	}else{
		moveTo(0,0);
		resizeTo(screen.width,screen.height);
	}
    }
}

//--ウィンドウ標準サイズ関数
function resizeWindowBasic(w,h,url){

	//標準サイズ
	if(w && h){
		var basicW = w;
		var basicH = h;
	}else{
		var basicW = 1016;
		var basicH = 762;
	}
	
	//中心を取得



	var centerX = screen.width / 2;
	var centerY = screen.height / 2;
	
	//ウィンドウの中心を合わせる
	var windowX = centerX - (basicW / 2);
	var windowY = centerY - (basicH / 2);
	
	if(windowX<0 || windowY<0){
	    moveTo(0,0);
	}else{
	    moveTo(windowX, windowY);
	}
	resizeTo(basicW,basicH);
	
	if(url){
		location.href = url;
	}

}

//--ウィンドウ標準サイズ関数
function openAndSetSizeScrollWindow(url, w, h){
	var newWin = window.open(url, 'vsign', 'width=' + w + ',height=' +h + ',resizable=yes,status=yes, scrollbars=yes');
	newWin.focus();
}

//--ウィンドウ標準サイズ関数
function openAndrSetSizeWindow(url, w, h){
	window.open(url, 'vsign', 'width=' + w + ',height=' +h + ',resizable=yes,status=yes');	
}
/*
* @description ターゲットウインドウ名を指定してリンクする
* @param リンク先URL
* @param ウインドウ名

*/
function openNameWindow(url, winName){
	var newWin = window.open(url, winName , 'resizable=yes,status=yes, menubar=yes, toolbar=yes, location=yes, scrollbars=yes');
		
	newWin.focus();
}

function openHelpWindow(url){
	var newWin = window.open(url, 'help' , 'resizable=yes,status=no, menubar=no, toolbar=no, location=no, scrollbars=yes, width=890');
		
	newWin.focus();
}

//--ダイアログを開く  (showModalDialog が実装されている場合（IEのみ）と、それ以外を分ける)
/*
* @url      開くURL
* @winName  ウインドウ名
* @w        ウインドウの幅
* @h        ウインドウの高さ
*/
function openDialog(url, winName, w, h){

	var param = 'resizable=no,status=no, menubar=no, toolbar=no, location=no, scrollbars=no';
	param = param + ', width=' + w + ', height=' + h;
	var win = window.open(url, winName, param);
	win.focus();	
	return win;
	
}
//--トップに戻る
function checkMother(){
	var backUrl = "http://www.logpaper.jp";
	if(window.opener && !window.opener.closed){
	window.opener.focus(backUrl);
	}else{
	window.open(backUrl,'window_name');
	}
}