
var pprLargeEtStrict = {
	pprLarge:{co:'W6G15',mappedCo:'W6GBB'},
	pprStrict:{co:'W6G14',mappedCo:'W6GAA'},
	gclid:null,
    getURLParam:function (strParamName, isCaseSensitive)
    {
        var strReturn = "";
        var strHref = window.location.href;
        if ( strHref.indexOf("?") > -1 ){
            var strQueryString = (isCaseSensitive!=undefined && isCaseSensitive) ? strHref.substr(strHref.indexOf("?")) : strHref.substr(strHref.indexOf("?")).toLowerCase();
            var aQueryString = strQueryString.split("&");
            for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
                if (aQueryString[iParam].indexOf(strParamName.toLowerCase() + "=") > -1 ){
                    var aParam = aQueryString[iParam].split("=");
                    strReturn = aParam[1];
                    break;
                }
            }
        }
        return unescape(strReturn);
    },
	run:function(){
		var flag = cookie_readCookie('pprLargeEtStrictFlag');
		if(flag)
		{
			//déjà fait
			//var coFromCookie = cookie_readCookie('co');
			//alert('campagne déjà exécutée: coFromCookie=' + coFromCookie);
		}
		else
		{
			//jamais fait , regarde ds url
			var coFromUrl = this.getURLParam('co');
			if(coFromUrl!="")
			{
				if(coFromUrl.toUpperCase()==this.pprLarge.co)
				{
    				coFromUrl = (Math.round(Math.random())==1) ? this.pprLarge.co : this.pprLarge.mappedCo;
				    cookie_writeCookie('pprLargeEtStrictFlag','pprLarge',null,'/');
				}
				else if(coFromUrl.toUpperCase()==this.pprStrict.co)
				{
					coFromUrl = (Math.round(Math.random())==1) ? this.pprStrict.co : this.pprStrict.mappedCo;
					cookie_writeCookie('pprLargeEtStrictFlag','pprStrict',null,'/');
				}
				cookie_writeCookie('co',coFromUrl,null,'/');
			}
			this.redirect(coFromUrl);
		}
	},
	redirect:function(co){
        this.gclid = this.getURLParam('gclid',true);
        this.gclid = (!this.gclid) ? '' : ('&gclid='+this.gclid);
		switch(co)
		{
			case this.pprLarge.mappedCo:
			     location.replace('../../?co=' + this.pprLarge.mappedCo + this.gclid);
			     break;
			case this.pprStrict.mappedCo:
			     location.replace('../../?co=' + this.pprStrict.mappedCo + this.gclid);
			     break;
			default:
			     break;
		}
	}
}

pprLargeEtStrict.run();