// JavaScript Document
// For Layer Moves
// Created By Kenny Y, Lee
// lee.youngkwon@gmail.com

function CheckUIElements()
{
        var yMenu1From, yMenu1To, yOffset, timeoutNextCheck;
        var wndWidth = parseInt(document.body.clientWidth, 10);
 
                yMenu1From   = parseInt (document.getElementById("quickLink").style.top, 10);
                yMenu1To     = document.body.scrollTop + 305; // 위쪽 위치

        timeoutNextCheck = 0;

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

					document.getElementById("quickLink").style.top = parseInt (document.getElementById("quickLink").style.top, 10) + yOffset;
					if(wndWidth > 955){
						document.getElementById("quickLink").style.left = wndWidth/2 + 477;
					} else {
						document.getElementById("quickLink").style.left = 965;
					}
                timeoutNextCheck = 0;
        }

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

function MovePosition()
{
  var wndWidth = parseInt(document.body.clientWidth, 10);
  // 페에지 로딩시 포지션
		if(wndWidth > 955){
			document.getElementById("quickLink").style.left = wndWidth/2 + 477;
		} else {
			document.getElementById("quickLink").style.left = 965;
		}
   // initializing UI update timer
  CheckUIElements();
  return true;
}