
/* 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;
	
			var x = Event.pointerX(event) + 20;
		var y = Event.pointerY(event) - 30;
		$('wkEingangOk').style.top = y+'px';
		$('wkEingangOk').style.left = x+'px';
		
	$('wkEingangOkAnimation').src = '/pix/spacer.gif';
	$('wkEingangOk').show();
	$('wkEingangOkAnimation').src = animSrc;
	Element.hide.delay(3, 'wkEingangOk'); 
}
/* d_spl_js_bittewarten */

function bitteWarten() 
{
	if ( bitteWartenZulassen )
	{
		var arr = $$('body');
		var body = arr[0];
		new Effect.Opacity(body, { from: 1.0, to: 0.7, duration: 1 }); 
		new Effect.Opacity(body, { from: 0.7, to: 0.3, duration: 3 }); 
	}
	else bitteWartenZulassen = true;
}

function bitteWartenIE(e) 
{
	if ( bitteWartenZulassen )
	{
		var e2 = e || window.event;
		if ( e2 ) 
		{
			var x = Event.pointerX(e2) + 3;
			var y = Event.pointerY(e2) - 15;
			$('bitteWarten').style.top = y+'px';
			$('bitteWarten').style.left = x+'px';
			$('bitteWarten').show();
			$('bitteWarten').setOpacity(0.9); 
		}
	}
	else bitteWartenZulassen = true;
}

