var marqueeId = 0;
var marquee = new Array();

function marqueeNew(contents, width, height, speed, direction) {
	var name, m;
	if (document.all) {
		document.write("<marquee scrollAmount=" + speed + " width=" + width + " height=" + height
		+ " direction=" + direction + ">" + contents + "</marquee>");
	}
	else {
		name = "marquee" + marqueeId;
		document.write("<ilayer width=" + width + " height=" + height + " name=" + name + ">"
		+ "<layer name=marquee></layer></ilayer>");
		m = new Object();
		marquee[marqueeId] = m;
		m.contents = contents;
		m.width = width;
		m.height = height;
		m.speed = speed;
		m.direction = direction;
		marqueeId++;
	}
}

function marqueeAnimate() {
	var i, name, m;
	for (i = 0; i < marquee.length; i++) {
		name = "marquee" + i;
		m = marquee[i];
		switch (m.direction) {
		case "left":
			if ((- document[name].document.marquee.left) > m.limit)
				document[name].document.marquee.left = m.width;
			document[name].document.marquee.left -= m.speed;
			break;

		case "up":
			if ((- document[name].document.marquee.top) > m.limit)
				document[name].document.marquee.top = m.height;
			document[name].document.marquee.top -= m.speed;
			break;
		}
	}
	setTimeout("marqueeAnimate()", 100);
}

function marqueeOnload() {
	var i, name, m;
	if (marquee.length > 0) {
		for (i = 0; i < marquee.length; i++) {
			name = "marquee" + i;
			m = marquee[i];
			switch (m.direction) {
			case "left":
				document[name].document.marquee.left = m.width;
				document[name].document.marquee.width = 5000;
				document[name].document.marquee.document.write(
				"<table border=0 cellspacing=0 cellpadding=0><tr><td nowrap>"
				+ m.contents + "</td></tr></table>");
				document[name].document.marquee.document.close();
				marquee[i].limit = document[name].document.marquee.document.width;
				break;

			case "up":
				document[name].document.marquee.top = m.height;
				document[name].document.marquee.document.write(m.contents);
				document[name].document.marquee.document.close();
				marquee[i].limit = document[name].document.marquee.document.height;
				break;
			}
		}
		marqueeAnimate();
	}
}
handleOnload += "marqueeOnload();"