What I'm trying to do is check if class exist. If present add height by 'X' px in another class if not add height by 'Y' px

Not using Jquery. And it should be supported in IE8. `document.getElementsByClassName` is not supported in IE8 so used `className.match` but then again it started to get longer. My code below does not go past the 3rd 
[JSBIN](http://jsbin.com/gunomu/1/edit)

Any one with a short IE8 friendly code?

```
window.onload = window.onresize = function heightResize () {
var browserHeight = window.innerHeight;
var present=document.getElementsByTagName('p');
alert(present.length);
 for (var i=0; i<present.length; i++) {
  if (present[i].className.match(/\bbuttons-container\b/))
       {
 alert("Yes Present");
 document.getElementsByClassName("boxcontent")[0].style.height = browserHeight -150 + "px";
       } else {
alert("Not Present");
document.getElementsByClassName("boxcontent")[0].style.height = browserHeight -200 + "px";
              }

              }

              };

```

HTML

```
 <p>
First Para
 </p>
  <table>
  <tr>
  <td>
    <p>
Second Paragraph
    </p>
    <div  id ="overlay_modal" class="boxcontent">
      Output
    </div>
     </td>
   </tr>
   </table>

  <p>
Third Para
  </p>
   <p class="buttons-container">
Buttons
   </p>

```