// JavaScript Document

window.showContentBehindImages = function() {

	var divFirst = $('effect_one');
	var divSecond = $('effect_two');
	var divThird = $('effect_three');
	
	
	
	if ( divFirst && divSecond && divThird ) 
	{
		new Effect.Opacity(divFirst, {
			from: 1.0,
			to: 0,
			duration: 2,
			delay: 1,
			beforeStart : function() {

				new Effect.Opacity(divSecond, {
					from: 1.0,
					to: 0,
					duration: 2.0,
					delay: 1.5,
					beforeStart : function() {
						new Effect.Opacity(divThird, {
							from: 1.0,
							to: 0,
							duration: 2.0,
							delay: 2.0,
							afterFinish : function() {
								$('effect_one').hide();
								$('effect_two').hide();
								$('effect_three').hide();
							}
						});
					}
				});
			}
		});
	}

	if ( $('videoblend') )
	{
		new Effect.Opacity($('videoblend'), {
			from: 1.0,
			to: 0,
			duration: 2,
			delay: 1,
			afterFinish : function() {
				$('videoblend').hide();
			}
		});
	}
};


Event.observe(window, 'load', function() {
	if ( hensam && hensam.Snippets && hensam.Snippets.Cookies ) 
	{
		var cookie = new hensam.Snippets.Cookies();
		cookie.set('winecard-spoiler', 'viewed', 30);
	}

	if ( window.hasSpoiler )
	{
		document.observe('spoiler:closed', window.showContentBehindImages);

	}
	else
	{
		window.showContentBehindImages();
	}
});
