var isDOM = (document.getElementById ? true : false);
var isIE4 = ((document.all && !isDOM) ? true : false);
var isNS4 = (document.layers ? true : false);
var isNS = navigator.appName == "Netscape";

function getRef(id) {
  if (isDOM) return document.getElementById(id);
  if (isIE4) return document.all[id];
  if (isNS4) return document.layers[id];
}

function getSty(id) {
  x = getRef(id);
  return (isNS4 ? getRef(id) : getRef(id).style);
}

var scrollerHeight = 88;
var imageIdx = 0;

function moveRightEdge() {
  var yMenuFrom, yMenuTo, yOffset, timeoutNextCheck;

  if (document.body.clientHeight) yTop=document.body.clientHeight-122; // À§ÂÊ À§Ä¡
  else yTop=550;

  if (isNS4) {
    yMenuFrom   = divMenu.top;
    yMenuTo     = windows.pageYOffset + yTop;
  } else if (isDOM) {
    yMenuFrom   = parseInt (divMenu.style.top, 10);
    yMenuTo     = (isNS ? window.pageYOffset : document.body.scrollTop) + yTop;
  }
  timeoutNextCheck = 100;

  if (yMenuFrom != yMenuTo) {
    yOffset = Math.ceil(Math.abs(yMenuTo - yMenuFrom) / 20);
    if (yMenuTo < yMenuFrom)
      yOffset = -yOffset;
    if (isNS4)
      divMenu.top += yOffset;
    else if (isDOM)
      divMenu.style.top = parseInt (divMenu.style.top, 10) + yOffset;
      timeoutNextCheck = 10;  // ½ºÅ©·ÑµÇ¾î¼­ ³»·Á¿À´Â ¼Óµµ
  }
  setTimeout ("moveRightEdge()", timeoutNextCheck);
}

document.write("<div id=divMenu style='left:995; visibility: visible; position: absolute'><a href='#top' onfocus='this.blur()'><img src='top.gif' border=0></a></div>");

if (isNS4) {
  var divMenu = document["divMenu"];
  divMenu.top = top.pageYOffset + 100;
  divMenu.visibility = "visible";
  moveRightEdge();
} else if (isDOM) {

  var divMenu = getRef('divMenu');
  divMenu.style.top = (isNS ? window.pageYOffset : document.body.scrollTop) + 300;  // Ã³À½ ½ºÅ©·Ñ µÇ´Â À§Ä¡
  divMenu.style.visibility = "visible";
  moveRightEdge();
}
