function AbnTools(lsTitle, liNewsLetterID, lsDescription, lsImageName, liImageWidth, liImageHeight, lsquestionnaire, lsTermsUrl){
	this.title					= lsTitle;
	this.newsLetterID			= liNewsLetterID;
	this.description			= lsDescription;
	this.imageName				= lsImageName;
	this.termsUrl				= lsTermsUrl;
	this.index					= AbnTools.items.length;
	this.imageHeight			= liImageHeight;
	this.imageWidth				= liImageWidth;
	this.questionnaire          = lsquestionnaire;
	AbnTools.items[this.index] = this;
}

AbnTools.items					= [];/*Array for abnTools objects*/
AbnTools.protocol				= location.protocol=='https://'?'https://':'http://';
AbnTools.imagePath_fr			 = 	'prod.abocollecte.com/prod/logoProd/'; /*Chemin d'acc�s aux images*/
AbnTools.isCheckBox            = false; /*Permet de savoir si on utilise des boutons radio (false) ou des checkbox (true)*/
AbnTools.url_visit             = '';/*'http://www.abonews-france.com/visit.asp';*/
AbnTools.url_styles            = '';/*'http//www.abonews-france.com/abonews/styles/.css';*/

function commencePar(str, start){return (str.match("^"+start)==start);}function verifierTextelibre(texte){}function verifierTelfixe(tel){var regexpTelfixe = /^(01|02|03|04|05|08|09)[0-9]{8}$/;if(!regexpTelfixe.test(tel.value)){alert("Ce numéro de téléphone fixe n'est pas correct");}}function verifierTelmobile(tel){var regexpTelmobile = /^(06)[0-9]{8}$/;if(!regexpTelmobile.test(tel.value)){alert("Ce numéro de téléphone mobile n'est pas correct");}}function verifierCodepostal(codepostal){var regexpCodepostal = /^[0-9]{5}$/;if(!regexpCodepostal.test(codepostal.value)){alert("Ce code postal n'est pas correct");}}function verifierDate(date){if(commencePar(date.id, 'sA')){var idjour = 'sADateJ'+date.id.substr(7);var idmois = 'sADateM'+date.id.substr(7);var idannee = 'sADateA'+date.id.substr(7);var jour = document.getElementById(idjour);var mois = document.getElementById(idmois);var annee = document.getElementById(idannee);switch(mois.value){case '04' : case '06' : case '09' : case '11' :if(jour.value == '31'){ jour.value = '30';} break;case '02' :if(jour.value == '30' || jour.value == '31'){ jour.value = '29';} break;}}var idCache = 'specificAnswer'+date.id.substr(7);var cache = document.getElementById(idCache);cache.value = jour.value+'/'+mois.value+'/'+annee.value;}

AbnTools.validation = function () {
  var valid = true;
  /* Si le formulaire est avec des boutons radio*/
  if (!AbnTools.isCheckBox) {
      /* on récupère les composants input */
      var loCheckBoxes = document.getElementById('abntoolcheckboxes').getElementsByTagName('input');
      for(var iAbnTools = 0; iAbnTools < loCheckBoxes.length; iAbnTools++) {
          /* on récupère l'id du contrôle en cours */
          var id = "" + loCheckBoxes[iAbnTools].id;
          /* si le composant est un bouton radio d'abonnement à une news letter (oui) */
          if (id.substring(0,11) == "abntoolsOui") {
              /* si le bouton radio oui n'est pas selectionné */
              if (loCheckBoxes[iAbnTools].checked == false) {
                  /* si le bouton radio non correspondant n'est pas coché non plus */
                  if ( document.getElementById('abntoolsNon' + id.substring(11,id.length) ).checked == false ) {
                      /* message d'alert */
                      alert("Vous devez indiquer votre choix pour toutes les newsletter");
                      /* retourne faux */
                      valid = false;
                  }
              }
          }
      }
  }
  return valid;
}


document.write('<table><tr><td><input name="idSitePartenaire" type="hidden" value="94"/></td><td><input name="idPartenaire" type="hidden" value="77"/></td></tr></table>');

AbnTools.Display = function(){/*routine for displaying each abnTools newsletter*/
	for(var i = 0;i<AbnTools.items.length;i++){
		AbnTools.items[i].display();
	}
}
AbnTools.showhideAbnTools = function(oElem){
	var oDiv = document.getElementById('abntoolsdiv');
	oDiv.style.display = 'block';
	return true;
}

AbnTools.selectAllAbnTools = function (oElem){

	var loCheckBoxes = document.getElementById('abntoolcheckboxes').getElementsByTagName('input');
    var isChecked = oElem.checked;
    
    if (AbnTools.isCheckBox)
	{
    	for(var iAbnTools = 0; iAbnTools < loCheckBoxes.length; iAbnTools++){
            var id = "" + loCheckBoxes[iAbnTools].id;
	        if (id.substring(0,11) == "abntoolsChk")
	        {
	            loCheckBoxes[iAbnTools].checked = !isChecked;
	            loCheckBoxes[iAbnTools].click();
	        }
        }
        oElem.checked = isChecked;
	} else {
	    //alert("ALERT : "+oElem.id+" "+oElem.checked+" : "+isChecked);
		for(var iAbnTools = 0; iAbnTools < loCheckBoxes.length; iAbnTools++){
		    var id = "" + loCheckBoxes[iAbnTools].id;
		    if (isChecked)
		    {
		        if (id.substring(0,11) == "abntoolsOui")
		        {
		            loCheckBoxes[iAbnTools].checked = true;
		            loCheckBoxes[iAbnTools].click();
		        }
		    } else {
		        if (id.substring(0,11) == "abntoolsNon")
		        {
		            loCheckBoxes[iAbnTools].checked = true;
		            loCheckBoxes[iAbnTools].click();
		        }
		    }
	    }
	}	
	return true;
}

afficheQuestionnaire = function(idNewsletter,ouiNon){
    //alert("ALERT affiche: "+idNewsletter+" : "+ouiNon);
	var oDiv = document.getElementById('questionnaire' + idNewsletter);
	if (oDiv != null)
	{
	    if(ouiNon)
	        oDiv.style.display="block";
	    else
	       oDiv.style.display="none";
	}
	return true;
}

AbnTools.getImage	= function(lsURL, lsOnclick, lsAlt, lsStyle){
	var loImg		= new Image();
	loImg.src		= lsURL;
	var lsWidth		= loImg.width?'width="'+ loImg.width +'"':'';
	var lsHeight	= loImg.width?'width="'+ loImg.width +'"':'';
	lsOnclick		= lsOnclick?'onclick="'+ lsOnclick +'"':'';
	lsAlt			= lsAlt||'';
	lsStyle			= lsStyle||'';
	
	return '<img src="'+loImg.src+'" '+lsWidth+' '+lsHeight+' align="middle" '+lsOnclick+' style="'+lsStyle+'" alt="'+lsAlt+'">';
}

function CheckCheckbox(lsName)
{
	var chk = eval('document.all.' + lsName);
	
	if (chk.checked==true)
	{
		chk.checked=false;
	}
	else
	{
		chk.checked=true;
	}
}

AbnTools.prototype.display	= function(){

	var lsHTML = '<tr>'+
	'<td class="dots" colspan="5"><img src="' + AbnTools.protocol +
	AbnTools.imagePath_fr +'spacer.gif" width="1" height="20"></td>'+
	'</tr>'+
	'<tr>'+
	'<td valign="top">' +
		'<img src="' + AbnTools.protocol + AbnTools.imagePath_fr + this.imageName + '" width="'+
		this.imageWidth +'" height="'+ this.imageHeight +'" align="left" alt="'+ this.title +
		'"></td><td><img src="'+ AbnTools.protocol + AbnTools.imagePath_fr + 'spacer.gif" width="5" height="1" alt="" /></td><td>'+
		'<span class = "ClickableRow" onclick="document.getElementById(\'abntools' + this.index +
		'\').click();"><label for="abntools' + this.index +'" class="newsletterDescription_Text">'+
		this.description+'</label></span>&nbsp;';
	
lsHTML = lsHTML + '</td><td><img src="/images/spacer.gif" width="5" height="1" alt="" /></td><td align="right" valign="top" >'+'<div align="left"><input type="radio" name="abntoolsRad'+ this.newsLetterID + '" id="abntoolsOui'+ this.newsLetterID +'" class="newsletterRadio" value="Oui" onclick="if(this.checked){afficheQuestionnaire('+this.newsLetterID+',true);}">Oui</br><input type="radio" name="abntoolsRad'+ this.newsLetterID + '" id="abntoolsNon'+ this.newsLetterID +'" class="newsletterRadio" value="Non" onclick="if(this.checked){afficheQuestionnaire('+this.newsLetterID+',false);document.getElementById(\'_abntoolsselectall\').checked=false;}">Non</div>'+'</td>'+'</tr>';
	if (this.questionnaire != undefined){
	lsHTML = lsHTML + '<tr><td colspan="5"><div id="questionnaire'+this.newsLetterID +'" style="display:none">'+ this.questionnaire +'</div></td></tr>';
	}
	/*lsHTML = lsHTML + '</table>';*/
	document.write(lsHTML);
}
			
AbnTools.UseStyleSheet		= false
AbnTools.CheckboxName		= 'AbnToolsNewsletter';
AbnTools.RadioName         = 'AbnToolsNewsletter';

new AbnTools('SFR_Boutique',59,'La boutique SFR propose un grand choix de t&eacute;l&eacute;phone mobile 3G et 3G+, de forfait mobile et de forfait ADSL avec la Neuf box. Souhaitez-vous recevoir par voie &eacute;lectronique les offres et services SFR ?','59_35_logo_SFR_85x30.jpg',85,30);

new AbnTools('FDJ SPORT',32,'Avec le nouvel espace de paris sportifs FDJ&reg;, &agrave; vous l&rsquo;information pour mieux parier !<br />En exclusivit&eacute;, soyez alert&eacute; des PACTOLE&reg; Loto Foot 7&amp;15, des offres promotionnelles, de l\'actualit&eacute; sportive et des pronostics d\'experts.<br />Certifiez sur l\'honneur &ecirc;tre majeur et inscrivez-vous &agrave; la newsletter ParionsWeb','32_logo_fdjsport.jpg',85,30);

new AbnTools('orange',40,'D&eacute;couvrez vite les bons plans et offres exclusives d&rsquo;Orange France et France T&eacute;l&eacute;com SA<br />Je souhaite les recevoir par e-mail','40_orange.gif',85,30,'<table><tr><td>T&eacute;l&eacute;phone Mobile</td><td><input id="specificAnswer40_5_5_0" name ="specificAnswer40_5_5_0" type="text"  maxlength="10" onblur="verifierTelmobile(this)"/></td></tr></table>');


if(AbnTools.UseStyleSheet){
		document.write('<link rel="stylesheet" href="'+AbnTools.url_styles+'">');
}
document.write('<style>.dots {background-image: url(/abonews/images/dots.gif);'+
				' background-repeat: repeat-x; background-position: 50% 50%;}</style>');

document.write('<div style="display:block" id="abnToolsdiv">' +
	'<table cellpadding="0" cellspacing="0" border="0" id="abntoolcheckboxes" width="100%" class="abntoolsListTable">' +
	'<tr>' +
	'<td class="dots" colspan="5"><img src="' + AbnTools.protocol +
	AbnTools.imagePath_fr +'spacer.gif" width="1" height="20"></td>' +
	'</tr>' +
	'<tr>' +
	'<td colspan="4" class=ClickableRow onclick="document.getElementById(\'_abntoolsselectall\').click()">');

/*Ligne qui permet de selectionner toutes les newsletter*/
document.write('S&eacute;lectionner toutes les newsletters');/*writes select all image*/
document.write('</td>' +
	'<td><input type="checkbox" name="_abntoolsselectall" onclick="AbnTools.selectAllAbnTools(this)"'+
	' id="_abntoolsselectall" class="newsletterCheckbox"></td>' +
	'</tr>' +
	'</tr>');
				
AbnTools.Display()/*displays newsletters by calling display() method for each webbrand object*/

document.write('<tr>' +
	'<td class="dots" colspan="5" width=500 style="width:500;"><img src="' +
	AbnTools.protocol +
	AbnTools.imagePath_fr +
	'spacer.gif" width="1" height="20"><iframe style="position:absolute;left:-20000;"'+
	' src="'+AbnTools.url_visit+'" height="0px" width="0px"></iframe></td>' +
	'</tr>' +
	'</table>' +
	'</div>');
