

if(window.scrollbars)
window.scrollbars.visible=false;
var DOM=(document.getElementById?true:false);
var IE4=((document.all&&!DOM)?true:false);
var NS4=(document.layers?true:false);
var Dyn=(DOM||IE4||NS4);
function getRef(id){
    if(DOM)
        return document.getElementById(id);
    if(IE4)
        return document.all[id];
    if(NS4
        )return document.layers[id];
}

function getSty(id){
    return (NS4 ? getRef(id) : getRef(id).style);
}

function scrFileLoaded(){with(this){activeScr=null;scrollBy(-100000);for(count=0;count<divs.length;count++)getSty(divs[count][0]).visibility='visible';}}
function scrScrollBy(amount){
    with(this){
        if(!Dyn||!loaded)
            return;
        amount=parseInt(amount);
        divHeight=document.all?divRef.clientHeight:(DOM?divRef.offsetHeight:divRef.document.height);
        if(divHeight==0)
            divHeight=1;
        if((cBot+amount)>=divHeight)
            amount=divHeight-cBot;
        if((cTop+amount)<0)
            amount=0-cTop;
        cTop+=amount;cBot+=amount;
        if(DOM||IE4)
            divSty.clip='rect('+cTop+'px '+cWidth+'px '+cBot +'px 0px)';
        else if(NS4){
            if(isNaN(cTop)||isNaN(cBot)||isNaN(amount))
                layout();
            if(cBot<divSty.clip.top)
                divSty.clip.top=cTop+'px';
            divSty.clip.bottom=cBot+'px';
            divSty.clip.top=cTop+'px';
        }
        divSty.top=(eval(divs[0][2])-cTop)+'px';
        thmHeight=10;
        if(thmHeight<minThmHeight)
            thmHeight=minThmHeight;
        if(thmHeight>barHeight)
            thmHeight=barHeight;
        if(DOM||IE4)
            thmSty.height=thmHeight+'px';
        else if(NS4)
            thmSty.clip.height=thmHeight+'px';
        if(activeScr)
            return;
        fracDivDown=(cTop/(divHeight-(cBot-cTop)));
        fracDivDown=(isNaN(fracDivDown))?0:fracDivDown;
        thmSty.top=(parseInt(barSty.top)+fracDivDown*(barHeight-thmHeight))+'px';
        if(loop)
            setTimeout(myName+'.scrollBy('+amount+')',loop);
    }
}

function scrThumbDown(evt){activeScr=this;if(document.all)scrOffset=event.offsetY;else scrOffset=evt.layerY;return false;}
function scrThumbMove(evt){
    if(NS4)
        document.routeEvent(evt);
    if(!activeScr)
        return true;
    else {
        with(activeScr){
            if((cBot>divHeight)||(thmHeight==barHeight))
                return;
            if (document.all)
                newTop=document.body.scrollTop+event.clientY-scrOffset;
            else newTop=evt.pageY-scrOffset;
            var barTop=parseInt(barSty.top);
            if(newTop<barTop)newTop=barTop;
            if(newTop+thmHeight>(barTop+barHeight))
                newTop=(barTop+barHeight)-thmHeight;
            thmSty.top=newTop+'px';
            fracDivDown=cTop/(divHeight-(cBot-cTop));
            fracBarDown=(newTop-barTop)/(barHeight-thmHeight);
            if(isNaN(fracDivDown))
                return;
            scrollBy((fracBarDown-fracDivDown)*(divHeight-(cBot-cTop)));
            return false;
        }
    }
}

function scrThumbUp(evt){if(NS4)document.routeEvent(evt);activeScr=null;}
function scrBarClick(evt){with(this){if(NS4)document.routeEvent(evt);if(document.all)clickPos=document.body.scrollTop+event.clientY;else clickPos=evt.pageY;if(clickPos<parseInt(thmSty.top))scrollBy(cTop-cBot);if(clickPos>(parseInt(thmSty.top)+thmHeight))scrollBy(cBot-cTop);}}
function scrLayout(){
    with(this){
        if(!Dyn)
            return;
        winWidth=getWidth();
        winHeight=getHeight();
        if(NS4&&(scrFirstWidth!=winWidth)){
            fileName=location.href;
            if(fileName.indexOf('?')!=-1)
                fileName=fileName.substring(0,fileName.indexOf('?'));
            location.href=fileName+'?loadFile='+divRef.src;
        }
        if(!loaded)
            return;
        if(winWidth<minWinWidth)
            winWidth=minWinWidth;
        if(winHeight<minWinHeight)
            winHeight=minWinHeight;
        for(count=0;count<divs.length;count++){
            var tmpObj=getSty(divs[count][0]);

            if(divs[count][1]){
                tmpObj.left=eval(divs[count][1])+'px';
            }
            if(divs[count][2]){
                tmpObj.top=eval(divs[count][2])+'px';
            }
            if(divs[count][3]){
                var tmpW=eval(divs[count][3])+'px';
                NS4 ? tmpObj.clip.width=tmpW : tmpObj.width=tmpW;
            }
            if(divs[count][4]&&count!=0){
                var tmpH=eval(divs[count][4])+'px';
                NS4? tmpObj.clip.height=tmpH : tmpObj.height=tmpH;
            }
        }
        if((DOM||IE4)&&!cTop)
            cTop=0;
        if(NS4)
            cTop=divSty.clip.top;
        barHeight=eval(divs[1][4]);
        cBot=cTop+eval(divs[0][4]);
        cWidth=eval(divs[0][3]);
        if(DOM||IE4)
            divSty.width=cWidth;
        scrollBy(0);
    }
}

function scrSetup(){
    with(this){
        if(!Dyn)
            return;
        divRef=getRef(divs[0][0]);
        divSty=getSty(divs[0][0]);
        barSty=getSty(divs[1][0]);
        thmSty=getSty(divs[2][0]);
        barRef=getRef(divs[1][0]);
        thmRef=getRef(divs[2][0]);
        if(NS4){
            barRef.captureEvents(event.CLICK);
            thmRef.captureEvents(event.MOUSEDOWN);
            document.captureEvents(event.MOUSEMOVE|event.MOUSEUP);
        }
        thmRef.onmousedown=new Function(
            'evt','return '+myName+'.thumbDown(evt)');
        document.onmousemove=scrThumbMove;
        document.onmouseup=scrThumbUp;
        if(document.all)
            document.onselectstart=new Function('if(activeScr) return false');
        else if(DOM)
            document.onselect=new Function('if(activeScr) return false');
        loaded=true;
        layout();
        fileLoaded();
    }
}
function DHTMLScroller(myName){this.divRef=null;this.divSty=null;this.barSty=null;this.thmSty=null;this.divs=new Array();this.bufRef=null;this.myName=myName;this.loaded=false;this.loop=0;this.minThmHeight=20;this.divHeight=0;this.barHeight=0;this.thmHeight=0;this.cTop=0;this.cBot=0;this.cWidth=0;this.fileLoaded=scrFileLoaded;this.scrollBy=scrScrollBy;this.thumbDown=scrThumbDown;this.setup=scrSetup;this.layout=scrLayout;}
var activeScr=null,scrOffset=0,winWidth,winHeight,scrFirstWidth=window.innerWidth,mainDiv,mainDiv2,mainDiv3,mainDiv4,minWinWidth=500,minWinHeight=300;
function getWidth(){if(window.innerWidth)return window.innerWidth;else return document.body.offsetWidth-2;}
function getHeight(){if(window.innerHeight)return window.innerHeight;else return document.body.offsetHeight-4;}
function getDivWidth(){return getWidth()-302;}
function getDivHeight(){return getHeight()-97;}
function getScrollX(){return getWidth()-16;}
function getScrollY(){return getHeight()-16;}
function getScrollHeight(){return getHeight()-121;}
var interval;

mainDiv1=new DHTMLScroller('mainDiv1');
with (mainDiv1){
 divs[0] = new Array('mainContentDiv', '186', '92', '447', '379');
 divs[1] = new Array('scrollBar', '637', '107', '14', '349');
 divs[2] = new Array('scrollThumb', '639', '', '10', '');
 divs[3] = new Array('upArrows', '637', '91', '14', '16');
 divs[4] = new Array('downArrows', '637', '456', '14', '16');
}

mainDiv2=new DHTMLScroller('mainDiv2');
with (mainDiv2){
 divs[0] = new Array('mainContentDiv2', '380', '92', '249', '379');
 divs[1] = new Array('scrollBar2', '637', '107', '14', '349');
 divs[2] = new Array('scrollThumb2', '639', '', '10', '');
 divs[3] = new Array('upArrows2', '637', '91', '14', '16');
 divs[4] = new Array('downArrows2', '637', '456', '14', '16');
}

mainDiv3=new DHTMLScroller('mainDiv3');
with (mainDiv3){
 divs[0] = new Array('mainContentDiv3', '182', '249', '153', '221');
 divs[1] = new Array('scrollBar3', '339', '265', '14', '189');
 divs[2] = new Array('scrollThumb3', '341', '', '10', '');
 divs[3] = new Array('upArrows3', '339', '249', '14', '16');
 divs[4] = new Array('downArrows3', '339', '454', '14', '16');
}

mainDiv5=new DHTMLScroller('mainDiv5');
with (mainDiv5){
 divs[0] = new Array('mainContentDiv5', '182', '91', '134', '380');
 divs[1] = new Array('scrollBar5', '323', '107', '14', '349');
 divs[2] = new Array('scrollThumb5', '325', '', '10', '');
 divs[3] = new Array('upArrows5', '323', '91', '14', '16');
 divs[4] = new Array('downArrows5', '323', '456', '14', '16');
}

mainDiv4=new DHTMLScroller('mainDiv4');
with (mainDiv4){
 divs[0] = new Array('mainContentDiv4', '365', '91', '264', '380');
 divs[1] = new Array('scrollBar4', '637', '107', '14', '349');
 divs[2] = new Array('scrollThumb4', '639', '', '10', '');
 divs[3] = new Array('upArrows4', '637', '91', '14', '16');
 divs[4] = new Array('downArrows4', '637', '456', '14', '16');
}
