/* Derived variables */
sc = function () {
    this.loc = window.location.pathname;
    this.host = window.location.hostname + '';
    if (loc.indexOf(applicationRoot) == 0) {
        loc = loc.substring(applicationRoot.length - 1);
    }
    this.locItems = loc.split('/');
    var bodyId = document.getElementsByTagName('body')[0].id;
    this.pageType = bodyId == "error" ? "errorPage" : "";
    this.videoName = bodyId == "video" ? $(".feature .summary h2").text() : "";
		if (this.locItems[1] === 'photos') {
			this.nav1 = 'Gallery';
		} else if (this.loc == '/') {
			this.nav1 = 'Homepage';
		} else {
	    this.nav1 = $("#mainNav>li.selected>a").text(); // top level nav			
		}
    this.nav2 = $("#mainNav>li.selected li.selected>a").text(); // second level nav    
    // Declare a function to split
    jQuery.query = function() {
      var r = {};
      var params = location.search.replace(/^\?/,'').split('&');
      for( var i = params.length-1;  i >= 0;  i-- ) {
         var p = params[i].split('='), key = p[0];
         if( key ) r[key] = p[1];
      }
      return r;
    };         
    this.searchTerm = $.query()['Phrase'];
    this.searchTerm = this.searchTerm == null ? $.query()['HeaderContentSearchPhrase'] : this.searchTerm; 
    this.searchTerm = this.searchTerm == null ? "" : this.searchTerm;
    var regex = /(\d+)/.exec($("#pager").text());
    this.seachTotal = regex != null ? regex[1] : "";
    
    return this;
}();
/* You may give each page an identifying name, server, and channel on
the next lines. */
s.pageName=sc.loc;
s.server=sc.host;
s.channel=sc.nav1;
s.pageType=sc.pageType;
s.prop1="topgear";
s.prop2="acp";
s.prop3=sc.locItems[0];
s.prop4=sc.locItems.length > 1 ? sc.locItems[1] : "";
s.prop5=sc.locItems.length > 2 ? sc.locItems[2] : "";
s.prop6=sc.searchTerm;
s.prop7=sc.seachTotal;
s.prop10=sc.videoName;
/* Conversion Variables */
s.campaign="";
s.state="";
s.zip="";
s.events="";
s.products="";
s.purchaseID="";
s.eVar1="";
s.eVar2="";
s.eVar3="";
s.eVar4="";
s.eVar5="";

s.hier1 = s.prop1;
if (s.prop2) s.hier1 += '|' + s.prop2;
if (s.prop3) s.hier1 += '|' + s.prop3;
if (s.prop4) s.hier1 += '|' + s.prop4;
if (s.prop5) s.hier1 += '|' + s.prop5;

/************* DO NOT ALTER ANYTHING BELOW THIS LINE ! **************/
var s_code=s.t();if(s_code)document.write(s_code); 