$(function(){
	var yt_class = 'video';
	
	// Detect old style youtube object embeds
	$('object').each(function(){
		var self = $(this);
		
		if (self.attr('data').search('youtube') >= 0)
		{
			if (!self.parent().hasClass(yt_class))
			{
				self.wrap('<div class="'+yt_class+'" />');
			}
		}
	});
	
	// Detect newer youtube iframe embeds
	$('iframe').each(function(){
		var self = $(this);
		
		if (self.attr('src').search('youtube') >= 0)
		{
			if (!self.parent().hasClass(yt_class))
			{
				self.wrap('<div class="'+yt_class+'" />');
			}
		}
	});
});
