revealing module pattern and timeout
===

I was wondering if someone could give me a simple solution to this. 

I want to have the two dog instances repeat the bark + wag tail combination. 

If all logic is contained within the barkNameAndTime function, I'm fine, but by calling wagTail via the setTimout I lose context. I don't write much JS so my closure knowledge is a litle rust and I can't quite seem to find a clean solutions. 

Problem is that Baloo ends up doing all the barking and tail wagging and Lola is lost in the crowd :)

Thanks
Warrick

    <script type="text/javascript">
    $(document).ready(function () {
        var zDog1 = new dog("Lola");
        var zDog2 = new dog("Baloo");

        zDog1.bark();
        zDog2.bark();
    });

    function dog(aName) {
        var name = aName,
            barkNameAndTime = function () {
                var time = new Date().getTime();
                $('#MyDiv').html($('#MyDiv').html() + "<br />" + name + " barked @ " + time);
                setTimeout(wagTail, 1000);
            };

            wagTail = function () {
                var time = new Date().getTime();
                $('#MyDiv').html($('#MyDiv').html() + "<br />" + name + "  wagged tail @ " + time);
                setTimeout(barkNameAndTime, 1000);
            }

        return {
            bark: barkNameAndTime
        };
    }

</script>

<div id="MyDiv"></div>

