function showOverlay(){
	$("object, embed").hide();
	$(".sIFR-flash").show();
	$("#overlay").css("height", $(document).height());
	$("#overlay_block").css("margin-top", $(document).scrollTop() + 30);
	$("#overlay").css("position", "absolute");
	$("#overlay").show();
};
function loadOverlay(content)  
{  
	showOverlay();
	content = content.replace('www.www', 'www');
	$('#overlay_content').html('<iframe frameborder="0" scrolling="no" style="background: rgb(255, 255, 255) none repeat scroll 0% 0%; height: 100%; width: 100%;" src="'+content+'" title="This area displays dynamic overlaid content, but is not always visible." name="overlay_frame" id="overlay_frame"/>');
};
$(document).ready(function(){
	$('.lhn').after('<a id="pause_button" title="Pause Animations" href="#"><span>Pause Animations</span></a>');
	$('<div id="overlay"><div id="overlay_block"><div id="overlay_relative"><div id="overlay_content"></div><div id="overlay_close"></div></div></div>').appendTo('body');   	
	$("a[rel]").click(function(){
		showOverlay();
		loadOverlay($(this).attr("href"));
		return false;
	});
	$("#overlay_close").click(function(){
		$("object").show();
		$("#overlay").hide();
		$("#overlay_content").empty();
		return false;
	});
	$("#pause_button").click(function(){
		var $this = $(this);
		if($this.is('.active')){
			$("object").each(function(){
				if(this && typeof this.SetVariable != "undefined"){
					this.SetVariable('stopmovie', "false");
				};
			});
			$this.removeClass('active');
			$this.attr('title', 'Pause Animations');
			$this.html('<span>Pause Animations</span>');
		} else {
			$("object").each(function(){
				if(this && typeof this.SetVariable != "undefined"){
					this.SetVariable('stopmovie', "true");
				};
			});
			$this.addClass('active');
			$this.attr('title', 'Play Animations');
			$this.html('<span>Play Animations</span>');
		};
		return false;
	});
});