  var nrOfTips = 17;
  
  function saveTipNr() {
	    setCookie("tipnr", getTipNr()+1, 365);
  }

  // tipnr telt vanaf 1, niet vanaf 0!
  function getTipNr() {
  	var retVal;
    if (getCookie("tipnr") != null)
	{
		retVal = getCookie("tipnr");
		retVal %= (nrOfTips+1);
		if (retVal == 0) 
			retVal++;
		return retVal;
	}
	else
		return 1;
  }

  function getCookie(NameOfCookie) { 
   if (window.document.cookie.length > 0) { 
     begin = window.document.cookie.indexOf(NameOfCookie+"=");
     if (begin != -1) { 
       begin += NameOfCookie.length+1;
       end = window.document.cookie.indexOf(";", begin);
       if (end == -1) {
         end = window.document.cookie.length;
       }
       return unescape(window.document.cookie.substring(begin, end));
     } 
   }
   return null;
  }

  function setCookie(NameOfCookie, value, expiredays) { 
   var ExpireDate = new Date ();
   ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));
   window.document.cookie = NameOfCookie + "=" + escape(value);
   if (expiredays != null) 
   	window.document.cookie += ";expires=" + ExpireDate.toGMTString();
  }

  function delCookie (NameOfCookie) { 
   if (getCookie(NameOfCookie)) {
     window.document.cookie = NameOfCookie + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
   }
  }
