var init = (function () {
	var w = window,
		opacity = [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 0],
		l = opacity.length,
		setOpacity;

	function animate(el, i) {
		if (i < l) {
			setOpacity(el, opacity[i++]);
			window.setTimeout(
				function () {
					animate(el, i);
				}, 10
			);
		}
	}

	return function () {
		var flash = document.getElementById('flash');
		if (flash) {
			setOpacity = ('undefined' !== typeof flash.style.opacity)
				? function (e, z) {
					e.style.opacity = (z / 100).toString();
				}
				: (('undefined' !== typeof flash.style.filter)
				   ? function (e, z) {
					   e.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=' + z + ')';
				   }
				   : null
				  );
			if (setOpacity) {
				flash.style.display = 'block';
				setOpacity(flash, 0);
				function delay() {
					animate(flash, 0);
					w.setTimeout(delay, 4000);
				}
				w.setTimeout(delay, 1000);
			}
		}
	};

})();

window.onload = init;
