var ra           = (new Date()).getTime() % 1000;
var ie           = navigator.appName.indexOf("Microsoft") >= 0;
var gecko        = navigator.userAgent.indexOf("Gecko") >= 0;
var blank        = "<table border=0 cellpadding=0 cellspacing=0><tr><td width=1 height=1></td></tr></table>";
var category     = 0;
var categories   = Array(
   2,  0, "Auto/moto",
   11, 0, "Būstas",
   4,  0, "Internetas",
   6,  0, "Turizmas",
   7,  0, "Kompiuteriai",
   8,  0, "Sveikata",
   9,  0, "Kultūra",
   5,  0, "Mokslas",
   3,  0, "Pomėgiai",
   12, 0, "Laisvalaikis",
   13, 0, "Programos",
   14, 0, "Regionai",
   15, 0, "Sportas",
   17, 0, "Teisė",
   18, 0, "Verslas",
   16, 0, "Visuomenė",
   19, 0, "Žiniasklaida",
   1,  1, "Asmeniniai",
   23, 1, "Fanų psl.",
   24, 1, "Anime",
   25, 1, "Žaidėjų klanai",
   22, 1, "Įvairūs",
   10, 1, "Bendravimas",
   20, 1, "Pinigai",
   21, 2, "Suaugusiems"
);

function popup(url) {
   window.open(url, "", "width=400,height=400" + (url.indexOf(".html") > 0 ? ",scrollbars=1" : ""));

   return false;
}

function popupLink(url, title, type) {
   return "<a" + (type ? " class=" + type : "") + " target=_blank href='" + url + "' onclick=\"return popup('" + url + "');\">" + title + "</a>";
}

function categories_box(category) {
   var c = new Array("normal", "restricted", "adult");
   var i, j;
   var s = "";

   for(i = 0; i < categories.length / 3; i++) {
      j = (i % 5 * 5 + Math.floor(i / 5)) * 3;
      s += (i % 5 ? "" : "<tr>") + "<td><img width=3 height=6 src='images/arrow.gif'></td><td class=small><a class=" + c[categories[j + 1]] + " href='top.php?category=" + categories[j] + "'><span" + (categories[j] == category ? " class=bold" : "") + ">" + categories[j + 2] + "</span></a></td>" + (i % 5 == 4 ? "</tr>" : "<td class=small>&nbsp;&nbsp;</td>");
   }

   return "<table border=0 cellpadding=1 cellspacing=1>" + s + "</table>";
}

function begin(now, c) {
   category = c;

   document.write(""
+ "<table width=100% border=0 cellpadding=0 cellspacing=0>"
+  "<tr>"
+   "<td height=8 bgcolor=999999>" + blank + "</td>"
+   "<td rowspan=2 width=604 align=center>"
+    "<table border=0 cellpadding=0 cellspacing=0>"
+     "<tr>"
+      "<td width=12><img width=12 height=32 src='images/bl.gif'></td>"
+      "<td class=upper>"
+       "<table width=592 border=0 cellpadding=0 cellspacing=0>"
+        "<tr align=center>"
+         "<td><a class=menu href='/'>Pradžia</a>&nbsp;&nbsp;</td>"
+         "<td width=2><img width=2 height=32 src='images/bar.gif'></td>"
+         "<td>&nbsp;&nbsp;<a class=menu href='accounts.php?command=signin'>Nariams</a>&nbsp;&nbsp;</td>"
+         "<td width=2><img width=2 height=32 src='images/bar.gif'></td>"
+         "<td>&nbsp;&nbsp;<a class=menu href='accounts.php?command=signup'>Registracija</a>&nbsp;&nbsp;</td>"
+         "<td width=2><img width=2 height=32 src='images/bar.gif'></td>"
+         "<td>&nbsp;&nbsp;<a class=menu href='top.php'>Top 100</a>&nbsp;&nbsp;</td>"
+         "<td width=2><img width=2 height=32 src='images/bar.gif'></td>"
+         "<td><table border=0 cellpadding=0 cellspacing=0><tr><td>&nbsp;&nbsp;</td><td><img width=15 height=15 src='images/clock.gif'></td><td>&nbsp;</td><td class=menu>" + now + "</td></tr></table></td>"
+        "</tr>"
+       "</table>"
+      "</td>"
+      "<td width=12><img width=12 height=32 src='images/br.gif'></td>"
+     "</tr>"
+    "</table>"
+   "</td>"
+   "<td height=8 bgcolor=999999>" + blank + "</td>"
+  "</tr>"
+  "<tr>"
+   "<td height=24></td>"
+   "<td height=24></td>"
+  "</tr>"
+  "<tr>"
+   "<td></td>"
+   "<td align=center>"
+    "<table border=0 cellpadding=0 cellspacing=0>"
+     "<tr>"
+      "<td><a href='/'><img width=120 height=120 border=0 src='images/logo.gif' alt='Hey.lt'></a></td>"
+      "<td width=16></td>"
+      "<td>"
+       "<table class=categories width=468 height=88 border=0 cellspacing=0 cellpadding=0>"
+        "<tr>"
+         "<td align=center>"
+          categories_box(category)
+         "</td>"
+        "</tr>"
+       "</table>"
+      "</td>"
+     "</tr>"
+    "</table>"
+   "</td>"
+   "<td></td>"
+  "</tr>"
+  "<tr>"
+   "<td></td>"
+   "<td align=center>"
+    "<table border=0 cellpadding=0 cellspacing=0>"
+     "<tr>"
+      "<td><iframe id='a354aa9a' name='a354aa9a' src='http://" + (category == 21 ? "www.468x60.lt/serve.php?920,1,1,frame(ffffff),category(5)" : "track.ads.lt/adframe.php?n=a354aa9a&amp;what=zone:4&amp;target=_blank") + "' framespacing='0' frameborder='no' scrolling='no' width='468' height='60'></iframe></td>"
+      "<td width=16></td>"
+      "<td><iframe id='a0a347d8' name='a0a347d8' src='http://" + (category == 21 ? "www.120x60.lt/serve.php?972,1,1,frame(ffffff),category(5)" : "track.ads.lt/adframe.php?n=a0a347d8&amp;what=zone:5&amp;target=_blank") + "' framespacing='0' frameborder='no' scrolling='no' width='120' height='60'></iframe></td>"
+     "</tr>"
+    "</table>"
+   "</td>"
+   "<td></td>"
+  "</tr>"
+  "<tr>"
+   "<td height=16></td>"
+  "</tr>"
+ "</table>"
+ "<div align=center>"
   );
}

function end() {
   document.write(""
+ "</div>"
+ "<table width=100% border=0 cellpadding=0 cellspacing=0>"
+  "<tr>"
+   "<td height=16></td>"
+  "</tr>"
+  "<tr>"
+   "<td align=center>"
+    "<a href='http://www.serveriai.lt/'><img border=0 src='//grafika.iv.lt/serveriai/small_logo.png' alt='Hostingo paslaugų lyderis'></a>\n"
+    "&nbsp;\n"
+    "<a href='http://www.dedikuoti.lt/'><img border=0 src='//grafika.iv.lt/dedikuoti/small_logo.png' alt='Dedikuoti serveriai profesionalams'></a>\n"
+    "&nbsp;\n"
+    "<a href='details.php?id=hey'><img width=88 height=31 border=0 src='count.php?id=hey&referer=" + escape(document.referrer) + "' alt='Nemokamas lankytojų skaitliukas'></a>\n"
+   "</td>"
+  "</tr>"
+  "<tr>"
+   "<td height=64></td>"
+  "</tr>"
+ "</table>"
   );
}

document.write(""
+ "<style>"
+  "<!--"
+   "body {margin: 0px; padding: 0px; background-color: white; color: black}"
+   "a {color: #6699cc}"
+   "a.menu {font-weight: bold; text-decoration: none}"
+   "a.menu:hover {text-decoration: underline}"
+   "a.normal {color: black; text-decoration: none}"
+   "a.normal:hover {text-decoration: underline}"
+   "a.restricted {color: #999999; text-decoration: none}"
+   "a.restricted:hover {text-decoration: underline}"
+   "a.adult {color: #cc9999; text-decoration: none}"
+   "a.adult:hover {text-decoration: underline}"
+   "a.top {color: black; text-decoration: none}"
+   "a.top:hover {text-decoration: underline}"
+   "p, td, th {font: 13px verdana, helvetica, sans-serif}"
+   ".small {font-size: 11px}"
+   ".white {color: white}"
+   ".bold {font-weight: bold}"
+   ".menu {font-size: 11px; color: white}"
+   ".header {font-weight: bold; background: #999999; color: white}"
+   ".footer {font-size: 11px; color: #999999}"
+   ".big {font-weight: bold; font-size: 18px; color: white}"
+   ".section {font-weight: bold; font-size: 18px; color: #999999}"
+   ".upper {background-image: url('images/bc.gif'); background-repeat: repeat-x}"
+   ".lower {background-image: url('images/tc.gif'); background-repeat: repeat-x}"
+   ".categories {background-image: url('images/categories.gif')}"
+ (
     ie || gecko
        ? ""
        : "input {font: 13px courier new, courier}"
  )
+  "-->"
+ "</style>"
);

