<!--******showBasketValue*******

  var setBasketInterval = true;

  function setCookie(name, value, expires, path, domain, secure) {

    var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");

    document.cookie = curCookie;
  }

  function getCookie(name) {
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);

    if (begin == -1) {
      begin = dc.indexOf(prefix);
      if (begin != 0) {
        return null;
      }
    } 
    else {
      begin += 2;
    }

    var end = document.cookie.indexOf(";", begin);
    if (end == -1) {
      end = dc.length;
    }

    return unescape(dc.substring(begin + prefix.length, end));
  }

  function stripBasketValueHTML(str) {
    var re= /<\S[^><]*>/g
    str = str.replace(re, "");
    return str.replace(/\&nbsp\;/g, " ");
  }
  
  

  function showBasketValue() {

    var currency = "EUR";
    if ( window.location.hostname.search(/joop/i) != -1 ) currency = "€";
    if ( window.location.hostname.search(/lloydstore\.dk/i) != -1 ) currency = "DKK";
    if ( window.location.hostname.search(/lloyd-store\.dk/i) != -1 ) currency = "DKK";
    var hSessionID      = getCookie ( 'DePauli_hSessionID' );
    var hSessionIDValue = getCookie ( 'DePauli_hSessionID_Value' );
    var myArray		= "";
    var output          = '0 Artikel, 0.00 ' + currency;

    // Mindestbestellwert erreicht 18.07.11
    var outputfree_a    = '&nbsp;';
    var outputfree_b    = '';    
    var outputfreebetrag = 0.00;

    var highlight	= false;
    var color_aktiv	= "";
    var color_inaktiv	= "";
    
    
    // Anzeigefarben übernehmen. Die Farben müssen global definiert sein. Zum Beispiel auf der Startseite des Shops.
    if ( typeof warenkorb_color_aktiv != "undefined" ) color_aktiv = warenkorb_color_aktiv;
    if ( typeof warenkorb_color_inaktiv != "undefined" ) color_inaktiv = warenkorb_color_inaktiv;


    if ( !setBasketInterval ) clearInterval ( intervalBasket );

    if ( (hSessionID != null) && (hSessionIDValue != null) && (typeof(hSessionIDValue) == 'string') ) {
      hSessionIDValue = stripBasketValueHTML(hSessionIDValue);
      myArray = hSessionIDValue.split ( ',' );

      if ( myArray[0] ) {

	if ( myArray[3] ) {
		if ( myArray[3] != "") currency = myArray[3];
	}
	if ( (currency == "EUR") && (window.location.hostname.search(/joop/i) != -1) ) currency = "€";
	if ( (currency == "EUR") && (window.location.hostname.search(/lloydstore\.dk/i) != -1) ) currency = "DKK";
	if ( (currency == "EUR") && (window.location.hostname.search(/lloyd-store\.dk/i) != -1) ) currency = "DKK";
	

        // Stimmt die aktuelle SessionID mit der SessionID der Basketwerte über ein?
        if ( hSessionID == myArray[0] ) {
	  // Mindestbestellwert erreicht 18.07.11
	  if ( myArray[2] > 0 && myArray[4] && myArray[5]) {
		outputfreebetrag = (Math.round((myArray[5] - myArray[4]) * 100) / 100).toFixed(2);
		outputfree_a 	= 'noch ' +  outputfreebetrag + " " + currency + ' bis zum kostenlosen Versand';
		outputfree_b    = 'Kostenloser Versand ' + myArray[5] + ' ' + currency + ' erreicht';
	  }
          if ( myArray[1] == 1 ) {
            output =  '1 Artikel, ' + myArray[2] + ' ' + currency;
	    highlight = true;
          }
          else {
            output = myArray[1] + ' Artikel, ' + myArray[2] + ' ' + currency;
            if ( parseInt(myArray[1]) > 0 ) highlight = true;;
          }
        }
      }
    }

    var bval = document.getElementById("bval");
    var blink = document.getElementById("blink");

    if ( bval ) {
    	//bval.firstChild.nodeValue =  output;
    	bval.innerHTML =  output;
    }

    var second_bval = document.getElementById("second_bval");
    //if ( second_bval ) second_bval.firstChild.nodeValue =  output;
    if ( second_bval ) second_bval.innerHTML =  output;
    
    // Mindestbestellwert erreicht 18.07.11
    var free_bval = document.getElementById("free_bval");
    if ( free_bval ) {
	if ( outputfreebetrag == 0) {
		free_bval.innerHTML =  "&nbsp;";
	}
	else  if ( outputfreebetrag > 0) {
		free_bval.innerHTML =  outputfree_a;
	} else if ( outputfreebetrag < 0) {
		free_bval.innerHTML =  outputfree_b;
	}
    }

    if ( color_aktiv != "" && color_inaktiv != "" ) {
	if ( highlight ) {
		if ( bval ) bval.style["color"] = color_aktiv;
		if ( blink ) blink.style["color"] = color_aktiv;
	}
	else {
		if ( bval ) bval.style["color"] = color_inaktiv;
		if ( blink ) blink.style["color"] = color_inaktiv;
	}
    }
    
  }

 var intervalBasket = setInterval ( "showBasketValue()", 1000);
 

//-->

