//Deployment Toolkit - liveManager.js v2.1.20090915, Copyright 2009 Tealium.com Inc. All Rights Reserved.
if(typeof(cdc)=="undefined")cdc=new Object();
if(typeof(cdc.util)=="undefined")cdc.util=new Object();
cdc.util.ensureNamespace=function(namespaceStr){
    if(!namespaceStr)return;
    var parts = namespaceStr.split(".");
    var o=window;
    for(var i=0;i<parts.length;i++){
        var aPart=parts[i];
        if(typeof(o[aPart])!="object"){
            o[aPart]=new Object();
        }
        o=o[aPart];
    }
}

cdc.util.ensureNamespace("cdc.ut.liveManager");
cdc.util.ensureNamespace("cdc.ut.trackEvent");

cdc.ut.liveManager={q:{},l:[],f:{},p:0,o:0,ol:0,i:new Image(),A:function(a,b,c,d){if(a.c)this.l.push(a);b=document;if(b.createElement){c="Lm_"+a.a;if(!b.getElementById(c)){try{eval(a.e)}catch(e){};
d=b.createElement('script');d.language='javascript';d.type='text/javascript';d.src=a.b;d.id=c;b.getElementsByTagName("head")[0].appendChild(d)}}},LOAD:function(a,b,c,d){
this.f[a]=0;c=this.l.length;for(b=this.p;b<c;b++){d=this.l[b];if(this.f[d.a]==0){this.f[d.a]=++this.p;try{eval(d.d);}catch(e){}}else return;}if(this.p==c&&this.o==0)this.o=1},
EV:function(a,b,c,d){if(a.addEventListener){a.addEventListener(b,c,false)}else if(a.attachEvent){a.attachEvent(((d==1)?"":"on")+b,c)}}}

cdc.ut.liveManager.config={
    domain:".cisco.com",
    dop_sensor:"//www.cisco.com/web/fw/tools/mktg_metrics/flashtag.txt?Log=1",
    passthru:true,
    sc_acct:"cisco-us",
    sc_test:false,
    sc_testaccount:"cisco-dev",
    send:{dop:true,s_code:true},
    dev_domain:["ecmx-wip","ecmx-staging","ecmx-active","wwwin-tools-stage","cco-rtp-1","dev-stage","tools-stage","wwwin-tools-dev","preview","cco-stage","ecmx-wip-stage"]
}

cdc.ut.liveManager.lh=location.hostname;
cdc.ut.liveManager.pre="//www.cisco.com";

for(cdc.ut.liveManager.i=0;cdc.ut.liveManager.i<cdc.ut.liveManager.config["dev_domain"].length;cdc.ut.liveManager.i++){
    if(cdc.ut.liveManager.lh.indexOf(cdc.ut.liveManager.config["dev_domain"][cdc.ut.liveManager.i])==0){
        cdc.ut.liveManager.config.dop_sensor="//preview.cisco.com/web/fw/tools/mktg_metrics/flashtag.txt?Log=1";
        cdc.ut.liveManager.pre="";
        break;
    }    
}

cdc.ut.trackEvent={event:function(a,b){cdc.ut.liveManager.q['trackEvent']={a:a,b:b}}};var trackEvent=cdc.ut.trackEvent;
cdc.ut.liveManager.t1=location.hostname+location.pathname;
cdc.ut.liveManager.t2=new Array('www.','ecmx-wip.','ecmx-staging.','ecmx-active.','wwwin-tools-stage.','cco-rtp-1.','dev-stage.','tools-stage.','wwwin-tools-dev.');
for(cdc.ut.liveManager.i=0;cdc.ut.liveManager.i<cdc.ut.liveManager.t2.length;cdc.ut.liveManager.i++)cdc.ut.liveManager.t1=cdc.ut.liveManager.t1.replace(cdc.ut.liveManager.t2[cdc.ut.liveManager.i],'');
if(cdc.ut.liveManager.t1.lastIndexOf('/')==cdc.ut.liveManager.t1.length-1)cdc.ut.liveManager.t1=cdc.ut.liveManager.t1.substring(0,cdc.ut.liveManager.t1.length-1);

cdc.ut.liveManager.t={
    //base variables
    basepage:cdc.ut.liveManager.t1,
    property:"Cisco",
    tag:"ut2.2.20091108.1200",
    title:document.title,
    url:document.URL,
    referrer:eval("document."+"referrer"),
    linktrack:"linkpage",
    elementtype:"page"
};
cdc.ut.liveManager.t["loc"]="http://"+cdc.ut.liveManager.t["basepage"];

//read prev page cookie
cdc.ut.liveManager.RCV=function(a,b,c,d){b=document.cookie;c=b.indexOf(a+"=");d="";if(c>-1){d=b.indexOf(";",c+1);d=(d>0)?d:b.length;d=(d>c)?b.substring(c+a.length+1,d):""}return d};
cdc.ut.liveManager.t["prevpage"]=cdc.ut.liveManager.RCV("s_prev");

//var vs_libloadedflag=1; //used to disable visualsciences.js

//referring_site tracking
if(typeof lm_libloadedflag=="undefined"){
    try{cdc.ut.liveManager.s=location.search.toLowerCase();if(cdc.ut.liveManager.s.indexOf('referring_site=')>0){var a=cdc.ut.liveManager.s.substring(1).split('&'),b={},c,d,e;for(d=0;d<a.length;d++){c=a[d].split("=");b[c[0]]=unescape(c[1])}
    c=cdc.ut.liveManager.config.dop_sensor+"&tag="+cdc.ut.liveManager.t["tag"]+"&vs_basepage="+escape(document.URL)+"&&vs_elementtype=page&vs_event=campaign";d=["referring_site","position","campaign","keyword","creative","country"];
    for(e=0;e<d.length;e++){if(typeof b[d[e]]!="undefined")c+="&"+d[e]+"="+escape(b[d[e]])}cdc.ut.liveManager.i.src=c}}catch(e){}    
}

cdc.ut.liveManager.A({a:"rs_map",b:cdc.ut.liveManager.pre+"/web/fw/tools/mktg_metrics/rs_map.js?v="+cdc.ut.liveManager.t["tag"],c:0});

cdc.ut.liveManager.ONLOAD=function(p){
    if(cdc.ut.liveManager.ol==1)return;
    cdc.ut.liveManager.ol=1;

   cdc.ut.liveManager.A({a:"vs",b:cdc.ut.liveManager.pre+"/web/fw/tools/mktg_metrics/visualsciences_ut.js?v="+cdc.ut.liveManager.t["tag"],c:1});
    cdc.ut.liveManager.A({a:"dop",b:cdc.ut.liveManager.pre+"/web/fw/tools/mktg_metrics/dop.js?v="+cdc.ut.liveManager.t["tag"],c:1,d:"cdc.ut.liveManager.dop.INIT()"});
    if(typeof s_account=="undefined")cdc.ut.liveManager.A({a:"s_code",b:cdc.ut.liveManager.pre+"/web/fw/tools/mktg_metrics/s_code_ut.js?v="+cdc.ut.liveManager.t["tag"],c:1});        
    cdc.ut.liveManager.A({a:"trackEvent",b:cdc.ut.liveManager.pre+"/web/fw/tools/mktg_metrics/trackEvent.js?v="+cdc.ut.liveManager.t["tag"],c:1,d:"cdc.ut.liveManager.PT();cdc.ut.trackEvent.INIT();cdc.ut.trackEvent.event('view',cdc.ut.liveManager.t);sendImpression()"});

    //BazaarVoice Integration Functionality
    ratingsDisplayed=function(totalReviewCount, avgRating, totalRatingOnlyCount, buyAgainPercentage){
      if(totalReviewCount > 0 || totalRatingOnlyCount > 0){
        cdc.ut.trackEvent.event("custom",{bv_event:"bv_ratingdisplayed",bv_reviewcount:totalReviewCount,bv_avgrating:avgRating,bv_rating_only:totalRatingOnlyCount,bv_buyagain:buyAgainPercentage});
      }
    }

    pageChanged=function(pageName, pageStatus){
      cdc.ut.trackEvent.event("custom",{bv_event:"bv_pagechanged",bv_page:pageName,bv_status:pageStatus});
    }
    
}

cdc.ut.liveManager.ONERROR=function(a,b,c){if(cdc.ut.liveManager.erf!=1){cdc.ut.liveManager.error=(typeof a=="string")?(a+"-"+c):"Unknown";cdc.ut.liveManager.erf=1}}
cdc.ut.liveManager.EV(window,"error",cdc.ut.liveManager.ONERROR);

cdc.ut.liveManager.PT=function(a,b,c,d,e,f,g){   
    //meta data
    var ex={description:1,keywords:1,date:1,pubdate:1,pushdate:1,docRequest:1,synonym:1}
    a=document.getElementsByTagName("meta");
    for(b=0;b<a.length;b++){if(a[b].name&&a[b].name!=""&&typeof ex[a[b].name]=="undefined"){cdc.ut.liveManager.t["meta."+a[b].name.toLowerCase()]=a[b].content.toLowerCase()}}
    
    //hinav
    a=document.getElementsByTagName("div");b=[];for(c=0;c<a.length;c++){if(a[c].className=="hinav"){d=a[c].innerHTML;e=d.split("<a");for(f=0;f<e.length;f++){if(e[f].indexOf('class="parent"')>-1)
    b.push(e[f]);else if(e[f].indexOf('class="selected"')>-1)b.push(e[f])}d=[];for(e=0;e<b.length;e++){b[e]=(b[e].split("&amp;")).join("&");b[e]=b[e].toLowerCase();f=b[e].indexOf(">");
    g=b[e].indexOf("<",f);d.push(b[e].substring(f+1,g))}cdc.ut.liveManager.t["hinav"]=d.join("/");break}}
    
    //nav-treecrumb
    if(typeof document.getElementById("nav-treecrumb")!="undefined"){a=document.getElementsByTagName("li");b=[];for(c=0;c<a.length;c++){d=a[c].className;e=a[c].parentNode.id;if(e=="nav-treecrumb"){
    e=a[c].innerHTML;f=e.indexOf('>');g=e.indexOf('<',f);e=e.substring(f+1,g);b.push((e.split("&amp;")).join("&"))}if(d=="crumb-selected")break}cdc.ut.liveManager.t["treecrumb"]=b.join("/")}
    
    //pagelevel variables
    if(typeof track!="undefined"){for(a in track){if(typeof a!="function")cdc.ut.liveManager.t[a]=track[a]}}
    
    e=["meta.iapath","hinav","treecrumb"];for(f=0;f<e.length;e++){if(typeof cdc.ut.liveManager.t[e[f]]!="undefined"){cdc.ut.liveManager.t["sitearea"]=cdc.ut.liveManager.t[e[f]];cdc.ut.liveManager.t["sa_source"]=e[f];break}}
}

cdc.ut.liveManager.RS_MAP=function(a,b){
    if(typeof ut_rs_map!="undefined"){
        a=document.URL;
        for(b in ut_rs_map){
            if(typeof ut_rs_map[b]=="string"){
                if(a.indexOf(b)>-1)return ut_rs_map[b];
            }
        }
    }
    return "";
}

try{$(document).ready(function(){cdc.ut.liveManager.ONLOAD()})}catch(e){cdc.ut.liveManager.EV(window,"load",cdc.ut.liveManager.ONLOAD);setTimeout("cdc.ut.liveManager.ONLOAD",3000);}
var lm_libloadedflag=1;

cdc.ut.liveManager.DB=function(a,i){i=new Image();i.src="//cdn.tealium.com/track.gif?tag=ut2.0&msg="+a}
