function getQueryParam(key) {
  var u = location.search;
  if (u != '') {
    var kv = u.substring(1).split('&');
    for ( var i = 0; i < kv.length; i++) {
      var idx = kv[i].indexOf('=');
      if (idx > -1) {
        var k = kv[i].substring(0, idx);
        if (key == k) {
          return kv[i].substring(idx + 1);
        }
      }
    }
    return false;
  }
}
document.write('<div style="position:absolute;visibility:hidden" id="pixelholder0">nix</div>');
window.arPixelUrlBase = 'http://www.spox.com/pub/external/picounter.html?key=';
function callIframePixel(params) {
  if (! window.arPixelIdx) window.arPixelIdx = 0;
  if (! window.arPixel) window.arPixel = new Array();
  window.arPixel[window.arPixel.length] = window.arPixelUrlBase + params;
  window.sPixel = window.arPixel.join('\n');
  if (! window.callingPixel) {
    window.callingPixel = true;
    doIframePixelCall();
  }
}
function doIframePixelCall() {
  if (window.arPixelIdx >= window.arPixel.length) {
    window.callingPixel = false;
    return;
  }
  var url = window.arPixel[window.arPixelIdx];
  var x = '<div id="pixelholder'+(window.arPixelIdx + 1)+'">nix</div>';
  x += '<iframe src="'+url+'" onload="window.arPixelIdx++;doIframePixelCall();"></iframe>';
  document.getElementById('pixelholder' + window.arPixelIdx).innerHTML=x; 
}

window.PIs = [];

// initialer Aufruf zur Zaehlung eines SeitenPI
function countPage(oParams) {
  if (typeof(oParams) == 'string') {
    oParams = {ivwCode:oParams};
  }
  window.ivwPI='http://spoxcom.ivwbox.de/cgi-bin/ivw/CP/' + oParams.ivwCode + ';?r='+escape(document.referrer);
  countPI(oParams);
}

// Wiederholung eines SeitenPI
// hier sollte ein neues Parameterobjekt uebergeben werden, welches eine vollstaendige Parameterliste enthaelt.
function countPI(oParams) {
  var pathExt = false;
  if (typeof window.ivwPI == 'undefined') return;
  if (typeof(oParams) == 'string') {
    pathExt = oParams;
    oParams = false;
  }
  var z = '';
  var doIvw = true;
  if (oParams && 'off' == oParams.ivw) {
    doIvw = false;
  }
  if (doIvw) {
    var x = new Image();
    window.PIs[window.PIs.length] = x;
    x.src = window.ivwPI+'&d='+(Math.random()*100000);
  }
}
