// HP Common Metrics Architecture 20050829a
// BEGIN Clickstream:
var s_hp_optOut = false // WARNING: IF SET TO TRUE, PAGE WILL NOT BE TRACKED
// Common Dynamic Account structure - please do not use unless authorized by CKM&A Ops
var s_dynamicAccountSelection=false;
var s_dynamicAccountList="devhphqtestaccount=localhost";
var s_dynamicAccountMatch=window.location.hostname;

var s_trackDownloadLinks=true
var s_trackExternalLinks=true
var s_trackInlineStats=true
var s_linkDownloadFileTypes="exe,zip,wav,mp3,mov,mpg,avi,doc,pdf,xls,cgi,dot,pot,ppt,wmv,asx"
var s_linkInternalFilters="hp,compaq,cpqcorp,javascript:"
var s_linkLeaveQueryString=true

if (!(window.s_account)){
	var s_account="hphqglobal,hphqwwhpbrandstore";
}

/** Code which segments different websections **/
var url = (window.location.hostname+window.location.pathname).toLowerCase();
var pqs = window.location.href.split(window.location.hostname)[1];
var s_prop49 = url;
var s_prop50= window.location.href;




// Common metrics plugin function - do not remove

function s_hp_doMetricsPlugins() { 
	
	if(window.hpmmd) {
		pg = hpmmd.page;
		ur = hpmmd.user;
		pd = hpmmd.product;
		
		/* Page Level Values*/
		if (!pg.country){
			pg.country=window.s_prop7!=null?window.s_prop7:"undef"
		}
		if (!pg.country){
			pg.language=window.s_prop8!=null?window.s_prop8:"undef"
		}
		pg.segment = window.s_prop9!=null?window.s_prop9:"";
		_prv_defRegion (window.s_prop7); // define region as per the country//

		pg.name = pg.name!=null?pg.name:pqs; // pqs = path with query string //
		pg.pagetype = pg.pagetype!=null?pg.pagetype:"others";
		
		/* User Level Values*/
		ur.usertype = ur.usertype!=null?ur.usertype:"guest";
		
		/* Internal Search Details */
		if (pg.pagetype=="search"){
			s_prop6 = pg.searchterm
		}

		/* Product Level Values*/
		pd.category = pd.category!=null?pd.category:""; // Product Category name //
		pd.productname = pd.productname!=null?pd.productname:""; // Product Name //
		pd.productsku = pd.productsku!=null?pd.productsku:""; // Product Sku //
		
		var cl = pg.country + ":" + pg.language;
		

		/* Variable Mapping */
		s_pageName = ("hpbrands:"+cl+ ":" + pg.pagetype+ ":" + pg.name).toLowerCase();

		s_hier1=(pg.region+":"+cl+":"+pg.pagetype+":"+pg.name).toLowerCase();
		s_hier2=(pg.region+":"+cl).toLowerCase();

		s_eVar1=cl+":"+pg.segment;
		s_eVar5 = pg.region+":"+cl+":"+"hpbrandstore";
		s_eVar10 = ur.usertype;
		s_prop14 = ur.usertype;
		s_eVar46 = s_pageName;
		
		// This is for the product view Page //
		if (pg.pagetype=="product"){
			s_events = "event5";
			s_products= pd.category+";"+ pd.productsku
		}
	}
}

/*** DO NOT MODIFY THIS SECTION ***/
/* Under no circumstances should you modify this code */
s_hp_includeJavaScriptFile("welcome.hp-ww.com","/cma/metrics/sc/s_code_remote.js");
function s_hp_includeJavaScriptFile(hp_hostname,hp_path) {
	if(!(window.s_hp_optOut && window.s_hp_optOut == true)) {
		var hp_ssl=(window.location.protocol.toLowerCase().indexOf('https')!=-1)
		if(hp_hostname && hp_hostname.length>0) {
			if(hp_ssl == true && hp_hostname.toLowerCase().indexOf("welcome.") != -1) { hp_hostname = "secure.hp-ww.com"; }
			var fullURL = "http" + (hp_ssl?"s":"") + "://" + hp_hostname + hp_path
		}
		else
			var fullURL=hp_path;
		document.write("<sc" + "ript language=\"JavaScript\" src=\""+fullURL+"\"></sc" + "ript>");
	}
}
// END Clickstream:

function _prv_defRegion(cc) {
	if(hpmmd.page!=null) {
		var cc1=(cc!=null?cc.toLowerCase():"")+":";
		var ap="au:cn:hk:hk:in:id:jp:kr:my:nz:ph:sg:tw:th:vn:",
			emea="emea_africa:at:be:be:by:bg:hr:cz:dk:ee:fi:fr:de:gr:hu:ie:il:it:kz:lv:lt:emea_middle_east:nl:no:pl:pt:ro:ru:rs:sk:si:za:es:se:ch:ch:tr:ua:uk:",
			na="us:ca:",la="ar:bo:br:lamerica_nsc_carib:lamerica_nsc_cnt_amer:cl:co:ec:mx:py:pe:pr:uy:ve:";
		if(na.indexOf(cc1)!=-1) { 	
			hpmmd.page.region="na";
			return;
		} 
		if(emea.indexOf(cc1)!=-1) { 	
			hpmmd.page.region= "emea";
			return;
		} 
		if(ap.indexOf(cc1)!=-1) { 	
			hpmmd.page.region= "apj";
			return;
		} 
		if(la.indexOf(cc1)!=-1) { 	
			hpmmd.page.region= "la";
			return;
		} 
	}
}
