function unhighlightElement(element) {
  if (element && element.parentNode) {
    $(element.parentNode).removeClassName('inputs-line-selected');
  }
}

function highlightElement(element) {
  if (element && element.parentNode) {
    $(element.parentNode).addClassName('inputs-line-selected');
  }
}

function highlightWrapper(wrapperID) {
  wrapperElement = $(wrapperID);
  if (wrapperElement) {
    wrapperElement.addClassName('inputs-line-selected');
  }
}

function unhighlightWrapper(wrapperID) {
  wrapperElement = $(wrapperID);
  if (wrapperElement) {
    wrapperElement.removeClassName('inputs-line-selected');
  }
}

function hideHighlight(element)
{
  unhighlightElement(element);
  if (element.childNodes != null) {
    for (var i = 0; i < element.childNodes.length; i++) {
      hideHighlight(element.childNodes[i]);
    }
  }
}

function addFCKOnFocusEvent(textAreaId, containerID, wrapperID)
{
  window.setTimeout(function() {
    try {
      if (FCKeditorAPI != null)
      {  
        var editorInstance = FCKeditorAPI.GetInstance(textAreaId) ; 
        if (editorInstance != null) {
          editorInstance.Events.AttachEvent( 'OnFocus', function() { highlightWrapper(wrapperID); } ) ;
          editorInstance.Events.AttachEvent( 'OnBlur', function() { unhighlightWrapper(wrapperID); } ) ;
        }
      }          
    }
    catch (exc) {
      textAreaElement = document.getElementById(textAreaId);
      if (textAreaElement != null) {
        textAreaElement.onfocus = function () {highlight(textAreaElement)};
      }
    }
  }, 1000);
}