$(document).ready(function () {
    resizeIt();

    $("#main-menu > ul > .sub-menu").each(function () {

        tougleMenu($(this), 0);
     })


    $("#main-menu > ul > .sub-menu > a").click(function (e) { // Important click thing
        e.preventDefault();
        if (!$(this).parent("li").hasClass("on")) {

            $("#main-menu > ul > li").each(function (e) {
                if ($(this).hasClass("on")) {
                    $(this).removeClass("on");
                    $(this).children("ul").slideUp(250);
                }
            });
        }
        tougleMenu($(this).parent("li"), 250);
    });
});
$(window).resize(function(){
	
	resizeIt()
});
function resizeIt()
{
	if($("#content").height() < $(document).height())
	{
		//$("#content").height($(document).height());
	}
}
function tougleMenu(menu, duration){
	if(menu.hasClass("on")){
		menu.removeClass("on");
		menu.children("ul").slideUp(duration);
	}
	else
	{
		menu.addClass("on");
		menu.children("ul").slideDown(duration);
	}
}
