var g_strScrollBar;
function TT_ScrollBar(strClassName)
{
g_strScrollBar = strClassName;
this.SetRectangle = TTS_SetRectangle;
this.nTop = 0;
this.nLeft = 0;
this.nWidth = 0;
this.nHeight = 0;
this.nScrollLen = 0;
this.aRectMiddle = new Array();
this.aRectTop = new Array();
this.aRectBottom = new Array();
this.aRectBar = new Array();
this.SetImageMiddle = TTS_SetImageMiddle;
this.SetImageTop = TTS_SetImageTop;
this.SetImageBottom = TTS_SetImageBottom;
this.SetImageBar = TTS_SetImageBar;
this.MouseDown = TTS_MouseDown;
this.MouseUp = TTS_MouseUp;
this.MouseMove = TTS_MouseMove;
this.SetBarPos = TTS_SetBarPos;
this.HitTest = TTS_HitTest;
this.Show = TTS_Show;
this.event = 0;
this.bMouseDown = false;
this.SetEventHandle = TTS_SetEventHandle;
this.SetBarPosition = TTS_SetBarPosition;
this.timeOut = 0;
this.nOldHit = -2;
this.OnTimer = TTS_OnTimer;
this.bObject = false;
this.DoClose = false;
this.SetDoClose = TTS_SetDoClose;
}
function TTS_SetDoClose(obj)
{
this.DoClose=obj;
}
function TTS_SetEventHandle(Obj,bObject)
{
this.bObject=bObject;
this.event=Obj;
}
function TTSMouseDown(e)
{
TT_Doc.GetMouseKoord(e);
eval(g_strScrollBar+".MouseDown("+TT_Doc.GetX()+","+TT_Doc.GetY()+")");
return false;
}
function TTSMouseUp(e)
{
TT_Doc.GetMouseKoord(e);
eval(g_strScrollBar+".MouseUp("+TT_Doc.GetX()+","+TT_Doc.GetY()+")");
return false;
}
function TTSMouseMove(e)
{
TT_Doc.GetMouseKoord(e);
eval(g_strScrollBar+".MouseMove("+TT_Doc.GetX()+","+TT_Doc.GetY()+")");
return false;
}
function TTSMouseMoveOut(e)
{
eval(g_strScrollBar+".MouseUp();");
return false;
}
function TTS_SetRectangle(nLeft,nTop,nWidth,nHeight,strTransparent)
{
this.nTop = nTop;
this.nLeft = nLeft;
this.nWidth = nWidth;
this.nHeight = nHeight;
TT_Doc.Write("");
TT_Doc.Write("
");
TT_Doc.Write("");
TT_Doc.SetMouseEvent("MOUSEDOWN",TTSMouseDown,g_strScrollBar+"FRAMEI");
TT_Doc.SetMouseEvent("DBLCLICK",TTSMouseDown,g_strScrollBar+"FRAMEI");
TT_Doc.SetMouseEvent("MOUSEUP",TTSMouseUp,g_strScrollBar+"FRAMEI");
TT_Doc.SetMouseEvent("MOUSEMOVE",TTSMouseMove,g_strScrollBar+"FRAMEI");
TT_Doc.SetMouseEvent("MOUSEUP",TTSMouseUp,g_strScrollBar+"FRAMEO");
TT_Doc.SetMouseEvent("MOUSEMOVE",TTSMouseMoveOut,g_strScrollBar+"FRAMEO");
TT_Doc.SetMouseEvent("MOUSEOVER",TTSMouseMoveOut,g_strScrollBar+"FRAMEO");
}
function TTS_SetImageMiddle(strImage,nWidth,nHeight)
{
this.aRectMiddle[0]=this.nLeft+(this.nWidth-nWidth)/2;
this.aRectMiddle[1]=this.nTop+(this.nHeight-nHeight)/2;
this.aRectMiddle[2]=this.aRectMiddle[0]+nWidth;
this.aRectMiddle[3]=this.aRectMiddle[1]+nHeight;
TT_Doc.Write("");
TT_Doc.Write("");
//alert(this.aRectMiddle[0]+" "+this.aRectMiddle[1]+" "+this.aRectMiddle[2]+" "+this.aRectMiddle[3]);
}
function TTS_SetImageTop(strImage,nWidth,nHeight)
{
this.aRectTop[0]=this.nLeft+(this.nWidth-nWidth)/2;
this.aRectTop[1]=this.aRectMiddle[1]-nHeight;
this.aRectTop[2]=this.aRectTop[0]+nWidth;
this.aRectTop[3]=this.aRectMiddle[1];
TT_Doc.Write("");
TT_Doc.Write("");
}
function TTS_SetImageBottom(strImage,nWidth,nHeight)
{
this.aRectBottom[0]=this.nLeft+(this.nWidth-nWidth)/2;
this.aRectBottom[1]=this.aRectMiddle[3];
this.aRectBottom[2]=this.aRectTop[0]+nWidth;
this.aRectBottom[3]=this.aRectMiddle[3]+nHeight;
TT_Doc.Write("");
TT_Doc.Write("");
}
function TTS_SetImageBar(strImage,nWidth,nHeight)
{
this.aRectBar[0]=this.nLeft+(this.nWidth-nWidth)/2;
this.aRectBar[1]=this.aRectMiddle[1];
this.aRectBar[2]=this.aRectTop[0]+nWidth;
this.aRectBar[3]=this.aRectBar[1]+nHeight;
TT_Doc.Write("");
TT_Doc.Write("");
this.nScrollLen=this.aRectMiddle[3]-this.aRectMiddle[1]-nHeight;
}
function TTS_MouseDown(nX,nY)
{
clearTimeout(this.timeOut);
var nHit=this.HitTest(nX,nY);
if(nHit<0)
{
return false;
}
switch(nHit)
{
case 0:
case 1:
case 3:
case 4:
this.timeOut=setTimeout(g_strScrollBar+".OnTimer("+nHit+")",400);
if(this.bObject)
this.event.ScrollEvent(nHit);
else
this.event(nHit);
break;
default:
TT_Doc.SetLayerVisible(true,g_strScrollBar+"FRAMEO");
this.bMouseDown=true;
break;
}
return false;
}
function TTS_MouseUp(nX,nY)
{
clearTimeout(this.timeOut);
this.bMouseDown=false;
TT_Doc.SetLayerVisible(false,g_strScrollBar+"FRAMEO");
this.bMouseDown=false;
return false;
}
function TTS_MouseMove(nX,nY)
{
nHit=this.HitTest(nX,nY);
if(nHit!=this.nOldHit)
{
clearTimeout(this.timeOut);
this.nOldHit=-2;
}
if(!this.bMouseDown)
{
if(this.DoClose && nX>this.nLeft+this.nWidth+30)
{
this.DoClose.Show(false);
}
return false;
}
if(nXthis.nLeft+this.nWidth+20||nY>this.nTop+this.nHeight)
{
this.bMouseDown=false;
this.MouseUp();
return;
}
this.SetBarPos(nY);
}
function TTS_SetBarPos(nY,bNoEvent)
{
var nHeight=this.aRectBar[3]-this.aRectBar[1];
this.aRectBar[1]=Math.max(nY-nHeight/2,this.aRectMiddle[1]);
this.aRectBar[1]=Math.min(this.aRectBar[1],this.aRectMiddle[3]-nHeight);
this.aRectBar[3]=this.aRectBar[1]+nHeight;
TT_Doc.SetLayerY(this.aRectBar[1],g_strScrollBar+"BAR");
var nPercent=50;
if(this.aRectBar[1]==this.aRectMiddle[1])
nPercent=0;
else if(this.aRectBar[1]==this.aRectMiddle[3]-nHeight)
nPercent=100;
else
{
nPercent=(this.aRectBar[1]-this.aRectMiddle[1])/this.nScrollLen*100;
}
if(bNoEvent)
return;
if(this.bObject)
this.event.ScrollEvent(5,nPercent);
else
this.event(5,nPercent);
}
function TTS_HitTest(nX,nY)
{
if(nXthis.aRectTop[2] ||
nXthis.aRectMiddle[2] ||
nYthis.aRectBottom[3])
return -1;
if(nYthis.aRectMiddle[3])
return 1;
if(nY>=this.aRectBar[1]&&nY<=this.aRectBar[3])
return 2;
if(nY