function hasardFromTaux(tabElements){
    valHasard = Math.random()*100;
    maxElement = 0;
    for (idElement in tabElements){
        maxElement += tabElements[idElement][1];
        if (valHasard<=maxElement)
            return tabElements[idElement][0];
    }
    return false;
}
tabPublications= [["<a href='http://adserver.24h00.com/redirections/pubs/redirection_212.php?place=146' target='_blank'><img src='http://adserver.24h00.com/redirections/pubs/pub_212.gif?place=146' width='186' height='116' border='0' alt='Tercera Afflelou'></a>", 25], ["<a href='http://adserver.24h00.com/redirections/pubs/redirection_214.php?place=146' target='_blank'><img src='http://adserver.24h00.com/redirections/pubs/pub_214.gif?place=146' width='186' height='116' border='0' alt='Ear Piercing'></a>", 25], ["<a href='http://adserver.24h00.com/redirections/pubs/redirection_216.php?place=146' target='_blank'><img src='http://adserver.24h00.com/redirections/pubs/pub_216.gif?place=146' width='186' height='116' border='0' alt='Boutique Phildar'></a>", 25], ["<a href='http://adserver.24h00.com/redirections/pubs/redirection_218.php?place=146' target='_blank'><img src='http://adserver.24h00.com/redirections/pubs/pub_218.gif?place=146' width='186' height='116' border='0' alt='Texto Saint Medard'></a>", 25]];
document.write(hasardFromTaux(tabPublications));



