// Script para criar divs para os boxes após cada h4

function criaBoxes()
{
  html = document.getElementById('blocos-planos').innerHTML;
  html = html.replace(/<br><br><h4>/gi,"<h4>"); //remove quebras de linha antes de cada cabeçalho H4
  html = html.replace(/<\/h4><br>/gi,"</h4>"); //remove quebras de linha antes de cada cabeçalho H4
  html = html.replace(/<h4>/gi,"</div></div><div class=chapeubloco><h4>").replace(/<\/h4>/gi,"</h4></div><div class=textobloco>");
  html = html.replace(/<\/div><\/div>/i,"");
  html = html.replace(/<br><br><br>/gi,"<br><br>");
  html = html.replace(/<br><br>/gi,"<div><br></div>");
  html += "</div>";
  document.getElementById('blocos-planos').innerHTML = html;

  var obj = document.getElementById('blocos-planos').getElementsByTagName("div");
  var ultimo = obj.length - 1;
  if (obj[ultimo-1].getElementsByTagName("h4")[0].innerHTML == ""){
    obj[ultimo-1].className+=" last";
    obj[ultimo].className+=" last";
  }
}
