function wopen3()
{
	
var title="Ссылка";
var altext="Вы не ввели текст ссылки";
var wid=400;var hei=200;var poswid=screen.width/2-wid/2;var poshei=screen.height/2-hei/2;
gde = "width="+wid+",height="+hei+",copyhistory=no,directories=no,menubar=yes,resizable=yes,status=yes,tollbar=no,scrollbars=no,top="+poshei+",left="+poswid;
myWindow = window.open("", "Insert", gde);myWindow.document.open();

myWindow.document.write("<HTML><title>"+title+"</title><style>body{font-family:Verdana;font-size:12px;}</style><BODY>");
myWindow.document.write("<script>function pst3(sel, kto, msid, tag1, tag2){if (TheForm.ur.value=='') {window.close();return true;} ");

myWindow.document.write("if (TheForm.txt.value=='') {alert('"+altext+"');return false;} ");
myWindow.document.write("if (TheForm.ur.value.indexOf('http') == -1 && TheForm.ur.value.indexOf('ftp') == -1){alert('Не введена ссылка!');return false;} ");
myWindow.document.write("var messageField = opener.document.TheForm.formpar;var selStart = messageField.selectionStart;var selEnd = messageField.selectionEnd;var MsgVal = messageField.value;");
myWindow.document.write("var text = new String();var step = new Number();messageField.focus();if(document.selection){opener.document.TheForm.document.selection.createRange().text = tag1+sel+opener.document.TheForm.document.selection.createRange().text+tag2;}else{if(selStart || messageField.selectionStart == '0'){step = tag1.length + sel.length + tag2.length;text = MsgVal.substring(0, selStart) + tag1 + sel;text += MsgVal.substring(selStart, selEnd) + tag2;text += MsgVal.substring(selEnd, MsgVal.length);");
myWindow.document.write("messageField.value = text;messageField.selectionStart = selStart + selEnd + step; messageField.selectionEnd = selEnd + step;}} window.close();}</script>");
myWindow.document.write("<form name=TheForm>Введите адрес ссылки<br>");
myWindow.document.write("<input type=text name=ur size=50><br><br>");

myWindow.document.write("Текст ссылки:<br><input type=text name=txt size=50 value='click here' onFocus=javascript:TheForm.txt.value=''><br><br>");
myWindow.document.write("<input type=button value='ОК' onClick=javascript:pst3('','','','");
myWindow.document.write("[link='+TheForm.ur.value+'][text='+TheForm.txt.value,'][/link]");
myWindow.document.write("');> <input type=button value='Отмена' onClick=javascript:window.close();></form>");
myWindow.document.write("</BODY></HTML>");
myWindow.document.close();
}



