<%~if adsize eq '300x250' and $ad_300x250%>
  <%~if forum_id eq '4' or page_id eq 'login'%>
	<%~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_lr_300x250%>" + '</div>'); }
	  </script>
	</div>
	<%~else%>
	<div class="ad">
	  <script type="text/javascript">
		  if (winWidth > 1024) { document.write('<div class="adwrapper">' + "<%escape_js ad_lr_300x250%>" + '</div>'); }
	  </script>
	</div>
	<%~endif%>
  <%~else%>
  	<%~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%>
  <%~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%>
  <%~if forum_id eq '4' or page_id eq 'login'%>
	 <div class="ad">
	   <script type="text/javascript">
		   if (winWidth > 1024) { document.write('<div class="adwrapper">' + "<%escape_js ad_lr_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%>
  <%~endif%>
<%~elsif adsize eq '728x90' and $ad_728x90%>
  <%~if forum_id eq '4' or page_id eq 'login'%>
  <div class="ad">
	<%~-- Serve leaderboard ad --%>
	<script type="text/javascript">
		if (winWidth >= 767) { document.write('<div class="adwrapper">' + "<%escape_js ad_lr_728x90%>" + '</div>'); }
	</script>
  </div>
  <%~else%>
  <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%>
<%~endif%>
