/* This script for sliding images open and shut */

cxOpened=760
cxClosed=50
cxDiff=cxOpened-cxClosed
iTimeDelay=10
maxTxt=600
cyBottom=5
iWideOne=1
slidehandle=0


timerBox=""

function stopMe(){
  clearTimeout(timerBox)
}

function OpenSlider(numslider){
    if (numslider != iWideOne){
        if (slidehandle == 0) {
            slidehandle = 1;
            scrollAndExpandByNumber(iWideOne,numslider,1);
            }
        }
  }

function scrollAndExpandFAST(idToShrink,idToGrow,iNum)
{
    var i = 1;
    
    for(i=1; i<= cxDiff; i++)
    {
        document.getElementById(idToShrink).style.width = (cxOpened - i) +'px';
        document.getElementById(idToGrow).style.width = (cxClosed + i) +'px';
        
    }
}

function scrollAndExpandByNumber(iShrink,iGrow,iNum)
{
    document.getElementById('div'+iShrink).style.width = (cxOpened - iNum) +'px';
    document.getElementById('text'+iShrink).style.width = (cxOpened - iNum) +'px';
    document.getElementById('top'+iShrink).style.width = (cxOpened - iNum) +'px';

    document.getElementById('div'+iGrow).style.width = (cxClosed + iNum) +'px';
    document.getElementById('text'+iGrow).style.width = (cxClosed + iNum) +'px';
    document.getElementById('top'+iGrow).style.width = (cxClosed + iNum) +'px';

    iNum = iNum + 25;
    
    if (iNum < cxDiff){
        timerBox=setTimeout("scrollAndExpandByNumber("+iShrink+","+iGrow+","+iNum+")",iTimeDelay);
        }
    else{
        iWideOne = iGrow;
        document.getElementById('div'+iShrink).style.width = cxClosed+'px';
        document.getElementById('div'+iGrow).style.width = cxOpened+'px';
        document.getElementById('text'+iShrink).style.width = cxClosed+'px';
        document.getElementById('text'+iGrow).style.width = cxOpened+'px';
        document.getElementById('top'+iShrink).style.width = cxClosed+'px';
        document.getElementById('top'+iGrow).style.width = cxOpened+'px';
        stopMe();
        if (iWideOne==1)
            shrinkHeight('botcontainer',1);
        else
            growHeight('botcontainer',1);
            
        // release the slidehandle
        slidehandle=0;
    }
}
function shrinkHeight(id,iNum)
{
    if (cyBottom != 5)
    {
    document.getElementById(id).style.height = (maxTxt - iNum) +'px';
    iNum = iNum + 40; 

    if (iNum < maxTxt){
        setTimeout("shrinkHeight('"+id+"',"+iNum+")",iTimeDelay);    
        }
    else{
        document.getElementById(id).style.height = '0px';
        cyBottom=5;
        }
    }
}
function growHeight(id,iNum)
{
    if (cyBottom != maxTxt)
    {
    document.getElementById(id).style.height = (5 + iNum) +'px';
    iNum = iNum + 25;

    if (iNum < maxTxt){
        setTimeout("growHeight('"+id+"',"+iNum+")",iTimeDelay);    
        }
    else{
        document.getElementById(id).style.height = maxTxt + 'px';
        cyBottom=maxTxt;
        }
    }
}
