var scrollers_speed=50;
var scrollers_amount=2;
var scrollerName="scrollRL";

function emptyShell(variableName){
this.variableName=variableName;
this.variable=this;
this.enable=function(){ for(var e=0;e<this.enable.arguments.length;e++){ if(typeof(this.enable.arguments[e])=="object" ){ for(var ee=0;ee<this.enable.arguments[e].length;ee++){ this[this.enable.arguments[e][ee]]=new shellGuest(this.variableName, this.enable.arguments[e][ee]) } } else{ this[this.enable.arguments[e]]=new shellGuest(this.variableName, this.enable.arguments[e]); } } };
for(var i=1; i<emptyShell.arguments.length; i++){this.enable(emptyShell.arguments[i]);}
this.timer=false;
this.abilitate=function(){return;};/*to avoid bad error if mistaken after ULMA emulation compliance*/
/* keep this comment to reuse freely:
http://www.unitedscripters.com */}

function shellGuest(variableName, methodName){
this.variableName=this.managerName=variableName;
this.owner = this.manager = this.variable= eval(variableName);
this.methodName= methodName;
this.exec= this.exe= this.ex= this.x= this.X= this.e= this.execute= eval(methodName);
this.isRunning=0; this.isTimed=0;
//func:
this.run=function(arg){
arg=(arg)?arg:''; var runner= this.variableName+ "."+ this.methodName+ ".execute("+arg+")";
this.timer=setInterval(runner, ( (parseFloat(this.variable.speed))?parseFloat(this.variable.speed):parseFloat(this.speed) ) );
};/*func over*/
//func:
this.timedRun=function(arg){ arg=(arg)?arg:''; var runner= this.managerName+ "."+ this.methodName+ ".execute("+arg+")"; 
this.isTimed=1;
this.timer=setTimeout(runner,( (parseFloat(this.variable.speed))?parseFloat(this.variable.speed):parseFloat(this.speed) ));
};/*func over*/
//func:
this.stop=function(){ if(!this.isTimed){ clearInterval( this.timer );}else{ clearTimeout(this.timer); this.isTimed=0;};
this.isRunning=0;};/*func over*/
//func:
this.setAttributes=function(){
if(!this.setAttributes.arguments.length){return;};if(this.setAttributes.arguments.length>=2){for(var A=0; A< (this.setAttributes.arguments.length-1); A+=2){this[this.setAttributes.arguments[A]] = this.setAttributes.arguments[A+1];}}
else{
if( typeof(this.setAttributes.arguments[0]) == "object" && this.setAttributes.arguments[0].length>=2){
for(var L=0; L< (this.setAttributes.arguments[0].length-1); L+=2){this[this.setAttributes.arguments[0][L]] = this.setAttributes.arguments[0][L+1];}};
};}/*func over*/
this.setAttribute= this.setattribute= this.setattributes= this.attributes= this.set= this.setAttributes;
/* keep this comment to reuse freely:
http://www.unitedscripters.com */}






function scrollRL(){
if(!this.isRunning){
this.isRunning=1;
this.currentCycles=0;
this.bareObject=(document.getElementById)? document.getElementById(this.variableName):
(document.all)?document.all[this.variableName]:0;
	if(!this.bareObject){this.isRunning=0; return false;};
this.owner.lastCalled=this.methodName;
this.reset=function(){this.bareObject.style.top="0px"; this.bareObject.style.left="0px";}
this.scroll=(!isNaN(parseFloat(this.scroll)))?parseFloat(this.scroll):1;
this.increaser=this.bareObject.offsetLeft;
}
//RUN:
this.increaser-=this.scroll;
if(this.increaser<-this.bareObject.offsetWidth){
++this.currentCycles;
this.increaser=this.bareObject.parentNode.offsetWidth;
}
this.bareObject.style.left=this.increaser+'px';
/* keep this comment to reuse freely:
http://www.unitedscripters.com */}






function makeTheScroller(id){//id must be array
/*nearby bottom: if an array entry is a NUMBER, it will mean that the PREVIOUS layer ID must NOT run the scrolling.*/
for(var i=0;i<id.length;i++){
		if( !document.getElementById(id[i]) /*non existent Html id*/ ){continue;};
		if( !isNaN(parseFloat(id[i+1]))){++i;continue;/*means you don't want to run this scroller*/};
window[id[i]]=new emptyShell(id[i]);
window[id[i]].enable(scrollerName);
window[id[i]].scrollRL.setAttributes(
"speed", scrollers_speed,
"scroll", scrollers_amount 
);
document.getElementById(id[i]).style.width = document.getElementById(id[i]).scrollWidth+'px';
document.getElementById(id[i]).style.height = document.getElementById(id[i]).scrollHeight+'px';
window[id[i]].scrollRL.run();
}
}






function scrollers_onoff(id, onOff){
if(window[id] && window[id][scrollerName]/*check also if the method exists, because until loaded the variables are not initialized and thus have no method, though window[id] might ALREADY reprot an existing element (javascriot may climb the hierarchy to find something that belongs to the WINDOW object with such an id, and it shall report an existing dom node!*/){
	if(!onOff){window[id].scrollRL.stop();}
	else{window[id].scrollRL.run();};
};
}

function scrollers_anchor_onclick(){
return false;
}

function scrollers_reset(id){
if(window[id] && window[id][scrollerName]){
window[id][scrollerName].stop();
window[id][scrollerName].reset();
window[id][scrollerName].scroll=scrollers_amount;
};
}

function scrollers_run(id){
if(window[id] && window[id][scrollerName] && !window[id][scrollerName].isRunning){
window[id][scrollerName].run();
};
}

function scrollers_stop(id){
if(window[id] && window[id][scrollerName] && window[id][scrollerName].isRunning){
window[id][scrollerName].stop();
};
}

function scrollers_faster(id){
if(window[id] && window[id][scrollerName]){
window[id][scrollerName].stop();
window[id][scrollerName].scroll+=(window[id][scrollerName].scroll<100)?2:0;
window[id][scrollerName].run();
};
}

function scrollers_slower(id){
if(window[id] && window[id][scrollerName]){
window[id][scrollerName].stop();
window[id][scrollerName].scroll-=(window[id][scrollerName].scroll>=3)?2:0;
window[id][scrollerName].run();
};
}