                   
function changeNavigationHeight(by, negative) {                                    
    if (Prototype.Browser.IE) {
        by += 5;
        by = negative ? (by * -1) : by;
        
        new Effect.MoveBy('wrapperBottom', by);
            
        try {
            $('navigation').style.height = (50 + by) + "px";
        } catch (e) { }
    }
    else {
        by = negative ? (by * -1) : by;
        
        new Effect.MoveBy('wrapperBottom', by);                   
                                                    
        $('navigation').style.height = (45 + by) + "px";
    }
}      

function slide_up(id) {
    var description = states[id];                    
    if (!description) {
        alert("There is no definition for " + id + "!");
        return false;                       
    }
                             
    Effect.SlideUp(id);
    changeNavigationHeight(description.height, true);
    
    description.state = false;
    states[id] = description;
    
    return true;                
}

function slide_down(id) {
    var description = states[id];                    
    if (!description) {
        alert("There is no definition for " + id + "!");
        return false;                       
    }                   
      
    Effect.SlideDown(id);
    changeNavigationHeight(description.height, false);                    
    
    description.state = true;                    
    states[id] = description;
    
    return true;                
}                           

function slide(id) {
    var description = states[id];                    
    if (!description) {
        alert("There is no definition for " + id + "!");
        return false;                       
    }
    
    for (var key in states) {
        if ((key != id) && states[key].state) {
            window.setTimeout(function(){slide(id);}, 1000);
            return slide_up(key);
        }
    }
    
    if (description.state) {                        
        return slide_up(id);
    }
      
    return slide_down(id);
}