$.fn.wait = function(time, type) { time = time || 1000; type = type || "fx"; return this.queue(type, function() { var self = this; setTimeout(function() { $(self).dequeue(); }, time); }); }; $(document).ready(function(){ $("div.infobox").wait(2000).slideUp("slow"); $("div.errorbox").wait(2000).slideUp("slow"); $("#add").click(function(){ $(".hidden").fadeIn("slow"); $(this).hide(0); $("label.info").hide(0); $(".tohide").hide(0); }); $("#kadobutton").click(function(){ $(".kadoscope").animate({opacity:"1"},"5000"); }); $('span.timeago').timeago(); });