// Utility functions needed all over the app
jQuery(document).ready(function() {

    // Flash Messages
    //TODO Change to a nicer jquery plugin growl/element one?
    // auto remove success msgs
    setTimeout(function() {
         jQuery('div.success, div#flashMessage.message').slideUp(400);
    }, 3000);
    // add click to remove to all other flash msgs
    jQuery('.flash').click(function() {
        jQuery('.flash').slideUp(400);
    });
    jQuery('#authMessage').click(function() {
        jQuery('#authMessage').slideUp(400);
    });

    // Dsis template datepicker class, add class in the form helper :
    // $this->Form->input('date', array('type' => 'text', 'class' => 'datepicker'));
    jQuery( ".datepicker" ).datepicker({ dateFormat: 'yy-mm-dd' });

    // remove text from newsletter signup form on click
    jQuery('#NewsletterEmail').click(function() {
        jQuery(this).val('');
    });

    // add a last-child class to last image in image-bar-horiz
    jQuery('div.image-bar-horiz img:last').addClass('img-last');
});

