
function p(kilpi,hist)
{
    document.write("<BR CLEAR=\"left\"><BR><BR><A HREF=\"javascript:history_win('/historia.cgi?kilpi=",kilpi,"')\"><IMG SRC=\"/font/BLANK",hist,".GIF\" WIDTH=\"18\" HEIGHT=\"41\" ALT=\"Kilven historiatiedot\" BORDER=0 HSPACE=0 ALIGN=\"left\"></A>");
    document.write("<IMG SRC=\"../font/VASEN.GIF\" WIDTH=\"8\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
    if (kilpi.length==5) document.write("<IMG SRC=\"../font/PUOLI.GIF\" WIDTH=\"9\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
    if (kilpi.length==4) document.write("<IMG SRC=\"../font/TYHJA.GIF\" WIDTH=\"18\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
    for (var i=0 ; i<kilpi.length ; i++)
    {
      if (kilpi.charAt(i)=='-') { document.write("<IMG SRC=\"../font/-.GIF\" WIDTH=\"9\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">") }
      else document.write("<IMG SRC=\"../font/",kilpi.charAt(i),".GIF\" WIDTH=\"18\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
    }
    if (kilpi.length==5) document.write("<IMG SRC=\"../font/PUOLI.GIF\" WIDTH=\"9\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
    if (kilpi.length==4) document.write("<IMG SRC=\"../font/TYHJA.GIF\" WIDTH=\"18\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
    document.write("<IMG SRC=\"../font/OIKEA.GIF\" WIDTH=\"8\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
    if (kilpi.length<=6) document.write("<IMG SRC=\"../font/BLANK.GIF\" WIDTH=\"18\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
    document.write("<IMG SRC=\"../font/BLANK2.GIF\" WIDTH=\"35\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
}

function P(kilpi,hist)
{
    document.write("<BR CLEAR=\"left\"><BR><BR><A HREF=\"javascript:history_win('/historia.cgi?kilpi=",kilpi,"')\"><IMG SRC=\"/font/BLANK",hist,".GIF\" WIDTH=\"18\" HEIGHT=\"41\" ALT=\"Kilven historiatiedot\" BORDER=0 HSPACE=0 ALIGN=\"left\"></A>");
    document.write("<IMG SRC=\"../font/VASEN.GIF\" WIDTH=\"8\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
    if (kilpi.length==6) document.write("<IMG SRC=\"../font/PUOLI.GIF\" WIDTH=\"9\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
    if (kilpi.length==5) document.write("<IMG SRC=\"../font/TYHJA.GIF\" WIDTH=\"18\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
    if (kilpi.length==4) document.write("<IMG SRC=\"../font/PUOLI.GIF\" WIDTH=\"9\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\"><IMG SRC=\"../font/TYHJA.GIF\" WIDTH=\"18\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
    for (var i=0 ; i<kilpi.length ; i++)
    {
      if (kilpi.charAt(i)=='-') { document.write("<IMG SRC=\"../font/-.GIF\" WIDTH=\"9\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">") }
      else document.write("<IMG SRC=\"../font/",kilpi.charAt(i),".GIF\" WIDTH=\"18\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
    }
    if (kilpi.length==6) document.write("<IMG SRC=\"../font/PUOLI.GIF\" WIDTH=\"9\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
    if (kilpi.length==5) document.write("<IMG SRC=\"../font/TYHJA.GIF\" WIDTH=\"18\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
    if (kilpi.length==4) document.write("<IMG SRC=\"../font/PUOLI.GIF\" WIDTH=\"9\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\"><IMG SRC=\"../font/TYHJA.GIF\" WIDTH=\"18\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
    document.write("<IMG SRC=\"../font/OIKEA.GIF\" WIDTH=\"8\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
    document.write("<IMG SRC=\"../font/BLANK2.GIF\" WIDTH=\"35\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
}

function E(kilpi,hist)
{
    document.write("<BR CLEAR=\"left\"><BR><BR><A HREF=\"javascript:history_win('/historia.cgi?kilpi=",kilpi,"')\"><IMG SRC=\"/font/BLANK",hist,".GIF\" WIDTH=\"18\" HEIGHT=\"41\" ALT=\"Kilven historiatiedot\" BORDER=0 HSPACE=0 ALIGN=\"left\"></A>");
    document.write("<IMG SRC=\"../font/EURO.GIF\" WIDTH=\"25\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
    if (kilpi.length==6) document.write("<IMG SRC=\"../font/PUOLI.GIF\" WIDTH=\"9\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
    if (kilpi.length==5) document.write("<IMG SRC=\"../font/TYHJA.GIF\" WIDTH=\"18\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
    if (kilpi.length==4) document.write("<IMG SRC=\"../font/PUOLI.GIF\" WIDTH=\"9\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\"><IMG SRC=\"../font/TYHJA.GIF\" WIDTH=\"18\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
    for (var i=0 ; i<kilpi.length ; i++)
    {
      if (kilpi.charAt(i)=='-') { document.write("<IMG SRC=\"../font/-.GIF\" WIDTH=\"9\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">") }
      else document.write("<IMG SRC=\"../font/",kilpi.charAt(i),".GIF\" WIDTH=\"18\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
    }
    if (kilpi.length==6) document.write("<IMG SRC=\"../font/PUOLI.GIF\" WIDTH=\"9\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
    if (kilpi.length==5) document.write("<IMG SRC=\"../font/TYHJA.GIF\" WIDTH=\"18\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
    if (kilpi.length==4) document.write("<IMG SRC=\"../font/PUOLI.GIF\" WIDTH=\"9\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\"><IMG SRC=\"../font/TYHJA.GIF\" WIDTH=\"18\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
    document.write("<IMG SRC=\"../font/OIKEA.GIF\" WIDTH=\"8\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
    document.write("<IMG SRC=\"../font/BLANK.GIF\" WIDTH=\"18\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
}

function m(kilpi,hist)
{
    document.write("<BR CLEAR=\"left\"><BR><BR><A HREF=\"javascript:history_win('/historia.cgi?kilpi=",kilpi,"')\"><IMG SRC=\"/font/BLANK",hist,".GIF\" WIDTH=\"18\" HEIGHT=\"41\" ALT=\"Kilven historiatiedot\" BORDER=0 HSPACE=0 ALIGN=\"left\"></A>");
    document.write("<IMG SRC=\"../font/black/VASEN.GIF\" WIDTH=\"8\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
    if (kilpi.length==5) document.write("<IMG SRC=\"../font/black/PUOLI.GIF\" WIDTH=\"9\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
    if (kilpi.length==4) document.write("<IMG SRC=\"../font/black/TYHJA.GIF\" WIDTH=\"18\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
    for (var i=0 ; i<kilpi.length ; i++)
    {
      if (kilpi.charAt(i)=='-') { document.write("<IMG SRC=\"../font/black/-.GIF\" WIDTH=\"9\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">") }
      else document.write("<IMG SRC=\"../font/black/",kilpi.charAt(i),".GIF\" WIDTH=\"18\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
    }
    if (kilpi.length==5) document.write("<IMG SRC=\"../font/black/PUOLI.GIF\" WIDTH=\"9\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
    if (kilpi.length==4) document.write("<IMG SRC=\"../font/black/TYHJA.GIF\" WIDTH=\"18\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
    document.write("<IMG SRC=\"../font/black/OIKEA.GIF\" WIDTH=\"8\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
    document.write("<IMG SRC=\"../font/black/BLANK.GIF\" WIDTH=\"18\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
    document.write("<IMG SRC=\"../font/BLANK2.GIF\" WIDTH=\"35\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
}

function M(kilpi,hist)
{
    document.write("<BR CLEAR=\"left\"><BR><BR><A HREF=\"javascript:history_win('/historia.cgi?kilpi=",kilpi,"')\"><IMG SRC=\"/font/BLANK",hist,".GIF\" WIDTH=\"18\" HEIGHT=\"41\" ALT=\"Kilven historiatiedot\" BORDER=0 HSPACE=0 ALIGN=\"left\"></A>");
    document.write("<IMG SRC=\"../font/black/VASEN.GIF\" WIDTH=\"8\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
    if (kilpi.length==6) document.write("<IMG SRC=\"../font/black/PUOLI.GIF\" WIDTH=\"9\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
    if (kilpi.length==5) document.write("<IMG SRC=\"../font/black/TYHJA.GIF\" WIDTH=\"18\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
    if (kilpi.length==4) document.write("<IMG SRC=\"../font/black/PUOLI.GIF\" WIDTH=\"9\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\"><IMG SRC=\"../font/black/TYHJA.GIF\" WIDTH=\"18\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
    for (var i=0 ; i<kilpi.length ; i++)
    {
      if (kilpi.charAt(i)=='-') { document.write("<IMG SRC=\"../font/black/-.GIF\" WIDTH=\"9\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">") }
      else document.write("<IMG SRC=\"../font/black/",kilpi.charAt(i),".GIF\" WIDTH=\"18\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
    }
    if (kilpi.length==6) document.write("<IMG SRC=\"../font/black/PUOLI.GIF\" WIDTH=\"9\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
    if (kilpi.length==5) document.write("<IMG SRC=\"../font/black/TYHJA.GIF\" WIDTH=\"18\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
    if (kilpi.length==4) document.write("<IMG SRC=\"../font/black/PUOLI.GIF\" WIDTH=\"9\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\"><IMG SRC=\"../font/black/TYHJA.GIF\" WIDTH=\"18\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
    document.write("<IMG SRC=\"../font/black/OIKEA.GIF\" WIDTH=\"8\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
    document.write("<IMG SRC=\"../font/BLANK2.GIF\" WIDTH=\"35\" HEIGHT=\"41\" BORDER=\"0\" HSPACE=0 ALIGN=\"left\">");
}

function comeon()
{
 if ((document.referrer+'x').toLowerCase().indexOf('kilvet.com') == -1)
   location.href = '../';
}

function kuva(kilpi,w,h,takenby,other,linkki,pic_old,img_nr,desc)
{
 popup1=window.open("","popup1","toolbar=0,status=1,resizable=1,width=640,height=620"); popup1.document.clear();
 popup1.document.write("<HTML><HEAD><TITLE>KILVET.COM</TITLE><STYLE><!-- A{text-decoration:none} --></STYLE></HEAD><BODY BACKGROUND=\"/images/chalk.jpg\">");

 var maxw=585;
 popup1.document.write("<IMG SRC=\"");
 if (w <= maxw)
  { popup1.document.write("/imgload.cgi?image=",kilpi,"&in=",img_nr,"&width=",w,"\" WIDTH=",w," HEIGHT=",h," "); }
  else popup1.document.write("/resize.cgi?image=",kilpi,"&in=",img_nr,"&width=",maxw,"\" WIDTH=",maxw," HEIGHT=",Math.round(eval("maxw/w*h"))," ");
 popup1.document.write("ALT=\"");
 for (var i=0 ; i<kilpi.length ; i++)
  {
    if (kilpi.charAt(i)=='_') { popup1.document.write("&Aring;"); }
    else if (kilpi.charAt(i)=='a') { popup1.document.write("&Auml;"); }
    else if (kilpi.charAt(i)=='o') { popup1.document.write("&Ouml;"); }
    else popup1.document.write(kilpi.charAt(i));
  }
 popup1.document.write("\" BORDER=0><BR><FONT FACE=\"Courier\" SIZE=1><A HREF=\"historia.cgi?kilpi=",kilpi,"\" TARGET=\"_blank\" onMouseOver=\"window.status='Click for history of this plate...'; return true\" OnMouseOut=\"window.status='Document: Done'; return true\">");
 for (var i=0 ; i<kilpi.length ; i++)
  {
    if (kilpi.charAt(i)=='_') { popup1.document.write("&Aring;"); }
    else if (kilpi.charAt(i)=='a') { popup1.document.write("&Auml;"); }
    else if (kilpi.charAt(i)=='o') { popup1.document.write("&Ouml;"); }
    else popup1.document.write(kilpi.charAt(i));
  }
 popup1.document.write("</A></FONT><FONT FACE=\"Arial\" SIZE=1>. Kuva: ");
 if (linkki=="")
  { popup1.document.write(takenby); }
 else popup1.document.write ("<A HREF=\"",linkki,"\" TARGET=\"_blank\">",takenby,"</A>");

 if (other!="") popup1.document.write(" ",other);

 popup1.document.write("</FONT><P><BR><FONT FACE=\"Arial\" SIZE=2>",desc,"<P>");

 if (pic_old==2)
  { popup1.document.write("<A HREF=\"haku.cgi?kilpi=",kilpi,"\" TARGET=\"_blank\" onMouseOver=\"window.status='These plates are not on this car any more...'; return true\" OnMouseOut=\"window.status='Document: Done'; return true\">Kilvet ovat nyky&auml;&auml;n toisessa autossa...</A>"); }

 if ( (w==640 && h<=480) || (w<=640 && h==480) )
  { popup1.document.write("<P>Vaihtoehtoinen kuvan koko: &nbsp;&nbsp;<A HREF=\"\" onClick='popup=window.open(\"\",\"popup\",\"toolbar=0,width=",w+15,",height=",h+20,"\"); popup.document.clear(); ");
    popup1.document.write("popup.document.write(\"<HTML><HEAD><TITLE>KILVET.COM</TITLE></HEAD><BODY>\");");

    popup1.document.write("popup.document.write(\"<IMG SRC=/imgload.cgi?image=",kilpi,"&in=",img_nr,"&width=",w," BORDER=0></BODY></HTML>\"); popup.document.close(); ");
    popup1.document.write("return false;' onMouseOver=\"window.status='",w,"x",h," version of the picture'; return true\" OnMouseOut=\"window.status='Document: Done'; return true\">",w,"x",h,"</A>"); }
 else if (w/h >= 4/3 && w >= 640)
  { popup1.document.write("<P>Vaihtoehtoinen kuvan koko: &nbsp;&nbsp;<A HREF=\"\" onClick='popup=window.open(\"\",\"popup\",\"toolbar=0,width=655,height=",Math.round(eval("640/w*h"))+20,"\"); popup.document.clear(); ");
    popup1.document.write("popup.document.write(\"<HTML><HEAD><TITLE>KILVET.COM</TITLE></HEAD><BODY>\");");

    popup1.document.write("popup.document.write(\"<IMG SRC=/resize.cgi?image=",kilpi,"&in=",img_nr,"&width=640 BORDER=0></BODY></HTML>\"); popup.document.close(); return false;' onMouseOver=\"window.status='640x",Math.round(eval("640/w*h"))," version of the picture'; return true\" OnMouseOut=\"window.status='Document: Done'; return true\">640x",Math.round(eval("640/w*h")),"</A>"); }
 else if (w/h < 4/3 && h >= 480)
  { popup1.document.write("<P>Vaihtoehtoinen kuvan koko: &nbsp;&nbsp;<A HREF=\"\" onClick='popup=window.open(\"\",\"popup\",\"toolbar=0,width=",Math.round(eval("480/h*w"))+15,",height=500\"); popup.document.clear(); ");
    popup1.document.write("popup.document.write(\"<HTML><HEAD><TITLE>KILVET.COM</TITLE></HEAD><BODY>\");");

    popup1.document.write("popup.document.write(\"<IMG SRC=/resize.cgi?image=",kilpi,"&in=",img_nr,"&height=480 BORDER=0></BODY></HTML>\"); popup.document.close(); return false;' onMouseOver=\"window.status='",Math.round(eval("480/h*w")),"x480 version of the picture'; return true\" OnMouseOut=\"window.status='Document: Done'; return true\">",Math.round(eval("480/h*w")),"x480</A>"); }

 if ( (w==800 && h<=600) || (w<=800 && h==600) )
  { popup1.document.write("&nbsp;&nbsp;<A HREF=\"\" onClick='popup=window.open(\"\",\"popup\",\"toolbar=0,width=",w+15,",height=",h+20,"\"); popup.document.clear(); ");
    popup1.document.write("popup.document.write(\"<HTML><HEAD><TITLE>KILVET.COM</TITLE></HEAD><BODY>\");");

    popup1.document.write("popup.document.write(\"<IMG SRC=/imgload.cgi?image=",kilpi,"&in=",img_nr,"&width=",w," BORDER=0></BODY></HTML>\"); popup.document.close(); ");
    popup1.document.write("return false;' onMouseOver=\"window.status='",w,"x",h," version of the picture'; return true\" OnMouseOut=\"window.status='Document: Done'; return true\">",w,"x",h,"</A>"); }
 else if (w/h >= 4/3 && w >= 800)
  { popup1.document.write("&nbsp;&nbsp;<A HREF=\"\" onClick='popup=window.open(\"\",\"popup\",\"toolbar=0,width=815,height=",Math.round(eval("800/w*h"))+20,"\"); popup.document.clear(); ");
    popup1.document.write("popup.document.write(\"<HTML><HEAD><TITLE>KILVET.COM</TITLE></HEAD><BODY>\");");

    popup1.document.write("popup.document.write(\"<IMG SRC=/resize.cgi?image=",kilpi,"&in=",img_nr,"&width=800 BORDER=0></BODY></HTML>\"); popup.document.close(); return false;' onMouseOver=\"window.status='800x",Math.round(eval("800/w*h"))," version of the picture'; return true\" OnMouseOut=\"window.status='Document: Done'; return true\">800x",Math.round(eval("800/w*h")),"</A>"); }
 else if (w/h < 4/3 && h >= 600)
  { popup1.document.write("&nbsp;&nbsp;<A HREF=\"\" onClick='popup=window.open(\"\",\"popup\",\"toolbar=0,width=",Math.round(eval("600/h*w"))+15,",height=620\"); popup.document.clear(); ");
    popup1.document.write("popup.document.write(\"<HTML><HEAD><TITLE>KILVET.COM</TITLE></HEAD><BODY>\");");

    popup1.document.write("popup.document.write(\"<IMG SRC=/resize.cgi?image=",kilpi,"&in=",img_nr,"&height=600 BORDER=0></BODY></HTML>\"); popup.document.close(); return false;' onMouseOver=\"window.status='",Math.round(eval("600/h*w")),"x600 version of the picture'; return true\" OnMouseOut=\"window.status='Document: Done'; return true\">",Math.round(eval("600/h*w")),"x600</A>"); }

 if ( (w==1024 && h<=768) || (w<=1024 && h==768) )
  { popup1.document.write("&nbsp;&nbsp;<A HREF=\"\" onClick='popup=window.open(\"\",\"popup\",\"toolbar=0,width=",w+15,",height=",h+20,"\"); popup.document.clear(); ");
    popup1.document.write("popup.document.write(\"<HTML><HEAD><TITLE>KILVET.COM</TITLE></HEAD><BODY>\");");

    popup1.document.write("popup.document.write(\"<IMG SRC=/imgload.cgi?image=",kilpi,"&in=",img_nr,"&width=",w," BORDER=0></BODY></HTML>\"); popup.document.close(); ");
    popup1.document.write("return false;' onMouseOver=\"window.status='",w,"x",h," version of the picture'; return true\" OnMouseOut=\"window.status='Document: Done'; return true\">",w,"x",h,"</A>"); }
 else if (w/h >= 4/3 && w >= 1024)
  { popup1.document.write("&nbsp;&nbsp;<A HREF=\"\" onClick='popup=window.open(\"\",\"popup\",\"toolbar=0,width=1039,height=",Math.round(eval("1024/w*h"))+20,"\"); popup.document.clear(); ");
    popup1.document.write("popup.document.write(\"<HTML><HEAD><TITLE>KILVET.COM</TITLE></HEAD><BODY>\");");

    popup1.document.write("popup.document.write(\"<IMG SRC=/resize.cgi?image=",kilpi,"&in=",img_nr,"&width=1024 BORDER=0></BODY></HTML>\"); popup.document.close(); return false;' onMouseOver=\"window.status='1024x",Math.round(eval("1024/w*h"))," version of the picture'; return true\" OnMouseOut=\"window.status='Document: Done'; return true\">1024x",Math.round(eval("1024/w*h")),"</A>"); }
 else if (w/h < 4/3 && h >= 768)
  { popup1.document.write("&nbsp;&nbsp;<A HREF=\"\" onClick='popup=window.open(\"\",\"popup\",\"toolbar=0,width=",Math.round(eval("768/h*w"))+15,",height=788\"); popup.document.clear(); ");
    popup1.document.write("popup.document.write(\"<HTML><HEAD><TITLE>KILVET.COM</TITLE></HEAD><BODY>\");");

    popup1.document.write("popup.document.write(\"<IMG SRC=/resize.cgi?image=",kilpi,"&in=",img_nr,"&height=768 BORDER=0></BODY></HTML>\"); popup.document.close(); return false;' onMouseOver=\"window.status='",Math.round(eval("768/h*w")),"x768 version of the picture'; return true\" OnMouseOut=\"window.status='Document: Done'; return true\">",Math.round(eval("768/h*w")),"x768</A>"); }

 if ( (w==1152 && h<=864) || (w<=1152 && h==864) )
  { popup1.document.write("&nbsp;&nbsp;<A HREF=\"\" onClick='popup=window.open(\"\",\"popup\",\"toolbar=0,width=",w+15,",height=",h+20,"\"); popup.document.clear(); ");
    popup1.document.write("popup.document.write(\"<HTML><HEAD><TITLE>KILVET.COM</TITLE></HEAD><BODY>\");");

    popup1.document.write("popup.document.write(\"<IMG SRC=/imgload.cgi?image=",kilpi,"&in=",img_nr,"&width=",w," BORDER=0></BODY></HTML>\"); popup.document.close(); ");
    popup1.document.write("return false;' onMouseOver=\"window.status='",w,"x",h," version of the picture'; return true\" OnMouseOut=\"window.status='Document: Done'; return true\">",w,"x",h,"</A>"); }
 else if (w/h >= 4/3 && w >= 1152)
  { popup1.document.write("&nbsp;&nbsp;<A HREF=\"\" onClick='popup=window.open(\"\",\"popup\",\"toolbar=0,width=1167,height=",Math.round(eval("1152/w*h"))+20,"\"); popup.document.clear(); ");
    popup1.document.write("popup.document.write(\"<HTML><HEAD><TITLE>KILVET.COM</TITLE></HEAD><BODY>\");");

    popup1.document.write("popup.document.write(\"<IMG SRC=/resize.cgi?image=",kilpi,"&in=",img_nr,"&width=1152 BORDER=0></BODY></HTML>\"); popup.document.close(); return false;' onMouseOver=\"window.status='1152x",Math.round(eval("1152/w*h"))," version of the picture'; return true\" OnMouseOut=\"window.status='Document: Done'; return true\">1152x",Math.round(eval("1152/w*h")),"</A>"); }
 else if (w/h < 4/3 && h >= 864)
  { popup1.document.write("&nbsp;&nbsp;<A HREF=\"\" onClick='popup=window.open(\"\",\"popup\",\"toolbar=0,width=",Math.round(eval("864/h*w"))+15,",height=884\"); popup.document.clear(); ");
    popup1.document.write("popup.document.write(\"<HTML><HEAD><TITLE>KILVET.COM</TITLE></HEAD><BODY>\");");

    popup1.document.write("popup.document.write(\"<IMG SRC=/resize.cgi?image=",kilpi,"&in=",img_nr,"&height=864 BORDER=0></BODY></HTML>\"); popup.document.close(); return false;' onMouseOver=\"window.status='",Math.round(eval("864/h*w")),"x864 version of the picture'; return true\" OnMouseOut=\"window.status='Document: Done'; return true\">",Math.round(eval("864/h*w")),"x864</A>"); }

 if ( (w==1280 && h<=960) || (w<=1280 && h==960) )
  { popup1.document.write("&nbsp;&nbsp;<A HREF=\"\" onClick='popup=window.open(\"\",\"popup\",\"toolbar=0,resizable=1,scrollbars=1,width=",w+31,",height=",h+36,"\"); popup.document.clear(); ");
    popup1.document.write("popup.document.write(\"<HTML><HEAD><TITLE>KILVET.COM</TITLE></HEAD><BODY>\");");

    popup1.document.write("popup.document.write(\"<IMG SRC=/imgload.cgi?image=",kilpi,"&in=",img_nr,"&width=",w," BORDER=0></BODY></HTML>\"); popup.document.close(); ");
    popup1.document.write("return false;' onMouseOver=\"window.status='",w,"x",h," version of the picture'; return true\" OnMouseOut=\"window.status='Document: Done'; return true\">",w,"x",h,"</A>"); }
 else if (w/h >= 5/4 && w >= 1280)
  { popup1.document.write("&nbsp;&nbsp;<A HREF=\"\" onClick='popup=window.open(\"\",\"popup\",\"toolbar=0,resizable=1,scrollbars=1,width=1311,height=",Math.round(eval("1280/w*h"))+36,"\"); popup.document.clear(); ");
    popup1.document.write("popup.document.write(\"<HTML><HEAD><TITLE>KILVET.COM</TITLE></HEAD><BODY>\");");

    popup1.document.write("popup.document.write(\"<IMG SRC=/resize.cgi?image=",kilpi,"&in=",img_nr,"&width=1280 BORDER=0></BODY></HTML>\"); popup.document.close(); return false;' onMouseOver=\"window.status='1280x",Math.round(eval("1280/w*h"))," version of the picture'; return true\" OnMouseOut=\"window.status='Document: Done'; return true\">1280x",Math.round(eval("1280/w*h")),"</A>"); }
 else if (w/h < 5/4 && h >= 1024)
  { popup1.document.write("&nbsp;&nbsp;<A HREF=\"\" onClick='popup=window.open(\"\",\"popup\",\"toolbar=0,width=",Math.round(eval("1024/h*w"))+15,",height=1044\"); popup.document.clear(); ");
    popup1.document.write("popup.document.write(\"<HTML><HEAD><TITLE>KILVET.COM</TITLE></HEAD><BODY>\");");

    popup1.document.write("popup.document.write(\"<SCRIPT>function right(e) { if (navigator.appName.length==8 && (e.which == 3 || e.which == 2)) return false; else if (navigator.appName.length==27 \");");
    popup1.document.write("popup.document.write(\"&& (event.button == 2 || event.button == 3)) { alert(document.title); return false; } return true; } document.onmousedown=right; document.onmouseup=right; if (document.layers) \");");
    popup1.document.write("popup.document.write(\"window.captureEvents(Event.MOUSEDOWN); if (document.layers) window.captureEvents(Event.MOUSEUP); window.onmousedown=right; window.onmouseup=right;</SCRIPT>\");");

    popup1.document.write("popup.document.write(\"<IMG SRC=/resize.cgi?image=",kilpi,"&in=",img_nr,"&height=1024 BORDER=0></BODY></HTML>\"); popup.document.close(); return false;' onMouseOver=\"window.status='",Math.round(eval("1024/h*w")),"x1024 version of the picture'; return true\" OnMouseOut=\"window.status='Document: Done'; return true\">",Math.round(eval("1024/h*w")),"x1024</A>"); }

 if (pic_old==1)
  { popup1.document.write("<P><A HREF=\"haku.cgi?kilpi=",kilpi,"\" TARGET=\"_blank\" onMouseOver=\"window.status='Earlier car with same plates...'; return true\" OnMouseOut=\"window.status='Document: Done'; return true\">Aiempi auto samoin kilvin...</A>"); }

 popup1.document.write("</FONT></BODY></HTML>");
 popup1.document.close();
 return false;
}

function pic(kilpi,w,h,takenby,other,linkki,pic_old,img_nr,pvm,desc)
{
 var the_desc=desc;
 while (desc.indexOf("&quot;") != -1)
 {
  desc=desc.substring(0,desc.indexOf("&quot;"))+"&amp;quot;"+desc.substring(6+desc.indexOf("&quot;"),desc.length);
 }
 document.write(the_desc,"&nbsp;&nbsp;&nbsp;&nbsp;<A HREF='' onMouseOver=\"window.status='Document: Done'; return true\" onMouseOut=\"window.status='Document: Done'; return true\" onClick='return kuva(\"",kilpi,"\",",w,",",h,",\"",takenby,"\",\"",other,"\",\"",linkki,"\",",pic_old,",",img_nr,",\"",desc,"\")'><IMG SRC=\"../images/KUVA.GIF\" TITLE=\"");
 for (var i=0 ; i<kilpi.length ; i++)
  {
    if (kilpi.charAt(i)=='_') { window.document.write("&Aring;"); }
    else if (kilpi.charAt(i)=='a') { window.document.write("&Auml;"); }
    else if (kilpi.charAt(i)=='o') { window.document.write("&Ouml;"); }
    else window.document.write(kilpi.charAt(i));
  }
 document.write(" (max. ",w,"x",h,")\" BORDER=0></A>");
}

function img(kilpi,w,h,takenby,other,linkki,pic_old,img_nr,pvm,desc)
{
 var the_desc=desc;
 while (desc.indexOf("&quot;") != -1)
 {
  desc=desc.substring(0,desc.indexOf("&quot;"))+"&amp;quot;"+desc.substring(6+desc.indexOf("&quot;"),desc.length);
 }
 var thumbw=110; document.write("<A HREF=\"\" onClick='return kuva(\"",kilpi,"\",",w,",",h,",\"",takenby,"\",\"",other,"\",\"",linkki,"\",",pic_old,",",img_nr,",\"",desc,"\")' onMouseOver=\"window.status='",the_desc,"'; return true\" OnMouseOut=\"window.status='Document: Done'; return true\">");
 document.write("<IMG SRC=\"/resize.cgi?image=",kilpi,"&in=",img_nr,"&width=",thumbw,"\" TITLE=\"");
 for (var i=0 ; i<kilpi.length ; i++)
  {
    if (kilpi.charAt(i)=='_') { document.write("&Aring;"); }
    else if (kilpi.charAt(i)=='a') { document.write("&Auml;"); }
    else if (kilpi.charAt(i)=='o') { document.write("&Ouml;"); }
    else document.write(kilpi.charAt(i));
  }
 document.write(" (max. ",w,"x",h,")\" WIDTH=",thumbw," HEIGHT=",Math.round(eval("thumbw/w*h"))," BORDER=1></A>");
}

function check()
{ 
  if (!document.havainto.kilpi.value) { alert('Kirjoita ensin rekisteritunnus.');
    document.havainto.kilpi.focus(); document.havainto.kilpi.select(); return false; }
  if (document.havainto.kilpi.value.indexOf("-") == -1) { alert('Anna tunnus muodossa ABC-123.');
    document.havainto.kilpi.focus(); document.havainto.kilpi.select(); return false; }
  if (document.havainto.kilpi.value.indexOf(" ") != -1) { alert('Anna tunnus muodossa ABC-123.');
    document.havainto.kilpi.focus(); document.havainto.kilpi.select(); return false; }
  if (document.havainto.kilpi.value.lastIndexOf("I") > document.havainto.kilpi.value.indexOf("-"))
    { alert('Anna tunnus muodossa ABC-123.'); document.havainto.kilpi.focus();
    document.havainto.kilpi.select(); return false; }
  if (document.havainto.kilpi.value.lastIndexOf("i") > document.havainto.kilpi.value.indexOf("-"))
    { alert('Anna tunnus muodossa ABC-123.'); document.havainto.kilpi.focus();
    document.havainto.kilpi.select(); return false; }
  if (document.havainto.kilpi.value.lastIndexOf("O") > document.havainto.kilpi.value.indexOf("-"))
    { alert('Anna tunnus muodossa ABC-123.'); document.havainto.kilpi.focus();
    document.havainto.kilpi.select(); return false; }
  if (document.havainto.kilpi.value.lastIndexOf("o") > document.havainto.kilpi.value.indexOf("-"))
    { alert('Anna tunnus muodossa ABC-123.'); document.havainto.kilpi.focus();   
    document.havainto.kilpi.select(); return false; }
  return true;
}

function ok(maxchars) {
  if(document.ilmoitus.MUUTA.value.length > maxchars)
    {alert('Liikaa tarinaa tekstikentässä... lyhennäpä '+ (document.ilmoitus.MUUTA.value.length - maxchars)+ ' merkkiä niin mahtuu. Thänks.');
    return false; }    
  else return true; 
}

function history_win(URL) {
  the_window = window.open(URL, "new_win", 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=640,height=480,top=0,left=0');
}

