﻿var tgc=new Object();

function tgcVar(){
	var dCurrent=new Date();
	tgc.tgcdat=dCurrent.getTime();
	tgc.tgcsip=window.location.hostname;
	tgc.tgcuri=window.location.pathname;
	if (window.location.search){
		tgc.tgcqry=window.location.search;
	}
	if ((window.document.referrer!="")&&(window.document.referrer!="-")){
		if (!(navigator.appName=="Microsoft Internet Explorer"&&parseInt(navigator.appVersion)<4)){
			tgc.tgcref=window.document.referrer;
		}
	}
	
	if (window.tgcuri)
		tgc.tgcuri = tgcuri;
	if (window.tgcqry)
		tgc.tgcqry = tgcqry;
}

function tgcA(N,V){
	return "&"+N+"="+tgcEscape(V);
}

function tgcEscape(S){
	if (typeof(RE)!="undefined"){
		var retStr = new String(S);
		for (R in RE){
			retStr = retStr.replace(RE[R],R);
		}
		return retStr;
	}
	else{
		return escape(S);
	}
}

function tgcTag(){
	//var P='http'+(window.location.protocol.indexOf('https:')==0?'s':'')+'://localhost/scripts/t2.aspx?';
	//var P = (window.tgcdomain ? window.tgcdomain : '') + '/scripts/t2.aspx?';
	var P = 'http://wwwa.thegolfchannel.com/scripts/t2.aspx?';
	for (N in tgc){
		if (tgc[N]) {
			P+=tgcA(N,tgc[N]);
		}	
	}
	if (P.length>2048&&navigator.userAgent.indexOf('MSIE')>=0){
		P=P.substring(0,2040)+'&WT.tu=1';
	}

	//write call
	document.write('<script language="Javascript" src="' + P + '"></script>');
}

tgcVar();
tgcTag();
