// ブラウザのバージョンチェック
// バージョンチェック true 指定バージョン以降 false 以前
function vercheck(IEversion,NNversion){
	if ((navigator.appName.indexOf("Microsoft") >= 0) && (IEversion != 0) && (IEversion <= parseFloat(navigator.appVersion))){
		return true;
	} else {
		if ((navigator.appName.indexOf("Netscape") >= 0) && (NNversion != 0) && (NNversion <= parseFloat(navigator.appVersion))){
			return true;
		} else {
			return false;
		}
	}
}
// ウインドウを前に持ってくる
function fon(win) {
	if( vercheck(4,4) == true ){
		win.focus();
	}
}
//----------------------------------------
// window操作 
//----------------------------------------
//----------------------------------------
// サブウインドウからみて親ウインドウが開いているかどうか調べる 
// 親ウインドウが　true　開いている false 閉じている　を返す
function is_opener() {
	var ua = navigator.userAgent;
	if( !!window.opener ) {
		if( ua.indexOf('MSIE 4') != -1 && ua.indexOf('Win') != -1 ) {
			return !window.opener.closed;
		} else {
			return typeof window.opener.document == 'object';
		}
	} else {
		return false;
	}
}

//-------------------------------------------
// サブウインドウから親ウインドウを操作する
//	url ... 親ウインドウに開くページアドレス
//	wname ... 親ウインドウの名前
function Link(url,wname) {
	if( is_opener() ){
		window.opener.location.href = url;
	} else {
		window.open(url,wname);
	}
}

//-------------------------------------------
// 親ウインドウから見てサブウインドウが開いているか調べる
// サブウインドウが　true　開いている false 閉じている　を返す
function sbwin_closed(winVar) {
	var ua = navigator.userAgent;
	if( !!winVar ) {
		if( ua.indexOf('MSIE 4') != -1 && ua.indexOf('Win') != -1 ) {
			return winVar.closed;
		} else {
			return typeof winVar.document != 'object';
		}
	} else {
		return true;
	}
}

//-------------------------------------------
// 親ウインドウからサブウインドウを操作する
//	url ...		サブウインドウに開くページアドレス
//	name ... 	window name
//	sw ... 		widthサイズ
//	sh	...		heightサイズ
//	flg ...		指定無し 画面中央に設置しない　1:画面の中央に置く
//  sobj ... サブウインドウを開いた時のwindow関数の戻り値を設定
function SetSubWin(url,name,sw,sh,flg,sobj) {
	if( sbwin_closed(sobj) ) {
		sobj = fwindow( url, name, sw, sh, flg,1);
	} else {
		sobj.location.href = url;
	}
	fon(sobj);

	return sobj;
}

/*
//-----------------------------------------------------
// クッキー操作関係
//-----------------------------------------------------

// サンプルです
times = getCookie("Times");
if (times == "") {
    times = 1;
}
date = getCookie("Date");
if (date == "") {
    date = "????";
}
document.write("これまでの訪問回数：" + times + "<BR>");
document.write("前回の訪問日：" + date + "<BR>");

times++;

dd = new Date();
ye = dd.getYear();      if (ye < 1900) ye += 1900;
mo = dd.getMonth() + 1; if (mo < 10) mo = "0" + mo;
da = dd.getDate();      if (da < 10) da = "0" + da;
ho = dd.getHours();     if (ho < 10) ho = "0" + ho;
mi = dd.getMinutes();   if (mi < 10) mi = "0" + mi;
se = dd.getSeconds();   if (se < 10) se = "0" + se;
date = ye + "/" + mo + "/" + da + " " + ho + ":" + mi + ":" + se;

setCookie("Times", times);
setCookie("Date", date);

// clearCookie("Times");
// clearCookie("Date");
//-------------------------------------------

//-------------------------------------------
// クッキーを取得しちゃう
//
// key ... 取得するユニークなキーワード
//
function getCookie(key) {
	var tmp2,xx1,xx2,xx3;

    tmp1 = " " + document.cookie + ";";
    xx1 = xx2 = 0;
    len = tmp1.length;
    while (xx1 < len) {
        xx2 = tmp1.indexOf(";", xx1);
        tmp2 = tmp1.substring(xx1 + 1, xx2);
        xx3 = tmp2.indexOf("=");
        if (tmp2.substring(0, xx3) == key) {
           return(unescape(tmp2.substring(xx3 + 1, xx2 - xx1 - 1)));
        }
        xx1 = xx2 + 1;
    }
    return("");
}

//-------------------------------------------
// クッキーをセットしちゃう
//
// key ... 設定するユニークなキーワード
//
function setCookie(key, val, tmp) {
    tmp = key + "=" + escape(val) + "; ";
    // tmp += "path=" + location.pathname + "; ";
    tmp += "expires=Fri, 31-Dec-2100 23:59:59; ";
    document.cookie = tmp;
}

//-------------------------------------------
// クッキーを削除しちゃう！
//
// key ... 削除するユニークなキーワード
//
function clearCookie(key) {
    document.cookie = key + "=" + "xx; expires=1-Jan-1997 00:00:00;";
}
*/
//-------------------------------------------
//
// ブラウザのバックグラウンドカラーを変更する 	
// col16 ... カラーコード ex ('#000000')
// 
function SetBgColor(col16) {
	document.bgColor = col16;
}
/*

	この機能もページのＣＳＳ化により一時停止させます。 2004/05/09
	CSSバージョンではこの機能を封印しちゃってます。
	もう古い書き方だと思うからね。
//-------------------------------------------
//このscriptを使用すると必ずcssを書き換えます
// OSとブラウザを特定しちゃってCSS振り分けちゃう!
mac = (navigator.appVersion.indexOf("Mac") != -1 )?true:false;
ie = (navigator.appName.charAt(0) == "M" )?true:false;
//ns = (navigator.appName.charAt(0) == "N" )?true:false;

	document.write("<style type='text/css'><!--");
	if( mac ) {
		// Macな人
		document.write(".e9 { font-size: 9px}");
		document.write(".e10 { font-size: 10px}");
		document.write(".e12 {  font-size: 12px}");
		document.write(".j9 { font-size: 9px }");
		document.write(".j10 { font-size: 10px }");
		document.write(".j12 { font-size: 12px }");
	} else {
		if( ie ) {
			// Win IEな人
			document.write(".e9 {  font-size: 9px; line-height: 11px}");
			document.write(".e10 { font-size: 10px; line-height: 12px}");
			document.write(".e12 { font-size: 12px; line-height: 15px}");
			document.write(".j9 { font-size: 10px; line-height: 12px}");
			document.write(".j10 { font-size: 11px; line-height: 13px}");
			document.write(".j12 { font-size: 12px; line-height: 15px }");
		} else {
			// Win NNかわかんない人
			document.write(".e9 {  font-size: 11px}");
			document.write(".e10 { font-size: 12px; line-height: 11px}");
			document.write(".e12 { font-size: 14px}");
			document.write(".j9 { font-size: 10px; line-height: 11px}");
			document.write(".j10 { font-size: 11px; line-height: 12px}");
			document.write(".j12 { font-size: 12px; line-height: 15px}");
		}			
	}
	document.write("--></style>");
*/

//----------------------------------------------
function acclog() {
	document.write("<img src='http://www.orangejam.jp/chepes/cgi/acc/acclog.cgi?");
	document.write("referrer="+document.referrer+"&");
	document.write("width="+screen.width+"&");
	document.write("height="+screen.height+"&");
	document.write("color="+screen.colorDepth+"'>");
}