/**
 * FIX IE6 IMAGE FLICKER PROBLEM
 *
 */
try {
	document.execCommand('BackgroundImageCache', false, true);
} catch(e) {}

$(function() {
	// YouTube video overlay	
	$('#ftr-video a[rel]').overlay({
		onBeforeClose: function(){
			if(ytplayer)
			{
				ytplayer.pauseVideo();
			}
		},
		onLoad: function() {
			var trigger = this.getTrigger();
			
			videoTimer = setInterval(function() { loadVideo(); }, 250);
			
			function loadVideo()
			{
				if(typeof(ytplayer) != "undefined")
				{
					var triggerIndex = parseInt($("a.youtube").index(trigger) + 1);					
					
					ytplayer.loadVideoById($('input[name="vid_'+triggerIndex+'_YouTube"]').val());
					ytplayer.playVideo();
					
					clearInterval(videoTimer);
				}				
			}			
		}
	});
	
	// Graphical quotes for "Recent Comments"
	$('#ftr-comments blockquote').each(function(){
		$('p:first', this).prepend('<img alt="&#8220;" class="quote-start" height="12" width="13" src="/wp-content/themes/MLFV2/_images/icons/quote_start.gif" />');
		$('p:last', this).append('<img alt="&#8220;" class="quote-end" height="12" width="13" src="/wp-content/themes/MLFV2/_images/icons/quote_end.gif" />');
	});
});

function onYouTubePlayerReady(playerid)
{
	ytplayer = document.getElementById("myytplayer");
}