/* 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="amazonbenefitcosmeticsus"

/* supporting 3rd party cookies */
/* s.stdDom="amazonbenefitcosmeticsus.122.2o7.net" */
/* s.sslDom="amazonbenefitcosmeticsus.122.2o7.net" */

/* To support 1st party cookies, after the SSL cert is installed on Omniture's server and the client has added the CNAME in their DNS, the config file settings would be changed thusly (replacing above 2 lines settings):  */
s.trackingServer="amznmerch.122.2o7.net"
s.trackingSecureServer="amznmerch.122.2o7.net"
s.dc=122; //data center: Dallas
	
/* Override any default settings here */
s.currencyCode="USD"

if (s_account=="amznbenecoscom") {
	s.trackExternalLinks=true
	s.linkInternalFilters="javascript:,benefitcosmetics.com"
}


/* Merchant specific prePlugins functions (runs before doPlugins) */
function s_prePlugins(s) {
	
	// get external tracking code
	if (!s.campaign) {s.campaign=s.getQueryParam("ext_id")}
	
	// 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=["benefitcosmetics.com"];
	s_getExtRefMarker(intDomains);
}
/*
 * Plugin Utility: Replace v1.0
 */
s.repl=new Function("x","o","n",""
+"var i=x.indexOf(o),l=n.length;while(x&&i>=0){x=x.substring(0,i)+n+x."
+"substring(i+o.length);i=x.indexOf(o,i+l)}return x");

/*
* DynamicObjectIDs v1.3: Setup Dynamic Object IDs based on URL
*/
s.setupDynamicObjectIDs=new Function(""
+"var s=this;if(!s.doi){s.doi=1;if(s.apv>3&&(!s.isie||!s.ismac||s.apv"
+">=5)){if(s.wd.attachEvent)s.wd.attachEvent('onload',s.setOIDs);else"
+" if(s.wd.addEventListener)s.wd.addEventListener('load',s.setOIDs,fa"
+"lse);else{s.doiol=s.wd.onload;s.wd.onload=s.setOIDs}}s.wd.s_semapho"
+"re=1}");
s.setOIDs=new Function("e",""
+"var s=s_c_il["+s._in+"],b=s.eh(s.wd,'onload'),o='onclick',x,l,u,c,i"
+",a=new Array;if(s.doiol){if(b)s[b]=s.wd[b];s.doiol(e)}if(s.d.links)"
+"{for(i=0;i<s.d.links.length;i++){l=s.d.links[i];c=l[o]?''+l[o]:'';b"
+"=s.eh(l,o);z=l[b]?''+l[b]:'';u=s.getObjectID(l);if(u&&c.indexOf('s_"
+"objectID')<0&&z.indexOf('s_objectID')<0){u=s.repl(u,'\"','').substr"
+"ing(0,97);l.s_oc=l[o];a[u]=a[u]?a[u]+1:1;x='';if(c.indexOf('.t(')>="
+"0||c.indexOf('.tl(')>=0||c.indexOf('s_gs(')>=0)x='var x=\".tl(\";';"
+"x+='s_objectID=\"'+u+'_'+a[u]+'\";return this.s_oc?this.s_oc(e):tru"
+"e';if(s.isns&&s.apv>=5)l.setAttribute(o,x);l[o]=new Function('e',x)"
+"}}}s.wd.s_semaphore=0;return true");

/*
 * 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
         +"u=u.href;"
	+"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="";
	}
}
