var fID; //*** IFRAME ID
var TXTOBJ; //*** TEXT Obj
var format = new Array();
var viewm = new Array();
/**************************************/
document.onmousedown=doMousedown
document.onmouseup=doMouseup
function changetoIframeEditor(el)
{
var wi= '', hi= '';
if(el.style.height) hi= " height=" + el.style.height
else if(el.rows) hi= " height=" + (14*el.rows+28)
if(el.style.width) wi= " width=" + el.style.width
else if(el.cols) wi= " width=" + (6*el.cols +25)
var parent= el.parentElement
while(parent.tagName != 'FORM') parent= parent.parentElement
var oform= parent
var fidx=0; while(document.forms[fidx] != oform) fidx++ ; // form index
var val=''
if(el.tagName=='TEXTAREA'){ fID= fidx+'VDevID'+el.name; val= el.innerText }
else fID= fidx+'VDevID'+el.id
var strx = createEditor(fID,wi,hi);
el.outerHTML= strx
iEditor(fID)
if(el.tagName!='TEXTAREA') return
var reg= eval("/
/i") ;
if( reg.test(val) ) val= val.replace(/\n/g, "");
else val= val.replace(/\n/g, "
");
val= val.replace(/\r/g, "");
val= val.replace(/\t/g, "");
val= val.replace(/\\/g, "\");
val= val.replace(/\'/g, "'");
setTimeout("document.frames['"+fID+"'].document.body.innerHTML='"+val+"'",200)
oform[fID.split('VDevID')[1]].value= val
}
function iEditor(idF)
{
var obj=document.frames[idF]
obj.document.designMode="On"
obj.document.onmousedown= function(){ TXTOBJ=null; fID=idF; FMousedown();}
format[idF]='HTML'
viewm[idF]=1;
}
function formatDialogF()
{
var y = screen.height - parseInt('30em')*14 - 30
var feature = "font-family:Tahoma; font-size:10pt; dialogWidth:30em; dialogHeight:27em; dialogTop:"+y
feature+= ";edge:sunken; help:no; status:no"
var dialog= QBPATH+'/dialog.html'
var arr= showModalDialog(dialog, "visual", feature);
if(arr==null) return ;
doFormatF(arr)
}
function FMousedown()
{
var objF=document.frames[fID];
// if(objF && objF.event && objF.event.button==2) formatDialogF();
var el = objF.event.srcElement
doClick(el)
}
// init all found TEXTAREA in document
function changeAllTextareaToEditors()
{
var i=0;
while(document.all.tags('textarea')[i])
{
changetoIframeEditor(document.all.tags('textarea')[i])
if(++i>0 && !document.all.tags('textarea')[i] ) i=0;
}
}
// init all found IFRAME in document to Editable
function changeAllIframeToEditors()
{
var i=0;
while(document.all.tags('iframe')[i])
{
changetoIframeEditor(document.all.tags('iframe')[i])
i++
}
}
// init only IFRAMEs that have "id=argument of initEditors"
// e.g. changeIframeToEditor('id1','id2',...)
function changeIframeToEditor()
{
for(var j=0;j\