jQuery.fn.random = function() {
    var randomIndex = Math.floor(Math.random() * this.length);  
    return jQuery(this[randomIndex]);
};

$(document).ready(function(){

	// Homepage Quotes
	var homeQuote = $('.home-quote-list li').random().html();	
	$('p.home-quote').html(homeQuote);	

	// Press Page Quotes
	var homeQuote = $('div.press-quote').random().css('display', 'block');
       //$('p.home-quote').html(homeQuote);


	// Add 'last' class to last item in top nav
	$('#nav ul li:last').addClass('last');

	// Add 'last' class to right col
	$('.col-2 ul li:last-child').addClass('last');

	// Youtube popup
	$('a[title="youtube"]').addClass('thickbox');
	$('a[title="youtube"]').each(function(i){
		var tempLink = $(this).attr('href');
		var newLink = tempLink+'?KeepThis=true&TB_iframe=true&height=400&width=600';
		$(this).attr('href', newLink);
		$(this).attr('title', '');
	});	

	// Removed more link anchors	
	//$('span[id^="more-"]').attr('id', '');

	// PDF pops
	$("a[href*=.pdf]").click(function(){
		window.open(this.href, 'pdf', 'width=800,height=600,scrollbars=yes,top=100,left=100');
		return false;
	});

});

