//#################################
//HBO Statistik-Code PageImpression
//#################################

var modulIds = {
   "ais-online.de/index.html" : 500001,
   "6/staticpage/00/00/39" : 500050,
   "6/staticpage/00/09/31" : 500051,
   "6/staticpage/00/01/29" : 500052,
   "6/staticpage/00/08/22" : 500053,
   "cad/index.html" : 500061,
   "cad/preview" : 500061,
   "cad/selection" : 500061,
   "cad/category" : 500061,
   "cad/move" : 500061,
   "cadtree_preview" : 500062,
   "cad/company" : 500062,
   "ausschreibung/index.html" : 500071,
   "ausschreibung/selection" : 500071,
   "ausschreibung/category" : 500071,
   "ausschreibung/preview" : 500071,
   "ausschreibung/move" : 500071,
   "ausschreibung/company" : 500072,
   "spectree_preview" : 500072,
   "dyn/pdc/general/specexport.jsp?site=6" : 500072,
   "dyn/pdc/search/search.jsp" : 501000,
   "6/category" : 501000,
   "tree3_category" : 500061,
   "tree2_category" : 500071,
   "produktgruppe.html" : 501000,
   "6/staticpage/00/06/45" : 501045,
   "org=gooadp" : 501045,
   "6/staticpage/00/07/86" : 501300,
   "6/staticpage/00/08/02" : 501300,
   "6/company" : 502000,
   "tree2_company" : 500072,
   "tree2_product" : 500072,
   "tree3_product" : 500062,
   "tree3_company" : 500062,
   "firma.html" : 502000,
   "6/resourcefile" : 502000,
   "/datei-files" : 502000,
   "detailinformationen.html" : 502000,
   "datei.html" : 502000,
   "ausschreibung.html" : 502000,
   "cad.html" : 502000,
   "produkt.html" : 502000,
   "produkte.html" : 502000,
   "http://www.ais-online.de/dyn/pdc/rfi" : 502000,
   "dyn/pdc/feedback.jsp" : 502000,
   "6/pdcnewsitem" : 502000,
   "neuheit.html" : 502000,
   "objekt.html" : 505001,
   "6/pdcnewsitem/recent" : 500020,
   "6/pdcnewsitem/news" : 500020,
   "origin=news" : 502012,
   "dyn/pdc/map.jsp?site=6" : 502014,
   "org=gooadc" : 502045,
   "dyn/pdc/my/default.jsp?site=6" : 503021,
   "dyn/pdc/my/profile.jsp?site=6" : 503022,
   "dyn/pdc/my/branchenbuch.jsp?site=6" : 503023,
   "dyn/pdc/my/addproject.jsp?site=6" : 503024,
   "dyn/pdc/my/services.jsp?site=6" : 503025,
   "dyn/pdc/my/vob.jsp?site=6" : 503026,
   "dyn/pdc/my/projects.jsp?site=6" : 503028,
   "dyn/pdc/addtoyoursite.jsp?site=6" : 503028,
   "dyn/pdc/my/register.jsp?site=6" : 503029,
   "dyn/pdc/service/retrieve.jsp?site=6&my=true" : 503030,
   "dyn/pdc/my/raumprogramm.jsp" : 504001,
   "branchen/" : 508000,
   "dyn/pdc/search/services.jsp" : 508001,
   "6/staticpage/00/00/70" : 508100,
   "6/staticpage/00/00/71" : 508101,
   "6/newsletter/overview3" : 508102,
   "6/newsletter/overview16" : 508403,
   "6/staticpage/00/01/50" : 508103,
   "6/staticpage/00/01/51" : 508104,
   "dyn/pdc/default.jsp" : 508200,
   "dyn/pdc/addcompany.jsp" : 508300,
   "/dyn/pdc/addcompany.jsp?site=6&services=true" : 508302,
   "6/staticpage/00/09/22" : 508303,
   "6/staticpage/00/06/27" : 508400,
   "6/staticpage/00/06/34" : 508401,
   "staticpage/00/09/18" : 508998
};

function getModulId(hbo_sitename) {
  var modulId = null;
  for (key in modulIds) {
    if (hbo_sitename.indexOf(key) != -1) {
      modulId = modulIds[key];
    }
  }
  if (modulId == null) modulId = 508999;
  return modulId; 
}

function getEtrackerTarget(siteUrl) {
  var target = "";
  if (siteUrl.indexOf("http://www.ais-online.de/dyn/pdc/rfi") != -1) {
    target= "RFI";
  }
  return target;
}

function getEtrackerValue() {
  if (typeof amountOfRfis != "undefined") {
    return amountOfRfis + ".0";
  } else {
    return "";
  }
}

document.write("<span id=\"statNew\"></span>");
  
var hbo_timestamp = new Date().getTime();

function hbo_stat_pi(hbo_referrer, hbo_sitename, hbo_timestamp, hbo_modulID) {
  if (hbo_referrer == "") hbo_referrer = "unknown";
  var hbo_browser = navigator.userAgent;
  var status_modulID = "parameter";
  var writePageDots = true;
  //don't write page dots for pages with frames
  if (    hbo_sitename.indexOf("ausschreibung/index.html") != -1
       || hbo_sitename.indexOf("cad/index.html") != -1
       || hbo_sitename.indexOf("my/vob.jsp") != -1
       || hbo_sitename.indexOf("tree2_companylist_6.html") != -1
       || (hbo_sitename.indexOf("ais-online.de/index.html") != -1 
       || hbo_sitename.indexOf("actiosoft.com/index.html") != -1 
       || hbo_sitename == "http://www.ais-online.de/" 
       || hbo_sitename == "http://julian1.actiosoft.com/" 
       && hbo_modulID == null)) {
    writePageDots = false;
  }
  if (hbo_modulID != null) writePageDots = true;
  if (writePageDots) {
    if (!hbo_modulID) {
      status_modulID = "searched";
      hbo_modulID = getModulId(hbo_sitename);
    }
  
    var pagedotContainer = document.getElementById('statNew');
    
    var pagedotHnz = document.createElement('img');
    pagedotHnz.setAttribute('src', "http://www.ais-online.de/6/graphics/hbo_pi.gif?time=" + hbo_timestamp + "&browser=" + hbo_browser + "&modulid=" + hbo_modulID + "&sitename=" + hbo_sitename + "&referrer=" + hbo_referrer);
    
    var pagedotIvw = document.createElement('img');
    pagedotIvw.setAttribute('src', "http://aisonl.ivwbox.de/cgi-bin/ivw/CP/00" + hbo_modulID + "-001;ais_1?r=" + escape(hbo_referrer) + "&d=" + hbo_timestamp);
    
    pagedotContainer.appendChild(pagedotHnz);
    pagedotContainer.appendChild(pagedotIvw);
  }
}

//#############################
//HBO Statistik-Code PageObject
//#############################

function hbo_stat_po_with_time(hbo_obid, hbo_baumid, hbo_type, hbo_obid_company, timestamp_call) {
    hbo_stat_po(hbo_obid, hbo_baumid, hbo_type, timestamp_call, hbo_obid_company);
}

function hbo_stat_po_without_time(hbo_obid, hbo_baumid, hbo_type, hbo_obid_company) {
    hbo_stat_po(hbo_obid, hbo_baumid, hbo_type, hbo_timestamp, hbo_obid_company);
}

function hbo_stat_po(hbo_obid, hbo_baumid, hbo_type, timestamp_call, hbo_obid_company) {
  if (!hbo_baumid) hbo_baumid = "";
  if (!hbo_type) hbo_type = "";
  if (!hbo_obid_company) hbo_obid_company = "";

  var pagedotContainer = document.getElementById('statNew');
  var pagedotHnzOb = document.createElement('img');
  pagedotHnzOb.setAttribute('src', "http://www.ais-online.de/6/graphics/hbo_po.gif?time=" + timestamp_call + "&objectid=" + hbo_obid + "&baumid=" + hbo_baumid + "&pobKey=" + hbo_type + "&hbo_obid_company=" + hbo_obid_company);
  pagedotContainer.appendChild(pagedotHnzOb);
}

function hbo_stat_zoom(hbo_obid, hbo_obid_company) {
  var hbo_timestamp_zoom1 = new Date().getTime();
  hbo_stat_pi(document.referrer, document.URL, hbo_timestamp_zoom1, null);
  hbo_stat_po(hbo_obid, null, "FirmenObjekt", hbo_timestamp_zoom1, hbo_obid_company);
}
