/* Version: 060412 */

/* WARNING: Do not modify the visitorNamespace parameter
unless instructed to by Omniture */
s.visitorNamespace="amznmothercare"
	
/* Override any s_code.js default settings here */
s.currencyCode="GBP"


if (s_account=="amznmothercaredev" || s_account=="amznmothercareprod" || s_account=="amznmothercareqa") {
	s.trackExternalLinks=true
	s.linkInternalFilters="javascript:,mothercare"
}
	

/* 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();

	// cleanup browse node and search merchandising
	if (s.eVar14) {
		if (s.eVar14!="Browse") {s.eVar5="non-Browse"}
		if (s.eVar14!="Search") {s.eVar2="non-Search"}
	}
	
}


/*
 * 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"
);
