prova a metterci i var:

var i=0;
var tot=0;
var articoli = new Array();