/***********************************************
* Cross browser Marquee II- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

AlcassoftMarquee=function(params)
{
	this.delayb4scroll = 2000;
	this.marqueespeed=1;
	this.pauseit=1;
	this.cross_marquee;
	this.marqueeheight;
	this.elementid = "vmarquee";
	this.containerid = "marqueecontainer";
	
	this.copyspeed=this.marqueespeed;
	this.pausespeed=(this.pauseit==0)? this.copyspeed: 0;
	this.actualheight=5392;
	this.lefttime;//set interval pointer
	
	for(var param in params)
	{
		this[param] = params[param];
	}
}

AlcassoftMarquee.prototype.scrollmarquee=function()
{
	var a = parseInt(this.cross_marquee.style.top);
	var b = (this.actualheight*(-1)+8);
	
	if (a>b)
		this.cross_marquee.style.top=a-this.copyspeed+"px"
	else
		this.cross_marquee.style.top=parseInt(this.marqueeheight)+8+"px"
}

AlcassoftMarquee.prototype.initializemarquee=function()
{
	this.cross_marquee=document.getElementById(this.elementid);
	
	if(this.cross_marquee)
	{
		this.attachMouseOverEvents(this.cross_marquee);
		this.attachMouseOutEvents(this.cross_marquee);
	}
	
	this.cross_marquee.style.top=0;
	this.marqueeheight=document.getElementById(this.containerid).offsetHeight;
	this.actualheight=this.cross_marquee.offsetHeight;
	
	if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1)
	{ 
		//if Opera or Netscape 7x, add scrollbars to scroll and exit
		this.cross_marquee.style.height=this.marqueeheight+"px"
		this.cross_marquee.style.overflow="scroll"
		return;
	}
	
	var jonsobj = new Object();
	jonsobj['this'] = this;
	
	var func = function(obj){
		this.obj = obj;
	}
	
	var myfunc = new func(jonsobj['this']);
	setTimeout(
		function(){
			myfunc.obj.startInterval();
		}
	,this.delayb4scroll);
}

AlcassoftMarquee.prototype.startInterval=function()
{
	var jonsobj = new Object();
	jonsobj['this'] = this;
	var AnonaFunc = function(obj){
		this.obj = obj;
	}
	var anonaFunc = new AnonaFunc(jonsobj['this']);
	this.lefttime = setInterval(
		function()
		{
			anonaFunc.obj.scrollmarquee()
		}
	,30);
}

AlcassoftMarquee.prototype.attachMouseOverEvents=function(element)
{
	var jonsobj = new Object();
	jonsobj['this'] = this;
	
	
	Event.observe(element,'mouseover',
		function(){
			jonsobj['this'].copyspeed = jonsobj['this'].pausespeed;
		}
	);
}

AlcassoftMarquee.prototype.attachMouseOutEvents=function(element)
{
	var jonsobj = new Object();
	jonsobj['this'] = this;
	
	
	Event.observe(element,'mouseout',
		function(){
			jonsobj['this'].copyspeed = jonsobj['this'].marqueespeed;
		}
	);
}

AlcassoftMarquee.prototype.test=function()
{
	alert(this);
}
