// === Query String auswerten:
function get_winparam(my_key)
{ var i,parms,paare,wert='';
  if (location.search)
  { parms=location.search.split('\?'); parms=parms[1].split('\&');
    for (i=0; i<parms.length; i++) { paare=parms[i].split('\='); if (paare[0]==my_key) wert=paare[1]; }
  }
  return wert;
}

// === Cookies und Co.
function set_cookie(kennung,level,punkte)
{  var ablauf = new Date(); 
   var dreimonate = ablauf.getTime() + (100 * 24 * 60 * 60 * 1000);
   ablauf.setTime(dreimonate);
   var t=kennung+'='+level+','+punkte+'; expires=' + ablauf.toGMTString(); 
   document.cookie=t;
}

function check_cookie() { return document.cookie; }

function get_cookie(kennung)
{ var ok=document.cookie,parms;
  if (ok) { parms=document.cookie.split('\='); ok=(parms[0]==kennung); }
  if (ok) { parms=parms[1].split(','); level=parseInt(parms[0]); punkte=parseInt(parms[1]); }
  else alert('kein Spiel gespeichert!');
}

// -------------------------------------------------------------------------------------------------------------

function hilfe()    { var win2=window.open('hilfe.htm','popup','width=592,height=376,scrollbars=yes'); }

function updat_punkte(p) { document.form1.punkte.value=p; }
function updat_count(p)  { document.form1.count.value=p; }
function updat_level(p)  { document.form1.level.value=p; }
function updat_minp(p)   { document.form1.pmin.value=p; }

// === Listenkram:
var liste=new Array();  // muss global sein bei Gebrauch mit setTimeout
function in_liste(e,l)  { var i,k=-1; if (l[0]>0) for (i=1; i<=l[0]; i++) if (l[i]==e) k=i; return k; }
function add_liste(e,l) { if (in_liste(e,l)<1) { l[0]++; l[l[0]]=e; } }
function add2liste(e,l) { l[0]++; l[l[0]]=e; }
function sub_liste(e,l) { var i,k=in_liste(e,l); if (k>0) { l[k]=l[l[0]]; l[0]--; } }
function init_liste(l)  { l[0]=0; }
// =======================================================================================================

