var isNewsPaused = false;

jQuery(document).ready(
    function()
    {
        jQuery("div.scrollable").scrollable({ vertical:'true', items:'ul', size: 2, onBeforeSeek: function() {return !isNewsPaused;}}).circular().autoscroll(4000);
		jQuery("a.pause").click(
			function( e )
			{
				isNewsPaused = !isNewsPaused;
				e.preventDefault();
			}
		);
        jQuery("body").css("font-size", jQuery.cookie('fontSize'));
        jQuery("div#moduleArea").equalHeights();
        // Text resizer
        jQuery("span#textSmaller").click(
            function()
            {
                // Minimum font size - 12px
                newFontSize = getFontSize()-2;
                if( newFontSize >= 12 ) //ANN
                {
                    jQuery.cookie('fontSize', newFontSize + "px", { expires: 7 });
                    jQuery("body").css("font-size", newFontSize + "px");
                    jQuery("div#moduleArea").equalHeights();
                }
            }
        )
        jQuery("span#textLarger").click(
            function()
            {
                // Maximum font size - 21px
                newFontSize = getFontSize()+2;
                if( newFontSize <= 21 ) //ANN
                {
                    jQuery.cookie('fontSize', newFontSize + "px", { expires: 7 })
                    jQuery("body").css("font-size", newFontSize + "px");
                    jQuery("div#moduleArea").equalHeights();
                }
            }
        )
        jQuery("form#search input[name='search']").click(
            function()
            {
                jQuery(this).val('');
            }
        )
    }
)
// Get the font size of the body - returns value in pixels
function getFontSize()
{
    return parseFloat(jQuery("body").css("font-size"));
}
/*--------------------------------------------------------------------
 * JQuery Plugin: "EqualHeights"
 * by:    Scott Jehl, Todd Parker, Maggie Costello Wachs (http://www.filamentgroup.com)
 *
 * Copyright (c) 2008 Filament Group
 * Licensed under GPL (http://www.opensource.org/licenses/gpl-license.php)
 *
 * Description: Compares the heights or widths of the top-level children of a provided element
         and sets their min-height to the tallest height (or width to widest width). Sets in em units
         by default if pxToEm() method is available.
 * Dependencies: jQuery library
 * Version: 2.0, 08.01.2008
--------------------------------------------------------------------*/
jQuery.fn.equalHeights = function(px) {
    jQuery(this).each(function(){
        var currentTallest = 0;
        jQuery(this).children().each(function(i){
            jQuery(this).height('auto');
            jQuery(this).css('min-height', '0');
            if (jQuery(this).height() > currentTallest) { currentTallest = jQuery(this).height(); }
        });
        // for ie6, set height since min-height isn't supported
        if (jQuery.browser.msie && jQuery.browser.version == 6.0) { jQuery(this).children().css({'height': currentTallest}); }
        jQuery(this).children().css({'min-height': currentTallest});
    });
    return this;
};
