
cSrc = ''
tSrc = ''
the_duration = 0.3
mouseOverTipItem = 0

var toolDragApproved=false
var tX,tY
function toolMove() {
   if (toolDragApproved) {
      toolTipDiv.style.pixelLeft = toolTmp1 + event.clientX-tX
      toolTipDiv.style.pixelTop = toolTmp2 + event.clientY-tY
      return false
   }
}
function moveToolTip() {
//   if (event.srcElement.className == "drag") {
      toolDragApproved = true
      toolTmp1 = toolTipDiv.style.pixelLeft
      toolTmp2 = toolTipDiv.style.pixelTop
      tX = event.clientX
      tY = event.clientY
      document.onmousemove=toolMove
//   }
}

function setToolTip(cSrc,tSrc) {
   mouseOverTipItem = 1
   toolTipDiv.style.pixelLeft = event.clientX + 16
   toolTipDiv.style.pixelTop = event.clientY + 16
   if (cSrc && tSrc) {
      document['toolTitle'].src   = 'tooltip/' + tSrc + '.gif'
      document['toolContent'].src = 'tooltip/' + cSrc + '.gif'
      setToolTipDimensions()     
   }

   if (toolTipDiv.style.visibility != 'visible')
      setTimeout("fadeToolTip('visible')",500,"Javascript");
   moveToolTip()
}

function fadeToolTip(newState) {
//   currentToolTip = document['toolTitle'].src
   if (toolTipDiv.filters.blendTrans.status == 0) {
      if (the_duration)
         delay=the_duration;

      if (newState == 'visible') {
         toolContent.filters.blendTrans.duration = delay+0.05
         toolTitle.filters.blendTrans.duration = delay+0.05
      }

      else {
         toolContent.filters.blendTrans.duration = delay-0.05
         toolTitle.filters.blendTrans.duration = delay-0.05
      }

      if ( (mouseOverTipItem && newState == 'visible') || (!mouseOverTipItem && newState == 'hidden') ) {

         toolTipDiv.filters.blendTrans.duration = delay;
         toolTipDiv.filters.blendTrans.Apply()
         toolTipDiv.style.visibility = newState
         toolTipDiv.filters.blendTrans.Play()
      }   
   }
}

function killToolTip() {
   mouseOverTipItem = 0
   setTimeout("if (mouseOverTipItem == 0) resetToolTip();",350)
}

function resetToolTip() {
   fadeToolTip('hidden')
   setTimeout("toolDragApproved=false;toolTipDiv.style.top = -100;toolTipDiv.style.left = -100",300)
}

function setToolTipDimensions() {
   toolTipArea.width = document['toolContent'].width + 8
   toolTipArea.height = document['toolContent'].height + 4

   if ( (document['toolTitle'].width - 2) >= 0)
      toolTitleLeft.width = document['toolTitle'].width - 2;

   tmpWidth = document['toolContent'].width - document['toolTitle'].width
   if (tmpWidth < 0)
      tmpWidth *= -1;

   toolTitleRight.width = tmpWidth

   toolTitle.style.top = (document['toolContent'].height + 14)  * -1
   toolContent.style.top = (document['toolContent'].height + 8) * -1
}