problem with SetInterval and ClearInterval

problem with SetInterval and ClearInterval

Dear Members,
I'm totally newbie at jQuery but trying to build own slideshow with autoplay function.
Here's a snippet of code I have problem with:

  1.  $("h2.play").toggle(function()
            {
                
             $(this).addClass("pause");
             var intervalID = setInterval(function(){
                                                    $(".content ul>li:nth-child("+count+")").fadeOut('slow');
                                                        count++
                                                    if (count == total) {count = 1;}
                                                    $(".content ul>li:nth-child("+count+")").fadeIn('slow');
                                                },autoplay_speed);
            },
            function(){
            $(this).removeClass("pause");
                clearInterval(intervalID);
            });
         















h2.play triggers the setInterval for changing images set within <li>
I put toggle function to switch between two states of button (play/pause).
When I launch play button the autoplay of slides starts without problem.
The issue comes when I switch the button to pause - the animation does not stops.
I need also solution to re-start the animation after press play.

Could You help me advice to the issue above?
I will appreciate Your help.

Thank You,