function quickscroll(variableName/*as String*/, object, scrollUntil, scrollHow, amount, speed){
window[variableName]=this;/*variable MUST be window scoped: this line ensures it is*/
this.object=(typeof object == "object")? object:
(typeof object == "string")? document.getElementById(object):
document.getElementsByTagName("BODY")[0]/*if argument object is bypassed, object defaults to body*/;
var position=(this.object.currentStyle)?this.object.currentStyle["position"]:
document.defaultView.getComputedStyle(this.object, null).getPropertyValue("position");
position=(position)?position.toLowerCase():position;
if(position!="absolute" && position!="relative"){
this.object.style.position="relative";/*wants a position*/
};
var overflow=(this.object.currentStyle)?this.object.currentStyle["overflow"]:
document.defaultView.getComputedStyle(this.object, null).getPropertyValue("overflow");
overflow=(overflow)?overflow.toLowerCase():overflow;
if(overflow!="auto" && overflow!="scroll"){
this.object.style.overflow="scroll";/*wants an overflow*/
};
this.scrollUntil=scrollUntil;
scrollHow=parseFloat(scrollHow)||0;/*must be a number*/
if(!scrollHow){ this.position="Top"; this.dimension="Height"; }
else{ this.position="Left"; this.dimension="Width"; };
this.amount=parseFloat(amount)||20;
this.speed=parseFloat(speed)||20;
this.timer=0;
/***** METHOD private *****/
this.afterLoad=function(){
this.scrollHow="scroll"+this.position;
	if(typeof this.scrollUntil == "object"){
	this.stopAt=this.scrollUntil["offset"+this.position];
	var spaceRemains=this.object["scroll"+this.dimension] - this.scrollUntil["offset"+this.position];
		if(spaceRemains < this.object["client"+this.dimension]){
		this.stopAt-=this.object["client"+this.dimension] - spaceRemains;
		};
	}
	else if( document.getElementById(this.scrollUntil) ){
	var layerPos=document.getElementById(this.scrollUntil)["offset"+this.position];
	this.stopAt=layerPos;
	var spaceRemains=this.object["scroll"+this.dimension] - layerPos;
		if(spaceRemains < this.object["client"+this.dimension]){
		this.stopAt-=this.object["client"+this.dimension] - spaceRemains;
		};
	}
	else if( !isNaN(parseFloat(this.scrollUntil)) ){
	this.stopAt=Math.abs( (parseFloat(this.scrollUntil)||0) );/*abs: negative numbers may stall the timeout*/
	var spaceRemains=this.object["scroll"+this.dimension] - this.stopAt;
		if(spaceRemains < this.object["client"+this.dimension]){
		this.stopAt-=this.object["client"+this.dimension] - spaceRemains;
		};
	}
	else{/*no object argument: this.object defaults to the body tag, namely end of document*/
	this.stopAt=this.object["scroll"+this.dimension] - this.object["client"+this.dimension];
	};
	//RUN:
	if(this.object[this.scrollHow]<=this.stopAt){/*scroll to bottom or to right*/
	this.timer=setInterval(variableName+".scroll1()", this.speed);
	}
	else{/*scroll to top or to left*/
	this.timer=setInterval(variableName+".scroll2()", this.speed);
	};
}
/***** METHOD private *****/
this.scroll1=function(){
var toend=this.object[this.scrollHow] + this.amount;
	if(toend>=this.stopAt){ this.object[this.scrollHow]=this.stopAt; clearInterval(this.timer); this.timer=0; }
	else{ this.object[this.scrollHow]=toend; };
}
/***** METHOD private *****/
this.scroll2=function(){
var toend= this.object[this.scrollHow] - this.amount;
	if(toend<=this.stopAt){ this.object[this.scrollHow]=this.stopAt; clearInterval(this.timer); this.timer=0;}
	else{ this.object[this.scrollHow]=toend; };
}
/***** METHOD *****/
this.scroll=function(){ if(this.object/*exists*/ && !this.timer/*not running*/){this.afterLoad();}; }
/*class ends*//* keep this comment to reuse freely:
http://www.unitedscripters.com */}

