I'm implementing a swipe left/swipe right to the mobile photo gallery so phone users can swipe between photos. It works as expected but only once. So if I swipe left or right I go to the next or previous image but then it no longer works.

Code:
<script>    
<? if ($prev != '') { ?>

$(function(){       
$("#home").bind('swiperight',function(event, ui){
$.mobile.changePage("/photo.php?id=<?=$prev?>&album=<?=$album?>", "slide");
});       
});

<? } if ($next != '') { ?>
$(function(){        
$("#home").bind('swipeleft',function(event, ui){
$.mobile.changePage("/photo.php?id=<?=$next?>&album=<?=$album?>", "slide");
});       
});
<? } ?>
        </script>
Help?