var Nav  = navigator.userAgent.toLowerCase();
var isNS = Nav.indexOf('netscape') >= 0;
var isMoz= (Nav.indexOf('mozilla') >= 0) && (!isNS) && (!document.all);
var isOpera = Nav.indexOf('opera') >= 0;
var isIE = document.all && !isOpera;

function getElemPos(offsetTrail)
{
  var offsetLeft = 0;
  var offsetTop = 0;
  while (offsetTrail) {
      offsetLeft += offsetTrail.offsetLeft;
      offsetTop += offsetTrail.offsetTop;
      offsetTrail = offsetTrail.offsetParent;
  }
  if (navigator.userAgent.indexOf("Mac") != -1 && 
      typeof document.body.leftMargin != "undefined") {
      offsetLeft += document.body.leftMargin;
      offsetTop += document.body.topMargin;
  }
  return {left:offsetLeft, top:offsetTop};
}

function fnImgOver()
{
  if (!this.myImage) return;
  if (!this.myImage._loaded) return;
  clearInterval(this._timer);
  this._timer = setInterval("fnImgGrowShrink('"+this.id+"',true)",this.sIdt);
  var position = getElemPos(this);
  var l = this.imgDiv.style.left = position.left + this.offsetWidth + 20;
  if (isOpera)
    this.imgDiv.style.left = l + parseInt(this.imgDiv.style.paddingLeft);
  this.imgDiv.style.top = position.top;
  this.imgDiv.style.display="block";
  
  var myDiv = document.getElementById("fadeME"); myDiv.style.color="#CCCCCC";
  var myDiv = document.getElementById("fadeME_Blue"); myDiv.style.color="#CCCCFF";
}

function fnImgOut()
{
  if (!this.myImage) return;
  if (!this.myImage._loaded) return;
  clearInterval(this._timer);
  this._timer = setInterval("fnImgGrowShrink('"+this.id+"',false)",this.sIdt);
  
  var myDiv = document.getElementById("fadeME"); myDiv.style.color="#000000";
  var myDiv = document.getElementById("fadeME_Blue"); myDiv.style.color="#000099";
}


function fnImgGrowShrink(id,grow)
{
  var stp=false,o = document.getElementById(id); if (!o) return;
  o.myImage.style.width = o.sIcw; o.myImage.style.height = o.sIch;
  if (isOpera)
      o.imgDiv.style.width = o.sIcw + 2*parseInt(o.imgDiv.style.paddingLeft);
  if (grow) {
    if (o.sIcw < o.sIw) o.sIcw += o.sIdw; else stp=true;
    if (o.sIch < o.sIh) o.sIch += o.sIdh; else stp=true;
  } else {
    if (o.sIcw > o.sIdw) o.sIcw -= o.sIdw; else stp=true;
    if (o.sIch > o.sIdh) o.sIch -= o.sIdh; else stp=true;
  }
  if (stp) {
    clearInterval(o._timer);
    if (grow) {o.myImage.style.width = o.sIcw = o.sIw; o.myImage.style.height = o.sIch = o.sIh;}
    else o.imgDiv.style.display="none";
  }
}


function fnImgClick()
{
  if (this._url)
    window.location = this._url;
}

function fnImgOnLoad()
{
 if (!this._loaded)
 {
  var o = this.mi;
  o.sIw = this.width; o.sIh = this.height;

  if(o.sIh==0) o.sIh = 490;
  if(o.sIw==0) o.sIw = 648;

  o.sIdw = o.sIw / this.s; o.sIdh = o.sIh / this.s;
  this.style.width = o.sIcw = 0;
  this.style.height = o.sIch = 0;
  o.imgDiv.style.display="none";
  o.imgDiv.style.visibility="";
  this._loaded=true;
 }
}
function fnImgInit(o,img,lft,tp,t,s,url)
{
  if (!document.getElementById) return;
  if (o.myImage == null)
  {
    o.imgDiv = document.body.appendChild(document.createElement("div"));
    o.myImage = o.imgDiv.appendChild(document.createElement("img"));
    document.getElementById("hidImgDiv").appendChild(o.imgDiv);

    o.imgDiv.style.position="absolute";

    o.imgDiv.style.borderStyle="solid";
    o.imgDiv.style.borderColor="#000000";
    o.imgDiv.style.borderWidth="1px 1px 1px 1px";

    o.imgDiv.style.visibility="hidden";
    o.imgDiv.style.zIndex=110;
    
    o.sIlft=lft; o.imgDiv.style.top=tp;
    o.myImage.mi = o;
    o.myImage.s  = s;
    o.myImage.onload = fnImgOnLoad;
    o.sIdt = t; o._url = url;
    o.onmouseover=fnImgOver;
    o.onmouseout=fnImgOut;
    o.onclick=fnImgClick;
    if (url != null) {  
      if (document.all)
        o.style.cursor = "hand";
      else
        o.style.cursor = "pointer";
    }
    o.myImage.src = img;
  }
}
