/********************************************************************************/
/* SiteCatalyst code version: H.20.3.                                                                                                          */
/* Copyright 1997-2009 Omniture, Inc. More info available at                                                                      */
/* http://www.omniture.com                                                                                                                       */
/********************************************************************************/

// Setting the page name to the URL - it is all we have at this point
s.pageName = document.title
var TE_pageRe = new RegExp("^(.+) - Tyco Electronics$","ig");
 // check the page name to see if it ends with Tyco Electronics
if (TE_pageRe.test(s.pageName))
{
	// matched, so now replace s_pageName with just the value at the begining
	s.pageName=s.pageName.replace(TE_pageRe, "$1");
}

s.server=""
s.channel=""
s.pageType=""
s.prop1=""
s.prop2=""
s.prop3=""
s.prop4=""
s.prop5=""
/* Conversion Variables */
s.campaign=""
s.state=""
s.zip=""
s.events=""
s.products=""
s.purchaseID=""
s.eVar1=""
s.eVar2=""
s.eVar3=""
s.eVar4=""
s.eVar5=""

/************************** CONFIG SECTION **************************/
/* You may add or alter any code config here. */
s.charSet="UTF-8"
/* Conversion Config */
s.currencyCode="USD"
/* Link Tracking Config */
s.trackDownloadLinks=true
s.trackExternalLinks=true
s.trackInlineStats=true
s.linkDownloadFileTypes="exe,zip,wav,mp3,mov,mpg,avi,wmv,doc,pdf,xls,tar,gz,tif,tiff,tgz"
s.linkLeaveQueryString=false
s.linkTrackVars="None"
s.linkTrackEvents="None"

s.cookieDomainPeriods="2"

/* Used to determine whether user left a particular domain in our control to another domain in our control, 
   for example leaving tycoelectronics.com to go to elotouch.com domain */
var TE_baseHostName = new String(window.location.hostname);
var TE_hostNameArray
/* split the hostname into pieces, want to get the primary domain */
TE_hostNameArray = TE_baseHostName.split(".");

/* walk the hostname right to left and find the index of the first non-suffix part, i.e. not com, or co, etc.  The key is
that all suffixes are three or less characters, so we can stop checking for whether it is a suffix once the length is > than three, 
will collect the  entire name if every part of the hostname is  3 characters long or less*/
var firstIndex = 0;
for( i=TE_hostNameArray.length-1; i >= 0; i--){
	var tmpString = new String(TE_hostNameArray[i]);
	if( tmpString.length > 3){
		firstIndex = i;
		i=0;
	}
}

/* put the pieces of the hostname back together left to right  */
TE_baseHostName = "";
for( i=firstIndex; i < TE_hostNameArray.length; i++){
	TE_baseHostName = TE_baseHostName + TE_hostNameArray[i]
	if( i < TE_hostNameArray.length-1){
		TE_baseHostName = TE_baseHostName + '.'
	}

}
// add the shortened hostname to the s_linkInternalFilters so that when we go to pages in that same overall domain
// SiteCatalyst doesn't report it as an exit.
s.linkInternalFilters="javascript:,"+TE_baseHostName

/*Below code is TE specific code for reading trackinguuid cookie and send it as an evar for every page visits/events/custom links
 * Existing TE_GetCookie method can not be used since every page using the TE_sitecatalyst_H.js may not have te_scripts.js included.
 */
function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return "NA";
}
/* Plugin Config */
s.usePlugins=true
function s_doPlugins(s) {
	/* Add calls to plugins here */
	/****  TE SPECIFIC CODE. SEND THE TRACKINGUUID TO SC****/
	if(s.linkTrackVars.length==0 || s.linkTrackVars=="None"|| s.linkTrackVars=="eVar2")
		s.linkTrackVars="eVar2";
	else
		s.linkTrackVars+=",eVar2";
	var ewtCookie=getCookie("TECewt7");	
	if( ewtCookie!="NA")
		s.eVar2=ewtCookie;
	s.campaign = s.getQueryParam('s_cid');
	/*Populate s.prop50 for campaign page pathing*/
	if(s.campaign !=null && s.campaign.length>0){
		s.prop50=s.pageName+":"+s.campaign
		/****BELOW IS NOT SITECATALYST LOGIC AND NEEDS TO BE TAKEN CARE DURING SC UPGRADE.****/
		/*This code writes the campaign ID to session cookie for RN*/
		document.cookie="s_cid="+s.campaign+";path=/;"+";domain=.tycoelectronics.com;";
	}
	else {
		s.prop50=s.pageName
	}
}
s.doPlugins = s_doPlugins;

/****************************************************************/
/*     reset the s_account dynamically                                                                         */
/*                                                                                                                            */
/****************************************************************/
s.dynamicAccountSelection=true;
s.dynamicAccountList="tycoeglobal,tycotycoejapan=www.tycoelectronics.com/japan;"+
"tycoeglobal,tycoecatalog=www.tycoelectronics.com/catalog/ToolingXrefWeb;"+
"tycoeglobal,tycoecatalog,tycoemain=www.tycoelectronics.com/catalog,www.tycoelectronics.com/passives;"+
"tycoeglobal,tycoecatalog=www.tycoelectronics.com/commerce/DocumentDelivery,www.tycoelectronics.com/commerce/pcr,www.tycoelectronics.com/commerce/alt;"+
"tycoeglobal,tycoecommerce,tycopcn=www.tycoelectronics.com/commerce/pcnws;"+
"tycoeglobal,tycomobile=www.tycoelectronics.com/commerce/mob;"+
"tycoeglobal,tycoecommerce,tycoemain=ecommerce.tycoelectronics.com/commerce,www.tycoelectronics.com/commerce;"+
"tycoeglobal,tycoemain=search.tycoelectronics.com;"+
"tycoeglobal,tycoaerospace=www.tycoelectronics.com/industry/aerospace,www.thefutureunleashed.com;"+
"tycoeglobal,tycorochester,=www.rochestercables.com;"+
"tycoeglobal,tycomedical=www.tycoelectronics.com/industry/medical;"+
"tycoeglobal,tycoautomotive=www.tycoelectronics.com/automotive;"+
"tycoeglobal,tycocis,tycoinstrumentation=www.tycoelectronics.com/industry/instrumentation;"+
"tycoeglobal,tycocis,tycoappliance=www.tycoelectronics.com/industry/appliance;"+
"tycoeglobal,tycocis,tycocommunication=www.tycoelectronics.com/industry/communications;"+
"tycoeglobal,tycocis,tycocomputer=www.tycoelectronics.com/industry/computer;"+
"tycoeglobal,tycocis,tycoindustrial=www.tycoelectronics.com/industry/industrial;"+
"tycoeglobal,tycocis,tycolighting=www.tycoelectronics.com/lighting;"+
"tycoeglobal,tycocis,tycoalternativeenergy=www.tycoelectronics.com/industry/solar,www.tycoelectronics.com/wind;"+
"tycoeglobal,tycocis,tycorailway=www.tycoelectronics.com/railway;"+
"tycoeglobal,tycocis,tycodatacenter=www.tycoelectronics.com/industry/datacenter;"+
"tycoeglobal,tycocis,tycowirelessinfra=www.tycoelectronics.com/industry/wireless;"+
"tycoeglobal,tycoeampnetconnect=www.ampnetconnect.com,www.tycoelectronics.com/industry/enterprisenetworks;"+
"tycoeglobal,tycodistributor=www.tycoelectronics.com/distributor;"+
"tycoeglobal,tycoemain=www.tycoelectronics.com;"+
"tycoeglobal,tycocromptonusa=www.cromptonusa.com;"+
"tycoeglobal,tycoundersea=www.subcom.com,www.tycotelecom.com;"+
"tycoeglobal,tycoerelays=relays.tycoelectronics.com;"+
"tycoeglobal,tycoemicrodotconnectors=www.microdotconnectors.com;"+
"tycoeglobal,tycoetooling=tooling.tycoelectronics.com;"+
"tycoeglobal,tycoecircuitprotection=www.circuitprotection.com;"+
"tycoeglobal,tycoecorcom=www.cor.com,www.corcom.com;"+
"tycoeglobal,tycoeidentification=identification.tycoelectronics.com,www.idento.com,www.idento.de;"+
"tycoeglobal,tycoeenergy=energy.tycoelectronics.com;"+
"tycoeglobal,tycoeraychem=raychem.tycoelectronics.com,www.raychem.com;"+
"tycoeglobal,tycoepassives=passives.tycoelectronics.com;"+
"tycoeglobal,tycoeloar=elotouch.com.ar;"+
"tycoeglobal,tycoelobr=elotouch.com.br;"+
"tycoeglobal,tycoelomain=www.elotouch.com;"+
"tycoeglobal,tycoelocorner=corner.elotouch.com;"+
"tycoeglobal,tycoelode=elotouch.de;"+
"tycoeglobal,tycoeloexpress=elotouchexpress.com;"+
"tycoeglobal,tycoeloexpressbe=elotouchexpress.be;"+
"tycoeglobal,tycoelofr=elotouch.fr;"+
"tycoeglobal,tycoelogaming=elogaming.com;"+
"tycoeglobal,tycoelouk=elotouch.co.uk;"+
"tycoeglobal,tycoelotoucheu=elotouch.eu;"+
"tycoeglobal,tycoelojp=www.tps.co.jp;"+
"tycoeglobal,tycoelochina=elotouch.com.cn;"+
"tycoeglobal,tycoblog=blogs.tycoelectronics.com,blog.circuitprotection.com;"+
"tycoeglobal,tycoapptool=www.applicationtooling.com;"+
"tycoeglobal,tycocomacc=www.comacc.co.uk;"+
"tycoeglobal,tycotelecomosp=www.telecomosp.com;"+
"tycoeglobal,tycotelecomospde=germany.telecomosp.com;"+
"tycoeglobal,tycotelecomospuk=uk.telecomosp.com;"+
"tycoeglobal,tycomost=www.tycoelectronicsmost.com;"+
"tycoeglobal,tycoesupplier=supplierportal.tycoelectronics.com,supplier.tycoelectronics.com,ecommerce.tycoelectronics.com/supplier;"+
"tycoeglobal,tycoecommchannelxraychem=raychem-cx.tycoelectronics.com;"+
"tycoeglobal,tycotops=tops.us.tycoelectronics.com;"+
"devtyco=dev,qa;"+
"tycoeglobal=."

s.dynamicAccountMatch=window.location.host+window.location.pathname;

/************************** End SiteCatalyst *************************/
