function NlsEffSlide(conf){
var me=this;
this.scr=null;
this.rtprop={point:{}};
this.cfg={type:"shift",direction:"left",speed:10,stepsnum:40,topicsequence:"next",smartnavigation:"true"};
if(conf&&conf!=""){
	var tcnf=conf.replace(/\s+/gi,"").toLowerCase().split(",");
	var keyval="";
	for(var i=0;i<tcnf.length;i++){
		keyval=tcnf[i].split("=");
		this.cfg[keyval[0]]=keyval[1]
	}
}
this.rtprop["orgtype"]=this.cfg["type"];
this.crTpc=null;
this.lsTpc=null;
this.name="NlsEffSlide";
this.clearIv=function(){
	var p=this.rtprop;
	if(p["tmId"]!=null){
		clearInterval(p["tmId"]);
		p["tmId"]=null
	}
};
this.init=function(scr){
	this.scr=scr;
	this.crTpc=0;
	var b=this.scr.blockObj;
	switch(this.cfg.type){
		case"out":
			for(var i=0;i<b.length;i++){
				with(b[i].style){
					left="0px";top="0px"
				}
			}
		break;
		case"in":
		case"shift":
			var l=null;
			for(var i=0;i<b.length;i++){
				l=b[i];
				with(l.style){
					switch(this.cfg["direction"]){
						case"up":
							left=0+"px";
							top=this.scr.height+"px";
						break;
						case"down":
							left=0+"px";
							top=-l.offsetHeight+"px";
						break;
						case"left":
							left=this.scr.width+"px";
							top=0+"px";
						break;
						case"right":
							left=-l.offsetWidth+"px";
							top=0+"px";
						break
					}
				}
			}
			b[0].style.top="0px";
			b[0].style.left="0px";
			if(this.cfg.type=="in"){
				b[0].style.zIndex=b.length-1;
				b[1].style.zIndex=b.length
			}else{
				this.lsTpc=b[0]
			}
		break
	}
};
this.run=function(){
	if(this.rtprop.tmId!=null)
	return;
	var c=this.cfg;vert="top",p=this.rtprop.point,dir=c.direction,bl=this.scr.blockObj;
	this.rtprop.t=0;
	switch(dir){
		case"up":
			;
		case"down":
			vert="top";
		break;
		case"left":
			;
		case"right":
			vert="left";
		break
	}
	var cnt=bl.length;
	switch(this.cfg.type){
		case"out":
			this.runScroll=runScrollOut;
			var bh=null;
			bl[this.crTpc].style.zIndex=cnt;
			if(c.topicsequence=="next"){
				bh=bl[(this.crTpc==cnt-1?0:this.crTpc+1)]
			}else{
				bh=bl[(this.crTpc==0?cnt-1:this.crTpc-1)]
			}
			bh.style.zIndex=cnt-1;
			bh.style.top="0px";
			bh.style.left="0px";
			p.x1=0;
			switch(dir){
				case"up":
					p.x2=-this.scr.height;
				break;
				case"down":
					p.x2=this.scr.height;
				break;
				case"left":
					p.x2=-this.scr.width;
				break;
				case"right":
					p.x2=this.scr.width;
				break
			}
		break;
		case"in":
		case"shift":
			this.setTopic();
			var nextTpc=bl[this.crTpc];
			with(nextTpc.style){
				switch(dir){
					case"up":
						p.x1=this.scr.height;
						p.x2=0;
						top=p.x1+"px";
						left="0px";
					break;
					case"down":
						p.x1=-nextTpc.offsetHeight;
						p.x2=0;
						top=p.x1+"px";
						left="0px";
					break;
					case"left":
						p.x1=this.scr.width;
						p.x2=0;
						left=p.x1+"px";
						top="0px";
					break;
					case"right":
						p.x1=-nextTpc.offsetWidth;
						p.x2=0;
						left=p.x1+"px";
						top="0px";
					break
				}
			}
			nextTpc.style.zIndex=cnt;
			this.runScroll=(this.cfg.type=="in"?runScrollIn:runScrollShift);
		break
	}
	_fc_slide(p);
	this.points=[];
	for(var i=0;i<this.cfg.stepsnum;i++)
	this.points[i]=Math.ceil(effect_bezier(i/this.cfg.stepsnum,p.x1,p.x2,p.c1,p.c2))+"px";
	this.clearIv();
	this.rtprop["tmId"]=setInterval(function(){me.runScroll(vert,p);},+me.cfg["speed"]);
};
this.runScroll=function(){};
function runScrollIn(vert,p){
	var l=this.scr.blockObj[this.crTpc];
	if(this.rtprop.t>=this.points.length){
		var cnt=this.scr.blockObj.length;
		l.style[vert]="0px";
		for(var i=0;i<cnt;i++){
			if(i!=this.crTpc)
				this.scr.blockObj[i].style.zIndex=0}l.style.zIndex=cnt-1;
				this.clearIv();
			}else{
				l.style[vert]=this.points[this.rtprop.t++]
			}
		}
		function runScrollOut(vert,p){
			var l=this.scr.blockObj[this.crTpc];
			if(this.rtprop.t>=this.points.length){
				var cnt=this.scr.blockObj.length;
				with(l.style){
					zIndex=0;
					left="0px";
					top="0px"
				}
				this.setTopic();
				this.clearIv();
			}else{
				l.style[vert]=this.points[this.rtprop.t++]
			}
		}
		function runScrollShift(vert,p){
			var l=this.scr.blockObj[this.crTpc];
			var dirt=this.cfg["direction"],s=1;
			if(this.rtprop.t>=this.points.length){
				var cnt=this.scr.blockObj.length;
				this.clearIv();
				l.style[vert]="0px";
				for(var i=0;i<cnt;i++){
					if(i!=this.crTpc)this.scr.blockObj[i].style.zIndex=0
				}
				this.lsTpc.style.zIndex=0;
				l.style.zIndex=cnt-1;
				this.lsTpc=l
			}else{
				l.style[vert]=this.points[this.rtprop.t];
				if(dirt=="up"||dirt=="left")s=-1;
				this.lsTpc.style[vert]=parseInt(this.points[this.rtprop.t])+(s*parseInt(this.lsTpc[(vert=="top"?"offsetHeight":"offsetWidth")]))+"px";
				this.rtprop.t++
			}
		}
		this.prev=function(){
			this.navigate("prev");
		};
		this.next=function(){
			this.navigate("next");
		};
		this.navigate=function(dir){
			var pr=this.rtprop,c=this.cfg;
			if(pr.tmId!=null)
			return;
			c.topicsequence=dir;
			if(c.smartnavigation=="true"){
				if(c.type!="shift"){
					if(dir=="prev"){
						c.type=(pr.orgtype=="in"?"out":"in");
					}else{
						c.type=pr.orgtype
					}
				}
				var isLR=("leftright".indexOf(c.direction)>=0);
				if(dir=="prev")c.direction=(isLR?"left":"down");
				else if(dir=="next")c.direction=isLR?"right":"up"
			}
			this.run();
		};
		this.setTopic=NlsScroller.setTopic
	}
	function _fc_slide(p){
		p.c1=p.x1+(p.x2-p.x1)*4/5;
		p.c2=p.x2
	};
	function _f1(t){
		return(1-t);
	};
	function _f2(t){
		return(1-t)*(1-t);
	};
	function _f3(t){
		return(1-t)*(1-t)*(1-t);
	};
	function _f4(t){
		return t*t*t
	};
	function effect_bezier(t,x1,x2,c1,c2){
		return _f3(t)*x1+3*t*_f2(t)*c1+3*t*t*_f1(t)*c2+_f4(t)*x2
	};