var frontend = {
    init: function()
    {
        // Initialize layout
        this.layout.init();

        // Initialize tables
        this.tables.init();
    },

    layout: {
        init: function()
        {
            this.parseExternalLinks();
			this.setMinHeight();
        },

        parseExternalLinks: function()
        {
            $('a[rel=external]').click(function(e){
                open(this.href);
                e.preventDefault();
            });
        },

		setMinHeight: function() {
			if($('#nav').length > 0 && $('.nominheight').length == 0) {
				$('#main').css('minHeight', $('#nav').height() + 'px');
			}
		}
    },

    tables: {
        init: function()
        {
            // Add class 'first' to first th & td in table
            $('table th:first-child').addClass('first');
            $('table td:first-child').addClass('first');

            // Alternating rows
            $('table tr:even').addClass('even');
            $('table tr:odd').addClass('odd');

            // Hide thead section when not first class
            $('table:not(.first) thead').hide();
        }
    }
};


$(document).ready(function()
{
	// General javascript interaction
	frontend.init();
});