function setTicker() {
	if ($('nttext')!=null) {
		var ticker = new marqueeText('nttext','roller',null);
		ticker.run();
	//	Event.observe($('nttext'), 'mouseover', function(){ticker.stoper()});
		Event.observe($('roller'), 'mouseover', ticker.stoper.bindAsEventListener(ticker));
		Event.observe($('roller'), 'mouseout', ticker.run.bindAsEventListener(ticker));
	}
	
}

   function getPageSize() {
        
     var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = window.innerWidth + window.scrollMaxX;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	
	if (self.innerHeight) {	// all except Explorer
		if(document.documentElement.clientWidth){
			windowWidth = document.documentElement.clientWidth; 
		} else {
			windowWidth = self.innerWidth;
		}
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = xScroll;		
	} else {
		pageWidth = windowWidth;
	}

	return [pageWidth,pageHeight];
}

var marqueeText = Class.create();
marqueeText.prototype = {
	initialize: function(obj,text,params) {
		/**Настраиваемые параметры*/
		this.textspeed = 80;
		this.period = 10;
		
		this.speed=this.textspeed
		
		this.obj = $(obj); //объект, (в котором все движется)
		$(text).style.display='none';
		this.ow = this.obj.offsetWidth; //ширина объекта
		this.text = $(text); //то что движется
		/**накладываем стили и делаем объект релативным*/
		this.obj.style.overflow="hidden";
		this.obj.style.height = '2em';
		this.obj.style.position='relative';
		
		/**накладываем стили и делаем текст абсолютным*/
		this.text.style.whiteSpace='nowrap';
		this.text.show();
		this.tw = this.text.offsetWidth;
		//alert(this.tw);
		this.text.style.display='block';
		this.text.style.position='absolute';
		
		/**сдвигаем текст почти в самый конец объекта*/
		this.ctl = this.ow-100;
		this.text.style.left=this.ctl+'px';
		this.isrun=false;
	},
	
	stoper: function() {
		this.speed = 0;
		
	},
	
	positioned: function(pe) {
		this.pe=pe;
		this.ctl = this.ctl-this.speed*(this.period/1000);
		if (this.ctl<-this.tw) {
			this.ctl=this.ow;
		}
		this.text.style.left=this.ctl+'px';
	},
	
	run: function(pe) {
		this.speed = this.textspeed;
		if (this.isrun) {
			return;
		}
		this.isrun = true;
		new PeriodicalExecuter(this.positioned.bind(this),this.period/1000);
		
	}
	
}

function reswin() {
	setTicker();
	var pageheight = getPageSize()[1];
	var contheight = $('frame').getHeight();
	if(contheight < pageheight){
		$('container').setStyle({ height: (pageheight-362) + 'px' });
	} else {
		$('container').setStyle({ height: 'auto' });
	}
}

window.onresize = reswin;
window.onload = reswin;