// <SCRIPT LANGUAGE="JavaScript1.2" TYPE="text/javascript">
//   Made by <a href="/dhtmlcentral/thomas_brattli.asp">Thomas Brattli</a> 

scroll_width=		NTI_scroll1[0];
scroll_height=		NTI_scroll1[1];
scroll_xpos=		NTI_scroll1[2];
scroll_ypos=		NTI_scroll1[3];
scroll_speed=		NTI_scroll1[4];
scroll_font=		NTI_scroll1[5];
scroll_font_color=	NTI_scroll1[6];  
scroll_font_size=	NTI_scroll1[7];
scroll_background=	NTI_scroll1[8];
scroll_text=		NTI_scroll1[9];
scroll_border=		NTI_scroll1[10];
scroll_ident=		NTI_scroll1[11];
scroll_border_style=NTI_scroll1[12];

function NTI_lib_bwcheck(){ //--- Browsercheck (needed)
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.opera5=this.agent.indexOf("Opera 5")>-1
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6
	this.mac=this.agent.indexOf("Mac")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
	return this
}
//alert("qa");
var bw;

//--- If you want it to move faster you can set this lower:
var speed=scroll_speed;

//--- Sets variables to keep track of what's happening
var loop, timer

//--- Object constructor



function NTI_MakeElement(menuid) {
var MenuObject;
	MenuObject = document.createElement("DIV");
	with(MenuObject){
		id = menuid;
		name= menuid;
		with(style) {
			position = "absolute";
			visibility = "hidden";
			left = scroll_xpos+"px";
			top = scroll_ypos+"px";
			if (scroll_border)
				clip = "rect(0px "+ parseInt(scroll_width+2) +"px "+ parseInt(scroll_height+2) +"px 0px)";
			else
				clip = "rect(0px "+ scroll_width +"px "+ scroll_height +"px 0px)";
			width = scroll_width+"px";
			height= scroll_height+"px";
			backgroundColor=scroll_background;
			borderWidth = scroll_border + "px";
			borderColor = "black";
			borderStyle = "solid";
		}	
	}
	document.body.appendChild(MenuObject);
	return MenuObject;
}


function makeDiv(){
	if (bw.ie){
		var tmpString;
		tmpString='<div id="NTI_divCont" name="NTI_divCont" style="z-index:100;position:absolute; width:'+scroll_width+'; height:'+scroll_height+'; overflow:hidden; top:'+scroll_ypos+'; background-color:'+scroll_background+'; left:'+scroll_xpos+'; clip:rect(0,'+scroll_width+','+scroll_height+',0);border: solid '+ scroll_border +'px;border-style:'+ scroll_border_style +';"><div id="NTI_divText" name="NTI_divText" style="z-index:101;position:absolute; top:0; left:0; color:'+scroll_font_color+'; font-size:'+scroll_font_size+'pt; font-family:'+scroll_font+';">'+scroll_text+'</div></div>';
		//--- document.body.innerHTML= tmpString;
		document.body.insertAdjacentHTML("BeforeEnd",tmpString);
	}
	if (bw.dom){
		var NS6Div;
		NS6Div=NTI_MakeElement("NTI_divCont");	
		NS6Div.innerHTML='<div id="NTI_divText" name="NTI_divText" style="position:absolute; top:0; left:0; color:'+scroll_font_color+'; font-size:'+scroll_font_size+'pt; font-family:'+scroll_font+';">'+scroll_text+'</div>';
	}
	if (bw.ns4){
		var nLayer,childnLayer,bLayer;
		if (scroll_border){	
			bLayer=new Layer(scroll_width+2);
			bLayer.width=scroll_width+2;	
			bLayer.height=scroll_height+2;
			bLayer.bgColor="black";
			bLayer.visibility="show";	
			bLayer.left=scroll_xpos-1;
			bLayer.top=scroll_ypos-1;
			bLayer.clip.top=0;
			bLayer.clip.left=0;
			bLayer.clip.right=scroll_width+2;
			bLayer.clip.bottom=scroll_height+2;
		}
		//--- tworzenie odpowiednika NTI_divCont
		nLayer=new Layer(scroll_width);
		nLayer.visibility="hide";	
		nLayer.width=scroll_width;
		nLayer.height=scroll_height;
		//--- alert(nLayer.document.height+" aqq");
		nLayer.left=scroll_xpos;
		nLayer.top=scroll_ypos;
		nLayer.overflow="hide";
		nLayer.clip.top=0;
		nLayer.clip.left=0;
		nLayer.clip.right=scroll_width;
		nLayer.clip.bottom=scroll_height;
		nLayer.bgColor=scroll_background;
		//--- tworzenie odpowiednika NTI_divtext
		childnLayer=new Layer(scroll_width,nLayer);
		childnLayer.left=0;
		childnLayer.top=0;
		//--- childnLayer.bgColor="blue";
		childnLayer.visibility="show";
		TempString = "<FONT COLOR='"+ scroll_font_color +"' FACE='"+ scroll_font +"' POINT-SIZE='"+ scroll_font_size +"'>" + scroll_text + "</FONT>";
		childnLayer.document.write(TempString);
		childnLayer.document.close();
		//--- alert("nLayer.name = "+nLayer.name+". nLayer.height ="+nLayer.height);
		return childnLayer;
	}
}


function NTI_makeObj(obj,nest){
	//--- alert(document.layers[obj].height);
	//--- alert(obj);
    nest=(!nest) ? "":'document.layers.'+nest+'.';	
	this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.layers.'+obj):0;
		//--- alert(document.getElementById(obj));
	this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.layers.'+obj):0;
	this.scrollHeight=bw.ns4?this.css.clip.bottom:this.el.offsetHeight;
		//--- alert("Name: "+this.el.name+". Height: "+this.scrollHeight+". Bgcolor: "+this.css.bgColor);
	this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight
	this.up=NTI_goUp;this.down=NTI_goDown;
	this.moveIt=NTI_moveIt; this.x; this.y;
    this.obj = obj + "Object"
    eval(this.obj + "=this")
    return this
}

function NTI_moveIt(x,y){
	this.x=x;this.y=y
	this.css.left=this.x
	this.css.top=this.y
}

//--- Makes the object go up
function NTI_goDown(move){
	if (this.y<-this.scrollHeight){
		//--- alert("this: "+this.scrollHeight);
		this.y=oCont.scrollHeight;
		//--- alert("ocont : "+oCont.scrollHeight);
	}
	this.moveIt(10,this.y-0.5)
	if(loop) setTimeout(this.obj+".down("+0.5+")",speed)
}


//--- Makes the object go down
function NTI_goUp(move){
	if (this.y<0){
		this.moveIt(0,this.y-move)
		if(loop) setTimeout(this.obj+".up("+move+")",speed)
	}
}

//--- Calls the scrolling functions. Also checks whether the page is loaded or not.
function NTI_scroll(speed){
	if(NTI_loaded){
		loop=true;
		if(speed>0) oScroll.down(speed)
		else oScroll.up(speed)
	}
}

//--- Stops the scrolling (called on mouseout)
//function NTI_noScroll(){
	//loop=false
//	if(timer) clearTimeout(timer)
//}

//--- Makes the object
var NTI_loaded;
function NTI_scrollInit(){
var NTI_divText;
	bw=new NTI_lib_bwcheck()
	NTI_divText=makeDiv();
	if (bw.ns4){
		oCont=new NTI_makeObj(NTI_divText.parentLayer.name);
		oScroll=new NTI_makeObj(NTI_divText.name,NTI_divText.parentLayer.name);
	}
	else {
		oCont=new NTI_makeObj('NTI_divCont');
		oScroll=new NTI_makeObj('NTI_divText','NTI_divCont');
	}

	//--- alert(oCont.scrollHeight);
	oScroll.moveIt(scroll_ident,scroll_height);
	//--- alert(scroll_height);
	oCont.css.visibility='visible';
	NTI_loaded=true;
	NTI_scroll(speed);
}

//--- Call the init on page load
//window.onload=NTI_scrollInit;

