
$.fn.wait = function(time, type) {
        time = time || 1000;
        type = type || "fx";
        return this.queue(type, function() {
            var self = this;
            setTimeout(function() {
                $(self).dequeue();
            }, time);
        });
    };

    
function init() {
	
      $("div#projects div").each(function (i) {
      	$(this).hide();	
      });
      $("div#projects div").each(function (i) {
     	$(this).hide();
     	$(this).wait(10500*(i));
	  	$(this).fadeIn("slow");
	  	$(this).wait(7000);
	  	$(this).fadeOut("slow");
      });
      var $foo = $("div#projects div");
      setTimeout('init()',$foo.length*10500);
}

function init2() {
	
      $("div#middle_bg div.middle_menu").each(function (i) {
      	$(this).hide();	
      });
      $("div#middle_bg div.middle_menu").each(function (i) {
     	$(this).hide();
     	$(this).wait(13500*(i));
	  	$(this).fadeIn("slow");
	  	$(this).wait(10000);
	  	$(this).fadeOut("slow");
      });
      var $foo = $("div#projects div");
      setTimeout('init2()',$foo.length*13500);
}
$(document).ready(function() {
	init();
	init2();
 });
