/* Version: 060630 */
/*  1. Easy usage of 1st party cookies by modifying new s.stdDom and s.sslDom parameters                */
/*  2. Easy disabling of the JS code (including any cookie writing) with the new s_disableJS parameter  */


/* WARNING: Do not modify the visitorNamespace parameter */
s.visitorNamespace="amazontimex"
s.stdDom="amazontimex.122.2o7.net"
s.sslDom="amazontimex.122.2o7.net"
s.vmk=""
	
/* Override any default settings here */
s.currencyCode="USD"

if (s_account=="amzntimex") {
	s.trackExternalLinks=true
	s.linkInternalFilters="javascript:,timex.com"
}


/* Merchant specific prePlugins functions (runs before doPlugins) */
function s_prePlugins(s) {
	
	// get external tracking code
	if (!s.campaign) {s.campaign=s.getQueryParam("extid")}
	
	// get internal tracking code
	if (!s.eVar1) {s.eVar1=s.getQueryParam("intid")}
}


/* Merchant specific postPlugins functions (runs after doPlugins) */
function s_postPlugins(s) {
	s.setupDynamicObjectIDs();
	
	// get external ref marker
	var intDomains=["timex.com"];
	s_getExtRefMarker(intDomains);
}


/*
 * setupDynamicObjectIDs: Setup Dynamic ClickMap Object IDs
 */
s.setupDynamicObjectIDs=new Function(""
+"var s=this;if(!s.doi){s.doi=new Object;s.doi.a=new Array;s.doi.ol=s"
+".wd.onload;s.wd.onload=s.setOIDs;if(s.d.body){if(!s.d.body.s_semaph"
+"ore)s.d.body.s_semaphore=0;s.d.body.s_semaphore++;}}");
s.setOIDs=new Function("e",""
+"var s=s_c_il["+s._in+"],r=true,l,q,oc,x,y,ln;if(s.doi.ol)r=s.doi.ol"
+"(e);if(s.d.links){for(ln=0;ln<s.d.links.length;ln++){l=s.d.links[ln"
+"];q=l.href;oc=l.onclick?l.onclick.toString():'';q=q?s.getObjectID(q"
+"):'';if(q&&oc.indexOf('.t(')<0&&oc.indexOf('.tl(')<0&&oc.indexOf('s"
+"_objectID')<0){q=q.substring(0,97);if(oc.indexOf('.lc(')<0)l.s_oc=l"
+".onclick;s.doi.a[q]=s.doi.a[q]?s.doi.a[q]+1:1;x='s_objectID=\"'+q+'"
+"_'+s.doi.a[q]+'\";if(this.s_oc)return this.s_oc(e);return true';if("
+"s.isns&&s.apv>=5)l.setAttribute('onclick',x);l.onclick=new Function"
+"('e',x)}}}if(s.d.body&&s.d.body.s_semaphore)s.d.body.s_semaphore--;"
+"return r");
/*
 * Only return an objectID for URLs that should have an objectID.
 *   For all others, return empty string.
 */
s.getObjectID=new Function("u",""

	// strip query string
	+"var x=u.indexOf('?');"
	+"u=x>-1?u.substring(0,x):u;"

	// find the file name (last portion of path)
	+"y=u.lastIndexOf('/');"
	+"x=u.substring(y+1);"

	// if the dashes are in the right place, strip it
	+"if(x.charAt(3)!='-'||x.charAt(11)!='-')"
		+"u='';"
	+"else "
		+"u=u.substring(0,y);"

	// if '/qid=XXXXXXXXXXX/' exists, strip it
	+"x=u.indexOf('qid=');"
	+"y=x>-1?u.indexOf('/',x):0;"
	+"u=x>-1?u.substring(0,x)+u.substring(y+1):u;"

	// return the cleaned up URL (u) or nothing
	+"return u"
);


function s_getExtRefMarker(intDomains) {
	/* v1.1 12-19-05
		sets prop13 and eVar15 to ref marker when referrer
		is non-blank and doesn't match intDomains list */
	var isExt=true;
	var docRef=document.referrer;
	if (docRef=="") {isExt=false;}
	else {
		for (var i=0; i<intDomains.length; i++) {
			if (docRef.indexOf(intDomains[i])!=-1) {isExt=false;break;}
		}
	}
	if (isExt) {
		s.prop13=s.prop12;
		s.eVar15=s.getValOnce(s.prop12,"s_v15",0);
		s.prop12="";
	}
}
