/* Statistik Funktionalität: Nedstat Tag
 *
 * Verwendung: am Ende des Dokumentes vor </body> platzieren:
 * <script>ministat('Clio_Extreme.Home');</script>
 * <noscript><img src="http://fr.sitestat.com/renault-group/renault-ch/s?CH_Mini.Clio_Extreme.Home" width=1 height=1></noscript>
 *
 * Das Tag kann beliebig viele Unterrubriken haben: ClioExtreme.Gallery.Innenraum.Tacho
 *
 * Mit dem Befehl ministat wird dem Tag noch die Hauptrubrik "CH_Mini." vorangestellt.
 *
 * This code is based on very ugly nedstat javascript, I hope I got everything right..
 */

function ministat(tag) {
  prefix = "CH_Mini.";
  sitestat(prefix + tag);
}

function sitestat(tag) {
  statsite = "http://fr.sitestat.com/renault-group/renault-ch/s?";
  // strip last slash
  
  // add time and referrer
  opt = "&ns__t=" + new Date().getTime()
  r = document.referrer;
  r = (r.lastIndexOf("/") == r.length - 1) ? r.substring(r.lastIndexOf("/"), 0) : r;
  if (r.length > 0)
    opt += "&ns_referrer=" + escape(r);

  // compose nedstat url and load it
  staturl = statsite + tag + opt;
  
  if (document.images) {
    var statimg = new Image();
    statimg.src = staturl;
  } else {
    document.write('<img src="../../twingo_poker/scripts/%27+staturl+%27" border="0" width="1" height="1" />');
  }
}

/* Helper Funktionen */

function addQuestionMark(href) {
  return (href.indexOf('?') > 0? href : href + "?");
}

function ArrayCopy(arr) {
    for (i in arr) 
        this[i] = arr[i];
}
