var creditState = 'closed';
    var toggleCredits = function() {
        if (creditState == 'closed') {
            setCredits();
        } else {
            wipeCredits();
        }
    }
    var wipeCredits = function() {
        var div = AJS.$('credits');
        AJS.fx.setWidth(div, {
            from: 200,
            to: 205,
            onComplete: function() { 
                AJS.fx.fadeOut(AJS.$('site_credits_text'));
                AJS.fx.setWidth(div, {
                from: 205,
                to: 80,
                duration: 1000,
                onComplete: function() {
                    AJS.$('site_credits').style.display='inline';
                    AJS.setOpacity(AJS.$('site_credits'), 0);
                    AJS.fx.fadeIn(AJS.$('site_credits'));
                    AJS.$('site_credits_text').style.display='none';
                    //AJS.fx.highlight(div);
                }});
            }});
            creditState = 'closed';        
    }  
    var setCredits = function() {
        var div = AJS.$('credits');
        AJS.fx.setWidth(div, {
            from: 80,
            to: 200,
            duration: 1000,
            onComplete: function() { 
                AJS.fx.fadeOut(AJS.$('site_credits'));
                    AJS.$('site_credits_text').style.display='inline';
                    AJS.setOpacity(AJS.$('site_credits_text'), 0);
                    AJS.fx.fadeIn(AJS.$('site_credits_text'));
                    AJS.$('site_credits').style.display='none';
                    //AJS.fx.highlight(div);
            }});            
            creditState = 'open';        
    }