// ================ from libCrossBrowser.js ====================
// variables
// version of library
LCB_version = 2.8;
// _mac : true = macintosh, false = other os
_mac=navigator.userAgent.indexOf('Mac')!=-1;
// _ie512 : true = MSIE 5.12(mac), false = others
_ie512=navigator.userAgent.indexOf('MSIE 5.12')!=-1;
// _dom : kind of DOM.
//        IE4 = 1, IE5+ = 2, NN4 = 3, NN6+ = 4, others = 0
_dom = document.all?(document.getElementById?2:1)
                   :(document.getElementById?4:(document.layers?3:0));
_createLayerNo = 0;                    // layer no.

function getWindowWidth ()
{
	if(_dom==4 || _dom==3) 
		return window.innerWidth;
	if(_dom==2 || _dom==1) 
		return document.body.clientWidth;
	return 0;
}
function createLayer(left,top,width,height,parentDiv)
{
	var s='';
	if(arguments.length>5)
	{
    	for(var i=5; i<arguments.length; i++) 
			s+=arguments[i];
	}
  if(_dom==4){
    var divName= '_js_layer_'+_createLayerNo; _createLayerNo++;
    var pDiv   =parentDiv?parentDiv:document.body;
    var div    =document.createElement('DIV');
    div.id=divName;
    div.setAttribute('style',
       'position:absolute;left:'+left+';top:'+top
      +(width >0?(';width:' +width ):'')
      +(height>0?(';height:'+height):'')
      +';visibility:hidden');
    var range=document.createRange();
    range.selectNodeContents(div);
    range.collapse(true);
    var cf=range.createContextualFragment(s);
    div.appendChild(cf);
    pDiv.appendChild(div);
    return div;
  }
  if(_dom==2 || _dom==1){
    var adj    =(_mac&&!_ie512)?' ':'';
    var divName= '_js_layer_'+_createLayerNo; _createLayerNo++;
    var ha     =(height>0)?(';height:'+height):'';
    var pDiv   =parentDiv?parentDiv:document.body;
    pDiv.insertAdjacentHTML('BeforeEnd',
       '<div id="'+divName
      +'" style="position:absolute;left:'+left+'px;top:'+top+'px'
      +(width >0?(';width:' +width ):';width:1')
      +(height>0?(';height:'+height):'')
      +';visibility:hidden;">'+s+'<\/div>'+adj);
    return document.all(divName);
  }
  if(_dom==3){
    var div=parentDiv?(new Layer(width,parentDiv)):(new Layer(width));
    if(height>0) div.resizeTo(width,height);
    div.moveTo(left,top);
    if(s!=''){
      div.document.open('text/html','replace');
      div.document.write(s);
      div.document.close();
    }
    return div;
  }
  return null;
}
function initDivPos(div){
  if(_dom==4){
    div.style.left=div.offsetLeft+'px';
    div.style.top =div.offsetTop +'px';
  }
  else if(_dom==2 || _dom==1){
    div.style.pixelLeft=div.offsetLeft;
    div.style.pixelTop =div.offsetTop;
  }
  return div;
}
function initDivSize(div){
  if(_dom==4){
    // getComputedStyle is buggy in NN6, and wrong in Mozilla 0.8/9
    //
    // var style=document.defaultView.getComputedStyle(div,null);
    // div.style.width =style.getPropertyValue('width' );
    // div.style.height=style.getPropertyValue('height');
    //
    div.style.width =div.offsetWidth +'px';
    div.style.height=div.offsetHeight+'px';
    //
    // need border-width=0px, margin-width:0px
  }
  else if(_dom==2 || _dom==1){
    div.style.pixelWidth =div.offsetWidth;
    div.style.pixelHeight=div.offsetHeight;
  }
  return div;
}
function setDivVisibility(div,visible){
  if(_dom==4 || _dom==2 || _dom==1){
    div.style.visibility=(visible)?'inherit':'hidden';
    return;
  }
  if(_dom==3){
    div.visibility      =(visible)?'inherit':'hide';
    return;
  }
}
// ============================ main =============================
frameId=parent.winName2Id(window.name);
logoStr='<div id = "count'+frameId+'" class="count'+frameId+'" style="position:absolute;">'
	+'<table class="cgcount" border=0 cellspacing=0 cellpadding=0><tr><td nowrap>'
    //   +'<div id = "count'+frameId+'" class="count'+frameId+'" style="position:absolute !important;">'
       +'<img src="../counter/total.gif" width="60" height="100" alt="今までの人数です">'
       +'<img src="cgi-bin/accsessCount/dsw.cgi?count=total" alt="いままでやってきた人数なの!?" border="0" /> '
       +'　　<img src="../counter/today.gif" width="43" height="90" alt="今日やってきた人たちです。">'
       +'<img src="cgi-bin/accsessCount/dsw.cgi?count=today" alt="今日来た人です。" border="0" /> '
       +'　　<img src="../counter/yestaday.gif" width="54" height="90" alt="昨日いらした方々の人数です">'
       +'<img src="cgi-bin/accsessCount/dsw.cgi?count=yesterday" alt="昨日来た人数です。" border="0" />'
// +'<img src="bannor/banner_nana_04.png" width="200" height="40">'
      
       +'<\/td><\/tr><\/table>'
       +'<\/div>';
logoDiv=null;
tid = null;
function startPage(){
  tid=null;
  parent.initPage(frameId,initDivPos(initDivSize(logoDiv)),getWindowWidth());
  setDivVisibility(logoDiv,true);
}
function init(){

  logoDiv=createLayer(0,30,0,0,null,logoStr);
  tid=setTimeout('startPage()',0);
}
function cancel(){
  if(tid){ clearTimeout(tid); tid=null; }
  if(!_mac || !_ie512) parent.cancel(frameId);
}
function resize(){
  if(document.all || document.getElementById){
    parent.cancel(frameId);
    tid=setTimeout('startPage()',0);
  }
}

/*
onresize=resize(); 
onload=init(); 
onunload=cancel();
をBody内に挿入
*/