// ########## Delete Error Message
// ########## 2002.12.01
function HideError(){
	return true;
}
//window.onerror = HideError;


// ########## StyleSheet振り分け
window.onerror = null;

var ie  = (navigator.appName.indexOf('Micr') != -1);
var mac = (navigator.userAgent.indexOf('Mac') != -1 || navigator.userAgent.indexOf('mac') != -1);
var win = (navigator.userAgent.indexOf('Win') != -1 || navigator.userAgent.indexOf('win') != -1);

if (win) {
	if (ie) document.write('<LINK REL="STYLESHEET" HREF="../cmn_css/win.css" TYPE="text/css">');
	else document.write('<LINK REL="STYLESHEET" HREF="../cmn_css/win.css" TYPE="text/css">');
}else{
	if (mac) {
		if (ie) document.write('<LINK REL="STYLESHEET" HREF="../cmn_css/mac.css" TYPE="text/css">');
		else document.write('<LINK REL="STYLESHEET" HREF="../cmn_css/mac.css" TYPE="text/css">');
	}else{
		document.write('<LINK REL="STYLESHEET" HREF="../cmn_css/etc.css" TYPE="text/css">');
	}
}

// ########## Netscape 4.x系 再読込バグ回避
// ########## 2003.02.01
function N4_Reload(init) {
	if (init==true) with (navigator) {
		if ((appName=="Netscape") && (parseInt(appVersion)==4)) {
			document.N4_pgW = innerWidth;
			document.N4_pgH = innerHeight;
			onresize = N4_Reload;
		}
	} else if (innerWidth != document.N4_pgW || innerHeight != document.N4_pgH) location.reload();
}
N4_Reload(true);

// ########## Sub Window Open (Win-IE4不具合回避済み)
// ########## 2003.04.01

var newwin;
function WinOpen(URL,WN,F){
	if(newwin){
		if(!newwin.closed){
			newwin = window.open(URL,WN,F);
			newwin.focus();
		}else{
			newwin = window.open(URL,WN,F);
			newwin.focus();
		}
	}else{
		newwin = window.open(URL,WN,F);
			newwin.focus();
	}
}


function WinOpenReload(URL,WN,F){
	if(newwin){
		if(!newwin.closed){
			newwin = window.open(URL,WN,F);
			newwin.focus();
			if(Mac&&NN4){
				window.location.reload();
			}
		}else{
			newwin = window.open(URL,WN,F);
			if(Mac&&NN4){
				window.location.reload();
			}
		}
	}else{
		newwin = window.open(URL,WN,F);
		if(Mac&&NN4){
			window.location.reload();
		}
	}
}


// ########## Preload Image
function PreLoad() {
	var d = document;
	if(d.images){
		if(!d.My_IMG) d.My_IMG = new Array();
		var i , j = d.My_IMG.length , a = PreLoad.arguments;
		for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){
			d.My_IMG[j] = new Image;
			d.My_IMG[j++].src = a[i];
		}
	}
}


function GetObj(n, d) {
	var p,i,x;
	if(!d) d = document;
	if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d = parent.frames[n.substring(p+1)].document;
		n = n.substring(0,p);
	}
	if(!(x=d[n])&&d.all) x = d.all[n];
	for(i=0; !x&&i<d.forms.length; i++) x = d.forms[i][n];
	for(i=0; !x&&d.layers&&i<d.layers.length; i++) x = GetObj(n,d.layers[i].document);
	if(!x && document.getElementById) x = document.getElementById(n);
	return x;
}


// ########## Change Image
function ChgIMG() {
	var i , j = 0 , x , a = ChgIMG.arguments;
	document.My_sr = new Array;
	for(i=0; i<(a.length-2); i+=3) if ((x=GetObj(a[i]))!=null){
		document.My_sr[j++] = x;
		if(!x.oSrc) x.oSrc = x.src;
		x.src = a[i+2];
	}
}

// ########## Reset Image
function ResetIMG() {
	var i , x , a = document.My_sr;
	for(i=0; a&&i<a.length&&(x=a[i])&&x.oSrc; i++) x.src = x.oSrc;
}

