﻿function popupContent(url, name)
{
  var n = 'xpand';
  if((typeof(name) != 'undefined') && (name != null)) {
    n = name;
  }
  window.open(url, n, 'height=660,width=470,menubar=no,toolbar=no,status=no,resizable=yes,scrollbars=yes');
}

function resizeContentArea(editor)
{
    if (editor.InitialHeight == -1)
    {
        editor.InitialHeight = editor.Document.body.clientHeight;
    }
    var targetHeight = editor.Document.body.scrollHeight;
    if (targetHeight > editor.InitialHeight)
    {
        var theIFrame = document.getElementById("RadEContentIframe" + editor.Id);
        theIFrame.style.height = parseInt(targetHeight) + "px";
    }
}

function attachResizeEvents(editor)
{
    editor.InitialHeight = -1;
    editor.GetContentArea().style.overflow = "hidden";
    editor.Document.body.scroll = "no";
    var resizeFnRef = function anon(){resizeContentArea(editor)};
    editor.AttachEventHandler("RADEVENT_SEL_CHANGED", resizeFnRef)
    editor.AttachEventHandler("keydown", resizeFnRef)
}

function menuClick(a)
{
  var className = a.parentNode.className;
  var li = a.parentNode.parentNode.getElementsByTagName('li');
  for(var i = 0; i < li.length; i++) {
    if(li[i] == a.parentNode) {
      li[i].className = (li[i].className == 'show') ? 'hide' : 'show';
    } else {      
      li[i].className = 'hide';
    }    
  }
}
