/*
 * Author: Lucas Pereira (lucaspereira1981@gmail.com)
 * Last update: 14 Out 2008
 */



   

// This function is responsible for setting the height of the iframe
// It's called when the iframe issues a "loaded" event
function setupFrame()
{
   // first has to remove the image element used as a loader
   if(document.getElementById('image')) {
      var elm = document.getElementById('image');
      elm.parentNode.removeChild(elm);
   }  
   
   var bmHTML = getIFrameHTML("BMunicipal");
   //var hasBM = (bmHTML.indexOf("<!--@DwNewsListContent-->")== -1)? true : false;

   if(bmHTML.match(/<!--@DwNewsListContent-->/g) == null)
       //alert("tem todas as revistas");
      document.getElementById('BMunicipal').height = 450;
   else {
      //alert("tem "+ (bmHTML.match(/<!--@DwNewsListContent-->/g)).length + " revistas");
      document.getElementById('BMunicipal').height = (bmHTML.match(/<!--@DwNewsListContent-->/g)).length * 214;
}

   //alert((bmHTML.match(/<!--@DwNewsListContent-->/g)).length);
   //document.getElementById('BMunicipal').height = (hasBMGR)? "430px" : "0px";

}

function getIFrameHTML(iFrameID){
   doc = window.frames[iFrameID].document.getElementsByTagName("body")[0].innerHTML;
   return doc;
}
