			/************************************************/			
			ITimerable=function(){
				this.timerTick=function(){};
				this.condExit=function(){};
				this.exitingAction=function(){};
			}
			/*************************************************/
			
			
			/*************************************************/
			function Linterp(coordsX, coordsY, _x){
				if (coordsX.length != coordsY.length) 
					throw 'coordsX.length!=coordsY.length';
				
				if(_x < coordsX[0] || _x > coordsX[coordsX.length-1]) return 0;
				
				for (var i = 0; i < coordsX.length - 1; i++)
					if (_x >= coordsX[i] && _x <= coordsX[i + 1]) 
						return ((coordsY[i] - coordsY[i + 1]) / (coordsX[i] - coordsX[i + 1])) * (_x - coordsX[i + 1]) + coordsY[i + 1];
				return 0;
			}
				
			var LinterArray={
				devide:function(arr, value){
					if(value==0){
						alert("devide by zero");return;
					}
					
					for(var i=0; i<arr.length; i++)	arr[i]/=value;
					return arr;
				},
				subtract:function(arr, value){
					if(value==0) return arr;
					for(var i=0; i<arr.length; i++)	arr[i]-=value;
					return arr;
				},
				addition:function(arr, value){
					if(value==0)return arr;
					for(var i=0; i<arr.length; i++)	arr[i]+=value;
					return arr;
				},
				multiple:function(arr, value){
					for(var i=0; i<arr.length; i++)	arr[i]*=value;
					return arr;
				},
				
				cast2unit: function(arr){
					arr=this.subtract(arr, arr[0]);
					arr=this.devide(arr,arr[arr.length-1]);
					return arr;
				}
			}
			/*************************************************/
			
			/******************************************/
			function StyleSetter(obj){this._obj = obj;}
			StyleSetter.prototype.set=function(value){alert("StyleSetter");};
			
			
			function StyleSetterTop(obj){
				this.base = StyleSetter;
				this.base(obj);
			}
			StyleSetterTop.prototype = new StyleSetter;
			StyleSetterTop.prototype.set=function(value){
				this._obj.style.top = value+"px";
			}
			
			function StyleSetterLeft(obj){
				this.base = StyleSetter;
				this.base(obj);
			}
			StyleSetterLeft.prototype = new StyleSetter;
			StyleSetterLeft.prototype.set=function(value){
				this._obj.style.left = value+"px";
			}

			function StyleSetterHeight(obj){
				this.base = StyleSetter;
				this.base(obj);
			}
			StyleSetterHeight.prototype = new StyleSetter;
			StyleSetterHeight.prototype.set=function(value){
				this._obj.style.height = value+"px";
			}

			
			/******************************************/
			
			/*******************************************/
			TransferatorLinear=function(srcBegin,srcEnd	,speedX	,speedY, styleSetter)
			{
				var _timer = 0;
				var _srcBegin = 0;
				var _srcEnd = 0;
				var _speedX =0;
				var _speedY =0;
				var _markDirection = 1;
				var _styleSetter =0;
				var _pointTransfer=0;
				var _onExit=0;
				
				_init(srcBegin,srcEnd	,speedX	,speedY, styleSetter);
				
				function _init(srcBegin, srcEnd, speedX, speedY, styleSetter){

					if(!styleSetter instanceof StyleSetter){
						alert("!styleSetter instanceof StyleSetter") 
						return;
					}
					_srcBegin = srcBegin;
					_srcEnd   = srcEnd; 
					_speedX   = LinterArray.multiple(LinterArray.cast2unit(speedX), Math.abs(srcBegin-srcEnd));
					_speedY   = speedY;
					_pointTransfer = srcBegin;
					_styleSetter = styleSetter;
					
					_markDirection = (_srcEnd  - _srcBegin)/Math.abs(_srcEnd  - _srcBegin);
				}
				
				this.begin=function(frequency, onExit){
					if(_timer!=0) return;
					_onExit = onExit;
					_timer = new Timer(this,frequency);	
				}
				
				this.interrupt=function(){
					if(_timer ==0) return;
					_timer.exit();
				}
				
				this._timerTick = function(){
					_pointTransfer += Linterp(_speedX, _speedY,Math.abs(_pointTransfer-_srcBegin)) * _markDirection;
					_styleSetter.set(_pointTransfer);
				}
				
				this._condExit = function(){
					return _markDirection>0 ? _pointTransfer >= _srcEnd: _pointTransfer<=_srcEnd;
				}
				
				this._exitingAction = function(){
					_styleSetter.set(_srcEnd);
					if(_onExit!=0) _onExit();
				}
			}
			
			TransferatorLinear.prototype = new ITimerable();
			TransferatorLinear.prototype.timerTick=function(){this._timerTick();};
			TransferatorLinear.prototype.condExit=function(){return this._condExit();};
			TransferatorLinear.prototype.exitingAction=function(){this._exitingAction();};
			/**--------------------------------------------**/
			
			
			
			/*************************************************/
			function Timer(task, frequency){
				var _task  =0;
				var _timer = 0;
				
				run(task, frequency);
				
				function run(task, frequency){
					if(!checkTimerParam(task)) return false;
					
					_task = task;
					_timer = setInterval(timerTick, frequency);
					
					return true;
				}
				
			 	function timerTick(){
					if(_task.condExit()){
						exit();
						_task.exitingAction();
					}
					
					_task.timerTick();
				}
				
				function exit(){
					clearInterval(_timer);	
					_timer = 0;	

					return;	
				}
				
				this.exit=function(){
					exit();
				}

				function checkTimerParam(task){
					
					if (!task instanceof ITimerable) {	alert("task must be ITimerable");return false;}
					
					_task = task;
					return true;
				}
			}
			/************************************************/	
