/*================================================================================*/
/*                                                                                */
/*             BW2Technologies.Web.JScript.Framework (Alpha V1.0.0.0)             */
/*                                                                                */
/*                                  Web-Editor                                    */
/*                                                                                */
/*              Copyright © 2006-2010 by BW2Technologies (HP. Lassnig)            */
/*                           mail to : hansi@lassnig.ch                           */
/*                                                                                */
/*================================================================================*/

var _oEditors = new Array();
var _oEditor = null;

/*--------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------*/


/*================================================================================*/
/* <Function> Editor Object </Function>
/*================================================================================*/
function __bw2Editor(strEditor, strBackColor, strForeColor, strFontName, strFontSize, fBold, fItalic, fStrikeThrough, fSubscript, fSuperscript, fUnderline, fReadOnly, fAjax) {

         /*--- Base-Object ---*/
         this.Ajax = fAjax; 
         this.ID = strEditor;
         this.ReadOnly = fReadOnly;
         this.DefBackColor = strBackColor;
         this.DefBold = fBold;
         this.DefForeColor = strForeColor;
         this.DefFontName = strFontName;
         this.DefFontSize = strFontSize;
         this.DefItalic = fItalic;
         this.DefOverline = false;
         this.DefStrikeThrough = fStrikeThrough;
         this.DefSubscript = fSubscript;
         this.DefSuperscript = fSuperscript;
         this.DefUnderline = fUnderline;

         this.EventItem = _bw2EditorEventItem;

         /*--- Editor-Object ---*/
         this.Editor = __bw2GetElementById(strEditor);
         this.Editor.ParentObject = this;
         this.Editor.Type = 'editor';
         //this.Editor.style.backgroundColor = 'white';
         
         this.Editor.Resize = _bw2EditorResizeFn;

         /*--- PanelTop-Docking ---*/
         this.Editor.PanelTop = __bw2GetElementById(strEditor + '__PanelTop');
         
         if (this.Editor.PanelTop) {
            this.Editor.PanelTop.ParentObject = this;
            this.Editor.PanelTop.Type = 'placeholder';
         }

         /*--- PanelBottom-Docking ---*/
         this.Editor.PanelBottom = __bw2GetElementById(strEditor + '__PanelBottom');
         
         if (this.Editor.PanelBottom) {
            this.Editor.PanelBottom.ParentObject = this;
            this.Editor.PanelBottom.Type = 'placeholder';
         }

         /*--- Header ---*/
         this.Editor.Header = __bw2GetElementById(strEditor + '__Header');

         if (this.Editor.Header) {
            //this.Editor.Header.style.backgroundColor = 'blue';
         }

         /*--- Code-View ---*/
         this.Editor.InputSource = __bw2GetElementById(strEditor + '__InputSource');

         if (this.Editor.InputSource) {
            this.Editor.InputSource.ParentObject = this;
         }

         /*--- Design-View ---*/
         this.Editor.InputDesign = __bw2GetElementById(strEditor + '__InputDesign')

         if (this.Editor.InputDesign) {
            this.Editor.InputDesign.ParentObject = this;
            this.Editor.InputDesign.Content = _bw2EditorContent;
            
            if (!this.ReadOnly) {
               this.Editor.InputDesign.BackColor = function(strBackColor) {try {if (_fIE) {this.contentWindow.document.execCommand('backcolor', false, strBackColor);} else {this.contentWindow.document.execCommand('hilitecolor', false, strBackColor);}} catch (e) {alert('BackColor : ' + e);}};
               this.Editor.InputDesign.Bold = function(fBold) {try {this.contentWindow.document.execCommand('bold', false, fBold);} catch (e) {alert('Bold : ' + e);}};
               this.Editor.InputDesign.Focus = function() {try {this.contentWindow.focus();} catch (e) {}}; //alert('Focus : ' + e);
               this.Editor.InputDesign.ForeColor = function(strForeColor) {try {this.contentWindow.document.execCommand('forecolor', false, strForeColor);} catch (e) {alert('ForeColor : ' + e);}};
               this.Editor.InputDesign.FormatBlock = function(strFormatTag) {try {this.contentWindow.document.execCommand('formatblock', false, strFormatTag);} catch (e) {alert('FormatBlock : ' + e);}};
               this.Editor.InputDesign.FontName = function(strFontName) {try {this.contentWindow.document.execCommand('fontname', false, strFontName);} catch (e) {alert('FontName : ' + e);}};
               this.Editor.InputDesign.FontSize = function(strFontSize) {try {this.contentWindow.document.execCommand('fontsize', false, strFontSize);} catch (e) {alert('FontSize : ' + e);}};
               this.Editor.InputDesign.Initialize = _bw2EditorInitialize; //function() {try {this.ReadOnly(false); this.Undo();}catch(e){}};
               this.Editor.InputDesign.Initialized = false;
               this.Editor.InputDesign.Italic = function(fItalic) {try {this.contentWindow.document.execCommand('italic', false, fItalic);} catch (e) {alert('Italic : ' + e);}};
               this.Editor.InputDesign.JustifyCenter = function() {try {this.contentWindow.document.execCommand('justifycenter', false, null);} catch (e) {alert('JustifyCenter : ' + e);}};
               this.Editor.InputDesign.JustifyFull = function() {try {this.contentWindow.document.execCommand('justifyfull', false, null);} catch (e) {alert('JustifyFull : ' + e);}};
               this.Editor.InputDesign.JustifyLeft = function() {try {this.contentWindow.document.execCommand('justifyleft', false, null);} catch (e) {alert('JustifyLeft : ' + e);}};
               this.Editor.InputDesign.JustifyNone = function() {try {this.contentWindow.document.execCommand('justifynone', false, null);} catch (e) {alert('JustifyNone : ' + e);}};
               this.Editor.InputDesign.JustifyRight = function() {try {this.contentWindow.document.execCommand('justifyright', false, null);} catch (e) {alert('JustifyRight : ' + e);}};

               this.Editor.InputDesign.ReadOnly = function(fReadOnly) {try {if (fReadOnly) {this.contentWindow.document.designMode = 'off';} else {this.contentWindow.document.designMode = 'on';}} catch (e) {}}; //alert('ReadOnly : ' + e);}};
               this.Editor.InputDesign.Redo = function() {try {this.contentWindow.document.execCommand('redo', false, null);} catch (e) {}}; //alert('Undo : ' + e);}};
               this.Editor.InputDesign.StrikeThrough = function(fStrikeThrough) {try {this.contentWindow.document.execCommand('strikethrough', false, fStrikeThrough);} catch (e) {alert('StrikeThrough : ' + e);}};
               this.Editor.InputDesign.Subscript = function() {try {this.contentWindow.document.execCommand('subscript', false, null);} catch (e) {alert('Subscript : ' + e);}};
               this.Editor.InputDesign.Superscript = function() {try {this.contentWindow.document.execCommand('superscript', false, null);} catch (e) {alert('Superscript : ' + e);}};
               this.Editor.InputDesign.Text = function(strText) { try {if (strText != null) {this.contentWindow.document.body.innerHTML = strText;} else {return this.contentWindow.document.body.innerHTML;}} catch (e) {alert('Text : ' + e);}};
               this.Editor.InputDesign.Underline = function(fUnderline) {try {this.contentWindow.document.execCommand('underline', false, fUnderline);} catch (e) {alert('Underline : ' + e);}};
               this.Editor.InputDesign.Undo = function() {try {this.contentWindow.document.execCommand('undo', false, null);} catch (e) {}}; //alert('Undo : ' + e);}};

               __bw2AddEventListener(this.Editor.InputDesign, 'load', _bw2EditorInputOnLoad, false);
               __bw2AddEventListener(this.Editor.InputDesign, 'mouseover', _bw2EditorInputMouseOver, false);
            }
         }

         __bw2AddEventListener(this.Editor, 'mousedown', _bw2EditorMouseDown, false);

         if (_fIE){
            __bw2AddEventListener(this.Editor, 'resize', _bw2EditorResizeEv, false);
         } else {
            __bw2AddEventListener(this.Editor, 'resize', __bw2EditorResizeObject, false);
         }
         
         __bw2EditorResize(null, strEditor);

/*--------------------------------------------------------------------------------*/

         function _bw2EditorContent(strInnerHTML) { 
                  try {
                      with (this.contentWindow.document) {                    
                           body.innerHTML = strInnerHTML;  
                           body.style.margin = '10px';
                           body.onload = '';

                           /*--- Alle Scripts entfernen ---*/
                           if ((scripts) && (scripts.length > 0)) {
                              for (var nI = 0; nI < scripts.length; nI++) {
                                  var oScript = scripts[nI];  
                                  
                                  oScript.src = null;
                                  oScript.innerHTML = null;
                                  oScript.text = null;
                              }
                           }

                           /*--- Set Scrollbar-Style on IFrame ---*/ 
                           if (_fIE) {
                               body.style.scrollbarArrowColor = this.currentStyle.scrollbarArrowColor;
                               body.style.scrollbarBaseColor = this.currentStyle.scrollbarBaseColor;
                               body.style.scrollbar3dLightColor = this.currentStyle.scrollbar3dLightColor;
                               body.style.scrollbarDarkshadowColor = this.currentStyle.scrollbarDarkshadowColor;
                               body.style.scrollbarFaceColor = this.currentStyle.scrollbarFaceColor;
                               body.style.scrollbarHighlightColor = this.currentStyle.scrollbarHighlightColor;
                               body.style.scrollbarShadowColor = this.currentStyle.scrollbarShadowColor;
                               body.style.scrollbarTrackColor = this.currentStyle.scrollbarTrackColor;
                           }
                           
                           /*--- Allen Links ein Target zuweisen (protocol: file, ftp, gopher, http, https, javascript, mailto, news, res, telnet, view-source) ---*/
                           if ((links) && (links.length > 0)) {
                              for (var nI = 0; nI < links.length; nI++) {
                                  var oLink = links[nI];  

                                  switch (oLink.protocol) {
                                         case 'javascript:' :
                                              oLink.href = '';
                                              break; 
                                         default :
                                              oLink.target = '_blank';
                                              break; 
                                  }
                              }
                           }
                      }
                  } catch (e) {}
         }

/*--------------------------------------------------------------------------------*/

         function _bw2EditorEventItem(oItem) { 
                  if (_oEditor == null) return;

                  var strCommand = oItem.Command;
                  var strValue = oItem.Value;
                  
                  try {
                      //if (strCommand == null) strCommand = _oToolStrips[oItem.ToolStripObj.ID].Items[oItem.id].Command;
                      if (strCommand == null) alert('_bw2EditorEventItem : strCommand'); strCommand = _oToolStrips[oItem.ToolStripObj.ID].Items[oItem.id].Command;
                  } catch (e) {}

                  if (strCommand == null) return;

                  try {
                      _oEditor.Editor.InputDesign.Focus();

__bw2Debug('_bw2EditorEventItem : ' + oItem.id + ', ' + strCommand + ', ' + strValue);
                       //alert('Edit Item-Event : ' + Command);
                       //var oRange = _oEditor.Editor.InputDesign.contentWindow.document.selection.createRange();
                       //alert('Edit Item-Event : ' + _oEditor.Editor.InputDesign.contentWindow.document.selection.type);
                       //alert('_bw2EditorInitialize : ' + this.ParentObject.DefFontSize + ', ' + this.ParentObject.DefFontName);
                       //alert('Edit Item-Event : ' + oRange.htmlText + ' -> ' + oRange.text);
                       
                      switch (strCommand) {
                             case 'backcolor' :
                                  if (strValue == 'transparent') strValue = '#FFFFFF';
                                  _oEditor.Editor.InputDesign.BackColor(strValue);
                                  break; 
                             case 'bold' :
                                  _oEditor.Editor.InputDesign.Bold(oItem.Checked);
                                  break; 
                             case 'forecolor' :
                                  if (strValue == 'transparent') strValue = _oEditor.DefForeColor;
                                  _oEditor.Editor.InputDesign.ForeColor(strValue);
                                  break; 
                             case 'formatblock' :
                                  _oEditor.Editor.InputDesign.FormatBlock(strValue);
                                  break; 
                             case 'font' :
                                  _oEditor.Editor.InputDesign.FontName(strValue);
                                  break; 
                             case 'fontsize' :
                                  _oEditor.Editor.InputDesign.FontSize(strValue);
                                  break; 
                             case 'italic' :
                                  _oEditor.Editor.InputDesign.Italic(oItem.Checked);
                                  break; 
                             case 'justifycenter' :
                                  _oEditor.Editor.InputDesign.JustifyCenter();
                                  break; 
                             case 'justifyfull' :
                                  _oEditor.Editor.InputDesign.JustifyFull();
                                  break; 
                             case 'justifyleft' :
                                  _oEditor.Editor.InputDesign.JustifyLeft();
                                  break; 
                             case 'justifynone' :
                                  _oEditor.Editor.InputDesign.JustifyNone();
                                  break; 
                             case 'justifyright' :
                                  _oEditor.Editor.InputDesign.JustifyRight();
                                  break; 
                             case 'redo' :
                                  _oEditor.Editor.InputDesign.Redo();
                                  break; 
                             case 'strikethrough' :
                                  _oEditor.Editor.InputDesign.StrikeThrough(oItem.Checked);
                                  break; 
                             case 'subscript' :
                                  _oEditor.Editor.InputDesign.Subscript(oItem.Checked);
                                  break; 
                             case 'superscript' :
                                  _oEditor.Editor.InputDesign.Superscript(oItem.Checked);
                                  break; 
                             case 'underline' :
                                  _oEditor.Editor.InputDesign.Underline(oItem.Checked);
                                  break; 
                             case 'undo' :
                                  _oEditor.Editor.InputDesign.Undo();
                                  break; 
                             case 'viewmode' :
                                  try {
                                      var oLbl = __bw2GetElementById(oItem.id + '_Text');

                                      if (strValue == 'viewsource') { 
                                         oItem.Value = 'viewedit';
                                         oLbl.innerHTML = 'Text';
                                         
                                         _oEditor.Editor.InputSource.value = _oEditor.Editor.InputDesign.contentWindow.document.body.innerHTML.replace(/^\n/, '').replace(/^[ ]+/, '');
//                                         _oEditor.Editor.InputSource.style.left = _oEditor.Editor.InputDesign.offsetLeft;
//                                         _oEditor.Editor.InputSource.style.top = _oEditor.Editor.InputDesign.offsetTop;
//                                         _oEditor.Editor.InputSource.style.width = _oEditor.Editor.InputDesign.offsetWidth;
//                                         _oEditor.Editor.InputSource.style.height = _oEditor.Editor.InputDesign.offsetHeight;

                                         _oEditor.Editor.InputDesign.style.display = 'none';
                                         _oEditor.Editor.InputSource.style.display = 'block';


                                         //_oEditor.Editor.InputSource.style.border = '0px none';
                                         //_oEditor.Editor.InputSource.style.margin = '0 0 0 0';
                                         //_oEditor.Editor.InputSource.style.padding = '2 2 2 2';
                                         //_oEditor.Editor.InputSource.style.zIndex = 10;

                                      } else { 
                                         oItem.Value = 'viewsource';
                                         oLbl.innerHTML = 'Quellcode';
                                         
                                         _oEditor.Editor.InputSource.style.display = 'none';
                                         _oEditor.Editor.InputDesign.style.display = 'block';
                                      }
                                  } catch (e) {
                                  }
                                  
                                  break; 
                      }

//__bw2Debug('_bw2EditorEventItem : ' + oItem.id + ', ' + strCommand + ', ' + strValue);

                  } catch (e) {
                  }
         }
          
/*--------------------------------------------------------------------------------*/

         function _bw2EditorInitialize() { 
                  if (this.id == null) return;
                  if (this.Initialized) return;

                  var oEditor = __bw2GetElementById(this.id);
                  
                  oEditor.Focus();
                  oEditor.ReadOnly(this.ParentObject.ReadOnly);
                  oEditor.Undo();
                  

                  __bw2AddEventListener(oEditor.contentWindow.document, 'mousedown', _bw2EditorInputMouseDown, false);

                  try {
                      oEditor.contentWindow.document.body.style.fontSize = this.ParentObject.DefFontSize;
                  } catch (e) {}
                      
                  try {
                      oEditor.contentWindow.document.body.style.fontSize = this.ParentObject.DefFontSize;
                      oEditor.contentWindow.document.body.style.fontFamily = this.ParentObject.DefFontName;
                  } catch (e) {}

                  try {
                      if (this.ParentObject.DefItalic) {
                         oEditor.contentWindow.document.body.style.fontStyle = 'italic'
                      } else {
                         oEditor.contentWindow.document.body.style.fontStyle = 'normal'
                      }                         
                  } catch (e) {}

                  try {
                      if (this.ParentObject.DefBold) {
                         oEditor.contentWindow.document.body.style.fontWeight = 'bold'
                      } else {
                         oEditor.contentWindow.document.body.style.fontWeight = 'normal'
                      }                         
                  } catch (e) {}

                  try {
                      if (this.ParentObject.DefUnderline) {
                         oEditor.contentWindow.document.body.style.textDecoration = 'underline'
                      } else if (this.ParentObject.DefOverline) {
                         oEditor.contentWindow.document.body.style.textDecoration = 'overline'
                      } else if (this.ParentObject.DefStrikeThrough) {
                         oEditor.contentWindow.document.body.style.textDecoration = 'line-through'
                      } else {
                         oEditor.contentWindow.document.body.style.textDecoration = 'none'
                      }                         
                  } catch (e) {}

                  try { 
                      if (this.ParentObject.DefSubscript) {
                         oEditor.contentWindow.document.body.style.fontVariant = 'small-caps'
                      } else {
                         oEditor.contentWindow.document.body.style.fontVariant = 'normal'
                      }                         
                  } catch (e) {}
                         
                  oEditor.Initialized = true;
                  _oEditor = this.ParentObject;
         }

/*--------------------------------------------------------------------------------*/

         function _bw2EditorInputMouseDown(oEvent) {
                  __bw2ToolStripsHide();
                  if (oEvent == null) return;

                  var oDoc = __bw2EventSource(oEvent);

                  __bw2EditorToolStripItemsSet(oDoc);
         }

         function _bw2EditorInputOnLoad(oEvent) {
                  if (oEvent == null) return;

                  if (this.ParentObject) {
                     _oEditor = this.ParentObject;
                  } else {
                     _oEditor = __bw2EventSource(oEvent).ParentObject;
                  }

                  if (!_oEditor.Editor.InputDesign.Initialized) setTimeout('__bw2EditorInitialize()', 500);
         }

         function _bw2EditorInputMouseOver(oEvent) {
                  if (oEvent == null) return;

                  if (this.ParentObject) {
                     _oEditor = this.ParentObject;
                  } else {
                     _oEditor = __bw2EventSource(oEvent).ParentObject;
                  }

                  if (!_oEditor.Editor.InputDesign.Initialized) _oEditor.Editor.InputDesign.Initialize();
         }

/*--------------------------------------------------------------------------------*/

         function _bw2EditorMouseDown(oEvent) {
                  if (_oEditor) return;
                  if (oEvent == null) return;

                  if (this.ParentObject) {
                     _oEditor = this.ParentObject
                  } else {
                     _oEditor = __bw2EventSource(oEvent).ParentObject;
                  }
         }

/*--------------------------------------------------------------------------------*/

         function _bw2EditorResizeEv(oEvent) {
                  if (oEvent == null) return;
                  var oEditor = __bw2EventSource(oEvent);
                  if (oEditor) __bw2EditorResize(oEvent, oEditor.id); 
         }

/*--------------------------------------------------------------------------------*/

         function _bw2EditorResizeFn(oObj) {
                  if (oObj) {
                     __bw2EditorResize(null, oObj.id); 
                  } else {
                     __bw2EditorResize(null, this.id); 
                  }  
         }
}

/*================================================================================*/
/* <Function> Editor Init </Function>
/*================================================================================*/
function __bw2EditorInitialize() { 
         if ((!_oEditor) || (_oEditor.Editor.InputDesign.Initialized)) return;
         
         _oEditor.Editor.InputDesign.contentWindow.focus();
         _oEditor.Editor.InputDesign.Initialize();
         setTimeout('__bw2EditorInitialize()', 1000);
}

/*================================================================================*/
/* <Function> Editor-Header Collapse/Expand </Function>
/*================================================================================*/
function __bw2EditorHeaderCollapseExpand(oObjImg, strEditor) {
         if ((oObjImg == null) || (strEditor == null)) return;

         try {
             var oHeaderProps = __bw2GetElementById(strEditor + '_HeaderProps'); if (!oHeaderProps) return; 
             var oObjSendDate = __bw2GetElementById(strEditor + '_SendDate'); 

             if (oHeaderProps.style.display == 'none') {
                oObjImg.src = _oSkinImages['EMAIL_COL_EXP'].Image;
                oHeaderProps.style.display = 'block';
                if (oObjSendDate) oObjSendDate.style.display = 'none';
                __bw2AjaxRequest(strEditor, null, null, 'onexpand', null);

             } else {
                oObjImg.src = _oSkinImages['EMAIL_COL_EXP'].ImageExpand;
                oHeaderProps.style.display = 'none';
                if (oObjSendDate) oObjSendDate.style.display = 'block';
                __bw2AjaxRequest(strEditor, null, null, 'oncollapse', null);
             }
             
             __bw2EditorResize(null, strEditor);
         } catch (e) {}
}

/*================================================================================*/
/* <Function> Editor Resize </Function>
/*================================================================================*/
function __bw2EditorResize(oEvent, strEditor) {
         try {
             var oObj = __bw2GetElementById(strEditor); if (!oObj) return;
         
             with (oObj) {
                  var oST = null;  
                  var nT = 0;  
                  var nH = offsetHeight;  
                  var nPH = 0;
                  var nPW = 0;

                  if (_fIE) nPW = 1;  

                  oST = __bw2GetStyle(oObj, 'padding-top'); if (oST) nPH += __bw2GetNumber(oST);
                  oST = __bw2GetStyle(oObj, 'padding-bottom'); if (oST) nPH += __bw2GetNumber(oST);
                  oST = __bw2GetStyle(oObj, 'padding-left'); if (oST) nPW += __bw2GetNumber(oST);
                  oST = __bw2GetStyle(oObj, 'padding-right'); if (oST) nPW += __bw2GetNumber(oST);

                  oST = __bw2GetStyle(oObj, 'border-top-width'); if (oST) nPH += __bw2GetNumber(oST);
                  oST = __bw2GetStyle(oObj, 'border-bottom-width'); if (oST) nPH += __bw2GetNumber(oST);
                  oST = __bw2GetStyle(oObj, 'border-left-width'); if (oST) nPW += __bw2GetNumber(oST);
                  oST = __bw2GetStyle(oObj, 'border-right-width'); if (oST) nPW += __bw2GetNumber(oST);

                  /*--- ToolStripPanel-Top ---*/
                  if ((PanelTop) && (PanelTop.style.display != 'none')) {
                     PanelTop.style.left = 0;
                     PanelTop.style.top = 0;
                     PanelTop.style.width = offsetWidth - nPW;
                     __bw2ReorderContent(PanelTop);
                     nT = PanelTop.offsetHeight;
                     nH -= nT;
                  }

                  /*--- ToolStripPanel-Bottom ---*/
                  if ((PanelBottom) && (PanelBottom.style.display != 'none')) {
                     PanelBottom.style.left = 0;
                     PanelBottom.style.top = offsetHeight - PanelBottom.offsetHeight - nPH;
                     PanelBottom.style.width = offsetWidth - nPW;
                     __bw2ReorderContent(PanelBottom);
                     nH -= PanelBottom.offsetHeight;
                  }

                  /*--- Header ---*/
                  if (Header) {
                     if (Header.innerHTML == '') {
                        Header.style.display = 'none';
                     } else { 
                        Header.style.display = 'block';
                        Header.style.left = 1;
                        Header.style.top = nT + 1;
                        Header.style.width = offsetWidth - nPW - 2;
                        nT += Header.offsetHeight;
                        nH -= Header.offsetHeight;
                     }
                  }
                  
                  /*--- Design-View [Input] ---*/  
                  //if ((InputDesign) && (InputDesign.style.display != 'none')) {
                  if (InputDesign) {
                     InputDesign.style.left = 1;
                     InputDesign.style.top = nT + 1;

                     if (_fIE) {
                        InputDesign.style.width = offsetWidth - nPW - 3;
                        InputDesign.style.height = nH - nPH - 3;
                     } else {
                        if (InputDesign.tagName == 'DIV') {
                           InputDesign.style.width = offsetWidth - nPW - 2;
                        } else {   
                           InputDesign.style.width = offsetWidth - nPW;
                        }

                        InputDesign.style.height = nH - nPH - 2;
                     }
                  }

                  /*--- Source-View [Input] ---*/  
                  //if ((InputSource) && (InputSource.style.display != 'none')) {
                  if (InputSource) {
                     InputSource.style.left = InputDesign.style.left;
                     InputSource.style.top = InputDesign.style.top;
                     InputSource.style.width = InputDesign.style.width;
                     InputSource.style.height = InputDesign.style.height;
                  }
             }
         } catch (e) {
             __bw2Debug('__bw2EditorResize Exception : ' + e);
         }
}

/*--------------------------------------------------------------------------------*/

function __bw2EditorResizeObject(oObj) {
         try {
             if (oObj) __bw2EditorResize(null, oObj.id); 
         } catch (e) {}
}

/*================================================================================*/
/* <Function> Editor Show-Images </Function>
/*================================================================================*/
function __bw2EditorShowImages(strEditor) {
         try {
             __bw2AjaxRequest(strEditor, null, null, 'onshowimages', null);
         } catch (e) {}
}

/*================================================================================*/
/* <Function> Set Editors ToolStrip-Items by Content (Bold, Italic, Font, ..) </Function>
/*================================================================================*/
function __bw2EditorToolStripItemsSet(oDocument) { 
         if ((_oEditor == null) || (oDocument == null)) return;

         var oItemBold = __bw2ToolStripGetItemByCommand(_oEditor.ID, 'bold');

         if (oItemBold == null) return;

__bw2Debug('__bw2EditorToolStripItemsSet : ' + oDocument.tagName);
                  
         switch (oDocument.tagName) {
                case 'BODY' :
                     oItemBold.Check(false);
                     break;  
                case 'SPAN' :
                case 'STRONG' :
                     oItemBold.Check(true);
                     break;  
                  }
}

/*--------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------*/
