// Your messages. Add as many as you like
var message=new Array();

// the URLs of your messages
var messageurl=new Array();

// distance of the scroller to the left margin of the browser-window (pixels)
var scrollerleft;

// distance of the scroller to the top margin of the browser-window (pixels)
var scrollertop;

// speed 1: lower means faster
var pause=30;

// speed 2: higher means faster
var step=3;

// do not edit the variables below
var scrollerwidth = 300;
var scrollerheight = 20;
var scrollerleft_in;
var scrollertop_in;
var clipleft,clipright,cliptop,clipbottom;
var i_message=0;
var timer;
var textwidth;
var textcontent="";
//if (fntweight==1) {fntweight="700"}
//else {fntweight="100"}

var creepingElement;

function calc_offset(){
	scrollertop = 0;
	scrollerleft = 0;
	var el = creepingElement;
	while (el){
	 scrollertop += el.offsetTop;
	 scrollerleft += el.offsetLeft;
	 el = el.offsetParent;
	}
	scrollertop_in=scrollertop;
	scrollerleft_in=scrollerleft;
}

function creepInit(el) {
creepingElement = el;
gettextcontent();
//calc_offset();
 scrollertop = 0;
 scrollerleft = 0;
scrollertop_in=scrollertop;
scrollerleft_in=scrollerleft+15;
scrollerheight = 20;
scrollerwidth = 600;
//scrollerheight = creepingElement.parentElement.offsetHeight;
//scrollerwidth = creepingElement.parentElement.offsetWidth - 5;
if (document.all) {
creepingElement.innerHTML=textcontent;
textwidth=creepingElement.offsetWidth;
creepingElement.style.posTop=scrollertop_in;
creepingElement.style.posLeft=scrollerleft_in+scrollerwidth;

clipleft=0;
clipright=0;
cliptop=0;
clipbottom=scrollerheight;
creepingElement.style.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")";
scrolltext();
}
if (document.layers) {
creepingElement.document.write(textcontent);
creepingElement.document.close();
textwidth=creepingElement.document.width;
creepingElement.top=scrollertop_in;
creepingElement.left=scrollerleft_in+scrollerwidth;

creepingElement.clip.left=0;
creepingElement.clip.right=0;
creepingElement.clip.top=0;
creepingElement.clip.bottom=scrollerheight;

scrolltext();
}
}

function scrolltext() {
if (document.all) {
if (creepingElement.style.posLeft>=scrollerleft_in-textwidth) {
creepingElement.style.posLeft-=step;
clipright+=step;
if (clipright>scrollerwidth) {
clipleft+=step;
}
creepingElement.style.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")";

var timer=setTimeout("scrolltext()",pause);
}
else {
changetext();
}
}
if (document.layers) {
if (creepingElement.left>=scrollerleft_in-textwidth) {
creepingElement.left-=step;
creepingElement.clip.right+=step;
if (creepingElement.clip.right>scrollerwidth) {
creepingElement.clip.left+=step;
}
var timer=setTimeout("scrolltext()",pause);
}
else {
changetext();
}
}
}

function changetext() {
i_message++;
if (i_message>message.length-1) {i_message=0}
gettextcontent();
if (document.all) {
creepingElement.innerHTML=textcontent;
textwidth=creepingElement.offsetWidth;

creepingElement.style.posLeft=scrollerleft_in+scrollerwidth;
clipleft=0;
clipright=0;
creepingElement.style.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")";

scrolltext();
}

if (document.layers) {
creepingElement.document.write(textcontent);
creepingElement.document.close();

textwidth=creepingElement.document.width;

creepingElement.left=scrollerleft_in+scrollerwidth;
creepingElement.clip.left=0;
creepingElement.clip.right=0;

scrolltext();
}
}

function gettextcontent() {
textcontent="<span style='position:relative;'>";
if (messageurl[i_message] != ''){
	textcontent+="<a href="+messageurl[i_message]+" class='newslnk'>";
}
textcontent+="<nobr><b>"+message[i_message]+"</b><img src='/pic/news_arrow.gif' width=15 height=7 hspace=5></nobr>";
if (messageurl[i_message] != ''){
textcontent+="</a>";
}
textcontent+="</span>";
}

//window.onresize=creepInit(document.getElementById('creepingtext'));
