//theuntitled JavaScript Document

var FlashECard = function(element, options) {
	this.element = element;
	this.vars = options.vars;
	this.params = options.params;
};

FlashECard.prototype = {
	createFlash: function () {
		swfobject.embedSWF("/Files/Templates/WeberECardModule/ecard.swf", this.element, "462", "703", "8.0.0", "expressInstall.swf", this.vars, this.params);
	}
}

function openLayer() {
	if (!$('ecardlayer')) {
		new Insertion.Before('main_container', '<div id="ecardlayer" style="display:none;" onclick="closeLayer();"></div>');
		new Insertion.After('ecardlayer', '<div id="ecardflash" style="display:none;"></div><div class="clear"></div>');
		$('ecardlayer').setStyle({
			width: '100%',
			height: $('main_container').getDimensions().height + $('footer_container').getDimensions().height + 'px'
		});
		$('ecardflash').innerHTML = '<div class="blayer"><div class="content"><a href="javascript:closeLayer();" class="closelink">Schlie&szlig;en</a><div class="clear"></div>' + $$('.blayer .content')[0].innerHTML + '<div id="flashcont" style="height:0px;overflow:hidden;font-size:0px;"><div id="fader" style="display:none;"><div id="flashContent">F&uuml;r die Nutzung der E-Card m&uuml;ssen Sie Javascript aktiviert und den aktuellen Flash-Player installiert haben.<br />Den aktuellen Player k&ouml;nnen Sie hier herunterladen:<br /><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a><div style="clear:both"></div></div></div></div></div></div>';
		flashEc.createFlash();
		$('ecardflash').down(5).hide();
		if ($('openlink')) {
			$('openlink').hide();
		}
		Effect.Appear('ecardlayer', {
			duration: 0.4,
			from: 0.0,
			to: 0.5,
			afterFinish: function() {
				Effect.Appear('ecardflash', {
					duration: 0.4,
					from: 0.0,
					to: 1.0,
					afterFinish: function() {
						new Effect.Morph('flashcont', {
							duration: 0.4,
							style: {
								height: '705px'
							},
							afterFinish: function() {
								Effect.Appear('fader', {
									duration: 0.2
								});
							}
						});
					}
				});
			}
		});
	} else {
		Effect.Appear('ecardlayer', {
			duration: 0.4,
			from: 0.0,
			to: 0.5,
			afterFinish: function() {
				Effect.Appear('ecardflash', {
					duration: 0.4,
					from: 0.0,
					to: 1.0,
					afterFinish: function() {
						new Effect.Morph('flashcont', {
							duration: 0.4,
							style: {
								height: '705px'
							},
							afterFinish: function() {
								Effect.Appear('fader', {
									duration: 0.2
								});
							}
						});
					}
				});
			}
		});
	}
}

function closeLayer() {
	Effect.Fade('fader', {
		duration: 0.4,
		from: 1.0,
		to: 0.0,
		afterFinish: function() {
			Effect.Fade('ecardflash', {
				duration: 0.4,
				from: 1.0,
				to: 0.0,
				afterFinish: function() {
					$('flashcont').setStyle({
						height: '0px'
					});
					Effect.Fade('ecardlayer', {
						duration: 0.3,
						from: 0.5,
						to: 0.0
					});
				}
			});
		}
	});
}

function checkUrl() {
	url = window.location.href.split('&');
	if (url[1]) {
		if (url[1].substr(0, 3) == 'uid') {
			openLayer();
		}
	}
}

Event.observe(window, 'load', function() {
	checkUrl();
});
