/***********************************************
* adapted by 722z from:
* 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.
***********************************************/

var marquee_direction  = new Array();
var marquee_delay  = new Array();
var marquee_speed  = new Array();
var marquee_current_speed  = new Array();
var marquee_pause = new Array();
var marquee_height = new Array();
var marquee_width = new Array();
var marquee_size = new Array();

function marquee_scroll(marquee_id){
	var marquee = document.getElementById(marquee_id);
	if(marquee_direction[marquee_id] == 'horizontal'){
		if (parseInt(marquee.style.left) > (marquee_width[marquee_id] * (-1) + 8))
			marquee.style.left = parseInt(marquee.style.left) - marquee_current_speed[marquee_id] + "px";
		else
			marquee.style.left = parseInt(marquee_size[marquee_id]) + 8 + "px";
	} else {
		if (parseInt(marquee.style.top) > (marquee_height[marquee_id] * (-1) + 8))
			marquee.style.top = parseInt(marquee.style.top) - marquee_current_speed[marquee_id] + "px";
		else
			marquee.style.top = parseInt(marquee_size[marquee_id]) + 8 + "px";
	}
}

function marquee_init(marquee_id){
	var container_id = marquee_id + '-container';
	marquee_current_speed[marquee_id] = marquee_speed[marquee_id];
	marquee_pause[marquee_id] = (marquee_pause[marquee_id] == 0) ? marquee_current_speed[marquee_id] : 0;
	var marquee = document.getElementById(marquee_id);
	if(marquee_direction[marquee_id] == 'horizontal'){
		marquee.style.left = 0;
		marquee_size[marquee_id] = document.getElementById(container_id).offsetWidth;
		marquee_width[marquee_id] = marquee.offsetWidth;
		if (window.opera || navigator.userAgent.indexOf("Netscape/7") != -1){ //if Opera or Netscape 7x, add scrollbars to scroll and exit
			marquee.style.width = marquee_size[marquee_id] + "px";
			marquee.style.overflow = "scroll";
			return;
		}
	} else {
		marquee.style.top = 0;
		marquee_size[marquee_id] = document.getElementById(container_id).offsetHeight;
		marquee_height[marquee_id] = marquee.offsetHeight;
		if (window.opera || navigator.userAgent.indexOf("Netscape/7") != -1){ //if Opera or Netscape 7x, add scrollbars to scroll and exit
			marquee.style.height = marquee_size[marquee_id] + "px";
			marquee.style.overflow = "scroll";
			return;
		}
	}
	setTimeout('lefttime=setInterval("marquee_scroll(\''+ marquee_id +'\')",30)', marquee_delay[marquee_id]);
}