//----------------------------------------------------------------------------------------------------//
//　初期化（ドキュメントのイベントを設定）
//　引数：なし
//　戻値：なし
function init()
{
  if ( !document.getElementById ) return;
//  document.onclick = docClick;
//  document.onmousemove = docMouseMove;
}
//----------------------------------------------------------------------------------------------------//

//----------------------------------------------------------------------------------------------------//
//　左スクロール
//　引数：なし
//　戻値：なし
function scrollLeft()
{
  if ( !document.getElementById ) return;
  if ( window.pageXOffset )
    return window.pageXOffset;
  if ( document.compatMode == "CSS1Compat" )
    return document.body.parentNode.scrollLeft;
  if ( document.body.scrollLeft )
    return document.body.scrollLeft;
  return 0;
}
//----------------------------------------------------------------------------------------------------//

//----------------------------------------------------------------------------------------------------//
//　トップスクロール
//　引数：なし
//　戻値：なし
function scrollTop()
{
  if ( !document.getElementById ) return;
  if ( window.pageYOffset )
    return window.pageYOffset;
  if ( document.compatMode == "CSS1Compat" )
    return document.body.parentNode.scrollTop;
  if ( document.body.scrollTop )
    return document.body.scrollTop;
  return 0;
}
//----------------------------------------------------------------------------------------------------//

//----------------------------------------------------------------------------------------------------//
//　Windowの幅を取得
//　引数：なし
//　戻値：なし
function winWidth ()
{
  if(window.innerWidth)
    return window.innerWidth;
  if(document.compatMode == "CSS1Compat")
    return document.body.parentNode.clientWidth;
  if(document.body.clientWidth)
    return document.body.clientWidth;
  return 600;
}
//----------------------------------------------------------------------------------------------------//

//----------------------------------------------------------------------------------------------------//
//　Windowの高さを取得
//　引数：なし
//　戻値：なし
function winHeight ()
{
  if(window.innerHeight)
    return window.innerHeight;
  if(document.compatMode == "CSS1Compat")
    return document.body.parentNode.clientHeight;
  if(document.body.clientHeight)
    return document.body.clientHeight;
  return 400;
}
//----------------------------------------------------------------------------------------------------//

//----------------------------------------------------------------------------------------------------//
//　エレメントX座標取得
//　引数：なし
//　戻値：なし
function getElemLeft( elem )
{
  var x = elem.offsetLeft;
  var pa = elem.offsetParent;
  while ( pa )
  {
    if ( pa.offsetLeft )
    {
      x += pa.offsetLeft;
    }
    pa = pa.offsetParent;
  }
  return x;
}
//----------------------------------------------------------------------------------------------------//

//----------------------------------------------------------------------------------------------------//
//　エレメントY座標取得
//　引数：なし
//　戻値：なし
function getElemTop( elem )
{
  var y = elem.offsetTop;
  var pa = elem.offsetParent;
  while ( pa )
  {
    if ( pa.offsetTop )
    {
      y += pa.offsetTop;
    }
    pa = pa.offsetParent;
  }
  return y;
}
//----------------------------------------------------------------------------------------------------//

//----------------------------------------------------------------------------------------------------//
//　メニュージャンプ
//　引数：select
//　戻値：なし
function jumpMenu( select )
{
  if ( !document.getElementById ) return;
  var url = select.options[ select.selectedIndex ].value;
  if ( url )
  {
    location.href = url;
  }
}
//----------------------------------------------------------------------------------------------------//

//----------------------------------------------------------------------------------------------------//
//　日時表示
//　引数：なし
//　戻値：なし
function clock()
{
  if ( !document.getElementById ) return;
  var obj = document.getElementById( "clock" );
  var now = new Date();
  var yyyy = now.getFullYear();
  var mm = now.getMonth() + 1; 
  if ( mm < 10 ) mm = "0" + mm;
  var dd = now.getDate();
  if ( dd < 10 ) dd = "0" + dd;
  var daynm;
  if ( now.getDay() == 0 )
  {
    daynm = "日";
  }else if ( now.getDay() == 1 )
  {
    daynm = "月";
  }else if ( now.getDay() == 2 )
  {
    daynm = "火";
  }else if ( now.getDay() == 3 )
  {
    daynm = "水";
  }else if ( now.getDay() == 4 )
  {
    daynm = "木";
  }else if ( now.getDay() == 5 )
  {
    daynm = "金";
  }else if ( now.getDay() == 6 )
  {
    daynm = "土";
  }
  var hh = now.getHours(); 
  if ( hh < 10 ) hh = "0" + hh;
  var nn = now.getMinutes(); 
  if ( nn < 10 ) nn = "0" + nn;
  var ss = now.getSeconds(); 
  if ( ss < 10 ) ss = "0" + ss;
  var dttmstr = yyyy + "/" + mm + "/" + dd + " (" + daynm + ") " + hh + ":" + nn + ":" + ss;
  obj.innerHTML = dttmstr;
  setTimeout( "clock();", 1000 );
}
//----------------------------------------------------------------------------------------------------//

//----------------------------------------------------------------------------------------------------//
//　フォーカス設定
//　引数：e	...オブジェクト
//　戻値：なし
function setFocus( e )
{
  if ( !document.getElementById ) return;
  var obj = document.getElementById( e );
  obj.focus();
}
//----------------------------------------------------------------------------------------------------//

//----------------------------------------------------------------------------------------------------//
//　メッセージ確認サブミット
//　引数：formnm...フォーム名
//	  msg	...表示するメッセージ
//　戻値：なし
function msgSubmit( formnm, msg )
{
  if ( !document.getElementById ) return;
  if ( window.confirm( msg ) )
  {
//    if ( check_dbl_click() )
//    {
      document.forms[ formnm ].submit();
//    }
  }
}
//----------------------------------------------------------------------------------------------------//
