function InitializeMarquee(container, realmarquee,dummyClass, dirction, marqueespeed){
	this.dirction = dirction;
	this.marqueespeed = marqueespeed; //Specify marquee scroll speed (larger is faster 1-10)
	this.pauseit = 1; //Pause marquee onMousever (0=no. 1=yes)?
	this.copyspeed = this.marqueespeed;
	this.pausespeed = (this.pauseit == 0) ? this.copyspeed : 0;
	this.actualWidth = '';
    this.container = container;
	this.realOne = realmarquee;
	this.newOne = realmarquee + 'New';
	$(this.container).style.width = '5000px';
    this.widdd = 0;
	this.paras = $A($(this.realOne).getElementsByClassName(dummyClass)).compact(); 
	for (i = 0; i < this.paras.length; i++) {
		this.widdd = this.widdd + parseInt($(this.paras[i]).offsetWidth); 
	}
	
	//this.paras.each(function(elm){ this.widdd = this.widdd + parseInt(elm.offsetWidth); });
	$(this.container).style.width = (this.widdd * 2) + 'px';
	
	$(this.realOne).style.left = 0;
	this.containerWidth = $(this.container).offsetWidth;
	this.actualWidth = $(this.realOne).offsetWidth;
    $(this.realOne).style.width = this.actualWidth + 'px';
	if ( this.containerWidth > this.actualWidth ) { $(this.container).style.width = this.actualWidth; }
	if (!$(this.newOne)) {
		newUl = document.createElement('div');
		newUl.id = this.newOne;
		
		if (this.dirction == 'left')
		  new Insertion.After(this.realOne, newUl);  
		else 
		  new Insertion.Before(this.realOne, newUl);  
		
		$(this.newOne).innerHTML = $(this.realOne).innerHTML;
		$(this.newOne).style.position = $(this.realOne).style.position;
		$(this.newOne).style.padding = $(this.realOne).style.padding;
		$(this.newOne).style.margin = $(this.realOne).style.margin;
		$(this.newOne).style.width = $(this.realOne).style.width;
	    $(this.newOne).style.left = this.actualWidth + 'px';
	    $(this.newOne).style.top = $(this.realOne).style.top;
	    $(this.newOne).style.float = 'left';
	}
   if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1) { //if Opera or Netscape 7x, add scrollbars to scroll and exit
		$(this.realOne).style.Width = this.containerWidth + "px";
		$(this.realOne).style.overflow = "scroll";
		$(this.newOne).style.width = this.containerWidth + "px";
		$(this.newOne).style.overflow = "scroll";
		return;
	}
    
	// add mouseover and mouseout event
	Event.observe($(this.container), 'mouseover', this.mouseOver.bind(this)); 
	Event.observe($(this.container), 'mouseout', this.mouseOut.bind(this)); 
	this.timer = setTimeout(this.inverVal.bind(this), 2000);
}
InitializeMarquee.prototype.mouseOver = function() {
  	this.copyspeed = this.pausespeed;
}
InitializeMarquee.prototype.mouseOut = function() {
  	this.copyspeed = this.marqueespeed;
}
InitializeMarquee.prototype.inverVal = function() {
  	this.callAgain = setInterval(this.scrollmarquee.bind(this),80);
}
InitializeMarquee.prototype.scrollmarquee = function(){
	if (this.dirction == 'left') { 
		$(this.realOne).style.left = parseInt($(this.realOne).style.left) - this.copyspeed + "px";
		$(this.newOne).style.left = parseInt($(this.newOne).style.left) - this.copyspeed + "px";
		if ( parseInt($(this.realOne).style.left) + 10  <= this.actualWidth*(-1) ) {
		   $(this.realOne).style.left = this.actualWidth + "px";					
		}
		if ( parseInt($(this.newOne).style.left) + 10  <= this.actualWidth*(-1)  ) {
		   $(this.newOne).style.left = this.actualWidth + "px";					
		}
	}
	else {
		$(this.realOne).style.left = parseInt($(this.realOne).style.left) + this.copyspeed + "px";
		$(this.newOne).style.left = parseInt($(this.newOne).style.left) + this.copyspeed + "px";
		if ( parseInt($(this.realOne).style.left) + 10  >= this.actualWidth ) {
		   $(this.realOne).style.left = this.actualWidth*(-1) + "px";					
		}
		if ( parseInt($(this.newOne).style.left) + 10  >= this.actualWidth  ) {
		   $(this.newOne).style.left = this.actualWidth*(-1) + "px";					
		}
	}
}
/*_......................................................................_*/
function moveRight1() {
  curLeft = $('banner-one').style.left;
  if ( parseInt($('banner-one').style.left) >= 0 ) {
	 $('banner-one').style.left = '0px'; 
     clearInterval(startInterval);
	 return false;   
  }
  $('banner-one').style.left = (parseInt(curLeft) + 10) + "px";     
}
function moveRight() {
  clearInterval(startInterval);
  startInterval = setInterval("moveRight1()",100);	
}
function moveLeft() {
  clearInterval(startInterval);
  startInterval = setInterval("moveLeft1()",100);	
}
function moveLeft1() {
  curLeft = $('banner-one').style.left;
  if ( Math.abs(parseInt(curLeft)) >= (bannerWidth - 650) ) {
    clearInterval(startInterval);
	 return false;   
  }
  $('banner-one').style.left = (parseInt(curLeft) - 10) + "px";     
}
function stopMoving() {
  clearInterval(startInterval);
}

/*_......................................................................_*/
var startInterval;
var bannerWidth = 0;
document.observe('dom:loaded', function () { 
		if ( $('marqueecontainer') )
		   new InitializeMarquee('marqueecontainer','vmarquee', 'dummyClass', 'left', 3); // container div, content div , move to (left to right or right to left), moving speed
		if ( $('marqueecontainer1') )
		   new InitializeMarquee('marqueecontainer1','vmarquee1','dummyClass1', 'left', 2); // container div, content div , move to (left to right or right to left), moving speed

		if ($('banner-one')) {
	       paras = $A($('banner-one').getElementsByClassName('banner-box')); 
	       paras.each(function(elm){ bannerWidth = bannerWidth + parseInt(elm.offsetWidth); });
		   $('banner-one').style.left = '0px';
		   $('banner-one').style.width = bannerWidth+'px';
		   
		}
});
