function inspectfunc() {
  var userid = 'tokkotaiorjp';
  var f_cur = 'parent';
  var f_parent = 'parent.parent';
  var ref_orig;
  if (parent == self) {
    // not use frame
    ref_orig = self.document.referrer;
  } else if (self.document.referrer != parent.document.URL) {
    // move in frame
    ref_orig = self.document.referrer;
  } else {
    while (eval(f_parent) != eval(f_cur)
	   && eval(f_cur).document.referrer == eval(f_parent).document.URL) {
      f_cur += '.parent';
      f_parent += '.parent';
    }
    ref_orig = eval(f_cur).document.referrer;
  }
  var ref = ref_orig.replace(/#.*$/ig, '');
  var url = document.URL.replace(/#.*$/ig, '');
  if (url.indexOf('http://', 0) != 0 && url.indexOf('https://', 0) != 0) { return; }
  url = url.replace(/^(https?:\/\/)[^\/]*@/, '$1');
  if(url != ref) { //self referrer check
    var ww;
    var wh;
    if (document.all) {
      if (document.body) {
	ww=document.body.clientWidth;
	wh=document.body.clientHeight;
      } else {
	ww=''; wh='';
      }
    } else if ((document.layers)||(document.getElementById)) {
      ww=window.innerWidth;
      wh=window.innerHeight;
    }

    var myDate = new Date();
    var ctime = myDate.getTime();

    var depth = screen.colorDepth;
    if (depth == 0) depth = '';
    if (document.body) {
      document.write('<img border=0 src="http://www.tokkotai.or.jp/inspect/logging.fcgi?userid='+userid+'&referer='+escape(ref)+'&url='+escape(url)+'&col='+depth+'&width='+screen.width+'&height='+screen.height+'&wwidth='+ww+'&wheight='+wh+'&ctime='+ctime+'" onload="if(this.width==1&&this.height==1){this.style.display=\'none\';}; this.onload=\'\';">');
    } else {
      var Img = new Image(1,1);
      Img.src ='http://www.tokkotai.or.jp/inspect/logging.fcgi?userid='+userid+'&referer='+escape(ref)+'&url='+escape(url)+'&col='+depth+'&width='+screen.width+'&height='+screen.height+'&wwidth='+ww+'&wheight='+wh+'&ctime='+ctime;
    }
  }
}
inspectfunc();
