Type.registerNamespace('IFrameworks.UI');

IFrameworks.UI.unhighlightElement =  function(element)
{
  if (element && element.parentNode) 
  {
    if (element.parentNode.className.indexOf(' inputs-line-selected') > 0) 
    {
      element.parentNode.className = element.parentNode.className.replace(' inputs-line-selected' , '');
    }  
  }
};
  
  
IFrameworks.UI.highlightElement = function(element) 
{
  if (element && element.parentNode) 
  {
    element.parentNode.className += ' inputs-line-selected';
  }
};
  
IFrameworks.UI.highlightWrapper = function(wrapperID) 
{
  var wrapperElement = $get(wrapperID);
  if (wrapperElement) 
  {
    wrapperElement.className +=' inputs-line-selected';
  }
};
  
IFrameworks.UI.unhighlightWrapper = function(elementID) 
{
  var wrapperElement = $get(elementID);
  if (wrapperElement.className.indexOf(' inputs-line-selected') > 0) 
  {
    wrapperElement.className = wrapperElement.className.replace(' inputs-line-selected' , '');
  }
};
  
IFrameworks.UI.hideHighlight = function(element)
{
  if (element.className && element.className.indexOf(' inputs-line-selected') > 0) 
  {
    element.className = element.className.replace(' inputs-line-selected' , '');
  }
  if (element.childNodes) 
  {
    for (var i = 0; i < element.childNodes.length; i++) 
    {
      IFrameworks.UI.hideHighlight(element.childNodes[i]);
    }
  }
};
  
IFrameworks.UI.addFCKOnFocusEvent = function (textAreaId, containerID, wrapperID)
{
  window.setTimeout(function() 
  {
    try {
      if (FCKeditorAPI)
      {  
        var editorInstance = FCKeditorAPI.GetInstance(textAreaId) ; 
        if (editorInstance) 
        {
          editorInstance.Events.AttachEvent('OnFocus', function() { IFrameworks.UI.highlightWrapper(wrapperID); });
          editorInstance.Events.AttachEvent('OnBlur', function() { IFrameworks.UI.unhighlightWrapper(wrapperID); });
          
          //editorInstance.Events.AttachEvent( 'OnFocus', function() { IFrameworks.UI.highlightWrapper(wrapperID); } ) ;
          //editorInstance.Events.AttachEvent( 'OnBlur', function() { IFrameworks.UI.unhighlightWrapper(wrapperID); } ) ;
        }
      }          
    }
    catch (exc) {
      var textAreaElement = $get(textAreaId);
      if (textAreaElement) 
      {
        $addHandler(textAreaElement, 'onfocus', function () {IFrameworks.UI.highlight(textAreaElement)} );
        //textAreaElement.onfocus = function () {highlight(textAreaElement)};
      }
    }
  }, 1000);
};

// Notify ScriptManager that this is the end of the script.
if (typeof(Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();


