$(document).ready(function(){
    /* Setting up the explore button and content for explore section. */
		$("#explore-button").css('display', 'block');
		
		if ($('#ad-wrapper.big-ad').length) {
		  $('#ad-wrapper.big-ad')
		    .css('z-index', '1001')
		    .after('<div class="explore-wrapper left" id="explore-wrapper"><div class="inner-wrapper explore" id="explore"><p class="loading">Loading</p></div></div>');
		} else {
		  $('body').prepend('<div class="explore-wrapper left" id="explore-wrapper"><div class="inner-wrapper explore" id="explore"><p class="loading">Loading</p></div></div>');
		}
		
		$("#explore")
		  .html($(".site-navigation").html())		
  		.parent()
  		  .css({
  		    marginTop: "-" + $('#explore-wrapper').outerHeight() + "px",
  		    position: "relative",
  		    top: "0"
  		  });
		
		$('#explore-button').live('click', function(){
		  var $el = $('#explore-wrapper');
      if ($el.css("margin-top") != "0px") {
        $("#explore-button").css("background-position", "0 -29px").addClass('active');
        $el.animate({
          marginTop: "0"
        }, 1200, "easeInOutQuint");
      } else {
        $el.animate({
          marginTop: "-" + $el.height() + "px"
        }, 1200, "easeInOutQuint", function(){
          $("#explore-button").css("background-position", "0px 0px").removeClass('active');	
        });
      }
      return false;
		});

		$("#top-link").click(function(){
			var targetOffset = $("#header").offset().top;
	    $('html,body').animate({scrollTop: targetOffset}, 1000);
			return false;
		});		
});

	function flash(el) {
		$(el)
		.fadeTo("slow", 0.2).animate({opacity: 1.0}, "slow").fadeTo("slow", 1)
		.fadeTo("slow", 0.2).animate({opacity: 1.0}, "slow").fadeTo("slow", 1);
	}
