/* O.A.R. */
/* LANGUAGE & MARKUP CHANGES
----------------------------------------------------------------------------- */


function markup() {

	
/* DATE FORMAT
----------------------------------------------------------------------------- */


/*

	$('.widget-event.program ul.events li > strong, .widget-editorial li > strong, .widget-blog li .post > strong, .widget-blog li > strong').each(function() {
		
		var date = $(this).text().replace(', 2008','').replace(', 2009','').replace(', 2010','');
		var month = date.match(/[a-zA-Z]{3}/);
		var day = date.match(/\d{1,2}/);		
	
		$(this).text('');
		$(this).prepend('<abbr>' + month + '</abbr> ');
		$(this).append('<span>' + day + '</span>');
		
		$(this).show();
		
	});
	
*/
	

/* EVENT LISTINGS: PLACEHOLDER
----------------------------------------------------------------------------- */


	$('.widget-event.placeholder p').each(function() {
	
		$(this).html('No performances have been scheduled at this time');
	
	});
		
		
/* HOME PAGE: EVENT LISTINGS
----------------------------------------------------------------------------- */

	/*
	$('.section-home .sidebar .widget-event.program ul.events > li h4').each(function() {
	
		$(this).children('em').remove();
		var location = $(this).text();
		var link = $(this).parent().children('ul.actions').children('li').children('a.details').attr('href');

		$(this).text('');
		$(this).append('<a href="' + link + '">' + location + '</a>');
	
	});
	*/
	
/* TOUR PAGE: EVENT LISTINGS
----------------------------------------------------------------------------- */


	/*
	$('.section-tour .main .widget-event.program ul.events > li h4').each(function() {
	
		$(this).children('em').remove();
		var location = $(this).html();
		var link = $(this).parent().children('ul.actions').children('li').children('a.details').attr('href');

		$(this).text('');
		$(this).append('<a href="' + link + '">' + location + '</a>');
	
	});
	*/
	
	if ($('.section-tour #past.placeholder p').length > 0) {
	
		$('.section-tour #past.placeholder p').text('No past performances');
		
	}


/* MAILING/TEXT LISTS
----------------------------------------------------------------------------- */

	
	if ($('#mailinglist').length > 0) {
	
		var placeholder = "Enter your email address";
		$('#mailinglist #mailing_list_entry_email').attr('placeholder', placeholder);
		
		$('#mailinglist #mailing_list_entry_email').focus(function() {
		
			if ($(this).attr('value') == placeholder) $(this).attr('value', '');
		
		}, function() {
		
			if ($(this).attr('value') == "") $(this).attr('value', placeholder);
		
		});

	}
	
	
/* TAG BROWSER
----------------------------------------------------------------------------- */

	
	$('.widget-tag.browse > ul').children('li:first-child').each(function() {
	
		if (tag == "all" || !tag) {
	
			$(this).parent().prepend('<li><strong>Everything</strong></li>');
			$(this).remove();
		
		}
		
	});
	
	
/* TRUNCATE LEAD LENGTHS
----------------------------------------------------------------------------- */

	
	$('.widget-editorial.leads div.story, .widget-blog.leads p').each(function() {
	
		$(this).truncate(140, {
		chars: /\s/,
		trail: [ "" ]
		});
		
	});
	
	
/* TRUNCATE COMMENT LENGTHS ON MEMBER SITE
----------------------------------------------------------------------------- */

	
	// AUTHOR
	$('.sidebar .widget-comment.browse .post').each(function() {
	
		$(this).children('p').each(function() {
		
			if ($(this).parent().hasClass('author') || $('body').hasClass('author')) {
						
				// MODIFY ACTIONS COME BEFORE PARAGRAPHS
				$(this).siblings('p:nth-child(4)').remove();
				
			} else {
			
				// NO MODIFY ACTIONS BEFORE PARAGRAPH
				$(this).siblings('p:nth-child(3)').remove();
			
			}
		
		});
	
		$(this).children('p').truncate( 140, {
		chars: /\s/,
		trail: [ "..." ]
		});
		
	});
	
	$('.widget-editorial.leads .truncate_less p').each(function() {
	
		$(this).text($(this).text() + '...');
	
	});
	
	
/* PHOTO PLACEHOLDER
----------------------------------------------------------------------------- */


	$('.widget-photo.placeholder p').each(function() {
	
		$(this).html('There are no related photos');
	
	});
	

/* HIDE EMPTY SUB-TABS
----------------------------------------------------------------------------- */

	
	if ($('#itinerary > div').length == 0) $('#itinerary').remove();
	
	
/* HIDE EMPTY TABS
----------------------------------------------------------------------------- */


	$('.tabbed ul.tabs').children('li').each(function() {
	
		var respectivePane = $(this).find('a').attr('href');
		if ($(this).parent().siblings(respectivePane).children('*').length == 0) $(this).remove();

	});
	

/* FAN SITE SETTINGS: HIDE FAN SITE TAGLINE
----------------------------------------------------------------------------- */

	
	$('.group.title label:nth-child(4)').hide();
	

/* ADD LINK TO FRIEND REQUEST ALERT
----------------------------------------------------------------------------- */

	
	if ($('.widget-alert.info').length > 0 && $('.widget-alert.info h3').text().match('like to be your friend').length > 0) {
	
		$('.widget-alert.info').append('<p><a href="/friends">Click Here to View Request</a></p>');
	
	}
	

/* DETECT NETWORK HEADER
----------------------------------------------------------------------------- */
	
	
	if ($('#network-header').length > 0) $('body').addClass('header');
	
	
/* REMOVE "PAYING MEMBERS" FROM BLOG PRIVACY DROP DOWN
----------------------------------------------------------------------------- */


	$('#blog-modify').find('option[value=5]').remove();
	
	
/* REMOVE ?AJAX=TRUE FROM LINKS
----------------------------------------------------------------------------- */


/* Video Page */


	$('#video-browse').find('a').each(function() {
	
		$(this).attr('href', $(this).attr('href').replace('?ajax=true', ''));
	
	});
	
	
/* Music Page */


	$('#releases').find('a').each(function() {
	
		$(this).attr('href', $(this).attr('href').replace('?ajax=true', ''));
	
	});
	
	
/* MEMBER DISPLAY
----------------------------------------------------------------------------- */


	$('dt.comments').text('Comments');
	$('dt.updated').text('Updated');


}
