var bNetscape4plus = (navigator.appName == "Netscape" && navigator.appVersion.substring(0,1) >= "4");
var bExplorer4plus = (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.substring(0,1) >= "4");
if ( bNetscape4plus ) {
    cheight =  window.innerHeight;
}
if ( bExplorer4plus ) {
    cheight =  document.documentElement.clientHeight;
}

function CheckUIElements(){      
      var yMenuFrom, yMenuTo, yButtonFrom, yButtonTo, yOffset, timeoutNextCheck;
	  var toppos = 218;      //수정할 수치 CASE 1 (상단위치 기준시 사용) : 브라우저상단에서의 높이값 
	//var objheight = 300;   // 수정할수치 CASE 2 (하단위치 기준시 사용) : 퀵메뉴 높이지정
	//var toppos = cheight - objheight;  // 수정할수치 CASE 2 (하단위치 기준시 사용) : 퀵메뉴 높이지정


      if ( bNetscape4plus ) { 
              yMenuFrom   = document.getElementById("topbtn").style.top.replace("px","");
              yMenuTo     = self.pageYOffset + toppos; //넷스케이프용 최초 레이어 좌표 값
      }
      else if ( bExplorer4plus ) {
              yMenuFrom   = parseInt (topbtn.style.top, 10);
              yMenuTo     = document.documentElement.scrollTop + toppos; //익스플로러용 최초 레이어 좌표 값
      }
      timeoutNextCheck = 500;

      if ( Math.abs (yButtonFrom - (yMenuTo + 152)) < 6 && yButtonTo < yButtonFrom ) {
              setTimeout ("CheckUIElements()", timeoutNextCheck);
              return;
      }

      if ( yButtonFrom != yButtonTo ) {
              yOffset = Math.ceil( Math.abs( yButtonTo - yButtonFrom ) / 10 );
              if ( yButtonTo < yButtonFrom )
                      yOffset = -yOffset;

              if ( bNetscape4plus )
                      document["divLinkButton"].top += yOffset;
              else if ( bExplorer4plus )
                      divLinkButton.style.top = parseInt (divLinkButton.style.top, 10) + yOffset;

              timeoutNextCheck = 10;
      }
      if ( yMenuFrom != yMenuTo ) {
              yOffset = Math.ceil( Math.abs( yMenuTo - yMenuFrom ) / 20 );
              if ( yMenuTo < yMenuFrom )
                      yOffset = -yOffset;

              if ( bNetscape4plus ){
                   document.getElementById("topbtn").style.top = parseInt(document.getElementById("topbtn").style.top.replace("px","")) + yOffset + "px";
              }else if ( bExplorer4plus ){
                      topbtn.style.top = parseInt (topbtn.style.top, 10) + yOffset;
              }

              timeoutNextCheck = 10;
      }

      setTimeout ("CheckUIElements()", timeoutNextCheck);
}

function OnLoad()
{
      var y;
      if ( bNetscape4plus ) {
                selftop = self.pageYOffset + 135;
              document.getElementById("topbtn").style.top = selftop + "px"; //넷스케이프용 로딩시 시작 레이어 좌표 값
              document.getElementById("topbtn").style.visibility = "visible";
      }
      else if ( bExplorer4plus ) {
              topbtn.style.top = document.documentElement.scrollTop + 135; //익스플로러용 로딩시 시작 레이어 좌표 값
              topbtn.style.visibility = "visible";
      }
      CheckUIElements();
      return true;
}
OnLoad();
