$(function() {

    // animate the flashMessage
    $('div#flashMessage').animate({ backgroundColor: '#222222' }, 10000).fadeOut('slow');

    // swap values on form
    swapValues = [];
    $('.swap-value').each(function(i){
        $(this).prev('label').css('display','none');
        swapValues[i] = $(this).val();
        $(this).focus(function(){
            if ($(this).val() == swapValues[i]) {
                $(this).val('');
            }
        }).blur(function(){
            if ($.trim($(this).val()) == '') {
                $(this).val(swapValues[i]);
            }
        });
    });

    // validate the search form
    $('#SearchIndexAddForm').submit(function() {
        if ($('#SearchSearch').val() != 'Search') {
            return true;
        }
        return false;
    });

    // validate the subscribe form
    $('#SubscriberSubscribeForm').submit(function() {
        if ($('#SubscriberEmail').val() != 'your email address') {
            return true;
        }
        return false;
    });

    $('div.homepage:first').addClass('alpha');

    // validate forms
    if ($('form.validate').length > 0) {
        $('form.validate').validate();
    }
});

