//***************** DO NOT EDIT *****************
//This file was automatically generated by 
//./gen.pl espanol.dat espanol.js 
//on Fri Jan  1 06:38:17 2010.

//From : ../vendor/webtrends_public.js ____________
// Version: 8.5.0     
// Tag Builder Version: 2.0.0
// Created: 8/21/2008 4:59:14
// Last modified: 11/30/2009 by parnaudov@technologyleaders.com

function WebTrends(){
  var that=this;
  // begin: user modifiable
  this.dcsid=(window.location.host == "www.raileurope.com")? 
  "dcsx8kr3i00000wszzcluesb5_7x1y" : "dcs3nlnpl100008qhdxdd2eor_4p9c";
  this.domain="statse.webtrendslive.com";
  this.timezone=0;
  this.fpcdom=".raileurope.com";
  this.onsitedoms="";
  this.downloadtypes="xls,doc,pdf,txt,csv,zip";
  this.trackevents=true;
  this.enabled=true;
  this.i18n=false;
  this.fpc="WT_FPC";
  // end: user modifiable
  this.DCS={};
  this.WT={};
  this.DCSext={};
  this.images=[];
  this.index=0;
  this.exre=(function(){return(window.RegExp?new RegExp("dcs(uri)|(ref)|(aut)|(met)|(sta)|(sip)|(pro)|(byt)|(dat)|(p3p)|(cfg)|(redirect)|(cip)","i"):"");})();
  this.re=(function(){return(window.RegExp?(that.i18n?{"%25":/\%/g}:{"%09":/\t/g,"%20":/ /g,"%23":/\#/g,"%26":/\&/g,"%2B":/\+/g,"%3F":/\?/g,"%5C":/\\/g,"%22":/\"/g,"%7F":/\x7F/g,"%A0":/\xA0/g}):"");})();
  this.WT.sp="www.raileurope.com";
  this.TechTag = new TechLead();
}
WebTrends.prototype.dcsGetId=function(){
  if (this.enabled&&(document.cookie.indexOf(this.fpc+"=")==-1)&&(document.cookie.indexOf("WTLOPTOUT=")==-1)){
  document.write("<scr"+"ipt type='text/javascript' src='"+"http"+(window.location.protocol.indexOf('https:')==0?'s':'')+"://"+this.domain+"/"+this.dcsid+"/wtid.js"+"'><\/scr"+"ipt>");
  }
}
WebTrends.prototype.dcsGetCookie=function(name){
  var cookies=document.cookie.split("; ");
  var cmatch=[];
  var idx=0;
  var i=0;
  var namelen=name.length;
  var clen=cookies.length;
  for (i=0;i<clen;i++){
  var c=cookies[i];
  if ((c.substring(0,namelen+1))==(name+"=")){
	cmatch[idx++]=c;
  }
  }
  var cmatchCount=cmatch.length;
  if (cmatchCount>0){
  idx=0;
  if ((cmatchCount>1)&&(name==this.fpc)){
	var dLatest=new Date(0);
	for (i=0;i<cmatchCount;i++){
	var lv=parseInt(this.dcsGetCrumb(cmatch[i],"lv"));
	var dLst=new Date(lv);
	if (dLst>dLatest){
	  dLatest.setTime(dLst.getTime());
	  idx=i;
	}
	}
  }
  return unescape(cmatch[idx].substring(namelen+1));
  }
  else{
  return null;
  }
}
WebTrends.prototype.dcsGetCrumb=function(cval,crumb,sep){
  var aCookie=cval.split(sep||":");
  for (var i=0;i<aCookie.length;i++){
  var aCrumb=aCookie[i].split("=");
  if (crumb==aCrumb[0]){
	return aCrumb[1];
  }
  }
  return null;
}
WebTrends.prototype.dcsGetIdCrumb=function(cval,crumb){
  var id=cval.substring(0,cval.indexOf(":lv="));
  var aCrumb=id.split("=");
  for (var i=0;i<aCrumb.length;i++){
  if (crumb==aCrumb[0]){
	return aCrumb[1];
  }
  }
  return null;
}
WebTrends.prototype.dcsIsFpcSet=function(name,id,lv,ss){
  var c=this.dcsGetCookie(name);
  if (c){
  return ((id==this.dcsGetIdCrumb(c,"id"))&&(lv==this.dcsGetCrumb(c,"lv"))&&(ss==this.dcsGetCrumb(c,"ss")))?0:3;
  }
  return 2;
}
WebTrends.prototype.dcsFPC=function(){
  if (document.cookie.indexOf("WTLOPTOUT=")!=-1){
  return;
  }
  var WT=this.WT;
  var name=this.fpc;
  var dCur=new Date();
  var adj=(dCur.getTimezoneOffset()*60000)+(this.timezone*3600000);
  dCur.setTime(dCur.getTime()+adj);
  var dExp=new Date(dCur.getTime()+315360000000);
  var dSes=new Date(dCur.getTime());
  WT.co_f=WT.vt_sid=WT.vt_f=WT.vt_f_a=WT.vt_f_s=WT.vt_f_d=WT.vt_f_tlh=WT.vt_f_tlv="";
  if (document.cookie.indexOf(name+"=")==-1){
  if ((typeof(gWtId)!="undefined")&&(gWtId!="")){
	WT.co_f=gWtId;
  }
  else if ((typeof(gTempWtId)!="undefined")&&(gTempWtId!="")){
	WT.co_f=gTempWtId;
	WT.vt_f="1";
  }
  else{
	WT.co_f="2";
	var curt=dCur.getTime().toString();
	for (var i=2;i<=(32-curt.length);i++){
	WT.co_f+=Math.floor(Math.random()*16.0).toString(16);
	}
	WT.co_f+=curt;
	WT.vt_f="1";
  }
  if (typeof(gWtAccountRollup)=="undefined"){
	WT.vt_f_a="1";
  }
  WT.vt_f_s=WT.vt_f_d="1";
  WT.vt_f_tlh=WT.vt_f_tlv="0";
  }
  else{
  var c=this.dcsGetCookie(name);
  var id=this.dcsGetIdCrumb(c,"id");
  var lv=parseInt(this.dcsGetCrumb(c,"lv"));
  var ss=parseInt(this.dcsGetCrumb(c,"ss"));
  if ((id==null)||(id=="null")||isNaN(lv)||isNaN(ss)){
	return;
  }
  WT.co_f=id;
  var dLst=new Date(lv);
  WT.vt_f_tlh=Math.floor((dLst.getTime()-adj)/1000);
  dSes.setTime(ss);
  if ((dCur.getTime()>(dLst.getTime()+1800000))||(dCur.getTime()>(dSes.getTime()+28800000))){
	WT.vt_f_tlv=Math.floor((dSes.getTime()-adj)/1000);
	dSes.setTime(dCur.getTime());
	WT.vt_f_s="1";
  }
  if ((dCur.getDay()!=dLst.getDay())||(dCur.getMonth()!=dLst.getMonth())||(dCur.getYear()!=dLst.getYear())){
	WT.vt_f_d="1";
  }
  }
  WT.co_f=escape(WT.co_f);
  WT.vt_sid=WT.co_f+"."+(dSes.getTime()-adj);
  var expiry="; expires="+dExp.toGMTString();
  var cur=dCur.getTime().toString();
  var ses=dSes.getTime().toString();
  document.cookie=name+"="+"id="+WT.co_f+":lv="+cur+":ss="+ses+expiry+"; path=/"+(((this.fpcdom!=""))?("; domain="+this.fpcdom):(""));
  var rc=this.dcsIsFpcSet(name,WT.co_f,cur,ses);
  if (rc!=0){
  WT.co_f=WT.vt_sid=WT.vt_f_s=WT.vt_f_d=WT.vt_f_tlh=WT.vt_f_tlv="";
  WT.vt_f=WT.vt_f_a=rc;
  }
}
WebTrends.prototype.dcsIsOnsite=function(host){
  if (host.length>0){
	host=host.toLowerCase();
	if (host==window.location.hostname.toLowerCase()){
	return true;
	}
	if (typeof(this.onsitedoms.test)=="function"){
	return this.onsitedoms.test(host);
	}
	else if (this.onsitedoms.length>0){
	var doms=this.dcsSplit(this.onsitedoms);
	var len=doms.length;
	for (var i=0;i<len;i++){
	  if (host==doms[i]){
		return true;
	  }
	}
	}
  }
  return false;
}
WebTrends.prototype.dcsTypeMatch=function(pth, typelist){
  var type=pth.substring(pth.lastIndexOf(".")+1,pth.length);
  var types=this.dcsSplit(typelist);
  var tlen=types.length;  
  for (var i=0;i<tlen;i++){
  if (type==types[i]){
	return true;
  }
  }
  return false;
}
WebTrends.prototype.dcsEvt=function(evt,tag){
  var e=evt.target||evt.srcElement;
  while (e.tagName&&(e.tagName!=tag)){
  e=e.parentElement||e.parentNode;
  }
  return e;
}
WebTrends.prototype.dcsNavigation=function(evt){
  return "";
}
WebTrends.prototype.dcsBind=function(event,func){
  if ((typeof(func)=="function")&&document.body){
  if (document.body.addEventListener){
	document.body.addEventListener(event, func.wtbind(this), true);
  }
  else if(document.body.attachEvent){
	document.body.attachEvent("on"+event, func.wtbind(this));
  }
  }
}
WebTrends.prototype.dcsET=function(){
  var e=(navigator.appVersion.indexOf("MSIE")!=-1)?"click":"mousedown";
  this.dcsBind(e,this.dcsDownload);
  this.dcsBind(e,this.dcsOffsite);
}
WebTrends.prototype.dcsMultiTrack=function(){
  var args=dcsMultiTrack.arguments?dcsMultiTrack.arguments:arguments;
  if (args.length%2==0){
  for (var i=0;i<args.length;i+=2){
	if (args[i].indexOf('WT.')==0){
	this.WT[args[i].substring(3)]=args[i+1];
	}
	else if (args[i].indexOf('DCS.')==0){
	this.DCS[args[i].substring(4)]=args[i+1];
	}
	else if (args[i].indexOf('DCSext.')==0){
	this.DCSext[args[i].substring(7)]=args[i+1];
	}
  }
  var dCurrent=new Date();
  this.DCS.dcsdat=dCurrent.getTime();
  this.dcsFunc(this.dcsFPC());
  this.dcsTag();
  }
}
WebTrends.prototype.dcsSplit=function(list){
  var items=list.toLowerCase().split(",");
  var len=items.length;
  for (var i=0;i<len;i++){
  items[i]=items[i].replace(/^\s*/,"").replace(/\s*$/,"");
  }
  return items;
}
// Code section for Track clicks to download links.
WebTrends.prototype.dcsDownload=function(evt){
  evt=evt||(window.event||"");
  if (evt&&((typeof(evt.which)!="number")||(evt.which==1))){
  var e=this.dcsEvt(evt,"A");
  if (e.href){
	var hn=e.hostname?(e.hostname.split(":")[0]):"";
	if (this.dcsIsOnsite(hn)&&this.dcsTypeMatch(e.pathname,this.downloadtypes)){
	  var qry=e.search?e.search.substring(e.search.indexOf("?")+1,e.search.length):"";
	  var pth=e.pathname?((e.pathname.indexOf("/")!=0)?"/"+e.pathname:e.pathname):"/";
	  var ttl="";
	  var text=document.all?e.innerText:e.text;
	  var img=this.dcsEvt(evt,"IMG");
	  if (img.alt){
		ttl=img.alt;
	  }
	  else if (text){
		ttl=text;
	  }
	  else if (e.innerHTML){
		ttl=e.innerHTML;
	  }
	  this.dcsMultiTrack("DCS.dcssip",hn,"DCS.dcsuri",pth,"DCS.dcsqry",e.search||"","WT.ti","Download:"+ttl,"WT.dl","20","WT.nv",this.dcsNavigation(evt));
	  this.DCS.dcssip=this.DCS.dcsuri=this.DCS.dcsqry=this.WT.ti=this.WT.dl=this.WT.nv="";
	}
  }
  }
}
// Code section for Track clicks to links leading offsite.
WebTrends.prototype.dcsOffsite=function(evt){
  evt=evt||(window.event||"");
  if (evt&&((typeof(evt.which)!="number")||(evt.which==1))){
  var e=this.dcsEvt(evt,"A");
  if (e.href){
	var hn=e.hostname?(e.hostname.split(":")[0]):"";
	var pr=e.protocol||"";
	if ((hn.length>0)&&(pr.indexOf("http")==0)&&!this.dcsIsOnsite(hn)){
	  var qry=e.search?e.search.substring(e.search.indexOf("?")+1,e.search.length):"";
	  var pth=e.pathname?((e.pathname.indexOf("/")!=0)?"/"+e.pathname:e.pathname):"/";
	  var trim=true;
	  this.dcsMultiTrack("DCS.dcssip",hn,"DCS.dcsuri",pth,"DCS.dcsqry",trim?"":qry,"WT.ti","Offsite:"+hn+pth+qry,"WT.dl","24","WT.nv",this.dcsNavigation(evt));
	  this.DCS.dcssip=this.DCS.dcsuri=this.DCS.dcsqry=this.WT.ti=this.WT.dl=this.WT.nv="";
	}
  }
  }
}

WebTrends.prototype.dcsAdv=function(){
  if (this.trackevents&&(typeof(this.dcsET)=="function")){
  if (window.addEventListener){
	window.addEventListener("load",this.dcsET.wtbind(this),false);
  }
  else if (window.attachEvent){
	window.attachEvent("onload",this.dcsET.wtbind(this));
  }
  }
  this.dcsFunc(this.dcsFPC());
}
WebTrends.prototype.dcsVar=function(){
  var dCurrent=new Date();
  var WT=this.WT;
  var DCS=this.DCS;
  WT.tz=parseInt(dCurrent.getTimezoneOffset()/60*-1)||"0";
  WT.bh=dCurrent.getHours()||"0";
  WT.ul=navigator.appName=="Netscape"?navigator.language:navigator.userLanguage;
  if (typeof(screen)=="object"){
  WT.cd=navigator.appName=="Netscape"?screen.pixelDepth:screen.colorDepth;
  WT.sr=screen.width+"x"+screen.height;
  }
  if (typeof(navigator.javaEnabled())=="boolean"){
  WT.jo=navigator.javaEnabled()?"Yes":"No";
  }
  if (document.title){
  if (window.RegExp){
	var tire=new RegExp("^"+window.location.protocol+"//"+window.location.hostname+"\\s-\\s");
	WT.ti=document.title.replace(tire,"");
  }
  else{
	WT.ti=document.title;
  }
  }
  WT.js="Yes";
  WT.jv=(function(){
  var agt=navigator.userAgent.toLowerCase();
  var major=parseInt(navigator.appVersion);
  var mac=(agt.indexOf("mac")!=-1);
  var ff=(agt.indexOf("firefox")!=-1);
  var ff0=(agt.indexOf("firefox/0.")!=-1);
  var ff10=(agt.indexOf("firefox/1.0")!=-1);
  var ff15=(agt.indexOf("firefox/1.5")!=-1);
  var ff20=(agt.indexOf("firefox/2.0")!=-1);
  var ff3up=(ff&&!ff0&&!ff10&!ff15&!ff20);
  var nn=(!ff&&(agt.indexOf("mozilla")!=-1)&&(agt.indexOf("compatible")==-1));
  var nn4=(nn&&(major==4));
  var nn6up=(nn&&(major>=5));
  var ie=((agt.indexOf("msie")!=-1)&&(agt.indexOf("opera")==-1));
  var ie4=(ie&&(major==4)&&(agt.indexOf("msie 4")!=-1));
  var ie5up=(ie&&!ie4);
  var op=(agt.indexOf("opera")!=-1);
  var op5=(agt.indexOf("opera 5")!=-1||agt.indexOf("opera/5")!=-1);
  var op6=(agt.indexOf("opera 6")!=-1||agt.indexOf("opera/6")!=-1);
  var op7up=(op&&!op5&&!op6);
  var jv="1.1";
  if (ff3up){
	jv="1.8";
  }
  else if (ff20){
	jv="1.7";
  }
  else if (ff15){
	jv="1.6";
  }
  else if (ff0||ff10||nn6up||op7up){
	jv="1.5";
  }
  else if ((mac&&ie5up)||op6){
	jv="1.4";
  }
  else if (ie5up||nn4||op5){
	jv="1.3";
  }
  else if (ie4){
	jv="1.2";
  }
  return jv;
  })();
  WT.ct="unknown";
  if (document.body&&document.body.addBehavior){
  try{
	document.body.addBehavior("#default#clientCaps");
	WT.ct=document.body.connectionType||"unknown";
	document.body.addBehavior("#default#homePage");
	WT.hp=document.body.isHomePage(location.href)?"1":"0";
  }
  catch(e){
  }
  }
  if (document.all){
  WT.bs=document.body?document.body.offsetWidth+"x"+document.body.offsetHeight:"unknown";
  }
  else{
  WT.bs=window.innerWidth+"x"+window.innerHeight;
  }
  WT.fv=(function(){
  var i,flash;
  if (window.ActiveXObject){
	for(i=10;i>0;i--){
	try{
	  flash=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i);
	  return i+".0";
	}
	catch(e){
	}
	}
  }
  else if (navigator.plugins&&navigator.plugins.length){
	for (i=0;i<navigator.plugins.length;i++){
	if (navigator.plugins[i].name.indexOf('Shockwave Flash')!=-1){
	  return navigator.plugins[i].description.split(" ")[2];
	}
	}
  }
  return "Not enabled";
  })();
  WT.slv=(function(){
  var slv="Not enabled";
  try{     
	if (navigator.userAgent.indexOf('MSIE')!=-1){
	var sli = new ActiveXObject('AgControl.AgControl');
	if (sli){
	  slv="Unknown";
	}
	}
	else if (navigator.plugins["Silverlight Plug-In"]){
	slv="Unknown";
	}
  }
  catch(e){
  }
  if (slv!="Not enabled"){
	var i,j,v;
	if ((typeof(Silverlight)=="object")&&(typeof(Silverlight.isInstalled)=="function")){
	for (j=9;j>=0;j--){
	  for(i=3;i>0;i--){
	  v=i+"."+j;
	  if (Silverlight.isInstalled(v)){
		slv=v;
		break;
	  }
	  }
	  if (slv==v){
	  break;
	  }
	}
	}
  }
  return slv;
  })();
  if (this.i18n){
  if (typeof(document.defaultCharset)=="string"){
	WT.le=document.defaultCharset;
  } 
  else if (typeof(document.characterSet)=="string"){
	WT.le=document.characterSet;
  }
  else{
	WT.le="unknown";
  }
  }
  WT.tv="8.5.0";
//  WT.sp="@@SPLITVALUE@@";
  WT.dl="0";
  WT.ssl=(window.location.protocol.indexOf('https:')==0)?"1":"0";
  DCS.dcsdat=dCurrent.getTime();
  DCS.dcssip=window.location.hostname;
  DCS.dcsuri=window.location.pathname;
  WT.es=DCS.dcssip+DCS.dcsuri;
  if (window.location.search){
  DCS.dcsqry=window.location.search;
  }
  if ((window.document.referrer!="")&&(window.document.referrer!="-")){
  if (!(navigator.appName=="Microsoft Internet Explorer"&&parseInt(navigator.appVersion)<4)){
	DCS.dcsref=window.document.referrer;
  }
  }
}
WebTrends.prototype.dcsEscape=function(S, REL){
  if (REL!=""){
  S=S.toString();
  for (var R in REL){
	if (REL[R] instanceof RegExp){
	S=S.replace(REL[R],R);
	}
  }
  return S;
  }
  else{
  return escape(S);
  }
}
WebTrends.prototype.dcsA=function(N,V){
  if (this.i18n&&(this.exre!="")&&!this.exre.test(N)){
  if (N=="dcsqry"){
	var newV="";
	var params=V.substring(1).split("&");
	for (var i=0;i<params.length;i++){
	var pair=params[i];
	var pos=pair.indexOf("=");
	if (pos!=-1){
	  var key=pair.substring(0,pos);
	  var val=pair.substring(pos+1);
	  if (i!=0){
	  newV+="&";
	  }
	  newV+=key+"="+this.dcsEncode(val);
	}
	}
	V=V.substring(0,1)+newV;
  }
  else{
	V=this.dcsEncode(V);
  }
  }
  return "&"+N+"="+this.dcsEscape(V, this.re);
}
WebTrends.prototype.dcsEncode=function(S){
  return (typeof(encodeURIComponent)=="function")?encodeURIComponent(S):escape(S);
}
WebTrends.prototype.dcsCreateImage=function(dcsSrc){
  if (document.images){
  this.images[this.index]=new Image();
  this.images[this.index].src=dcsSrc;
  this.index++;
  }
  else{
  document.write('<IMG ALT="" BORDER="0" NAME="DCSIMG" WIDTH="1" HEIGHT="1" SRC="'+dcsSrc+'">');
  }
}
WebTrends.prototype.dcsMeta=function(){
  var elems;
  if (document.all){
  elems=document.all.tags("meta");
  }
  else if (document.documentElement){
  elems=document.getElementsByTagName("meta");
  }
  if (typeof(elems)!="undefined"){
  var length=elems.length;
  for (var i=0;i<length;i++){
	var name=elems.item(i).name;
	var content=elems.item(i).content;
	var equiv=elems.item(i).httpEquiv;
	if (name.length>0){
	if (name.indexOf("WT.")==0){
	  this.WT[name.substring(3)]=content;
	}
	else if (name.indexOf("DCSext.")==0){
	  this.DCSext[name.substring(7)]=content;
	}
	else if (name.indexOf("DCS.")==0){
	  this.DCS[name.substring(4)]=content;
	}
	}
  }
  }
}
WebTrends.prototype.dcsTag=function(){
  if (document.cookie.indexOf("WTLOPTOUT=")!=-1){
  return;
  }
  var WT=this.WT;
  var DCS=this.DCS;
  var DCSext=this.DCSext;
  var i18n=this.i18n;
  var P="http"+(window.location.protocol.indexOf('https:')==0?'s':'')+"://"+this.domain+(this.dcsid==""?'':'/'+this.dcsid)+"/dcs.gif?";
  if (i18n){
  WT.dep="";
  }
  for (var N in DCS){
  if (DCS[N]&&(typeof DCS[N]!="function")){
	P+=this.dcsA(N,DCS[N]);
  }
  }
  var keys=["co_f","vt_sid","vt_f_tlv"];
  for (var i=0;i<keys.length;i++){
  var key=keys[i];
  if (WT[key]){
	P+=this.dcsA("WT."+key,WT[key]);
	delete WT[key];
  }
  }
  for (N in WT){
  if (WT[N]&&(typeof WT[N]!="function")){
	P+=this.dcsA("WT."+N,WT[N]);
  }
  }
  for (N in DCSext){
  if (DCSext[N]&&(typeof DCSext[N]!="function")){
	if (i18n){
	WT.dep=(WT.dep.length==0)?N:(WT.dep+";"+N);
	}
	P+=this.dcsA(N,DCSext[N]);
  }
  }
  if (i18n&&(WT.dep.length>0)){
  P+=this.dcsA("WT.dep",WT.dep);
  }
  if (P.length>2048&&navigator.userAgent.indexOf('MSIE')>=0){
  P=P.substring(0,2040)+"&WT.tu=1";
  }
  this.dcsCreateImage(P);
  this.WT.ad="";
}
WebTrends.prototype.dcsFunc=function(func){
  if (typeof(func)=="function"){
  func();
  }
}
WebTrends.prototype.dcsDebug=function(){
  var t=this;
  var i=t.images[0].src;
  var q=i.indexOf("?");
  var r=i.substring(0,q).split("/");
  var m="<b>Protocol</b><br><code>"+r[0]+"<br></code>";
  m+="<b>Domain</b><br><code>"+r[2]+"<br></code>";
  m+="<b>Path</b><br><code>/"+r[3]+"/"+r[4]+"<br></code>";
  m+="<b>Query Params</b><code>"+i.substring(q+1).replace(/\&/g,"<br>")+"</code>";
  m+="<br><b>Cookies</b><br><code>"+document.cookie.replace(/\;/g,"<br>")+"</code>";
  if (t.w&&!t.w.closed){
  t.w.close();
  }
  t.w=window.open("","dcsDebug","width=500,height=650,scrollbars=yes,resizable=yes");
  t.w.document.write(m);
  t.w.focus();
}
WebTrends.prototype.dcsCollect=function(){
  if (this.enabled){
	this.dcsVar();
	this.dcsMeta();
	this.dcsFunc(this.dcsAdv());
	// TL functions
	this.TechTag.customTL();
	this.dcsTag();
	adDir();
  }
}

function dcsMultiTrack(){
  if (typeof(_tag)!="undefined"){
  return(_tag.dcsMultiTrack());
  }
}

Function.prototype.wtbind = function(obj){
  var method=this;
  var temp=function(){
  return method.apply(obj,arguments);
  };
  return temp;
}
// -- Technology Leaders Custom functions - Scott, Plamen
// -- must be called after dcsVar and before dcsTag
// -- includes JSON2 code, toFixed() Date method for rounding
// -- and all the custom Rail Europe Code In addition to the above
// -- Webtrends Code
// -- Last Updated 10/27/2009 - Scott at Technology Leaders

// -- JSON code from http://www.json.org/json2.js to pack and unpack our
// -- visitor history data from the cookie

// Create a JSON object only if one does not already exist. We create the
// methods in a closure to avoid creating global variables.

if (!this.JSON) {
  this.JSON = {};
}

(function () {

  function f(n) {
	// Format integers to have at least two digits.
	return n < 10 ? '0' + n : n;
  }

  if (typeof Date.prototype.toJSON !== 'function') {

	Date.prototype.toJSON = function (key) {

	  return isFinite(this.valueOf()) ?
		   this.getUTCFullYear()   + '-' +
		 f(this.getUTCMonth() + 1) + '-' +
		 f(this.getUTCDate())      + 'T' +
		 f(this.getUTCHours())     + ':' +
		 f(this.getUTCMinutes())   + ':' +
		 f(this.getUTCSeconds())   + 'Z' : null;
	};

	String.prototype.toJSON =
	Number.prototype.toJSON =
	Boolean.prototype.toJSON = function (key) {
	  return this.valueOf();
	};
  }

  var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
	escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
	gap,
	indent,
	meta = {    // table of character substitutions
	  '\b': '\\b',
	  '\t': '\\t',
	  '\n': '\\n',
	  '\f': '\\f',
	  '\r': '\\r',
	  '"' : '\\"',
	  '\\': '\\\\'
	},
	rep;


  function quote(string) {

	escapable.lastIndex = 0;
	return escapable.test(string) ?
	  '"' + string.replace(escapable, function (a) {
		var c = meta[a];
		return typeof c === 'string' ? c :
		  '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
	  }) + '"' :
	  '"' + string + '"';
  }


  function str(key, holder) {

// Produce a string from holder[key].

	var i,          // The loop counter.
	  k,          // The member key.
	  v,          // The member value.
	  length,
	  mind = gap,
	  partial,
	  value = holder[key];

// If the value has a toJSON method, call it to obtain a replacement value.

	if (value && typeof value === 'object' &&
		typeof value.toJSON === 'function') {
	  value = value.toJSON(key);
	}

// If we were called with a replacer function, then call the replacer to
// obtain a replacement value.

	if (typeof rep === 'function') {
	  value = rep.call(holder, key, value);
	}

// What happens next depends on the value's type.

	switch (typeof value) {
	case 'string':
	  return quote(value);

	case 'number':


	  return isFinite(value) ? String(value) : 'null';

	case 'boolean':
	case 'null':


	  return String(value);


	case 'object':

// Due to a specification blunder in ECMAScript, typeof null is 'object',
// so watch out for that case.

	  if (!value) {
		return 'null';
	  }


	  gap += indent;
	  partial = [];


	  if (Object.prototype.toString.apply(value) === '[object Array]') {



		length = value.length;
		for (i = 0; i < length; i += 1) {
		  partial[i] = str(i, value) || 'null';
		}



		v = partial.length === 0 ? '[]' :
		  gap ? '[\n' + gap +
			  partial.join(',\n' + gap) + '\n' +
				mind + ']' :
			  '[' + partial.join(',') + ']';
		gap = mind;
		return v;
	  }


	  if (rep && typeof rep === 'object') {
		length = rep.length;
		for (i = 0; i < length; i += 1) {
		  k = rep[i];
		  if (typeof k === 'string') {
			v = str(k, value);
			if (v) {
			  partial.push(quote(k) + (gap ? ': ' : ':') + v);
			}
		  }
		}
	  } else {


		for (k in value) {
		  if (Object.hasOwnProperty.call(value, k)) {
			v = str(k, value);
			if (v) {
			  partial.push(quote(k) + (gap ? ': ' : ':') + v);
			}
		  }
		}
	  }


	  v = partial.length === 0 ? '{}' :
		gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' +
			mind + '}' : '{' + partial.join(',') + '}';
	  gap = mind;
	  return v;
	}
  }

// If the JSON object does not yet have a stringify method, give it one.

  if (typeof JSON.stringify !== 'function') {
	JSON.stringify = function (value, replacer, space) {

	  var i;
	  gap = '';
	  indent = '';



	  if (typeof space === 'number') {
		for (i = 0; i < space; i += 1) {
		  indent += ' ';
		}


	  } else if (typeof space === 'string') {
		indent = space;
	  }


	  rep = replacer;
	  if (replacer && typeof replacer !== 'function' &&
		  (typeof replacer !== 'object' ||
		   typeof replacer.length !== 'number')) {
		throw new Error('JSON.stringify');
	  }


	  return str('', {'': value});
	};
  }


// If the JSON object does not yet have a parse method, give it one.

  if (typeof JSON.parse !== 'function') {
	JSON.parse = function (text, reviver) {

// The parse method takes a text and an optional reviver function, and returns
// a JavaScript value if the text is a valid JSON text.

	  var j;

	  function walk(holder, key) {


		var k, v, value = holder[key];
		if (value && typeof value === 'object') {
		  for (k in value) {
			if (Object.hasOwnProperty.call(value, k)) {
			  v = walk(value, k);
			  if (v !== undefined) {
				value[k] = v;
			  } else {
				delete value[k];
			  }
			}
		  }
		}
		return reviver.call(holder, key, value);
	  }

	  cx.lastIndex = 0;
	  if (cx.test(text)) {
		text = text.replace(cx, function (a) {
		  return '\\u' +
			('0000' + a.charCodeAt(0).toString(16)).slice(-4);
		});
	  }


	  if (/^[\],:{}\s]*$/.
test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@').
replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {

		j = eval('(' + text + ')');

		return typeof reviver === 'function' ?
		  walk({'': j}, '') : j;
	  }

// If the text is not JSON parseable, then a SyntaxError is thrown.

	  throw new SyntaxError('JSON.parse');
	};
  }
}());



Date.prototype.getWeek = function() {
  var onejan = new Date(this.getFullYear(),0,1);
  return Math.ceil((((this - onejan) / 86400000) + onejan.getDay()+1)/7);
} 

function TechLead(){
  var that=this;
  this.vCookie = "TLVC";
  this.z_vt_d = "";
  this.z_vt_w = "";
  this.z_vt_m = "";
  this.z_vt_e = ""
  this.z_vt_o = "";
  this.z_cs = "";
  this.atp = 0;
  this.pext = 0.00;
  this.timezone = 0;
  this.upd_c = false;
  this.vHist = { "hdelete":false,
		"cmpn":{},
		"invoices":new Array()
		};
  this.camp = { "tm":0,
		 "nm":0
	   }
  this.dCur=new Date();
  this.adj=(this.dCur.getTimezoneOffset()*60000)+(this.timezone*3600000);
  this.dCur.setTime(this.dCur.getTime()+this.adj);

}
// Read visitor history cookie and load our object for later use
TechLead.prototype.loadVisitorHistory = function() {

  var upd_c = false;
  // process sales and load them into this.pext
  this.handleSales();

  if(_tag.dcsGetCookie(this.vCookie) && (_tag.dcsGetCookie(this.vCookie) != "undefined")) {
  this.vHist = JSON.parse(_tag.dcsGetCookie(this.vCookie));
  } 
  // Check to see if this should be reset from a purchase in a previous visit
  // or if we need to add to attribution because of single visit w/ multiple purchases
  // Check to see if we get deleted and check we are not another purchase in  same visit
  // This should be called after this.packCampaignID

  // If first hit of the visit and we had a purchase last visit, then clear the 
  // cookie
  if(this.vHist.hdelete && _tag.WT.vt_f_s == 1) {
  this.vHist.cmpn = {};
  this.vHist.invoices = new Array();
  this.hdelete = false;
  upd_c = true;
  } 

  // Add campaign to visitorhistory if present
  //try in WT object first

   if(typeof _tag.WT.mc_id != "undefined") {
  this.addCamp(_tag.WT.mc_id,this.dCur.getTime());
  upd_c = true;
  }

  // add campaigns from query string
  if(this.getParam("WT.mc_id",_tag.DCS.dcsqry)) {
  this.addCamp(this.getParam("WT.mc_id",_tag.DCS.dcsqry),this.dCur.getTime());
  upd_c = true;
  }

  // Add our correlated attributions
   if((typeof this.vHist.cmpn != "undefined") && !this.isEmpty(this.vHist.cmpn)) {
  this.cmpnAttr();
  upd_c = true;
  }


  // Check for output of daily/weekly/monthly visitors

  if((typeof _tag.WT.tx_s != "undefined") && 
	(typeof _tag.WT.tx_u != "undefined")) {
  this.vHist.hdelete = true;
  }

  if(upd_c) {
  this.writeVHist();
  }

  return;
}
TechLead.prototype.isEmpty= function(o) {

  for(var p in o) {
  if (o[p] != o.constructor.prototype[p])
	return false;
  }
  return true;
}

// Get total attribution points
TechLead.prototype.getAtp = function() {
  var cnt = 0;
  for(i in  this.vHist.cmpn) {
	cnt += this.vHist.cmpn[i].nm;
  }
  return cnt;
}
// attribute daily, weekly and monthly visitor to campaigns
TechLead.prototype.cmpnAttr = function() {
  var c = new Date();
  var d = "0";
  var w = "0";
  var m = "0";
  var outp = 0;
  var o = "0";
  var e = "0";
  var sendst = false;

  this.atp=this.getAtp(); // count up total shares

  for(var i in this.vHist.cmpn) {

  // first time we've seen this campaign
  if(this.vHist.cmpn[i].tm == 0) {
	d = w = m = "1";
	outp = 1;       
	this.vHist.cmpn[i].tm = this.dCur.getTime();
  } else {
	c.setTime(this.vHist.cmpn[i].tm);
	if(this.dCur.getDay() != c.getDay()) {
	d = "1";
	outp = 1;
	}
	if(this.dCur.getWeek() != c.getWeek()) {
	w = "1";
	outp = 1;
	}
	if(this.dCur.getMonth() != c.getMonth()) {
	m = "1";
	outp = 1;
	}
  }
  // If we changed anything or had an order, output our campaigns
  if (outp == 1 || typeof _tag.WT.tx_s != "undefined") {
	this.vHist.cmpn[i].tm = this.dCur.getTime();
	if(this.pext > 0.00) {
	  o = (this.vHist.cmpn[i].nm/this.atp).toFixed(2);
	  e = (this.pext*(this.vHist.cmpn[i].nm/this.atp)).toFixed(2);
	}
	sendst = true;
	outp = 0;
	this.addCampParam(i,d,w,m,o,e);
  }

  } // end each campaign
  if (typeof _tag.WT.tx_i != "undefined" && _tag.WT.tx_i) {
	  if (typeof this.vHist.invoices != "undefined" && this.vHist.invoices) {
	  for (var s in this.vHist.invoices) 
		if (this.vHist.invoices[s]==_tag.WT.tx_i) return;
	  this.vHist.invoices.push(_tag.WT.tx_i);
	}
	else {
	this.vHist.invoices = new Array();
		this.vHist.invoices.push(_tag.WT.tx_i);
	}
  }

  // Now send the whole string them up in the WT object if there was anything so send
  if(sendst) {
  _tag.WT["z_cs"] = this.z_cs;
  _tag.WT["z_vt_d"] = this.z_vt_d;
  _tag.WT["z_vt_w"] = this.z_vt_w;
  _tag.WT["z_vt_m"] = this.z_vt_m;
  _tag.WT["z_vt_o"] = this.z_vt_o;
  _tag.WT["z_vt_e"] = this.z_vt_e;
  }
  return;
}

TechLead.prototype.toFixed=function(x) {
  var temp=this;
  temp=Math.round(temp*Math.pow(10,x))/Math.pow(10,x);
  return temp;
}
TechLead.prototype.addCampParam = function(s,d,w,m,o,e) {
  this.z_cs = this.z_cs?(this.z_cs+";"+s):s;
  this.z_vt_d = this.z_vt_d?(this.z_vt_d+";"+d):d;
  this.z_vt_w = this.z_vt_w?(this.z_vt_w+";"+w):w;
  this.z_vt_m = this.z_vt_m?(this.z_vt_m+";"+m):m;
  this.z_vt_o = this.z_vt_o?(this.z_vt_o+";"+o):o;
  this.z_vt_e = this.z_vt_e?(this.z_vt_e+";"+e):e;  
}

TechLead.prototype.addCamp = function(s,tm) {
  // Add each campaign into our array
  var myCamps = s.split(";");
  for(var x = 0;x < myCamps.length;x++) {
	// if new set the time
	if(typeof this.vHist.cmpn[myCamps[x]] == "undefined") {
	  this.vHist.cmpn[myCamps[x]] = this.camp;        
	}
	this.vHist.cmpn[myCamps[x]].nm++;
  }
}

// Write our visitor history cookie after we have done what is needed
TechLead.prototype.writeVHist = function() {
  this.writevHistCookie(this.vCookie,JSON.stringify(this.vHist),1);
}

TechLead.prototype.getParam = function(name, source) {  
  //returns an arbitrary query paramter's value
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");  
  var regexS = "[\\?&]"+name+"=([^&#]*)";  
  var regex = new RegExp( regexS );  
  var results = regex.exec(source); 

  if( results == null )    
	return "";  
  else    
	return results[1];
}

TechLead.prototype.isSearchEngine = function (uri_stem) { 
  //detects search engine. if recognized,
  //returns its search phrase query parameter

  knownSE=[["yahoo","p"],["msn","q"],["bing","q"],["aol","query"],
  ["aol","encquery"],["lycos","query"],["ask","q"],["altavista","q"],
  ["netscape","query"],["cnn","query"],["looksmart","qt"],["about","terms"],
  ["mamma","query"],["alltheweb","q"],["gigablast","q"],["voila","rdata"],
  ["virgilio","qs"],["live","q"],["baidu","wd"],["alice","qs"],["yandex","text"],
  ["najdi","q"],["aol","q"],["club-internet","query"],["mama","query"],["seznam","q"],
  ["search","q"],["wp","szukaj"],["onet","qt"],["netsprint","q"],["google.interia","q"],
  ["szukacz","q"],["yam","k"],["pchome","q"],["kvasir","searchExpr"],["sesam","q"],["ozu","q"],
  ["terra","query"],["nostrum","query"],["mynet","q"],["ekolay","q"],
  ["search.ilse","search_for"]];

  for ( i=0; i < knownSE.length;i++) {
	if (uri_stem.indexOf(knownSE[i][0]) != -1)
  result = this.getParam(knownSE[i][1], _tag.DCS.dcsref);
	  else 
  result = "";

	if (result) return result; 
  //complete match only if both se and its parameters
  //have been recognized
  }
  return result;
}

TechLead.prototype.prepID = function (campID) {
//translates campaign type, reformats, appends landing url
  campID = campID.replace(/cpc$/, "Paid Search");
  campID = campID.replace(/aff$/, "Affiliates");
  campID = campID.replace(/eml$/, "Email Marketing");
  campID = campID.replace(/dsp$/, "Display Advertising");
//translate non-standard campaign types
  campID = campID.replace(/email$/, "Email Marketing");
  campID = campID.replace(/affiliates$/, "Affiliates");
  campID = campID.replace(/display$/, "Display Advertising");
  campID = campID.replace(/microsite$/, "Microsite");
//change separator to something safer
  campID = campID.replace(/\.|$/g, "_x_");    
  if (typeof _tag.DCS.dcsuri != "undefined")
  campID += _tag.DCS.dcsuri;  //append landing url
  else
  campID += "None"; //this shouldn't happen

   return campID;
}

TechLead.prototype.packCampaignID = function () {
// -- appends landing url to existing campaign ID
// -- if absent, spoofs organic and referring sites campaigns
// -- must be called after dcsVar and before dcsTag
var campID = "";
var campIDt = "";
var campIDq = "";
var results = "";
var result = "";

//try in WT object first
  if (typeof _tag.WT.mc_id != "undefined") 
	campIDt = _tag.WT.mc_id; 
//try in query string
	campIDq = this.getParam ("WT.mc_id", _tag.DCS.dcsqry); 

  // If we don't have an mc_id in either source
  // begin spoof of organic and referring sites campaigns

  if(!campIDt && !campIDq) { 
  if (typeof _tag.DCS.dcsref != "undefined") {

  //referrer found
  var regex = new RegExp ("\/\/([^\/:?#]+)");
  //extract host from URL
  results = regex.exec(_tag.DCS.dcsref);
  if (!results) return;

  //first check if IP 
  var regex = new RegExp ("^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)$");
  result = regex.exec(results[1]);
  if (result) var isIP=results[1];

  var regex = new RegExp ("^([^.]+\.[a-z]{3})$");
  result = regex.exec(results[1]);
  if (result) results[1]='www.'+results[1];

  //do nothing if referrer is internal (self) or on-site
  if (this.fpcdom && results[1].indexOf(this.fpcdom) != -1) return;
  if (this.onsitedoms && this.onsitedoms.indexOf(results[1]) != -1) return;
  if (results[1].indexOf(window.location.hostname) != -1) return;

  //check if search engine
  result = this.isSearchEngine(results[1]);
  //strip prefix & suffixes
  hostn = results[1].replace(/^[^\.]+\.|\.[^\.]+$|\.[^\.]+\.[^\.]+$/g, ""); 
  //capitalize, store as company name
  if (isIP) campID = "Unknown Domain_x_";
  else
  campID = hostn.charAt(0).toUpperCase()+hostn.substr(1)+"_x_";

  //add search phrase to id with spaces instead of +
  if (result)
  campID += result.replace(/\+/g, " ")+"_x_Organic Search_x_";
  else { //add referrer url without query string
	var regex = new RegExp ("(^[^?#]+)");
	results = regex.exec(_tag.DCS.dcsref);
	campID += results[1]+"_x_Referring Sites_x_";
  }

  if (typeof _tag.DCS.dcsuri != "undefined")
  campID += _tag.DCS.dcsuri+"_x_end"; //append landing url
  else
  campID += "None_x_end"; //this shouldn't happen

  //add the spoofed campaign ID to WT object
	_tag.WT.mc_id = _tag.dcsEncode(campID);
  }
  else { } //no referrer--assume it's direct traffic  
  } 
  // -- If we have an mc_id, append landing url and overwrite it
  // -- Overwrites mc_id's in query and WT object independently
  // -- also append typed phrase if found in referrer
  else {

	if (typeof _tag.DCS.dcsref != "undefined") {
  //referrer found, look for phrase
  var regex = new RegExp ("\/\/([^\/:]+)");
	results = regex.exec(_tag.DCS.dcsref); //extract host
	 result = this.isSearchEngine(results[1]); //check if SE
	}   
  if (campIDt) {
  campIDt = this.prepID(campIDt);
	if (result) //add search phrase with spaces instead of +
	 campIDt += "_x_" + result.replace(/\+/g, " ");
  else
	 campIDt += "_x_None";  
  //overwrite mc_id in WT object
	_tag.WT.mc_id = _tag.dcsEncode(campIDt);
  }
  if (campIDq) {
  campIDq = this.prepID(campIDq);
	if (result) //add search phrase with spaces instead of +
	 campIDq += "_x_" + result.replace(/\+/g, " ");
  else
	 campIDq += "_x_None";
  //overwrite mc_id in query string
  _tag.DCS.dcsqry = _tag.DCS.dcsqry.replace(/WT\.mc_id=[^&#]*/g, "WT.mc_id="+campIDq);
  }

  }
  //social media site check
  if (_tag.WT.mc_id && _tag.WT.mc_id.indexOf('Referring%20Sites')!=-1) this.checkSM();
}
TechLead.prototype.checkSM = function() {
//checks if referrer is social media
sm = "360.yahoo.com,adjix.com,adultfriendfinder.com,advogato.org,affluence.org,amiestreet.com,aniboom.com,anobii.com,asmallworld.net,athlinks.com,atom.com,avatarsunited.com,b23.ru,badoo.com,bahu.com,balatarin.com,bebo.com,bgvip.tv,biip.no,bit.ly,blackplanet.com,blinkx.com,blip.tv,blogcn.com,blogger.com,bloglines.com,blogtv.com,bluekaffee.com,break.com,broadcaster.com,budurl.com,buzznet.com,cafemom.com,cakefinancial.com,canurl.com,care2.com,citeulike.org,classmates.com,cli.gs,cloob.com,collegetonight.com,connotea.org,couchsurfing.com,cozycot.com,crackle.com,cynapse.comproductscynin ,dailymotion.com,decenturl.com,delicious.com,delivr.com,desimartini.com,deviantart.com,diary-x.com,digg.com,diigo.com,dol2day.com,dolop.com,dontstayin.com,dwarfurl.com,easyurl.net,elftown.com,elfurl.com,engagemedia.org ,eons.com,epernicus.com,espin.com,experienceproject.com,facebook.com,faceparty.com,faces.com,famecast.com,faves.com,favorites.live.com,fetlife.com,ff.im,filmaffinity.com,fire.to,flickr.com,flixster.com,flq.us,fotolog.com,freak.to,friendsreunited.co.uk,friendster.com,fruehstueckstreff.org,fubar.com,furl.net,fuseurl.com,g02.me,gaiaonline.com,gather.com,gawkk.com,geni.com,givealink.org,go2.me,gofishcorp.com,goodreads.com,gossipreport.com,grono.net,habbo.com,helium.com,hexurl.com,hi.baidu.com,hi5.com,home.spaces.live.com,hospitalityclub.org,http:twitter.com,https:oneview.v2020-sai.com,https:researchgate.net,hyves.nl,ibm.comlotusconnections,idek.net,ign.com,imeem.com,indabamusic.com,internations.org,ipernity.com,irc-galleria.net,is.gd,italki.com,itsmy.com,iwiw.hu,ix.lt,iyouit.eu,jaiku.com,jammerdirect.com,kaixin001.com,kewego.com,kissa.be,kl.am,korta.nu,krunchd.com,last.fm,librarything.com,lifechat.net,lifeknot.com,lifelogger.com,linkedin.com,linkwad.com,livejournal.com,liveleak.com,livemocha.com,ln-s.net,loopt.us,lunarstorm.se,ma.gnolia.com,meetin.org,meettheboss.com,meetup.com,memurl.com,metacafe.com,miklos.dk,minixr.com,mister-wong.com,mixi.jp,mixx.com,mocospace.com,mog.com,moourl.com,msdn.microsoft.com,multiply.com,muxlim.com,my.opera.com,myanimelist.net,mychurch.org,myheritage.com,mylol.net,myspace.com,myspace.com ,myurl.in,myvideo.co.za,mywebsearch.com,myyearbook.com,nanoref.com,nasza-klasa.pl,netlog.com,nettby.no,newsvine.com,nexopia.com,nofrag.com,notlong.com,odnoklassniki.ru,okcupid.com,omgpop.com,opendiary.com,orkut.com,ourmedia.org,outeverywhere.com,ow.ly,pajamasmedia.com,pandora.tv,passportstamp.com,photobucket.com,phpmotion.com,ping.fm,pingsta.com,piurl.com,plaxo.com,playahead.se,playboyu.com,plurk.com,poprl.com,pownce.com,propeller.com,qicute.com,qik.com,quarterlife.com,quickblog.com,qurlyq.com,radio.userland.com,ravelry.com,rayzz.net,reallytinyurl.com,reddit.com,redirx.com,reeltime.com,reunion.com,reverbnation.com,rubyurl.com,rurl.org,rutube.ru,ryze.com,sandbox.com,scienceblogs.com,scispace.net,sendables.jibjab.com,sevenload.com,share.ovi.com,shelfari.com,shorl.com,short.ie,shorterlink.com,shortlinks.co.uk,shorturl.com,shout.to,shrinkurl.us,shurl.net,shw.me,simpy.com,simurl.com,sitebar.org,skyrock.com,smallr.com,snipr.com,snipurl.com,snurl.com,soapbox.msn.com,socialvibe.com,sonico.com,soundpedia.com,spike.com,spoke.com,stage6.com,starturl.com,stickam.com,studivz.net,stumbleupon.com,stumpedia.com,surl.co.uk,sync2it.com,tagged.com,talkbiznow.com,taltopia.com,tangle.com,technet.microsoft.com,tighturl.com,tinylink.com,tinypic.com,tinyurl.com,tinyvh.com,tr.im,traceurl.com,travbuddy.com,travellerspoint.com,tribe.net,trombi.com,trooptube.tv,truveo.com,tudou.com,tuenti.com,tv.oneworld.net,twi.bz,twine.com,twitter.com,twurl.nl,typepad.com,u.mavrev.com,ucoz.com,ur1.ca,url.ie,url9.com,urlcut.com,urlhawk.com,urli.ca,urlpass.com,url-press.com,urlx.ie,vampirefreaks.com,vbox7.com,veoh.com,viadeo.com,video.google.com,video.yahoo.com,videos.sapo.pt,vidoosh.tv,vimeo.com,vision.rambler.ru,vkontakte.ru,vox.com,vuze.com,wasabi.com,wayn.com,webbiographies.com,westhost.com,wis.dm,wiserearth.org,wordpress.com,wretch.cc,www2.mkade.com,xaddr.com,xanga.com,xiaonei.com,xing.com,xrl.us,xt3.com,yammer.com,yelp.com,yep.it,youku.com,youmeo.com,youtube.com,yuarel.com,yweb.com,ziffdavis.com,zurl.ws";

  sm=sm.split(",");
  for (i=0;i<sm.length;i++)
	if (_tag.DCS.dcsref.indexOf(sm[i])!=-1) 
	_tag.WT.mc_id=_tag.WT.mc_id.replace(/Referring%20Sites/, "Social%20Media");

}
// check for eticket tracking and generate parameters
TechLead.prototype.handleSales = function() {

if (typeof _tag.WT.tx_s == "undefined" || 
  typeof _tag.WT.tx_u == "undefined"  ) return;


var price = _tag.WT.tx_s.split(";");
var quant = _tag.WT.tx_u.split(";");


  for (i=0;i<price.length;i++){

	this.pext += parseFloat(price[i]);
  }

}
// check for eticket tracking and generate parameters
TechLead.prototype.handleEticket = function() {

if (typeof _tag.WT.tx_s != "undefined" && _tag.WT.tx_s) _tag.WT.z_tx_s = _tag.WT.tx_s;

if (typeof _tag.WT.tx_s == "undefined" || 
  typeof _tag.WT.tx_u == "undefined" ||
  typeof _tag.WT.z_pst == "undefined" ) return;

var pst = _tag.WT.z_pst.split(";");
var price = _tag.WT.tx_s.split(";");
var quant = _tag.WT.tx_u.split(";");
var psp = new Array ();
var psq = new Array ();

  for (i=0;i<pst.length;i++){
	if (pst[i] == "0" || pst[i] == "1") {
	psp[i]=0;
	psq[i]=0;
	}
	if (pst[i] == "2") {
	psp[i]=price[i];
	psq[i]=quant[i];

	}
  }
}
// check for up sell transaction and generate parameters
TechLead.prototype.handleUpsell = function() {

if (typeof _tag.WT.tx_e == "undefined") return;
if (typeof _tag.WT.z_us == "undefined") return;
if(_tag.WT.tx_e == "v") return;

var upf = _tag.WT.z_us.split(";");
var units = _tag.WT.tx_u.split(";");
var nupu = new Array ();
var upu = new Array ();

  if(typeof _tag.WT.tx_e != "undefined") {
  var upv = new Array ();
  var nupv = new Array ();
  var nupf = new Array ();
  var subts = _tag.WT.tx_s.split(";");

  for (i=0;i<upf.length;i++){
	nupf[i] = 1 - upf[i];
  if (upf[i] == "1") {
	 upv[i] = subts[i];
	 upu[i] = units[i];
	 nupv[i] = 0;
	 nupu[i] = 0; 
	}
  else {
	 nupv[i] = subts[i];
	 nupu[i] = units[i];
	 upv[i] = 0;
	 upu[i] = 0;
	}   
  }
  _tag.WT.z_upv = upv.join(";");
  _tag.WT.z_nupf = nupf.join(";");
  _tag.WT.z_nupv = nupv.join(";");
  _tag.WT.z_nupu = nupu.join(";");      

  } //end purchase

  if(_tag.WT.tx_e == "a") {
  for (i=0;i<upf.length;i++){
	if (upf[i] == "1")
	  { upu[i] = units[i]; }
	else
	 { upu[i] = 0; }
	}
  } //end add to cart
  _tag.WT.z_upu = upu.join(";");
   return;
}


// check to see if this is first hit in visit
// call after dcsVar but before dcsTag

TechLead.prototype.bounceCk = function() {
  // check for first page bounce
  if(typeof _tag.WT.vt_f_s == "undefined") {
  _tag.WT.z_bounces = "0";  
  } else if (_tag.WT.vt_f_s == "1" ) {
  _tag.WT.z_bounces = "1";
  } else if (_tag.WT.vt_f_s == "" || _tag.WT.vt_f_s == 0 ) {
  _tag.WT.z_bounces = "0";
  }
  // check for error bounce
  if(typeof _tag.WT.z_serrnm == "undefined") {
  _tag.WT.z_errbounce = "0";
  } else {
  var errs = _tag.WT.z_serrnm.split(";");
  for (var n=0;n<errs.length;n++) errs[n]="1";
  _tag.WT.z_errbounce = errs.join(";"); 
  }

}

// check for tcid cookie and set query parameter if found
TechLead.prototype.cktcid = function() {

  var name="tcid";
  var cookies=document.cookie.split("; ");
  var cmatch=[];
  var idx=0;
  var i=0;
  var namelen=name.length;
  var clen=cookies.length;
  for (i=0;i<clen;i++){
  var c=cookies[i];
  if ((c.substring(0,namelen+1))==(name+"=")){
	cmatch[idx++]=c;
  }
  }
  var cmatchCount=cmatch.length;
  if (cmatchCount>0){
  idx=0;
  _tag.WT.z_tcid = unescape(cmatch[idx].substring(namelen+1));
  }
  else{
  return null;
  }
}
TechLead.prototype.writeCookie = function(name, value, years) {
  var expire = "";
  if(years != null)
  {
  expire = new Date((new Date()).getTime() + years * 315360000000);
  expire = "; expires=" + expire.toGMTString();
  }
  document.cookie = name + "=" + escape(value) + expire +";path=/;domain="+_tag.fpcdom;
}

TechLead.prototype.writevHistCookie = function(name, value, years) {
  var expire = "";
  if(years != null)
  {
  expire = new Date((new Date()).getTime() + years * 315360000000);
  expire = "; expires=" + expire.toGMTString();
  }
  document.cookie = name + "=" + value + expire +";path=/;domain="+_tag.fpcdom;
}
TechLead.prototype.handleAgent = function() {
  if (typeof _tag.WT.z_agent != 'undefined' && _tag.WT.z_agent==1)
	this.writeCookie('AGNT', '1', 20);
  if (_tag.dcsGetCookie('AGNT')) _tag.WT.z_agent=1;
}

//main function set - call before dcsTag
TechLead.prototype.customTL = function() {

  this.bounceCk(); 
  this.packCampaignID();
  this.handleUpsell();
  this.handleEticket();
  this.handleAgent();
  this.cktcid();
  this.loadVisitorHistory();
}

//end TL Customs

// WebTrends Ad Director
// Copyright (c) 1996-2007 WebTrends Inc. All rights reserved.
// $DateTime: 2007/01/31 12:23:58 $

// First party cookie implementation for use on a site using WebTrends Analytics JS Tag
// configured to use commerce parameters wt.pn_sku, wt.tx_s, wt.tx_u, and wt.tx_i.
// Apply this javascript to all page on the site (will work on just landing pages).
// Change @@CUSTID@@ in the last line to reflect the correct account number.

// Integrated by parnaudov@technologyleaders.com

function DcsDynS(cid){
  // private members
  var cname="WT_DSAI";
  var wt=(typeof(_tag.WT)=="object")?_tag.WT:{};

  // private methods
  function setAdInfo(){
	var value=getQueryParam("cshift_ck");
	if (value.length>0){
	  var cur=new Date();
	  var exp=new Date(cur.getTime()+315360000000);
	  document.cookie=cname+"="+value+"; expires="+exp.toGMTString()+"; path=/";
	}
  }
  function getQueryParam(key){
	var qry=window.location.search.substring(1);
	if (qry.length>0){
	  var params=qry.split("&");
	  var count=params.length;
	  for (var i=0;i<count;i++){
		var p=params[i].split("=");
		if (p[0]==key){
		  return p[1];
		}
	  }
	}
	return "";
  }

  // privileged methods
  this.getClientId=function(){
	return cid;
  };
  this.getProductInfo=function(){
	var info="";
	try{
	  var id=wt.pn_sku.split(";");
	  var price=wt.tx_s.split(";");
	  var qty=wt.tx_u.split(";");
	  for (var i=0;i<id.length;i++){
		info+=(i?",":"")+id[i]+"#"+parseInt((parseFloat(price[i])*100)/parseInt(qty[i]))+"*"+qty[i];
	  }
	}
	catch(e){
	}
	return info;
  };
  this.getOrderInfo=function(){
	return wt.tx_i||"";
  };
  this.getIsNew=function(){
	return 1;
  };
  this.getAdInfo=function(){
	return _tag.dcsGetCookie(cname)||"";
  };
  this.getAttribution=function(){
	return "";
  };
  this.isConvPage=function(){
	return ((typeof(wt)=="object")&&(wt.tx_e=="p"))?true:false;
  };

  // read query parameter, set cookie
  setAdInfo();
}


// Ad Director calls to be inserted after dcsTag

function adDir() {

// maintain cookie
   var dcsDS=new DcsDynS(5165);
// credit purchase
  if (dcsDS.isConvPage()){

function _f2void() { return; }

function f2convert(cid, pids)
{
  try
  {   
	var img = new Image(1,1);
  var src = "//rd.clickshift.com/convert.gif?cid=" + escape(cid);
  try {
	if (location.protocol == 'file:') {
	src = "http:" + src;
	}
  } catch (ex) { }

  src += "&pids=" + escape(pids);

	// conversion_id is optional third parameter
	if (f2convert.arguments.length > 2) {
	  var conversion_id = f2convert.arguments[2];
	  src += "&conversion_id=" + (conversion_id ? escape(conversion_id) : '');
	}
	if (f2convert.arguments.length > 3) {
	  if (f2convert.arguments[3]) {
		src += "&pof=1";
	  }
	}
	if (f2convert.arguments.length > 4) {
	var cs_data = f2convert.arguments[4];
	  src += "&cshift_ck=" + (cs_data ? escape(cs_data) : '');
	}
	if (f2convert.arguments.length > 5) {
	var attribution = f2convert.arguments[5];
	  src += "&attribution=" + (attribution ? escape(attribution) : '');
	}

  img.onload = function () { _f2void(); }
  img.src = src;

  } catch (ex) {}

  return true;
}
  f2convert(dcsDS.getClientId(),dcsDS.getProductInfo(),dcsDS.getOrderInfo(),dcsDS.getIsNew(),dcsDS.getAdInfo());
  }
}

//end Ad Director code
