
//var trackingDiv = document.createElement('div');
//trackingDiv.setAttribute('id', "trackingDiv");

function trackSearchRev(sr) {
    if (sr.am == undefined || sr.page ==undefined) return;
    var img = new Image();
    img.src='https://s1.srtk.net/www/delivery/ti.php?trackerid=347&cb=27164&_sr_amount='+sr.am+'&_sr_page='+sr.page;
}

function trackSMG(smg) {
    if (smg.cat==undefined) return;
    var divId="SMGtracking";
    var axel = Math.random()+"";
    var a = axel * 10000000000000;
    //var dv = document.getElementById('floodLight_tag');
    var d = document.getElementById(divId);
    if (d==null) {
        d = document.createElement('div');
        d.id=divId;
        document.body.appendChild(d);
    }

    d.innerHTML = '<IFRAME SRC="http://fls.doubleclick.net/activityi;src=1352258;type=livep207;cat='+smg.cat+';ord='+ a + '?" WIDTH="1" HEIGHT="1" FRAMEBORDER="0"></IFRAME>';

}

function trackWT(wt) {
	if (wt.cgp==undefined || wt.cgs == undefined || wt.ti == undefined) return;
	wt.cgp = wt.cgp.toLowerCase();
	wt.cgs = wt.cgs.toLowerCase();
	wt.ti = wt.ti.toLowerCase();
	if (wt.dl == null) wt.dl=21;
	if (wt.dcsid != undefined) globalWT.dcsid = wt.dcsid;


   var params = [ 'DCS.dcsuri', new String('/'+wt.cgp+'/'+wt.cgs+'/'+wt.ti).replace(/ /g,""),
			'WT.cg_n', wt.cgp, 'WT.cg_s', wt.cgs, 'WT.ti', wt.ti ];

    params = params.concat( ['WT.dl', wt.dl] );
	params = params.concat( wt.ad != undefined ? ['WT.ad', wt.ad] : ['WT.ad', ''] );
    params = params.concat( wt.ac != undefined ?  ['WT.ac', wt.ac] : ['WT.ac', ''] );
	params = params.concat( wt.lpss != undefined ? ['WT.lp_ss', wt.lpss] : ['WT.lp_ss', ''] );

	globalWT.dcsMultiTrack.apply(globalWT, params);
}

function track(trackingString) {
	var params = eval('(' + trackingString + ')');

	if(params.lang == 'en_ca') {
		globalWT.dcsid = 'dcskgrta400000cxpjei61zc8_8o3j';
	} else {
		globalWT.dcsid = 'dcsu7j8zrf9xjyso9jru9rnoc_6d1y';
	}
	if(params.ad && params.wt) params.wt.ad = params.ad;

	if(params.click) {
		if (params.wt != undefined) {
			params.wt.dl = 21;
			if(params.clickVal) params.wt.ti += ' : '+params.clickVal;
			trackWT(params.wt);
		}
		if (params.smg != undefined) trackSMG(params.smg);
		if (params.sr != undefined) trackSearchRev(params.sr);
	} else {
		if (params.wt != undefined) trackWT(params.wt);
		if (params.smg != undefined) trackSMG(params.smg);
		if (params.sr != undefined) trackSearchRev(params.sr);
	}
    return true;
}

function linkBlocker(url) {
	var r = confirm("You are about to leave this website.\n\nLinked sites are not under The Coca-Cola Company's control and the Company is not responsible or liable for the privacy practices or the contents of any linked site, or any link contained in any linked site. If you provide payment or other personal information through a linked site, your transaction will occur on the linked website (not The Coca-Cola Company website) and the personal information you provide will be collected by and controlled by the privacy policy of the linked site. It is important that you familiarize yourself with the privacy policies and practices of the linked site.\n\nLinks to websites outside The Coca-Cola Company website are offered for your convenience. The inclusion of a link on The Coca-Cola Company website does not imply endorsement of the linked site by The Coca-Cola Company. Additionally, The Coca-Cola Company cannot attest to the accuracy of the information provided by linked sites.\n\nPlease hit OK to access the linked site.\n\nOr, click CANCEL to continue your visit on The Coca-Cola Company website.");
	if(r == true) {
		location.href=url;
	}
}

/*function track_Link(WTArray, SMGArray, SRArray) {
    if (WTArray != undefined && WTArray.length==3) trackWT_Link(WTArray[0], WTArray[1], WTArray[2]);
    if (SMGArray != undefined && SMGArray.length ==1) trackSMG(SMGArray[0]);
    if (SRArray != undefined && SRArray.length==2) 	trackSearchRev(SRArray[0],SRArray[1]);
    return true;
}


function parseit(fxn){
	eval(fxn);
}*/

