// HP Common Metrics Architecture 20051223a
// 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=""
var s_dynamicAccountMatch=window.location.hostname

if (!(window.s_account)){
	var s_account="hphqglobal"
}
var s_trackDownloadLinks=true
var s_trackExternalLinks=false
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() {
	// Wrapper Code to add all the fast search variables //
	noSearchResJsonObj = readCookie("hho_omni_usen");
	noSearchResJsonObj = noSearchResJsonObj!=null?noSearchResJsonObj:"";
	if (noSearchResJsonObj!=null && noSearchResJsonObj !=""){
			window.hpmetrics = {}; 
			eval(unescape(noSearchResJsonObj));
			var hhoInstance = s_hp_getBeaconInstance("hphqglobal,hphqna,hphqhhorollup,hphqnahpshopping");
			if(window.hpmetrics!=null){ // REASON: if we use sendAnalyticsEvent, it will inflat pageviews numbers //
				var fs_searchTerm = hpmetrics.isearch.search_term!=null?hpmetrics.isearch.search_term:"";
				var fs_numRecords = hpmetrics.isearch.numrecords!=null?hpmetrics.isearch.numrecords:-1; // number
				var fs_numChosen = hpmetrics.isearch.numchosen!=null?hpmetrics.isearch.numchosen:-1; // number
				var fs_searchType = hpmetrics.isearch.searchtype!=null?hpmetrics.isearch.searchtype:"";
				var fs_sort = hpmetrics.isearch.sort!=null?hpmetrics.isearch.sort:""; 
				var fs_refinepath = hpmetrics.isearch.refinepath!=null?hpmetrics.isearch.refinepath:""; // numrefine variable name is replced with refinepath //
				var fs_resultSet = hpmetrics.isearch.resultset!=null?hpmetrics.isearch.resultset:-1; // number
				var fs_searchResultPage = hpmetrics.isearch.searchresultpage!=null?hpmetrics.isearch.searchresultpage:""; // true or false
				var fs_searchPlatform = hpmetrics.isearch.search_platform!=null?hpmetrics.isearch.search_platform:"";

				// If there is no search result populate search term in prop and eVar variables//
				if ((fs_searchResultPage!="" && fs_searchResultPage == true) && (fs_numRecords!=-1 && fs_numRecords == 0)){
					hhoInstance.channel = "fast: no search results"
					hhoInstance.prop15 = fs_searchTerm;
					hhoInstance.prop30 = fs_searchPlatform +"|"+ fs_searchType +"|"+ fs_sort +"|"+ fs_refinepath +"|"+fs_resultSet; //Search Type|Sort|Refinement|Result Set
					hhoInstance.eVar46 = fs_searchPlatform +"|"+ fs_searchType +"|"+ fs_sort +"|"+ fs_refinepath +"|"+fs_resultSet; //Search Type|Sort|Refinement|Result Set
					hhoInstance.pageName = "gw: us/en: search: HHOall query page";
				}
			}
			// Just in case i have added cc, lc and segment //
			hhoInstance.prop7 = window.s_prop7;
			hhoInstance.prop8 = window.s_prop8;
			hhoInstance.prop9 = window.s_prop9;
			hhoInstance.prop10 = window.s_prop7+"|"+window.s_prop8+"|"+window.s_prop9;
			s_hp_sendSecondAnalyticsEvent(hhoInstance);
			delete_cookie("hho_omni_usen");
	}
	function readCookie(cookieName) {
		 var theCookie=""+document.cookie;
		 var ind=theCookie.indexOf(cookieName);
		 if (ind==-1 || cookieName=="") return ""; 
		 var ind1=theCookie.indexOf(';',ind);
		 if (ind1==-1) ind1=theCookie.length; 
		 return unescape(theCookie.substring(ind+cookieName.length+1,ind1));
	}
/*
	function delete_cookie(cookie_name)
	{
	  var cookie_date = new Date ( );  // current date & time
	  cookie_date.setTime ( cookie_date.getTime() - 1 );
	  document.cookie = cookie_name += "=; expires=" + cookie_date.toGMTString();
	}
*/
	function delete_cookie(cookieName)
    {
      var cookieDate = new Date();  // current date & time
      cookieDate.setTime(cookieDate.getTime() - 1);
      document.cookie = cookieName + "=; expires=" + cookieDate.toGMTString() + "; path=/; domain=.hp.com";
    }
}

// Common metrics plugin function - do not remove
function s_hp_doMetricsPlugins() {
} // end function ()
var s_hp_jumpid_prop = "s_prop2" // Search uses the NA standard for Jumpids

/*** DO NOT MODIFY THIS SECTION ***/
/* Under no circumstances should you modify this code */
if(window.s_account && s_account.indexOf("hphqap") != -1) {
	s_hp_includeJavaScriptFile("welcome.hp-ww.com","/cma/region/ap/apcma.js");
} 
if(window.s_account && s_account.indexOf("hphqemea") != -1) {
	s_hp_includeJavaScriptFile("welcome.hp-ww.com","/cma/region/emea/emeacma.js");
}
if(window.s_account && s_account.indexOf("hphqna") != -1) {
	s_hp_includeJavaScriptFile("welcome.hp-ww.com","/cma/region/na/nacma.js");
}
//s_hp_includeJavaScriptFile("welcome.hp-ww.com","/cma/metrics/sc/s_code_remote.js");
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: