jQuery(function($){

	//===============================================
	//	PNG fix
	//===============================================
  $("li.last").pngFix();
  // $("#cta").pngFix();
  $(document).pngFix();
  
  
  
	//===============================================
	//	Navigation
	//===============================================  
  $("#navigation li a").click(function() {
    var panel = $(this).attr("data-suffix");

    
    $(".main-content").hide();
    $("#header h1").hide();
    $("#explore-panel > div").hide();
    $("#splash").hide();
    
    if($(this).attr("data-side-nav")) {
      $("#cta span").html(function() { return $(this).attr("data-main-content"); });
      $("#cta").attr("href", "#").attr("target", "_self");
      $("#cta").unbind().click(function() {
        $("#module-dialog").jqmShow();
      });
      $("#cta").removeClass("develop");
    }
    else {
      $("#explore-panel").hide();
      $("#header-" + panel).fadeIn(500);
      $("#header").fadeIn(500);
    }
    
    if(panel === "develop") {
      $("#cta span").html(function() { return $(this).attr("data-develop-content"); });
      $("#cta").attr("href", function() { return $(this).attr("data-develop-link"); }).attr("target", "_blank");
      
      $("#cta").unbind();
      $("#cta").addClass("develop");
    }
    else {
      $("#cta span").html(function() { return $(this).attr("data-main-content"); });
      $("#cta").attr("href", "#").attr("target", "_self");
      $("#cta").unbind().click(function() {
        $("#module-dialog").jqmShow();
      });
      $("#cta").removeClass("develop");
    }
    
    $("#cta").fadeIn(500);
    $("#main-" + panel).fadeIn(500);

    return false;
  });
  
  $("#navigation > li").mouseover(function() {
      $("#splash").unbind();
      $("#navigation li ul").hide();
      $(this).addClass("expanded").find("ul").show();
  });
  $("#navigation > li").mouseout(function() {
      $(this).removeClass("expanded");
      $("#navigation li ul").hide();
  });
  
  $("#splash").bind("mouseover", function() {
    $("#navigation > li:first").addClass("expanded").find("ul").show();
  });
  $("#splash").mouseout(function() {
    $("#navigation li ul").hide();
    $("#navigation > li:first").removeClass("expanded");
  });
});

