<!--
var cmdebug = "NO";//turn debug on and off with this value

/*
	This sets the initial referrer to be used by the getReferrer function when tracking the home page.
	This is constantly being updated by the getReferrer function to store the last url you were at.
*/
var current_ref_url = document.referrer;


/**
	This function returns either a remote URL which the user came from, or the last action tag that was tracked

	@function getReferrer	
	@param actionTag A string that is basically the tracking ID
*/
function getReferrer(actionTag) {
	
	var refUrl = "" ;
	var next_ref_url = "" ;
   
	if( actionTag && actionTag != null && actionTag != "" ) {
		next_ref_url = actionTag ;
	}

	/* If in frameset mode, look at the parent.cm_ref variable */
	if (parent.cm_ref && parent.cm_ref != null) {
		refUrl = parent.cm_ref ;
		parent.cm_ref = document.URL;
	}
   
	/* If no frameset, just look at the document properties */
	else {
		refUrl = current_ref_url ;
		current_ref_url = next_ref_url ;
	}
   

	if( cmdebug && cmdebug != null && cmdebug.toUpperCase() == "YES" ) {
		alert("referrer: " + refUrl) ;
	}

	if ( refUrl && refUrl != null && refUrl != "" ) {
		if (refUrl.indexOf("nike.com/nikegoddess") > 0) { return "http://NIKEGODDESS.REF?refUrl="+refUrl;}
		if (refUrl.indexOf("nike.com/nikebasketball") > 0) { return "http://NIKEBASKETBALL.REF?refUrl="+refUrl;}
		if (refUrl.indexOf("nike.com/jumpman23") > 0) { return "http://JUMPMAN23.REF?refUrl="+refUrl;}
		if (refUrl.indexOf("nike.com/acg") > 0) { return "http://ACG.REF?refUrl="+refUrl;}
		if (refUrl.indexOf("nike.com/nikegolf") > 0) { return "http://NIKEGOLF.REF?refUrl="+refUrl;}
		if (refUrl.indexOf("nike.com/nikehockey") > 0) { return "http://NIKEHOCKEY.REF?refUrl="+refUrl;}
		if (refUrl.indexOf("nike.com/nikebiz") > 0) { return "http://NIKEBIZ.REF?refUrl="+refUrl;}
		if (refUrl.indexOf("nike.com/nikeid") > 0) { return "http://NIKEID.REF?refUrl="+refUrl;}
		if (refUrl.indexOf("nike.com/nikepresto") > 0) { return "http://NIKEPRESTO.REF?refUrl="+refUrl;}
		if (refUrl.indexOf("nike.com/nikefootball") > 0) { return "http://NIKEFOOTBALL.REF?refUrl="+refUrl;}
		if (refUrl.indexOf("nike.com/nikesphere") > 0) { return "http://NIKESPHERE.REF?refUrl="+refUrl;}
		if (refUrl.indexOf("nike.com/usa") > 0) {return "http://NIKEUSA.REF?refUrl="+refUrl;}
		return refUrl;
	}
    
	return null ;

}


/*
	Not sure what cm_search is used for.
	It's probably a feature of coremetrics which we do not implement
*/
var cm_search = "";


/**
	Creates a simple page view tag
	
	@function cmCreatePageViewTag	
	@param actionTag String a keyword passed by flash to identify the section of the site being viewed
*/
function cmCreatePageViewTag(actionTag) {

	
      
	/* If it's the homepage, it needs to do the technical properties 
         save instead of the standard createPageView */
	if( (homePageName && (homePageName != null)) && 
          (actionTag && (actionTag != null) ) &&
          (homePageName.toUpperCase() == actionTag.toUpperCase()) ) {

	    cmCreateHomePageTag(actionTag) 	

	    return ;	
	}
    
      var cm = new _cm("tid", "1", "vn2", "e3.1");
	cm.rf = getReferrer(actionTag);
	if (cm_search == null)
		cm_search = "";
	cm.se = cm_search;
	cm.pi = actionTag;

      if( dest_url && dest_url != null ) {
		cm.ul = dest_url ;
	}

	if( cmdebug && cmdebug != null && cmdebug.toUpperCase() == "YES" ) {
		alert("cmCreatePageViewTag: " + cm.pi) ;
	}
	cm.loadImg();
		
}



/**
	Creates home page tag
	
	@function cmCreateHomePageTag
	
	@param actionTag String a keyword passed by flash to identify the section of the site being viewed
*/
function cmCreateHomePageTag(actionTag) {
	
	var cm = new _cm("tid", "6", "vn2", "e3.1");

	cm.pi = actionTag;
	
	cm.pc = "Y";
	cm.rf = getReferrer(actionTag) ;
	cm.addTP();

	if( dest_url && dest_url != null ) {
		cm.ul = dest_url ;
	}

	if( cmdebug && cmdebug != null && cmdebug.toUpperCase() == "YES" ) {
		alert("cmCreateHomePageTag (techProps): " + actionTag ) ;
		alert("destination url " + cm.ul) ;
	}

	cm.loadImg();

}



/**
	Creates a registration tag in the following format: 
 
	Newsletter Name = <newsletter_name> (Only required if subscribed = "Y")
	Subscribed Flag = <subscribed>
		NOTE: subscribed MUST be either the string "Y" or "N"  If subscribed = "Y", you must
 		set newsletter_name
	Customer ID = <cust_id>
	Zip Code = <zip>
	
	@function cmCreateRegistrationTag
	
	@param newsletter_name String
	@param subscribed String
	@param cust_id String
	@param zip String
	
*/
function cmCreateRegistrationTag(newsletter_name, subscribed, cust_id, zip) {

	var cm = new _cm("tid", "2", "vn2", "e3.1");

	cm.rf = getReferrer("registration");

	if (subscribed == "Y") {
		cm.sd = "Y";
		cm.nl = newsletter_name;
	} else {
		cm.sd = "N";
	}

      if( cmdebug && cmdebug != null && cmdebug.toUpperCase() == "YES" ) {
		alert("cmCreateRegistrationTag: " + newsletter_name ) ;
	}

	cm.cd = cust_id;
	cm.zp = zip;
	
	cm.pc = "Y";

	cm.loadImg();
}



/**
	Creates a product tag in the following format:
	
	Page ID = PRODUCT: <cat_name> (<cat_id>):<prod_name> (<prod_id>)
	Product ID = <prod_id>
	Product Name = <prod_name>
	Category ID = <cat_id>
	Category Name = <cat_name>
	
	Page count = "Y"
	Category name should be removed if a CDF is provided.
 
 	Category name and id should be added to the page id if the customer
 	determines they want to see that in MarketForce pages
 	
 	@function cmCreateProductTag
 	
 	@param cat_name
 	@param cat_id
 	@param prod_name
 	@param prod_id
 	
 */
function cmCreateProductTag(cat_name, cat_id, prod_name, prod_id) {
	
	var cm = new _cm("tid", "5", "vn2", "e3.1");  //DO NOT CHANGE THESE PARAMETERS
	
	cm.rf = getReferrer(prod_name);
	cm.pi = "PRODUCT: " + prod_name + " (" + prod_id + ")";
	cm.pr = prod_id;
	cm.pm = prod_name;
	cm.cg = cat_id;
	cm.cl = cat_name;
	cm.pc = "Y";

	 if( cmdebug && cmdebug != null && cmdebug.toUpperCase() == "YES" ) {
		alert("cmCreateProductTag: " + prod_name + " - " + prod_id ) ;
	 }


	cm.loadImg();
}


/**
	Creates an error tag
	
	@function cmCreateErrorTag	
*/
function cmCreateErrorTag() {
	
	var cm = new _cm("tid", "404", "vn2", "e3.1");

	cm.rf = getReferrer();

	cm.pi = getFileNameFromURL(false,false);

	cm.loadImg();
}

//-->
 
