
// vid
var logArr = new Array();
// Try to figure out the time zone offset.
var thisDate = new Date();
var thisTZo = thisDate.getTimezoneOffset();
var thisTZm = Math.abs(thisTZo % 60);
var thisTZh = (thisTZo - thisTZm) / 60;
var thisTZ = new Array();
if(thisTZo < 0)
	thisTZ[thisTZ.length] = " +";
else
	thisTZ[thisTZ.length] = " -";
if(Math.abs(thisTZh) < 10)
	thisTZ[thisTZ.length] = "0";
thisTZ[thisTZ.length] = thisTZh;
if(Math.abs(thisTZm) < 10)
	thisTZ[thisTZ.length] = "0";
thisTZ[thisTZ.length] = thisTZm;

// client ip
logArr[0] = "unknown";
// current time
logArr[1] = thisDate.getMonth() + "/" + thisDate.getDate() + "/" + thisDate.getFullYear() + ":" + thisDate.getHours() + ":" + thisDate.getMinutes() + ":" + thisDate.getSeconds() + thisTZ.join("");

// just in case we need to create a new vid value
var vidval = encode64(logArr.join(" "));


// vid
var vid = GetCookie("VID");
if (vid == null) {
	var expiresNever = Date(2020, 12, 31);
	SetCookie("VID", vidval, expiresNever, "/", ".crosswalk.com");
	vid = GetCookie("VID");
	if (vid == null) vid = 0;
}


currentHost = document.location.hostname; 

if(currentHost.indexOf('crosswalk.com') != -1) { 
        hostElementsArray = currentHost.split("."); 
        channel = hostElementsArray[0]; 
		if(currentHost == 'crosswalk.com')
			channel = 'www';
} else { 

		// quick default
		channel = 'www';
        if(currentHost == 'www.trip.com') 
                channel = 'travel'; 
        if(currentHost == 'crosswalk.oneplace.com') 
                channel = 'broadcasts'; 
		if(currentHost == 'www.biblestudytools.net') 
                channel = 'bible';
} 

if(!document.referrer) { 
        qs = ""; 
} else { 
        qs = "?" + escape(document.referrer); 
} 

document.write('<img src="http://' + channel + '.track.crosswalk.com/' + qs + '" width="1" height="1">');
