Hi,
This is the script am using to insert an image in between an article. which work perfectly for IE, but not in Mozilla brower.
How can this be modified to be compatible for both?

Thank you ,
Prathibha

<script>
function insertTag ( txtName, tag, enclose ) {
var IBImageCnt;
var txt;
txt=eval("document.IM."+txtName+".value;");
IBImageCnt=countInstances(txt,'[Image]');
if(IBImageCnt==3)
{
alert("You can insert upto three images in the article");
return false;
}
else
{
if(eval("document.IM." + txtName + ".value") !="")
{
var closeTag = tag;
if ( enclose ) {
var attribSplit = tag.indexOf ( ' ' );
if ( tag.indexOf ( ' ' ) > -1 )
closeTag = tag.substring ( 0, attribSplit );
}
if ( isSelected ) {
var txtObj = eval ( "document.forms[0]." + txtName );
if (txtObj.createTextRange && txtObj.caretPos) {
var caretPos = txtObj.caretPos;
//caretPos.text = ( ( enclose ) ? "<"+tag+">"+caretPos.text+"</"+closeTag+">" : "<"+tag+">"+caretPos.text );
caretPos.text = ( ( enclose ) ? "<"+tag+">"+caretPos.text+"</"+closeTag+">" : "["+tag+"]"+caretPos.text );
markSelection ( txtObj );
if ( txtObj.caretPos.text=='' ) {
isSelected=false;
txtObj.focus();
}
}
} else {
// placeholder for loss of focus handler
}
}
else
{
eval("document.IM." + txtName + ".value=\"[Image]\";");
}
}
}
function countInstances(string, word)
{
var substrings = string.split(word);
return substrings.length - 1;
}

</script>



<input type="button" name="imageButton" value="Insert Image" onClick="javascript: insertTag( 'Article', 'Image', false );">