
function InitializeMarquee(container, realmarquee,dummyClass, dirction, marqueespeed){
	this.dirction = dirction;
	this.marqueespeed = 1; //Specify marquee scroll speed (larger is faster 1-10)
	this.pauseit = 0; //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.paras = $A($(this.realOne).getElementsByClassName(dummyClass)).compact(); 
    if ( (this.dirction == 'left') || (this.dirction == 'right') ) { 
		this.widdd = 0;
		for (i = 0; i < this.paras.length; i++) {
			this.widdd = this.widdd + parseInt($(this.paras[i]).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; }
	}
	else {
		this.heights = 0;
		for (i = 0; i < this.paras.length; i++) {
			this.heights = this.heights + parseInt($(this.paras[i]).offsetHeight); 
		}
		$(this.container).style.height = (this.heights * 2) + 'px';
		$(this.realOne).style.left = 0;
		this.containerHeight = $(this.container).offsetHeight;
		this.actualHeight = $(this.realOne).offsetHeight;
		$(this.realOne).style.height = this.actualHeight + 'px';
		if ( this.containerHeight > this.actualHeight ) { $(this.container).style.height = this.actualHeight; }
	}
	
	
	if (!$(this.newOne)) {
		newUl = document.createElement('div');
		newUl.id = this.newOne;
		if ( (this.dirction == 'left') || (this.dirction == 'top') )
		  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;
	    
		if ( (this.dirction == 'left') || (this.dirction == 'right') ) {
			$(this.newOne).style.left = this.actualWidth + 'px';
			$(this.newOne).style.top = $(this.realOne).style.top;
			$(this.newOne).style.float = 'left';
		}
		else {
		   if ( this.dirction == 'top' ) { 
			  $(this.realOne).style.top = '0px';
			  $(this.newOne).style.top = this.actualHeight+'px';
			  $(this.newOne).style.display = 'block';
		   }
		   else {
			  $(this.realOne).style.top = '0px';
			  $(this.newOne).style.top = this.actualHeight*(-1)+'px';
			  $(this.newOne).style.display = 'block';
		   }
		}
		
	}
	//alert($(this.container).innerHTML)
    
	// 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.dirction == 'right') ) { 
		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";					
			}
		}
	} // end if
	else {
		if (this.dirction == 'top') { 
			$(this.realOne).style.top = parseInt($(this.realOne).style.top) - this.copyspeed + "px";
			$(this.newOne).style.top = parseInt($(this.newOne).style.top) - this.copyspeed + "px";
			if ( parseInt($(this.realOne).style.top) + 10  <= this.actualHeight*(-1) ) {
			   $(this.realOne).style.top = this.actualHeight + "px";
			}
			if ( parseInt($(this.newOne).style.top) + 10  <= this.actualHeight*(-1)  ) {
			   $(this.newOne).style.top = this.actualHeight + "px";					
			}
		}
		else {
			$(this.realOne).style.top = parseInt($(this.realOne).style.top) + this.copyspeed + "px";
			$(this.newOne).style.top = parseInt($(this.newOne).style.top) + this.copyspeed + "px";
			if ( parseInt($(this.realOne).style.top) + 10  >= this.actualHeight ) {
			   $(this.realOne).style.top = this.actualHeight*(-1) + "px";					
			}
			if ( parseInt($(this.newOne).style.top) + 10  >= this.actualHeight  ) {
			   $(this.newOne).style.top = this.actualHeight*(-1) + "px";					
			}
		}
		
	}
}
/*_......................................................................_*/
function moveTop1() {
  curTop = $('banner-one').style.top;
  if ( parseInt($('banner-one').style.top) >= 0 ) {
	 $('banner-one').style.top = '0px'; 
     clearInterval(startInterval);
	 return false;   
  }
  $('banner-one').style.top = (parseInt(curTop) + 10) + "px";     
}
function moveTop() {
  clearInterval(startInterval);
  startInterval = setInterval("moveTop1()",100);	
}
function moveDown1() {
  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 moveDown() {
  clearInterval(startInterval);
  startInterval = setInterval("moveDown1()",100);	
}


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 - 350) ) {
    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 () {
										 
		var initialize_marquee = function () {
			if ($('marqueecontainer4'))
			   new InitializeMarquee('marqueecontainer4','vmarquee4','dummyClass', 'right', 3); // container div, content div , move to (left to right or right to left), moving speed
			if ($('marqueecontainer5'))
			   new InitializeMarquee('marqueecontainer5','vmarquee5','dummyClass', 'left', 3); // container div, content div , move to (left to right or right to left), moving speed
			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','dummyClass', 'right', 3); // container div, content div , move to (left to right or right to left), moving speed
			if ($('marqueecontainer2'))
			  new InitializeMarquee('marqueecontainer2','vmarquee2','dummyClass', 'top', 3); // container div, content div , move to (left to right or right to left), moving speed
			if ($('marqueecontainer3'))
			 new InitializeMarquee('marqueecontainer3','vmarquee3','dummyClass', 'down', 3); // 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';
			}
		}
		
		setTimeout(initialize_marquee,5000);
		
});