$(document).ready(function() {
	$('.layer').css("height",document.body.offsetHeight+"px");

	$('#success_layer').css("height",document.body.offsetHeight+"px");
	$('#success_layer').css("display","block");
	$('#success_layer_bonus').css("height",document.body.offsetHeight+"px");
	$('#success_layer_bonus').css("display","block");
	$('#success_layer_cart').css("height",document.body.offsetHeight+"px");
	$('#success_layer_cart').css("display","block");
	$('#success_layer_voucher_cart').css("height",document.body.offsetHeight+"px");
	$('#success_layer_voucher_cart').css("display","block");

	$('#error_layer').css("height",document.body.offsetHeight+"px");
	$('#error_layer').css("display","block");
	$('#error_layer_bonus').css("height",document.body.offsetHeight+"px");
	$('#error_layer_bonus').css("display","block");

	$('#voucher_layer').css("display","none");
	$('#voucher_error_layer').css("height",document.body.offsetHeight+"px");
	$('#voucher_error_layer').css("display","block");
	$('#voucher_cart_layer').css("height",document.body.offsetHeight+"px");
	$('#voucher_cart_layer').css("display","block");		

	if ($.browser.msie){
		// Layer auf die volle Breite setzen
		$('.layer').css("width",document.body.offsetWidth+"px");

		$('#success_layer').css("width",document.body.offsetWidth+"px");
		$('#success_layer_bonus').css("width",document.body.offsetWidth+"px");
		$('#success_layer_cart').css("width",document.body.offsetWidth+"px");
		$('#success_layer_voucher_cart').css("width",document.body.offsetWidth+"px");

		$('#error_layer').css("width",document.body.offsetWidth+"px");
		$('#error_layer_bonus').css("height",document.body.offsetHeight+"px");

		$('#voucher_error_layer').css("width",document.body.offsetWidth+"px");
		$('#voucher_cart_layer').css("width",document.body.offsetWidth+"px");
	}
});

function openLayer(layer) {
	$(layer).css("width",document.body.offsetWidth+"px");
	$(layer).css("height",document.body.offsetHeight+"px");
	$(layer).show();
	if ($(layer).children(".body").css("position") != "fixed") {
		window.scrollTo(0,0);
	}
}

function closeLayer(layer) {
	$(layer).hide();
}

function closeAllLayers() {
	$(".layer").hide();
}

function switchLayer(layer1, layer2) {
	closeLayer(layer1);
	openLayer(layer2);
}

function switchToLayer(layer) {
	closeAllLayers();
	openLayer(layer);
}
