jQuery(document).ready(function(){
    //ROUNDED CORNERS
    $(function(){
        DD_roundies.addRule('.box', 10, true);
        DD_roundies.addRule('.content', 10, true);
        DD_roundies.addRule('#tweets', 10, true);
    });
    
    //HOMEPAGE CYCLE
    $('#postCard').cycle({ 
        fx: 'scrollLeft', 
        speed: 500,
        timeout: 8000,
        pager:  '#pager' 
    });

    $('#tips div').cycle({
        fx: 'scrollUp',
        speed: 300,
        timeout: 7000
    });

    //FORMS AUTO-FILL
    $('input.month').autofill({
        value: 'MM',
        defaultTextColor: '#b8c9d9',
        activeTextColor: '#1e5f97'
    });
    $('input.day').autofill({
        value: 'DD',
        defaultTextColor: '#b8c9d9',
        activeTextColor: '#1e5f97'
    });
    $('input.year').autofill({
        value: 'YYYY',
        defaultTextColor: '#b8c9d9',
        activeTextColor: '#1e5f97'
    });

    //HOME PAGE STORE LOCATOR AUTOFILL
    $('input.zip').autofill({
        value: 'Zip code',
        defaultTextColor: '#b8c9d9',
        activeTextColor: '#1e5f97'
    });


    //STORE LOCATOR AUTOFILL
    $('input.startPoint').autofill({
        value: 'Starting Address',
        defaultTextColor: '#b8c9d9',
        activeTextColor: '#1e5f97'
    });

    $('.submit').click(function(){
        $('input.destination').autofill({
            value: ''
        });
        setTimeout(destFill, 500);
    });
    
    function destFill()
    {
        $('input.destination').autofill({
            value: 'Destination (Optional)',
            defaultTextColor: '#b8c9d9',
            activeTextColor: '#1e5f97'
        });
    }

    destFill();

    //EMPLOYMENT APPLICATION PAGINATION
    $('.tab').hide();
    $('#general_tab').show();
    $('#general').addClass('activeTab');
    $('.tabLink').click(function(){
        var id = $(this).attr('id'); 
        $('.tab').hide();
        $('#' + id + '_tab').show();
        $('.tabLink').removeClass('activeTab');
        $('#' + id).addClass('activeTab');
    });

  // adds a selected class to the main nav anchor tag that is current 
  $('#main_nav li.current').each(function(){
    $('a', $(this)).addClass('selected');
  });

    $("#agreement-toggle").fancybox({
        'width'             : '75%',
        'height'            : '75%',
        'autoScale'         : false,
        'overlayColor'      : '#000',
        'overlayOpacity'    : '0.7',
        'transitionIn'      : 'elastic',
        'transitionOut'     : 'fade',
        'easingIn'          : 'swing',
        'speedIn'           : 800,
        'speedOut'          : 300,
        'type'              : 'iframe'
    });
});
