function LoadCounter() { var Style='V2'; var TimeOutSeconds=600; var CounterServer='http://www.martl.at/domcount.nsf'; var IncParam=''; var Account='www.martl.at'; var cookie=unescape(document.cookie); // set default timeout if (TimeOutSeconds=='') TimeOutSeconds=600; // get current date/time var now=new Date(); // retrieve existing cookie, if exists var cookiename='DomCountLastVisit'+Account var index=cookie.indexOf(cookiename); if (index==-1) // no cookie present, therefore first visit to page { IncParam='&U'; } else { // DomCountLastVisit cookie exists, get date/time value var countbegin=(cookie.indexOf("=",index)+1); var countend=cookie.indexOf(";", index); if (countend == -1) countend = cookie.length; var LastVisit=new Date(cookie.substring(countbegin, countend)); // calculate seconds elapsed between last visit and now // (N.B. if your page will only be used by recent browsers (IE4/5, NS4), you can // use the Math.round function below for more precision) // elapsed=Math.round((now-LastVisit)/1000); var elapsed=(now-LastVisit)/1000; if (elapsed<=TimeOutSeconds) // user still within same session { IncParam='&K'; } else // create agent parameter to indicate unique visit IncParam='&U'; } // set SRC for IMG tag (will auto-load as soon as this is set) document.Counter.src=CounterServer+"/WebCounter?OpenAgent&S="+Style+"&X="+Account+"&T=0&W=4"+IncParam; // set LastVisit cookie value (after above tests and image loading) document.cookie=cookiename+"="+escape(now)+"; path=/"; }