    var no_over_state = false;
    
    function menu_hover ( menu_item )
    {
        $(menu_item).hover ( 
            function ()
            {
                var src = $(this).attr ( 'src' );
                if ( src.indexOf ( '_over' ) != -1 )
                {
                    no_over_state = true;
                }
                else
                {    
                    $(this).attr ( 'src', src.replace( '.gif', '_over.gif' )  );
                    no_over_state = false;
                }
            },
            function ()
            {                
                var src = $(this).attr ( 'src' );
                if ( no_over_state == false)
                {
                    $(this).attr ( 'src', src.replace(  '_over.gif', '.gif' )  );
                }
            });   
    }
    
    // initialise plugins
    $(function(){
        $('ul.sf-menu').superfish(
            {
                autoArrows:    false 
            });
        
        
        
        menu_hover ( $('ul.sf-menu li a img') );
            
        $('ul.sf-menu li ul li').hover ( 
            function ()
            {
                var src = $(this).parent().parent().children('a').children('img').attr('src');
                if ( src.indexOf ( '_over' ) != -1 )
                {
                    no_over_state = true;
                }
                else
                {    
                    $(this).parent().parent().children('a').children('img').attr ( 'src', src.replace( '.gif', '_over.gif' )  );
                    no_over_state = false;
                }
                $(this).css ( 'background', '#40A5B6' );
                $(this + 'a').css ( 'background', '#40A5B6' );
            
            },
            function ()
            {
                var src = $(this).parent().parent().children('a').children('img').attr ( 'src' );
                if ( no_over_state == false)
                {
                    $(this).parent().parent().children('a').children('img').attr ( 'src', src.replace(  '_over.gif', '.gif' )  );
                }
                $(this).css ( 'background', '#00879E' );
                $(this + 'a').css ( 'background', '#00879E' );
            });
    });
