<!--
docIncr = 8;
barWidth = 16;
thumbMinHeight = 10;
origInt = 50;  //first click on scroll bar time delay
repeatInt = 50; // move scroll bar after this millisec
initTimer = null;
scrollTimer = null;
bgTimer = null;
thumbTimer = null;
curY = null;
butImage = null;
setScroll = [];
setScrollCount=0;
actHeight=[];
actHeightCount=0;
var actCont,actButton;
function tellme(){
//alert(thumbMaxTop);
sMain = this;
actCont = this.parentLayer;
sThumb = actCont.layers[1].layers[2];
sThumbBot = actCont.layers[1].layers[2].layers[0];

scrollCalc();
actThumb.top = 16;
docAlign();
}
function initScroll(){
for(i=0;i<setScroll.length;i++){
sObj =  eval("document."+setScroll[i])//browser(setScroll[i]);
sMain = sObj.layers[0];
sMain.onload = tellme;
actHeight[sMain.id] = sMain.clip.height;
actHeightCount++;
sScroll = sObj.layers[1];
sThumb = sObj.layers[1].layers[2];
sThumbBot = sObj.layers[1].layers[2].layers[0];
sButtonbot = sObj.layers[1].layers[3];
sBG = sObj.layers[1].layers[1];
sThumb.onmouseover = thumbOn;//drag;
sThumb.onmouseout = thumbOff;
sBG.onmouseover = barOn;
sMain.onmouseover = barOff;
sObj.onmouseout = barOff;
sButtonbot.document.images[0].direction = 1;
sButtonbot.document.images[0].main = sMain;
sButtonbot.document.images[0].thumb = sThumb;
sButtonbot.document.images[0].onmouseover = downArrow;
sScroll.document.images[0].direction = 0;
sScroll.document.images[0].main = sMain;
sScroll.document.images[0].thumb = sThumb;
sScroll.document.images[0].onmouseover = downArrow;
sScroll.origTop = sScroll.top;
scrollCalc();
}//end func
}
function scrollCalc(){
docHeight = sMain.document.height;
lyrHeight = sMain.clip.height;
	if (docHeight <= lyrHeight){
    sScroll.visibility = "hide";
    return;
	}
	if (docHeight > lyrHeight){
    sScroll.visibility = "show";
	}

elvBarHeight = sMain.clip.height - (barWidth*2);
thumbHeight = Math.max((lyrHeight*elvBarHeight)/docHeight,thumbMinHeight)
sThumb.clip.height = thumbHeight;
sThumbBot.top = thumbHeight -sThumbBot.clip.height;
thumbMaxTop = (elvBarHeight + barWidth) - thumbHeight;
docToTravel = docHeight - lyrHeight;
scrToTravel = elvBarHeight - thumbHeight;
scrPixels = scrToTravel/docToTravel;
docPixels = docToTravel/scrToTravel;
}//end func
function butMove(){
actCont = actMain.parentLayer;
actThumb.origTop = actThumb.top;
if(dir == 1){
actThumb.top = Math.min(actThumb.top + actThumb.clip.height,actCont.layers[1].layers[3].top - actThumb.clip.height);
}else{
actThumb.top = Math.max(actThumb.top-docIncr-barWidth,actThumb.origTop-actThumb.top+barWidth) ;//: Math.min(actMain.top+docIncr,actMain.origTop);
}
docAlign();
}//end func
function butHold(){
captureEvents(Event.MOUSEUP);
onmouseup = upArrow;
initTimer = setTimeout("scrollTimer = setInterval(butMove,repeatInt)",origInt);
}//end func
function clearTimers(){
clearTimeout(initTimer);
clearInterval(scrollTimer);
clearTimeout(bgTimer);
clearInterval(thumbTimer);
bgTimer = thumbTimer = null;
}//end func
function upArrow(){
clearTimers();
thumbOff();
}//end func
function downArrow(e){
actThumb = this.thumb;
actMain = this.main;
dir = this.direction;
captureEvents(Event.MOUSEDOWN)
onmousedown = butHold;
}//end func
function drag(e){
curY = e.pageY;
captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);
onmousemove = thumbMove;
onmouseup = thumbOff;
return false;
}//end func
function thumbOff(){
releaseEvents(Event.MOUSEMOVE);
}//end func
function thumbMove(e){
difY = e.pageY - curY;
actThumb.top = Math.min(Math.max(actThumb.top+difY,barWidth),thumbMaxTop);
docAlign();
curY = e.pageY;
}//end func
function thumbOn(e){
actThumb = this;
actMain = this.parentLayer.parentLayer.layers[0];
dir = (e.pageY < actThumb.pageY) ? 0 : 1;
onmousedown = drag;
}//end func
function barClick(e){
if (e.pageY > actThumb.pageY && e.pageY <= actThumb.pageY+actThumb.clip.height) {bgUp();return}
actThumb.top = Math.min(Math.max(actThumb.top + actThumb.clip.height * dir,barWidth),thumbMaxTop);
docAlign();
}//end func
function barStick(e){
dir = (e.pageY < actThumb.pageY) ? -1 : 1;
captureEvents(Event.MOUSEUP);
onmouseup = bgUp;
barClick(e);
ev = e;
bgTimer = setTimeout("thumbTimer = setInterval(barClick,repeatInt,ev)",origInt);
return false;
}//end func
function barOn(e){
curY = e.pageY;
actThumb = this.parentLayer.layers[2];
actMain = actThumb.parentLayer.parentLayer.layers[0];
captureEvents(Event.MOUSEDOWN);
onmousedown = barStick;
}//end func
function barOff(){
releaseEvents(Event.MOUSEDOWN);
}//end func

function bgUp(){
clearTimers();
releaseEvents(Event.MOUSEUP);
return false;
}//end func
function docAlign(){
thumbDiff = actThumb.top - barWidth;
actMain.top = 2 - (thumbDiff*docPixels);
actMain.clip.top = (thumbDiff*docPixels);
actMain.clip.height = actHeight[actMain.id];
}//end func
function eventBuilder(name,src,w,h){
setScroll[setScrollCount] = name+"Cont";
setScrollCount++;

if(NS4){
eventToBuild = '<LAYER ID="'+name+'Cont" WIDTH='+w+' BGCOLOR=000000 CLIP='+w+','+h+' visibility="hide">';
eventToBuild+= '<LAYER ID="'+name+'Main" SRC="'+src+'" TOP=1 LEFT=1 WIDTH='+(w-24)+' BGCOLOR=ffffff CLIP=0,0,'+(w-2)+','+(h-3)+'></LAYER>';
eventToBuild+= '<LAYER ID="'+name+'Scroll" LEFT='+(w-17)+' TOP=2 WIDTH=16 CLIP=16,'+(h-3)+'>';
eventToBuild+= '<IMG SRC="http://graphics.fansonly.com/graphics/scroll-img/butTu.gif" WIDTH=16 HEIGHT=16 BORDER=0 HSPACE=0 VSPACE=0>';
eventToBuild+= '<LAYER ID="'+name+'BGcol" LEFT=0 TOP=16 CLIP=16,'+(h)+' BACKGROUND="http://graphics.fansonly.com/graphics/scroll-img/barBgBl.gif"></LAYER>';
eventToBuild+= '<LAYER ID="'+name+'BG" LEFT=0 TOP=16 CLIP=16,'+(h)+' BACKGROUND="http://graphics.fansonly.com/graphics/scroll-img/barBg.gif"></LAYER>';
eventToBuild+= '<LAYER ID="'+name+'Thumb" LEFT=0 TOP=16 WIDTH=16 CLIP=16,'+(h)+' BACKGROUND="http://graphics.fansonly.com/graphics/scroll-img/tmbBg.gif">';
eventToBuild+= '<IMG SRC="http://graphics.fansonly.com/graphics/scroll-img/tmbTop.gif" WIDTH=16 HEIGHT=2 BORDER=0 HSPACE=0 VSPACE=0 ALIGN=RIGHT>';
eventToBuild+= '<LAYER ID="'+name+'ThumbBot" LEFT=0 TOP=0 WIDTH=16 CLIP=16,2>';
eventToBuild+= '<IMG SRC="http://graphics.fansonly.com/graphics/scroll-img/tmbBot.gif" WIDTH=16 HEIGHT=2 BORDER=0 HSPACE=0 VSPACE=0 ALIGN=RIGHT></LAYER>';
eventToBuild+= '</LAYER>';
eventToBuild+= '<LAYER ID="'+name+'ButtonBot" LEFT=0 TOP='+(h-19)+' WIDTH=16 CLIP=16,16>';
eventToBuild+= '<IMG SRC="http://graphics.fansonly.com/graphics/scroll-img/butBu.gif" WIDTH=16 HEIGHT=16 HSPACE=0 BORDER=0></LAYER>';
eventToBuild+= '</LAYER>';
eventToBuild+= '</LAYER>';
}else{
eventToBuild = '<iframe id="'+name+'ContIE" width='+w+' height='+h+' src="'+src+'" style="visibility:hidden;" marginheight=0 marginwidth=0 noresize frameborder=0 scrolling="yes">';
eventToBuild+= '</iframe>';
}
document.write(eventToBuild);
}
function recalc(targ){
if(NS4){
var loadObj = browser(targ);
//alert(loadObj.layers[0].clip.width);
sMain = loadObj.layers[0];
sScroll = loadObj.layers[1];
sThumb = loadObj.layers[1].layers[2];
sThumbBot = loadObj.layers[1].layers[2].layers[0];
actMain = loadObj.layers[0];
actThumb = loadObj.layers[1].layers[2];

}
}
tabgroups =[];
tabgroups["centertabs"] = 3;
tabgroups["sidetabs"] = 4;

tabonbg =[];
tabonbg["centertabs"] = '0c2475';
tabonbg["sidetabs"] = '0c2475';

taboffbg =[];
taboffbg["centertabs"] = '4a5d97';
taboffbg["sidetabs"] = '4a5d97';

function getTabCount(tab){
tabObj = tab.split("_");
for(i=tabgroups[tabObj[0]];i>0;i--){
(!NS4) ? browser(tabObj[0]+"_"+i).style.backgroundColor = taboffbg[tabObj[0]]: browser(tabObj[0]+"_"+i).bgColor = taboffbg[tabObj[0]];

}
(!NS4) ? browser(tab).style.backgroundColor = tabonbg[tabObj[0]]: browser(tab).bgColor = tabonbg[tabObj[0]];
//alert(tabgroups[tabObj[0]]);
}

function loadnew(targ,file,tab,scrollable){
 //browser(tab).style.backgroundColor = '0c2475';
 getTabCount(tab)
if(NS4){
var loadObj = browser(targ);

	if (scrollable){
	loadObj.layers[0].load(file,loadObj.layers[0].clip.width)
	}else{
	loadObj.load(file,loadObj.clip.width);
	}

}else{
var loadObj = browser(targ+"IE");
	loadObj.src = file;
}
}//end func

