## The contents of this file are subject to the Common Public Attribution
## License Version 1.0. (the "License"); you may not use this file except in
## compliance with the License. You may obtain a copy of the License at
## http://code.reddit.com/LICENSE. The License is based on the Mozilla Public
## License Version 1.1, but Sections 14 and 15 have been added to cover use of
## software over a computer network and provide for limited attribution for the
## Original Developer. In addition, Exhibit A has been modified to be
## consistent with Exhibit B.
##
## Software distributed under the License is distributed on an "AS IS" basis,
## WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
## the specific language governing rights and limitations under the License.
##
## The Original Code is reddit.
##
## The Original Developer is the Initial Developer.  The Initial Developer of
## the Original Code is reddit Inc.
##
## All portions of the code written by reddit are Copyright (c) 2006-2012
## reddit Inc. All Rights Reserved.
###############################################################################

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
  <head>
    <title></title>
    <style type="text/css">
      #ad {
      background-color: white; width: 100%; text-align: center;
      font: normal small verdana, arial, sans-serif}
      #adlink {
      background-color: white; width: 100%; text-align: center;
      font: normal small verdana, arial, sans-serif}
      #adlink {width: 100%; text-align: center;}
      #adlink a {color: #336699; text-decoration: none}
      #adlink a:hover {text-decoration: underline}
    </style>
    <script language="javascript" type="text/javascript">
      //<![CDATA[
      function rwt(a) {
        var ad = document.getElementById("ad")
        var s = ad.getElementsByTagName("embed")[0]
        if (!s) {
          var iframes = ad.getElementsByTagName("iframe");
          for(var i = 0; i < iframes.length; i++) {
             /* if pubmatic. there will be a tracking beacon with a unique ID*/
             if (iframes[i].getAttribute('name') == 'pbeacon') {
               var url = iframes[i].src;
               url = url.split('?');
               if (url[1]) {
                 var x = url[1].split('&');
                 for(var j = 0; j < x.length; j++) {
                    var y = x[j].split('=');
                    if (y[0] == 'adId') {
                      s = url[0] + "?" + x[j];
                      a.href = "http://ads.reddit.com/submit?url=" + encodeURIComponent(s);
                      return true;
                    }
                 }
               }
             } else if(iframes[i].offsetHeight > 100 && 
                       iframes[i].offsetWidth > 100) {
                s = iframes[i];
                break;
             }
          }
        }
        if (!s) s = ad.getElementsByTagName("img")[0]
        if (s) a.href = "http://ads.reddit.com/submit?url=" + encodeURIComponent(s.src);
        else a.target = ""
        return true;
      }
      //]]>
    </script>
  </head>
  <body style="padding: 0; margin: 0;">
    <div id="ad">
      <!-- begin ad tag  (tile=1)  -->
      <script language="JavaScript" type="text/javascript">
        //<![CDATA[
ord=Math.random()*10000000000000000;
document.write('<script language="JavaScript" src="http://ad.doubleclick.net/adj/${thing.dartsite}/${thing.tag};kw=${thing.keyword};tile=1;sz=300x250;ord=' + ord + '?" type="text/javascript"></scr' + 'ipt>');
//]]>
      </script>
      <noscript><a href="http://ad.doubleclick.net/jump/${thing.dartsite}/${thing.tag};kw=${thing.keyword};tile=1;sz=300x250;ord=123456789?" target="_blank"><img src="http://ad.doubleclick.net/ad/${thing.dartsite}/${thing.tag};kw=${thing.keyword};tile=1;sz=300x250;ord=123456789?" width="300" height="250" border="0" alt=""/></a></noscript>
    </div>
    <div id="adlink">
      <a target="_top" href="#" onmousedown="rwt(this)">
        ${_("reddit this ad")}
      </a>
    </div>
    <script language="JavaScript" type="text/javascript">
      //<![CDATA[
      document.write("<img alt='' src='${unsafe(thing.tracker_url)}&random=" + Math.random()*10000000000000000 + "'/>");
     //]]>
    </script>
  </body>
</html>
