﻿jQuery(function() {
jQuery('#mc_embed_signup label[for=MERGE0]').each(function() {
        // style the label with JS for progressive enhancement
        jQuery(this).css({
            'position': 'absolute',
            'top': '6px',
            'left': '8px',
            'margin': 'auto',
            'display': 'inline',
            'z-index': '99'
        });

        // grab the input value
        var inputval = jQuery(this).next('input').val();

        //onload, check if a field is filled out, if so, move the label out of the way
        if (inputval !== '') {
            jQuery(this).stop().animate({ 'top': '30px' }, 1);
        }

        // if the input is empty on focus move the label to the left
        // if it's empty on blur, move it back
        jQuery('input').focus(function() {
            var label = jQuery(this).prev('label');
           
            var value = jQuery(this).val();

            if (value == '') {
                label.stop().animate({ 'top': '30px' }, 'fast');
            } else {
                label.css({ 'top': '35px' });
            }
        }).blur(function() {
            var label = jQuery(this).prev('label');
            var value = jQuery(this).val();
            if (value == '') {
                label.stop().animate({ 'top': '6px' }, 'fast');
            }
        });
    })
});
