﻿// JScript File

var TipList = new Array();
TipList.push("Pause the mouse over a crime marker.  After a short delay, a detailed window will appear.");
TipList.push("You can zoom in to a specific area by clicking and dragging to draw a box.");
TipList.push("Click anywhere on the map to move that location to the center.");
TipList.push("When viewing a large number of crimes, a crime density map will appear.");
TipList.push("Locations with multiple crimes will be highlighed with a larger marker.");

var tipDuration = 20000;
var currentTip = 0;
var currentTimeoutId;
var tipHolderElement;
var tipElement;

function startTipDisplay(inTipHolderElement, inTipElement)
{
  tipHolderElement = inTipHolderElement;
  tipElement = inTipElement;
  tipHolderElement.style.visibility = "visible";
  showNextTip();
}

function showNextTip()
{
  var thisTip = TipList[currentTip];
  currentTip++;
  currentTip %= TipList.length;
  
  //fadeElementOut(tipHolderElement);
  
  tipElement.innerHTML = thisTip;
  
  //fadeElementIn(tipHolderElement);
  
  currentTimeoutId = setTimeout("showNextTip()", tipDuration);
  
}

function stopTipDisplay()
{
  //alert("booger");
  clearTimeout(currentTimeoutId);
  //fadeElementOut(tipHolderElement);
  tipHolderElement.style.visibility = "hidden";
}

function fadeElementOut(inElement)
{
  var anim = new YAHOO.util.Anim(inElement.id, { opacity: { to: 0 } },5, YAHOO.util.Easing.easeOut);
  anim.animate();
}

function fadeElementIn(inElement)
{
  var anim = new YAHOO.util.Anim(inElement.id, { opacity: { to: 100 } },5, YAHOO.util.Easing.easeOut);
  anim.animate();
}