/* BON JOVI */
/* Live Stream Splash Page Functions
--------------------------------------------------------------------------- */
	$(document).ready(function() {

		hideCufon();
		$('#footer div.widget-alert').insertBefore('#layout #live');


	});
	
	$(window).load(function() {

		liveMarkup();
		$('div#network ul.menu strong, div#network li.joinus strong').click(function() {
		
			if ($(this).parent().hasClass('joinus')) {
				var $menu = $(this).parent();
			} else {
				var $menu = $(this).parent().parent().parent();
			}

			var $bar = $menu.parent();
			var original = $bar.css('width');

			$bar.animate({ width: '50px' }, 'fast', function() {

				if ($menu.hasClass('open')) {
					$menu.removeClass('open');
					$menu.siblings('li').show();
				} else {
					$menu.siblings('li').hide();
					$menu.addClass('open');
				}

				$bar.animate({ width: original }, 'fast');

			});
			
			return false;

		});

		function goLive() {
		
			$('h2 var').fadeOut(function() {
			
				$(this).remove();
			
			});
		
		}

		/*

		$('h2 var').countdown({
		
			until: $.countdown.UTCDate(-5, 2010, 4, 11, 19, 0, 0),
			format: "yowdHMS",
			layout: "{dn} {dl}, {hn} {hl}, {mn} {ml}, {sn} {sl} until show time!",
			onExpiry: goLive
			
		});
		
		*/
		
		$('h2 var').hide();
		
		cufon();

	});
	
	
/* FUNCTION: CUFON
----------------------------------------------------------------------------- */

	function hideCufon() {
	
		tradeGothicCondensed = [
		'h2',
		'.widget-event.program h4 strong',
		'.widget-event.program ul.tickets .available a',
		'div > ul.actions a:not(.download a)',
		'a.buy',
		'#continue',
		'h3.time',
		'#optin > h3',
		'div.widget-alert > h3'
		];
		
		tradeGothicExtended = [
		'#featured_dates > h3',
		'.widget-event.program a.date',
		'#featured_merch > h3'
		];
				
		$(tradeGothicExtended.toString()).css('visibility', 'hidden');
		$(tradeGothicCondensed.toString()).css('visibility', 'hidden');

	}
		
	function cufon() {
				
		Cufon.replace(tradeGothicExtended, { fontFamily: 'Trade Gothic Extended', hover: true });
		$(tradeGothicExtended.toString()).css('visibility', 'visible');
	
		Cufon.replace(tradeGothicCondensed, { fontFamily: 'Trade Gothic Condensed', hover: true });
		$(tradeGothicCondensed.toString()).css('visibility', 'visible');
		
	}
	
	

/* MARKUP CHANGES
----------------------------------------------------------------------------- */


	function liveMarkup() {
		
		$('div.widget-alert h3:contains("Thanks")').text('You have successfully entered the contest and joined the Bon Jovi Community!');
		$('div.widget-alert h3:contains("registered")').text('You are already registered for the Bon Jovi Community and entered for the contest! Thanks for being part of the Bon Jovi Community.');
 		
	}
	


	
