/* Omniture functions */
function IsVariableSet(varName)
{
	return (typeof window[varName] != 'undefined');
}
function SetVariable(varName, defaultVal, inheritedVarName)
{
	if (!inheritedVarName) inheritedVarName = varName;
	window[varName] = IsVariableSet(inheritedVarName) ? window[inheritedVarName] : defaultVal;
	return;
}
//=========================================================================================
// This javascript is required to parse Query String information
//=========================================================================================
function PageQuery(q)
{
	if(q.length > 1)
		this.q = q.substring(1, q.length);
	else this.q = null;
		this.keyValuePairs = new Array();
	if(q)
	{
		for(var i=0; i < this.q.split("&").length; i++)
		{
			this.keyValuePairs[i] = this.q.split("&")[i];
		}
	}
	this.getValue = function(s)
	{
		for(var j=0; j < this.keyValuePairs.length; j++) 
		{
			if(this.keyValuePairs[j].split("=")[0] == s)
			return this.keyValuePairs[j].split("=")[1];
		}
		return "";
	}
}
function qs(key){
	var page = new PageQuery(parent.parent.parent.parent.location.search); 
	return unescape(page.getValue(key)); 
}
//=========================================================================================

function customEventRecord(obj,linkType,linkTitle)
{
	var s=s_gi(r_account);
	s.linkTrackVars='prop1,prop2,prop3,prop4,prop5,prop6,prop7,prop8,prop9,prop10,prop11,prop12,prop13,prop14,prop15,prop16,prop17,prop18,prop19,prop20';
	s.linkTrackEvents='event1,event2,event3,event4,event5,event6,event7,event8,event9,event10,event11,event12,event13,event14,event15,event16,event17,event18,event19,event20';
	if (!linkType) linkType = 'o';
	if (!linkTitle && obj.title) linkTitle = obj.title;
	s.tl(obj,linkType,linkTitle);
}

//Determine if we are in production based on the host
if (/^https?:\/\/(www.)?russell.com\/au\//.test(location.href))
{
	SetVariable('r_account', 'russ-rcom-au');
	SetVariable('r_siteID', 'Russell.com AU');
}
else
{
	SetVariable('r_account', 'russ-rcom-au-test');
	SetVariable('r_siteID', 'Russell AU Test');
}

SetVariable('r_pageName', document.title);
SetVariable('r_defaultChannel', 'ww');
SetVariable('r_prop2', qs("HOME"));
SetVariable('r_defaultPage', 'default.aspx');
SetVariable('r_linkInternalFilters', 'javascript:,' + location.host+'/au/');

for (var x=2; x<=8; x++)
{
	if (IsVariableSet('omniWBB' + x)) SetVariable('r_prop' + x, window['omniWBB' + x]);
}

var jsHost = (('https:' == document.location.protocol) ? 'https://' : 'http://');
document.write(unescape('%3Cscript type="text/javascript" src="' + jsHost + 'www.russell.com/common/js/s_codeglobal.js"%3E%3C/script%3E'));

