function openImage(a, w, h, s) {
  win = window.open(a.href, a.target, 
                    'toolbar = no, menubar = no, location = no, directories = no, scrollbars = ' + s 
                    + ', resizable = no, status = no, width = ' + w + ', height = ' + h + ', top = ' + ((screen.height - h) / 2) + ', left = ' + ((screen.width - w) / 2));
  return (win != null);
}

function disableForm(id) {
  if (document.getElementById(id).disabled) document.getElementById(id).disabled = false; else document.getElementById(id).disabled = true;
}

function insertTag(id, begingURLtag, endURLtag) {
  myField = document.getElementById(id);
  if (document.selection) {
    myField.focus();
    sel = document.selection.createRange();
    sel.text = begingURLtag + sel.text + endURLtag;
  } else if (myField.selectionStart || myField.selectionStart == '0') {
    var startPos = myField.selectionStart;
    var endPos = myField.selectionEnd;
    myField.value = myField.value.substring(0, startPos)
    + begingURLtag + myField.value.substr(startPos, endPos - startPos) + endURLtag
    + myField.value.substring(endPos, myField.value.length);
  } else {
    myField.value += myValue;
  }
}
