﻿// JScript File

editors = new Array;
 
 function resizeContentArea(editor,setHeight)
 {
 InitialHeight = 0;
 InitialWidth = 0;
 if(setHeight=='true'){
 InitialHeight = document.getElementById(editor.Id + 'Cell').offsetHeight;
 }
  var targetHeight = editor.Document.body.scrollHeight;

  /*if (targetHeight < InitialHeight){
  targetHeight = InitialHeight;
  }
  */
   var theIFrame = document.getElementById("RadEContentIframe" + editor.Id);
   theIFrame.style.height = parseInt(targetHeight) + "px";
    var theTXTArea = document.getElementById("RadEContentTextarea" + editor.Id);
   theTXTArea.style.height = parseInt(targetHeight) + "px";
  }

 function sizeContainersOnLoad(CtId){
RadE = GetRadEditor(CtId);
resizeContentArea(RadE,'true');
}


currentEditor = "";

 function attachResizeEvents(editor)
 {
  editor.InitialHeight = -1;
  editor.GetContentArea().style.overflow = "hidden";
  editor.GetContentArea().className = document.getElementById(editor.Id + "_wrapper").className
  if(document.getElementById(editor.Id + "_wrapper").getAttribute("BgColor")){
  var setCol = document.getElementById(editor.Id + "_wrapper").getAttribute("BgColor");
  if(setCol != ""){
  editor.GetContentArea().style.backgroundColor = setCol;
  }
  }
  var resizeFnRef = function anon(){resizeContentArea(editor,'true')};
  editor.AttachEventHandler("RADEVENT_SEL_CHANGED", resizeFnRef)
  editor.AttachEventHandler("keydown", resizeFnRef)
     RadEditorCommandList["AddControl"] = function(addControl, editor, oTool)
     {
            currentEditor = editor;
            loadMaxObject(oTool.GetSelectedValue(),editor.GetWidth())
      };
        RadEditorCommandList["Forms"] = function(addControl, editor, oTool)
     {
            currentEditor = editor;
            loadFormObject(oTool.GetSelectedValue(),editor.GetWidth())
      };
RadEditorCommandList["SavePage"] = function(addControl, editor, oTool)
     {
           runEditorSave();
      };
  editors.push(editor)
 }
 
 function getId(input,nvalue){
 str = input.split(":");
 return str[nvalue];
 }