fadWidth = 193;
fadHeight = 166;
nowX = 977;
nowY = 330;
posX = 0;
posY = 0;
fad_style = document.getElementById("forumRightMenu").style;
fad_style1 = document.getElementById("forumRightMenu1").style;

finnerWidth = 0;

function fadIni()
{
  innerWidth = document.body.clientWidth;
  innerHeight = document.body.clientHeight;

  edge = (innerWidth-977)/2;

  if( edge < 0 )
  {
    posX = innerWidth - 145;
  }
  else
  {
    posX = edge + 805;
  }

  if(innerHeight < 500 ){
    posY = innerHeight-fadHeight;
  }
  else{
    posY = 30;
  }
}

function fadRefresh()
{
  if(innerWidth != document.body.clientWidth){
    fadIni();
  }
  offsetX = posX + document.body.scrollLeft - nowX;
  offsetY = posY + document.body.scrollTop - nowY;
  nowX += offsetX/5;
  nowY += offsetY/5;
  fad_style.left = nowX;
  fad_style.top = nowY;
  fad_style1.left = nowX-798;
  fad_style1.top = nowY;  

  var temp = getCookie("ckFORUM_setting");
  opobj = document.getElementById("op");


  if(document.body.scrollTop < 472 && ('' == temp || null == temp)){
    opobj.style.display = 'none';
    fad_style.zIndex = 0;
	fad_style1.zIndex = 0;
  }
  else if(document.body.scrollTop > 472 && ('' == temp || null == temp)){
    opobj.style.display = 'block';
    fad_style.zIndex = 10;
	fad_style1.zIndex = 10;
  }
/*
  else if('none' == temp || 'block' == temp){
    //opobj.style.display = temp;
    fad_style.zIndex = ('none' == temp)? 0:10;
  }
*/

  floatID = setTimeout("fadRefresh()", 20 );
}

function fadStart()
{
  fadIni();
  //window.onresize=fadIni;
  fadRefresh();
}

fadStart();

