// sprops 5-9 are for the level 1-5 site sections of a content group
var s_prop5="";
var s_prop6="";
var s_prop7="";
var s_prop8="";
var s_prop9="";

function getSiteSections (contentGroup) {
	
	var arr = contentGroup.split("|");
	
	for (var i=0; i<arr.length; i++) {
		var t = arr[i];
		
		if (i == 0){
			s_prop5 = t;
		}
		else if (i==1){
			s_prop6 = s_prop5 + "|" + t;
		}
		else if (i==2){
			s_prop7 = s_prop6 + "|" + t;
		}
		else if (i==3){
			s_prop8 = s_prop7 + "|" + t;
		}
		else if (i==4){
			s_prop9 = s_prop8 + "|" + t;
		}				
	}
}

// -----------------------------------------------------------------------------
// * ngsAdvertisingRefresh
// -----------------------------------------------------------------------------
// if you want ads to be refreshable OOTB then name the iframe with prefix "ngsAdvertisingRefreshFrame"
// e.g. <iframe name="ngsAdvertisingFrame1" ....
// TODO:
//	This javascript would get called by ngsPageView function (and could be pulled in via omniture_code.js (need global name)
function ngsAdvertisingRefresh(){

	var frameIndex = 0;
	var myFrames = top.frames;
	
	while (frameIndex < myFrames.length){

		var myFrame = myFrames[frameIndex];
	 // alert('refreshing ad frame: ' + myFrame.name);
		if (myFrame.name.indexOf("ngsAdvertisingRefreshFrame") == 0){
			myFrames[myFrame.name].location.reload();
		}
		frameIndex++;
	}
}

// -----------------------------------------------------------------------------
// * _pageNameFilterVideoPlayer
// -----------------------------------------------------------------------------
function _pageNameFilterVideoPlayer(pageName) {

	var videoPlayerPrefix = "/video/player";
	
	var cat1index = pageName.indexOf(videoPlayerPrefix);
	if (cat1index == -1){
		return;
	}
	
	// get to index after the prefix
	cat1index += videoPlayerPrefix.length;
	
	// videoPlayerPath contains the string after .../video/player
	var videoPlayerPath = pageName.substr(cat1index);
	
	var c1 = "";
	var c2 = "";
	var c3 = "";
	var video = "";
	
	// filename == directory or plain file	
  var filenames = videoPlayerPath.split("/");
     
  // the last entry is the plain file aka video name, all other entries are the cat1-cat3
  var i=0;
  var nodeIndex = 0; // only use directories other than "" (which would happen if there was // or even the leading /
  while (i<filenames.length){
  	if (filenames[i] == ''){
  		i++;
  		continue;
  	}
	
		if (nodeIndex == 0){
			// level 1 cat
			c1 = filenames[i];
		}
		else if ((nodeIndex == 1) && (i < filenames.length)){
			// level 2 cat
			c2 = filenames[i];
		}
		else if (nodeIndex == 2){
			// level 3 cat or video
			if (i < filenames.length-1){
				c3 = filenames[i];
			}
			else{
				video = filenames[i];
			}
		}		
		else{
			// assumes only 2 or 3 levels of categories
			video = filenames[i];
		}
		i++;
		nodeIndex++;
	}// end while		
	
	// trim any .html from the video filename
	var extIndex = video.indexOf(".html");
	if (extIndex != -1){
		video = video.substring(0,extIndex);
	}
	//alert('c1:' + c1 + '\nc2:' + c2 + '\nc3:' + c3 + '\nvideo:' + video + '\n');
	
// video would be "" if coming in to a cat 1 level url like /video/player/animals
// only want to set these evars and sprops if a video will be played
	if (video != ""){
		s_eVar7 = c1;
		s_prop13 = c1;
		
		s_eVar8 = c2;
		s_prop14 = c2;
		
		s_eVar9 = c3;
		s_prop15 = c3;
		
		s_eVar6 = video;
		s_prop12 = video;

		// only set event4 if video was viewed
		s_events="event4";
	}
	
	return pageName;
}


// -----------------------------------------------------------------------------
// * _pageNameFilter
// -----------------------------------------------------------------------------
function _pageNameFilter(pageName) {
	
	// depending on the path set different omniture variables
	if (pageName.indexOf('/video/player') == 0){
		
		if ((pageName.indexOf('/video/player/animals.html') == 0)||
				(pageName.indexOf('/video/player/environment.html') == 0)||
				(pageName.indexOf('/video/player/featured-videos.html') == 0)||
				(pageName.indexOf('/video/player/kids.html') == 0)||
				(pageName.indexOf('/video/player/people-and-places.html') == 0)||
				(pageName.indexOf('/video/player/world-music.html') == 0)){
				// do nothing
			}
		else{
			pageName = _pageNameFilterVideoPlayer(pageName);
		}
	}
	
	return pageName;
}


// -----------------------------------------------------------------------------
// * _ngsPageViewFilter
// -----------------------------------------------------------------------------
// optionally do something with the pageView data depending on the site
//
function _ngsPageViewFilter(pageName, separator) {
	
	var pathname = window.location.pathname;
	
	// depending on the path set different omniture variables
	if (pathname.indexOf('/video/player') == 0){
		
		if ((pathname.indexOf('/video/player/animals.html') == 0)||
				(pathname.indexOf('/video/player/environment.html') == 0)||
				(pathname.indexOf('/video/player/featured-videos.html') == 0)||
				(pathname.indexOf('/video/player/kids.html') == 0)||
				(pathname.indexOf('/video/player/people-and-places.html') == 0)||
				(pathname.indexOf('/video/player/world-music.html') == 0)){
				// do nothing
			}
			else{
				_ngsPageViewFilterVideoPlayer(pageName, separator);
			}
		}
	}

// -----------------------------------------------------------------------------
// * _ngsPageViewFilterVideoPlayer
// -----------------------------------------------------------------------------
function _ngsPageViewFilterVideoPlayer(pageName, separator) {
	
		// parse the pageName which is of the format
		// c1=foo&c2=bar&c3=blah&video=doh
		var c1 = "";
		var c2 = "";
		var c3 = "";
		var video = "";
		
  	var pairs = pageName.split("&");
     
		for (var i=0;i<pairs.length;i++){
			var pos = pairs[i].indexOf('=');
			if (pos >= 0){
				var name = pairs[i].substring(0,pos);
				var value = pairs[i].substring(pos+1);
				
				//c1 goes in evar7 and sprop13
				if (name == 'c1'){
					c1 = value;
				} 
				//c2 goes in evar8 and sprop14
				else if (name == 'c2'){
					c2 = value;
				}
				//c3 goes in evar9 and sprop15
				else if (name == 'c3'){
					c3 = value;
				}
				//video goes in evar6 and sprop12
				else if (name == 'video'){
					video = value;
				}      
				
			} // end if pos >= 0
		}// end for		
		
		s_eVar7 = c1;
		s_prop13 = c1;

		s_eVar8 = c2;
		s_prop14 = c2;

		s_eVar9 = c3;
		s_prop15 = c3;

		s_eVar6 = video;
		s_prop12 = video;

		// only set event4 if video was viewed
		if (video != ""){
			s_events="event4";
		}

		// shorten the page name from the seo long one to be
		// foo.nationalgeographic.com/video/player/|<separator>=<pageName>
		//var hostname = window.location.hostname;
		//s_pageName = "http://" + hostname + "/video/player/|" + separator + "=" + pageName;
		
		//recontruct the friendly url
		var videoPath = "/video/player";
		if (c1 != ""){
			videoPath = videoPath + "/" + c1;
			
			if (c2 != ""){
				videoPath = videoPath + "/" + c2;		
				
				if (c3 != ""){
					videoPath = videoPath + "/" + c3;
							
					if (video != ""){
						// c3 video page
						videoPath = videoPath + "/" + video + ".html";
					}
					else{
						// c3 category page
						videoPath = videoPath + "/index.html";
					}
				}
				else{		
					if (video != ""){
						// c2 video page
						videoPath = videoPath + "/" + video + ".html";
					}	
					else{
						// c2 category page
						videoPath = videoPath + "/index.html";
					}		
				} // end c3
			}
			else{
				// c1 category page
				videoPath = videoPath + "/index.html";
			}	// end c2
		} // end c1

		s_pageName = videoPath;
	}

// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//	*** begin generic function wrappers ***
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// if omniture goes away, then need to keep these functions defined for the flash files
// that call them to still work. So, either comment out the function bodies or call the
// equivalent function in the new web analytics package
function ngsPageView(pageName,separator){
	// use this function in those cases where the click should count as a page view
	
	// pageName	- the identifier for the simulated pageview. No spaces. FormatThePageNameLikeThis.
	
	// separator - optional - used in the reported pagename and content hierarchy.
	// Defaults to "Flash," but this function can get used by other media, so it's changeable here.
	
	// if neither the pageName nor the separator are defined, the parent HTML page is simply given another pageview count, without any modifiers at all.
	
	if (ngsTrackingEnabled) {
		var blankpage = (typeof pageName == "undefined" && typeof separator == "undefined") ? true : false;
		
		if (typeof pageName == "undefined") var pageName = "UnnamedEvent";	
	
		if (typeof separator == "undefined") var separator = "Flash";
		
		
		if (blankpage == false) {
		
			s_hier1 = s_originalHier1 + (separator ? "|" + separator : "");
			s_pageName = s_originalPageName + (pageName ? ("|" + separator + (separator ? "=" : "") + pageName) : "");
		
		} else { // reset to default values if no data specified, count it as a straight HTML pageview
			
			s_hier1 = s_originalHier1;
			s_pageName = s_originalPageName;
			
		}
		
		_ngsPageViewFilter(pageName, separator);
			
		sendAnalyticsEvent();	
		
		// alert ("s_hier1="+s_hier1+"\ns_pagename="+s_pageName);
	}
	
	// if there are refreshable ads on a page then refresh them
	ngsAdvertisingRefresh();
}


function ngsCustomEvent(eventName,type,separator){
	// use this function in those cases where the click does not count as a page view
	
	// eventName - used to create a custom link name by combining it
	// with the content group value: 
	// e.g. eventName = s_hier1 + separator (defaults to "Flash") + eventName					
	
	// type (optional) valid values: "custom_event", "file_download", "exit_link"	
	
	// separator (optional) - used in the link event name. Defaults to "Flash,"
	// but this function can get used by other media, so it's changeable here.
	
	
	// reset these sprops/evars as they have special use for page views
	// and they don't have meaning for custom events
	s_eVar7 = "";
	s_prop13 = "";

	s_eVar8 = "";
	s_prop14 = "";

	s_eVar9 = "";
	s_prop15 = "";

	s_eVar6 = "";
	s_prop12 = "";
	
	
	if (ngsTrackingEnabled) {
	
		if (typeof separator == "undefined") var separator = "Flash";
		var eventName = eventName || "UnnamedEvent";
		
		//eventName = s_originalPageName + "?" + separator + "=" + eventName;
		var pathname = window.location.pathname;
		eventName = pathname + "?" + separator + "=" + eventName;
		
		//    map linkType to omniture list: o: Custom Links
		//									 d: File Downloads report
		//									 e: exit links report
		//
		
		if (typeof type != "undefined"){
		
			if (type == "custom_event" || "o"){
				type = 'o';
			}
			else if (type == "file_download" || "d"){
				type = 'd';
			}
			else if (type == "exit_link" || "e"){
				type = 'e';
			}		
			else {
				type = 'o';
			}
			
		}	else {
				var type = 'o';
			}
		
		// alert ("eventName="+eventName+"\ntype="+type);
	
		sendLinkEvent("",eventName,type);
	
	}
}


function ngsProcessPathname (t) {
	// used to make pagenames in the Omniture style (no index.htm/l, no trailing slash)
	
	if (typeof t == "undefined" || !t ) return;

	var tin = t.lastIndexOf("/index.htm");
	
	if (tin > -1 && tin + 12 > t.length) { t = t.substring(0,tin); }
	// if the location of index.htm(l) is at the end of the pathname (fewer than 12 characters from the end), strip it out. Otherwise the pathname might have a query string, like index.html?foo=bar, so it should stay as is.

	var tl = t.length;
	
	t = (t.charAt(tl-1) == "/") ? t.substring(0,tl-1) : t; // strip trailing slash

	//Strip ?fs/source/email=XXXXX from urls
	var qsIndex = t.indexOf("?");
	var newqs = "";
	if (qsIndex != -1){
		var qs = t.substr(qsIndex+1);

		var pairs = qs.split("&");
	     
	  //alert('pairs: ' + pairs);
		for (var i=0;i<pairs.length;i++){
			var pos = pairs[i].indexOf('=');
			if (pos >= 0){
				var name = pairs[i].substring(0,pos);
				var value = pairs[i].substring(pos+1);
				
				if ((name != "fs") && (name != "source") && (name != "email")){
					newqs = newqs + pairs[i] + "&";
				}
			}
			else{
				newqs = newqs + pairs[i] + "&";
			}
		}	
		t = t.substring(0,qsIndex+1);
		t = t + newqs;
	}

	return t;
}



function checkStartOf (string,params) {
	// params should be a comma-separated list. This functions checks if any of the params
	// are at the start of the string. If so, returns true; otherwise false.

	var arr = params.split(",");
	var stringCheck = false;
	
	for (var i=0; i<arr.length; i++) {
		var t = arr[i];
		if (string.indexOf(t) == 0) {
			stringCheck = true;
			break;
		}	
	}

	return stringCheck;
}



// om_parseQuery and om_parseGoogle are used to parse the Google search terms from a URL.

function om_parseQuery(str,q) { // gets value of q from str
  
		 var sPos = str.indexOf(q + "=")
    
    if (sPos > -1) {
        sPos = sPos + q.length + 1;
        var ePos = str.indexOf("&",sPos);
        if (ePos == -1) { ePos = str.length; }
		 		 var result = str.substring(sPos,ePos);
        return unescape(result.replace(/\+/g," ")); // strip out plus signs
      }
     else {
      		 return "";
		  }
}

function om_parseGoogle (queryStr) {

		 		 var q = om_parseQuery (queryStr, "q") ;
		 		 var p = om_parseQuery (queryStr, "start");
		 		 var s = om_parseQuery (queryStr, "site");

		 		// begin changes 060317 jgo 
		 		// change name of default_collection to "global_search"
		 		if (typeof s != "undefined"){
			 		if (s =="default_collection"){
			 			s = "global_search";
			 		}
		 		}
		 		// end changes 060317 jgo 
		 		
		 		 p = (p != "") ? ((parseInt(p)+10)/10) : 1;
		 		 
		 		 return (q != "") ? " | " + q.toLowerCase() + " | " + s + " | page " + p : "";

}


// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//	*** end generic function wrappers ***
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------

//var ngs_furl="/animals/mammals/polar-bear.html";
//var ngs_reportsuite="natgeoglobal";
//var ngs_contentgroup=""; 
//var ngs_channel="";
//var ngs_event="";
//var ngs_pagenumber="0"; ?

var s_events="event5"
if (typeof ngs_event != "undefined") { 
	s_events = s_events + "," + ngs_event;
}

if (typeof ngs_furl != "undefined") { 
	s_pageName = ngs_furl; 
}

if (typeof ngs_reportsuite != "undefined") { 
	s_account = ngs_reportsuite; 
}

if (typeof ngs_contentgroup != "undefined") { 
	s_hier1 = ngs_contentgroup; 
}
else{
	// for variables we use in the omn custom code, make sure they have
	// some value so that are defined before they are used.
	// otherwise, we get a js error
	if (typeof s_hier1 == "undefined") {
		s_hier1="";
	}
}
//put the individual levels of the content group into separate sprops (5-9)
getSiteSections(s_hier1);


if (typeof ngs_channel != "undefined") { 
	s_channel = ngs_channel; 
}
else{
	// set this to same value as s_hier1
	// so can see the urls that fall under a particular group
	s_channel=s_hier1;
}

// end changes 070419 jgo

// to enable tracking on a test server, then
// set this variable in the html page:
// var ngsTrackingEnabled = 1;

var hostname = window.location.hostname;
var pathname = window.location.pathname;

if (typeof ngsTrackingEnabled == "undefined") {

	if (checkStartOf(hostname,"teststats")) {
		var ngsTrackingEnabled = 1;
	}
	else if (checkStartOf(hostname,"test,testnetscape,testaolxxx,atoll,pebble,stone,rock,boulder,rapid,eddy")) { // comma-delimited list of testing servers
	
		var ngsTrackingEnabled = 0;
		//alert('tracking disabled');
	}
	else {
		var ngsTrackingEnabled = 1;
	}
}

// if s_pageName doesn't exist, create it based on the rules we have defined.
// rules include: hostname is rewritten to www.nationalgeographic.com if user
// is browsing a mirror (e.g., www.ngeo.com); trailing slash and index.htm/l
// are removed; a query string is stripped unless it's in a site where we want
// to track query strings.


if (typeof s_pageName == "undefined" || s_pageName == "") {
	
	if (checkStartOf(hostname,"www.nationalgeographic") == false) {
	
		// don't do the processor-intensive search unless we need to
		
		if (checkStartOf(hostname, "aol,nationalgeographic,netscape,ngeo,www.ngeo,www.nationalgeographic.org,nationalgeographic.org,ww.nationalgeographic,wwww.nationalgeographic,www.ngsociety,207.24.89.170")) { // comma-delimited list of mirrors
		
		// if we're on a mirror server, use the "www" pathname instead.
		hostname = "www.nationalgeographic.com";

		}
	
	}
	
// process the pathname that will eventually build the page name. 
// disabled google code since too many unique page names
// instead going to store search term in sprop/evar - 061201 jgo	
//	if (hostname.indexOf("google")>-1) {
	// if this is a google search, run through the special google function to define the pathname.
//	pathname = om_parseGoogle(window.location.search);
//	} else {
	
		if (checkStartOf(pathname,"/ngm,/pod,/cgi-bin/pod,/xpeditions,/forcesofnature,/genographic")) { // comma-delimited list of sites that have valuable information in the query string
		
			pathname += window.location.search;
		
		}
		
		// process the pathname to strip trailing characters
		pathname = ngsProcessPathname(pathname);	
//	}
		
	// right now filter isn't changing value of pagename, just extracting data and setting evars/sprops
	// should consolidate above process pathname code into filter(s)
	_pageNameFilter(pathname);
	
	// build final s_pageName	
	// don't include domain for video (want to do for all subdomains?)
	if (hostname.indexOf("video") == 0){
		s_pageName = pathname;
	}
	else if (hostname.indexOf("kids.") == 0){
		s_pageName = "Kids:" + pathname;
	}
	else if (hostname.indexOf("channel.") == 0){
		s_pageName = "NGC:" + pathname;
	}	
	else if (hostname.indexOf("www.u23dmovie.") == 0){
		s_pageName = "U23D:" + pathname;
	}	
//	// don't include domain for specific report suites
	else if (	(typeof s_account != "undefined") && 
						((s_account == "natgeoadventuremagcom")||
						 (s_account == "natgeotravelermagcom")||
						 (s_account == "natgeoworldmusic")||
						 (s_account == "natgeonews")||
						 (s_account == "natgeopeopleplaces")||
						 (s_account == "natgeongmcom")||
						 (s_account == "natgeomapscom")||
						 (s_account == "natgeonavcom")||
						 (s_account == "natgeomissionpubcom")||
						 (s_account == "natgeomissiondevcom"))){
			s_pageName = pathname;
	}
	else{
		s_pageName = window.location.protocol + "//" + hostname + pathname;
	}
	
	// add stub if it exists
	if (typeof s_pageNameStub != "undefined") { s_pageName = s_pageName + "|" + s_pageNameStub; }

}


// Set global variables for flash tracking.

var s_originalPageName = s_pageName;
var s_originalHier1 = s_hier1;


var s_server = window.location.hostname;
var s_prop3=navigator.userAgent; 	// track browser/platform versions
var s_prop11 = s_pageName;				// s_prop11 is used for Top URLs

// For Flash version tracking 

var s_maxFlashVersion = 8;

// default to the global group if the var is not already set
if (typeof s_account == "undefined"){
	//s_account = "nationalgeopoc,natgeoglobal";
	s_account = "natgeoglobal,natgeonotags";
}
else if (s_account == "natgeongkidsmagcom"){
	// typo at omniture
	s_account = "natgeongkidsmagccom,natgeoglobal";
}
else if ((s_account == "ngcorporate")||
		 (s_account == "natgeoschoolpublishing")||
		 (s_account == "natgeohamptonbrown")||
		 (s_account == "natgeohbedge")||
		 (s_account == "natnatgeongsp")){		 	
	// don't add to global report suite
}
else if (s_account == "natgeoglobal"){
	// natgeonotags makes it easy to see pages without custom tags
	s_account = s_account + ",natgeonotags";
}
else{
	s_account = s_account + ",natgeoglobal";
}

// if tracking is disabled, set the s_account to blank. This disables the omniture call.
// This should be placed just before the sitecatalyst code.
if (!ngsTrackingEnabled) s_account="";


/*** JS file vG9 Code ***/
// San Jose Data Center
/************************ ADDITIONAL FEATURES ************************
     Plugins
*/
/************************** CONFIG SECTION **************************/

/* You may add or alter any code config here.                       */
/* Variables (s_pageName, s_prop1, etc.) not prefixed with "s_" will not be used. */
var s_disableLegacyVars=true

/* E-commerce Config */
var s_currencyCode="USD"
var s_eVarCFG=""

/* Link Tracking Config */
var s_trackDownloadLinks=true
var s_trackExternalLinks=true
var s_trackInlineStats=true
var s_linkDownloadFileTypes="flv,fla,ram,asx,exe,zip,wav,mp3,mp4,mov,mpg,avi,wmv,doc,pdf,xls,jpg,scr,bin"

var s_linkInternalFilters="javascript:,nationalgeographic.com,nationalgeographic.org,customersvc,buysub,nationalgeographicchannel.com,national-geographic.com,nationalgeo.com,ngadventure.com,ngtraveler.com,ngdigitalmotion.com,ngtlibrary.com,ngchannel.com,nationalgeographicexpeditions.com,godgrewtiredofus.com,runningthesahara.com,arctictalemovie,ngtservice.com,pictopia.com,shopngvideos.com,thegreenguide.com,everydayexplorer.com,mywonderfulworld.com,mywonderfulworld.org,ngcwild.com,ngmapstore.com,ngmservice.com,ngschoolpub.org,ngsednet.org,ngsimages.com,buysub.com,ngs.org,209.16.232.90,realarcade.com,nationalgeographic.co.uk,u23dmovie.com,ngm.com,hippodude.com,xif.com" 


var s_linkLeaveQueryString=false
var s_prop1=""; 

/* Plugin Config */
var s_usePlugins=true
function s_doPlugins() {

	/* Add calls to plugins here */
	
	s_vp_getCGI('s_campaign','source');			// External Campaigns.
	
	s_vp_getCGI('s_eVar1','intcmp');				// Internal campaigns
	s_eVar2=s_pageName; // s.eVar2=s_pageName ; //s.pagename -- populate eVar2 with pagename 
	s_eVar3=s_channel; 	// s.eVar3=s.channel; // populate eVar3 with channel 
	s_vp_getCGI('s_eVar4','EMAIL');	
	s_vp_getCGI('s_eVar5','Q'); 
	//s_vp_getCGI('s_eVar6','HP'); replaced by video player usage
	//s_vp_getCGI('s_eVar7','LT');	replaced by video player usage
	s_vp_getCGI('s_eVar11','cds_page_id');
	s_vp_getCGI('s_eVar12','cds_mag_code');
	s_vp_getCGI('s_eVar13','id');
	s_vp_getCGI('s_eVar14','lsid');
	s_vp_getCGI('s_eVar15','cds_misc_5');
	s_vp_getCGI('s_eVar18','NAV');	

	s_vp_getCGI('s_eVar19','widgets'); 
	s_vp_getCGI('s_eVar20','feed'); 

	s_vp_getCGI('s_eVar21','source'); //	s.eVar21=s.campaign;  populate eVar21 with any s.campaign value 
	s_vp_getCGI('s_eVar22','source'); // s.eVar22=s.campaign; populate eVar22 with any s.campaign value 	

	s_vp_getCGI('s_eVar26','REFERRER');
	s_vp_getCGI('s_eVar27','MSRSMAG');

	s_vp_getCGI('s_prop20','freetext');
	s_vp_getCGI('s_eVar30','freetext');
	
	s_vp_getCGI('s_eVar23','ngc');

	s_vpr('s_prop1', s_vp_getNewRepeat());	// Return whether user is new or repeat	
	s_vp_getCGI('s_prop2','Q');
	s_vpr('s_prop4',s_vp_detectFlash());		// Flash detection
	s_prop10=document.title; // populate prop10 with title tag value 
}

// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//	*** begin vanilla omniture ***
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------

/************************** PLUGINS SECTION *************************/
/* You may insert any plugins you wish to use here.                 */

/*
 * Plugin: Flash Tracking
 */
function sendAnalyticsEvent(accnt){
accnt=accnt?accnt:s_account;void(s_gs(accnt))}

function sendLinkEvent(accnt,lnkname,type){
accnt=accnt?accnt:s_account;s_linkType=type?type:"o";s_lnk=true;
s_linkName=lnkname?lnkname:s_linkName?s_linkName:"Flash Link Event";
void(s_gs(accnt))}
/* 
 * Plugin: Flash Detection. 
 */ 
function s_vp_detectFlash() 
        {var fv=-1,dwi=0,mt=s_n.mimeTypes;if(s_pl&&s_pl.length){if(s_pl[ 
        "Shockwave Flash 2.0"]){fv=2}x=s_pl["Shockwave Flash"];if(x){fv=0;z= 
        x.description;if(z){fv=z.substring(16,z.indexOf('.'))}}}else if(mt&& 
        mt.length){x=mt['application/x-shockwave-flash'];if(x&& 
        x.enabledPlugin)fv=0}if(fv<=0)dwi=1;var w=s_u.indexOf("Win")!=-1?1:0 
        if(dwi&&s_isie&&w&&execScript){result=false;for(var i= 
        s_maxFlashVersion;i>=3&&result!=true;i--){execScript('on error res'+ 
        'ume next: result = IsObject(CreateObject("ShockwaveFlash.Shockwav'+ 
        'eFlash.'+i+'"))','VBScript');fv=i}}return fv==-1?'flash not detec'+ 
        'ted':fv==0?'flash enabled (no version)':'flash '+fv} 
        
/*
 * Plugin: Get Plugin Modified Value
 */
function s_vp_getValue(vs)
	{var k=vs.substring(0,2)=='s_'?vs.substring(2):vs;return s_wd[
	's_vpm_'+k]?s_wd['s_vpv_'+k]:s_gg(k)}
/*
 * Plugin: Get Query String CGI Variable Value
 */
function s_vp_getCGI(vs,k)
	{var v='';if(k&&s_wd.location.search){var q=s_wd.location.search,
	qq=q.indexOf('?');q=qq<0?q:q.substring(qq+1);v=s_pt(q,'&',s_cgif,
	k.toLowerCase())}s_vpr(vs,v)}function s_cgif(t,k){if(t){var te=
	t.indexOf('='),sk=te<0?t:t.substring(0,te),sv=te<0?'True':
	t.substring(te+1);if(sk.toLowerCase()==k)return s_epa(sv)}
	return ''}
/*
 * Plugin: Get Value From Cookie
 */
function s_vp_getCookie(vs,k)
	{s_vpr(vs,s_c_r(k))}
/*
 * Plugin: Store value in variable history and get last value
 */
function s_vp_setAndGetLastValue(vs,v)
	{var l=s_vh_gl(vs);if(!s_vh_s(vs,v))l='';s_vpr(vs,l)}
/*
 * Plugin: Set variable to value only once per time priod:
 *         (Min, Hour, Day, Month, Year)
 *         in the specified timezone (hour offset from GMT)
 */
function s_vp_setOncePer(vs,v,period,tzOffs)
	{if(v){var n=s_dt(tzOffs,0),t,st=s_vh_gt(vs,v);st=st?st:0;if(
	!s_vh_s(vs,v))v='';else if(st){t=s_dt(tzOffs,st);var min=(
	n.getMinutes()==t.getMinutes()),hour=(n.getHours()==t.getHours()
	),day=(n.getDate()==t.getDate()),mon=(n.getMonth()==t.getMonth()
	),year=(n.getYear()==t.getYear());if(period=='Ever'||(year&&((
	period=='Year')||(mon&&((period=='Month')||(day&&((period=='Day'
	)||(hour&&((period=='Hour')||(min&&period=='Min')))))))))){v=''}}
	}s_vpr(vs,v)}
/*
 * Plugin: Dynamically Generate Page Name Based On Current URL
 */
function s_vp_getPageName()
	{	
	var pn=(window.s_siteID&&(""+s_siteID).length>0)?""+s_siteID:
	'',l=location,dp=(window.s_defaultPage)?""+s_defaultPage:'',e=
	(window.s_pathExcludeDelim)?s_pathExcludeDelim:'',cs=(window.
	s_pathConcatDelim)?s_pathConcatDelim:'',q=l.search.substring(1),
	p=l.pathname.substring(1),x=p.indexOf(e);p=((x<0)?p:p.substring(0,
	x)).split("/");for(j=0;j<p.length;j++){if(p[j].length>0){if(pn.
	length>0)pn+=cs;pn+=p[j]}else{if(dp.length>0){if(pn.length>0)pn+=
	cs;pn+=dp}}}if(q.length>0){if(window.s_queryVarsList){var qpa=new 
	Array(),qv=s_queryVarsList.split(","),qp=q.split("&"),tmp,idx;for
	(i=0;i<qp.length;i++){tmp=qp[i].split("=");qpa[i]=tmp[0]}for(i=0;
	i<qv.length;i++){idx=s_inArray(qpa,qv[i]);if(idx>=0){if(pn.length
	>0)pn+=cs;pn+=qp[idx]}}}}return pn}
	
// begin changes 051219 jgo	
/* 
 * Plugin: getNewRepeat 1.0 - Return whether user is new or repeat 
 */ 
function  s_vp_getNewRepeat()
{var e=new  Date(),cval,ct=e.getTime(),y=e.getYear();
e.setTime(ct+30*24*60*60*1000);cval=s_c_r('s_nr');if(cval.length==0){s_c_w('s_nr',ct,e);
return  'New';}if(cval.length!=0&&ct-cval<30*60*1000){
s_c_w('s_nr',ct,e);return  'New';}if(cval<1123916400001){
e.setTime(cval+30*24*60*60*1000);s_c_w('s_nr',ct,e);return 'Repeat';}
else  return 'Repeat';}
// end changes 051219 jgo
	
/*
 * Plugin Utilities v2.0 (Required For All Plugins)
 */
function s_vpr(vs,v){if(s_wd[vs])s_wd[vs]=s_wd[vs];else s_wd[vs]=''
if(vs.substring(0,2) == 's_')vs=vs.substring(2);s_wd['s_vpv_'+vs]=v
s_wd['s_vpm_'+vs]=1}function s_dt(tz,t){var d=new Date;if(t)d.setTime(
t);d=new Date(d.getTime()+(d.getTimezoneOffset()*60*1000))
return new Date(Math.floor(d.getTime()+(tz*60*60*1000)))}
function s_vh_gt(k,v){var vh='|'+s_c_r('s_vh_'+k),vi=vh.indexOf('|'+v
+'='),ti=vi<0?vi:vi+2+v.length,pi=vh.indexOf('|',ti),t=ti<0?'':
vh.substring(ti,pi<0?vh.length:pi);return t}function s_vh_gl(k){var
vh=s_c_r('s_vh_'+k),e=vh?vh.indexOf('='):0;return vh?(vh.substring(0,
e?e:vh.length)):''}function s_vh_s(k,v){if(k&&v){var e=new Date,st=
e.getTime(),y=e.getYear(),c='s_vh_'+k,vh='|'+s_c_r(c)+'|',t=s_vh_gt(k,
v);e.setYear((y<1900?y+1900:y)+5);if(t)vh=s_rep(vh,'|'+v+'='+t+'|','|'
);if(vh.substring(0,1)=='|')vh=vh.substring(1);if(vh.substring(
vh.length-1,vh.length)=='|')vh=vh.substring(0,vh.length-1);vh=v
+'=[PCC]'+(vh?'|'+vh:'');s_c_w(c,vh,e);if(s_vh_gt(k,v)!='[PCC]')
return 0;vh=s_rep(vh,'[PCC]',st);s_c_w(c,vh,e)}return 1}

/************* DO NOT ALTER ANYTHING BELOW THIS LINE ! **************/
var s_linkType,s_linkName,s_objectID,s_un,s_ios=0,s_q='',s_code='',
code='',s_bcr=0,s_lnk='',s_eo='',s_vb,s_pl,s_tfs=0,s_etfs=0,s_wd=
window,s_d=s_wd.document,s_ssl=(s_wd.location.protocol.toLowerCase(
).indexOf('https')>=0),s_n=navigator,s_u=s_n.userAgent,s_apn=
s_n.appName,s_v=s_n.appVersion,s_apv,s_i,s_ie=s_v.indexOf('MSIE '),
s_ns6=s_u.indexOf('Netscape6/');if(s_v.indexOf('Opera')>=0||
s_u.indexOf('Opera')>=0)s_apn='Opera';var s_isie=(s_apn==
'Microsoft Internet Explorer'),s_isns=(s_apn=='Netscape'),s_isopera=(
s_apn=='Opera'),s_ismac=(s_u.indexOf('Mac')>=0);if(s_ie>0){s_apv=
parseInt(s_i=s_v.substring(s_ie+5));if(s_apv>3)s_apv=parseFloat(s_i)}
else if(s_ns6>0)s_apv=parseFloat(s_u.substring(s_ns6+10));else s_apv=
parseFloat(s_v);function s_fl(s,l){return s?(s+'').substring(0,l):s}
function s_co(o){if(!o)return o;var n=new Object,x;for(x in o)if(
x.indexOf("select")<0&&x.indexOf("filter")<0)n[x]=o[x];return n}
function s_num(x){var s=x.toString(),g='0123456789',p,d
for(p=0;p<s.length;p++){d=s.substring(p,p+1);if(g.indexOf(d)<0)
return 0}return 1}function s_rep(s,o,n){var i=s.indexOf(o),l=n.length>
0?n.length:1;while(s&&i>=0){s=s.substring(0,i)+n+s.substring(i
+o.length);i=s.indexOf(o,i+l)}return s}function s_ape(s){return s?
s_rep(escape(''+s),'+','%2B'):s}function s_epa(s){return s?unescape(
s_rep(''+s,'+',' ')):s}function s_pt(s,d,f,a){var t=s,x=0,y,r;while(t)
{y=t.indexOf(d);y=y<0?t.length:y;t=t.substring(0,y);r=f(t,a);if(r)
return r;x+=y+d.length;t=s.substring(x,s.length);t=x<s.length?t:''}
return ''}function s_isf(t,a){if(t.substring(0,2)=='s_')t=t.substring(
2);return (t!=''&&t==a)}function s_fsf(t,a){if(s_pt(a,',',s_isf,t))
s_fsg+=(s_fsg!=''?',':'')+t;return 0}var s_fsg;function s_fs(s,f){
s_fsg='';s_pt(s,',',s_fsf,f);return s_fsg}var s_c_d=''
function s_c_gdf(t,a){if(!s_num(t))return 1;return 0}function s_c_gd()
{var d=s_wd.location.hostname,n=s_gg('cookieDomainPeriods'),p;if(d&&
!s_c_d){n=n?parseInt(n):2;n=n>2?n:2;p=d.lastIndexOf('.');while(p>=0&&
n>1){p=d.lastIndexOf('.',p-1);n--}s_c_d=p>0&&s_pt(d,'.',s_c_gdf,0)?
d.substring(p):''}return s_c_d}function s_c_r(k){k=s_ape(k);var c=' '
+s_d.cookie,s=c.indexOf(' '+k+'='),e=s<0?s:c.indexOf(';',s),v=s<0?'':
s_epa(c.substring(s+2+k.length,e<0?c.length:e));return v!='[[B]]'?v:''
}function s_c_w(k,v,e){var d=s_c_gd(),l=s_gg('cookieLifetime'),s;v=''
+v;l=l?(''+l).toUpperCase():'';if(e&&l!='SESSION'&&l!='NONE'){s=(v!=
''?parseInt(l?l:0):-60);if(s){e=new Date;e.setTime(e.getTime()+(s*1000
))}}if(k&&l!='NONE'){s_d.cookie=k+'='+s_ape(v!=''?v:'[[B]]')+'; '
+'path=/;'+(e&&l!='SESSION'?' expires='+e.toGMTString()+';':'')+(d?
' domain='+d+';':'');return s_c_r(k)==v}return 0}function s_cet(f,a,
et,oe,fb){var r,d=0
/*@cc_on@if(@_jscript_version>=5){try{return f(a)}catch(e){return et(e)}d=1}@end@*/
if(!d){if(s_ismac&&s_u.indexOf('MSIE 4')>=0)return fb(a);else{
s_wd.s_oe=s_wd.onerror;s_wd.onerror=oe;r=f(a);s_wd.onerror=s_wd.s_oe
return r}}}function s_gtfset(e){return s_tfs}function s_gtfsoe(e){
s_wd.onerror=s_wd.s_oe;s_etfs=1;var code=s_gs(s_un);if(code)s_d.write(
code);s_etfs=0;return true}function s_gtfsfb(a){return s_wd}
function s_gtfsf(w){var p=w.parent,l=w.location;s_tfs=w;if(p&&
p.location!=l&&p.location.host==l.host){s_tfs=p;return s_gtfsf(s_tfs)}
return s_tfs}function s_gtfs(){if(!s_tfs){s_tfs=s_wd;if(!s_etfs)s_tfs=
s_cet(s_gtfsf,s_tfs,s_gtfset,s_gtfsoe,s_gtfsfb)}return s_tfs}
function s_ca(un){un=un.toLowerCase();var ci=un.indexOf(','),fun=ci<0?
un:un.substring(0,ci),imn='s_i_'+fun;if(s_d.images&&s_apv>=3&&
!s_isopera&&(s_ns6<0||s_apv>=6.1)){s_ios=1;if(!s_d.images[imn]&&(
!s_isns||(s_apv<4||s_apv>=5))){s_d.write('<im'+'g name="'+imn
+'" height=1 width=1 border=0 alt="">');if(!s_d.images[imn])s_ios=0}}}
function s_it(un){s_ca(un)}function s_mr(un,sess,q,ta){un=
un.toLowerCase();var ci=un.indexOf(','),fun=ci<0?un:un.substring(0,ci
),unc=s_rep(fun,'_','-'),imn='s_i_'+fun,ns=s_gg('visitorNamespace'),
im,b,e,rs='http'+(s_ssl?'s':''
)+'://'+(ns?ns:(s_ssl?'102':unc))+'.112.2O7.net/b/ss/'+un+'/1/G.9-Pd-R/'
+sess+'?[AQB]&ndh=1'+(q?q:'')+(s_q?s_q:'')+'&[AQE]';if(s_ios){im=s_wd[
imn]?s_wd[imn]:s_d.images[imn];if(!im)im=s_wd[imn]=new Image;im.src=rs
if(rs.indexOf('&pe=')>=0&&(!ta||ta=='_self'||ta=='_top'||(s_wd.name&&
ta==s_wd.name))){b=e=new Date;while(e.getTime()-b.getTime()<500)e=
new Date}return ''}return '<im'+'g sr'+'c="'+rs
+'" width=1 height=1 border=0 alt="">'}function s_gg(v){var g='s_'+v
return s_wd[g]||s_wd.s_disableLegacyVars?s_wd[g]:s_wd[v]}var s_qav=''
function s_havf(t,a){var b=t.substring(0,4),s=t.substring(4),n=
parseInt(s),k='s_g_'+t,m='s_vpm_'+t,q=t,v=s_gg('linkTrackVars'),e=
s_gg('linkTrackEvents');if(!s_wd['s_'+t])s_wd['s_'+t]='';s_wd[k]=s_wd[
m]?s_wd['s_vpv_'+t]:s_gg(t);if(s_lnk||s_eo){v=v?v+',pageName,pageURL,'
+'referrer,charSet,visitorNamespace,cookieDomainPeriods,cookieLifetim'
+'e,currencyCode,purchaseID':'';if(v&&!s_pt(v,',',s_isf,t))s_wd[k]=''
if(t=='events'&&e)s_wd[k]=s_fs(s_wd[k],e)}s_wd[m]=0;if(t=='pageURL')q=
'g';else if(t=='referrer')q='r';else if(t=='charSet')q='ce';else if(
t=='visitorNamespace')q='ns';else if(t=='cookieDomainPeriods')q='cdp'
else if(t=='cookieLifetime')q='cl';else if(t=='currencyCode')q='cc'
else if(t=='channel')q='ch';else if(t=='campaign')q='v0';else if(
s_num(s)){if(b=='prop')q='c'+n;else if(b=='eVar')q='v'+n;else if(b==
'hier'){q='h'+n;s_wd[k]=s_fl(s_wd[k],255)}}if(s_wd[k]&&t!='linkName'&&
t!='linkType')s_qav+='&'+q+'='+s_ape(s_wd[k]);return ''}
function s_hav(){var n,av='charSet,visitorNamespace,cookieDomainPerio'
+'ds,cookieLifetime,pageName,pageURL,referrer,channel,server,pageType'
+',campaign,state,zip,events,products,currencyCode,purchaseID,linkNam'
+'e,linkType';for(n=1;n<51;n++)av+=',prop'+n+',eVar'+n+',hier'+n
s_qav='';s_pt(av,',',s_havf,0);return s_qav}function s_lnf(t,h){t=t?
t.toLowerCase():'';h=h?h.toLowerCase():'';var te=t.indexOf('=');if(t&&
te>0&&h.indexOf(t.substring(te+1))>=0)return t.substring(0,te)
return ''}function s_ln(h){if (s_gg('linkNames'))return s_pt(s_gg(
'linkNames'),',',s_lnf,h);return ''}function s_ltdf(t,h){t=t?
t.toLowerCase():'';h=h?h.toLowerCase():'';var qi=h.indexOf('?');h=qi>=
0?h.substring(0,qi):h;if(t&&h.substring(h.length-(t.length+1))=='.'+t)
return 1;return 0}function s_ltef(t,h){t=t?t.toLowerCase():'';h=h?
h.toLowerCase():'';if(t&&h.indexOf(t)>=0)return 1;return 0}
function s_lt(h){var lft=s_gg('linkDownloadFileTypes'),lef=s_gg(
'linkExternalFilters'),lif=s_gg('linkInternalFilters')?s_gg(
'linkInternalFilters'):s_wd.location.hostname;h=h.toLowerCase();if(
s_gg('trackDownloadLinks')&&lft&&s_pt(lft,',',s_ltdf,h))return 'd';if(
s_gg('trackExternalLinks')&&(lef||lif)&&(!lef||s_pt(lef,',',s_ltef,h)
)&&(!lif||!s_pt(lif,',',s_ltef,h)))return 'e';return ''}function s_lc(
e){s_lnk=s_co(this);s_gs('');s_lnk='';if(this.s_oc)return this.s_oc(e)
return true}function s_ls(){var l,ln,oc
for(ln=0;ln<s_d.links.length;ln++){l=s_d.links[ln];oc=l.onclick?
l.onclick.toString():'';if(oc.indexOf("s_gs(")<0&&oc.indexOf("s_lc(")<
0){l.s_oc=l.onclick;l.onclick=s_lc}}}function s_bc(e){s_eo=
e.srcElement?e.srcElement:e.target;s_gs('');s_eo=''}function s_ot(o){
var a=o.type,b=o.tagName;return (a&&a.toUpperCase?a:b&&b.toUpperCase?
b:o.href?'A':'').toUpperCase()}function s_oid(o){var t=s_ot(o),p=
o.protocol,c=o.onclick,n='',x=0;if(!o.s_oid){if(o.href&&(t=='A'||t==
'AREA')&&(!c||!p||p.toLowerCase().indexOf('javascript')<0))n=o.href
else if(c){n=s_rep(s_rep(s_rep(s_rep(c.toString(),"\r",''),"\n",''),
"\t",''),' ','');x=2}else if(o.value&&(t=='INPUT'||t=='SUBMIT')){n=
o.value;x=3}else if(o.src&&t=='IMAGE')n=o.src;if(n){o.s_oid=s_fl(n,100
);o.s_oidt=x}}return o.s_oid}function s_rqf(t,un){var e=t.indexOf('='
),u=e>=0?','+t.substring(0,e)+',':'';return u&&u.indexOf(','+un+',')>=
0?s_epa(t.substring(e+1)):''}function s_rq(un){var c=un.indexOf(','),
v=s_c_r('s_sq'),q='';if(c<0)return s_pt(v,'&',s_rqf,un);return s_pt(
un,',',s_rq,0)}var s_sqq,s_squ;function s_sqp(t,a){var e=t.indexOf('='
),q=e<0?'':s_epa(t.substring(e+1));s_sqq[q]='';if(e>=0)s_pt(
t.substring(0,e),',',s_sqs,q);return 0}function s_sqs(un,q){s_squ[un]=
q;return 0}function s_sq(un,q){s_sqq=new Object;s_squ=new Object
s_sqq[q]='';var k='s_sq',v=s_c_r(k),x,c=0;s_pt(v,'&',s_sqp,0);s_pt(un,
',',s_sqs,q);v='';for(x in s_squ)s_sqq[s_squ[x]]+=(s_sqq[s_squ[x]]?
',':'')+x;for(x in s_sqq)if(x&&s_sqq[x]&&(x==q||c<2)){v+=(v?'&':'')
+s_sqq[x]+'='+s_ape(x);c++}return s_c_w(k,v,0)}function s_wdl(e){
s_wd.s_wd_l=1;var r=true;if(s_wd.s_ol)r=s_wd.s_ol(e);if(s_wd.s_ls)
s_wd.s_ls();return r}function s_wds(un){un=un.toLowerCase()
s_wd.s_wd_l=1;if(s_apv>3&&(!s_isie||!s_ismac||s_apv>=5)){s_wd.s_wd_l=0
if(!s_wd.s_unl)s_wd.s_unl=new Array;s_wd.s_unl[s_wd.s_unl.length]=un
if(s_d.body&&s_d.body.attachEvent){if(!s_wd.s_bcr&&
s_d.body.attachEvent('onclick',s_bc))s_wd.s_bcr=1}else if(s_d.body&&
s_d.body.addEventListener){if(!s_wd.s_bcr&&s_d.body.addEventListener(
'click',s_bc,false))s_wd.s_bcr=1}else{if(!s_wd.s_olr){s_wd.s_ol=
s_wd.onload;s_wd.onload=s_wdl}s_wd.s_olr=1}}}function s_iepf(i,a){if(
i.substring(0,1)!='{')i='{'+i+'}';if(s_d.body.isComponentInstalled(i,
'ComponentID')){var n=s_pl.length;s_pl[n]=new Object;s_pl[n].name=i
+':'+s_d.body.getComponentVersion(i,'ComponentID')}return 0}
function s_vs(un,x){var s=s_gg('visitorSampling'),g=s_gg(
'visitorSamplingGroup'),k='s_vsn_'+un+(g?'_'+g:''),n=s_c_r(k),e=
new Date,y=e.getYear();e.setYear(y+10+(y<1900?1900:0));if(s){s*=100
if(!n){if(!s_c_w(k,x,e))return 0;n=x}if(n%10000>s)return 0}return 1}
function s_gs(un){un=un.toLowerCase()
s_un=un;var trk=1,tm=new Date,sed=Math&&Math.random?Math.floor(
Math.random()*10000000000000):tm.getTime(),sess='s'+Math.floor(
tm.getTime()/10800000)%10+sed,yr=tm.getYear(),tfs=s_gtfs(),t,ta='',q=
'',qs='';yr=yr<1900?yr+1900:yr;t=tm.getDate()+'/'+tm.getMonth()+'/'+yr
+' '+tm.getHours()+':'+tm.getMinutes()+':'+tm.getSeconds()+' '
+tm.getDay()+' '+tm.getTimezoneOffset();if(!s_q){var tl=tfs.location,
s='',c='',v='',p='',bw='',bh='',j='1.0',k=s_c_w('s_cc','true',0)?'Y':
'N',hp='',ct='',iepl=s_gg('iePlugins'),pn=0,ps;if(s_apv>=4)s=
screen.width+'x'+screen.height;if(s_isns||s_isopera){if(s_apv>=3){j=
'1.1';v=s_n.javaEnabled()?'Y':'N';if(s_apv>=4){j='1.2';c=
screen.pixelDepth;bw=s_wd.innerWidth;bh=s_wd.innerHeight;if(s_apv>=
4.06)j='1.3'}}s_pl=s_n.plugins}else if(s_isie){if(s_apv>=4){v=
s_n.javaEnabled()?'Y':'N';j='1.2';c=screen.colorDepth;if(s_apv>=5){bw=
s_d.documentElement.offsetWidth;bh=s_d.documentElement.offsetHeight;j=
'1.3';if(!s_ismac&&s_d.body){s_d.body.addBehavior("#default#homePage")
hp=s_d.body.isHomePage(tl)?"Y":"N";s_d.body.addBehavior(
"#default#clientCaps");ct=s_d.body.connectionType;if(iepl){s_pl=
new Array;s_pt(iepl,',',s_iepf,'')}}}}else r='';if(!s_pl&&iepl)s_pl=
s_n.plugins}if(s_pl)while(pn<s_pl.length&&pn<30){ps=s_fl(s_pl[pn
].name,100)+';';if(p.indexOf(ps)<0)p+=ps;pn++}s_q=(s?'&s='+s_ape(s):''
)+(c?'&c='+s_ape(c):'')+(j?'&j='+j:'')+(v?'&v='+v:'')+(k?'&k='+k:'')+(
bw?'&bw='+bw:'')+(bh?'&bh='+bh:'')+(ct?'&ct='+s_ape(ct):'')+(hp?'&hp='
+hp:'')+(s_vb?'&vb='+s_vb:'')+(p?'&p='+s_ape(p):'')}if(s_gg(
'usePlugins'))s_wd.s_doPlugins();var l=s_wd.location,r=
tfs.document.referrer;if(!s_gg("pageURL"))s_wd.s_pageURL=s_fl(l?l:'',
255);if(!s_gg("referrer"))s_wd.s_referrer=s_fl(r?r:'',255);q+=(t?'&t='
+s_ape(t):'')+s_hav();if(s_lnk||s_eo){var o=s_eo?s_eo:s_lnk;if(!o)
return '';var p=s_wd.s_g_pageName,w=1,t=s_ot(o),n=s_oid(o),x=o.s_oidt,
h,l,i,oc;if(s_eo&&o==s_eo){while(o&&!n&&t!='BODY'){o=o.parentElement?
o.parentElement:o.parentNode;if(!o)return '';t=s_ot(o);n=s_oid(o);x=
o.s_oidt}oc=o.onclick?o.onclick.toString():'';if(oc.indexOf("s_gs(")>=
0)return ''}ta=o.target;h=o.href?o.href:'';i=h.indexOf('?');h=s_gg(
'linkLeaveQueryString')||i<0?h:h.substring(0,i);l=s_gg('linkName')?
s_gg('linkName'):s_ln(h);t=s_gg('linkType')?s_gg('linkType'
).toLowerCase():s_lt(h);if(t&&(h||l))q+='&pe=lnk_'+(t=='d'||t=='e'?
s_ape(t):'o')+(h?'&pev1='+s_ape(h):'')+(l?'&pev2='+s_ape(l):'');else
trk=0;if(s_gg('trackInlineStats')){if(!p){p=s_wd.s_g_pageURL;w=0}t=
s_ot(o);i=o.sourceIndex;if(s_gg('objectID')){n=s_gg('objectID');x=1;i=
1}if(p&&n&&t)qs='&pid='+s_ape(s_fl(p,255))+(w?'&pidt='+w:'')+'&oid='
+s_ape(s_fl(n,100))+(x?'&oidt='+x:'')+'&ot='+s_ape(t)+(i?'&oi='+i:'')}
s_wd.s_linkName=s_wd.s_linkType=s_wd.s_objectID=s_lnk=s_eo='';if(
!s_wd.s_disableLegacyVars)s_wd.linkName=s_wd.linkType=s_wd.objectID=''
}if(!trk&&!qs)return '';var code='';if(un){if(trk&&s_vs(un,sed))code+=
s_mr(un,sess,q+(qs?qs:s_rq(un)),ta);s_sq(un,trk?'':qs)}else if(
s_wd.s_unl)for(var unn=0;unn<s_wd.s_unl.length;unn++){un=s_wd.s_unl[
unn];if(trk&&s_vs(un,sed))code+=s_mr(un,sess,q+(qs?qs:s_rq(un)),ta)
s_sq(un,trk?'':qs)}return code}function s_dc(un){un=un.toLowerCase()
s_wds(un);s_ca(un);return s_gs(un)}
s_code=s_dc(s_account);if(s_code)s_d.write(s_code)

// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//	*** end vanilla omniture ***
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------

// put this just on the NG homepage and the NGM homepage.
var ngc_retargeting_pixel_2913_pathname = window.location.pathname;
	
// depending on the path set different omniture variables
if (window.location.hostname == 'www.nationalgeographic.com'){
	if ((ngc_retargeting_pixel_2913_pathname == '/')||(ngc_retargeting_pixel_2913_pathname == '/index.html')){
		document.write('<scr' +'ipt language="JavaSc'+'ript" src="http://www3.nationalgeographic.com/stats/ax/ngc_retargeting_pixel_2913.js"></scr'+'ipt>');		
	}
}
else{
	if (ngc_retargeting_pixel_2913_pathname == '/ngm/ngm.html'){
		document.write('<scr' +'ipt language="JavaSc'+'ript" src="http://www3.nationalgeographic.com/stats/ax/ngc_retargeting_pixel_2913.js"></scr'+'ipt>');
	}
}
