/* BEYONDLIVE */
/* Javascript Triggers and Custom Functions
----------------------------------------------------------------------------- */


	$(window).load(function() {
		
		markup();
		cufon();
		truncate("#live em", 14);
		truncate("#live li div > a", 38);
		truncate("#content ul.clips > li > div > em", 47);
		truncate("#content ul.clips > li > div > a", 60);
		
		// PLUGIN: CLIQUE FORMS (Adds text into input forms)
		$('#mailing_list_entry_email').cliqueForms({ placeholder: "Enter your e-mail address" });
		
		// PLUGIN: CLIQUE ACTIONS (Replaces inputs with text anchors)
		try { $('input[type=submit]').cliqueActions(); } catch (error) { alert('Error: Missing Clique Actions Plugin'); }
		
	});
	
	
/* FUNCTION: MARKUP CHANGES
----------------------------------------------------------------------------- */


	function markup() {
	
		$('ul.clips a.watch').text("Watch Now");
		$('#live p').text("There are currently no live shows");
			
	}
	
	
/* FUNCTION: CUFON REPLACEMENTS
----------------------------------------------------------------------------- */


	function cufon() {
	
		var helvetica_condensed_bold = [ 
		
			'h2',
			'h3',
			'h4',
			'#management div p strong',
			'#about div p strong',
			'ul.clips li div em',
			'#live li > div > a',
			'p.tagline'
			
		];
		
		Cufon.replace(helvetica_condensed_bold, { fontFamily: 'Helvetica', hover: true });	
		$(helvetica_condensed_bold.toString()).css('visibility', 'visible');
				
	}
	
	
/* FUNCTION: TRUNCATE
---------------------------------------------------------------------------- */

	
	function truncate(selector, length) {
	
		$(selector).each(function() {
		if ($(this).text().length > length) {
		var text = $(this).text().slice(0, length);
		var text = text.slice(0, text.lastIndexOf(' ')) + '...';
		$(this).html(text);
		Cufon.refresh();
		}
		});
		
	}	
	
	



	
	

