// -------------------------
//
//  MMWeb iFrame Scroller
//
// -------------------------

function iFrameScroll(name,objectid) {
	this.name = name;
	this.objectid = objectid;
	this.speed = 10;
	this.delay = 20;
	this.timer = null;
	this.imageroot = "/lib/images";
	this.upstate = "_up";
	this,downstate = "_down";
	this.onstate = "_on";
	this.extension = ".gif";
	this.obj = null;
	this._getobject =	function() {
					if (!this.obj) this.obj=document.getElementById(this.objectid).contentWindow;
					return (this.obj)?true:false;
				}
	this.scrollup = 	function(img) { 
					if (!this._getobject()) return;
					this.swap(img); 
					this.timer=setInterval(this.name + ".scroll(-1)",this.delay);
				} 
	this.scrolldown = 	function(img) { 
					if (!this._getobject()) return;
					this.swap(img); 
					this.timer=setInterval(this.name + ".scroll(1)",this.delay);
				} 
	this.scroll =		function(dir) {
					this.obj.scrollBy(0,dir*this.speed);
				}
	this.stop = 		function(img) { 
					this.swap(img);
					clearInterval(this.timer);
					
				}
	this.swap = 		function(img) {
					var src = img.src;
					if (src.indexOf(this.onstate)>-1) img.src=src.replace(this.onstate,"")
					else img.src=src.replace(this.extension,this.onstate+this.extension);
				}
	return this;
}






