$(document).ready( function() {
    
    initMenu();
    initCarousel();
    
    //header menu: search button actions
    $('#headerMenuSearch').toggle( 
        function() {
            $('#topSearch').show(200, function(){
                $('#headerMenuSearch').addClass('selected');
                $('#topSearch .submit').show();
                $('#topSearch .text').focus();
            });
            
        }, 
        function() {
            $('#topSearch').hide(200, function(){
                $('#headerMenuSearch').removeClass('selected');
                $('#topSearch .submit').hide();
            });
        } 
    );
    
    //forms: set focus to highlighted error input
    if( formErrorsExist ) 
    {
        $('form .inputError').focus();
    }    
    
    //forms: reset styles for highlighted error inputs
    $( 'form .inputError' ).click( function() {
        $('form .inputError').removeClass( 'inputError' );
    });
    $( 'form .inputError' ).change( function() {
        $('form .inputError').removeClass( 'inputError' );
    });
    
    //forms: submit form when enter key is pressed in text inputs
    $('input').keydown( function(e) {
        if( e.keyCode == 13 ) {
            $(this).parents('form').submit();
            return false;    
        }
    });
    
    
    
});	
