﻿  var factCheck = setTimeout('');
  
  function remoteFact(e)
  {
   document.getElementById('FactArrow').style.visibility = "visible";
   e = document.getElementById('p'+e);
   document.getElementById('FactArrow').style.left = e.getAttribute("cleft")+'px';
   document.getElementById('FactArrow').style.top = e.getAttribute("top")+'px';
   e.setAttribute("remote", true);
   showFact(e);
  }

  function showFact(e)
  {
   clearTimeout(factCheck);
   document.getElementById('Facts').className = "trans5";
   document.getElementById('FactArrow').className = "trans5";
   document.getElementById('Facts').setAttribute('goaway',2);
   document.getElementById('Facts').style.left = e.getAttribute("left")+'px';
   document.getElementById('Facts').style.top = e.getAttribute("top")+'px';
   document.getElementById('Facts').innerHTML = e.getAttribute("put");
   document.getElementById('Facts').style.visibility="visible";
   if(e.getAttribute("remote") == true || e.getAttribute("remote") == 'true')
   {
    document.getElementById('FactArrow').style.visibility = "visible";
    e.setAttribute("remote", false);
   }
   else document.getElementById('FactArrow').style.visibility = "hidden";
  }
  
  function hideFact()
  {
   document.getElementById('Facts').setAttribute('goaway',1);
   clearTimeout(factCheck);
   checkFact(5);
  }
  
  function checkFact(phase)
  {
    clearTimeout(factCheck);
    if(document.getElementById('Facts').getAttribute('goaway') == 1)
    {
     document.getElementById('Facts').setAttribute('goaway',0);
     factCheck = setTimeout('checkFact(5)', 500);
    }
    else if(document.getElementById('Facts').getAttribute('goaway') == 0)
    {
      document.getElementById('Facts').className = "trans"+phase;
      document.getElementById('FactArrow').className = "trans"+phase;
      if(phase > 0)
       factCheck = setTimeout('checkFact('+(--phase)+')', 60);
      else
      {
       document.getElementById('Facts').style.visibility = "hidden";
       document.getElementById('FactArrow').style.visibility = "hidden";
      }
    }
  }
  function setFacts(i)
  {
   var marker = ':';
   map = document.getElementById('parklocations');
   var areas	= map.getElementsByTagName("area");
   for(var a = 0; a < areas.length; a++)
   {
    if(areas[a].tagName.toLowerCase() == "area")
    {
     var e = areas[a];
     var info = e.title.toString();
     if(info != '')
     {
      var coords = e.coords.toString().split(',');
      var left = parseInt(coords[0]);
      e.setAttribute("cleft", left - 4);
      if(left > 340) left -= 400;
      e.setAttribute("left",20 + left);
      e.setAttribute("top", parseInt(coords[1]));
      var put = '<div'>+info+'</div>';
      if(info.indexOf(marker) > 0)
      {
        put = '<div>'+info.substring(0,info.indexOf(marker))+'</div>';
         put += '<p>'+info.substring(info.indexOf(marker)+1,info.length)+'</p>';
      }
      e.setAttribute("put",put);
      e.removeAttribute("title");
      e.onmouseover = function(){showFact(this)}
      e.onmouseout = function(){hideFact()}
     }
    }
   }
   document.getElementById('Facts').setAttribute('goaway',0);
   document.getElementById('Facts').onmouseover=function()
   {
    clearTimeout(factCheck);
    checkFact(0);
   }
   i.onmouseover = setFacts = null;
   i.removeAttribute("onmouseover");
  }