function Omniture(omnitureConfigObject) {
	
	//Debug variables
	this.statSeq = 0;
		
	eval("this.objOmnitureConfig = new " + omnitureConfigObject + "()");
	//eval("this.objOmnitureConfig = new " + omnitureConfigObject + "();");
	// pull in all config values from config file into a bunch of properties defined in this object
	// these take presidence over any info passed in through other tag related methods

	for(var propName in this.objOmnitureConfig) 
	{
	// for each property in config object, 
	// create property in omniture object
	/* propName is a string containing the property name.
	* You can access the property value with obj[propName]
	*/
		if (this.objOmnitureConfig[propName]!=null && this.objOmnitureConfig[propName]!="")
		{
			eval("this." + propName + " = \"" + this.objOmnitureConfig[propName] + "\"");
			//alert(this.objOmnitureConfig[propName]);
		}
	}

	this.createPageViewTag = function createPageViewTag(page_namex,strLocale,strSection,strSubSection)
	{
		this.setOmnitureVars();
		s_account = this.getAccount();
		this.setDynamicVars(page_namex,strLocale,strSection,strSubSection);
		if (this.objOmnitureConfig.debug=="client")
		{
			this.debugOutput();
		}
		sendAnalyticsEvent(s_account); // SiteCatalyst specific
		if (this.objOmnitureConfig.debug=="server")
		{
			this.debugOutput();
		}
		this.flushVars();	
	}
	

	this.createLinkEvent = function createLinkEvent(strLinkName, type)
	{
		this.setOmnitureVars();
		s_account = this.getAccount();
		this.s_LinkName=this.objOmnitureConfig.siteName + '>' + strLinkName;
		if (this.objOmnitureConfig.debug=="client")
		{
			this.debugOutput();
		}
		sendLinkEvent(s_account,this.s_LinkName,type);//SiteCatalyst specific
		if (this.objOmnitureConfig.debug=="server")
		{
			this.debugOutput();
		}
		this.flushVars();
	}
	
	this.getAccount = function getAccount()
	{
		var domainname = this.objOmnitureConfig.domain;
		var referrername = this.objOmnitureConfig.referrername;  
		var theConfigURL = domainname.split(";")
		var theBrowserURL = window.location.href;
		for (var i=0;i<theConfigURL.length;i++)
		{
			if ((theBrowserURL.indexOf(theConfigURL[i])) >= 0)
			{
				account=this.objOmnitureConfig.liveAccount;
			} else {
				account=this.objOmnitureConfig.devAccount;
			}
			return account;
		}
	}
	this.setDynamicVars = function setDynamicVars(page_namex,strLocale,strSection,strSubSection)
	{
			if (s_pageName=="")
			{
				s_pageName = this.objOmnitureConfig.siteName + ">" + page_namex;
			}
			
			// set region, subregion, language
			if (s_prop13=="")
			{
				s_prop13 = getRegion(strLocale);
			}
			
			if (s_prop14=="")
			{
				s_prop14 = getSubRegion(strLocale);
			}
			
			if (s_prop15=="")
			{
				s_prop15 = getLanguage(strLocale);
			}
			
			if (s_prop6=="")
			{
				s_prop6 = strLocale;
			}
			
			if (s_channel=="")
			{
				// channel determined dynamically using 
				// index "section;subsection"
				if (strSubSection!="")
				{
					s_channel = this.getChannel(strSection + ";" + strSubSection); 
				}
				else
				{
					s_channel = this.getChannel(strSection); 
				}
			}
			
			if (s_prop18=="")
			{
				s_prop18 = strSection;
			}
			
			if (s_prop19=="")
			{
				s_prop19 = strSubSection;
			}
			
			   if (s_channel == null || s_channel =="") s_channel = "undefined";
			   if (s_server == null || s_server =="") s_server = "undefined";
			   if (s_prop12 == null || s_prop12 =="") s_prop12 = "undefined";
			   if (s_prop13 == null || s_prop13 =="") s_prop13 = "undefined";
			   if (s_prop14 == null || s_prop14 =="") s_prop14 = "undefined";
			   if (s_prop15 == null || s_prop15 =="") s_prop15 = "undefined";
	}
	
	this.setCommerce = function setCommerce(strEvents,strProducts)
	{
		// empty s_products variable if not sent
		// can happen when setting custom commerce event
		if (strProducts == "" || strProducts== null || strProducts=="undefined")
		{
			strProducts = "";
		}
			s_events = strEvents;
			s_products = strProducts;	
	}
	
	this.setCookieVar = function setCookieVar(strName, strValue){
		eval(strName + " = \"" + strValue + "\"");
	}

	this.setOmnitureVars = function setOmnitureVars()
	{
		// populates the physical omniture vars based on omniture property values before tag call
		// creates a string with omniture variable declarations, then evals the string
		for (var configVar in this)
		{
			
			if (this.getOmnitureVarForConfigVar(configVar) != "" && this.getOmnitureVarForConfigVar(configVar) != null)
			{
				// alert("in setOmnitureVars: " + this.getOmnitureVarForConfigVar(configVar));
				eval(this.getOmnitureVarForConfigVar(configVar) + " = \"" + this[configVar] + "\"");
			}
			
		}
	}

	this.flushVars = function flushVars() 
	{
		// empty some object properties
		// e.g. all commerce variables
		 //s_setRef= this.objOmnitureConfig.setRef;
		 s_pageName=""
		 s_LinkName=""
		 s_server=""
		 s_channel=""
		 s_pageType=""
		 s_prop1="";//Langauge
		 s_prop2="";//Media Source type
		 s_prop3="";//Ref referer
		 s_prop4=""
		 s_prop5=""
		 s_prop6=""
		 s_prop7=""
		 s_prop8=""
		 s_prop9=""
		 s_prop10=""
		 s_prop11=""
		 s_prop12="";//Site Category
		 s_prop13="";//Region
		 s_prop14="";//Subregion
		 s_prop15="";//Langauge in iso639
		 s_prop16=""
		 s_prop17=""
		 s_prop18=""
		 s_prop19=""
		 s_prop20=""
		 s_campaign=""
		 s_state=""
		 s_zip=""
		 s_events=""
		 s_products=""
		 s_purchaseID=""
		 //s_account="" //Don't empty this one with Playmaker because looks like it's affecting exit link tracking calls for some reason
		 s_eVar1=""
		 s_eVar2=""
		 s_eVar3=""
		 s_eVar4=""
		 s_eVar5=""
		 s_eVar6=""
		 s_eVar7=""
		 s_eVar8=""
		 s_eVar9=""
		 s_eVar10=""
		 s_eVar11=""
		 s_eVar12=""
		 s_currencyCode=""
		 
		 this.s_LinkName = "";
	}
	
	this.debugOutput = function debugOutput()
	{
		if (this.objOmnitureConfig.debug=="client")
		{
			var strOutput = "s_setRef = " + s_setRef + "\n" + "s_pageName = " + s_pageName + "\n" +  "s_server = " + s_server + "\n" + "s_channel = " + s_channel + "\n" + "s_pageType = " + s_pageType + "\n" + "s_prop1 = " + s_prop1 + "\n" + "s_prop2 = " + s_prop2 + "\n" + "s_prop3 = " + s_prop3 + "\n" + "s_prop4 = " + s_prop4 + "\n" + "s_prop5 = " + s_prop5 + "\n" + "s_prop6 = " + s_prop6 + "\n" + "s_prop7 = " + s_prop7 + "\n" + "s_prop8 = " + s_prop8 + "\n" + "s_prop9 = " + s_prop9 + "\n" + "s_prop10 = " + s_prop10 + "\n" + "s_prop11 = " + s_prop11 + "\n" + "s_prop12 = " + s_prop12 + "\n" + "s_prop13 = " + s_prop13 + "\n" + "s_prop14 = " + s_prop14 + "\n" + "s_prop15 = " + s_prop15 + "\n" + "s_prop16 = " + s_prop16 + "\n" + "s_prop17 = " + s_prop17 + "\n" + "s_prop18 = " + s_prop18 + "\n" + "s_prop19 = " + s_prop19 + "\n" + "s_campaign = " + s_campaign + "\n" + "s_state = " + s_state + "\n" + "s_zip = " + s_zip + "\n" + "s_events = " + s_events + "\n" + "s_products = " + s_products + "\n" + "s_purchaseID = " + s_purchaseID + "\n" + "s_account = " + s_account + "\n" + "s_eVar1 = " + s_eVar1 + "\n" + "s_eVar2 = " + s_eVar2 + "\n" + "s_eVar3 = " + s_eVar3 + "\n" + "s_eVar4 = " + s_eVar4 + "\n" + "s_eVar5 = " + s_eVar5 + "\n" + "s_eVar6 = " + s_eVar6 + "\ns_currencyCode = " + s_currencyCode;
			if (this.s_LinkName!=null && this.s_LinkName!="")
			{
				strOutput += "\n" + "linkName = " + this.s_LinkName;
			}
			alert(strOutput);
		}
		else if (this.objOmnitureConfig.debug=="server")
		{
			this.statSeq+=1; //This offsets multiple catalyst debug windows!
			var statWinNm = "stats_debugger" + Math.round(Math.random()*10000);
			void(window.open("",statWinNm,"width=600,height=600,location=0,menubar=0,status=1,toolbar=0,resizable=1,scrollbars=1,top=" + this.statSeq * 10 + ",left="  + this.statSeq * 10).document.write("<script language=\"JavaScript\" src=\"http://192.168.112.2O7.net/stats_debugger.php\"></"+"script>"));		
		}
	}
	
	this.getOmnitureVarForConfigVar = function getConfigValueForOmnitureVar(configVar)
	{
		// map our userfriendly names onto the relevant Omniture var
		var value = "";
		var varMap= new Array()
		varMap["account"] = "s_account";
		varMap["category"] = "s_prop12";
		varMap["channel"] = "s_channel";
		varMap["locale"] = "s_prop6";
		varMap["s_prop15"] = "language"; // ISO 3 letter code
		varMap["subdomain"] = "s_server";
		varMap["trackDownloads"] = "s_trackDownloadLinks";
		varMap["trackExternalLinks"] = "s_trackExternalLinks";
		varMap["currency"] = "s_currencyCode";
		
		value = varMap[configVar];
		return value;
	}
	

	this.setDebugTag = function setDebugTag(tStr)
	{
		if ((tStr == null) || (tStr == "")) { tStr = "none"; }
		alert('debug:' + tStr + '  //possible values: "client" "server" or "none"');
		this.objOmnitureConfig.debug = tStr;
	}
	

	
	/* If a site has multiple channels, the
	   channel/section/subsection mappings must
	   be defined here. Otherwise, for single-channel
	   sites, the channel can be defined in the config
	   file
	 */
	this.getChannel = function getChannel(key)
	{
		var value = "";
		var channel = new Array()
		// channel["launch"]="Other";
		// channel["home"]="Gateway";
		// channel["fuel"]="Media";
		// channel["equip"]="ProductExperience";
		// channel["compete"]="Experience";
		// channel["train"]="Experience";

		value = channel[key];
		return value;
	}
}