//---------------------------------------------------------------------------------------------------------------------
// Class : MainApp - Contains all the common functionality
//---------------------------------------------------------------------------------------------------------------------
var MainApp = Class.create(
{
	//-----------------------------------------------------------------------------------------------------------------
	// Constructor - Define class vars
	//-----------------------------------------------------------------------------------------------------------------
	initialize : function()
	{
		this.contentDiv  = 'dynamicContent';  // index.php Dynmaic Content DIV elmt
		this.leftBotBox  = 'leftBox';         // index.php Bottom Left Box DIV elmt
		this.rightBotBox = 'rightBox';        // index.php Bottom Right Box DIV elmt
		this.leftAds     = 'leftAds';         // index.php Bottom Left Ads section
		
		this.BIO       = 0;
		this.DOWNLOADS = 1;
		this.CONTACT   = 2;
		this.BLOG      = 3;
		this.STORE     = 4;
		this.GALLERY   = 5;
		this.FORUM     = 6;
	}

	//-----------------------------------------------------------------------------------------------------------------
	// PUBLIC - A top Nav button has been clicked
	//-----------------------------------------------------------------------------------------------------------------
	,onNavBtn : function( iBtn )
	{
		switch ( iBtn )
		{
			case this.BIO       : this._bio();       break;
			case this.DOWNLOADS : this._downloads(); break;
			case this.CONTACT   : this._contact();   break;
			case this.BLOG      : this._blog();      break;
			case this.STORE     : this._store();     break;
			case this.GALLERY   : this._gallery();   break;
			case this.FORUM     : this._forum();     break;
		}
	}
	
	//-----------------------------------------------------------------------------------------------------------------
	// PRIVATE - Display the band bio
	//-----------------------------------------------------------------------------------------------------------------
	,_bio : function()
	{
		var strContent =
			  '<p>TFY5K is made up of four working stiffs who, despite the daily demands of everyday life, have managed to keep a darn good rock band going since 2003.  All the band members have full-time jobs (thems all bin to college) and three are married with kids.'
			+ '<p>For the most part, the music tends to be loud, fast and uncomplicated.  With the sound sitting somewhere between The Ramones and Motorhead.'
			+ '<p>Lyrically, most of the tunes are not meant to be taken too seriously.  And if there is some sort of actual message buried deep down in a song or two, it\'s delivered with the band\'s usual good humor.'
			+ '<p>The goal, in so much as one exists, is not to "make it" in the traditional major-label sense.  They\'re out to write a few tunes, play a few shows, drink a few beers, drink a few more beers, and maybe earn a few dollars with which to pay for the aforementioned beers.'
			+ '<p>Would they like to quit their jobs and concentrate on the rock?  Sure, who wouldn\'t?  Should that opportunity present itself, they\'ll grab it with both hands and suck on it as if it were the biggest, most perfect beer ever brewed.  But they\'ll do it without the, uh, "help" of the majors or anybody else with an RIAA membership for that matter.'
			+ '<p>If this completely half-assed approach somehow manages to lead them to fame and fortune.  Great!  If not, well then.... screw it.  Who cares.  They\'re still having more fun than most people their age have any right to.'
			+ '<p><b>Ye Olde (brief and somewhat confusing) Historie</b>'
			+ '<p>During the 1990\'s, all the members of TFY5K were part of the Connecticut music scene as members of other bands.'
			+ '<p>The Pope was a member of S.I.K. for a while before splitting off with fellow band mate Billy Willy to form CT White Bread.'
			+ '<p>Adam and Negative Ed spent the entire time in Death Toboggan and all its various incarnations. More recently Negative Ed played with (and continues to play with) The 9th Wave.'
			+ '<p>Big Ed, Damian, Jimmy and Bob were all in Death Penis together.'
			+ '<p>Bob originally met Damian online back in 1988 (Yes kids, there was an online community during the 1980\'s.  Raise your hand if you know what a "300 baud modem" is). He met both Big Ed and The Pope while attending college at WCSU in Danbury, CT. He got to know Negative Ed and Adam through an old mutual high school friend. Big Ed and Damian met through Bob prior to the formation of Death Penis. Bob, Big Ed and Damian all got to know Chris (who plays an important role later in the story) of Amnesty Underground as fellow members of the local Danbury music scene, after Death Penis had been around for a little while.'
			+ '<p><p>With Bob knowing members of both CT White Bread and Death Toboggan, it naturally followed that Death Penis ended up playing shows with both bands from time to time. Thus allowing the various band members to all get to know each other.'
			+ '<p>At roughly the turn of the century - meaning 2000 not 1900, just in case there was any confusion there - all three bands called it quits for a host of different reasons. Most of it amounting to just life in general getting in the way of band activities.'
			+ '<p>By early 2003 band withdrawals had set in. So Bob & Big Ed hooked back up with the original Death Penis drummer, Jimmy, to form Terror From the Year 5000. It started as a 3-piece jam band, but they ultimately decided to add vocals and switch to a more Punk-oriented song structure. They enlisted Damian , who was also anxious to get back into the scene again, as lead vocalist and began the quest for a second guitarist.'
			+ '<p>Conveniently enough, Bob and Chris (See, I told you he was important!) ran into each other again after having lost touch for a couple of years. The discussion naturally turned to music and bands, at which point Bob finds out that Chris and Adam were now roommates. Chris explained that he could hear Adam gently sobbing himself to sleep each night for the lack of an outlet for his prodigious musical talents. A couple of band practices later, Adam agreed to join the band.'
			+ '<p>A few months later, Jimmy decided he could no longer tolerate the consistently beautiful New England weather and opted to move to that armpit of the United States, Hawaii. (He still keeps in touch and continues to rock out, albeit in shorts and a goofy tee shirt.) Chris (Still important!) generously offered to fill in on drums until a permanent replacement could be found.'
			+ '<p>Meanwhile Bob and The Pope had been working together at the same crappy little technology company, as horribly underpaid software engineers (Bitter? Who\'s bitter?), since early 2000. A couple of months after Jimmy\'s departure, Bob learned that The Pope played drums (after 13 or so years, you\'d think you knew a guy...sheesh). The conversation went something like this: "You play drums!?!? Wanna join the band???" "Ok." And thus Pope became the new drummer.'
			+ '<p>The band continued on in this form until the tail end of 2004, when Big Ed announced that the final show of the year (Ditto\'s in Litchfield, CT) would be his last show. It was a kick-ass show and after it was over, Big Ed exited on good terms with everyone.'
			+ '<p>After breaking for the holiday season, the band returned and recruited Negative Ed to take over bass duties.  This line-up lasted until mid-2007, when The 9th Wave got busy enough that -Ed simply could not continue to play with both bands.  He left TFY5K to focus on the Rockabilly material.  The two bands have since found that they work pretty well together live.'
			+ '<p>With the departure of -Ed, Damian decided his life\'s dream was to be a bass player. So he bought a bass and beat on it until he could play all the tunes. Adam took over most of the lead vocal duties and thusly TFY5K continued on...';
		
		// Display the BIO contents in our dynamic content div.
		document.getElementById( this.contentDiv ).innerHTML = strContent;
		
		// Hide the two bottom boxes
		this._hideBlocks();
		
		// Display the Left Ads block
		this._showLeftAds();
	}

	//-----------------------------------------------------------------------------------------------------------------
	// PRIVATE - Display the Downloads
	//-----------------------------------------------------------------------------------------------------------------
	,_downloads : function()
	{
		var strContent =
			  '<table>'
			+ '<tr>'
			+ '<td align="left" colspan="2">'
			+ '<p><span class="title">Here It Is:</span><br>Everything we have ever recorded, or at least everything worth listening to, <span class="title">FREE</span>.</p>'
			+ '<p>Why? Because music <i>wants</i> to be free and free is good.  Take it, listen to it, use it, share it. If you like it enough, '
			+ '<a href="/store.php">slip us some cake</a>. If not, no problem. At least you took the time to listen and that is cool with us.</p>'
			+ '</td>'
			+ '</tr>'
			+ '<tr>'
			+ '<td align="left" colspan="2">'
			+ '<p><span class="title">Official Releases</span></p>'
			+ '</td>'
			+ '</tr>'
			+ '<tr>'
			+ '<td colspan="2" align="center"><b>2008 - Opening Band<b></td>'
			+ '</tr>'
			+ '<tr>'
			+ '<td valign="top" align="left" width="125">'
			+ '<img src="/images/openingBandCover_100x100.jpg">'
			+ '<br /><br />'
			+ '<a href="/media/openingBand/TFY5K_OpeningBand.zip">Download the .zip</a>'
			+ '</td>'
			+ '<td valign="top" align="left">'
			+ '<ol>'
			+ '<li><a href="/media/openingBand/Terror From The Year 5000-Opening Band-01-Opening Band.mp3">Opening Band</a></li>'
			+ '<li><a href="/media/openingBand/Terror From The Year 5000-Opening Band-02-Low Bridge.mp3">Low Bridge</a></li>'
			+ '<li><a href="/media/openingBand/Terror From The Year 5000-Opening Band-03-Stuck In The Suburbs.mp3">Stuck In the Suburbs</a></li>'
			+ '<li><a href="/media/openingBand/Terror From The Year 5000-Opening Band-04-Drinkin\' All Night.mp3">Drinkin\' All Night</a></li>'
			+ '<li><a href="/media/openingBand/Terror From The Year 5000-Opening Band-05-7 Days In Hell.mp3">7 Days In Hell</a></li>'
			+ '<li><a href="/media/openingBand/Terror From The Year 5000-Opening Band-06-Last Supper.mp3">Last Supper</a></li>'
			+ '</ol>'
			+ 'Unreleased trax from the Opening Band sessions:'
			+ '<ol>'
			+ '<li><a href="/media/openingBand/Terror From The Year 5000-Opening Band-07-Bang Your Head (unreleased).mp3">Bang Your Head</a></li>'
			+ '<li><a href="/media/openingBand/Terror From The Year 5000-Opening Band-08-Ghost Riders (unreleased).mp3">Ghost Riders</a></li>'
			+ '</ol>'
			+ '</td>'
			+ '</tr>'
			+ '<tr>'
			+ '<td colspan="2" align="center"><b>2005 - Robot Babies<b></td>'
			+ '</tr>'
			+ '<tr>'
			+ '<td valign="top" align="left" width="125">'
			+ '<img src="/images/robotBabiesCover_100x100.jpg">'
			+ '<br /><br />'
			+ '<a href="/media/robotBabies/TFY5K_RobotBabies.zip">Download the .zip</a>'
			+ '</td>'
			+ '<td valign="top" align="left">'
			+ '<ol>'
			+ '<li><a href="/media/robotBabies/Terror From The Year 5000 - Robot Babies - 01 - Worm\'s Song.mp3">Worm\'s Song</a></li>'
			+ '<li><a href="/media/robotBabies/Terror From The Year 5000 - Robot Babies - 02 - Gimme My Cookie.mp3">Gimme My Cookie</a></li>'
			+ '<li><a href="/media/robotBabies/Terror From The Year 5000 - Robot Babies - 03 - 3 Little Fishies.mp3">3 Little Fishies</a></li>'
			+ '<li><a href="/media/robotBabies/Terror From The Year 5000 - Robot Babies - 04 - Steppin\' Stone.mp3">Steppin\' Stone</a></li>'
			+ '<li><a href="/media/robotBabies/Terror From The Year 5000 - Robot Babies - 05 - Firebird.mp3">Firebird</a></li>'
			+ '<li><a href="/media/robotBabies/Terror From The Year 5000 - Robot Babies - 06 - Trippin\' & Hitchin\'.mp3">Trippin\' & Hitchin\'</a></li>'
			+ '<li><a href="/media/robotBabies/Terror From The Year 5000 - Robot Babies - 07 - March of the Drunken Mailman.mp3">March of the Drunken Mailman</a></li>'
			+ '<li><a href="/media/robotBabies/Terror From The Year 5000 - Robot Babies - 08 - The Ballad of Charlie.mp3">The Ballad of Charlie</a></li>'
			+ '<li><a href="/media/robotBabies/Terror From The Year 5000 - Robot Babies - 09 - Toast.mp3">Toast</a></li>'
			+ '<li><a href="/media/robotBabies/Terror From The Year 5000 - Robot Babies - 10 - DOOM!.mp3">DOOM!</a></li>'
			+ '<li><a href="/media/robotBabies/Terror From The Year 5000 - Robot Babies - 11 - Hitler\'s Dog.mp3">Hitler\'s Dog</a></li>'
			+ '<li><a href="/media/robotBabies/Terror From The Year 5000 - Robot Babies - 12 - She Dun Me Wrong.mp3">She Dun Me Wrong</a></li>'
			+ '</ol>'
			+ 'Unreleased trax from the Robot Babies sessions:'
			+ '<ol>'
			+ '<li><a href="/media/robotBabies/Terror From The Year 5000 - Robot Babies - 13 - More Cowbell (unreleased).mp3">More Cowbell</a></li>'
			+ '</ol>'
			+ '</td>'
			+ '</tr>'
			+ '<tr>'
			+ '<td colspan="2" align="center"><b>2004 - Demo<b></td>'
			+ '</tr>'
			+ '<tr>'
			+ '<td valign="top" align="left" width="125">'
			+ '<img src="/images/tfy5k_Starburst_100x100.jpg">'
			+ '<br /><br />'
			+ '<a href="/media/demo/TFY5K_Demo.zip">Download the .zip</a>'
			+ '</td>'
			+ '<td valign="top" align="left">'
			+ '<ol>'
			+ '<li><a href="/media/demo/Terror From The Year 5000 - Demo - 01 - All those planets.mp3">All those planets</a></li>'
			+ '<li><a href="/media/demo/Terror From The Year 5000 - Demo - 02 - Ballad of Charlie.mp3">Ballad of Charlie</a></li>'
			+ '<li><a href="/media/demo/Terror From The Year 5000 - Demo - 03 - Firebird.mp3">Firebird</a></li>'
			+ '<li><a href="/media/demo/Terror From The Year 5000 - Demo - 04 - Hitler\'s Dog.mp3">Hitler\'s Dog</a></li>'
			+ '<li><a href="/media/demo/Terror From The Year 5000 - Demo - 05 - Megatransection.mp3">Megatransection</a></li>'
			+ '<li><a href="/media/demo/Terror From The Year 5000 - Demo - 06 - Rocket.mp3">Rocket</a></li>'
			+ '<li><a href="/media/demo/Terror From The Year 5000 - Demo - 07 - Blah (hidden track).mp3">Blah (hidden track)</a></li>'
			+ '</ol>'
			+ '</td>'
			+ '</tr>'
			+ '</table>';
			
		document.getElementById( this.contentDiv ).innerHTML = strContent;
		
		// Hide the two bottom boxes
		this._hideBlocks();
		
		// Display the Left Ads block
		this._showLeftAds();
	}

	//-----------------------------------------------------------------------------------------------------------------
	// PRIVATE - Display the Store
	//-----------------------------------------------------------------------------------------------------------------
	,_store : function()
	{
		window.location.href = "/store.php";
	}

	//-----------------------------------------------------------------------------------------------------------------
	// PRIVATE - Display the Contact Info
	//-----------------------------------------------------------------------------------------------------------------
	,_contact : function()
	{
		var strBand  = 'band';
		var strAt    = '@';
		var strTFY5K = 'tfy5k';
		var strDot   = '.';
		var strCom   = 'com';
		var strAddr  = strBand + strAt + strTFY5K + strDot + strCom;
		
		var strContent = 
			  '<p>'
			+ '<span class="title">Hey! We\'d love to hear from you...</span><br>'
			+ 'For pretty much whatever reason you might have for getting in touch. '
			+ 'If you want to book us for a gig, even better.  Here\'s all we ask:'
			+ '<ul><li><b>Try to give us at least 4 weeks notice.</b> We\'ve all got full-time jobs and 3 of us have families. We need time to get our various schedules sorted out.</li></ul>'
			+ '<ul><li><b>We\'re a local band based out of Connecticut (USA).</b> The farther we have to travel, the more planning will be required. If we\'ve gotta go far enough to have to spend one or more nights on the road, we\'ll need to make at least enough to cover the costs of food and lodging. Please keep this in mind.</li></ul>'
			+ '<ul><li><b>We DO NOT pre-sell tickets.</b> That\'s the promoter\'s job.</li></ul>'
			+ '<ul><li><b>We DO NOT guarantee a draw.</b> Again, not our job.</li></ul>'
			+ '<ul><li><b>We DO NOT pay-to-play.</b> Nuff sed about that.</li></ul>'
			+ '<ul><li><b>We WILL</b> show up on time, put on the best show we can and be as professional towards the club/promoter, as we expect them to be with us.</li></ul>'
			+ '</p>'
			+ '<p><span class="title"><a href="mailto:' + strAddr + '">' + strAddr + '</a></span></p>'
			;
		
		document.getElementById( this.contentDiv ).innerHTML = strContent;

		// Hide the two bottom boxes
		this._hideBlocks();
		
		// Display the Left Ads block
		this._showLeftAds();
	}
	
	//-----------------------------------------------------------------------------------------------------------------
	// PRIVATE - Go to the Blog
	//-----------------------------------------------------------------------------------------------------------------
	,_blog : function()
	{
		window.location.href = "http://blog.tfy5k.com/";
	}
	
	//-----------------------------------------------------------------------------------------------------------------
	// PRIVATE - Go to the Gallery
	//-----------------------------------------------------------------------------------------------------------------
	,_gallery : function()
	{
		alert( "CT Music Photo Gallery coming soon!" );
	}
	
	//-----------------------------------------------------------------------------------------------------------------
	// PRIVATE - Go to the Forum
	//-----------------------------------------------------------------------------------------------------------------
	,_forum : function()
	{
		alert( "CT Music Forums coming soon!" );
	}
	
	//-----------------------------------------------------------------------------------------------------------------
	// PRIVATE - Hide the main content area's left & right bottom blocks
	//-----------------------------------------------------------------------------------------------------------------
	,_hideBlocks : function()
	{
		document.getElementById( this.leftBotBox  ).style.display = 'none';
		document.getElementById( this.rightBotBox ).style.display = 'none';
	}
	
	//-----------------------------------------------------------------------------------------------------------------
	// PRIVATE - Hide the main content area's left & right bottom blocks
	//-----------------------------------------------------------------------------------------------------------------
	,_showLeftAds : function()
	{
		document.getElementById( this.leftAds ).style.display = 'block';
	}
});
