/* ===== for Netscape Navigator 4.xx ===== */

if (document.layers){
	var forNN4 = '<link rel="styleSheet" href="../style/nn4x.css" media="screen" type="text/css" charset="Shift_JIS">';
	document.write(forNN4);
}

//################################//
//## 閲覧人数カウントプログラム ##//
//################################//
var WhoIsOnline = {
	'option' : {
		'repeatID' : setTimeout("", 30000)
	},
	
	'init' : function() {
		var that = this;
		
		if(window.XMLHttpRequest) {
			var message = new XMLHttpRequest;
		} else if(window.ActiveXObject) {
			try {
				var message = new ActiveXObject("Msxml2.XMLHTTP");
			} catch(e) {
				var message = new ActiveXObject("Microsoft.XMLHTTP");
			}
		} else {
			return null;
		}
		
		message.onreadystatechange = function() {
			if(message.readyState == 4) {
				if(message.status == 200) {
					//成功
				} else {
					//失敗
				}
			} else {
				//取得中
			}
		}
		
		if(location.href.match(/^http:/)) {
			this.option.repeatID = this.open(message);
		}
	},
	
	'open' : function(xmlhttp) {
		var that = this;
		
		try {
			var dummyTime = (new Date()).getTime();
			
			xmlhttp.open('GET', location.protocol + "//www.teichiku.co.jp/script/analyze/who_is_online.php?url=" + encodeURIComponent(location.href.replace(/index\.(html|php)/, "")) + "&t=" + dummyTime, true);
			xmlhttp.send(null);
			
			return setTimeout(function() {
				that.option.repeatID = that.open(xmlhttp);
			}, 30000);
		} catch(e) {
			
		}
	}
};

window.onload = function() {
	WhoIsOnline.init();
}

