function setMilestone(pageCode)
{
	var mileStonesCookie = getTrackCookie("mlstn");
	var mileStones = new Array();
	if (mileStonesCookie)
	{
		var mileStones = mileStonesCookie.split(">");
		for (var i = 0; i < mileStones.length; i++)
		{
			if (mileStones[i] == pageCode)
			{
				// Remove this and all the succeeding page codes.
				mileStones.splice(i, mileStones.length - i);
			}
		}
	}
	// Add the page to the array, collapse, reset cookie, and send to Omniture
	mileStones.push(pageCode);
	mileStonesCookie = mileStones.join(">");
	setTrackCookie("mlstn", mileStonesCookie);
}

function setTrackCookie(key, value)
{	
	// Get the omniture tracking cookie
	var cookie_val = GetCookie("otc");
	if (cookie_val == "" || cookie_val == null)
	{
		// First setting of tracking cookie
		cookie_val = key + "#" + value + ";";
	}
	else
	{
		// Create the regular expression that will match
		// individual cookies in the combined cookie
		var r = new RegExp(key + "#(.*?);");
		if (res = cookie_val.match(r))
		{
			// Key exists, change value
			cookie_val = cookie_val.replace(r,key + "#" +value + ";");
		}
		else
		{
			// New cookie... append key value pair
			cookie_val += key + "#" + value + ";";
		}
	}
	var expiration = new Date();
	expiration.setTime(expiration.getTime() + 60*60*24*90*1000);
	sbweb.util.cookies.setCookie("otc",cookie_val,expiration,"/","intuit.com");
}

function getTrackCookie(key)
{
	var cookie_val = GetCookie("otc");
	if (cookie_val != "" && cookie_val != null)
	{
		var r = new RegExp(key + "#(.*?);");
		if(res = cookie_val.match(r))
		{
			return res[1];
		}
	}
	return "";
}

/*
function addTrackParams(link)
{
	var oadm = getTrackCookie("mlstn");
	var oadfs = getTrackCookie("source");
	var href = link.href;
	
	var params = new Array();
	if (oadm != "")
	{
		params.push("oad_m=" + oadm);
	}
	if (oadfs != "")
	{
		params.push("oad_fs=" + oadfs);
	}
	
	if (params.length > 0)
	{
		paramstring=params.join("&");
		
		if (href.indexOf("?") == -1)
		{
			href += "?" + paramstring;
		}
		else
		{
			href += "&" + paramstring;
		}
	}
	link.href = href;
	return true;
}
*/
