nlsScroller=new Object();
_ua=navigator.userAgent;
nls_isIE=(_ua.indexOf("MSIE")>=0);
nls_isIE5=(_ua.indexOf("MSIE 5.0")>=0);
nls_isIE4=(_ua.indexOf("MSIE 4")>=0);
nls_isSafari=(_ua.indexOf("Safari")>=0);
nls_isOpera=(_ua.indexOf("Opera")>=0);
if(nls_isOpera)nls_isIE=false;
function NlsScrollerIco(path){
	if(!path||path==""){
		var allScs=(document.getElementsByTagName?document.getElementsByTagName("SCRIPT"):document.scripts);
		for(var i=0;i<allScs.length;i++){
			if(allScs[i].src.toLowerCase().indexOf("nlsscroller.js")>=0){
				path=allScs[i].src.replace(/nlsscroller.js/gi,"img/");
				break
			}
		}
	}
	this.next=path+"next.gif";
	this.nextover=path+"nextover.gif";
	this.prev=path+"prev.gif";
	this.prevover=path+"prevover.gif";
	this.resume=path+"play.gif";
	this.resumeover=path+"playover.gif";
	this.stop=path+"stop.gif";
	this.stopover=path+"stopover.gif";
	this.backgrd=path+"bg.gif";
	this.modeauto=path+"modeauto.gif";
	this.modeman=path+"modeman.gif";
	this.loading=path+"loading.gif";
	return this
}
function NlsScroller(s){
	this.scrlId=s;
	this.intRef=null;
	this.blockObj=null;
	this.helper=null;
	this.ico=new NlsScrollerIco();
	nlsScroller[s]=this;
	this.mode="AUTO";
	this.effect=new NlsEffContinuous();
	this.showToolbar=false;
	this.toolbar=["MODE","PLAY","PREV","NEXT"];
	this.content=[];
	this.width=150;
	this.height=80;
	this.speed=3500;
	this.stylePref="";
	this.stopOnMouseOver=false;
	this.loadText="Loading...";
	this.prev=function(){
		this.effect.prev()
	};
	this.next=function(){
		this.effect.next()
	};
	this.onMouseOver=function(){};
	this.onMouseOut=function(){};
	return this
}
NLSSCROLLER=NlsScroller.prototype;
NLSSCROLLER.setContent=function(c){
	var bd=c.match(/<body[^>]/gi);
	if(bd){
		c=c.substr(c.indexOf(bd[0]));
		c=c.substr(c.indexOf(">")+1);
		bd=c.match(/<\/body>/gi);
		if(bd){
			c=c.substr(0,c.indexOf(bd[0]));
		}
	}
	var s="<span class=\"nlsscrollerbreak\"></span>";
	c=c.replace(/<span class=(["']*)nlsscrollerbreak(["']*)><\/span>/gi,s);
	this.content=c.split(s);
	this.reload();
};
NLSSCROLLER.setContentById=function(id){
	var cnt=NlsScroller.GE(id);
	cnt.style.overflow="hidden";
	this.setContent(cnt.innerHTML);
};
NlsScroller.$posAttr=function(){
	var pos="absolute",dsp="none";
	if(nls_isIE4){
		pos="absolute";
		dsp="block"
	}
	return[pos,dsp]
};
NlsScroller.$genContent=function(c){
	var str="",atr=NlsScroller.$posAttr();
	;
	for(var i=0;i<c.content.length;i++){
		str+=("<table id='"+c.scrlId+"line"+i+"' style='display:"+atr[1]+";position:absolute;top:0px' class='"+c.stylePref+"scrlcontentfrm'><tr><td class='"+c.stylePref+"scrlcontent'>"+c.content[i]+"</td></tr></table>");
	}
	return str
};
NLSSCROLLER.render=function(plc){
	var atr=NlsScroller.$posAttr(),sId=this.scrlId,sObj="nlsScroller."+sId;
	var autoTool="<table id='"+sId+"auto' cellpadding='0' cellspacing='0' "+(this.mode=="MANUAL"?"style='display:none'":"")+"><tr>";
	autoTool+="<td onmouseover=\"NlsScroller.tbMOVR('"+sId+"play')\" onmouseout=\"NlsScroller.tbMOUT('"+sId+"play')\" onclick='"+sObj+".resume();'><img id='"+sId+"play' src='"+this.ico.resume+"' alt='Run' ><img id='"+sId+"playover' src='"+this.ico.resumeover+"' style='display:none' alt='Play'></td>";
	autoTool+="<td onmouseover=\"NlsScroller.tbMOVR('"+sId+"pause')\" onmouseout=\"NlsScroller.tbMOUT('"+sId+"pause')\" onclick='"+sObj+".stop();'><img id='"+sId+"pause' src='"+this.ico.stop+"' alt='Stop'><img id='"+sId+"pauseover' src='"+this.ico.stopover+"' style='display:none' alt='Stop'></td>";
	autoTool+="</tr></table>";
	var manTool="<table id='"+sId+"manual' border='0' cellpadding='0' cellspacing='0' "+(this.mode=="AUTO"?"style='display:none'":"")+"><tr>";
	manTool+="<td onmouseover=\"NlsScroller.tbMOVR('"+sId+"prev')\" onmouseout=\"NlsScroller.tbMOUT('"+sId+"prev')\" onclick='"+sObj+".prev();'><img id='"+sId+"prev' src='"+this.ico.prev+"' alt='Previous'><img id='"+sId+"prevover' src='"+this.ico.prevover+"' style='display:none' alt='Previous'></td>";
	manTool+="<td onmouseover=\"NlsScroller.tbMOVR('"+sId+"next')\" onmouseout=\"NlsScroller.tbMOUT('"+sId+"next')\" onclick='"+sObj+".next();'><img id='"+sId+"next' src='"+this.ico.next+"' alt='Next'><img id='"+sId+"nextover' src='"+this.ico.nextover+"' style='display:none' alt='Next'></td>";
	manTool+="</tr></table>";
	var modeTool="<table cellpadding='0' cellspacing='0'><tr><td onclick='"+sObj+".toggleMode();'><img id='"+sId+"mode' src='"+this.ico.modeauto+"' "+(this.mode=="MANUAL"?"style='display:none'":"")+" alt='Toggle scroll mode: auto/manual'><img id='"+sId+"modeover' src='"+this.ico.modeman+"' "+(this.mode=="AUTO"?"style='display:none'":"")+" alt='Toggle scroll mode: auto/manual'></td></tr></table>";
	var ld="<table id=\""+sId+"$loading\" style='display:none;position:absolute;top:z-index:1000'><tr><td><img src='"+this.ico.loading+"'></td><td style='color:#333333'>"+this.loadText+"</td></tr></table>";
	var str=NlsScroller.$genContent(this);
	str="<div id=\""+sId+"$content\" style='height:100%'>"+str+"</div>";str+=("<div id='"+sId+"Helper' style='display:"+atr[1]+";position:absolute;top:0px;width:100%;height:100%' class='"+this.stylePref+"scrlefflayerH'><table width='100%' cellpadding='0' cellspacing='0'><tr><td></td></tr></table></div>");
	str=("<div id=\""+sId+"\" style='position:absolute;overflow:hidden;width:"+this.width+"px;height:"+this.height+"px;' onmouseover=\"NlsScroller.mOver('"+sId+"')\" onmouseout=\"NlsScroller.mOut('"+sId+"')\">"+str+"</div>");
	str="<table cellpadding='0' cellspacing='0'><tr><td valign='top' style='width:"+this.width+"px;height:"+this.height+"px'>"+str;
	str+="</td></tr></table>";
	str="<table cellpadding='0' cellspacing='0' class='"+this.stylePref+"nlsscroller'><tr><td class='"+this.stylePref+"scrlclient'>"+ld+str+"</td></tr>";
	if(this.showToolbar&&this.toolbar.length>0)str+="<tr><td class='"+this.stylePref+"scrltoolbar' background='"+this.ico.backgrd+"' align='center'><table width='100%' height='100%' cellpadding='0' cellspacing='0'><tr><td width='20px'>&nbsp;</td><td align='center'>"+autoTool+manTool+"</td><td width='20px'>"+modeTool+"</td></tr></table></td></tr>";
	str+="</table>";
	str+="<div style='font-style:italic;color:#999999;'>&#78;&#108;&#115;&#83;&#99;&#114;&#111;&#108;&#108;&#101;&#114; &#80;&#114;&#111; &#68;&#101;&#109;&#111;&#46; &#67;&#111;&#112;&#121;&#114;&#105;&#103;&#104;&#116; &#50;&#48;&#48;&#55; &#97;&#100;&#100;&#111;&#98;&#106;&#101;&#99;&#116;&#46;&#99;&#111;&#109;</div>";
	if(plc){
		var tPlc=NlsScroller.GE(plc);
		tPlc.innerHTML=str;
		tPlc.style.display="block"
	}else{
		document.write(str);
		str=""
	}
	this.helper=NlsScroller.GE(sId+"Helper");
	this.scrl=NlsScroller.GE(sId);
	this.cntWin=NlsScroller.GE(sId+"$content");
	this.ldng=NlsScroller.GE(sId+"$loading");
	if(nls_isIE){
		window.attachEvent("onload",function(){nlsScroller[sId].start();});
	}else{
		window.addEventListener("load",function(){nlsScroller[sId].start();},false);
	}
	return str
};
NLSSCROLLER.reload=function(){
	if(!this.cntWin)return;
	this.stop();
	this.cntWin.innerHTML=NlsScroller.$genContent(this);
};
NLSSCROLLER.start=function(){
	var line=null;
	this.blockObj=[];
	for(var i=0;i<this.content.length;i++){
		line=NlsScroller.GE(this.scrlId+"line"+i);
		this.blockObj[this.blockObj.length]=line;
		with(line.style){
			zIndex=this.content.length-i;
			display=""
		}
	}
	if(this.blockObj.length==0)return;
	this.effect.init(this);
	this.stop();
	if(this.effect.name=="NlsEffContinuous"){
		this.intRef=setTimeout("eval(nlsScroller."+this.scrlId+".effect.run())",this.speed);
	}else{
		if(this.mode=="AUTO"){
			this.intRef=setInterval("eval(nlsScroller."+this.scrlId+".effect.run())",this.speed);
		}
	}
};
NLSSCROLLER.stop=function(){
	if(!this.effect)return;
	if(this.effect.name=="NlsEffContinuous"){
		this.effect.stop();
		if(this.intRef){
			clearTimeout(this.intRef);
			this.intRef=null
		}
	}else{
		if(this.intRef){
			clearInterval(this.intRef);
			this.intRef=null
		}
	}
};
NLSSCROLLER.resume=function(){
	if(!this.effect)return;
	if(this.effect.name=="NlsEffContinuous"){
		this.effect.run();
	}else{
		if(this.intRef==null){
			this.intRef=setInterval("eval(nlsScroller."+this.scrlId+".effect.run())",this.speed);
		}
	}
};
NLSSCROLLER.toggleMode=function(){
	var m=NlsScroller.GE(this.scrlId+"mode");
	var mo=NlsScroller.GE(this.scrlId+"modeover");
	var mn=NlsScroller.GE(this.scrlId+"manual");
	var at=NlsScroller.GE(this.scrlId+"auto");
	if(this.mode=="AUTO"){
		if(this.effect.name=="NlsEffContinuous"){
			alert("Manual mode not available in this effect");
			return
		}
		this.mode="MANUAL";
		this.stop();
		m.style.display="none";
		mo.style.display="";
		mn.style.display="";
		at.style.display="none"
	}else if(this.mode=="MANUAL"){
		this.mode="AUTO";
		this.effect.cfg["topicsequence"]="next";
		this.resume();
		m.style.display="";
		mo.style.display="none";
		mn.style.display="none";
		at.style.display=""
	}
};
NLSSCROLLER.setEffect=function(eff){
	if(!eff)return;
	if(eff.name=="NlsEffContinuous"){
		if(NlsScroller.GE(this.scrlId+"mode")){
			if(this.mode=="MANUAL")this.toggleMode();
		}else{
			this.mode="AUTO"
		}
	}else if(eff.name=="NlsEffIETrans"){
		if(!nls_isIE||nls_isIE5)return
	}else if(eff.name=="NlsEffFade"){
		if(nls_isOpera||nls_isIE5)return
	}
	this.stop();
	this.effect=eff
};
NlsScroller.GE=function(id){
	if(document.all){
		return document.all(id);
	}else if(document.getElementById){
		return document.getElementById(id);
	}
};
NlsScroller.exitView=function(dirc,pos,bound){
	switch(dirc){
		case"up":
			;
		case"left":
			return(pos<=bound);
		case"down":
			;
		case"right":
			return(pos>=bound);
	}
};
NlsScroller.prevTopic=function(){
	this.cfg.topicsequence="prev";
	this.run();
};
NlsScroller.nextTopic=function(){
	this.cfg.topicsequence="next";
	this.run();
};
NlsScroller.setTopic=function(){
	this.crTpc=NlsScroller.getTopic(this);
};
NlsScroller.getTopic=function(f){
	var cnt=f.scr.blockObj.length,tp=f.crTpc;
	if(f.cfg.topicsequence=="next"){
		tp=(tp==cnt-1?0:tp+1);
	}else{
		tp=(tp==0?cnt-1:tp-1);
	}
	return tp
};
NlsScroller.tbMOVR=function(b){
	NlsScroller.GE(b).style.display="none";
	NlsScroller.GE(b+"over").style.display=""
};
NlsScroller.tbMOUT=function(b){
	NlsScroller.GE(b).style.display="";
	NlsScroller.GE(b+"over").style.display="none"
};
NlsScroller.mOver=function(scrlId){
	var scr=nlsScroller[scrlId];
	if(scr.mode=="MANUAL")return;
	if(scr.stopOnMouseOver)scr.stop();
	scr.onMouseOver();
};
NlsScroller.mOut=function(scrlId){
	var scr=nlsScroller[scrlId];
	if(scr.mode=="MANUAL")return;
	if(scr.stopOnMouseOver)scr.resume();
	scr.onMouseOut();
};
function NlsEffContinuous(conf){
	var me=this;
	this.scr=null;
	this.rtprop={};
	this.cfg={direction:"up",speed:40,step:1,delay:0};
	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.crTpc=0;
	this.lsTpc=null;
	this.name="NlsEffContinuous";
	this.init=function(scr){
		this.scr=scr;
		this.crTpc=0;
		var line=null;
		var tmpPos=0;
		for(var i=0;i<this.scr.blockObj.length;i++){
			line=this.scr.blockObj[i];
			line.style.height="";
			with(line.style){
				switch(this.cfg["direction"]){
					case"up":
						left=0;
						top=tmpPos+"px";
						tmpPos+=line.offsetHeight;
					break;
					case"down":
						left=0;
						tmpPos+=line.offsetHeight;
						top=(this.scr.height-tmpPos)+"px";
					break;
					case"left":
						top=0;
						left=tmpPos+"px";
						tmpPos+=line.offsetWidth;
					break;
					case"right":
						top=0;
						tmpPos+=line.offsetWidth;
						left=(this.scr.width-tmpPos)+"px";
					break
				}
			}
		}
		this.lsTpc=line
	};
	this.run=function(){
		if(!this.scr)return;
		var step=1,dir,odim,dim,sdir=this.cfg["direction"];
		switch(sdir){
			case"up":
			case"left":
				this.runScroll=runUpLeft;
				step=-this.cfg["step"];
			break;
			case"down":
			case"right":
				this.runScroll=runDownRight;
				step=+this.cfg["step"];
			break
		}
		switch(sdir){
			case"up":
			case"down":
				dir="top";
				odim="offsetHeight";
				dim="height";
			break;
			case"left":
			case"right":
				dir="left";
				odim="offsetWidth";
				dim="width";
			break
		}
		this.stop();
		this.rtprop["tmId"]=window.setInterval(function(){me.runScroll(step,dir,odim,dim);},+me.cfg["speed"]);
	};
	this.runScroll=function(){};
	function runUpLeft(step,p_dir,p_odim,p_dim){
		var l,pos,bl=this.scr.blockObj;
		for(var i=0;i<bl.length;i++){
			l=bl[i];
			pos=parseInt(l.style[p_dir])+step;
			l.style[p_dir]=pos+"px";
			if(pos>this.scr[p_dim]){
				pos=parseInt(bl[i-1].style[p_dir])+bl[i-1][p_odim];
				l.style[p_dir]=pos+"px";
				break
			}
		}
		l=bl[0];
		pos=parseInt(l.style[p_dir]);
		var bound=-l[p_odim];
		if(NlsScroller.exitView(this.cfg["direction"],pos,bound)){
			var t=parseInt(this.lsTpc.style[p_dir])+this.lsTpc[p_odim];
			l.style[p_dir]=(t>this.scr[p_dim]?t:this.scr[p_dim])+"px";
			this.lsTpc=l;
			for(var i=0;i<bl.length-1;i++){
				bl[i]=bl[i+1]}bl[i]=l;
				if(+this.cfg["delay"]>0){
					this.stop();
					setTimeout(function(){me.run();},+this.cfg["delay"]);
				}
			}
		}
		function runDownRight(step,p_dir,p_odim,p_dim){
			var l,pos,bl=this.scr.blockObj;
			for(var i=0;i<bl.length;i++){
				l=bl[i];
				pos=parseInt(l.style[p_dir])+step;
				l.style[p_dir]=pos+"px";
				if(pos+l[p_odim]<0){
					pos=parseInt(bl[i-1].style[p_dir])-l[p_odim];
					l.style[p_dir]=pos+"px";
					break
				}
			}
			l=bl[0];
			pos=parseInt(l.style[p_dir]);
			var bound=this.scr[p_dim];
			if(NlsScroller.exitView(this.cfg["direction"],pos,bound)){
				var t=parseInt(this.lsTpc.style[p_dir]);
				l.style[p_dir]=(t<0?(t-l[p_odim]):-l[p_odim])+"px";
				this.lsTpc=l;
				for(var i=0;i<bl.length-1;i++){
					bl[i]=bl[i+1]}bl[i]=l;
					if(+this.cfg["delay"]>0){
						this.stop();
						setTimeout(function(){me.run();},+this.cfg["delay"]);
					}
				}
			};
			this.stop=function(){
				if(this.rtprop["tmId"]!=null){
					clearInterval(this.rtprop["tmId"]);
					this.rtprop["tmId"]=null
				}
			}
		}