
/* d_shop_js_cover */

/**
 * @param  id    cms buch id 
 * @param  b     breite 
 * @param  h     höhe 
 */
function coverGrossAn(id, b, h)
{
	var bodyDecke = document.createElement('div');
	bodyDecke.id = 'bodyDecke';
	bodyDecke.style.height = 2 * document.viewport.getHeight() + 'px';
	document.body.insertBefore(bodyDecke, document.body.firstChild);
	
	$('coverGross').show();
	
	$('coverGrossBild').style.width = b+'px';
	$('coverGrossBild').style.height = h+'px';
	
	new Ajax.Updater('coverGrossBild', '/sixcms/detail.php', {
		method: 'get', 
		parameters: { template: 'd_shop_cover_ajax', id: id }
	});

}


function coverGrossAus()
{
	$('coverGross').hide();
	$('bodyDecke').remove();
}
/* d_shops_js_warenkorb */

function updateWarenkorbKurz()
{
	new Ajax.Updater('warenkorbInhaltKurz', '/sixcms/detail.php', {
		method: 'get', 
		parameters: { template: 'd_shops_wk_inhalt_kurz'}
	});
}

function epoqWkAktualisierung()
{ 
	new Ajax.Request('/sixcms/detail.php', {
		method: 'get', 
		parameters: { template: 'd_shops_wk_json'},
		onSuccess: function(transport) {
			var wk = transport.responseText.evalJSON(true);
			epoq_productIds = [];
			epoq_quantities = [];
			epoq_unitPrices = [];
			wk.each(function(prod, index) {
				epoq_productIds[index] = prod.add_id;
				epoq_quantities[index] = prod.menge;
				epoq_unitPrices[index] = prod.preis;
			});
			epoq_updateCart();
		}
	}); 
}

function inDenWarenkorb2(addId, shopId, event)
{
	new Ajax.Request('/sixcms/detail.php', {
		method: 'get', 
		parameters: { template: 'd_shops_in_wk_ajax', add_id: addId, shop_id: shopId},
		onSuccess: wkEingangOk(event)
	});

	updateWarenkorbKurz.delay(3);
}

function wkEingangOk(event)
{
	var animSrc = $('wkEingangOkAnimation').src;
	
			window.scrollTo(0,0);
		
	$('wkEingangOkAnimation').src = '/pix/spacer.gif';
	$('wkEingangOk').show();
	$('wkEingangOkAnimation').src = animSrc;
	Element.hide.delay(3, 'wkEingangOk'); 
}
/* d_shop_js_falsches_fenster */

function falschesFensterAn(domElem)
{
	document.body.insertBefore(domElem, document.body.firstChild);

	var bodyDecke = document.createElement('div');
	bodyDecke.id = 'bodyDecke';
	bodyDecke.style.height = 2 * document.viewport.getHeight() + 'px';
	document.body.insertBefore(bodyDecke, document.body.firstChild);
	
	domElem.show();
	window.scrollTo(0, 0);
}


function falschesFensterAus(domElem)
{
	domElem.hide();
	$('bodyDecke').remove();
}

