var general = {

  CURRENT_MENU : "",
  
  MENU_OFFSETS : [],
  
  PAGE_HEIGHT : "1050px",

  bindEvents : function() {
  
  
    $("#projects").click(function() {
      $("#projectslabel").addClass("bold");
      $("#" + general.CURRENT_MENU + "label").removeClass("bold");
     general.loadSubContent("projects", "projects.php");
    });
    $("#news").click(function() {
      $("#newslabel").addClass("bold");
      $("#" + general.CURRENT_MENU + "label").removeClass("bold");    
      general.loadSubContent("news", "news.php");
    });   
    $("#menu3").click(function() {
      $("#menu3label").addClass("bold");
      $("#" + general.CURRENT_MENU + "label").removeClass("bold");
      general.loadSubContent("menu3", "spring-mock-exam.php");
    });  
    $("#aboutme").click(function() {
      $("#aboutmelabel").addClass("bold");
      $("#" + general.CURRENT_MENU + "label").removeClass("bold");
      general.loadSubContent("aboutme", "aboutme.php");
    });
    $("#contact").click(function() {
      general.loadSubContent("contact", "contacts.php", true);
    });
    $("#impressum").click(function() {
      general.loadSubContent("impressum", "imprint.php", true);
    });
    $("#guest").click(function() {
      $("#splashscreen").fadeOut(1000);
      general.loadSubContent("projects", "projects.php?setcookie=guest", true);
    });
    $("#closesplash").click(function() {
      $("#splashscreen").fadeOut(1000);
      general.loadSubContent("projects", "projects.php?setcookie=guest", true);
    });    
    $("#friend").click(function() {
      $("#splashscreen").fadeOut(1000);
      $("#newslabel").addClass("bold");
      $("#projectslabel").removeClass("bold");
      general.loadSubContent("news", "news.php?setcookie=friend", true);
    });   
    $("#isabella").click(function() {
      $("#splashscreen").fadeOut(1000);
      window.location.href="photoredirect.php?setcookie=isabella";
    });       
    
    
  },
  
  showSubContent : function(menuItem) {
     
    $("#loaddiv").stop();
    //$("body").css("cursor", "wait");
    $("#loaddiv").height(general.PAGE_HEIGHT);
    $("#loaddiv").css("top", "-" + general.PAGE_HEIGHT);
    $("#loaddiv").css("clip", "rect(" + general.PAGE_HEIGHT + "," + general.PAGE_HEIGHT + "," + general.PAGE_HEIGHT + ",0px)");
      
    general.CURRENT_MENU = menuItem;  
   
    $("#loaddiv").animate({
      clip: 'rect(0px,' + general.PAGE_HEIGHT + ', ' + general.PAGE_HEIGHT + ',0px)',
      top: "0px"
    }, {
      duration: 1000, 
      specialEasing: {
        height: 'swing'
      }, 
      complete: function() {
      }
    });
  },  
  
  loadSubContent : function(menuItem, url, hideLoading) {  
        if (!hideLoading) {   
          var position = $("#" + menuItem).position();
          $("#loading").css("top", position.top);
          $("#loading").css("left", position.left);
          $("#loading").removeClass("hidden");
        }

        $("#loaddiv").load(url, function(responseText, textStatus, XMLHttpRequest) {       
          $("#loaddiv").html(responseText);
          general.showSubContent(menuItem);
           $("#loading").addClass("hidden");        
        });

  },
  
  showSubContentButtomUp : function(menuItem) {
     
    $("#loaddiv").stop();
    //$("body").css("cursor", "wait");
    $("#loaddiv").css("top", general.PAGE_HEIGHT);
    $("#loaddiv").css("clip", "rect(0px," + general.PAGE_HEIGHT + ",0px,0px)");
      
    general.CURRENT_MENU = menuItem;  
   
    $("#loaddiv").animate({
      clip: 'rect(0px,' + general.PAGE_HEIGHT + ', ' + general.PAGE_HEIGHT + ',0px)',
      top: "0px"
    }, {
      duration: 1000, 
      specialEasing: {
        height: 'swing'
      }, 
      complete: function() {
      }
    });
  },  
  
  loadSubContentBottomUp : function(menuItem, url) {
        var position = $("#" + menuItem).position();
        $("#loading").css("top", position.top);
        $("#loading").css("left", position.left);
        $("#loading").removeClass("hidden");

        $("#loaddiv").load(url, function(responseText, textStatus, XMLHttpRequest) {       
          $("#loaddiv").html(responseText);
          general.showSubContentButtomUp(menuItem);
           $("#loading").addClass("hidden");        
        });
  },
  
  hideNewComment : function(name, comment) {
  
    $("#newcomment").html("<p>Thank you for your comment!</p>");
    $("#newcomment").animate({
      height: '55px'
    }, {
      duration: 500, 
      specialEasing: {
        height: 'swing'
      }, 
      complete: function() {
      }
    });
  },
  
  hideContact : function(name, comment) {
  
    $("#contactform").html("<p>Thank you for getting in touch!</p>");
    $("#contactform").animate({
      height: '55px'
    }, {
      duration: 500, 
      specialEasing: {
        height: 'swing'
      }, 
      complete: function() {
      }
    });
  }

  
}
