  var iFrameAnimate = true; //true for iframe slide down, false for instant appear

  var iFrameYOffset = 90;
  var iFrameShown = false;
  var iFrameHrefCurrent = 'registration.html';

  var iFrameDivHeightFX;
  var iFrameOverlayFX;

  var footerLinks;
  var footerLinkFX;

  var iFrameOverlay;
  var iFrameOverlayShown = false;

  window.addEvent('domready', function() {

    //when the DOM is ready, move the iframe to the correct position
    //make sure it is hidden, and prepped for sliding in

    //add in an overlay div (absolutely positioned, this allows creating a 'lightbox fade')
    iFrameOverlay = new Element('div', {'id': 'iframeOverlay'}).injectBefore('iframeDiv');

	if (!detectMacXFF())
		iFrameOverlay.setStyle('background-color','#000');

    positionOverlay();

    iFrameDivHeightFX = new Fx.Style('iframeDiv', 'top', {
       fps:40,
       duration: 1000,
       wait: false,
       transition: Fx.Transitions.Expo.easeOut
    });

    iFrameOverlayFX = new Fx.Style('iframeOverlay', 'opacity', {duration: 200 });

    hideOverlay();

    //grab all footer links from the top nav,
    //then using element effects, add events to fade the links in to white on hover
    //and fade back to light grey when the user leaves the footNav

    footerLinks =  $ES('a','li');
    footerLinkFX = new Fx.Elements(footerLinks, {wait:false });

    footerLinks.each(function(link,i) {
        link.addEvent('mouseenter', function(event) {
            var fxNew = {};
            fxNew[i] = {color: '#FFFFFF'};

            footerLinks.each(function(otherLink, j) {
                if (i != j) { fxNew[j] = {color: '#AAAAAA' };
                }
            });

            footerLinkFX.start(fxNew);
        });
    });
    $('footNav').addEvent('mouseleave', function(event) {
       var fxNew = {};
       footerLinks.each(function(link, i) {
          fxNew[i] = {color: '#AAAAAA'};
       });

       footerLinkFX.start(fxNew);
    });

    //the following bind the click events to perform javascript
    //they cancel the event to allow non javascript browsers
    //to follow the href attribute in the <a>

	var regs = $('registrationLink');

    $('registrationLink').addEvent('click',function(e) {
        e = new Event(e);
        toggleIframeWithHref('registration.html');
        e.stop();
     });
    $('disclaimerLink').addEvent('click',function(e) {
        e = new Event(e);
        toggleIframeWithHref('disclaimer.html');
        e.stop();
     });
    $('creditsLink').addEvent('click',function(e) {
        e = new Event(e);
        toggleIframeWithHref('sitecredits.html');
        e.stop();
     });
    $$('a.closeIframe').addEvent('click',function(e) {
        e = new Event(e);
        hideIframe();
        e.stop();
      });

     $ES("a").addEvent('click',function(e) { e = new Event(e); e.target.blur(); }); //gets all the anchor tags; synonymous with $$("a")

     centerIframe();
     moveMultiUseIframe(null, -1 * getIframeHeight());
  });
  window.addEvent('resize', function() { centerIframe(); positionOverlay(); });
  window.addEvent('scroll', function() { positionOverlay(); });

  function detectMacXFF() {
	  //http://jakeo.org/blog/2007/03/16/css-opacity-and-flash-transparency-in-mac-firefox/
	  var userAgent = navigator.userAgent.toLowerCase();
	  if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) {
		return true;
	  }
  }
  function showOverlay() {
	  iFrameOverlayShown = true;
	  positionOverlay();

	  if (detectMacXFF()) {
		  //http://jakeo.org/blog/2007/03/16/css-opacity-and-flash-transparency-in-mac-firefox/
		  iFrameOverlay.setStyles({'backgroundImage': 'url(interface/images/overlayBkgd.png)',
									'backgroundRepeat' : 'repeat'
								  });
	  }
	  else
	  	iFrameOverlayFX.start(0.7);  //opacity transition (0.0 = 0% opaque)
  }
  function hideOverlay() {
	  iFrameOverlayShown = false;

	  if (detectMacXFF()) {
		  //http://jakeo.org/blog/2007/03/16/css-opacity-and-flash-transparency-in-mac-firefox/
		 iFrameOverlay.setStyles({'height': '0px',
								 'backgroundRepeat': 'none'
								 });
	  }
	  else
		  iFrameOverlayFX.start(0);  //opacity, transition to transparent (0)
  }

  function getIframeHeight() { return $('iframeDiv').getSize().size.y; }
  function getIframeWidth() { return $('iframeDiv').getSize().size.x; }

  function positionOverlay() {
	  if (iFrameOverlayShown)
    	iFrameOverlay.setStyles({'top': window.getScrollTop(), 'height': window.getHeight()});
  }
  function centerIframe() {
      moveMultiUseIframe((window.getWidth() / 2) - 355, null); //pass in null to prevent y changes
  }
  function moveMultiUseIframe(x, y) {
    frame = $('iframeDiv');
    if (frame) {
        if (frame.style) {
          frame = frame.style;
          if (x != null) frame.left = x + 'px';
          if (y != null) frame.top = y + 'px';
      }
    }
  }

  function toggleIframeWithHref(iFrameHref)  {
    if (iFrameShown && iFrameHrefCurrent == iFrameHref)
      hideIframe();
    else
      showIframeWithHref(iFrameHref);
  }

  function showIframeWithHref(iFrameHref)
  {
    if(iFrameShown && iFrameHrefCurrent == iFrameHref)
        return;

    var changingIframePage = false;

    //Ensure the URL is correct on the iframe:
    //if (iFrameHrefCurrent != iFrameHref) //commented, force loading of page everytime
    {
        changingIframePage = true;

       	$('iFrameMultiPage').src = iFrameHref;
        iFrameHrefCurrent = iFrameHref;
    }
    if (!iFrameShown) //start sliding iframe in
    {
        iFrameDivHeightFX.set(-1 * getIframeHeight());
        //check if we need delay for iframe.src to finish (page loading in the iframe)
       	showOverlay.delay((changingIframePage ? 50 : 0));

        function showIframeDiv() {
			if (iFrameAnimate)
				iFrameDivHeightFX.start(iFrameYOffset); //start = animation, transitioned into spot
			else
				iFrameDivHeightFX.set(iFrameYOffset);  //set = instant, no animation or transition
        };
		//+ 200 sets speed for instant appear or slide after overlay has finished
		//(NOTE: mac doesn't animate, set to 0 for instant appear!)
        showIframeDiv.delay((changingIframePage ? 50 : 0) + (detectMacXFF() ? 75 : 200));

        iFrameShown = true;
    }
  }
  function hideIframe()
  {
    if(iFrameShown)
    {
        //reverse the animation... first slide up then hide the overlay
        //adding delay to prevent massive cpu usage
		if (iFrameAnimate)
			iFrameDivHeightFX.start(-1 * getIframeHeight()); //start = animation or transition into spot
		else
	        iFrameDivHeightFX.set(-1 * getIframeHeight());  //set = instant or no animation or transition

        hideOverlay.delay((iFrameAnimate ? 100 : 0)); //makes sure overlay displays when iframe is in view, 100 sets delay time

        iFrameShown = false;

      var StopVideoHack = setTimeout("$('iFrameMultiPage').src = 'about:blank';", 1000);
    }
  }