addLoadListener(windowLoad); 
addLoadListener(initDropBox);
addLoadListener(initDismissBox);

function initDismissBox () {
	var link = document.getElementById("dismissbox");
	link.onclick = dismissboxv2;

}


function initDropBox()
{

  //document.getElementById("drop2").animationTimer = setInterval('moveObject(document.getElementById("drop2"),  500, 0, 25)', 50);
  document.getElementById("drop2").animationTimer = setInterval('moveObject(document.getElementById("drop2"), 250, 400, 25)', 80); //mine
}

function moveObject(target, destinationLeft, destinationTop, maxSpeed)
{
 var currentLeft = parseInt(retrieveComputedStyle(target, "left"));
 var currentTop = parseInt(retrieveComputedStyle(target, "top"));

  if (isNaN(currentLeft))
  {
   // currentLeft = 0;
    currentLeft = 250; //mine
  }

  if (isNaN(currentTop))
  {
    currentTop = 0;
  }

  if (currentLeft < destinationLeft)
  {
    currentLeft += maxSpeed;

    if (currentLeft > destinationLeft)
    {
      currentLeft = destinationLeft;
    }
  }
  else
  {
    currentLeft -= maxSpeed;

    if (currentLeft < destinationLeft)
    {
      currentLeft = destinationLeft;
    }
  }

  if (currentTop < destinationTop)
  {
    currentTop += maxSpeed;

    if (currentTop > destinationTop)
    {
      currentTop = destinationTop;
    }
  }
  else
  {
    currentTop -= maxSpeed;

    if (currentTop < destinationTop)
    {
      currentTop = destinationTop;
    }
  }

  target.style.left = currentLeft + "px";
  target.style.top = currentTop + "px";

  if (currentLeft == destinationLeft && currentTop == destinationTop)
  {
    clearInterval(target.animationTimer); 
  }
}

function addLoadListener(fn)
{
  if (typeof window.addEventListener != 'undefined')
  {
    window.addEventListener('load', fn, false);
  }
  else if (typeof document.addEventListener != 'undefined')
  {
    document.addEventListener('load', fn, false);
  }
  else if (typeof window.attachEvent != 'undefined')
  {
    window.attachEvent('onload', fn);
  }
  else
  {
    var oldfn = window.onload;
    if (typeof window.onload != 'function')
    {
      window.onload = fn;
    }
    else
    {
      window.onload = function()
      {
        oldfn();
        fn();
      };
    }
  }
}

function retrieveComputedStyle(element, styleProperty)
{
  var computedStyle = null;

  if (typeof element.currentStyle != "undefined")
  {
    computedStyle = element.currentStyle;
  }
  else
  {
    computedStyle = document.defaultView.getComputedStyle(element, null);
  }

  return computedStyle[styleProperty];
}


/*Functions from here on are not Terry */
function windowLoad() 
	{
	
// Standard window on load function. Page specific

imageLoad();
	}

var loaded = false;
if (document.images)
	{
	navHOMEoff = new Image(70,26);navHOMEoff.src = "images/nav_home.gif";
	navWORKSoff = new Image(136,26);navWORKSoff.src = "images/nav_how_it_works.gif";
	navMINDoff = new Image(133,26);navMINDoff.src = "images/nav_keep_in_mind.gif";
	navINVESTMENToff = new Image(228,26);navINVESTMENToff.src = "images/nav_investment.gif";
	navACTIONoff = new Image(129,26);navACTIONoff.src = "images/nav_take_action.gif";
	navINFOoff = new Image(175,26);navINFOoff.src = "images/nav_info.gif";
		}

		

function imageLoad()
	{
	if (document.images)
	{
	navHOMEon = new Image(70,26);navHOMEon.src = "images/nav_home_mo.gif";
	navWORKSon = new Image(136,26);navWORKSon.src = "images/nav_how_it_works_mo.gif";
	navMINDon = new Image(133,26);navMINDon.src = "images/nav_keep_in_mind_mo.gif";
	navINVESTMENTon = new Image(228,26);navINVESTMENTon.src = "images/nav_investment_mo.gif";
	navACTIONon = new Image(129,26);navACTIONon.src = "images/nav_take_action_mo.gif";
	navINFOon = new Image(175,26);navINFOon.src = "images/nav_info_mo.gif";
	return (loaded = true);
	}
	}

		
function rollOut(imgName)
	{
	if (document.images)
	{
	imgOn = eval(imgName+"off.src");
document[imgName].src = imgOn;
	}
	}

function rollIn(imgName)
	{
	if (document.images &&(loaded==true))
	{
	imgOff = eval(imgName+"on.src");
	document[imgName].src = imgOff;
	}
	}
function dismissboxv2 () {
	if (window.document.getElementById("drop2")) clearInterval(document.getElementById("drop2").animationTimer )
document.getElementById("drop1").style.visibility="hidden"

	//drop1.style.display="none";
}

