Cufon.replace('.britains-got-favourites h2', {color: '-linear-gradient(#660019, #a70027)'});
Cufon.replace('.a-slice-of-britain h2', {color: '-linear-gradient(#660019, #a70027)'});

var pagecontent;
var videoContent;
var pageContent = $('#page-content');
var videoContent = $('#video-content');
var videoContainer = $('#video-container');

$(document).ready(function() {
// Reload the body content within page content
	/*var bodycontent = $('body').html();
	$('body').html('');
	pageContent = $('<div>');
	$(pageContent).attr({'id':'page-content'});
	$('body').append($(pageContent));
	$(pageContent).html(bodycontent);
	*/
	
// Set the video container
	videoContainer = $('<div>');
	$(videoContainer).hide().attr({'id':'video-container'}).css({height: $(window).height() + 'px'});
	$('body').append($(videoContainer));
	
	videoContent = $('<div>');
	$(videoContent).hide().attr({'id':'video-content'}).css({height: $(window).height() + 'px'});
	$(videoContainer).append($(videoContent));
	
	var nonFlash;
	nonFlash = '<div class="message">' +
		'<p style="text-align: center"><a target="_blank" href="http://www.adobe.com/products/flashplayer" title="Adobe Flash Player"><img src="'+root+'assets/images/generic/flash_player_50x50.jpg" width="50" height="50" alt="Flash Player" /></a></p>' +
		'<p>To view this content, JavaScript must be enabled,<br />and you need the latest version ' +
		'of the <a target="_blank" href="http://www.adobe.com/products/flashplayer" title="Adobe Flash Player">Adobe Flash Player</a>. </p>' +
		'<p>Download the free <a href="http://www.adobe.com/products/flashplayer" title="Adobe Flash Player" target="_blank">Flash Player</a> now!</p>' +
	'</div>';
	$(videoContent).html(nonFlash);

// Get the flash ready
	var flashvars = {};
	var params = {menu: "false",bgcolor: "black"};
	var attributes = {id:"video-content-player",name:"myDynamicContent"};
	swfobject.embedSWF(root+"assets/swf/VideoPlayer.swf", "video-content", "100%", "100%", "9.0.0","expressInstall.swf", flashvars, params, attributes);

// IE6 refresh DD_Belated_PNG
	if(thisIsIE6 === true) {
		try {
			DD_belatedPNG.fix('img');
			DD_belatedPNG.fix('div');
			DD_belatedPNG.fix('a');
			DD_belatedPNG.fix('input');
		} catch (Error) {
		}
	}

// Get the link ready
	var watchLink = $('.watch-the-tv-ad');
	$(watchLink).click(function(e) {
		videoOverlay('open')
		e.preventDefault();
	});
	var watchLink2 = $('.img-link');
	$(watchLink2).click(function(e) {
		videoOverlay('open')
		e.preventDefault();
	});
	
// Get the mouseovers ready
	mouseOvers();
});

function mouseOvers() {
	var hoverLinks = $('.overlay-links').find('a');
	$(hoverLinks).each(function(i) {
		var hoverLink = $(hoverLinks[i]);
		var i2 = i + 1;
		var overlay = $('.overlay-' + i2);
		var overlayLink = $(overlay).find('a');
		$(hoverLink).attr('title', '');
		$(overlayLink).attr('title', '');
		$(hoverLink).mouseover(function() { $(overlay).fadeIn(200); });
		$(overlayLink).mouseout(function() { $(overlay).fadeOut(200); });
	});
}

function videoOverlay(action) {
	if(action == 'open') {
		$('body form').hide();
		$(videoContainer).show();
		$(videoContent).show();
	} else {
		$(videoContainer).hide();
		$(videoContent).hide();
		$('body form').show();
	}	
}
