var mo="0";

function more(el){
	if(!el)return false;
	var orgEl = el;
	while(el && (el=el.nextSibling) ) if( el.nodeType==1 ) break;
	if(!el||!el.style)return false;
	var bActive = el.style.display!="block";
	el.style.display = bActive ? "block" : "none";
	orgEl.className = bActive ? "active" : "";
	return false
}

function setCookie(name, wert, domain, expires, path, secure){
   var cook = name+"="+unescape(wert)
   cook += (domain) ? "; domain="+ domain : ""
   cook += (expires) ? "; expires="+expires : ""
   cook += (path) ? "; path="+path : ""
   cook += (secure) ? "; secure="+secure : ""
   document.cookie = cook
}

function eraseCookie(name, domain, path){
var ProduktAnzahl = 0;
   var cook = name+"=; expires=Thu, 01-Jan-70 00:00:01 GMT"
   cook += (domain) ? "; domain="+domain : ""
   cook += (path) ? "; path="+path : ""
   document.cookie = cook
}

function getCookie(name){
   var i=0  //Suchposition im Cookie
   var suche = name+"="
   while (i<document.cookie.length){
      if (document.cookie.substring(i, i+suche.length)==suche){
         var ende = document.cookie.indexOf(";", i+suche.length)
         ende = (ende>-1) ? ende : document.cookie.length
         var cook = document.cookie.substring(i+suche.length, ende)
         return unescape(cook)
      }
      i++
   }
   return ""
}

function checkCookie(){
   setCookie("CookieTest", "OK")
   if (!getCookie("CookieTest"))
      return false
   else{
      eraseCookie("CookieTest")
      return true
   }
}

function einfuegen(pid, deeplink, bild, titel, preis){
  var ipid = getCookie("PID") + pid + "|"
  var ideeplink = getCookie("Deeplink") + deeplink + "|"
  var ibild = getCookie("Bild") + bild + "|"
  var ititel = getCookie("Titel") + titel + "|"
  var ipreis = getCookie("Preis") + preis + "|"
  setCookie("PID", ipid,"","Thu, 01-Jan-15 00:00:01 GMT","/")
  setCookie("Deeplink", ideeplink,"","Thu, 01-Jan-15 00:00:01 GMT","/")
  setCookie("Bild", ibild,"","Thu, 01-Jan-15 00:00:01 GMT","/")
  setCookie("Titel", ititel,"","Thu, 01-Jan-15 00:00:01 GMT","/")
  setCookie("Preis", ipreis,"","Thu, 01-Jan-15 00:00:01 GMT","/")
   if (!document.cookie)
     alert("Cookies not enabled!")
   else
  {
    var ipid = getCookie("PID") 
    var ProduktAnzahl = 0
    ipid.replace(/\|/g, function () {
     ProduktAnzahl++;
   });
     document.getElementById("menge").innerHTML=ProduktAnzahl;
    alert("Ok!")
  }
}

function menge() {
var ipid = getCookie("PID") 
var ProduktAnzahl = 0
ipid.replace(/\|/g, function () {
   ProduktAnzahl++;
});
 document.write('<span id=menge>'+ProduktAnzahl+'</span>');
}

function clearText(thefield){
if (thefield.defaultValue==thefield.value)
thefield.value = ""
}
