
var lm = [],  rm = [], scrollgo,scrolrgo, sdelay = 20, ls = 2, rs = 1;	//lm=left marquee, rm=right, ls=left speed, rs=right speed
//var ld1 = document.getElementById('s1'), ld2 = document.getElementById('s1a'), ld3 = document.getElementById('s1b');
//var rd1 = document.getElementById('s2'), rd2 = document.getElementById('s2a'), rd3 = document.getElementById('s2b');

function lspause() { ls = 0; }
function lscontinue() {	ls = 2; }
//function rspause() { rs = 0; }
//function rscontinue() {	rs = 1; }
function sDiv() {
	lsDiv();
	//rsDiv();
}

function lsDiv() {
	var ld1 = document.getElementById('s1'), ld2 = document.getElementById('s1a'), ld3 = document.getElementById('s1b');
	for( var i = 0, leftD; i < 1; i++ ) {
		if( ld1 ) {
			if( !( leftD = ld2 ) ) { continue; }
			if( !( leftD.sub = ld3 ) ) { continue; }
			ld3.style.left = ld2.offsetWidth + 'px';
			lm[lm.length] = ld2;
		}
	}
	scrollgo = setInterval('lscroll()',sdelay); 
}

/*function rsDiv() {
	var rd1 = document.getElementById('s2'), rd2 = document.getElementById('s2a'), rd3 = document.getElementById('s2b');
	for( var j = 0, rightD; j < 1; j++ ) {
		if( rd1 ) {
			if( !( rightD = rd2 ) ) { continue; }
			if( !( rightD.sub = rd3 ) ) { continue; }
			rd3.style.left = rd2.offsetWidth + 'px';
			rm[rm.length] = rd2;
		}
	}
	scrolrgo = setInterval('rscroll()',sdelay);
}
*/
///////////////////////////////////////////////////////////////////////
function lscroll() {
	var leftD, lpos, ld1 = document.getElementById('s1'),  ld3 = document.getElementById('s1b');
	for( var i = 0; i < lm.length; i++ ) {
		
		leftD = lm[i].sub;
		lpos = parseInt(ld3.style.left);
		if( lpos <= -(leftD.offsetWidth) ) {
			ld3.style.left = lm[i].offsetWidth + 'px';
		} else {
			ld3.style.left = ( lpos - ls ) + 'px';
		}
	}
}

/*function rscroll() {
	var rightD, rpos, rd1 = document.getElementById('s2'), rd3 = document.getElementById('s2b');
	for( var j = 0; j < rm.length; j++ ) {
		
		rightD = rm[j].sub;
		rpos = parseInt(rd3.style.left);
		if( rpos <= -(rightD.offsetWidth) ) {
			rd3.style.left = rm[j].offsetWidth + 'px'; //restart
		} else {
			rd3.style.left = ( rpos - rs ) + 'px'; //scroll
		}
	}

}
*/
if( window.addEventListener ) {
	window.addEventListener('load',sDiv,false);
} 
else if( document.addEventListener ) {
	document.addEventListener('load',sDiv,false);
} 
else if( window.attachEvent ) {
	window.attachEvent('onload',sDiv);
}
