var Placard = function() {
	marqueesHeight = 21;  
	stopscroll = false;
	scrollContainer = null;
	var preTop = 0, currentTop = 0, stoptime = 0;  
	list = new Array();
	return {
		add : function(text, date) {
			list.push({text : text, date : date});
		},
		initialize : function(container) {
			scrollContainer = container;
			container.scrollTop = 0;
			var htmlCode = "<table>";
			for (var i = 0; i < list.length; i++) {
				htmlCode += "<tr><td><a href=\"#\">" + list[i].text + "</a></td><td style=\"width: 68px;\">" + list[i].date + "</td></tr>";
			}
			htmlCode += "</table>";
			htmlCode += htmlCode;
			container.innerHTML = htmlCode;
			window.setInterval(Placard.scroll, 40);
		},
		scroll : function() {
			currentTop += 1;  
			if(currentTop == 22) {  
				stoptime += 1;  
				currentTop -= 1;  
				if(stoptime == 80) {  
					currentTop = 0;  
					stoptime = 0;  
				}  
			} else {        
				preTop = scrollContainer.scrollTop;  
				scrollContainer.scrollTop += 1;  
				if(preTop == scrollContainer.scrollTop) {  
					scrollContainer.scrollTop = 42;  
					scrollContainer.scrollTop += 1;  
				}  
			}  
		}
	};
} ();

var List = function() {
	return {
		initialize : function(id) {
			var container = document.getElementById(id);
			var rows = container.getElementsByTagName("TR");
			for (var i = 0; i < rows.length; i++) {
				if (i%2 == 0) {
					rows[i].className = "clearance";
				}
				this.bindEvent(rows[i]);
			}
		},
		bindEvent : function(row) {
			row.onmouseover = function() {
				this.className = "current";
			};
			row.onmouseout = function() {
				var index = this.rowIndex;
				if (index%2 == 0) {
					this.className = "clearance";
				} else {
					this.className = "";
				}
			};
		},
		stripe : function() {
			for (var i = 0; i < arguments.length; i++) {
				var id = arguments[i];
				var table = document.getElementById(id);
				for (var j = 0; j < table.rows.length; j++) {
					if (j%2 == 1) {
						table.rows[j].className = "clearance";
					}
				}
			}
		}
	};
} ();
