
var tableAll, saske, naruto;
var panelCenter, panelLeft, panelRight;
var frameCenter, frameLeft, frameRight;
var panelWidth;
var visiblePanel;
var expandObj, aftermath;
var isRunning, openingTimer, firstRun;

function showPanel(panel, expre) {
    if(!initDone) return;
    
    if(openingTimer) clearTimeout(openingTimer);
    if(isRunning) return;
    isRunning = true; expandObj = panel; aftermath = expre;
    
    hide(frameCenter); hide(frameLeft); hide(frameRight);
    expandShrink();
}

function expandShrink() {
    currentWidth = (widthof(expandObj))? widthof(expandObj): 0;
    if(currentWidth >= panelWidth)
         { isRunning = false; visiblePanel = expandObj; aftermath(); }
    else {
        currentWidth += ceil((panelWidth-currentWidth) * 0.3);
        expandObj.style.width = currentWidth;
        if(visiblePanel)
            visiblePanel.style.width = panelWidth - currentWidth;
        setTimeout("expandShrink()", 10);
    }
}

function showCenterFrame() {
    obj('narutopanel').style.backgroundPosition = 'bottom left';
    obj('saskepanel').style.backgroundPosition = 'bottom right' ;
    naruto.title = 'Tagboard at Random quotes generator!';
     saske.title = 'Ang aking mga walang katuturang blog entries.';
    show(frameCenter);
}

function showLeftFrame() {
    naruto.title = 'Go to home page!';
     saske.title = 'Ang aking mga walang katuturang blog entries.';
     
    frameLeft.style.height = heightof(window);
    show(frameLeft);
}

function showRightFrame() {
    naruto.title  = 'Tagboard at Random quotes generator!';
     saske.title  = 'Go to home page!';
     
    frameRight.style.height = heightof(window);
    show(frameRight);
}

function narutoClick() {
    if(visiblePanel == panelLeft)
         showPanel(panelCenter, showCenterFrame);
    else showPanel(panelLeft, showLeftFrame);
}

function saskeClick() {
    if(visiblePanel == panelRight)
         showPanel(panelCenter, showCenterFrame);
    else showPanel(panelRight, showRightFrame);
}

function opencomment(n) {
    height = 440;
    width  = 420;
    wtop   = Math.round(heightof(screen)/2 - height/2); 
    wleft  = Math.round( widthof(screen)/2 -  width/2);
    
    window.open('blog/hamu/comment.php?form=1&entry='+n, '', 'width='+width+',height='+height+',top='+wtop+',left='+wleft+',resizable,scrollbars');
}