//tealium universal tag - utag.sender.custom_container ut4.0.201801311934, Copyright 2018 Tealium.com Inc. All Rights Reserved.
try{

if(!utag.libloader){utag.libloader=function(src,handler,a,b){a=document;b=a.createElement('script');b.language='javascript';b.type='text/javascript';b.src=src;if(typeof handler=='function'){b.handlerFlag=0; b.onreadystatechange=function(){ if((this.readyState=='complete'||this.readyState=='loaded')&&!b.handlerFlag){b.handlerFlag=1;handler()}};b.onload=function(){if(!b.handlerFlag){b.handlerFlag=1;handler()}};a.getElementsByTagName('head')[0].appendChild(b)}}};

(function(id,loader,u){u=utag.o[loader].sender[id]={};u.ev={'view':1};
  u.map={};
  u.extend=[function(a,b){
//Helper
//thg (180122)
function setCookie(cname, cvalue, exdays) {
    var d = new Date();
    d.setTime(d.getTime() + (exdays*24*60*60*1000));
    var expires = "expires="+d.toUTCString();
//    document.cookie = cname + "=" + cvalue + "; " + expires + ";path=/";
//    document.cookie = "content_consumer_id=msa; " + expires + ";path=/"; 
    document.cookie = "content_consumer=msa; " + expires + ";path=/"; 
}

var query_utag_app = b['qp.utag_app'];

if (typeof query_utag_app !== 'undefined')
{
    setCookie("utag_app", query_utag_app, 30);
}
}];

  u.send=function(a,b,c,d,e,f){if(u.ev[a]||typeof u.ev.all!="undefined"){var data={};
    /*extensions*/for(c=0;c<u.extend.length;c++){try{d=u.extend[c](a,b);if(d==false)return}catch(e){if(typeof utag_err!='undefined'){utag_err.push({e:'extension error:'+e,s:utag.cfg.path+'utag.'+id+'.js',l:c,t:'ex'})}}};
    /*mapping*/for(d in utag.loader.GV(u.map)){if(typeof b[d]!='undefined'){e=u.map[d].split(',');for(f=0;f<e.length;f++){data[e[f]]=b[d]}}}
    /*Transmission Code Stubs Here - a:eventType, b:eventData, data:mappedData*/
    }
  };
  try{utag.o[loader].loader.LOAD(id)}catch(e){utag.loader.LOAD(id)}
})('14','telekom.phoenix');
}catch(e){}

/*
**  Tealium Custom Tag Container
**  
**  Add your custom tag in between the start and end tags
**  Add javascript code only, do not add HTML tags directly into this file
**  If you have <script> tags in your tag, you will need to remove them
**  If you need to load an additional Javascript file, make the following function call: utag.libloader("//PATH/TO/YOUR/JS/FILE",function(){})
**    utag.libloader can be called with an optional callback function to trigger after the JS loads: utag.libloader("//PATH/TO/YOUR/JS/FILE",function(){myCallback()})
**
**  Note: Due to asynchronous loading of .js files, the utag.libloader should be used with a callback function if you wish to use the library.
**
**  
*/

/* Start custom tag */
var loader = function(url, callback) {
  var head = document.getElementsByTagName("head")[0] || document.documentElement;
  var node = null;
  //console.log("loader called for: " + url);
  if(/js/.test(url)) {
    node = document.createElement("script");
    node.type = "text/javascript";
    node.async = "async";
    node.src = url;
    node.onload = node.onreadystatechange = function() {
      if(!node.readyState || /loaded|complete/.test(node.readyState)) {
        // handle memory leak in IE
        node.onload = node.onreadystatechange = null;
        if(typeof callback === "function") {
          callback(node);
        }
      }
    }
    head.appendChild(node);
  }
  else if(/(css)/.test(url)) {
    node = document.createElement("link");
    node.type = "text/css";
    node.rel = "stylesheet";
    node.media = "all";
    node.href = url;
    head.appendChild(node);
    var img = document.createElement("img");
    img.onerror = function() { if(typeof callback === "function") { callback(node); } }
    img.src = url;
  }
}

//Helper to deactivate Sidebar and Liveperson Chat in case of the User comes via MSA
//thg (180122)
function setCookie(cname, cvalue, exdays) {
    var d = new Date();
    d.setTime(d.getTime() + (exdays*24*60*60*1000));
    var expires = "expires="+d.toUTCString();
//    document.cookie = cname + "=" + cvalue + "; " + expires + ";path=/";
     document.cookie = "content_consumer_id=msa; " + expires + ";path=/"; 
}

//var query_utag_app = b['qp.utag_app'];
//var query_utag_app = qp.utag_app;

//if (typeof query_utag_app !== 'undefined')
//{
//    setCookie("content_consumer_id", query_utag_app, 30);    
//}    
    
loader("//www.telekom.de/is-bin/INTERSHOP.static/WFS/EKI-TELEKOM-Site/EKI-TELEKOM/de_DE/functions/sidebar-dev/sidebar_min.css", function(){
loader("//www.telekom.de/is-bin/INTERSHOP.static/WFS/EKI-TELEKOM-Site/EKI-TELEKOM/de_DE/functions/sidebar-dev/sidebar_min.js", function(){
  
/*
User Agent Switcher
*/
if(navigator.userAgent.match(/(iPhone|iPod|iPad|blackberry|android|Kindle|htc|lg|midp|mmp|mobile|nokia|opera mini|palm|pocket|psp|sgh|smartphone|symbian|treo mini|Playstation Portable|SonyEricsson|Samsung|MobileExplorer|PalmSource|Benq|Windows Phone|Windows Mobile|IEMobile|Windows CE|Nintendo Wii)/i))
{
      var telekomSidebarConfig = {
        name: 'stacked-pk-slide-production',
        features: ['chat', 'community', 'shopfinder', 'contact'],  //community entfernt
	theme: 'stacked-pk-slide',
	portal: '',
	mobile: true, 
	debug: true,
        verbose: true,
	disableAdvancedTracking: true,
	position: ['50%', 10, 'translateY(50%)']
      };
}
else  
{
       var telekomSidebarConfig = {
        name: 'pk',
        features: ['contact', 'shopfinder', 'community', 'chat'], //community entfernt
	theme: 'stacked-pk',
	portal: '',
	mobile: false,
	debug: true,
        verbose: true,
	disableAdvancedTracking: true,
	position: [120, 10],
	 le2: true
      };
}; 

  
if (typeof query_utag_app === 'undefined')
{
window.Sidebar.start(telekomSidebarConfig);
}
  
  
//window.Sidebar.start(telekomSidebarConfig);


});
});
/* End custom tag */

//end tealium universal tag
//~~tv:20010.20130205
