allPages = new Array();
allImages = new Array();
allMessage = new Array();

allPages.push("/story/17/story_1702_1.html");
allPages.push("/section/quiz/index.asp?sectionID=&surveyID=72");
allPages.push("/story/214/story_21423_1.html");
allPages.push("/easter/easterrecipes.html?pgIndex=0");
allPages.push("/story/75/story_7506_1.html");
allPages.push("/features/easter_candy.html");
allPages.push("/story/74/story_7488_1.html");
allPages.push("http://community.beliefnet.com/?page_id=1000&site_page_id=13");
allPages.push("http://www.beliefnet.com/story/143/story_14375_5.html");
allPages.push("/easter/index.html");
allPages.push("/story/210/story_21006_1.html");

allImages.push("/imgs/Features/easter2007/egg1_w.gif");
allImages.push("/imgs/Features/easter2007/egg2_w.gif");
allImages.push("/imgs/Features/easter2007/egg3_w.gif");
allImages.push("/imgs/Features/easter2007/egg4_w.gif");
allImages.push("/imgs/Features/easter2007/egg5_w.gif");
allImages.push("/imgs/Features/easter2007/egg6_w.gif");
allImages.push("/imgs/Features/easter2007/egg7_w.gif");
allImages.push("http://www.beliefnet.com/imgs/Features/easter2007/egg8_w.gif");
allImages.push("/imgs/Features/easter2007/egg9_w.gif");
allImages.push("/imgs/Features/easter2007/egg10_w.gif");


allMessage.push("You've found the first Easter Egg.<br />#link# to find the next one.");
allMessage.push("You've found the second Easter Egg.<br />#link# to find the next one.");
allMessage.push("You've found the third Easter Egg.<br />#link# to find the next one.");
allMessage.push("You've found the fourth Easter Egg.<br />#link# to find the next one.");
allMessage.push("You've found the fifth Easter Egg.<br />#link# to find the next one.");
allMessage.push("You've found the sixth Easter Egg.<br />#link# to find the next one.");
allMessage.push("You've found the seventh Easter Egg.<br />#link# to find the next one.");
allMessage.push("You've found the eighth Easter Egg.<br />#link# to find the next one.");
allMessage.push("You've found the ninth Easter Egg.<br />#link# to find the last one.");
allMessage.push("You've found the last Easter Egg.<br />#link# to win a basket of edible goodies.");

curLocation = -1;
for (tmpN=0;tmpN<allPages.length-1 && curLocation<0;tmpN++)
{
  curTst = allPages[tmpN].replace("http://www.beliefnet.com/","");
  if (document.URL.indexOf(curTst) > -1)
    curLocation = tmpN;
}

function printCode()
{
  allAttr = parseURL();  

  if (allAttr["hunt"] && curLocation > -1)
  {
    nxLink = allPages[(curLocation+1)]
    if (nxLink.indexOf("?") > -1)
      nxLink += "&hunt=1";
    else
      nxLink += "?hunt=1";
  
    nxMsg = allMessage[curLocation].replace("#link#","<a href='"+nxLink+"'>Click here</a>");
  
    document.write('<style>#popupArea{  border: black 1px solid;  padding: 2px;  z-index: 3;  top: 0px;  left: 0px;  display: none;  position: absolute;  background-color: white;}#popupImg{  float: left;  border: none;}</style>');
    document.write('<img id="egImg" onmouseover="showLnk(this);" align="left" src="'+allImages[curLocation]+'" />');
    document.write('<div id="popupArea" onmouseover="hdTim=3000" onmouseout="hdTim=1500"><a href="'+nxLink+'"><img src="'+allImages[curLocation]+'" id="popupImg" /></a>'+nxMsg+'</div>')
  }
}

function showLnk(obj)
{
  hdTim=3000;
  eggInf=document.getElementById("popupArea");

  if(eggInf.style.display!="block")
  {
    var curleft=curtop=0;
    if(obj.offsetParent)
    {
      curleft=obj.offsetLeft;
      curtop=obj.offsetTop;
      while(obj=obj.offsetParent)
      {
        curleft+=obj.offsetLeft;
        curtop+=obj.offsetTop
      }
    }
    eggInf.style.left=curleft-6+"px";
    eggInf.style.top=curtop-3+"px";
    if(navigator.userAgent.search("Firefox")>-1)
      eggInf.style.left=curleft-3+"px";
    eggInf.style.display="block";
    setTimeout("hideLnk()",10);
  }
}

function hideLnk()
{
  if(hdTim==0)
    document.getElementById("popupArea").style.display="none";
  else
  {
    hdTim-=10;
    setTimeout("hideLnk()",10);
  }
}

//parses  URland returns an array with the attributes
function parseURL()
{
  out = new Array();
  prm = location.search;

  if (prm.length > 0)
  {
    prm = prm.substr(1);
    spl1 = prm.split("&");
    
    for (tmpN=0;tmpN<spl1.length;tmpN++)
    {
      spl2 = spl1[tmpN].split("=");
      out[spl2[0]] = spl2[1];
    }
  }
  return out;
}//end parseURL

printCode();
