    var lastScrollY = 0;
    var layerLeftPosition = 0;
	var timeoutNextCheck=10;

	function initlayerPostion() {

		if (document.body.scrollHeight>=document.body.clientHeight){
			if(document.body.clientWidth>905){
				 layerLeftPosition=((document.body.clientWidth-981)/2)+905;
			}
			else layerLeftPosition=905;
		}
		else{
			if(document.body.clientWidth>905){
				 layerLeftPosition=((document.body.clientWidth-999)/2)+905;
			}
			else layerLeftPosition=905;
		}

        document.getElementById("productView").style.top = 0;
	    document.getElementById("productView").style.left = layerLeftPosition;
	
	}
		
	function layerPostion() {

		if(document.body.clientWidth>905){
			 layerLeftPosition=((document.body.clientWidth-981)/2)+905;
		}
		else layerLeftPosition=905;

		document.getElementById("productView").style.left = layerLeftPosition;
	
	}

    function heartBeat() {
		if(document.body.scrollTop){
				var diffY = document.body.scrollTop;
		}else{
				var diffY = document.documentElement.scrollTop;
		}

		if (diffY != lastScrollY) {
			percent = .5 * (diffY - lastScrollY);
			
			if (percent > 900) {
				percent = Math.ceil(percent);
			} else {
				percent = Math.floor(percent);
			}
			document.all.productView.style.pixelTop += percent;			
			lastScrollY = lastScrollY + percent;
		}
	}

  


function OnLoad() {
    var y;

	initlayerPostion();
	 
	 // ÆäÀÌÁö ·Îµù½Ã Æ÷Áö¼Ç
		if(document.body.scrollTop){
			productView.style.pixelTop=document.body.scrollTop + document.body.clientHeight - productView.offsetHeight //- 700;
		}else{
			productView.style.pixelTop=document.documentElement.scrollTop + document.body.clientHeight - productView.offsetHeight //- 700;
		}
	
    productView.style.visibility = "visible";

    // initializing UI update timer
    CheckUIElements();

    return true;
}

function CheckUIElements() {
    var yMenuFrom, yMenuTo, yButtonFrom, yButtonTo, yOffset, timeoutNextCheck;

    yMenuFrom = parseInt (productView.style.top, 10);
	
	if(document.body.scrollTop){
	   yMenuTo = document.body.scrollTop + 380;//yÃàÀ§Ä¡¼öÁ¤°¡´É
	}else{
	   yMenuTo = document.documentElement.scrollTop + 380;//yÃàÀ§Ä¡¼öÁ¤°¡´É
	}
    timeoutNextCheck = 300;

    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;
  timeoutNextCheck = 10;
 }
 if ( yMenuFrom != yMenuTo ) {
     yOffset = Math.ceil( Math.abs( yMenuTo - yMenuFrom ) / 20 );
  if ( yMenuTo < yMenuFrom )
      yOffset = -yOffset;

        //productView.style.top = parseInt (productView.style.top, 10) + yOffset;
        productView.style.top = (parseInt (productView.style.top, 10) + yOffset - 5)+"px";
        timeoutNextCheck = 10;
    }

	if (document.body.scrollHeight>=document.body.clientHeight){

		if(document.body.clientWidth>905){
			document.all.productView.style.left = ((document.body.clientWidth-981)/2)+905;
		}
		else document.all.productView.style.left =905;

	}
	else{
		if(document.body.clientWidth>910){
			document.all.productView.style.left = ((document.body.clientWidth-999)/2)+910;
		}
		else document.all.productView.style.left =910;

	}

 setTimeout ("CheckUIElements()", timeoutNextCheck);
}


