﻿function ScrollImgLite(d1,d2,d2a,d2b)
{var _=this;
	_.interval=3000;
	_.scrollamount=1;
	var d1=I(d1),d2=I(d2),d2a=I(d2a),d2b=I(d2b);
	var d1h=d1.OH();
	
	_.row=1;
	_.rowcount=0;
	
	_.mt=function()
	{
			_.it1=setInterval(_.mtdo,_.interval);
	}

	_.mtdo=function()
	{
			if(d1.M==null){d1.M=I.M(d1);}
			I.MC.prototype.MT=function()
		{var m=d1.M,o=m.o;m.doing=1;
				o.a+=(o.b-o.a)*.12;
				if(o.a>=o.b*.99){o.a=o.b;}				
				m.O.scrollTop=(o.a);
				if(o.a==o.b){m.stopM();m.doing=0;}
		}	

			d1.M.o={o:d1,a:d1.OH()*(_.row-1),b:d1.OH()*_.row};
			d1.M.playM("MT");
			//document.title=_.row+":"+_.rowcount;
			_.row+=1;
			if(_.row>_.rowcount){_.row=1;}
	}
	

	_.sl=function()
	{_.stop();
		_.it1=setInterval(_.sldo,_.interval);
	}
	
	_.sldo=function()
	{
		d1.scrollLeft+=_.scrollamount;
		if(d1.scrollLeft==d2a.OW())
		{
			d1.scrollLeft=0;
		}
	}
	
	_.stop=function()
	{
		clearInterval(_.it1);
	}
	
	_.init=function()
	{
		_.rowcount=Math.round(d2.OH()/d1.OH());
		//alert(_.rowcount+":"+d2.OH()+":"+d1.OH()+":"+(d2.OH()/d1.OH()));
		d2b.h(d2a.H());
	}

	_.init();
	
	
}


I.MC=function(O)
{var _=this;
	_.O=O;
	_.it=null;
	_.doing=0;
	_.M1=function()
	{var o=_.o;
			_.doing=1;
			o.a+=(o.b-o.a)*.12;
			if(o.a>=o.b*.95){o.a=o.b;}
			if(o.op==1){_.O.sO(o.b-o.a);}else{_.O.sO(o.a);}
			if(o.a==o.b){try{o.done();}catch(e){}_.stopM();_.doing=0;}
	}
	
	_.stopM=function(){try{clearInterval(_.it);}catch(e){}}
	_.playM=function(mn)
{
	if(_.doing==1)return;
	_.stopM();
	var m=eval("_."+mn);
	_.it=setInterval(m,1);
}
}


I.M=function(O)
{
	return new I.MC(O);
}
