// bcn.properties: tft/tft.js,tft/core/console.js,tft/core/statistics.js,tft/core/statistics/ivwagof.js,tft/core/statistics/googleanalytics.js,tft/core/statistics/webtrekk.js,tft/util/string/removeHtmlComments.js

/* ************************
* tft/tft.js
*/

// $Id: tft.js 22551 2010-07-28 13:02:21Z bkonetzny $
// JSLint settings:
/*jslint browser: true, cap: false, eqeqeq: true, evil: true, laxbreak: true, onevar: true */
/*global $, TFT  */

/**
* TFT Namespace - the global TFT namespace
* @namespace TFT
*/
var TFT = {};

/**
* TFT Core - handles core related functions
*/
TFT.Core = {
	/**
	* @static
	* @constructor (note: a constructor for JsDoc purposes)
	*/
	Modules: {
		oModules: {},
		/**
		* Registers a module
		* @param {String} sVersionString A svn:keywords (Id) property like '$Id: tft.js 22551 2010-07-28 13:02:21Z bkonetzny $'
		* @example
		* TFT.Core.Modules.addModule('tft.js 22551 2010-07-28 13:02:21Z bkonetzny $');
		*/
		addModule: function(sVersionString){
			var aVersionData = sVersionString.split(' '),
				sModule;
			
			if(aVersionData.length === 7){
				aVersionData.shift();
			}
			
			sModule = aVersionData[0].split(',');
			
			this.oModules[sModule[0]] = {iVersion: aVersionData[1], sTimestamp: aVersionData[2] + ' ' + aVersionData[3], sAuthor: aVersionData[4]};
		},
		/**
		* Returns true if module is loaded
		* @param {String} sModule Name of script file as provided by TFT.Core.Modules.addModule().
		* @return {Boolean}
		* @example
		* if(TFT.Core.Modules.isLoaded('tft.js')){
		* 	// tft.js is loaded
		* }
		* else{
		* 	// tft.js is not loaded
		* }
		*/
		isLoaded: function(sModule){
			if(typeof this.oModules[sModule] === 'undefined'){
				return false;
			}
			return true;
		}
	}
};

TFT.Core.Modules.addModule('tft.js 22551 2010-07-28 13:02:21Z bkonetzny $');

/**
* TFT Util - handles utility functions
* @constructor (note: a constructor for JsDoc purposes)
*/
TFT.Util = {
	/**
	* @constructor (note: a constructor for JsDoc purposes)
	*/
	Date: {},
	/**
	* @constructor (note: a constructor for JsDoc purposes)
	*/
	Form: {},
	/**
	* @constructor (note: a constructor for JsDoc purposes)
	*/
	String: {}
};

/**
* TFT Ext - handles project-related functions
*/
TFT.Ext = {};

/* ************************
* tft/core/console.js
*/

// $Id: console.js 22359 2010-07-22 06:56:50Z bkonetzny $
// JSLint settings:
/*jslint browser: true, cap: false, eqeqeq: true, evil: true, laxbreak: true, onevar: true */
/*global $, TFT */
TFT.Core.Modules.addModule('console.js 22359 2010-07-22 06:56:50Z bkonetzny $');

/**
* Base TFT Core Console object
* @constructor (note: a constructor for JsDoc purposes)
*/
TFT.Core.Console = {
	bActive: false,
	bLoggerReady: false,
	sLogHandler: '',
	sKeyHandler: '',
	aKeyFilters: [],
	aSeverity: [],
	aMessageBuffer: [],
	/**
	* Logs a message to console.
	* Determines if message should be logged based on given filters.
	* Logging / buffering is handled by writeLog().
	* @param {String} sKey
	* @param {String} [sMessage]
	* @param {String} [sSeverity='info'] One of the following: 'debug', 'info', 'warn' or 'error'.
	* @returns {Boolean}
	* @example
	* TFT.Core.Console.log('TFT.My.Custom.Object', 'argument1: value1 | argument2: value2');
	*/
	log: function(sKey, sMessage, sSeverity){
		sMessage = sMessage || '';
		sSeverity = sSeverity || 'info';
		
		var bLog = true,
			aMatches;

		if (!this.bActive) {
			return false;
		}
		else {
			if(this.aSeverity.join(' ').indexOf(sSeverity) === -1){
				bLog = false;
			}
			
			if(bLog && this.aKeyFilters.length) {
				if(this.sKeyHandler === 'include'){
					aMatches = $.grep(this.aKeyFilters, function(sItem, iIndex){
						var sItemFilter;
						
						if (sItem.indexOf('*') !== -1) {
							sItemFilter = sItem.substr(0,sItem.length-2);
							
							return (sItemFilter === sKey.substr(0,sItemFilter.length));
						}
						else {
							return (sItem === sKey);
						}
					});
					
					if(!aMatches.length){
						bLog = false;
					}
				}
				else if(this.sKeyHandler === 'exclude'){
					aMatches = $.grep(this.aKeyFilters, function(sItem, iIndex){
						var sItemFilter;
						
						if (sItem.indexOf('*') !== -1) {
							sItemFilter = sItem.substr(0,sItem.length-2);
							
							return (sItemFilter === sKey.substr(0,sItemFilter.length));
						}
						else {
							return (sItem === sKey);
						}
					});
					
					if(aMatches.length){
						bLog = false;
					}
				}
			}

			if(bLog) {
				this.writeLog(sKey, sMessage, sSeverity);
			}
			
			return true;
		}
	},
	/**
	* Prepares / buffers the message.
	* If console output is paused or logger is not ready, messages are buffered.
	* Output to console is handled by writeLogHandler().
	* @private
	* @param {String} sKey
	* @param {String} sMessage
	* @param {String} sSeverity
	*/
	writeLog: function(sKey, sMessage, sSeverity){
		if (this.bLoggerReady) {
			if(this.aMessageBuffer.length){
				for(var iIndex = 0; iIndex < this.aMessageBuffer.length; iIndex++){
					this.writeLogHandler(this.aMessageBuffer[iIndex].sKey, this.aMessageBuffer[iIndex].sMessage, this.aMessageBuffer[iIndex].sSeverity);
				}
				
				this.aMessageBuffer = [];
			}
			
			this.writeLogHandler(sKey, sMessage, sSeverity);
		}
		else {
			this.aMessageBuffer.push({sKey: sKey, sMessage: sMessage, sSeverity: sSeverity});
		}
	},
	/**
	* Writes a message to console
	* @private
	* @param {String} sKey
	* @param {String} sMessage
	* @param {String} sSeverity
	*/
	writeLogHandler: function(sKey, sMessage, sSeverity){
		if (this.sLogHandler === 'console.debug') {
			if(sSeverity === 'info'){
				console.info('[' + sKey + '] ' + sMessage);
			}
			else if(sSeverity === 'warn'){
				console.warn('[' + sKey + '] ' + sMessage);
			}
			else if(sSeverity === 'error'){
				console.error('[' + sKey + '] ' + sMessage);
			}
			else{
				console.debug('[' + sKey + '] ' + sMessage);
			}
		}
		else if (this.sLogHandler === 'div#tft_core_console') {
			$('div#tft_core_console textarea').val('[' + sSeverity + '][' + sKey + '] ' + sMessage + '\n' + $('div#tft_core_console textarea').val());
		}
		else if (this.sLogHandler === 'alert') {
			alert('[' + sSeverity + '][' + sKey + '] ' + sMessage);
		}
	},
	/**
	* Initializes the Console
	* @param {Boolean} bActive Enables/Disables console output
	* @param {String} [sLogHandler=''] Name of the LogHandler. Possible values are 'console.debug', 'div#tft_core_console' or 'alert'. If empty will detect if native console is available, otherwise chooses the TFT HTML console. 
	* @param {Array} [aKeyFilters=[]]
	* @param {String} [sKeyHandler='include']
	* @param {String} [aSeverity=['info', 'warn', 'error']] Can contain the following values: 'debug', 'info', 'warn' and 'error'.
	* @example
	* // log all
	* TFT.Core.Console.init(true, '', [], 'include');
	* @example
	* // log only where key contains 'TFT.Core.Statistics'
	* TFT.Core.Console.init(true, 'alert', ['TFT.Core.Statistics.*'], 'include');
	* @example
	* // log all except where key contains 'TFT.Core.Statistics'
	* TFT.Core.Console.init(true, 'alert', ['TFT.Core.Statistics.*'], 'exclude');
	* @example
	* // log all except where key contains 'TFT.Core.Statistics', with severity 'debug' enabled
	* TFT.Core.Console.init(true, 'alert', ['TFT.Core.Statistics.*'], 'exclude', ['debug', 'info', 'warn', 'error']);
	*/
	init: function(bActive, sLogHandler, aKeyFilters, sKeyHandler, aSeverity){
		sLogHandler = sLogHandler || '';
		aKeyFilters = aKeyFilters || [];
		sKeyHandler = sKeyHandler || 'include';
		aSeverity = aSeverity || ['info', 'warn', 'error'];
		
		if (bActive) {
			if (sLogHandler !== '') {
				this.sLogHandler = sLogHandler;
			}
			else {
				// detect firebug console
				if (typeof console !== 'undefined' && typeof console.debug !== 'undefined') {
					this.sLogHandler = 'console.debug';
				}
				else {
					this.sLogHandler = 'div#tft_core_console';
				}
			}
			
			this.aKeyFilters = aKeyFilters;
			this.sKeyHandler = sKeyHandler;
			this.aSeverity = aSeverity;
			
			if(this.sLogHandler === 'div#tft_core_console'){
				this.createConsoleElement();
			}
			else{
				this.bLoggerReady = true;
			}
			
			this.bActive = true;
			
			this.log('TFT.Core.Console.init', 'Initialised');
		}
		else {
			this.bActive = false;
		}
		
		$(document).ready(function(){
			TFT.Core.Console.log('TFT.Core.Console.documentReady');
		});
	},
	/**
	* Pause/resumes console output.
	* @param {Boolean} [bReady=true]
	* @example
	* // pause logger
	* TFT.Core.Console.toggleLogger(false);
	* @example
	* // resume logger
	* TFT.Core.Console.toggleLogger(true);
	*/
	toggleLogger: function(bReady){
		bReady = bReady || true;
		
		if(!bReady) {
			this.log('TFT.Core.Console.toggleLogger', 'bLoggerReady: ' + bReady);
		}
		
		TFT.Core.Console.bLoggerReady = bReady;
		
		if(bReady) {
			this.log('TFT.Core.Console.toggleLogger', 'bLoggerReady: ' + bReady);
		}
	},
	/**
	* Creates a HTML console on when document is ready. The log() calls are buffered until this console is ready.
	* @private
	*/
	createConsoleElement: function(){
		$(document).ready(function(){
			TFT.Core.Console.log('TFT.Core.Console.createConsoleElement', '#tft_core_console');
		
			var sConsole = '';
			
			sConsole += '<div id="tft_core_console" style="z-index: 999; border: 1px solid #000; width: 510px; position: fixed; right: 0px; bottom: 0px; background-color: #ccc; padding: 5px; font-family: Arial; font-size: 10px; color: #000;">';
			sConsole += '<label for="tft_core_console_log" style="float: left; display: block; font-family: Arial; font-size: 12px; font-weight: bold; color: #000;">TFT.Core.Console:</label>';
			sConsole += '<a href="#" style="float: right; font-family: Arial; font-size: 10px; padding-left: 10px; font-weight: normal; color: #000;" onclick="$(\'#tft_core_console\').hide(); return false;">[ close ]</a>';
			sConsole += '<a href="#" style="float: right; font-family: Arial; font-size: 10px; padding-left: 10px; font-weight: normal; color: #000;" onclick="$(\'#tft_core_console div\').toggle(); if($(this).html() == \'[ hide ]\') { $(this).html(\'[ show ]\'); } else { $(this).html(\'[ hide ]\'); } return false;">[ hide ]</a>';
			sConsole += '<a href="#" style="float: right; font-family: Arial; font-size: 10px; padding-left: 10px; font-weight: normal; color: #000;" onclick="$(\'#tft_core_console textarea\').val(\'\'); return false;">[ clear ]</a>';
			sConsole += '<a href="#" style="float: right; font-family: Arial; font-size: 10px; padding-left: 10px; font-weight: normal; color: #000;" onclick=" if($(this).html() == \'[ pause ]\') { TFT.Core.Console.toggleLogger(false); $(this).html(\'[ resume ]\'); } else { TFT.Core.Console.toggleLogger(true); $(this).html(\'[ pause ]\'); } return false;">[ pause ]</a>';
			sConsole += '<div>';
			sConsole += '<textarea id="tft_core_console_log" style="clear: both; display: block; width: 500px; height: 100px; font-size: 11px; color: #000;"></textarea>';
			sConsole += 'Mode: '+TFT.Core.Console.sKeyHandler+' | Filter: '+TFT.Core.Console.aKeyFilters;
			sConsole += '</div>';
			sConsole += '</div>';
			
			$('body').append(sConsole);
			TFT.Core.Console.bLoggerReady = true;
		});
	}
};

/* ************************
* tft/core/statistics.js
*/

// $Id: statistics.js 22366 2010-07-22 07:22:09Z bkonetzny $
// JSLint settings:
/*jslint browser: true, cap: false, eqeqeq: true, evil: true, laxbreak: true, onevar: true */
/*global $, TFT */
TFT.Core.Modules.addModule('statistics.js 22366 2010-07-22 07:22:09Z bkonetzny $');

/**
* Base statistics object
* @constructor (note: a constructor for JsDoc purposes)
*/
TFT.Core.Statistics = {
	Handler: {},
	bInitialised: false,
	aActiveHandler: [],
	oProperties: {},
	oPropertiesDefaults: {},
	oPropertiesProvided: {},
	/**
	* Initialize statistic handlers
	* Only initialized handlers can be used later
	* @param {Array} aActiveHandler
	* @example
	* // init 2 handlers: IvwAgof and Omniture
	* TFT.Core.Statistics.init(['IvwAgof', 'Omniture']);
	*/
	init: function(aActiveHandler){
		TFT.Core.Console.log('TFT.Core.Statistics.init', 'aActiveHandler: ' + aActiveHandler);
		
		var myself = this;

		$.each(aActiveHandler, function(iIndex, sValue) {
			if (typeof myself.Handler[sValue] !== 'undefined'){
				if (typeof myself.Handler[sValue].count !== 'undefined') {
					if (typeof myself.Handler[sValue].init !== 'undefined') {
						myself.Handler[sValue].init();
					}
					
					myself.Handler[sValue].iCount = 0;
					myself.aActiveHandler.push(sValue);
				}
				else{
					TFT.Core.Console.log('TFT.Core.Statistics.init', 'Function count() not implemented by handler "' + sValue + '". Handler will be disabled.', 'error');
				}
			}
			else{
				TFT.Core.Console.log('TFT.Core.Statistics.init', 'Handler "' + sValue + '" could not be initialized. Please make sure this handler is loaded. Handler will be disabled.', 'error');
			}
		});
		
		this.bInitialised = true;
	},
	/**
	* Count a statistics event
	* @param {Array} [aHandlers=All active handlers]
	* @example
	* // count an IvwAgof and Omniture event
	* TFT.Core.Statistics.count(['IvwAgof', 'Omniture']);
	* @example
	* // count an event for all active handlers
	* TFT.Core.Statistics.count();
	*/
	count: function(aHandlers){
		if (this.bInitialised) {
			aHandlers = aHandlers || this.aActiveHandler;
			
			var myself = this;
			
			TFT.Core.Console.log('TFT.Core.Statistics.count', 'aHandlers: ' + aHandlers);
			
			this.prepareProperties(aHandlers);
			
			$.each(aHandlers, function(iIndex, sValue) {
				myself.Handler[sValue].count(myself.oProperties[sValue]);
				myself.Handler[sValue].iCount++;
			});
		
			this.reset(aHandlers);
		}
	},
	/**
	* Set the statistics handler properties
	* @param {String} sHandler
	* @param {Object} oProperties
	* @example
	* // set properties for IvwAgof
	* TFT.Core.Statistics.set('IvwAgof', {ivw: 'http://ivwhost.example.com/cgi-bin/ivw/CP', agof: '10000'});
	*/
	set: function(sHandler, oProperties){
		if (this.bInitialised) {
			TFT.Core.Console.log('TFT.Core.Statistics.set', 'sHandler: ' + sHandler);
			
			this.reset([sHandler]);
			this.oPropertiesProvided[sHandler] = oProperties;
		}
	},
	/**
	* Get the statistics handler properties
	* @param {String} sHandler
	* @param {String} [sProperty=''] 
	* @param {String} [sType='object'] Possible values are 'object, array'.
	* @param {Boolean} [bUseHandler=false] Use data from handler, instead of data from statistics framework 
	* @example
	* // get properties for IvwAgof as object
	* TFT.Core.Statistics.get('IvwAgof');
	* @example
	* // get properties for IvwAgof as array
	* TFT.Core.Statistics.get('IvwAgof', '', 'array');
	* @example
	* // get single property for IvwAgof
	* TFT.Core.Statistics.get('IvwAgof', 'agof');
	*/
	get: function(sHandler, sProperty, sType, bUseHandler){
		if (this.bInitialised) {
			sProperty = sProperty || '';
			sType = sType || 'object';
			bUseHandler = bUseHandler || false;
			
			TFT.Core.Console.log('TFT.Core.Statistics.get', 'sHandler: ' + sHandler + ' | sProperty: ' + sProperty + ' | sType: ' + sType + ' | bUseHandler: ' + bUseHandler);
			
			var oProperties = {},
				oReturn;
			
			if(!bUseHandler){
				$.extend(oProperties, this.oPropertiesDefaults[sHandler]);
				$.extend(oProperties, this.oPropertiesProvided[sHandler]);
				
				if(sProperty === ''){
					if(sType === 'array'){
						oReturn = [];
						$.each(oProperties, function(sKey, sValue){
							oReturn.push([sKey, sValue]);
						});
					}
					else{
						oReturn = oProperties;
					}
				}
				else{
					oReturn = '';
					
					if(typeof oProperties[sProperty] !== 'undefined'){
						oReturn = oProperties[sProperty];
					}
				}
			}
			else{
				if (typeof this.Handler[sHandler].get !== 'undefined') {
					oProperties = this.Handler[sHandler].get(sProperty);
					
					if(sType === 'array'){
						oReturn = [];
						$.each(oProperties, function(sKey, sValue){
							oReturn.push([sKey, sValue]);
						});
					}
					else{
						oReturn = oProperties;
					}
				}
				else{
					TFT.Core.Console.log('TFT.Core.Statistics.get', 'Function get() not implemented by handler "' + sHandler + '".', 'error');
				}
			}
			
			return oReturn;
		}
	},
	/**
	* Set the default statistics properties
	* @param {String} sHandler
	* @param {Object} oProperties
	* @example
	* // set default properties for IvwAgof
	* TFT.Core.Statistics.setDefaults('IvwAgof', {ivw: 'http://ivwhost.example.com', agof: '10000'});
	*/
	setDefaults: function(sHandler, oProperties){
		if (this.bInitialised) {
			TFT.Core.Console.log('TFT.Core.Statistics.setDefaults','sHandler: ' + sHandler);
			
			this.oPropertiesDefaults[sHandler] = oProperties;
		}
	},
	/**
	* Get the default statistics properties
	* @param {String} sHandler
	* @return {Object}
	* @example
	* // get default properties for IvwAgof
	* oDefaultProperties = TFT.Core.Statistics.getDefaults('IvwAgof');
	*/
	getDefaults: function(sHandler){
		if (this.bInitialised) {
			TFT.Core.Console.log('TFT.Core.Statistics.getDefaults','sHandler: ' + sHandler);
			
			return this.oPropertiesDefaults[sHandler];
		}
		else{
			return {};
		}
	},
	/**
	* Resets statistics properties
	* @private
	* @param {Array} [aHandlers=All active handlers]
	*/
	reset: function(aHandlers){
		if (this.bInitialised) {
			aHandlers = aHandlers || this.aActiveHandler;
		
			TFT.Core.Console.log('TFT.Core.Statistics.reset', 'aHandlers: ' + aHandlers);
			
			var myself = this;
			
			$.each(aHandlers, function(iIndex, sValue){
				if (typeof myself.Handler[sValue].reset !== 'undefined') {
					myself.Handler[sValue].reset(myself.oProperties[sValue]);
				}
			
				myself.oPropertiesProvided[sValue] = {};
				myself.oProperties[sValue] = {};
			});
		}
	},
	/**
	* Prepares the statistics properties for count
	* @private
	* @param {Array} [aHandlers=All active handlers]
	*/
	prepareProperties: function(aHandlers){
		if (this.bInitialised) {
			aHandlers = aHandlers || this.aActiveHandler;
		
			var myself = this;
			
			$.each(this.oPropertiesDefaults, function(sKey, sValue){
				if (typeof myself.oProperties[sKey] === 'undefined') {
					myself.oProperties[sKey] = {};
				}
				$.extend(myself.oProperties[sKey], sValue);
			});
			
			$.each(this.oPropertiesProvided, function(sKey, sValue){
				if (typeof myself.oProperties[sKey] === 'undefined') {
					myself.oProperties[sKey] = {};
				}
				$.extend(myself.oProperties[sKey], sValue);
			});
			
			$.each(aHandlers, function(iIndex, sValue){
				if (typeof myself.Handler[sValue].set !== 'undefined') {
					myself.oProperties[sValue] = myself.oProperties[sValue] || {};
					myself.Handler[sValue].set(myself.oProperties[sValue]);
				}
			});
		}
	}
};

/* ************************
* tft/core/statistics/ivwagof.js
*/

// $Id: ivwagof.js 9442 2009-09-28 11:15:53Z bkonetzny $
// JSLint settings:
/*jslint browser: true, cap: false, eqeqeq: true, evil: true, laxbreak: true, onevar: true */
/*global $, TFT */
TFT.Core.Modules.addModule('ivwagof.js 9442 2009-09-28 11:15:53Z bkonetzny $');

/**
* Base IvwAgof Statistics Handler object
* @constructor (note: a constructor for JsDoc purposes)
*/
TFT.Core.Statistics.Handler.IvwAgof = {
	/**
	* Counts an statistics event
	* @private
	* @param {Object} oProperties
	* @param {String} oProperties.account Name of the IVW account (ACCOUNTNAME.ivwbox.de)
	* @param {String} oProperties.agof AGOF-ID
	* @param {String} [oProperties.sSelector=#ivwbox] Selector of existing IVW statistics image
	* @param {String} [oProperties.type=CP] Type of IVW count: either CP (Content-Pixel), NP (Newsletter-Pixel) or FP (Flash-Pixel)
	* @param {String} [oProperties.comment=''] Comment for internal logging server reports - not used by IVW.
	* @see TFT.Core.Statistics.count
	*/
	count: function(oProperties){
		oProperties.sSelector = oProperties.sSelector || '#ivwbox';
		oProperties.type = oProperties.type || 'CP';
		oProperties.comment = oProperties.comment || '';
	
		TFT.Core.Console.log('TFT.Core.Statistics.Handler.IvwAgof.count', 'account: ' + oProperties.account + ' | agof: ' + oProperties.agof + ' | type: ' + oProperties.type);
		
		var sRandomToken = new Date().getTime(),
			sReferer = '';
		
		if(document.referrer){
			sReferer = document.referrer;
			sReferer = sReferer.replace(/["'<>]/g, "");
			sReferer = encodeURI(sReferer);
			sReferer = sReferer.replace (/\//g, '%2F');
		}
		
		$(oProperties.sSelector).attr('src', 'http://' + oProperties.account + '.ivwbox.de/cgi-bin/ivw/' + oProperties.type + '/' + oProperties.agof + ';' + oProperties.comment + '?r=' + sReferer + '&d=' + sRandomToken);
	}
};

/* ************************
* tft/core/statistics/googleanalytics.js
*/

// $Id: googleanalytics.js 22385 2010-07-22 11:15:14Z bkonetzny $
// JSLint settings:
/*jslint browser: true, cap: false, eqeqeq: true, evil: true, laxbreak: true, onevar: true */
/*global $, TFT */
TFT.Core.Modules.addModule('googleanalytics.js 22385 2010-07-22 11:15:14Z bkonetzny $');

/**
* Base GoogleAnalytics Statistics Handler object
* @constructor (note: a constructor for JsDoc purposes)
*/
TFT.Core.Statistics.Handler.GoogleAnalytics = {
	/**
	* Initializes the statistics handler
	* @private
	* @see TFT.Core.Statistics.init
	*/
	init: function(){
		TFT.Core.Console.log('TFT.Core.Statistics.Handler.GoogleAnalytics.init');
		
		window._gaq = window._gaq || [];
		
		(function() {
			var ga = document.createElement('script'), s;
			ga.type = 'text/javascript';
			ga.async = true;
			ga.src = ('https:' === document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
			s = document.getElementsByTagName('script')[0];
			s.parentNode.insertBefore(ga, s);
		})();
	},
	/**
	* Counts an statistics event
	* @private
	* @param {Object} oProperties
	* @param {String} oProperties.account Account in the format 'UA-XXXXXX-X'.
	* @param {String} [oProperties.sPagePath=''] Custom page path to track.
	* @param {Boolean} [oProperties.anonymizeIp=true] Anonymize the users IP.
	* @param {Array} [oProperties.aCommands=[]] Array of commands (array) passed to window._gaq.push().
	* @see TFT.Core.Statistics.count
	*/
	count: function(oProperties){
		oProperties.sPagePath = oProperties.sPagePath || '';
		
		TFT.Core.Console.log('TFT.Core.Statistics.Handler.GoogleAnalytics.count', 'sPagePath: ' + oProperties.sPagePath);
		
		if(oProperties.sPagePath !== ''){
			window._gaq.push(['_trackPageview', oProperties.sPagePath]);
		}
		else{
			window._gaq.push(['_trackPageview']);
		}
	},
	/**
	* Set a statistics property
	* @private
	* @param {Object} oProperties
	* @see TFT.Core.Statistics.set
	*/
	set: function(oProperties){
		oProperties.anonymizeIp = typeof oProperties.anonymizeIp !== 'undefined' ? oProperties.anonymizeIp : true;
		oProperties.aCommands = oProperties.aCommands || [];
		
		TFT.Core.Console.log('TFT.Core.Statistics.Handler.GoogleAnalytics.set', 'oProperties.account: ' + oProperties.account + ' | oProperties.anonymizeIp: ' + oProperties.anonymizeIp);

		window._gaq.push(['_setAccount', oProperties.account]);
		
		if(oProperties.anonymizeIp){
			window._gaq.push(['_gat._anonymizeIp']);
		}
		
		$.each(oProperties.aCommands, function(sKey, sValue){
			window._gaq.push(sValue);
		});
	}
};

/* ************************
* tft/core/statistics/webtrekk.js
*/

// $Id: webtrekk.js 22376 2010-07-22 07:24:24Z bkonetzny $
// JSLint settings:
/*jslint browser: true, cap: false, eqeqeq: true, evil: true, laxbreak: true, onevar: true */
/*global $, TFT */
TFT.Core.Modules.addModule('webtrekk.js 22376 2010-07-22 07:24:24Z bkonetzny $');

/**
* Base Webtrekk Statistics Handler object
* @constructor (note: a constructor for JsDoc purposes)
*/
TFT.Core.Statistics.Handler.Webtrekk = {
	/**
	* Initializes the statistics handler
	* @private
	* @see TFT.Core.Statistics.init
	*/
	init: function(){
		TFT.Core.Console.log('TFT.Core.Statistics.Handler.Webtrekk.init');
		
		window.webtrekk = window.webtrekk || {};
	},
	/**
	* Counts an statistics event
	* @private
	* @param {Object} oProperties
	* @param {String} oProperties.trackDomain The tracking domain.
	* @param {String} oProperties.trackId The tracking ID or list of tracking IDs, e.g. '1234567890,1234567891'.
	* @param {String} oProperties.domain The domain to track, e.g. 'REGEXP:\\.example\\.com$'.
	* @param {String} oProperties.contentId The ID of the tracked content, e.g. 'example.de_DE.lifestyle.music.productname'.
	* @param {Array} [oProperties.contentGroup=[null,null,null,null,null,null,null,'de_DE']] Categories for given tracking, 7th item describes the content language.
	* @param {String} [oProperties.linkTrack='standard'] Tracks links with proper name-attribute.
	* @param {String} [oProperties.internalSearch] Searchterm of the internal search.
	* @param {Boolean} [oProperties.heatmap=0] Records heatmap for all clicks, for elements inside the reference point (set by oProperties.heatmapRefpoint).
	* @param {String} [oProperties.heatmapRefpoint='wt_refpoint'] Element ID of the wrapper element, whose clicks should be recorded to the heatmap.
	* @param {String} [oProperties.mediaCode='wt_mc'] URL parameter, which marks the request as a campaign request.
	* @param {Array} [oProperties.customParameter]
	* @param {String} [oProperties.customParameter[1]] Template type.
	* @param {String} [oProperties.customParameter[2]] Content type, e.g. 'ec;ec_text;ec_images;ec_videos;ugc;ugc_text;ugc_images;ugc_vieos'.
	* @param {String} [oProperties.customParameter[3]] Author ID.
	* @param {String} [oProperties.customParameter[4]] User status, one of the following: 'guest,user_loggedout,user_loggedin,user_loggedout_premium,user_loggedin_premium'.
	* @param {String} [oProperties.customParameter[5]] Tags, e.g. 'sport;olympic games'.
	* @param {String} [oProperties.customParameter[6]] IVW/AGOF, format 'ALIAS;CODE;TYPE', e.g. 'example;10000;CP'.
	* @param {String} [oProperties.customParameter[7]] Number of internal search results.
	* @param {String} [oProperties.customParameter[8]] Advertising category, e.g. 'Lifestyle;Music'.
	* @param {String} [oProperties.customParameter[9]] Advertising special, e.g. 'custom_campaign_name'.
	* @see TFT.Core.Statistics.count
	*/
	count: function(oProperties){	
		TFT.Core.Console.log('TFT.Core.Statistics.Handler.Webtrekk.count');
		
		if (this.checkWebtrekkExistence()) {
			window.wt_sendinfo();
		}
	},
	/**
	* Set a statistics property
	* @private
	* @param {Object} oProperties
	* @see TFT.Core.Statistics.set
	*/
	set: function(oProperties){
		oProperties.contentGroup = oProperties.contentGroup || [null,null,null,null,null,null,null,'de_DE'];
		oProperties.linkTrack = oProperties.linkTrack || 'standard';
		oProperties.heatmap = oProperties.heatmap || 0;
		oProperties.heatmapRefpoint = oProperties.heatmapRefpoint || 'wt_refpoint';
		oProperties.mediaCode = oProperties.mediaCode || 'wt_mc';
		
		TFT.Core.Console.log('TFT.Core.Statistics.Handler.Webtrekk.set');

		if (this.checkWebtrekkExistence()) {
			$.each(oProperties, function(sKey, sValue){
				window.webtrekk[sKey] = sValue;
			});
		}
	},
	/**
	* Get a statistics property
	* @private
	* @param {String} sProperty
	* @see TFT.Core.Statistics.get
	*/
	get: function(sProperty){
		TFT.Core.Console.log('TFT.Core.Statistics.Handler.Webtrekk.get');
		
		var oReturn = {};

		if (this.checkWebtrekkExistence()) {
			if(sProperty === ''){
				$.each(window.webtrekk, function(sKey, sValue){
					if(typeof sValue !== 'function' && typeof sValue !== 'object'){
						oReturn[sKey] = sValue;
					}
				});
			}
			else{
				oReturn = '';
				
				if(typeof window.webtrekk[sProperty] !== 'undefined'){
					oReturn = window.webtrekk[sProperty];
				}
			}
		}
		
		return oReturn;
	},
	/**
	* Checks for existence of webtrekk tracking code
	* @private
	* @return {Boolean}
	*/
	checkWebtrekkExistence: function(){
		if (typeof window.wt_sendinfo !== 'undefined') {
			return true;
		}
		else{
			TFT.Core.Console.log('TFT.Core.Statistics.Handler.Webtrekk.checkWebtrekkExistence','"window.wt_sendinfo" is undefined. Please make sure Webtrekk is included.','error');
			return false;
		}
	}
};

/* ************************
* tft/util/string/removeHtmlComments.js
*/

// $Id: removeHtmlComments.js 17803 2010-04-01 08:35:30Z pgoetz-ci $
// JSLint settings:
/*jslint browser: true, cap: false, eqeqeq: true, evil: true, laxbreak: true, onevar: true */
/*global $, TFT */
TFT.Core.Modules.addModule('removeHtmlComments.js 17803 2010-04-01 08:35:30Z pgoetz-ci $');

/**
* Removes Html comments from a string
* @param {String} string
* @return {String}
*/
TFT.Util.String.removeHtmlComments = function(string){
	return string.replace(/(<!--|-->)/gi, '');
};
