var base_url;
var template_url;

jQuery(document).ready(function($) {	
	// Run the prep functions on the initial document
	$('body').prep_content();

});


(function($) {
	
	// Preparation for newly loaded content
	$.fn.prep_content = function() {
		$(this)
			.prep_content_specific()
			.each(function() {
				$(this)
					// Make all external links open in a new window
					.find('a[href*="http://"]').not('[href*="' + base_url + '"]').attr('target','_blank').end().end()
					// Blur on click
					.find(':submit, a').click(function(){ this.blur(); }).end()
					// Fix YouTube video layering
					.find('iframe[src*="youtube"]').each( function(){
						var the_url = $(this).attr('src') + "";
					
						if ( the_url.indexOf("?") > -1 )
							the_url += "&";
						else
							the_url += "?";					
					
						the_url += 'wmode=transparent';
					
						$(this).attr('src', the_url);
					});
			});
		
		return this;
	}
})(jQuery);
