/**
  * Render an insertbutton element
  *
  * @access public
  */
 function fetchElementImplicit($field, $label, $withjs = true)
 {
     if ($withjs) {
         $js = "// <![CDATA[\n                function insertAtCursor(myField, myValue) {\n                    if (document.selection) {\n                        // IE support\n                        myField.focus();\n                        sel = document.selection.createRange();\n                        sel.text = myValue;\n                    } else if (myField.selectionStart || myField.selectionStart == '0') {\n                        // MOZILLA/NETSCAPE support\n                        var startPos = myField.selectionStart;\n                        var endPos = myField.selectionEnd;\n                        myField.value = myField.value.substring(0, startPos)\n                            + myValue\n                            + myField.value.substring(endPos, myField.value.length);\n                    } else {\n                        myField.value += myValue;\n                    }\n                }\n                function jInsertEditorText(text, editor) {\n                    insertAtCursor(\$(editor), text);\n                }\n                // ]]>\n                ";
         $doc =& JFactory::getDocument();
         $doc->addScriptDeclaration($js);
     }
     JHTML::_('behavior.modal', 'a.modal-button');
     $link = 'index.php?option=com_avreloaded&amp;view=insert&amp;tmpl=component&amp;e_name=' . $field;
     $button = new JObject();
     $button->set('modal', true);
     $button->set('link', $link);
     $button->set('text', JText::_($label));
     $button->set('name', 'image');
     $button->set('options', "{handler: 'iframe', size: {x: 600, y: 650}}");
     return JElementInsertButton::_renderButton($button);
 }