
function closethis() {
  //srange = window.opener.parent.also.currentitem.document.selection.createRange();
  // result = window.clipboardData.setData("HTML",out);
   //srange.text = window.clipboardData.getData("HTML");
  //window.opener.parent.also.i_text.innerHTML += out;
  //alert(window.opener.parent.also.currentitem);
 
  window.opener.parent.also.i_text.innerHTML += out;
  window.opener.parent.also.document.form1.ment.value =1;
  window.close();
}

function redraw() {

ns6 = (navigator.userAgent.indexOf('Netscape6')>0) ? true : false;
if (ns6) prevlayer = document.getElementById('preview'+line); 
else     prevlayer = preview;

with (document.thetable) {
  par = "";
  if (validNumber(t_width.value))  par = par + "WIDTH=" + t_width.value + " ";
  if (validNumber(t_height.value)) par = par + "HEIGHT=" + t_height.value + " ";

  tstyle = '';
  if (t_border.value==0) tstyle = tstyle + 'border: 1px dashed black;';
  if ((t_border.value==1) || (t_innerborder.value==1)) tstyle = tstyle + 'border: 1px solid black;';
  if ((t_border.value==2) || (t_innerborder.value==2)) tstyle = tstyle + 'border: 2px solid black;';
  if ((t_border.value==3) || (t_innerborder.value==3)) tstyle = tstyle + 'border: 3px solid black;';
  par = par + " STYLE='border-collapse: collapse; "+tstyle+"' ";

  tdstyle = '';
  if (t_innerborder.value==0) tdstyle = 'border: 1px dashed black;';
  if (t_innerborder.value==1) tdstyle = 'border: 1px solid black;';
  if (t_innerborder.value==2) tdstyle = 'border: 2px solid black;';
  if (t_innerborder.value==3) tdstyle = 'border: 3px solid black;';
  if (tdstyle.length>0) tdstyle = " STYLE='"+tdstyle+"'";

  if (validNumber(t_width.value)) 
    ratio = Math.round(t_width.value/(cols)); 
  else 
    ratio = Math.round(100/cols) + "%"; 

  if (t_equal.checked) tdstyle = " WIDTH='" + ratio + "'" + tdstyle;

  if (t_innerborder.value==4) par = par + ' BORDER=1 ';
  out = "  <TABLE CELLPADDING=2 CELLSPACING=0 "+par+">\n";

  for (i=0; i<rows; i++) {
    out = out + "  <TR>\n";
    for (j=0; j<cols; j++) {
      thisvalue = eval("document.thetable.cell"+i+"_"+j+".value");
      thisvalue = thisvalue.replace(/\n/g,"<BR>");
      out = out + "    <TD"+tdstyle+">" + thisvalue + "</TD>\n";
    }
    out = out + "  </TR>\n";
  }
}

out = out + "  </TABLE>\n";

out = "\n\n<!-- Itt kezdôdik a táblázat - innentôl a végéig ne módosítsd! -->\n" + out +
      "<!-- Itt a táblázat vége - eddig ne módosítsd! -->\n\n";


prevlayer.innerHTML = out;
// + "<TEXTAREA COLS=150 ROWS=20>"+out+"</TEXTAREA>";

}

