	/* Lib structure:
		vkiGAlib - required
		Additional plug-in objects
		 - vkiTSP Traffic Source Pathing
		 - segmentHelper  Custom Hierarchial Visitor Segmentation
		 - vkiAutoEvents - autotagging of events
		 - vkiEComm - eCommerce Tracking
	*/

var vkiGA_CONFIG = {
	PROD_HOST_DOMAIN: 'weightlossdeal.com', // No leading period
	PROD_WPID	: '1967051-1',
	DEV_WPID		: '8706900-3',
	IN_PROD			: true
}

var vkiGA_SLOTS = {
	MEDIUM_SLOT 	:	{slot:5,scope:1},
	SOURCE_SLOT 	: 	{slot:4,scope:1},
	VISITOR_SEGMENT : 	{slot:1,scope:1}
};  

var LEVELS = new Array(
	'No Action',	
	'Subscribers',
	'Quiz_Takers',
	'Paying Members'
	);


var vkiGAlib = (function (strCurTracker) {

	/**
	 *  Checks query string or  manually created cookie to test for  debugging mode
	 *  Ensures cookie is created if in deubugging mode
	 * @privileged
	 */
	this.isDebugging =  function() {
		var isDbgCookie = true;//(document.location.search(/[&?]debug(ging)?=yes/i) !== -1);
		//if (isDbgCookie) this.createCookie('debugging', 'yes', 0);
		return isDbgCookie || (document.cookie.search(/debug(ging)?=yes/i) !== -1);
	}
	
	this.consoleLog = function (s) { 
		if(this.isDebugging() && console && console.log) 
			console.log(s); 
	} 
	
	this.curTrackerName = '';//(strCurTracker || 'pageTracker');	// the tracker this instance will use
	this.curTrackerName += (this.curTrackerName ? '.' : '');
	
	var strHref = '';
	var strHost = document.location.host;

	this.getDomainName = function(strURL) {
		strURL = strURL || document.location.hostname;
		
			// extract the host name since full url may have been provided
		strURL = strURL.match(/^(?:https?:\/\/)?([^\/:]+)/)[1];	// this cannot error unless running as file://
		
		if(strURL.match(/(\d+\.){3}(\d+)/) || strURL.search(/\./) == -1) return strURL;	// ipaddress

		try {
			strURL = strURL.match(/(([^.\/]+\.[^.\/]{2,3}\.[^.\/]{2})|(([^.\/]+\.)[^.\/]{2,4}))(\/.*)?$/)[1];
		} catch (e) {
				// custom or local dns name like sub.mylaptop in which case return the whole hostname part of strURL
		}
		return  strURL;
	};
	
	this.isHostExternal = function(strURL) {
		this.consoleLog(strURL + ' && ' + strHost + ' && ' + (strURL.indexOf(strHost)) 
						+ ' && ' + (strHost.indexOf(strURL))
						+ ' && ' + (this.getDomainName(strURL).indexOf(strHost)));
						
		var isExternal =	(strURL.indexOf(strHost) == -1) 
						&&	(strHost.indexOf(strURL) == -1)
						&&	(this.getDomainName(strURL).indexOf(this.getDomainName(strHost)) == -1); 
						
		this.consoleLog(isExternal);
		
		return isExternal
	};
	
	if (vkiGA_CONFIG.IN_PROD && strHost.indexOf(vkiGA_CONFIG.PROD_HOST_DOMAIN) !== -1) {
		var strDomainName = vkiGA_CONFIG.PROD_HOST_DOMAIN;
		var strWebPropertyId = 'UA-' + vkiGA_CONFIG.PROD_WPID;
	}
	else  {
			// Testing Account
		var strDomainName = '.' + this.getDomainName();
		var strWebPropertyId = 'UA-' + vkiGA_CONFIG.DEV_WPID;
	}	

		// All settings must be configured before any other code is called
	_gaq.push(	/*function() {alert('test');}, */
				[this.curTrackerName + '_setAccount', strWebPropertyId],
				[this.curTrackerName + '_setDomainName', strDomainName],
				[this.curTrackerName + '_setAllowHash', true]
			);

	this.sendPage = function(strVPN) {

			// ---- Start Traffic Source Pathing -------------------------------
		if (!oVkiTSP) {	// If script has not already run eg if this is called on click
			var oVkiTSP =  new vkiTSP(this);
			try {oVkiTSP.doAttribution(strDomainName); } catch (e) { this.consoleLog(e.message);}
		}
			// ---- End Traffic Source Pathing ----------------------------------

			// Determine what the page name will be based on whether 
			//	a Virtual Page Name was provided in document.strTrackPageView
		if (strVPN) {
			strHref = strVPN;
		} else {
			if (document.strTrackPageView)
				strHref = document.strTrackPageView;
			else
				strHref = document.location.pathname + vkiParamCleaner();
		}
		
			// if document.strVisitorSegment is set, process it.  Must be done before _trackPageview so that the value can be sent with the page.
		if (oVkiVisitorSegmentor) {
			if (document.strVisitorSegment) {
					// segment visitor if segment specified on the current page
				_gaq.push(oVkiVisitorSegmentor.setNewVisitorLevel);
				
			} else if (strHref.match(/\/quiz\/Are-you-ready-Result/)) {
				_gaq.push(function(){oVkiVisitorSegmentor.setNewVisitorLevel('Quiz_Takers');});
				
			} else if (strHref.match(/\/quiz\/Are-you-ready-question-1/)) {
				_gaq.push(function(){oVkiVisitorSegmentor.setNewVisitorLevel('Subscribers');});
				
			}
		}
		
		_gaq.push([this.curTrackerName + '_trackPageview', strHref]);
		// debugging: divResults.innerHTML += strVPN + '<br><br>' + strHref+'<hr>';

		return true;
	};
	
	this.sendEvent = function(category, action, label, value) {
		value = value || 1;
		value = Math.round(value);	// decimal values not supported
		_gaq.push([this.curTrackerName + '_trackEvent', category, action, label, value]);
	}
	
	/**
	 *  Reads  cookies, requires domain hash
	 *  
	 * @private
	 * @param {string} name cookie name
	 * @param {string} optional value or regexp as string to match value
	 * @param {string or int}  Domain Hash for __utm cookie and if danger of there being another __utm* cookie set.  Value returned includes domain hash
	 * @returns	value of the cookie, or null if cookie not set
	 * @type mixed
	 * @example obj.readCookie('__utmb', '', 1) to get value of __utmb cookie with setAllowHash = false
	 */
	 
	this.readCookie = function(cookieName, expression, intDomainHash) {
		try {
			expression = expression || '';
			intDomainHash = intDomainHash ? intDomainHash + '\.' : '';
			var ptn = new RegExp(cookieName + '=(' + expression + intDomainHash + '.*?)(; |$)');
			return document.cookie.match(ptn)[1];
		} catch (e) {return null;}
	}

	/**
	 *  Creates cookie
	 *  
	 * @private
	 * @param {string} name cookie name
	 * @param {string} value cookie value
	 * @param {string} mins mins until cookie expires
	 * @param {string} cookieDomain optional - domain to set the cookie for
	 */
	 
	this.createCookie = function(name, value, mins, cookieDomain) {
		var domain = "";
		var expires = "";
		
		if (mins) {
			var date = new Date();
			date.setTime(date.getTime()+(mins*60*1000));
			var expires = " expires="+date.toGMTString() + ";";
		}
		
		if (typeof(cookieDomain) != 'undefined')
			domain = " domain=" + cookieDomain + "; ";
		
		document.cookie = name + "=" + value + ";" + expires + domain + "path=/";
	}
	

	this.setCustomVar = function(varParams, strKey, strValue) {
		strKey = strKey.replace(/ /g,'_');
		strValue = unescape(strValue.replace(/ /g,'_'));
		_gaq.push([this.curTrackerName + '_setCustomVar', varParams.slot, unescape(strKey), strValue, varParams.scope]);		
	}

	
	this.setVar = function(value) {
		_gaq.push([this.curTrackerName + '_setVar', value]);
	}
	
	this.setTracker = function() {
		if (!this.curPageTracker) this.curPageTracker = _gat._getTrackerByName(this.curTrackerName);
	};
	
	
	this.getCustomVisitorValue = function(varParams) {
		this.setTracker();
		return this.curPageTracker._getVisitorCustomVar(varParams.slot);
	};
	
	
	this.getDomainHash = function(domainOrHash) { 
		
		if (typeof domainOrHash == 'number') 
			return domainOrHash;
			
		strDomainName = domainOrHash || this.getDomainName();
		
		if (strDomainName == "none")
			return 1;
			
		fromGaJs_h =  function (e) {
			return undefined == e || "-" == e || "" == e
		};
		fromGaJs_s = 
			function (e) {
					var k = 1,
					a = 0,
					j, i;
					if (!fromGaJs_h(e)) {
						k = 0;
						for (j = e.length - 1; j >= 0; j--) {
							i = e.charCodeAt(j);
							k = (k << 6 & 268435455) + i + (i << 14);
							a = k & 266338304;
							k = a != 0 ? k ^ a >> 21 : k
						}
					}
					return k
				};
		return fromGaJs_s(strDomainName) ; 
		
	}

});


var strUnknowns = '';

var vkiParamCleaner = (function () {
	var PARAMS2REMOVE = 'return';	// comma-delimited string
	var isCASE_SENSITIVE = false;

	var _knownParams = function() {
		var KNOWN_PARAMS = '';
		
		KNOWN_PARAMS = isCASE_SENSITIVE ? KNOWN_PARAMS : KNOWN_PARAMS.toLowerCase();
			// string must start and end with a comma or more complex regexp required
		return (',' + KNOWN_PARAMS + ',');
	}

	var _reportUnknownParameters = function(strUnknowns) {
	}
	
	var strURLQuery = unescape(document.location.search).substring(1);
	if (!strURLQuery) return '';
	
	var aryQuery;
	var toRemove;
	var aryQueryNew = new Array;
	var knownParams = _knownParams();

		// If query string contains an embedded query string the name value pair is assumed to be the last pair and is removed
	var posEmbeddedQS = strURLQuery.indexOf('?');
	if (posEmbeddedQS !== -1) {
		strURLQuery = strURLQuery.substring(0, posEmbeddedQS);
		strURLQuery = strURLQuery.match(/([^&]*)&.*$/);
		if (strURLQuery) strURLQuery = strURLQuery[1];
	}
	aryQuery = strURLQuery.split('?');
	aryQuery = strURLQuery.split('&');

	PARAMS2REMOVE = isCASE_SENSITIVE ? PARAMS2REMOVE : PARAMS2REMOVE.toLowerCase();
		// string must start and end with a comma or more complex regexp required
	PARAMS2REMOVE = ',' + PARAMS2REMOVE + ',';
	
	
	for (key in aryQuery) {
		if (typeof(aryQuery[key]) == 'string') {
			elmArray = aryQuery[key].split('=');
			strParam = isCASE_SENSITIVE ? elmArray[0] : elmArray[0].toLowerCase();
								// params names that are URLs http & https 
				toRemove  = (strParam.search(/^[?&]?https?:\/\//i) !== -1) 
							||
							(PARAMS2REMOVE.indexOf(',' + strParam + ',') !== -1);
					
				if (!toRemove && strParam) {
					aryQueryNew.push(strParam + '=' + (elmArray[1] ? elmArray[1] : ''));
					if (knownParams.indexOf(',' + strParam + ',') == -1) strUnknowns += (strUnknowns ? ',' : '') + strParam;
				}
		}
	}
	
	if (strUnknowns) _reportUnknownParameters(strUnknowns);
	
	return '?' + aryQueryNew.join('&');
	
	
});


var vkiSegmentVisitor = (function(oVkiGAlib) {

	var VARIABLE_NAME = 'Visitor Commitment';
	var VISITOR_SEGMENT = vkiGA_SLOTS.VISITOR_SEGMENT;
		
	this.currentLevel = '';
	var instance = this;
	
	this.getCurrentSegmentLevel = function() {
		currentLevel = oVkiGAlib.getCustomVisitorValue(VISITOR_SEGMENT);
		return currentLevel;
	}

	this.setNewVisitorLevel = function(sNewLevel) {
		instance.newLevel = sNewLevel || document.strVisitorSegment;
		instance.segmentVisitor();
	}

	this.segmentVisitor = function() {
		var iNew = LEVELS.indexOf(instance.newLevel);
		var iCurrent = LEVELS.indexOf(instance.getCurrentSegmentLevel());
		
		if (iNew > iCurrent && iNew >= 0) {
			currentLevel = instance.newLevel;
			oVkiGAlib.setCustomVar(VISITOR_SEGMENT, VARIABLE_NAME, instance.newLevel);
		}
			// Temp:
		if (oVkiGAlib.isDebugging()) {
			oVkiGAlib.setVar(instance.newLevel);
			oVkiGAlib.sendEvent('Medium Path', VARIABLE_NAME, instance.newLevel, 1);
		}
	}

});



var vkiAutoEvents = (function (oVkiGAlib) {

	var EXTERNAL_FOLDER = '/external/';
	var DOWNLOADS_FOLDER = '/downloads/';
	var MAILTO_FOLDER = '/mailto/';
	var DOCS_REGEXP = /\.(?:doc|eps|jpg|png|svg|xls|ppt|pdf|xls|zip|txt|vsd|vxd|rar|exe|wma|mov|avi|wmv|mp3)($|\&)/;
	var objPlyr;
	
	this.fGooAnTagPdfs = function() {
		if (document.getElementsByTagName) {
				// Initialize external link handlers
			var hrefs = document.getElementsByTagName("a");
			for (var l = 0; l < hrefs.length; l++) {
					// try {} catch{} block added by VKI for tags that have no href
				try{
						//protocol, host, hostname, port, pathname, search, hash
					if (hrefs[l].protocol == "mailto:") {
							startListening(hrefs[l],"click",trackMailto);
					} 
					else if (hrefs[l].innerHTML.indexOf('sponsors-footer') !== -1) {
						startListening(hrefs[l],"click",
									function(event) {trackEvent(event, 'Credibility Banner');}
						);
					} 
					else if (oVkiGAlib.isHostExternal(hrefs[l].hostname)) {
						var path = hrefs[l].pathname + hrefs[l].search;

						var isDoc = path.match(DOCS_REGEXP);
						if (isDoc) {
							startListening(hrefs[l],"click", trackDownloadLinks);
						} 
						else if (hrefs[l].onclick) {
							if (hrefs[l].onclick.toString().indexOf('startAudioPlayer') !== -1) {
								startListening(hrefs[l],"click",trackAudioClick);
							}
						}	 
					} 
					else {
						startListening(hrefs[l],"click",trackExternalLinks);
					}
				}
				catch(e){
					continue;
				}
			}
			if (objPlyr = document.getElementById('audioplayer1')) {
				objPlyr.onclick=trackAudioClick;
			}
		}
	} 


	var startListening = function(obj,evnt,func) {
        if (obj.addEventListener) {
                obj.addEventListener(evnt,func,false);
        } else if (obj.attachEvent) {
                obj.attachEvent("on" + evnt,func);
        }
	}

	var trackMailto = function (evnt) {
        var href = (evnt.srcElement) ? evnt.srcElement.href : this.href;
        var mailto = MAILTO_FOLDER + href.substring(7);
        oVkiGAlib.sendPage(mailto);
	}

	var trackEvent = function (evnt, description) {
        oVkiGAlib.sendEvent('Special Clicks', 'Credibility', description);
	}

	var trackLinks = function (e, virtualFolder) {
        while (e.tagName != "A") {
            e = e.parentNode;
        }
        var lnk = (e.pathname.charAt(0) == "/") ? e.pathname : "/" + e.pathname;
        if (e.search && e.pathname.indexOf(e.search) == -1) lnk += e.search;
        if (e.hostname != location.host) lnk = e.hostname + lnk;
		lnk = (virtualFolder + lnk).replace(/\/\//g, '/');
        oVkiGAlib.sendPage(lnk);
	} 

	var trackExternalLinks = function (evnt) {
		var e = (evnt.srcElement) ? evnt.srcElement : this;
		trackLinks(e, EXTERNAL_FOLDER);
	}

	var trackDownloadLinks = function (evnt) {
        var e = (evnt.srcElement) ? evnt.srcElement : this;
		trackLinks(e, DOWNLOADS_FOLDER);
	}

	var trackAudioClick = function (evnt) {
		var title = document.title.replace(/The 90 Calorie Deal( - )?/, '');
		var pageId = document.location.search.match(/&(id=[^&]*)/i);
		
		if (pageId) pageId = pageId[1]; else pageId = '';
		
		if (!trackAudioClick.isPause) {
			trackAudioClick.startTime = new Date().getTime();
			oVkiGAlib.sendEvent('Player', 'Starts', title + (pageId ? ' | ' + pageId : ''), 0);
		} else {
			trackAudioClick.startTime = (new Date().getTime()) - trackAudioClick.startTime;
			oVkiGAlib.sendEvent('Player', 'Pauses', title + (pageId ? ' | ' + pageId : ''), trackAudioClick.startTime/1000);
			
		}
		trackAudioClick.isPause = !trackAudioClick.isPause;
		
	}
	trackAudioClick.isPause = false;
	trackAudioClick.startTime = 0;

})
/*
      var isDoc = path.match(/\.(?:doc|eps|jpg|png|svg|xls|ppt|pdf|xls|zip|txt|vsd|vxd|rar|exe|wma|mov|avi|wmv|mp3)($|\&)/);
*/



var vkiEComm = (function (oVkiGAlib, orderID) {

	var VKI_COOKIE_NAME = '__utmvki';
	var isNewTransaction;
	this.orderID = orderID;
	/**
	 *  Checks if order has already been sent or not.  Sets session cookie to track orders that have been sent.
	 *  Prevents sending duplicate transactions on reload of the thankyou page
	 * @private
	 * @param {string} unique order ID
	 */
	 
	var _checkSetTrans = function (orderID) {
		var strCookieValue = 'e.' + orderID;
		var strControlCookie = oVkiGAlib.readCookie(VKI_COOKIE_NAME) || '';
		var isNew = (strControlCookie.search(strCookieValue) == -1);
		oVkiGAlib.createCookie(VKI_COOKIE_NAME, strCookieValue, 0);
		return isNew;
	};
	
	/**
	 *  Adds transaction to GA tracking object
	 *  
	 * @privileged
	 * @param {string} unique order ID
	 * @param {string} affiliate, store or other grouping
	 * @param {string} order total excluding taxes and shipping
	 * @param {string} tax amount
	 * @param {string} shipping amount
	 * @param {string} city of customer
	 * @param {string} state of customer
	 * @param {string} country of customer
	 */
	isNewTransaction = _checkSetTrans(orderID);
	this.addTrans = function (affiliate, total, tax, shipping, city, state, country) {
		try {
			if (isNewTransaction) 
				_gaq.push([oVkiGAlib.curTrackerName + '_addTrans', 
							this.orderID, affiliate, total, tax, shipping, city, state, country
						]);
		}
		catch (err) {
			oVkiGAlib.consoleLog(err.message);
		}
	}
	
	/**
	 *  Adds item to GA tracking object
	 *  
	 * @privileged
	 * @param {string} unique order ID
	 * @param {string} unique SKU/identifier of the product
	 * @param {string} descriptive product name
	 * @param {string} category of product
	 * @param {string} unit price of product
	 * @param {string} quantity purchased
	 */
	this.addItem = function (sku, productName, category, price, quantity) {
		try {
			if (isNewTransaction) 
				_gaq.push([oVkiGAlib.curTrackerName + '_addItem', 
							this.orderID, sku, productName, category, price, quantity
						]);
		}
		catch (err) {
			oVkiGAlib.consoleLog(err.message);
		}
	}
	
	/**
	 *  Sends transaction tracking request to GA if the order hasn't already been sent
	 *  
	 * @privileged
	 * @param {string} unique order ID
	 */
	this.trackTrans = function () {
		try {
			if (isNewTransaction) {
				oVkiVisitorSegmentor.setNewVisitorLevel('Paying Members');

				_gaq.push([oVkiGAlib.curTrackerName + '_trackTrans']);
				if (document.vkiDelaySend) oVkiGAlib.sendPage();
			}
		}
		catch (err) {
			oVkiGAlib.consoleLog(err.message);
		}
		isNewTransaction = false;
	}
	
	
});

var vkiTSP = (function (oVkiGAlib) {
		
			// VKI's TrafficSourcePath parameters
		this.MEDIUM_SLOT	= vkiGA_SLOTS.MEDIUM_SLOT;	// Slot for Traffic Medium
		this.SOURCE_SLOT 	= vkiGA_SLOTS.SOURCE_SLOT;	// Slot for Traffic Source

			// 	To deal with the 64 byte limitation:
		this.SOURCE_LENGTH = 0;		// Limit Source length - 0 = no limit
		this.MEDIUM_LENGTH = 3;		// Limit medium length - 0 = no limit	
		this.DROP_TLD = true;		// Remove .com, .co.uk etc from Traffic Source if present
		this.DROP_SAME_AS_LAST = true;		// Don't record S and M if same as previous (decided against limit to unique in this implementation)

		var DELIMITER = '_';		// When GA gets around to decoding it's MCV strings we can use >

		var strMedium	= '';
		var strSource	= '';

		this.isFromCampaign = function() {
				// if URL contains sufficient parameters for a campaign, the referrer is a campaign, even if the HTTP referrer is direct
				// Note: utm_medium may be a required parameter but GA defaults it to (none) if missing
			return (document.location.search.match(/((utm_source=.+utm_campaign=.+)|(utm_campaign=.+utm_source=.+)|gclid=.+)/));
		}

		this.isVisitStart = function(intDomainHash) {
				// can be called before or after  _gaq.push is called or pageTracker is instantiated
				// but MUST be called before any functions that cause cookies to be written:
				//	_trackPageView, _trackEvent, _setVar  _initData	
			intDomainHash = intDomainHash || '';
			var ptn = new RegExp('(__utm[cb]=' + intDomainHash + ')', 'g');
					// Start of Visit if  no __utmb and/or no __utmc cookies
			try {
				return 	document.cookie.match(ptn).length <= 1;
			} catch (e) {return true;}
		}

		this.isDirect = function(intDomainHash, isVisitStart) {
				// can be called before or after  _gaq.push is called or pageTracker is instantiated
				// but MUST be called before any functions that cause cookies to be written:
				//	_trackPageView, _trackEvent, _setVar  _initData

				// Direct if there is no referrer and this is the 1st page of a visit 
			return 	(!document.referrer) && (isVisitStart || isVisitStart(intDomainHash));
		}


		
		this.doAttribution = function(domainOrHash, sourceLength, mediumLength, dropTLD, dropSameAsLast) {

			sourceLength = (sourceLength || this.SOURCE_LENGTH);
			mediumLength = (mediumLength || this.MEDIUM_LENGTH);
			dropTLD = (dropTLD || this.DROP_TLD);
			dropSameAsLast = (dropSameAsLast || this.DROP_SAME_AS_LAST);
				
			intDomainHash = oVkiGAlib.getDomainHash(domainOrHash); 

			var isVisitStart = this.isVisitStart(intDomainHash);
			
			if (!isVisitStart) return;
			
			var isDirect = this.isDirect(intDomainHash, isVisitStart);

			this.setAttribution(intDomainHash, isDirect);
			
			strSource = this.cleanS_M(strSource, sourceLength, dropTLD);
			strMedium = this.cleanS_M(strMedium, mediumLength);
			
				// In effect, dropSameAsLast in S independant of dropSameAsLast in M
			strSource = this.accumulateSource_Medium(strSource, this.SOURCE_SLOT, dropSameAsLast);
			strMedium = this.accumulateSource_Medium(strMedium, this.MEDIUM_SLOT, dropSameAsLast);
			
			oVkiGAlib.setCustomVar(this.SOURCE_SLOT, 'Sc', strSource);
			oVkiGAlib.setCustomVar(this.MEDIUM_SLOT, 'Md', strMedium);
		}

		this.setAttribution = function(intDomainHash, isDirect) {

			intDomainHash = intDomainHash || oVkiGAlib.getDomainHash();
			isDirect = (isDirect || this.isDirect()) && !this.isFromCampaign();
			if (isDirect) {
				strMedium = 'dir' ; //(none)
				strSource = 'dir' ; // (direct)
			}
			else {
				_gaq.push([oVkiGAlib.curTrackerName +'_initData']);		// need to set the cookies so we can get the medium from __utmz
				strMedium = this.getSourceMedium(intDomainHash);
				strSource = strMedium ? strMedium[0] :  '';
				strSource = strSource == 'direct' ? 'dir' : strSource;
				
				strMedium = strMedium ? strMedium[1] :  '';
				strMedium = strMedium == 'non' ? 'dir' : strMedium;
			}
		}

		this.getSourceMedium = function(intDomainHash) {
			var strRegExp = '__utmz=' + intDomainHash + '\..*utmc';
			var ptnM = new RegExp(strRegExp + 'md=([^|]*)');
			var ptnS = new RegExp(strRegExp + 'sr=([^|]*)');
			
			if (document.cookie.match(ptnS))
				return [document.cookie.match(ptnS)[1], document.cookie.match(ptnM)[1]]; 
		}

		// this.SOURCE_SLOT
		this.cleanS_M = function(str, intLength, bolDropTLD) {
		
			if (!str) return '';
			
			str = str.replace(/[()]/g, '');			// drop brackets (direct) (none)
			
			if (intLength) str = str.substring(0, intLength); 	// leftmost intLength

			if (bolDropTLD) str = str.match(/[^.]*/)[0];		// drop TLD in Source
			
			return  str;
		}

		this.accumulateSource_Medium = function(strCurrentSM, varParams, dropSameAsLast) {
			var strPreviousSM = unescape(oVkiGAlib.getCustomVisitorValue(varParams)) || '';
			strPreviousSM = strPreviousSM == 'undefined' ? '' : strPreviousSM;
			
				// dropSameAsLast in S & M are independant of each other
			if (dropSameAsLast && strPreviousSM.search(strCurrentSM + '$') !== -1){
				return strPreviousSM;
			} else {
				if (strPreviousSM) strPreviousSM += DELIMITER;
				return strPreviousSM + strCurrentSM;
			}
		}

	}
)


function fSafeAddOnload(func) {
    v = 'v3.1.0 2006-11-22; like:; req:;';
    if (!window.__load_events) {
        var init = function () {
            if (arguments.callee.done) return;
            arguments.callee.done = true;
            if (window.__load_timer) {
                clearInterval(window.__load_timer);
                window.__load_timer = null;
            }
            for (var i = 0; i < window.__load_events.length; i++) {
                window.__load_events[i]()
            }
            window.__load_events = null
        };
        if (document.addEventListener) {
            document.addEventListener("DOMContentLoaded", init, false)
        }
        if (/WebKit/i.test(navigator.userAgent)) {
            window.__load_timer = setInterval(function () {
                if (/loaded|complete/.test(document.readyState)) {
                    init()
                }
            },
            10)
        }
        window.onload = init;
        window.__load_events = []
    }
    window.__load_events.push(func)
}

var _gaq = _gaq || [];

(function() {
    var ga = document.createElement('script');     ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:'   == document.location.protocol ? 'https://ssl'   : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; 
	s.parentNode.insertBefore(ga, s);
})();


var oVkiGAlib = new vkiGAlib();
var oVkiAutoEvents = new vkiAutoEvents(oVkiGAlib);
var oVkiVisitorSegmentor = new vkiSegmentVisitor(oVkiGAlib);
if (!document.vkiDelaySend) oVkiGAlib.sendPage();
fSafeAddOnload(oVkiAutoEvents.fGooAnTagPdfs);

	
	
//
