限制.Toggleclass一次一个?

Currently have this code that swaps classes whenever an image is clicked , and it is inside a PHP Html Loop to create the image buttons for every content post, but I want to limit the class swapping to be one at a time, So if I click the image in another post, the other posts' images will return to default. Any ideas?

{LOOP: STORIES}
<script type="text/javascript">

 $("#{STORIES.story_id}6 :image").click(function() {
        widget.toggle();
        $("#{STORIES.story_id}6").toggleClass('buyy');
};
</script>

<span class="buy" id="{STORIES.story_id}6"><input type="image" class="TEST"></input></span>
{/LOOP: STORIES}