/******************** TOUCH CLARITY CONFIG **************************/

var tc = window.tc || {};
tc.audi_protocol = (document.location.protocol !="https:") ? "http://" : "https://";
tc.log_path = window.tc.log_path || (tc.audi_protocol+"www.audi.de/cms4imp_base/audi/touchclarity");

tc.audi_location = document.location.toString();
tc.audi_env = tc.audi_location.match(/(?:^https?|^file):\/\/\/?(?:www\.)?([^\/]+)/);
tc.audi_domain = tc.audi_env && tc.audi_env[1] ? tc.audi_env[1] : "";

switch(tc.audi_domain)
{
  case "my.audi.com" : 
    tc.environment_prepend = "secure-www.audi.com"; 
  break;
  default : tc.environment_prepend = "";
}

// debug concatenation
if(-1<document.location.search.indexOf("tcdebug=true"))
{
  tc.brdebug = "/audi/de/de2/tools/tc_business_rules_debug.data.js";
}

/** 
* tc.active activation controller. Only supported properties for this activation list are the following: 
* - site_id : touchclarity site_id to track to in case all criteria (properties set) is met
* - domain : the domain part of the URL to activate. The logic breaks the domain on. and iterate through each part individually
* - path part : a path-trigger to activate on. the logic breaks the path on / and iterate through each part individually
* - query parameter : a query-parameter to activate on. it has to be specified as a key-value pair.
* - active : set tc.active true or false
*
* Optional dynamic script-injection can also be specified; mandatory properties are:
* - scripthost : (string) the domain where script(s) is/are hosted, e.g. "audi.de" without host (http(s)://) specified (autodetected)
* - scriptpath : (string) the root relative path to the scripts, e.g. "/cms4imp_base/audi/touchclarity" 
* - scriptfiles : (string) comma separated list of the filename(s) of the script(s) to be injected.
*/

var activateList =
[
  { // default if tc.active set explicitly on page 
    inline_default  :   true,
    site_id         :   455,
    scripthost      :   tc.environment_prepend || "www.audi.de",
    scriptpath      :   "",
    scriptfiles     :   "/cms4imp_base/audi/touchclarity/json.js, " + (tc.brdebug || "/audi/de/de2/tools/tc_business_rules.data.js")
  }
  ,
  { // A5 microsite, only activate on the German version
    // since all microsites share the domain microsites.audi.com
    // we have to ensure only the A5 microsite is activated. This is done to
    // match "microsites.audi.com" AND path "audia5" AND lang=de
    site_id     :     455,
    domain      :     "microsites.audi.com",
    path        :     "audia5",
    query       :     { lang : "de" },
    active      :     true, 
    scripthost  :     tc.environment_prepend || "www.audi.de",
    scriptpath  :     "",
    scriptfiles :     "/cms4imp_base/audi/touchclarity/json.js, " + (tc.brdebug || "/audi/de/de2/tools/tc_business_rules.data.js")
  }
  ,
  { // Car Configurator URL with mandant ID (in some scenarios)
    // example: http://ak4-de.audi.de/entry.do?mandant=ak4_de
    site_id     :     455,
    query       :     { mandant : "ak4_de" },
    active      :     true, 
    scripthost  :     tc.environment_prepend || "www.audi.de",
    scriptpath  :     "",
    scriptfiles :     "/cms4imp_base/audi/touchclarity/json.js, " + (tc.brdebug || "/audi/de/de2/tools/tc_business_rules.data.js")
  }
  ,
  { // Car Configurator URL without mandant ID (in some scenarios)
    // example: http://ak4-de.audi.de/entry.do
    site_id     :     455,
    domain      :     "ak4-de.audi.de",
    active      :     true, 
    scripthost  :     tc.environment_prepend || "www.audi.de",
    scriptpath  :     "",
    scriptfiles :     "/cms4imp_base/audi/touchclarity/json.js, " + (tc.brdebug || "/audi/de/de2/tools/tc_business_rules.data.js")
  }
];
