function vScroll(objName,width,height,speed,pause,interval,delay,text)
{	
	
 // speed must be < 10
	
	
	
	this.objName = objName;
	
	this.scrollerdelay=delay;
	this.scrollerwidth=width;
	this.scrollerheight=height;
	this.messages = text;
	this.interval = interval;
	this.speed = speed;
	
	this.i = 0;
	
	this.ie=document.all;
	this.dom=document.getElementById;
	
	

	if (this.messages.length>2)
	{
		this.i=2;
	}
	else
	{
		this.i=0;
	}
	
	this.second2_obj=null;
	this.first2_obj =null;
	this.html	='';
	this.html2 	='';
	this.tdiv = '';
	this.tdiv2 = '';
	this.tlayer = '';
	this.tlayer2 = '';
	
	this.move1 = move1;
	this.move2 = move2;
	this.move3 = move3;
	this.move4 = move4;
	
	this.start = startscroll;
	this.renderscroller = renderScroller;
	
	this.renderscroller();
	


}

function move1(whichlayer)
{
	
	this.tlayer=eval(whichlayer);
	
	if (this.tlayer.top>0&&this.tlayer.top<=5)
	{
		this.tlayer.top=0;
		setTimeout(this.objName+".move1("+this.objName+".tlayer)",this.scrollerdelay);
		setTimeout(this.objName+".move2("+eval('document.'+this.objName+'main.document.'+this.objName+'second')+")",this.scrollerdelay);
		
		return;
	}
	if (this.tlayer.top>=this.tlayer.document.height*-1)
	{	

		
		
		this.tlayer.top-=5;
		setTimeout(this.objName+".move1("+this.objName+".tlayer)",50);
	}
	else
	{
	this.tlayer.top=parseInt(this.scrollerheight);
	this.tlayer.document.open();
	this.tlayer.document.write= (this.messages[this.i]);
	this.tlayer.document.close();
	if (this.i==this.messages.length-1)
		this.i=0;
	else
		this.i++;
	}
	
}

function move2(whichlayer)
{
	alert('move2');
	this.tlayer2=eval(whichlayer)
	if (this.tlayer2.top>0&&this.tlayer2.top<=5)
	{
		this.tlayer2.top=0;
		setTimeout(this.objName+".move2("+this.objName+".tlayer2)",this.scrollerdelay);
		setTimeout(this.objName+".move1("+eval('document.'+this.objName+'main.document.'+this.objName+'first')+")",this.scrollerdelay);
		return;
	}
	if (this.tlayer2.top>=this.tlayer2.document.height*-1)
	{
		this.tlayer2.top-=5;
		setTimeout(this.objName+".move2("+this.objName+".tlayer2)",50);
	}
	else
	{
		this.tlayer2.top=parseInt(this.scrollerheight);
		this.tlayer2.document.write(this.messages[i]);
		this.tlayer2.document.close()
		if (this.i==this.messages.length-1)
			this.i=0;
		else
			this.i++;
	}
}

function move3(whichdiv)
{
	
	
	this.tdiv=eval(whichdiv)
	if (parseInt(this.tdiv.style.top)>0&&parseInt(this.tdiv.style.top)<=1)
	{
		
		this.tdiv.style.top=0+"px";
		setTimeout(this.objName+".move3("+this.objName+".tdiv)",this.scrollerdelay);
		setTimeout(this.objName+".move4("+this.objName+".second2_obj)",this.scrollerdelay);
		return;
	}
	if (parseInt(this.tdiv.style.top)>=this.tdiv.offsetHeight*-1)
	{
		this.tdiv.style.top=parseInt(this.tdiv.style.top)-this.speed+"px"
		setTimeout(this.objName+".move3("+this.objName+".tdiv)",this.interval)
	}
	else
	{
		this.tdiv.style.top=parseInt(this.scrollerheight)
		this.tdiv.innerHTML=this.messages[this.i]
		if (this.i==this.messages.length-1)
			this.i=0;
		else
			this.i++;
	}
}

function move4(whichdiv)
{

	
	this.tdiv2=eval(whichdiv)
	if (parseInt(this.tdiv2.style.top)>0&&parseInt(this.tdiv2.style.top)<=1)
	{
		this.tdiv2.style.top=0+"px";
		setTimeout(this.objName+".move4("+this.objName+".tdiv2)",this.scrollerdelay);
		setTimeout(this.objName+".move3("+this.objName+".first2_obj)",this.scrollerdelay);
		return;
	}
	if (parseInt(this.tdiv2.style.top)>=this.tdiv2.offsetHeight*-1)
	{
		this.tdiv2.style.top=parseInt(this.tdiv2.style.top)-this.speed+"px";
		setTimeout(this.objName+".move4("+this.objName+".second2_obj)",this.interval);
	}
	else
	{
		this.tdiv2.style.top=parseInt(this.scrollerheight);
		this.tdiv2.innerHTML=this.messages[this.i];
		if (this.i==this.messages.length-1)
			this.i=0;
		else
			this.i++;
	}
}

function startscroll()
{
	
	if (this.ie||this.dom)
	{
		this.first2_obj=this.ie? eval(this.objName+"first2") : document.getElementById(this.objName+"first2");
		this.second2_obj=this.ie? eval(this.objName+"second2") : document.getElementById(this.objName+"second2");
		this.move3(this.first2_obj);
		this.second2_obj.style.top=this.scrollerheight;
		this.second2_obj.style.visibility='visible';
		if(this.objName.toLowerCase()=="requestscroller")
			this.second2_obj.style.visibility='hidden';
	}
	else if (document.layers)
	{
		eval("document."+this.objName+"main.visibility='show'");
		this.move1(eval("document."+this.objName+"main.document."+this.objName+"first"));
		eval("document."+this.objName+"main.document."+this.objName+"second.top=parseInt("+this.scrollerheight+")+5");
		eval("document."+this.objName+"main.document."+this.objName+"second.visibility='visible'");
	}
}


function renderScroller()
{

/*	this.html='<ilayer id="'+this.objName+'main";width='+this.scrollerwidth+';height='+this.scrollerheight+';visibility=hide>';
	this.html+='<layer id="'+this.objName+'first"; left=0 top=0 width='+this.scrollerwidth+'>';
	if (document.layers)
		this.html+=(this.messages[0]);

	this.html+='</layer>';
	this.html+='<layer id="'+this.objName+'second"; left=0 top=0 width='+this.scrollerwidth+';visibility=hide>';

	if (document.layers)
		this.html+=(this.messages[dyndetermine=(this.messages.length==1)? 0 : 1]);

	this.html+='</layer></ilayer>';
	
	document.write(this.html); */
	
	if(document.layers)
		document.write('');

	if (this.ie||this.dom)
	{
		this.html2='<div id="'+this.objName+'main2" style="position:relative;width:'+this.scrollerwidth+';height:'+this.scrollerheight+';overflow:hidden;">';
		this.html2+='<div style="position:absolute;width:'+this.scrollerwidth+';height:'+this.scrollerheight+';clip:rect(0 '+this.scrollerwidth+' '+this.scrollerheight+' 0);left:0px;top:0px">';
		this.html2+='<div id="'+this.objName+'first2" style="position:absolute;width:'+this.scrollerwidth+';left:5px;top:1px;">';
		this.html2+=this.messages[0];
		this.html2+='</div>';
		this.html2+='<div id="'+this.objName+'second2" style="position:absolute;width:'+this.scrollerwidth+';left:5px;top:1px;visibility:hidden">';
		this.html2+=this.messages[dyndetermine=(this.messages.length==1)? 0 : 1];
		this.html2+='</div></div></div>';
		document.write(this.html2);	
	}
	
}

// Requestscroller ////////////////////////////////////////////////////////////////////////////

function rScroll(objName,width,height,speed,pause,interval,delay,text)
{
this.objName = objName;
this.width = width;
this.height = height;
this.marqueespeed = speed;

	if(pause.toLowerCase()=='true')
	{
	this.pause = 1;
	}
	else
	{
		this.pause = 0		
	}

this.interval = interval;
this.delay = delay;
this.marqueecontent = text[0];


this.marqueespeed=(document.all)? this.marqueespeed : Math.max(1, this.marqueespeed-1); //slow speed down by 1 for NS
this.copyspeed=this.marqueespeed;
this.pausespeed=(this.pauset==0)? this.copyspeed: 0;
this.iedom=document.all||document.getElementById;
this.actualheight = 0;
this.cross_marquee = null;
this.ns_marquee = null;

this.populate = populate;
this.scroll = scrollmarquee;
this.render = renderscroller;
this.start = rStart;

}

function rStart()
{
	this.render();
	this.populate();	
}

function populate()
{
	
	if (this.iedom)
	{
		this.cross_marquee=document.getElementById? document.getElementById(this.objName+"iemarquee") : eval('document.all.'+this.objName+'iemarquee');
		this.cross_marquee.style.top=parseInt(this.height)+8+"px";
		this.cross_marquee.innerHTML=this.marqueecontent;
		this.actualheight=this.cross_marquee.offsetHeight;
	}
	else if (document.layers) //  todo
	{
		this.ns_marquee=document.ns_marquee.document.ns_marquee2;
		this.ns_marquee.top=parseInt(marqueeheight)+8;
		this.ns_marquee.document.write(marqueecontent);
		this.ns_marquee.document.close();
		this.actualheight=ns_marquee.document.height;
	}
this.lefttime=setInterval(this.objName+".scroll()",this.interval);
}


function scrollmarquee()
{

	if (this.iedom)
	{
	
		if (parseInt(this.cross_marquee.style.top)>(parseInt(this.cross_marquee.offsetHeight)*(-1)+8))
			this.cross_marquee.style.top=parseInt(this.cross_marquee.style.top)- this.copyspeed+"px";
		else
			this.cross_marquee.style.top=parseInt(this.height)+8+"px";
	}
	else if (document.layers)
	{
		if (this.ns_marquee.top>(this.actualheight*(-1)+8))
			this.ns_marquee.top-=this.copyspeed;
		else
			this.ns_marquee.top=parseInt(this.height)+8;
	}
}

function renderscroller()
{
	if (this.iedom||document.layers)
	{
		with (document)
		{
			if (this.iedom)
			{
				write('<div style="position:relative;width:'+this.width+';height:'+this.height+';overflow:hidden" onMouseover="'+this.objName+'.copyspeed='+this.objName+'.pausespeed" onMouseout="'+this.objName+'.copyspeed='+this.objName+'.marqueespeed">');
				write('<div id="'+this.objName+'iemarquee" style="position:absolute;left:10px;top:0px;width:100%;">');
				write('</div></div>');
			}
			else if (document.layers) 
			{
				
				write('');
	
			}
		}
	}
}


// Fading Message Text 

function fScroll(objName,width,height,speed,pause,interval,delay,text)
{
	this.objName = objName;
	this.delay = delay;
	this.maxsteps=30; // number of steps to take to change from start color to endcolor
	this.stepdelay=interval; // time in miliseconds of a single step

	this.startcolor= new Array(235,230,235); // start color (red, green, blue)
	this.endcolor=new Array(50,105,125); // end color (red, green, blue)

	this.fcontent=text;
	//this.begintag='<div id="innerDiv" style="position:relativ;left:10px;top:0px;width:100%;">'; //set opening tag, such as font declarations
	//this.closetag='</div>';

	this.fwidth=width+'px'; //set scroller width
	this.fheight=height+'px'; //set scroller height

	this.fadelinks=1;  //should links inside scroller content also fade like text? 0 for no, 1 for yes.

	this.ie4=document.all&&!document.getElementById;
	this.DOM2=document.getElementById;
	this.faderdelay=0;
	this.index=0;


	this.start = start;
	this.linkColorChange = linkcolorchange;
	this.colorFade = colorfade;
	this.getStepColor = getstepcolor;
	this.renderFader = renderFader;
	
	this.renderFader();
}

function start(){
	
  if (this.index >= this.fcontent.length)
    this.index=0
  if (this.DOM2){
    document.getElementById(this.objName+"fscroller").style.color="rgb("+this.startcolor[0]+", "+this.startcolor[1]+", "+this.startcolor[2]+")"
    document.getElementById(this.objName+"fscroller").style.marginLeft=10; //this.begintag+this.fcontent[this.index]+this.closetag
    document.getElementById(this.objName+"fscroller").innerHTML=this.fcontent[this.index];
    if (this.fadelinks)
      this.linkColorChange(1);
    this.colorFade(1, 15);
  }
  else if (this.ie4) // to do
    eval('document.all.'+this.objName+'fscroller.innerHTML='+this.begintag+fcontent[this.index]+this.closetag);
  this.index++;
}


function linkcolorchange(step){
  var obj=document.getElementById(this.objName+"fscroller").getElementsByTagName("A");
  if (obj.length>0){
    for (i=0;i<obj.length;i++)
      obj[i].style.color=this.getStepColor(step);
  }
}


function colorfade(step) {
  
  var fadecounter;
  if(step<=this.maxsteps) {	
    document.getElementById(this.objName+"fscroller").style.color=this.getStepColor(step);
    if (this.fadelinks)
      this.linkColorChange(step);
    step++;
    fadecounter=setTimeout(this.objName+".colorFade("+step+")",this.stepdelay);
  }else{
    clearTimeout(fadecounter);
    document.getElementById(this.objName+"fscroller").style.color="rgb("+this.endcolor[0]+", "+this.endcolor[1]+", "+this.endcolor[2]+")";
    setTimeout(this.objName+".start()", this.delay);
	
  }   
}

function getstepcolor(step) {
  var diff
  var newcolor=new Array(3);
  for(var i=0;i<3;i++) {
    diff = (this.startcolor[i]-this.endcolor[i]);
    if(diff > 0) {
      newcolor[i] = this.startcolor[i]-(Math.round((diff/this.maxsteps))*step);
    } else {
      newcolor[i] = this.startcolor[i]+(Math.round((Math.abs(diff)/this.maxsteps))*step);
    }
  }
  return ("rgb(" + newcolor[0] + ", " + newcolor[1] + ", " + newcolor[2] + ")");
}



function renderFader()
{
if (this.ie4||this.DOM2)
  document.write('<div id="'+this.objName+'fscroller" style="border:0px;width:'+this.fwidth+';height:'+this.fheight+';overflow:hidden;"></div>');
else
	document.write('');
	
}
//#####################################################################################
// Sliding-in  Scroller
//#####################################################################################
function sScroll(objName,width,height,speed,pause,interval,delay,text)
{
	this.objName = objName;
	this.message = text;
	this.inc=1;
	this.ns4=document.layers;
	this.ie5ns6=document.getElementById||document.all;
	this.crossobj =  null;
	this.delay = delay;
	this.timer = 0;
	this.speed = speed;
	
	this.scrollwidth = width;
	this.scrollheight = height;
	
	this.renderScroller = renderSlideScroller;
	this.updatemsg = updatemsg;
	this.updatemsgns4 = updatemsgns4;
	this.animatein = animatein;
	this.start = initialize;
	
	this.beginTag='<Table width="'+this.scrollwidth+'" height="'+this.scrollheight+'"><tr><td valign="middle">';
	this.endTag = '</td></tr></table>';
	
	this.renderScroller();
	
	

	
}


function initialize()
{
	if (this.ie5ns6)
	{
		this.crossobj=document.getElementById? document.getElementById(this.objName+"flyin") : eval('document.all.'+this.objName+'flyin');
		setInterval(this.objName+".updatemsg()",this.delay+1000);
	}
	else if (this.ns4)
	{
		
		var scroll1 = null;
		scroll1 = eval('document.'+this.objName+'sslide.document.'+this.objName+'sslide2');
		
		
		//eval('document.'+this.objName+'sslide.document.'+this.objName+'sslide2.document.write('+this.beginTag+this.message[0]+this.endTag+')');
		//alert('hallo');
		//eval('document.'+this.objName+'sslide.document.'+this.objName+'sslide2.document.close()');
		
		//setInterval(this.objName+".updatemsgns4()",this.delay);
		
	}
}
	
	
function renderSlideScroller()
{
	var sHtml = '';
	if (this.ie5ns6)
	{
		sHtml = '<div id="'+this.objName+'flyinMain" style="position:relative;left:10px;width:'+this.scrollwidth+';height:'+this.scrollheight+';overflow:hidden;">';
		sHtml = sHtml+ '<div id="'+this.objName+'flyin" style="position:absolute;width:'+this.scrollwidth+';height:'+this.scrollheight+';overflow:hidden;">'+this.beginTag+this.message[0]+this.endTag+'</div></div>';
	}
	else
	{
			sHtml = '<ilayer name="'+this.objName+'sslide";width='+this.scrollwidth+';height='+this.scrollheight+';>';
			sHtml = sHtml + '<layer name="'+this.objName+'sslide2";width='+this.scrollwidth+';height='+this.scrollheight+';></layer>';
			sHtml = sHtml + '</ilayer>';
	}
	
	document.write(sHtml);
	
}


function updatemsg()
{
	this.crossobj.style.left="-1000px";
	this.crossobj.style.fontStyle="italic";
	this.crossobj.innerHTML=this.beginTag+this.message[this.inc]+this.endTag;
	this.crossobj.style.left=this.crossobj.offsetWidth*(-1)+1+"px";
	this.timer=setInterval(this.objName+".animatein()",50);
	this.inc=(this.inc<this.message.length-1)? this.inc+1 : 0;
}

function animatein()
{
	if (parseInt(this.crossobj.style.left)<0)
		this.crossobj.style.left=parseInt(this.crossobj.style.left)+this.speed+"px";
	else
	{
		this.crossobj.style.left=0+"px";
		this.crossobj.style.fontStyle="normal";
		clearInterval(this.timer);
	}
}

function updatemsgns4()
{
	eval('document.'+this.objName+'sslide.document.'+this.objName+'sslide2.document.write('+this.objName+'.message['+this.objName+'.inc])');
	eval('document.'+this.objName+'sslide.document.'+this.objName+'sslide2.document.close()');
	this.inc=(this.inc<this.message.length-1)? this.inc+1 : 0;
}




