function openWindowAndWrite(iname,icap,iht,wsize,hsize) {
  wname = '_blank';
  wsize = Math.min(screen.width,(parseInt(wsize, 10) + 20));
  hsize = Math.min(screen.height-70,parseInt(hsize, 10));
  var bldArg = 'width=' + wsize + ',height=' + hsize + ',left=10,top=10,screenX=10,screenY=10';
  bldArg = bldArg + ',channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=1,scrollbars=1,status=0,toolbar=0';
 if(!(iname=="")) {
  popupWin=window.open('',wname,bldArg);
  if (!popupWin.opener) { popupWin.opener = self;}
  popupWin.document.open();
  popupWin.document.writeln("<head>");
  popupWin.document.writeln("<meta http-equiv='Content-Type' content='text/html; charset=windows-1257'>");
//  popupWin.document.writeln("<link rel='stylesheet' type='text/css' href='kligys.css'>");
  popupWin.document.writeln("<title>" + icap + "</title>");
  popupWin.document.writeln("<SCRIPT language='JavaScript'>");
  popupWin.document.writeln("if (window.focus) {");
  popupWin.document.writeln(" self.focus();");
  popupWin.document.writeln("}");
  popupWin.document.writeln("</SCRIPT>");
  popupWin.document.writeln("</head>");
  popupWin.document.writeln("<body  bgcolor='#484848' marginheight=0 marginwidth=0 topmargin=0 leftmargin=0>");
//  popupWin.document.writeln("<body>");
  popupWin.document.writeln("<center>");

iname="http://www.kligys.com"+iname;

  popupWin.document.writeln("<a href='#' onClick='self.close()'><img src='" + iname + "' border=0></a><br>");
//  popupWin.document.writeln("<a href='#' onClick='self.close()'><img src='" + iname + "' width=" + wsize + " height=" + iht + " border=0></a><br>");
//  popupWin.document.writeln("<font face='Verdana' size='2' color='#003031'><b>" + icap + "</b></font>");
  popupWin.document.writeln("<font face='Verdana' size='2' color='#ffffff'><b>" + icap + "</b></font>");
  popupWin.document.writeln("</center>");
  popupWin.document.close();
 } else {
  popupWin=window.open('http://www.kligys.com',wname,bldArg);
  if (!popupWin.opener) { popupWin.opener = self;}
 }
}
