<%~if adsize eq '300x250' and $ad_300x250%>
<%~if admod eq 'mobile' or $admod eq 'tablet'%>
<div class="ad<%if admod eq 'mobile'%> admob<%elsif admod eq 'tablet'%> adtab<%endif%>">
  <%~-- Serve ad for tablet/mobile --%>
  <script type="text/javascript">
      if (winWidth <= 1024) { document.write('<div class="adwrapper">' + "<%escape_js ad_300x250%>" + '</div>'); }
  </script>
</div>
<%~else%>
<div class="ad">
  <script type="text/javascript">
      if (winWidth > 1024) { document.write('<div class="adwrapper">' + "<%escape_js ad_300x250%>" + '</div>'); }
  </script>
</div>
<%~endif%>
<%~elsif adsize eq '300x600' and $ad_300x600%>
<%~if admod eq 'mobile' or $admod eq 'tablet'%>
<div class="ad<%if admod eq 'mobile'%> admob<%elsif admod eq 'tablet'%> adtab<%endif%>">
  <%~-- Serve ad for tablet/mobile --%>
  <script type="text/javascript">
      if (winWidth <= 1024) { document.write('<div class="adwrapper">' + "<%escape_js ad_300x600%>" + '</div>'); }
  </script>
</div>
<%~else%>
<div class="ad">
  <script type="text/javascript">
      if (winWidth > 1024) { document.write('<div class="adwrapper">' + "<%escape_js ad_300x600%>" + '</div>'); }
  </script>
</div>
<%~endif%>
<%~elsif adsize eq '728x90' and $ad_728x90%>
<div class="ad">
  <%~-- Serve leaderboard ad --%>
  <script type="text/javascript">
      if (winWidth >= 767) { document.write('<div class="adwrapper">' + "<%escape_js ad_728x90%>" + '</div>'); }
  </script>
</div>
<%~endif%>
