var jsStop = 'START';
var jsShow = 'NEIN';
var jsWait = 'NEIN';
var cart = '';
var cart_h = '';
var el = '';
var elb = '';
var AktSite = 1
var OptionClick = 'NEIN';

function chide(wert)
{
  var carth = document.getElementById('cart_h');
	var cartcont = document.getElementById('cart_container');
	if (jsStop == 'JA')
	{
  	if (wert > 0)
  	{
  	  wert --;
  	  wert --;
  	  wert --;
  		carth.style.opacity = (wert / 100);
  		carth.style.MozOpacity = (wert / 100);
  		carth.style.KhtmlOpacity = (wert / 100);
  		carth.style.filter = 'alpha(opacity=' + wert + ')';
  		cartcont.style.opacity = (wert / 100);
  		cartcont.style.MozOpacity = (wert / 100);
  		cartcont.style.KhtmlOpacity = (wert / 100);
  		cartcont.style.filter = 'alpha(opacity=' + wert + ')';
  		setTimeout(function () { chide(wert) }, 1);
    }
    else
    {
      cartcont.style.display = 'none';
    	carth.style.display = 'none';
    	jsStop = 'NEIN';
    	jsShow = 'NEIN';
    	jsWait='NEIN';
    }
  }
  
}
  
function cshow(wert)
{
	
  if (jsStop != 'JA')
	{
    jsStop = 'NEIN';
    var carth = document.getElementById('cart_h');
  	var cartcont = document.getElementById('cart_container');
    cartcont.style.display = 'block';
  	carth.style.display = 'block';
  	
  	if (wert < 100)
  	{
  	  jsShow = 'JA';
      wert ++;
  	  wert ++;
  	  wert ++;
  		carth.style.opacity = (wert / 100);
  		carth.style.MozOpacity = (wert / 100);
  		carth.style.KhtmlOpacity = (wert / 100);
  		carth.style.filter = 'alpha(opacity=' + wert + ')';
  		cartcont.style.opacity = (wert / 100);
  		cartcont.style.MozOpacity = (wert / 100);
  		cartcont.style.KhtmlOpacity = (wert / 100);
  		cartcont.style.filter = 'alpha(opacity=' + wert + ')';
  		setTimeout(function () { cshow(wert) }, 1);
    }
    else
    {
      jsStop = 'JA';
      jsShow = 'NEIN';
    }
  }
  
}

function jsWaitForHide(wert)
{  
  if (jsWait == 'NEIN')
  {
    //alert('Wait='+jsWait+'; Show='+jsShow+'; Stop='+jsStop);
    jsWait = 'JA';
    setTimeout(function () { if (jsShow == 'JA' && jsStop == 'JA') {jsStop = 'JA';jsShow = 'JA';chide(wert) }else{jsStop = 'JA';jsShow = 'JA';jsWait='NEIN';}}, 800)
  }
}

function jsgo()
{
	//alert(location.href);
	if (OptionClick == 'NEIN')
	{
    if (location.href.indexOf('muesli-mixen.asp') != -1)
  	{
  		if (Added == "JA")
  		{
  			var accept = confirm('Willst du dein Müsli gleich in den Warenkorb legen?');
  			if (accept == true)
  			{
  				location.href="warenkorb.asp?mix=1";
  			}
  			else
  			{
  				location.href="warenkorb.asp";
  			}
  		}
  		else
  		{
  			location.href="warenkorb.asp";
  		}
  	}
  	else
  	{
  		location.href="warenkorb.asp";
  	}
	}
	else
	{
	   OptionClick = 'NEIN';
  }
}
