// LastUpdate : 2004/5/10/4:42:54 PM
// このスクリプトは変数設定に合わせた同じ表示領域のサブウィンドウを開くものです。
// 対応ブラウザはバージョン4以上です。

function openSubwin(wurl,wname,wproperty,wwidth,wheight,wtop,wleft){
	
	// 初期設定
	
	pref= "no";
	
	if(wurl == "url" || wurl == null){
		wurl = "http://www.google.com/";
	}
	if(wwidth == "width" || wwidth == null){
		wwidth = 500;
	}
	else{
		wwidth = parseInt(wwidth)
	}
	if(wheight == "height" || wheight == null){
		wheight = 500;
	}
	else{
		wheight = parseInt(wheight)
	}
	
	var wtb = (wproperty.charAt(0) == '1' ? 'yes' : 'no');
	var wlb = (wproperty.charAt(1) == '1' ? 'yes' : 'no');
	var wdir = (wproperty.charAt(2) == '1' ? 'yes' : 'no');
	var wstb = (wproperty.charAt(3) == '1' ? 'yes' : 'no');
	var wmb = (wproperty.charAt(4) == '1' ? 'yes' : 'no');
	var wscb = (wproperty.charAt(5) == '1' ? 'yes' : 'no');
	var wres = (wproperty.charAt(6) == '1' ? 'yes' : 'no');
	
	// 表示領域オフセット
	
	var pf = navigator.platform.charAt(0);
	var an = navigator.appName.charAt(0);
	var ua = navigator.userAgent;
	
	if(pf == "M"){
		
		if(an == "N"){
			
			if(wtb =="yes" || wlb == "yes"){
				
				if(ua.indexOf("Gecko",0) > -1 && ua.indexOf("Safari",0) <= -1){
					wheight += 79;
				}
				if(wlb == "yes" && ua.indexOf("Safari",0) > -1){
					wheight += 72;
				}
				if(wscb != "no" && ua.indexOf("Safari",0) > -1){
					wwidth += 15;
					wheight += 15;
				}
				
			}
			
			if(wstb == "yes"){
				
				if(ua.indexOf("Safari",0) > -1){
					wheight += 15;
				}
				if(ua.indexOf("Gecko",0) > -1 && ua.indexOf("Safari",0) <= -1){
					wheight += 18;
				}
				
			}
			
			if(wscb == "yes"){
				
				if(ua.indexOf("Gecko",0) > -1 && ua.indexOf("Safari",0) <= -1){
					wwidth += 18;
					wheight += 18;
				}
				else{
					
					if(wstb != "yes" && ua.indexOf("[",0) <= -1){
						wwidth += 15;
						wheight += 15;
					}
					
				}
				
			}
			
		}
		
	}
	else{
		
		if(wmb == "yes"){
			
			if(ua.indexOf("MSIE",0) > -1){
				
				if(wtb == "yes" && wlb == "yes" && wdir == "yes" && wstb == "yes"){
					wheight += 123;
				}
				else{
					wheight -= 20;
				}
				
			}
			
		}
		if(wscb == "yes"){
			wwidth += 15;
			wheight += 15;
		}
		
	}
	
	// 表示位置（デフォルトは中央）
	
	var sw = screen.availWidth / 2;
	var sh = screen.availHeight / 2;
	var ww = wwidth / 2;
	var wh = wheight / 2;
	
	if(wtop == "top" || wtop == null){
		wtop = parseInt(sh - wh);
	}
	
	if(wleft == "left" || wleft == null){
		wleft = parseInt(sw - ww);
	}
	
	var wopt = "width=" + wwidth;
	wopt += ",height=" + wheight;
	wopt += ",top=" + wtop;
	wopt += ",left=" + wleft;
	wopt += ",toolbar=" +  wtb;
	wopt += ",location=" + wlb;
	wopt += ",directories=" + wdir;
	wopt += ",status=" + wstb;
	wopt += ",menubar=" + wmb;
	wopt += ",scrollbars=" + wscb;
	wopt += ",resizable=" + wres;
	
	ow = window.open(wurl,wname,wopt);
	ow.focus();
	return;
	
}

// Author : kenta@digitrick