// HP Common Metrics Architecture 20050829a
// BEGIN Clickstream:
var s_hp_optOut = false // WARNING: IF SET TO TRUE, PAGE WILL NOT BE TRACKED
var s_channel="";
// Common Dynamic Account structure - please do not use unless authorized by CKM&A Ops
var s_dynamicAccountSelection=true;
var s_dynamicAccountList="devhphqesupport=spp-itg-site2-hpp.austin.hp.com,spp-itg-site2-athp.austin.hp.com,spp-itg-site1-hpp.austin.hp.com,spp-itg-site1-athp.austin.hp.com,spp-itg-athp.austin.hp.com,spp-itg-hpp.austin.hp.com,htx413-f.cce.hp.com,whp-java1.extweb.hp.com";
var s_dynamicAccountMatch=window.location.hostname+window.location.pathname;

if (!(window.s_account)){
	var s_account="hphqglobal,hphqwwserviceportal" // TODO: Add country-specific report suite here
}

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

function s_hp_doPostMetaTagFunction() {
	if (!(window.s_prop9)){ var s_prop9="commercial";} // defaulting segment to commercial if its not set
	if (window.s_prop7) {s_hp_setRegionVariables (window.s_prop7)}

	if (window.SP_PAGE_NAME) {
		// Define the value for pageName //
		var h_pName = window.SP_PAGE_NAME.toLowerCase();
		if (h_pName.indexOf("forums")>-1)
		{
			var forumAction = getQueryVariableFromSPFrm("spf_p.prp_fmMain")!=null?getQueryVariableFromSPFrm("spf_p.prp_fmMain"):"";
			//window.s_pageName = "sp:"+window.s_prop7+"/"+window.s_prop8+"|"+ h_pName +"|"+forumAction;
			window.s_pageName = "hpsc:"+ h_pName +"|"+forumAction;
		}
		else 
		{
			//window.s_pageName = "sp:"+window.s_prop7+"/"+window.s_prop8+"|"+ h_pName ;
			window.s_pageName = "hpsc:"+ h_pName ;
		}
		// for Search Results page
		if (h_pName.indexOf("search")>-1){
			if (window.SP_SEARCH_RESULTS==0) // When there is no search results //
				window.s_prop15 = window.SP_SEARCH_KEYWORDS;
			else 
				window.s_prop6 = window.SP_SEARCH_KEYWORDS
		}
		
		// To capture document ID //
		if (window.SP_DOC_ID){
			window.s_prop2 = window.SP_DOC_ID;
		}
	}
} // end of s_hp_doPostMetaTagFunction


// Common metrics plugin function - do not remove
function s_hp_doMetricsPlugins() { 
} 

/*** 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 s_hp_setRegionVariables(countryCode) {
	switch(countryCode.toLowerCase()) {
		case "ca":
			s_hp_region = "na";
			if (s_account.toLowerCase().indexOf("hphqna")== -1) s_account += ",hphqna";
			if (s_account.toLowerCase().indexOf("hphqnaca")== -1) s_account += ",hphqnaca";
			s_channel = "hpsc:NA:"+window.s_prop7
			if (window.s_prop8) {s_channel = s_channel+"/"+window.s_prop8;}
			break;
		case "us":
			s_hp_region = "na";
			if (s_account.toLowerCase().indexOf("hphqna")== -1) s_account += ",hphqna";
			s_channel = "hpsc:NA:"+window.s_prop7
			if (window.s_prop8) {s_channel = s_channel+"/"+window.s_prop8;}
			break;
		case "kr":
		case "cn":
		case "jp":
		case "tw":
		case "au":
		case "hk":
		case "sg":
		case "in":
		case "th":
		case "nz":
		case "my":
		case "ph":
		case "vn":
		case "id":
			s_hp_region = "ap";
			s_hp_countryRS = "hphqap"+countryCode;
			if (s_account.toLowerCase().indexOf("hphqap")== -1) s_account += ",hphqap";
			if (s_account.toLowerCase().indexOf("hphqAPsupport")== -1) s_account += ",hphqAPsupport";
			if (s_account.toLowerCase().indexOf(s_hp_countryRS)== -1) s_account += ","+s_hp_countryRS;
			s_channel = "hpsc:APJ:"+window.s_prop7
			if (window.s_prop8) {s_channel = s_channel+"/"+window.s_prop8;}
			break;
		case "de": 
		case "fr": 
		case "es": 
		case "uk": 
		case "nl": 
		case "it": 
		case "pl": 
		case "se": 
		case "be": 
		case "dk": 
		case "ch": 
		case "pt": 
		case "ru": 
		case "no": 
		case "at": 
		case "fi": 
		case "cz": 
		case "tr": 
		case "hu": 
		case "il": 
		case "gr": 
		case "za": 
		case "ie": 
		case "sk": 
		case "ro": 
		case "ua": 
		case "gb": 
		case "sa":
		case "by":
		case "emea_africa":
		case "emea_middle_east":
			s_hp_region = "emea";
			s_hp_countryRS = "hphqemea"+countryCode;
			if (s_account.toLowerCase().indexOf("hphqemea")== -1) s_account += ",hphqemea";
			if (s_account.toLowerCase().indexOf(s_hp_countryRS)== -1) s_account += ","+s_hp_countryRS;
			s_channel = "hpsc:EMEA:"+window.s_prop7
			if (window.s_prop8) {s_channel = s_channel+"/"+window.s_prop8;}
			break;
		case "lamerica_nsc_carib":
		case "lamerica_nsc_cnt_amer":
		case "br":  
		case "mx": 
		case "ar": 
		case "co": 
		case "cl": 
		case "ve": 
		case "pe": 
		case "pr": 
		case "ec": 
		case "ns": 
		case "bo": 
		case "uy": 
		case "sv": 
		case "py": 
		case "hn":
			s_hp_region = "la";
			s_hp_countryRS = "hphqla"+countryCode;
			if (s_account.toLowerCase().indexOf("hphqla")== -1) s_account += ",hphqla";
			if (s_account.toLowerCase().indexOf(s_hp_countryRS)== -1) s_account += ","+s_hp_countryRS;
			s_channel = "hpsc:LA:"+window.s_prop7
			if (window.s_prop8) {s_channel = s_channel+"/"+window.s_prop8;}
			break;
		default:
	}
	window.s_account = s_account;
}

function getQueryVariableFromSPFrm(variable) {
  var query = unescape(window.location.search.substring(1));
  var vars = query.split("&");
  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("=");
    if (pair[0] == variable) {

      return (unescape(pair[2]).split("|")[0]+"|"+unescape(pair[2]).split("|")[1]);
    }
  } 
}