﻿$(document).ready(function() {

    initMenu(); //call function that sets up menu

    // apply corner effect to main page wrapper
    // http://jquery.malsup.com/corner/
    $('#wrapperInner').corner("round 10px").parent().css('padding', '5px').corner("round 14px");

    if ($("#tabs")) {
        // initialize a tab control if it exists
        // Tabs by jQueryUI; http://www.jQueryUI.com/	
        $("#tabs").tabs({ cookie: { expires: 1} });
        $("#tabs ul:first").removeClass('ui-widget-header').addClass('ui-state-default');
        $("#tabs .ui-tabs-panel").css({ 'min-height': '400px' });


    };

    //If the User resizes the window, adjust the menu position helpers by reinitializing menu
    //http://snipplr.com/view/9097/jquery-detecting-a-browser-resize/
    $(window).bind("resize", resizeWindow);

    $("a.external").each(function() {

        // set onclick and title attributes of anchor tags with class .external
        // opens links to external websites in a new browser window or tab

        $(this).attr('title', 'This link will open in a new window')
    	.click(function() { window.open(this.href); return false; });

    });


});

function resizeWindow(e) {
        initMenu();
};


function initMenu() {

			//	fg-menu from the Filament Group
			//	http://www.filamentgroup.com/

            $('.fg-button').hover(
    		    function() { $(this).removeClass('ui-state-default').addClass('ui-state-focus'); },
    		    function() { $(this).removeClass('ui-state-focus').addClass('ui-state-default'); }
    	    );

            $('#aboutus').menu({
                content: $('#aboutus').next().html(),
                showSpeed: 200
               
            });

            $('#calendars').menu({
                content: $('#calendars').next().html(),
                showSpeed: 200,
                flyOut: true
            });

};

               
