/******************************
LiveChat v2.0
by Derrick Gall
	Ported from the original monitor code from LivePerson (consolidated variables)
******************************/

var lpMTagConfig = {
	// FIRM SPECIFIC SETTINGS
	lpNumber: 'LIVE_PERSON_ACCOUNT_NUMBER',
	// THIS PART (BELOW) USUALLY STAYS THE SAME
	lpServer: 'server.iad.liveperson.net',
	lpProtocol: 'https'
};

/*********************************************
	DO NOT MODIFY ANYTHING BELOW THIS LINE
*********************************************/
var livePerson = {
	// Initialization function
	init: function() {
		if (window.attachEvent) window.attachEvent('onload', livePerson.lpAddMonitorTag);
		else window.addEventListener('load', livePerson.lpAddMonitorTag, false);
	},
	// Monitor code
	lpAddMonitorTag: function(src) {
		if (typeof(src) == 'undefined' || typeof(src) == 'object') {
			src = lpMTagConfig.lpMTagSrc ? lpMTagConfig.lpMTagSrc : '/hcp/html/mTag.js';
		}
		if (src.indexOf('http') != 0) { 
			src = lpMTagConfig.lpProtocol + "://" + lpMTagConfig.lpServer + src + '?site=' + lpMTagConfig.lpNumber;
		} else {
			if (src.indexOf('site=') < 0) {
				if (src.indexOf('?') < 0) src = src + '?';
				else src = src + '&';
				src = src + 'site=' + lpMTagConfig.lpNumber;
			}
		};
		
		var s = document.createElement('script');
		s.setAttribute('type','text/javascript');
		s.setAttribute('charset','iso-8859-1');
		s.setAttribute('src', src);
		document.getElementsByTagName('head').item(0).appendChild(s);
	}
}

livePerson.init();
