﻿function WidgetLibrary_Help_expandCollapseHelpText (img, runtimeId)
{
  if (eval(runtimeId + '_expanded'))
  {
    document.getElementById(runtimeId + '_Truncated').style.display = 'block'; 
    document.getElementById(runtimeId + '_Full').style.display = 'none';
    img.src ='/WidgetLibrary40/img/Help_Collapsed.gif';
  }
  else
  {
    document.getElementById(runtimeId + '_Truncated').style.display = 'none'; 
    document.getElementById(runtimeId + '_Full').style.display = 'block';
    img.src ='/WidgetLibrary40/img/Help_Expanded.gif';
  }
  eval(runtimeId + '_expanded = !' + runtimeId + '_expanded');
}

function WidgetLibrary_Help_truncateText(originalText, cutoffPoint)
{
    if(originalText != null)
    {
        var tempStr = originalText.substring(0, cutoffPoint);
        var lastIndexDot = tempStr.lastIndexOf(".");
        var lastIndexSpace = tempStr.lastIndexOf(" ");
        var lastIndex = (lastIndexDot > lastIndexSpace) ? lastIndexDot : lastIndexSpace;
        return tempStr.substring(0, lastIndex + 1);
    }
}
