var speed=15;
var loop,timer;
var px="px";

function makeObj(obj,nest)
{
nest=(!nest)?"":'document.'+nest+'.';
this.el=document.getElementById(obj);
this.css=document.getElementById(obj).style;
this.scrollHeight=this.el.offsetHeight
this.clipHeight=this.el.offsetHeight
this.up=goUp;
this.down=goDown;
this.moveIt=moveIt;
this.x=0;
this.y=0;
this.obj = obj + "Object";
eval(this.obj + "=this");

return this;
}

function moveIt(x,y)
{
this.x=x;
this.y=y;
this.css.left=this.x+px;
this.css.top=this.y+px;
}

function goDown(move)
{
if (this.y>-this.scrollHeight+oCont.clipHeight)
	{
	this.moveIt(0,this.y-move);

	if (loop)
		{
		setTimeout(this.obj+".down("+move+")",speed);
		}
	}
}

function goUp(move)
{
if (this.y < 0)
	{
	this.moveIt(0,this.y-move);

	if (loop)
		{
		setTimeout(this.obj+".up("+move+")",speed);
		}
	}
}

function scroll(speed)
{
if (scrolltextLoaded)
	{
	loop=true;

	if (speed > 0)
		{
		oScroll.down(speed);
		}
	else
		{
		oScroll.up(speed);
		}
	}
}

function noScroll()
{
loop=false;

if (timer)
	{
	clearTimeout(timer);
	}
}

var scrolltextLoaded=false;

function scrolltextInit()
{
oCont=new makeObj('divScrollTextCont');
oScroll=new makeObj('myPics','divScrollTextCont');
oScroll.moveIt(0,0);
oCont.css.visibility="visible";
scrolltextLoaded=true;
}

onload=scrolltextInit;
