//<!--  -->
// 03/28/05 added passing of external variable 'PageID' in '&i='
// 03/30/05 added '.do' and '.aspx' to list of page "terminators" to make .do pages track as exitlinks

//  03/03/07 change code to read Account= from variable like PageID instead of hardcoded.  Set the Variable in 
//				the include_bot routine based on lcase(Sites.Site).  That will allow this routine to be generic and not
//  			be maintained for each account.
//  03/08/07 change to call version r2 of clicks, which is the MySQL version with changes in the ClickCount table
//  11/18/08 added window width to screen resolution - j=

// a=account (australiatraveldestinations, gaytraveldestinations, etc.)
// b=page title from <title>xxxx</title>
// c=mytoken, random integer used to link between page server and form server (webservices) since session cookies can't
// d=GMT time stamp ie: 'Wed, 7 Mar 2007 18:35:27 UTC' - not currently being passed and probably not of much value
// e=refering URL
// f=this URL (document.location)
// g=language ie: en, en-us, en-gb
// h=java enabled Y/N
// i=TrackPageID set by calling asp page, PromoID used for 'Also Viewed' logic
// j=screen resolution ie: 800x600, 1280x800
// k=color depth ie:16 or 32
// l=cookies allowed? true, null or false
// el=exit link (if this page was left, where did they go?)

// var BU='http://www.globaltraveltech.com/gtt/clicks.asp?a=' + a;
var BU='http://www.globaltraveltech.com/gtt/clicks_r2.asp?a=' + a;

//var BU='http://localhost/gtt/clicks.asp?a=localhost';

var _ud="undefined";
var IT="";
var olt=false;
var img=new Image();
var na=(navigator.appName=="Netscape");

var mytoken=Math.floor(Math.random()*9999999999); // 10 bytes

//var mytoken = new Date().getTime();
//var mybot = new Date(2004,0,0).getTime();	// "Beginning of time" subtracted from today to get a smaller number
//mytoken = eval(mytoken - mybot);
BU+="&c="+escape(mytoken);

// alert(mytoken)
// alert (BU);

//if(typeof ACTION!=_ud)
//  {
//  IT+="&x="+escape(ACTION);
//  ACTION='';
//  }
//  else 
var ACTION='';
// if(typeof AMOUNT!=_ud)
//  {
//  IT+="&xa="+escape(AMOUNT);
//  AMOUNT='';
//  }
//  else 
var AMOUNT='';
// if(typeof MEMBERID!=_ud)BU+="&m="+escape(MEMBERID);

if(typeof PageID!=_ud)BU+="&i="+escape(PageID);

// if(typeof DOCUMENTNAME!=_ud)

// BU+="&b="+escape(DOCUMENTNAME);
// else 
 if(document.title.length>0) BU+="&b="+escape(document.title); // add page title

var itDate=new Date();
// IT+="&d="+escape(itDate.toGMTString());
// IT+="&n="+escape(parseInt(itDate.getTimezoneOffset()/60));

var ecl='';if(typeof EXCL!=_ud)ecl=EXCL;

function gcpn(x){var z=location.search;var i=z.indexOf("?"+x+"=");var j=z.indexOf("&"+x+"=");if((i==0)||(j>-1)){var k=(i==0)?0:j;var l=z.indexOf('&',k+1);return z.substring(k+2+x.length,(l>-1)?l:z.length);}return '';}function getFileName(x){return (x.substring(x.lastIndexOf("/")+1,x.length));}

function gh(x) 						// finds the host name ie: www.host.com returns 'host'
{
 var i=x.host.indexOf(":");
return (i>=0)?x.host.substring(0,i):x.host;
}

function gpr(x){var y=x.protocol;var i=y.indexOf(":");return (i>=0)?y:y+":";}
function gp(x){var y=x.pathname;var i=y.indexOf("/");return (i==0)?y:"/"+y;}

function mxDmnRGXP(v)
{
 return new RegExp(mxRgXpStr(v),"i");
}

function mxR(e,_x,_y,_z){i=0;while(e.indexOf(_x)>=0){i++;e=e.replace(_y,_z);if(i>50)break;}return e;}function mxRgXpStr(e){e=mxR(e," "," ","");e=mxR(e,"\*\.","\\*\\.","\*");e=mxR(e,",\*",",\\*","|");e=mxR(e,"*","*","");e=mxR(e,",",",","|^");e=mxR(e,".","\\.",";");e=mxR(e,";",";","\\.");return e;}

function exitLink(x)
{

 if(gh(location)==gh(x))return true;
 var pt =(typeof DOMAINS!=_ud)?mxDmnRGXP(DOMAINS):mxDmnRGXP(gh(location));
 a=(ACTION=='')?"":"&x="+escape(ACTION);
 xa=(AMOUNT=='')?"":"&xa="+escape(AMOUNT);
 ln=escape(x.href);
 if(pt.test(gh(x)))return true;
 if(na)setTimeout("img.src=BU+xa+a+'&el='+ln;",1);
 else img.src=BU+xa+a+'&el='+ln;

// alert(BU+xa+a+'&el='+ln);

return true;
}

function oco(x,y)
{
 var i=0;
 var rv=true;
 while(document.links[i]!=x)
 {
  i++;
 }
 if(y.li[i]) rv=y.li[i].oc();					// shift the original onclick back to the returned event
 fn=getFileName(x.pathname); // filename only (default.asp)
 if(fn!="")
 {
  var pt =new RegExp("\..?html?|\.asp|\.cfm|\.jsp|\.cgi|\.php[3-4]?|\.pl|\.taf|\.tml|\.dll|\.vm|\.mv|\.do|\.aspx|jsessionid","i");

// alert (fn+fn.indexOf("."));

  if((!pt.test(fn))&&(fn.indexOf(".")!=-1))
  {

// alert ('after pt.test');

   if(((ecl.length>0)&&(!mxDmnRGXP(ecl).test(x.pathname)))||(ecl.length==0))
   {

// alert ('after ecl');

    a=(ACTION=='')?"":"&x="+escape(ACTION);
    xa=(AMOUNT=='')?"":"&xa="+escape(AMOUNT);
    fn=gpr(x)+"//"+gh(x)+gp(x);

// alert (BU+xa+a+"&fn="+escape(fn));

    if(na) setTimeout("img.src=BU+xa+a+\"&fn=\"+escape(fn);",1); // na=navigator
    else img.src=BU+xa+a+"&fn="+escape(fn);

// alert(BU+xa+a+"&fn="+escape(fn));

   }
  }
  else exitLink(x);
 }
 else exitLink(x);
return rv;
}


function olo()
{
if(olt)ool();
lnks=new Object();
var ln=document.links.length;
lnks.li=new Array(ln);

for (var i=0; i<ln; i++)
{
  var link = document.links[i].href;			// insert a TrackerID token in link
  if (link.indexOf("TrackerID=") !=-1)			// is there a placeholder to replace?
  {					
    var link_array=link.split("TrackerID=");		// split the URL and insert the token
    document.links[i].href = link_array[0] + "TrackerID=" + escape(mytoken) + link_array[1];
  }

 if(document.links[i].onclick)
 {
  lnks.li[i]=document.links[i];				// basically they are "hooking" each link on a page through the onclick method
  lnks.li[i].oc=document.links[i].onclick;		// if an onclick event already is present - what do they do?
 }
 eval("document.links[i].onclick=function(){return oco(this,lnks);}");
 }
}
ns=(navigator.appName.substring(0,9)=="Microsoft");
if(((window.screen)||((new Array()).toSource)||((new Array()).shift&&ns))&&(navigator.userAgent.indexOf('Mac')<0))
{
 if(window.onload)
 {
  ool=window.onload;olt=true;
 }
window.onload=olo;
}

function _e()
 {
 _rf(false);
 return true;
 }
 _rf(true);

function _rf(_d)
 {
 t="";r=document.referrer;
 if((navigator.userAgent.indexOf('Mac')>=0)&&(navigator.userAgent.indexOf('MSIE 4')>=0))
   r=document.referrer;
 else 
   if(_d){window.e=window.onerror;window.onerror=_e;
if(document.location!=top.location){r=top.document.referrer;t=top.location.href;}}
else IT+="&nr=t";window.onerror=window.e;
   if(r.length>0)IT+="&e="+escape(r);
   if(t.length>0)IT+="&t="+escape(t);

BU+="&f="+escape(document.location);
document.cookie="itc=t";
IT+="&g="+escape(na?navigator.language:navigator.userLanguage);	        // language
IT+="&h="+escape((navigator.javaEnabled()?'Y':'N'));					// java enabled Y/N
IT+="&j="+escape(screen.width+'x'+screen.height+'-'+document.documentElement.clientWidth);	// resolution + window.width
IT+="&k="+escape((ns)?screen.colorDepth:screen.pixelDepth);				// colors
IT+="&l="+((document.cookie.indexOf("itc=")>=0)?"-1":"0");			// accept cookies? true/false

if((typeof CAMPAIGN!=_ud)&&(CAMPAIGN!=''))IT+="&cp="+escape(CAMPAIGN);if((typeof CMPPARM!=_ud)&&(CMPPARM!=''))IT+="&cp="+escape(gcpn(CMPPARM));if((typeof PROMO!=_ud)&&(PROMO!=''))IT+="&scp="+escape(PROMO);if((typeof PROMOPARM!=_ud)&&(PROMOPARM!=''))IT+="&scp="+escape(gcpn(PROMOPARM));
img.src=BU+IT;
document.write("<\!--");}
//<!-- End of Code -->