// for DOM objects
var combox;
var piclist;
var controlpanel;
var statusbox;
// work vars
var STAtimerActive = false;
var STAPercent = 0;
var STAOrigin = 0;
var STATarget = 0;
var STAtimer;
var STAStatusOpacity;
var STATargetObj;
// constants
var STAIncrement = 1;
var STAstatusboxMaxOpacity = .75;
/*
var ElementOpacity = new Array();
var ElementOpacityCount = 0;

function ElementOpacity_Register()
{
  ElementOpacity[ElementOpacityCount] = _object;
  return "eo_" + ElementOpacityCount++;
}
*/
function SetComBoxPos(id) //{{{
{
  var curitem = document.getElementById(id);
  if (combox)
  {
    combox.style.top = findPosY(curitem) - (isIE ? 0 : 40);
    combox.style.left = findPosX(curitem) + 620;
    combox.style.display = 'block';
    if (!STAtimerActive) StartScrollToAnchor(id);
  }
}
//}}}
function HideComBox() //{{{
{
  if (combox) SetOpacity(combox,0.5);
  if (piclist) SetOpacity(piclist,0.5);
}
//}}}
function ContinueFadeoutSTA() //{{{
{
  STAStatusOpacity -= 0.05;
  if (STAStatusOpacity < 0.01)
  {
    STAStatusOpacity = 0;
    clearTimeout(STAtimer);
    STAtimerActive = false;
  }
  else
  {
    STAtimer = setTimeout('ContinueFadeoutSTA();', 10);
  }
  SetOpacity(statusbox,STAStatusOpacity);
  SetOpacity(STATargetObj, (1 - STAStatusOpacity * .25));
}
//}}}
function StartFadeoutSTA() //{{{
{
  STAStatusOpacity = STAstatusboxMaxOpacity;
  clearTimeout(STAtimer);
  STAtimer = setTimeout('ContinueFadeoutSTA();', 10);
}
//}}}
function ContinueSTA() //{{{
{
  STAPercent += STAIncrement * ((100 - STAPercent)*0.2);
  if (STAPercent >= 99.9)
  {
    STAPercent = 100;
    clearTimeout(STAtimer);
    STAtimer = setTimeout('StartFadeoutSTA();', 10);
    STAtimerActive = false;
    //SetOpacity(STATargetObj, 1);
  }
  else
  {
    //SetOpacity(STATargetObj, Math.random()/2 + 0.5);
    SetOpacity(STATargetObj, (STAPercent * .0075));
    STAtimer = setTimeout('ContinueSTA();',50);
  }
  var NextTarget = STAOrigin + (STATarget - STAOrigin) * STAPercent / 100;
  window.scrollTo(0,NextTarget);
  statusbox.innerHTML = 'futok! ' + Math.round(STAPercent) + "%";
  //commentbox.style.top = STATarget + (isIE ? 40 : 0);
}
//}}}
function StartScrollToAnchor(anchorid) //{{{
{
  STATargetObj = document.getElementById(anchorid);
  STATarget = findPosY(document.getElementsByName(anchorid)[0]);// - 400;
  STAOrigin = CurrentYPos();
  //alert (STAOrigin + " - " + STATarget);
  //if ( (STAOrigin > 10 ) || (STATarget > 50) )
  if (STATarget < 100) STATarget = 0;
  if (STATarget - STAOrigin != 0)
  {
    STAPercent = 0;
    clearTimeout(STAtimer);
    STAtimer = setTimeout("ContinueSTA();",100);
    STAtimerActive = true;
    SetOpacity(statusbox,STAstatusboxMaxOpacity);
    statusbox.style.top = STATarget + 40;
  }
}
//}}}


