var lisExtended = 0;
var lheight = 137;
var lwidth = 400;
var lslideDuration = 300;
var lopacityDuration = 500;

function closeLeftContract () {
    if (0 == lisExtended) return;
    extendLeftContract();
}

function extendLeftContract () {
    if (lisExtended == 0) {
        leftBarSlide(137, lheight, 28, lwidth);
        leftBarOpacity(0, 1);
        lisExtended = 1;
        // make expand tab arrow image face left (inwards)
        $('leftBarTab').childNodes[0].src = $('leftBarTab').childNodes[0].src.replace(/(\.[^.]+)$/, '-active$1');
    } else {
        leftBarSlide(lheight, 137, lwidth, 28);
        leftBarOpacity(1, 0);
        lisExtended = 0;
        // make expand tab arrow image face right (outwards)
        $('leftBarTab').childNodes[0].src = $('leftBarTab').childNodes[0].src.replace(/-active(\.[^.]+)$/, '$1');
    }
}

function leftBarSlide (fromHeight, toHeight, fromWidth, toWidth) {
    var myEffects = new Fx.Styles('leftBar', {duration: lslideDuration, transition: Fx.Transitions.linear});
    myEffects.custom({
         'height': [fromHeight, toHeight],
         'width':  [fromWidth, toWidth]
    });
}

function leftBarOpacity (from, to) {
    var myEffects = new Fx.Styles('leftBarContents', {duration: lopacityDuration, transition: Fx.Transitions.linear});
    myEffects.custom({
         'opacity': [from, to]
    });
}

function leftBarInit () {
    $('leftBarTab').addEvent('click', function() { extendLeftContract(); return false; });
}

