function CheckUIElements()
{
	var yMenuFrom, yMenuTo, yOffset, timeoutNextCheck, HHHHHH, bottomheight, bottomheight;
	bottomheight =100; // ¹Ø¹Ù´Ú¿¡ Å©±â.
	imgheight = 420; // ±×¸²ÀÇ ¼¼·ÎÅ©±â
	HHHHH = document.body.clientHeight; // Ã¢ÀÇ ¼¼·ÎÅ©±â

	yMenuFrom   = parseInt (divMenu.style.top, 10);
	yMenuTo     = document.body.scrollTop + HHHHH-imgheight + 4 ; // À§ÂÊ À§Ä¡

	if (document.body.scrollHeight < (yMenuTo + imgheight + bottomheight)) {
		yMenuTo	 = document.body.scrollHeight - imgheight - bottomheight;
	}
   
	timeoutNextCheck = 100;
 
	if ( yMenuFrom != yMenuTo ) {
		yOffset = Math.ceil( Math.abs( yMenuTo - yMenuFrom ) / 5 );
		if ( yMenuTo < yMenuFrom )
			yOffset = -yOffset;
			divMenu.style.top = parseInt (divMenu.style.top, 10) + yOffset;
			timeoutNextCheck = 10;
	}
	
	setTimeout ("CheckUIElements()", timeoutNextCheck);        
        
        
}


function CheckUIElements2()
{
        var yMenuFrom, yMenuTo, yButtonFrom, yButtonTo, yOffset, timeoutNextCheck;


		yMenuFrom   = parseInt (divMenu2.style.top, 10);
        yMenuTo     = document.body.scrollTop +50; // À§ÂÊ À§Ä¡
   
        timeoutNextCheck = 100;

        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;
                        divMenu2.style.top = parseInt (divMenu2.style.top, 10) + yOffset;
             			timeoutNextCheck = 10;
        }
        if ( yMenuFrom != yMenuTo ) {
                yOffset = Math.ceil( Math.abs( yMenuTo - yMenuFrom ) / 20 );
                if ( yMenuTo < yMenuFrom )
                        yOffset = -yOffset;
                        divMenu2.style.top = parseInt (divMenu2.style.top, 10) + yOffset;
                		timeoutNextCheck = 10;
        }

        setTimeout ("CheckUIElements2()", timeoutNextCheck);
}



function onLoad()
{
    var y;
	divMenu.style.top = document.body.scrollTop + 100;
	divMenu.style.visibility = "visible";
	divMenu2.style.top = document.body.scrollTop + 100;
	divMenu2.style.visibility = "visible";
	CheckUIElements();
	CheckUIElements2();
    return true;
}
