// wa_process.js Version 2.1
// Last modified by:
// Kevin Dikeman 02/0/2006
//  History */
//  Added Header to track version and history 
//  Added support for WAP 2.1 variables.


var wa_queryObj = waParseQueryString(location.search);

var	wa_pageName="",
	wa_org1="",
	wa_org2="",
	wa_org3="",
	wa_org4="",
	wa_orgX="",
	wa_geo="",
	wa_language="",
	wa_iid=""
	wa_reportSuites="",
	wa_url="",
	wa_ngipDocId="",
	wa_ngipUniqueId="",
	wa_campaign="",
	wa_events="",
	wa_custom01="",
	wa_custom02="",
	wa_custom03="",
	wa_custom04="",
	wa_custom05="",
	wa_custom06="",
	wa_custom07="",
	wa_custom08="",
	wa_custom09="",
	wa_custom10="",
	wa_custom11="",
	wa_custom12="",
	wa_custom13="",
	wa_custom14="",
	wa_custom15="",
	wa_urlQueryString="",
	wa_visitId="",
	wa_referrer="",
	wa_profileID="";





var wa_visitId = waGetCookie('wa_visitId');
if (wa_visitId == null)
{
	wa_visitId = waNewId();
}


waSetCookie('wa_visitId', wa_visitId);

function waParseQueryString(queryString)
{
	var queryObject = new Object();
	queryString = queryString.replace(/^.*\?(.+)$/,'$1');

	while ((pair = queryString.match(/([^=]+)=\'?([^\&\']*)\'?\&?/)) && pair[0].length)
	{
		queryString = queryString.substring( pair[0].length );
		if (/^\-?\d+$/.test(pair[2])) pair[2] = parseInt(pair[2]);
		queryObject[pair[1]] = pair[2];
	}
	return queryObject;
}

function waNewId()
{
	var guid = "{";
	for (var i = 1; i <= 32; i++)
	{
		var n = Math.floor(Math.random() * 16.0).toString(16);
		guid += n;
		if ((i == 8) || (i == 12) || (i == 16) || (i == 20))
			guid += "-";
	}
	guid += "}";
	return guid;
}

function waGetCookie (name)
{
	var arg = name + "=";
	var alen = arg.length;
    var clen = document.cookie.length;
    var i = 0;
    while (i < clen)
    {
		var j = i + alen;
        if (document.cookie.substring(i, j) == arg)
			return waGetCookieVal (j);
        i = document.cookie.indexOf(" ", i) + 1;
        if (i == 0)
			break;
	}
	return null;

}

function waGetCookieVal (offset)
{
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1)
		endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}

function waSetCookie (name, value)
{
	var wa_cookieExpDate = new Date ();	
	wa_cookieExpDate.setTime(wa_cookieExpDate.getTime() + (365 * 24 * 3600 * 1000));
    document.cookie = name + "=" + escape (value) +
		"; expires=" + wa_cookieExpDate.toGMTString() +
		"; path=/" +
        "; domain=.intel.com"
       
}
