function showShopLightBox() {
	document.getElementById("panel").style.display = 'block';
	document.getElementById("panel-content").style.display = 'block';
	window.scrollTo(0,0);

	for (var i=0; i < document.getElementsByTagName("select").length; i++)	{
		if(document.getElementsByTagName("select")[i]) {
			document.getElementsByTagName("select")[i].style.display = "none";
		}
	}

}

function setLightBoxSize() {
	if(document.getElementById("panel-inside").offsetHeight+70 > document.body.offsetHeight) {
		if(document.getElementById("body-holder").offsetHeight > document.getElementById("panel-inside").offsetHeight) {
			document.getElementById("panel-container").style.height = document.getElementById("body-holder").offsetHeight + "px";
		} else {
			document.getElementById("panel-container").style.height = document.getElementById("panel-inside").offsetHeight + 70 + "px";
		}
	} else {
		if(document.getElementById("body-holder").offsetHeight > document.body.offsetHeight) {
			document.getElementById("panel-container").style.height = document.getElementById("body-holder").offsetHeight + "px";
		} else {
			document.getElementById("panel-container").style.height = document.body.offsetHeight + "px";
		}
	}
}

function hidePanel() {
	document.getElementById("panel-content").style.display = 'none';
	document.getElementById("panel").style.display = 'none';
	if(document.getElementById("sizeSelect")) {
		document.getElementById("sizeSelect").style.display = "inline";
	}
	for (var i=0; i < document.getElementsByTagName("select").length; i++)	{
		if(document.getElementsByTagName("select")[i]) {
			document.getElementsByTagName("select")[i].style.display = "inline";
		}
	}
	$("#panel-inside").css("width", "600px");
}

function showPage(ajaxUrl) {
	document.getElementById("content-container").innerHTML = "<div style=\"text-align: center;\"><br/><br/><br/><br/><img src=\"/images/common/loading.gif\" alt=\"\"/><br/><br/><br/><br/></div>";
	ajaxParams = "rand=" + Math.floor(Math.random()*100000000);
	jQuery.ajax({
		type: "POST",
		url: ajaxUrl,
		data: ajaxParams,
		dataType: "html",
		success: function(msg){
			$("div#content-container").html(msg);
			$("#panel-inside").css("width", "627px");
			setLightBoxSize();
		}
	});
	
	showShopLightBox();
}

function showTitleZoom(productId) {
	document.getElementById("content-container").innerHTML = "<div style=\"text-align: center;\"><br/><br/><br/><br/><img src=\"/images/common/loading.gif\" alt=\"\"/><br/><br/><br/><br/></div>";
	ajaxParams = "action=ShowTitleZoom&productId=" + productId + "&rand=" + Math.floor(Math.random()*100000000);
	jQuery.ajax({
		type: "POST",
		url: "/app/navigation.do",
		data: ajaxParams,
		dataType: "html",
		success: function(msg){
			$("div#content-container").html(msg);
			$("#panel-inside").css("width", "527px");
			MagicZoom.refresh();
			setLightBoxSize();
		}
	});
	
	showShopLightBox();
}

function showIssueZoom(productId, day, month, year) {
	document.getElementById("content-container").innerHTML = "<div style=\"text-align: center;\"><br/><br/><br/><br/><img src=\"/images/common/loading.gif\" alt=\"\"/><br/><br/><br/><br/></div>";
	ajaxParams = "action=ShowIssueZoom&productId=" + productId + "&day=" + day + "&month=" + month + "&year=" + year + "&rand=" + Math.floor(Math.random()*100000000);
	jQuery.ajax({
		type: "POST",
		url: "/app/navigation.do",
		data: ajaxParams,
		dataType: "html",
		success: function(msg){
			$("div#content-container").html(msg);
			$("#panel-inside").css("width", "527px");
			MagicZoom.refresh();
			setLightBoxSize();
		}
	});
	
	showShopLightBox();
}

function showBonusZoom(productId, bonusProductId) {
	document.getElementById("content-container").innerHTML = "<div style=\"text-align: center;\"><br/><br/><br/><br/><img src=\"/images/common/loading.gif\" alt=\"\"/><br/><br/><br/><br/></div>";
	ajaxParams = "action=ShowBonusZoom&productId=" + productId + "&bonusProductId=" + bonusProductId + "&rand=" + Math.floor(Math.random()*100000000);
	jQuery.ajax({
		type: "POST",
		url: "/app/navigation.do",
		data: ajaxParams,
		dataType: "html",
		success: function(msg){
			$("div#content-container").html(msg);
			$("#panel-inside").css("width", "527px");
			setLightBoxSize();
		}
	});
	
	showShopLightBox();
}

function showBonusZoomCheckOut(productId, bonusProductId) {
	document.getElementById("content-container").innerHTML = "<div style=\"text-align: center;\"><br/><br/><br/><br/><img src=\"/images/common/loading.gif\" alt=\"\"/><br/><br/><br/><br/></div>";
	ajaxParams = "action=ShowBonusZoom&productId=" + productId + "&bonusProductId=" + bonusProductId + "&rand=" + Math.floor(Math.random()*100000000);
	jQuery.ajax({
		type: "POST",
		url: "/app/navigation.do",
		data: ajaxParams,
		dataType: "html",
		success: function(msg){
			$("div#content-container").html(msg);
			$("#panel-inside").css("width", "527px");
			$("div.lb-bonus-footer").css("display", "none");
			setLightBoxSize();
		}
	});
	
	showShopLightBox();
}

function showBFCCRCLightbox() {
	document.getElementById("content-container").innerHTML = "<div style=\"text-align: center;\"><br/><br/><br/><br/><img src=\"/images/common/loading.gif\" alt=\"\"/><br/><br/><br/><br/></div>";
	ajaxParams = "action=ShowBFCCRCLightbox&rand=" + Math.floor(Math.random()*100000000);
	jQuery.ajax({
		type: "POST",
		url: "/app/order.do",
		data: ajaxParams,
		dataType: "html",
		success: function(msg){
			$("div#content-container").html(msg);
			$("#panel-inside").css("width", "627px");
			setLightBoxSize();
		}
	});
	
	showShopLightBox();
}

function showExtraAddressForm( addProductForm ) {
	document.getElementById("content-container").innerHTML = "<div style=\"text-align: center;\"><br/><br/><br/><br/><img src=\"/images/common/loading.gif\" alt=\"\"/><br/><br/><br/><br/></div>";
	ajaxParams = addProductForm + "&action=ShowExtraAddress&rand=" + Math.floor(Math.random()*100000000);
	jQuery.ajax({
		type: "POST",
		url: "/app/order.do",
		data: ajaxParams,
		dataType: "html",
		success: function(msg){
			$("div#content-container").html(msg);
			$("#panel-inside").css("width", "627px");
			setLightBoxSize();
		}
	});
	
	showShopLightBox();
}

function showEditExtraAddressForm( ) {
	document.getElementById("content-container").innerHTML = "<div style=\"text-align: center;\"><br/><br/><br/><br/><img src=\"/images/common/loading.gif\" alt=\"\"/><br/><br/><br/><br/></div>";
	ajaxParams = "&action=ShowEditExtraAddress&rand=" + Math.floor(Math.random()*100000000);
	jQuery.ajax({
		type: "POST",
		url: "/app/order.do",
		data: ajaxParams,
		dataType: "html",
		success: function(msg){
			$("div#content-container").html(msg);
			$("#panel-inside").css("width", "627px");
			setLightBoxSize();
		}
	});
	
	showShopLightBox();
}

function sendExtraAddressForm() {
	var ajaxParams = jQuery("#regFormEXTRA").serialize();
	document.getElementById("content-container").innerHTML = "<div style=\"text-align: center;\"><br/><br/><br/><br/><img src=\"/images/common/loading.gif\" alt=\"\"/><br/><br/><br/><br/></div>";
	jQuery.ajax({
		type: "POST",
		cache: false,
		url: "/app/order.do",
		data: ajaxParams,
		dataType: "html",
		success: function(msg){
			jQuery("div#content-container").html(msg);
			setLightBoxSize();
		}
	});
}

function showAddressBook() {
	document.getElementById("content-container").innerHTML = "<div style=\"text-align: center;\"><br/><br/><br/><br/><img src=\"/images/common/loading.gif\" alt=\"\"/><br/><br/><br/><br/></div>";
	ajaxParams = "&action=ShowAddressBook&rand=" + Math.floor(Math.random()*100000000);
	jQuery.ajax({
		type: "POST",
		url: "/app/order.do",
		data: ajaxParams,
		dataType: "html",
		success: function(msg){
			$("div#content-container").html(msg);
			$("#panel-inside").css("width", "627px");
			setLightBoxSize();
		}
	});
	
	showShopLightBox();
}

function sendDeleteShippingAddress(screenName) {
	var ajaxParams = jQuery("#regForm").serialize();
	jQuery("div#content-container").html("<img src=\"/images/common/loading.gif\" alt=\"\" style=\"margin: 100px auto; display: block;\" />");
	jQuery.ajax({
		type: "POST",
		cache: false,
		url: screenName,
		data: ajaxParams,
		dataType: "html",
		success: function(msg){
			jQuery("div#content-container").html(msg);
			setLightBoxSize();
		}
	});
}

function sendNewShippingAddress(ajaxUrl) {
	var ajaxParams = jQuery("#regForm").serialize();
	jQuery("div#content-container").html("<img src=\"/images/common/loading.gif\" alt=\"\" style=\"margin: 100px auto; display: block;\" />");
	jQuery.ajax({
		type: "POST",
		cache: false,
		url: ajaxUrl,
		data: ajaxParams,
		dataType: "html",
		success: function(msg){
			jQuery("div#content-container").html(msg);
			setLightBoxSize();
		}
	});
}

function showWelcomeText() {
	document.getElementById("content-container").innerHTML = "<div style=\"text-align: center;\"><br/><br/><br/><br/><img src=\"/images/common/loading.gif\" alt=\"\"/><br/><br/><br/><br/></div>";
	ajaxParams = "";
	jQuery.ajax({
		type: "POST",
		url: "/app/willkommen.do",
		data: ajaxParams,
		dataType: "html",
		success: function(msg){
			$("div#content-container").html(msg);
			$("#panel-inside").css("width", "918px");
			setLightBoxSize();
		}
	});
	
	showShopLightBox();
}

function showWelcomeBildText() {
	document.getElementById("content-container").innerHTML = "<div style=\"text-align: center;\"><br/><br/><br/><br/><img src=\"/images/common/loading.gif\" alt=\"\"/><br/><br/><br/><br/></div>";
	ajaxParams = "";
	jQuery.ajax({
		type: "POST",
		url: "/app/willkommen_bild.do",
		data: ajaxParams,
		dataType: "html",
		success: function(msg){
			$("div#content-container").html(msg);
			$("#panel-inside").css("width", "918px");
			setLightBoxSize();
		}
	});
	
	showShopLightBox();
}

function showBildPostalCodeQuery(mustRefresh, mainProductId, bonusProductId) {
	document.getElementById("content-container").innerHTML = "<div style=\"text-align: center;\"><br/><br/><br/><br/><img src=\"/images/common/loading.gif\" alt=\"\"/><br/><br/><br/><br/></div>";
	ajaxParams = "&action=ShowBildPostalCodeQuery&rand=" + Math.floor(Math.random()*100000000);
	if(mustRefresh) {
		ajaxParams += "&mustRefresh=true";
		if( mainProductId != "" ){
			ajaxParams += "&mainProductId=" + mainProductId;
		}
	} else {
		ajaxParams += "&mustRefresh=false&mainProductId=" + mainProductId + "&bonusProductId=" + bonusProductId;
	}
	jQuery.ajax({
		type: "POST",
		url: "/app/navigation.do",
		data: ajaxParams,
		dataType: "html",
		success: function(msg){
			$("div#content-container").html(msg);
			$("#panel-inside").css("width", "938px");
			setLightBoxSize();
		}
	});
	
	showShopLightBox();
}

function submitBildPostalCodeQuery() {
	var ajaxParams = jQuery("#postalCodeForm").serialize();
	document.getElementById("content-container").innerHTML = "<div style=\"text-align: center;\"><br/><br/><br/><br/><img src=\"/images/common/loading.gif\" alt=\"\"/><br/><br/><br/><br/></div>";
	jQuery.ajax({
		type: "POST",
		cache: false,
		url: "/app/navigation.do",
		data: ajaxParams,
		dataType: "html",
		success: function(msg){
			$("div#content-container").html(msg);
			setLightBoxSize();
		}
	});
}

function showWeltkompaktPostalCodeQuery(mustRefresh, mainProductId, bonusProductId) {
	document.getElementById("content-container").innerHTML = "<div style=\"text-align: center;\"><br/><br/><br/><br/><img src=\"/images/common/loading.gif\" alt=\"\"/><br/><br/><br/><br/></div>";
	ajaxParams = "&action=ShowWeltkompaktPostalCodeQuery&rand=" + Math.floor(Math.random()*100000000);
	if(mustRefresh) {
		ajaxParams += "&mustRefresh=true";
		if( mainProductId != "" ){
			ajaxParams += "&mainProductId=" + mainProductId;
		}
	} else {
		ajaxParams += "&mustRefresh=false&mainProductId=" + mainProductId + "&bonusProductId=" + bonusProductId;
	}
	jQuery.ajax({
		type: "POST",
		url: "/app/navigation.do",
		data: ajaxParams,
		dataType: "html",
		success: function(msg){
			$("div#content-container").html(msg);
			$("#panel-inside").css("width", "938px");
			setLightBoxSize();
		}
	});
	
	showShopLightBox();
}

function submitWeltkompaktPostalCodeQuery() {
	var ajaxParams = jQuery("#weltPostalCodeForm").serialize();
	document.getElementById("content-container").innerHTML = "<div style=\"text-align: center;\"><br/><br/><br/><br/><img src=\"/images/common/loading.gif\" alt=\"\"/><br/><br/><br/><br/></div>";
	jQuery.ajax({
		type: "POST",
		cache: false,
		url: "/app/navigation.do",
		data: ajaxParams,
		dataType: "html",
		success: function(msg){
			$("div#content-container").html(msg);
			setLightBoxSize();
		}
	});
}

function showBZPostalCodeQuery(mustRefresh, mainProductId, bonusProductId) {
	document.getElementById("content-container").innerHTML = "<div style=\"text-align: center;\"><br/><br/><br/><br/><img src=\"/images/common/loading.gif\" alt=\"\"/><br/><br/><br/><br/></div>";
	ajaxParams = "&action=ShowBZPostalCodeQuery&rand=" + Math.floor(Math.random()*100000000);
	if(mustRefresh) {
		ajaxParams += "&mustRefresh=true";
		if( mainProductId != "" ){
			ajaxParams += "&mainProductId=" + mainProductId;
		}
	} else {
		ajaxParams += "&mustRefresh=false&mainProductId=" + mainProductId + "&bonusProductId=" + bonusProductId;
	}
	jQuery.ajax({
		type: "POST",
		url: "/app/navigation.do",
		data: ajaxParams,
		dataType: "html",
		success: function(msg){
			$("div#content-container").html(msg);
			$("#panel-inside").css("width", "938px");
			setLightBoxSize();
		}
	});
	
	showShopLightBox();
}

function submitBZPostalCodeQuery() {
	var ajaxParams = jQuery("#postalCodeForm").serialize();
	document.getElementById("content-container").innerHTML = "<div style=\"text-align: center;\"><br/><br/><br/><br/><img src=\"/images/common/loading.gif\" alt=\"\"/><br/><br/><br/><br/></div>";
	jQuery.ajax({
		type: "POST",
		cache: false,
		url: "/app/navigation.do",
		data: ajaxParams,
		dataType: "html",
		success: function(msg){
			$("div#content-container").html(msg);
			setLightBoxSize();
		}
	});
}

function showWeltPostalCodeQuery(mustRefresh, mainProductId, bonusProductId) {
	document.getElementById("content-container").innerHTML = "<div style=\"text-align: center;\"><br/><br/><br/><br/><img src=\"/images/common/loading.gif\" alt=\"\"/><br/><br/><br/><br/></div>";
	ajaxParams = "&action=ShowWeltPostalCodeQuery&rand=" + Math.floor(Math.random()*100000000);
	if(mustRefresh) {
		ajaxParams += "&mustRefresh=true";
		if( mainProductId != "" ){
			ajaxParams += "&mainProductId=" + mainProductId;
		}
	} else {
		ajaxParams += "&mustRefresh=false&mainProductId=" + mainProductId + "&bonusProductId=" + bonusProductId;
	}
	jQuery.ajax({
		type: "POST",
		url: "/app/navigation.do",
		data: ajaxParams,
		dataType: "html",
		success: function(msg){
			$("div#content-container").html(msg);
			$("#panel-inside").css("width", "938px");
			setLightBoxSize();
		}
	});
	
	showShopLightBox();
}

function submitWeltPostalCodeQuery() {
	var ajaxParams = jQuery("#postalCodeForm").serialize();
	document.getElementById("content-container").innerHTML = "<div style=\"text-align: center;\"><br/><br/><br/><br/><img src=\"/images/common/loading.gif\" alt=\"\"/><br/><br/><br/><br/></div>";
	jQuery.ajax({
		type: "POST",
		cache: false,
		url: "/app/navigation.do",
		data: ajaxParams,
		dataType: "html",
		success: function(msg){
			$("div#content-container").html(msg);
			setLightBoxSize();
		}
	});
}

function showWamskPostalCodeQuery(mustRefresh, mainProductId, bonusProductId) {
	document.getElementById("content-container").innerHTML = "<div style=\"text-align: center;\"><br/><br/><br/><br/><img src=\"/images/common/loading.gif\" alt=\"\"/><br/><br/><br/><br/></div>";
	ajaxParams = "&action=ShowWamskPostalCodeQuery&rand=" + Math.floor(Math.random()*100000000);
	if(mustRefresh) {
		ajaxParams += "&mustRefresh=true";
		if( mainProductId != "" ){
			ajaxParams += "&mainProductId=" + mainProductId;
		}
	} else {
		ajaxParams += "&mustRefresh=false&mainProductId=" + mainProductId + "&bonusProductId=" + bonusProductId;
	}
	jQuery.ajax({
		type: "POST",
		url: "/app/navigation.do",
		data: ajaxParams,
		dataType: "html",
		success: function(msg){
			$("div#content-container").html(msg);
			$("#panel-inside").css("width", "938px");
			setLightBoxSize();
		}
	});
	
	showShopLightBox();
}

function submitWamskPostalCodeQuery() {
	var ajaxParams = jQuery("#postalCodeForm").serialize();
	document.getElementById("content-container").innerHTML = "<div style=\"text-align: center;\"><br/><br/><br/><br/><img src=\"/images/common/loading.gif\" alt=\"\"/><br/><br/><br/><br/></div>";
	jQuery.ajax({
		type: "POST",
		cache: false,
		url: "/app/navigation.do",
		data: ajaxParams,
		dataType: "html",
		success: function(msg){
			$("div#content-container").html(msg);
			setLightBoxSize();
		}
	});
}

function showTAFScreen(productId, bonusProductId) {
	document.getElementById("content-container").innerHTML = "<div style=\"text-align: center;\"><br/><br/><br/><br/><img src=\"/images/common/loading.gif\" alt=\"\"/><br/><br/><br/><br/></div>";
	ajaxParams = "&action=ShowTAFScreen&rand=" + Math.floor(Math.random()*100000000);
	ajaxParams += "&productId=" + productId + "&bonusProductId=" + bonusProductId;
	jQuery.ajax({
		type: "POST",
		cache: false,
		url: "/app/navigation.do",
		data: ajaxParams,
		dataType: "html",
		success: function(msg){
			$("div#content-container").html(msg);
			$("#panel-inside").css("width", "627px");
			setLightBoxSize();
		}
	});
	showShopLightBox();
}

function submitTAFScreen(ajaxParams) {
	document.getElementById("content-container").innerHTML = "<div style=\"text-align: center;\"><br/><br/><br/><br/><img src=\"/images/common/loading.gif\" alt=\"\"/><br/><br/><br/><br/></div>";
	jQuery.ajax({
		type: "POST",
		url: "/app/navigation.do",
		data: ajaxParams,
		dataType: "html",
		success: function(msg){
			$("div#content-container").html(msg);
			$(".co-error").css("width", "615px");
			setLightBoxSize();
		}
	});
}

function showTAFScreenConfirmation(productId, bonusProductId) {
	document.getElementById("content-container").innerHTML = "<div style=\"text-align: center;\"><br/><br/><br/><br/><img src=\"/images/common/loading.gif\" alt=\"\"/><br/><br/><br/><br/></div>";
	ajaxParams = "&action=ShowTAFScreenConfirmation&rand=" + Math.floor(Math.random()*100000000);
	ajaxParams += "&productId=" + productId + "&bonusProductId=" + bonusProductId;
	jQuery.ajax({
		type: "POST",
		cache: false,
		url: "/app/navigation.do",
		data: ajaxParams,
		dataType: "html",
		success: function(msg){
			$("div#content-container").html(msg);
			$("#panel-inside").css("width", "627px");
			setLightBoxSize();
		}
	});
	showShopLightBox();
}

function showEpaperTAFScreen(productId) {
	document.getElementById("content-container").innerHTML = "<div style=\"text-align: center;\"><br/><br/><br/><br/><img src=\"/images/common/loading.gif\" alt=\"\"/><br/><br/><br/><br/></div>";
	ajaxParams = "&action=ShowTAFScreen&rand=" + Math.floor(Math.random()*100000000);
	ajaxParams += "&productId=" + productId ;
	jQuery.ajax({
		type: "POST",
		cache: false,
		url: "/app/navigation.do",
		data: ajaxParams,
		dataType: "html",
		success: function(msg){
			$("div#content-container").html(msg);
			$("#panel-inside").css("width", "627px");
			setLightBoxSize();
		}
	});
	showShopLightBox();
}

function showAppsDetails(appId, appDetailsId) {
	document.getElementById("content-container").innerHTML = "<div style=\"text-align: center;\"><br/><br/><br/><br/><img src=\"/images/common/loading.gif\" alt=\"\"/><br/><br/><br/><br/></div>";
	ajaxParams = "&action=ShowAppsDetails&rand=" + Math.floor(Math.random()*100000000);
	ajaxParams += "&appId=" + appId + "&appDetailsId=" + appDetailsId;
	jQuery.ajax({
		type: "POST",
		cache: false,
		url: "/app/navigation.do",
		data: ajaxParams,
		dataType: "html",
		success: function(msg){
			$("div#content-container").html(msg);
			$("#panel-inside").css("width", "896px");
			setLightBoxSize();
		}
	});
	showShopLightBox();
}
