var TO = false;
$(window).resize(function(){
 if(TO !== false)
    clearTimeout(TO);
 TO = setTimeout(resizeStuff, 250); //200 is time in miliseconds
});

function resizeStuff() {
	var calc = ($(window).width()) / 150; // $(window).height() *
	$("body, html").animate({ "font-size" : calc <= 10 ? 10 : calc + "px"});
}

$(document).ready(function () {
    $(window).trigger("resize");
    $("#sitebar h1").click(function () { location.href = "/" });

    var ding = $("<div />").attr("id", "achiev");
    ding.html("<span>Achievement Unlocked</span><br />Schnapps? Schnapps? Schnapps? Schnapps? Schnapps? 5 Schnapps.");
    ding.appendTo("body");
    ding.fadeIn();

    var x = setTimeout(function () { ding.fadeOut(function () { $(this).remove() }); }, 3000);
    ding.mouseenter(function () { clearTimeout(x); });
    ding.mouseleave(function () { $(this).fadeOut().remove(); });
});
