<!--WEBSIDESTORY CODE HBX2.0 (Universal)-->
<!--COPYRIGHT 1997-2005 WEBSIDESTORY,INC. ALL RIGHTS RESERVED. U.S.PATENT No. 6,393,479B1. MORE INFO:http://websidestory.com/privacy-->
var _hbEC=0,_hbE=new Array;function _hbEvent(a,b){b=_hbE[_hbEC++]=new Object();b._N=a;b._C=0;return b;}
var hbx=_hbEvent("pv");hbx.vpc="HBX0200u";hbx.gn="ehg-techtarget.hitbox.com";

//TT functions
//testing display
if (window.location.search.indexOf("wrData=on") != -1) document.cookie="wrData=on; path=/";
if (window.location.search.indexOf("wrData=off") != -1) document.cookie="wrData=off; path=/";


//BEGIN EDITABLE SECTION
function setSrcCookie(name, value, expires, path, domain, secure) {
    document.cookie= name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires.toGMTString() : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}

function getSrcCookie(name) {
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1) {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    } else {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1) {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}
// used for asrc and psrc
function getArgs() {
	var args = new Object();
	var query = window.location.search.substring(1);
	var pairs = query.split("&");
	for(var i = 0; i < pairs.length; i++) {
		var pos = pairs[i].indexOf('=');
		if (pos == -1) continue;
		var argname = pairs[i].substring(0,pos);
		var value = pairs[i].substring(pos+1);
		args[argname] = unescape(value);
	}
	return args;
}

//ASRC
var expIn2Hr = new Date();
expIn2Hr.setTime(expIn2Hr.getTime() + 1000 * 3600 * 2) // dead in 2 Hr

var args = getArgs();
var asrc;
if (args.asrc) {
    asrc = args.asrc;
} else asrc = getSrcCookie("ASRC");


if (!asrc || asrc == "") {
	// check to see if its top 5 (google) or top 5 (non-google)
	// (as of May 2006) search engine referrer and set appropriate ASrc
	// doesn't use code from above as that list isn't limited to top 5, 
	// which would skew stats
  var r = document.referrer;
  if (r.indexOf('google.com\/search') != -1) asrc = 'ORG_OSE_GOOGUS';
  if (r.indexOf('google.co.in\/search') != -1) asrc = 'ORG_OSE_GOOGIN';
  if (r.indexOf('google.ca\/search') != -1) asrc = 'ORG_OSE_GOOGCA';
  if (r.indexOf('google.co.uk\/search') != -1) asrc = 'ORG_OSE_GOOGUK';
  if (r.indexOf('google.com.au\/search') != -1) asrc='ORG_OSE_GOOGAU';
  if (r.indexOf('search.yahoo.com') != -1) asrc = 'ORG_OSE_YAHOO';
  if (r.indexOf('ask.com\/web') != -1) asrc = 'ORG_OSE_ASK';
  if (r.indexOf('dogpile.com') != -1) asrc = 'ORG_OSE_DOGPILE';
  if (r.indexOf('altavista.com') != -1) asrc = 'ORG_OSE_ALTAV';
  if (r.indexOf('search.msn.com') != -1) asrc = 'ORG_OSE_MSN';
} 

var cm1;
if (asrc) {
	var values = asrc.split(/_|-|\|/);
	if (values.length >= 2) {
		cm1 = values[0]+"|"+values[1]+"-"+site_cd+"-";
		if (values.length >= 3)
		    cm1 += values[2];
		cm1 += "-"+tt_pn.replace(/-/g,"_");
		setSrcCookie("ASRC", asrc, expIn2Hr, "/");	   
	}	    
	
}

//CONFIGURATION VARIABLES

if(typeof hbAcct == "undefined") var hbAcct = "MustSpecifyAcct!";

var path = window.location.pathname;
if (typeof tt_mlc == "undefined" ) var tt_mlc = path.substring(0,path.lastIndexOf("/")+1);
if (typeof tt_pn == "undefined" ) var tt_pn = path.substring(path.lastIndexOf("/")+1);

hbx.acct = hbAcct;
hbx.pn = (tt_pn == '') ? 'index.php' : tt_pn; //PAGE NAME(S)
hbx.mlc=tt_mlc;//MULTI-LEVEL CONTENT CATEGORY
hbx.pndef="";//DEFAULT PAGE NAME
hbx.ctdef="";//DEFAULT CONTENT CATEGORY

//OPTIONAL PAGE VARIABLES
//ACTION SETTINGS
hbx.fv="";//FORM VALIDATION MINIMUM ELEMENTS OR SUBMIT FUNCTION NAME
hbx.lt=hbLinkTracking;//LINK TRACKING
hbx.dlf="n";//DOWNLOAD FILTER
hbx.dft="n";//DOWNLOAD FILE NAMING
hbx.elf="n";//EXIT LINK FILTER

//SEGMENTS AND FUNNELS
hbx.seg="";//VISITOR SEGMENTATION
hbx.fnl="";//FUNNELS

//CAMPAIGNS
hbx.cmp="";//CAMPAIGN ID
hbx.cmpn="";//CAMPAIGN ID IN QUERY
hbx.dcmp="";//DYNAMIC CAMPAIGN ID
hbx.dcmpn="";//DYNAMIC CAMPAIGN ID IN QUERY
hbx.dcmpe="";//DYNAMIC CAMPAIGN EXPIRATION
hbx.dcmpre="";//DYNAMIC CAMPAIGN RESPONSE EXPIRATION
hbx.hra="";//RESPONSE ATTRIBUTE
hbx.hqsr="";//RESPONSE ATTRIBUTE IN REFERRAL QUERY
hbx.hqsp="";//RESPONSE ATTRIBUTE IN QUERY
hbx.hlt="";//LEAD TRACKING
hbx.hla="";//LEAD ATTRIBUTE
hbx.gp="";//CAMPAIGN GOAL
hbx.gpn="";//CAMPAIGN GOAL IN QUERY
hbx.hcn="";//CONVERSION ATTRIBUTE
hbx.hcv="";//CONVERSION VALUE
hbx.cp="null";//LEGACY CAMPAIGN
hbx.cpd="";//CAMPAIGN DOMAIN

//CUSTOM VARIABLES
hbx.ci="";//CUSTOMER ID

if(cm1) hbx.hc1=cm1;
else hbx.hc1="";

hbx.hc2="";//CUSTOM 2
hbx.hc3="";//CUSTOM 3
hbx.hc4="";//CUSTOM 4
hbx.hrf="";//CUSTOM REFERRER
hbx.pec="";//ERROR CODES



//INSERT CUSTOM EVENTS

// setting custom event for search
if ( typeof(window['hbx_search_keyword']) != "undefined" ) {
	var sev = _hbEvent("search");
	sev.keywords = hbx_search_keyword;
	if ( typeof(window['hbx_search_results']) != "undefined" ) {
		sev.results = hbx_search_results;
	} else {
		sev.results = "0";
	}
}

//END EDITABLE SECTION


//Keep this code.  Used for testing.
if (document.cookie.indexOf("wrData=on") != -1) {
  if(typeof tt_alert == "undefined") var tt_alert = "";
  tt_alert = "HITBOX DATA \n";
  tt_alert += "account numbers = " + hbx.acct + "\n";  
  tt_alert += "multi-level content (hbx.mlc) = " + hbx.mlc + "\n";
  tt_alert += "pagename (hbx.pn) = " + hbx.pn + "\n";
  tt_alert += "link tracking (hbx.lt) = " + hbx.lt + "\n";
  tt_alert += "arival source (hbx.hc1) = " + hbx.hc1 + "\n";
 if ( typeof(window['hbx_search_keyword']) != "undefined" ) { 
  tt_alert += "search keyword = " + sev.keywords + "\n";
  tt_alert += "search total results = " + sev.results + "\n";
  }
  if (tt_alert != "") window.alert(tt_alert);
}

