function doFormat(what)
{
// var editTextRange = window.frames.edit1.document.selection.createRange();
// important !!!
// not editTextRange.execCommand(what, true);
doFocus();
if(arguments[1] == null)
window.frames.edit1.document.execCommand(what, true);
else
window.frames.edit1.document.execCommand(what, true, arguments[1]);
}
function doFocus()
{ window.frames.edit1.focus();
}
// insert image
function insertImage()
{
window.open("insertImage.html","insertImage","width=400,height=223");
}
function insertFile() {
window.open("insertFile.html","insertFile","width=300,height=124");
}
function palette() {
var return_value = showModalDialog("palette.html","","dialogWidth:18;dialogHeight:16;dialogTop:50;dialogLeft:500;status:no;");
if (return_value != "")
doFormat("ForeColor",return_value)
}
function addTable()
{
var return_value= showModalDialog("insertTable.html","","dialogWidth:30;dialogHeight:13.4;dialogTop:50;dialogLeft:500;status:no;");
if (return_value != "")
{
doInsert(return_value);
}
}
function doInsert(str)
{ doFocus();
var editTextRange = window.frames.edit1.document.selection.createRange();
editTextRange.pasteHTML(str);
}
function doSelectClick(str, el) {
var Index = el.selectedIndex;
if (Index != 0){
el.selectedIndex = 0;
if (el.id == "specialtype")
specialtype(el.options[Index].value);
else
doFormat(str,el.options[Index].value);
}
}
function selectRange(){
edit = edit1.document.selection.createRange();
RangeType = edit1.document.selection.type;
}
function specialtype(Mark){
var strHTML;
if (bIsIE5) selectRange();
if (RangeType == "Text"){
strHTML = "<" + Mark + ">" + edit.text + "</" + Mark + ">";
edit.pasteHTML(strHTML);
textEdit.focus();
edit.select();
}
}
function onlinehelp() {
showModalDialog("help.html","","dialogWidth:18;dialogHeight:16;dialogTop:50;dialogLeft:500;status:no;");
}
function insertTest()
{
doFocus();
var editTextRange = window.frames.edit1.document.selection.createRange();
editTextRange.pasteHTML("<b>aaa</b>");
}
var displayMode = 1;
function changeModel(n, model)
{ switch(n)
{ case 1:
mode_1.style.display='';
mode_2.style.display='none';
mode_3.style.display='none';
if(displayMode != 1)
window.frames.edit1.document.body.innerHTML=theForm.content.value;
imageName = "bn_edit_s.gif";
break;
case 2:
mode_1.style.display='none';
mode_3.style.display='none';
mode_2.style.display='';
if(displayMode != 2)
theForm.content.value=window.frames.edit1.document.body.innerHTML;
imageName = "bn_code_s.gif";
break;
case 3:
mode_1.style.display='none';
mode_2.style.display='none';
mode_3.style.display='';
if(displayMode == 1)
window.frames.edit2.document.body.innerHTML=window.frames.edit1.document.body.innerHTML;
else if(displayMode == 2)
window.frames.edit2.document.body.innerHTML=theForm.content.value;