var scObj1 = new scrollObject("sMain", 573, 159, "up", 350, 1.15);
scObj1.block[0] = "Alexandria, VA";
scObj1.block[1] = "Ann Arbor, MI";
scObj1.block[2] = "Arlington, VA";
scObj1.block[3] = "Atlanta, GA";
scObj1.block[4] = "Atlantic City, NJ";
scObj1.block[5] = "Austin, TX";
scObj1.block[6] = "Baltimore, MD";
scObj1.block[7] = "Bethesda, MD";
scObj1.block[8] = "Boston, MA";
scObj1.block[9] = "Cambridge, MA";
scObj1.block[10] = "Chapel Hill, NC";
scObj1.block[11] = "Charlotte, NC";
scObj1.block[12] = "Chicago, IL";
scObj1.block[13] = "Columbus, OH";
scObj1.block[14] = "Dallas, TX";
scObj1.block[15] = "Delray Beach, FL";
scObj1.block[16] = "Denver, CO";
scObj1.block[17] = "Detroit, MI";
scObj1.block[18] = "Dewey Beach, DE";
scObj1.block[19] = "Edmonton, Canada";
scObj1.block[20] = "El Paso, TX";
scObj1.block[21] = "Fort Lauderdale, FL";
scObj1.block[22] = "Fort Worth, TX";
scObj1.block[23] = "Hollywood, CA";
scObj1.block[24] = "Houston, TX";
scObj1.block[25] = "Indianapolis, IN";
scObj1.block[26] = "Jacksonville, FL";
scObj1.block[27] = "Las Vegas, NV";
scObj1.block[28] = "Los Angeles, CA";
scObj1.block[29] = "Louisville, KY";
scObj1.block[30] = "Melbourne, Australia";
scObj1.block[31] = "Memphis, TN";
scObj1.block[32] = "Miami, FL";
scObj1.block[33] = "Milwaukee, WI";
scObj1.block[34] = "Nashville, TN";
scObj1.block[35] = "New Orleans, LA";
scObj1.block[36] = "New York City (NYC), NY";
scObj1.block[37] = "Norfolk, CT";
scObj1.block[38] = "Ocean City, MD";
scObj1.block[39] = "Philadelphia, PA";
scObj1.block[40] = "Phoenix, AZ";
scObj1.block[41] = "Pittsburgh, PA";
scObj1.block[42] = "Portland, OR";
scObj1.block[43] = "Raleigh, NC";
scObj1.block[44] = "San Antonio, TX";
scObj1.block[45] = "San Diego, CA";
scObj1.block[46] = "San Francisco, CA";
scObj1.block[47] = "San Jose, CA";
scObj1.block[48] = "Seattle, WA";
scObj1.block[49] = "Tunica, MS";
scObj1.block[50] = "Vancouver, Canada";
scObj1.block[51] = "Washington, DC";
scObj1.block[52] = "Dallas - Fort Worth";
scObj1.block[53] = "Greater Miami - Fort Lauderdale";
scObj1.block[54] = "Major Venues in the DC-Baltimore Metropolitan Area";
scObj1.block[55] = "Maryland";
scObj1.block[56] = "NoVA";


function scrollObject(main, width, height, direct, pause, speed) {
	var self = this;
	this.main = main;
	this.width = width;
	this.height = height;
	this.direct = direct;
	this.pause = pause;
	this.speed = Math.max(1.001, Math.min((direct == "up" || direct == "down") ? height : width, speed));
	this.block = new Array();
	this.blockprev = this.offset = 0;
	this.blockcurr = 1;
	this.mouse = false;
	this.scroll = function() {
		if (!document.getElementById) return false;
		this.main = document.getElementById(this.main);
		while (this.main.firstChild) this.main.removeChild(this.main.firstChild);
		this.main.style.overflow = "hidden";
		this.main.style.position = "relative";
		this.main.style.width = this.width + "px";
		this.main.style.height = this.height + "px";
		for (var x = 0; x < this.block.length; x++) {
			var table = document.createElement('table');
					table.cellPadding = table.cellSpacing = table.border = "0";
					table.style.position = "absolute";
					table.style.left = table.style.top = "0px";
					table.style.width = this.width + "px";
					table.style.height = this.height + "px";
					table.style.overflow = table.style.visibility = "hidden";
				var tbody = document.createElement('tbody');
					var tr = document.createElement('tr');
						var td = document.createElement('td');
								td.innerHTML = this.block[x];
							tr.appendChild(td);
						tbody.appendChild(tr);
					table.appendChild(tbody);
			this.main.appendChild(this.block[x] = table);
		}
		if (this.block.length > 1) {
			this.main.onmouseover = function() { self.mouse = true; }
			this.main.onmouseout = function() { self.mouse = false; }
			this.main.onclick = function() { location = "music_scene/index.html"; }
			setInterval(function() {
				if (!self.offset && self.scrollLoop()) self.block[self.blockcurr].style.visibility = "visible";
			}, this.pause);
		} this.block[this.blockprev].style.visibility = "visible";
	}
	this.scrollLoop = function() {
		if (!this.offset) {
      if (this.mouse) return false;
			this.offset = (this.direct == "up" || this.direct == "down") ? this.height : this.width;
    } else this.offset = Math.floor(this.offset / this.speed);
		if (this.direct == "up" || this.direct == "down") {
			this.block[this.blockcurr].style.top = ((this.direct == "up") ? this.offset : -this.offset) + "px";
			this.block[this.blockprev].style.top = ((this.direct == "up") ? this.offset - this.height : this.height - this.offset) + "px";
		} else {
			this.block[this.blockcurr].style.left = ((this.direct == "left") ? this.offset : -this.offset) + "px";
			this.block[this.blockprev].style.left = ((this.direct == "left") ? this.offset - this.width : this.width - this.offset) + "px";
		}
		if (!this.offset) {
			this.block[this.blockprev].style.visibility = "hidden";
			this.blockprev = this.blockcurr;
			if (++this.blockcurr >= this.block.length) this.blockcurr = 0;
		} else setTimeout(function() { self.scrollLoop(); }, 30);
    return true;
	}
}

window.onload = function() {
  scObj1.scroll();
}



