function MMarqueen(id , boxid,width,height)
	{
		this.id = id; 
		this.boxid = boxid ;
		this.height = typeof(height) == 'undefined' ? -1 : height ;
		this.width = typeof(width) == 'undefined' ? -1 : width ;
		this.panel = null;
		this.cnt1 = null;
		this.cnt2 = null;
		this.offsetX = 0;
		this.offsetY = 0 ;
		this.direction = 'left' ;

		this.amount = 1 ;
		this.timer1 = null;
		this.delay = 30 ;

		this.start = function()
		{
			this.box = document.getElementById(this.boxid) ; 
			this.box.style.overflow = 'hidden' ;
			if(this.width != -1 )this.box.style.width = this.width ;
			else this.width = parseInt(this.box.style.width);
			if(this.height != -1 )	this.box.style.height = this.height;
			else this.height = parseInt(this.box.style.height);
			var content = "<nobr>"+this.box.innerHTML+"</nobr>" ;			
			this.box.innerHTML = '<div><div>'+content+'</div><div>'+content+'</div></div>';
			this.panel = this.box.childNodes.item(0);
			this.cnt1 = this.panel.childNodes.item(0);
			this.cnt2 = this.panel.childNodes.item(1);
			this.cnt1.style.position = 'absolute';						
			this.offsetX = this.cnt1.offsetWidth ;
			this.offsetY = this.cnt1.offsetHeight;
			this.cnt1.style.position = 'static';
			if(this.direction == 'left' || this.direction == 'right')
			{
				if(this.offsetX < this.width) this.cnt2.style.display = "none" ;
				this.cnt2.style.cssFloat = this.cnt2.style.styleFloat = 'left';
				this.cnt1.style.cssFloat = this.cnt1.style.styleFloat = 'left';
				this.panel.style.width = 2*this.offsetX+"px";
			}
			else if(this.direction == 'up' || this.direction == 'down')
			{
				if(this.offsetY < this.height) this.cnt2.style.display = "none" ;
				this.cnt2.style.cssFloat = this.cnt2.style.styleFloat = 'none';
				this.cnt1.style.cssFloat = this.cnt1.style.styleFloat = 'none';
				this.panel.style.width = 2*this.offsetY+"px";
			}
			this.play();
		}

		this.play = function ()//start scroll
		{
			if(this.direction == 'left' || this.direction == 'top')amount = 0 - Math.abs(this.amount) ;
			else 
				amount = this.amount;

			if(this.timer1 == null )
				this.timer1 = window.setInterval(this.id+'.scroll('+amount+')',this.delay);
		}

		this.stop = function()
		{
			if(this.timer1!= null ) clearInterval(this.timer1);
			this.timer1 = null;
		}

		this.scroll = function (offset)
		{
			offset = parseInt(offset);
			if(this.direction == 'up' || this.direction == 'down')
			{
				if(this.offsetY < this.height) return ;
				oldmargin  = parseInt( this.panel.style.marginTop);
				if(isNaN(oldmargin)) oldmargin = 0 ;
				newmargin = oldmargin + offset ;
				if(newmargin < 0 - this.offsetY) newmargin = 0 ;
				if(newmargin > 0) newmargin = 0 - this.offsetY ;
				this.panel.style.marginTop = newmargin+"px";
			}
			else
			{
				if(this.offsetX < this.width) return ;
				oldmargin  = parseInt( this.panel.style.marginLeft);
				if(isNaN(oldmargin)) oldmargin = 0 ;
				newmargin = oldmargin + offset ;
				if(newmargin < 0 - this.offsetX) newmargin = 0 ;
				if(newmargin > 0) newmargin = 0 - this.offsetX ;
				this.panel.style.marginLeft = newmargin+"px";
			}
		}
	}
