/* használat div: id="scrollid" title="sebesség(ms);léptetés(px);térköz(px)" (style és class ne itt legyen megadva, hanem egy külső div-ben)*/
scrolltools=[];
function scrollmove(id) {
	var t=scrolltools[id];
	var a1=t.a1;
	a1.style.left=(parseInt(a1.style.left)-t.move)+'px';
	if (t.a2!=undefined) {
		var a2=t.a2;
		a2.style.left=(parseInt(a1.style.left)+t.width)+'px';
		if (parseInt(a2.style.left)<0) {
			var x=a2.style.left;
			a2.style.left=a1.style.left;
			a1.style.left=x;
		}
	} else if (parseInt(a1.style.left)<-t.width) {
		a1.style.left=t.e.style.width;
	}
}
function schollinit(id) {
	scrolltools[id]={}
	var e=document.getElementById(id);
	scrolltools[id].e=e;

	var c=e.title ? e.title.split(';') : [];
	scrolltools[id].speed=c[0]!=undefined&&c[0]!='' ? parseInt(c[0]) : 25;
	scrolltools[id].move=c[1]!=undefined&&c[1]!='' ? parseInt(c[1]) : 2;
	scrolltools[id].space=c[2]!=undefined&&c[2]!='' ? parseInt(c[2]) : 25;
	e.title='';

	e.style.overflow='hidden';
	e.style.position='relative';
	e.style.whiteSpace='nowrap';
	e.style.width=e.offsetWidth+'px';
	e.style.height=e.offsetHeight+'px';
	var txt=e.innerHTML;
	e.innerHTML='';

	var a1=document.createElement('div');
	a1.id=id+'1';
	a1.style.position='absolute';
	a1.style.whiteSpace='nowrap';
	a1.style.left='0px';
	a1.innerHTML=txt;
	e.appendChild(a1);
	scrolltools[id].a1=a1;
	scrolltools[id].width=a1.offsetWidth;

	if (scrolltools[id].width>e.offsetWidth) {
		scrolltools[id].width+=scrolltools[id].space;
		var a2=document.createElement('div');
		a2.id=id+'2';
		a2.style.position='absolute';
		a2.style.whiteSpace='nowrap';
		a2.style.left='0px';
		a2.innerHTML=txt;
		e.appendChild(a2);
		scrolltools[id].a2=a2;
	}

	setInterval("scrollmove('"+id+"')", scrolltools[id].speed);
}

