function insert_link(form) {
  var str = document.selection.createRange().text;
  form.text_area.focus();
  //var my_link = prompt("Enter URL:","http://");
  //writeln(form_text.value);
  var my_link = form.link_1.value;

  if (my_link != null) {
    var sel = document.selection.createRange();
    sel.text = "<a href=\"" + my_link + "\">" + str + "</a>";
  }
  return;
}
function format_sel(v, form) {
                  var str = document.selection.createRange().text;
                  form.text_area.focus();
                  var sel = document.selection.createRange();
                  sel.text = "<" + v + ">" + str + "</" + v + ">";
                  return;
 }


function openBrWindow(theURL, winName, features,TextHeader,TextFooter) { //v2.0

   Picture = window.open("/view.htm",winName,features);
   Picture.document.open();
   Picture.document.write('<html><head><title>Просмотр</title>' +
           '<LINK href="blue_style.css" type="text/css" rel="stylesheet"></head>' +
           '<body leftmargin="0" topmargin="0" marginheight="5" marginwidth="5" onBlur="self.close()">');

   Picture.document.write('<table width="100%" height="100%" cellspacing="10" cellpadding="0" bgcolor="#ffffff" > ' +
                          '<tr><td  align="center" valign="bottom"><h2>' + TextHeader + '</h2><br></td></tr>'+
                          '<tr><td align="center" valign="middle">' );

   Picture.document.write('<img src="' + theURL + '"  valign="middle" alt="' + TextFooter + '" >');

   Picture.document.write('</td></tr><tr><td  align="center"><h2>' + TextFooter + '</h2></td></tr>' +
   '</table></body></html>');

   Picture.document.close();
   Picture.focus();
}



function openFlashWindow(theURL,winName,features,FlashSource,FlashWidth,FlashHeight,TextHeader,TextFooter) { //v2.0

   Picture = window.open("viewswf.htm",winName,features);

   Picture.document.open();

   Picture.document.write('<html><title>Просмотр</title><link rel="stylesheet" href="../main.css" type="text/css"><body leftmargin="0" topmargin="0" marginheight="5" marginwidth="5" bgcolor="#CCCCCC"  >');

   Picture.document.write('<table width="100%" height="100%" cellspacing="10" cellpadding="0" bgcolor="#999999"><tr><td class="header" align="center" valign="bottom">' + TextHeader + '<br><hr></td></tr><tr><td align="center" valign="middle">' );



        Picture.document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width=' + FlashWidth + ' height=' + FlashHeight + '><param name=movie value="' + FlashSource + '"><param name=menu value=false> <param name=quality value=high> <param name=scale value=exactfit> <param name=bgcolor value=#FFFFFF><embed src="' + FlashSource + '" menu=false quality=high scale=exactfit bgcolor=#FFFFFF  width=' + FlashWidth + ' height=' + FlashHeight + ' type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed></object>');



        Picture.document.write('</td></tr><tr><td class="normal" align="center" valign="top"><hr><b>' + TextFooter + '</b></td></tr></table></center></body></html>');

    Picture.document.close();

    Picture.focus();

}