function switchDiv(divId) {
    var elements = document.getElementsByClassName("active");
    var removed = false;
    for(var i=0; i < elements.length; i++) {
        if(elements[i].id != divId) {
            Effect.BlindUp(elements[i], {queue: 'front', duration: .5});
            elements[i].removeClassName("active");
            removed = true;
        }
    }
    if(!$(divId).hasClassName("active")) {
        Effect.BlindDown($(divId), {queue: 'end', duration: .5});
        $(divId).addClassName("active");
    }
}

function displayImage(imgPath, divId, width, height) {
	MdaradUtils.deleteAllChildren($(divId));
    $(divId).appendChild(Builder.node("img", {src: imgPath}));
    
    win = new Window({
        className: "accopilot", 
        title: "", 
        width: width,
        height: height,
        minWidth: width,
        minHeight: height,
        maxWidth: 790,
        maxHeight: 550,
        showEffect: Effect.Appear, 
        hideEffect: Effect.Fade,
        resizable: false, 
        draggable: true, 
        minimizable: false,
        maximizable: false,
        wiredDrag: false
    });
    win.setContent(divId, true, true);
    win.updateWidth();
    win.updateHeight();
    win.showCenter(true);    
}
            
function openCorrectTab() {
    var tabName = MdaradUtils.getURLParameter("tab");
    if(tabName && tabName != '') {
        switchDiv(tabName);
    }
}

