// Basic Java functions

function ShowPic(PicID,Caption){
  document.getElementById("caption").innerHTML=Caption;
  SldVue.src = PicID;
  document.getElementById("slidemsg").innerHTML= "Slide show is <b>STOPPED</b> - click on the picture to restart, or select another thumbnail";
  slidemax = 0;
}

function SetOpacity(object,opacityPct)
{
  // IE.
  object.style.filter = 'alpha(opacity=' + opacityPct + ')';
  // Old mozilla and firefox
  object.style.MozOpacity = opacityPct/100;
  // Everything else.
  object.style.opacity = opacityPct/100;
}

function ChangeOpacity(id,msDuration,msStart,fromO,toO)
{
  var element=document.getElementById(id);
  var opacity = element.style.opacity * 100;
  var msNow = (new Date()).getTime();
  opacity = fromO + (toO - fromO) * (msNow - msStart) / msDuration;
  if (opacity<0) 
    SetOpacity(element,0)
  else if (opacity>100)
    SetOpacity(element,100)
  else
  {
    SetOpacity(element,opacity);
    element.timer = window.setTimeout("ChangeOpacity('" + id + "'," + msDuration + "," + msStart + "," + fromO + "," + toO + ")",1);
  }
}

function FadeInImage(foregroundID,newImage,backgroundID)
{
  var foreground=document.getElementById(foregroundID);
  var background=document.getElementById(backgroundID);

  if (background)
  {
    background.src = foreground.src;
    background.style.backgroundImage = 'url(' + foreground.src + ')';
    background.style.backgroundRepeat = 'no-repeat';
  }

  SetOpacity(foreground,0);
  foreground.src = newImage;
  if (foreground.timer) window.clearTimeout(foreground.timer); 
  var startMS = (new Date()).getTime();
  foreground.timer = window.setTimeout("ChangeOpacity('" + foregroundID + "',1000," + startMS + ",0,100)",10);
}

function clickIE4(){
  if (event.button==2){
    alert(message);
    return false;
  }
}
function clickNS4(e){
  if (document.layers||document.getElementById&&!document.all){
    if (e.which==2||e.which==3){
      alert(message);
      return false;
    }
  }
}

