(function ($) {

    function App() {
        var self = this;

        // Load
        // ------------------

        $(document).ready(function () {

            // vars
            self.bodyHeight = $(".gm_container").height();

            // events
            $(window).resize(self.f_resize);

            // menu
            f_toggleMenu();

            // set size/footer
            self.f_resize();


        });


        // private functions
        // ------------------

        // menu toggle
        function f_toggleMenu() {
            var path = window.location.pathname;
            path = path.slice(1, path.indexOf("."));

            if (path == "") {
                $(".index_link").addClass("gm_header_links_on");
            } else {
                $("." + path + "_link").addClass("gm_header_links_on");
            }
        }

        // resize stage
        this.f_resize = function () {
            var h = $(window).height() - 147;
            var w = $(window).width();

            // ie hack
            if ($.browser.msie)
                h = h - 3

            //move footer
            if (h >= self.bodyHeight) {
                $(".gm_container").height(h);
            } else {
                $(".gm_container").height(self.bodyHeight);
            }
        }
    }

    window.app = new App();

})(jQuery)
