	LeadGen = window.LeadGen || {};
	LeadGen.Tracking = LeadGen.Tracking || {};
	LeadGen.Tracking = function() {
		var emptyStr = 'na';
		var dlm = '_';
		return {
		   siteCode: emptyStr,
                   storyType: emptyStr,
                   pageType: emptyStr,
                   topicChannel: emptyStr,
                   author: emptyStr,
                   moduleName: emptyStr,
                   ref: document.referrer,
		   domain: '',
		   sourceParam: '',
		   setDomain:function(){
			if(this.ref != null){
			   var tempdomain = this.ref.match('\/\/.*?\/');
			   if(tempdomain) this.domain = tempdomain[0].substring(2,tempdomain[0].length -1);
			   if(this.domain.indexOf('www.') > -1) this.domain = this.domain.substring(4);
			}
			if(this.domain == null || this.domain.length == 0) this.domain = emptyStr;
		   },
		   addSourceCode:function(_siteCode, _moduleCode, _element){
			// if(_siteCode != null && _siteCode.length > 0) siteCode = _siteCode;
			siteCode = 'ctwsite';
			if(_moduleCode != null && _moduleCode.length > 0) moduleCode = _moduleCode;	
			var _sourceParam = siteCode + dlm + sourceParam + dlm + moduleCode;
			if(_element){
			    var sep = '?';
			    if(_element.href.indexOf('?') > -1) sep = '&'; 
			    window.location = _element.href + sep + 'idglg=' + _sourceParam;
			}			
		   },
		   init:function(){
			LeadGen.Tracking.setDomain();
		   	if(typeof(s_prop5) != 'undefined' && s_prop5 != null && s_prop5.length > 0) this.storyType = s_prop5;
			if(typeof(s_prop14) != 'undefined' && s_prop14 != null && s_prop14.length > 0) this.pageType = s_prop14;
			if(typeof(s_channel) != 'undefined' && s_channel != null && s_channel.length > 0) this.topicChannel = s_channel;
			if(typeof(s_prop4) != 'undefined' && s_prop4 != null && s_prop4.length > 0) this.author = s_prop4;
			sourceParam = this.storyType + dlm + this.pageType + dlm + this.topicChannel + dlm + this.author + dlm + this.domain;		
		   }
		 }
	}();
	LeadGen.Tracking.init();
