// jQuery Ready
$(document).ready(function() {
  // Are we dealing with ie?
  ie = (navigator.appName == "Microsoft Internet Explorer" && parseFloat(navigator.appVersion) < 7) ? true : false;
  
  if (ie) {
    // Change the background color :3
    $("body").css("background-color", "#5b5b5a");
  }
  
  // Hide all pages
  $("#pages div").hide();
  $("#pages div").fadeOut();
  $("#" + currentView + "_img img").hide();
  
  // Show Default
  $("#generalInformation").show();
  $("#" + currentView + "_generalInformation").show();
  
  // Page Links
  $("#contnav a")
  // .mouseOver & Mouse Out
  .hover(
    function() { $(this).css("cursor", "pointer") },
    function() { $(this).css("cursor", "default") })

  // ContNav .Click
  .click(function(event) {
    // Stop nav links default and blur
    event.preventDefault();
    $(this).blur();
    
    // get the href
    var page = $(this).attr("href")
    // remove the #
    var img_page = "#" + currentView + "_" + page.replace(/#/, "");
    
    // Fade All Pages and the softplay image
    switch (ie) {
      case true:
        // Hide Both Softplay image and all pages
        $("#pages div").hide();
        $("#" + currentView + "_img img").hide();
        
        // Show Page
        $(page).show();
        $(img_page).show();
        break;
      case false:
        // Fade away Softplay image and all pages
        $("#pages div").fadeTo("slow", 0);
        $("#" + currentView + "_img img").fadeTo("slow", 0);
        
        // timed fade in
        $(this).oneTime(500, function() {
          // Hide All pages
          $("#pages div").hide();
          $("#" + currentView + "_img img").hide();
                      
          // Show then fade in clicked Page
          $(page).show().fadeTo("slow", 1);
          // fade in the softplay image
          $(img_page).show().fadeTo("slow", 1);
        });
        break;
    }
  });
});