/**********************************************************
    D O N 'T   M O D I F Y   T H I S   F I L E  !!!
**********************************************************/
if (typeof webTracker == "undefined") {
	var webTracker = new function () {
		this.trackerId = {};
		//alert('inside webtrends callback function');
		
		/**
			Called every 2 second after a video was started the first time
			
			The only paramter is the corresponding youtubePlayer object, which offers the following methods:
				- youtubePlayerWrapper.getYoutubeId()    =  YoutubeID wie: dMH0bHeiRNg  (siehe URL: http://www.youtube.com/watch?v=dMH0bHeiRNg)
				- youtubePlayerWrapper.getTitle()  =  Bsp: "Evolution of Dance"
				- youtubePlayerWrapper.getPlayedPercentage() = the current percentage the video was played
				- youtubePlayerWrapper.getPlayerState() = the current state of the video as String  {'unstarted' , 'ended' , 'playing' , 'paused' , 'buffering' , 'cued'};
		*/
		this.trackVideoPlaying = function (youtubePlayerWrapper) {
			// calculate in which quarter we are
			var percentage = youtubePlayerWrapper.getPlayedPercentage();
			//alert('inside webtrends trackVideoPlaying at %: ' + percentage);
			if (youtubePlayerWrapper.getPlayerState() == "ended") {percentage = 100;} 	// often stops at 99%
			var finishedQuarter = Math.floor(percentage / 25);
			
			if (typeof(webTracker.trackerId[youtubePlayerWrapper.playerId]) == "undefined" || webTracker.trackerId[youtubePlayerWrapper.playerId] < finishedQuarter) {
				// this paint is reached ONLY ONCE after a quarter was played
				// available varaible : finishedQuarter = [0-4]
				//alert('webtrendscall: ' + youtubePlayerWrapper.getTitle());
				dcsMultiTrack('DCS.dcsuri','/Video ' + youtubePlayerWrapper.getTitle(),'WT.ti','Video ' + youtubePlayerWrapper.getTitle(), 'WT.cusVideo', youtubePlayerWrapper.getTitle(), 'WT.cusVideoCategory', document.title, 'WT.cusVideoPercentage', finishedQuarter * 25);
				
				// save that this quarter was already tracked
				webTracker.trackerId[youtubePlayerWrapper.playerId] = finishedQuarter;
			}
		};
		
		
		/**
			Called if somebody presses the "send"-button of the send to a friend function
			(function is called even if no mail is send, because of any kind of error)
			
			Available params:
				_params.shareUrl = Url which the user wants to share
				_params.shareTitle = Title of the url the user shares
				_params.mailfrom = The users own name
				_params.mailto = the email of the person the user wants the share the url with
				
		*/
		this.sendAFriend = function (_params) {
			//console.log ("SEND A FRIEND");
			//console.log (_params);
			//dcsMultiTrack('DCS.dcsuri','/Send to a friend ' + _params.shareTitle, 'WT.ti','Send to a friend ' + _params.shareTitle);
			dcsMultiTrack('DCS.dcsuri','/Send to a friend ' + _params.shareTitle, 'WT.cusShareSiteMedium', 'E-Mail', 'WT.cusShareSitePageTitle', _params.shareTitle, 'WT.cusShareSitePageURL', _params.shareUrl);
		};
		
		
		/**
			Called if somebody clicks on "Continue" in the external link overlay
			
			Available params:
				_params.url = full url of external link		(eg: "http://www.myspace.com/Modules/PostTo/Pages/?l=3&u=http%3A%2F%2F10.190.199.6%2Fiw-mount%2Fdefault%2Fmain%2FMarketingSites%2FBSP%2FYourLife%2FInternational%2FDev%2FWORKAREA%2Fhtdocs%2Fscripts%2Fpages%2Fen%2Fhome%2Fknow_your_options%2Fyour_contraception%2Findex.php%3Fmethod%3DCondoms&t=The%20Condom")
				_params.domain = only domain part of external link		(eg: "myspace.com")
				_params.isShareLink = was this external link a share icon? [true/false]
		*/
		this.externalLink = function (_params) {		
			//console.log ("Open external Link");
			//console.log ("URL: " + window.location.pathname);
			//console.log (_params);
			dcsMultiTrack('WT.cusShareSiteMedium', _params.domain);
		};
		
		

		
		/**
			Called if somebody submits successfiully the couple of the week apply form
			Available params: NONE
		*/
		this.trackCoupleOfTheWeekSubmit = function () {		
			dcsMultiTrack('WT.cusCOTWSubmit','1');
		};

		/**
			Called if somebody confirms (clicks on link in email) his before successfiully submitted couple of the week apply form
			Available params: NONE
		*/
		this.trackCoupleOfTheWeekConfirm = function () {		
			dcsMultiTrack('WT.cusCOTWConfirm','1');
		};
		
		
		
		
		/**
			Called if somebody submits successfiully the love-talk form
			Available params: NONE
		*/
		this.trackLoveTalkSubmit = function () {		
			dcsMultiTrack('WT.cusLoveTalkSubmit','1');		
		};

		/**
			Called if somebody confirms (clicks on link in email) his before successfiully submitted love-talk form
			Available params: NONE
		*/
		this.trackLoveTalkConfirm = function () {		
			dcsMultiTrack('WT.cusLoveTalkConfirm','1');	
		};
		
		
		
	};
}

