function TrackingManager()
{
  this.enabled       = false;

  this.rootAgofCode  = '';
  this.rootIvwAdd    = '';
  this.rootNavId     = '';
  this.rootPagetitle = '';
  this.articleId     = '';
  this.ivwBase       = '';
  this.statScript    = '';

  this.init = function(
    rootAgofCode,
    rootIvwAdd,
    rootNavId,
    rootPagetitle,
    ivwBase,
    articleId,
    statScript
  )
  {
    this.rootAgofCode  = rootAgofCode;
    this.rootIvwAdd    = rootIvwAdd;
    this.rootNavId     = rootNavId;
    this.rootPagetitle = rootPagetitle;
    this.ivwBase       = ivwBase;
    this.articleId     = articleId;
    this.statScript    = statScript;

    this.enabled       = true;
  }

  this.count = function(ivwAdd, agofCode, navId)
  {
    if (!this.enabled) {
      return;
    }

    var pagenumber               = '';
    var js_article_id_pagenumber = '';

    // if no overriding value is passed to the method,
    // we use the basic value that was used to initialize
    // the tracking manager on this page
    statNavid = (navId == null)    ? this.rootNavId    : navId;
    agofCode  = (agofCode == null) ? this.rootAgofCode : agofCode;
    ivwAdd    = (ivwAdd == null)   ? this.rootIvwAdd   : ivwAdd;

    // If we are paging - we want the correct PAGE NAME(S) and MULTI-LEVEL CONTENT CATEGORY
    var event_type = ivwAdd;
    if (ivwAdd.substring(0, 6) == 'paging') {
      if (
        ivwAdd.substring(6, 7) == ','
        && (ivwAdd.substring(7, 8) - 0 == ivwAdd.substring(7, 8)
        && ivwAdd.substring(7, 8).length > 0)
      ) {
       // Pagenumber given and numeric?
        rest       = parseInt(ivwAdd.substring(7));
        pagenumber = '-' + rest; // Prefix for Backwardscompatibility
      }
      ivwAdd = (this.rootPagetitle == '') ? ivwAdd : this.rootPagetitle;
    }

    // on the current page we replace the src of the ivw-image to retrigger the counting ...
    if (document.images) {

      // IVW - usually we have one static navid for the ivw-counting.
      if ($('ivwpx') != null) {
        var js_article_id = this.articleId;

        if (js_article_id > 0) { // Append pagenumber only when article-id is present
          js_article_id_pagenumber = js_article_id + pagenumber;
        }
        ivwPixelPath = this.ivwBase + agofCode +
                       ';' + statNavid + ',' +
                       js_article_id_pagenumber +
                       ',JS_' + ivwAdd +
                       ',?r=' + escape(document.referrer) +
                       '&d=' + (Math.random() * 100000);

        $('ivwpx').src = ivwPixelPath;
      }

      // Only for Sites with no IVW- Tracking:
      // STAT-Pixel - the selfmade GuJ tracking; for historic reasons,
      // we use virtual navids here to simulate the teamsite-content-hierarchy
      if ($('stat') != null) {
        statPixelPath = this.statScript +
                        '?c=' + statNavid +
                        ',,JS_'+ ivwAdd +
                        ',&amp;p='+(Math.random()*100000);
        $('stat').src = statPixelPath;
      }

      // Omniture SiteCatalyst
      if ((typeof s != 'undefined') && (s != null)) {
        savehier1  = s.hier1;
        saveprop10 = s.prop10;
        // initial page impression is marked by 'pi'
        if (s.hier1.substring(s.hier1.length - 18) == 'pi ohne ajax/flash') {
          s.hier1 = s.hier1.slice(0, s.hier1.length-18);
          s.hier1 = s.hier1 + 'ajax';
        }
        else {
          s.hier1 = s.hier1 + ',ajax';
        }
        s.hier1 = s.hier1 + ',' + event_type;
        // adjust page number
        if (event_type.substring(0, 7) == 'paging,') {
          s.prop10 = event_type.substring(7);
        }
        s.referrer = window.location.protocol + '//' + document.location.host + document.location.pathname;
        void(s.t());
        s.hier1  = savehier1;
        s.prop10 = saveprop10;
      }

      // googleAnalytics - same for GA, we just call the javascript-function
      if ((typeof pageTracker != 'undefined') && (pageTracker != null)) {
        pageTracker._trackPageview();
      }

     }
  };

  // this is a simple wrapper around SiteCatalyst's link tracker
  this.link = function(obj, type, text)
  {
    if (!this.enabled || typeof s_account == 'undefined') {
      return;
    }
    var s = s_gi(s_account);
    s.tl(obj, type, text);
  };

}

// create dummy trackingManager
var trackingManager = new TrackingManager();

