


/******************************************************/
/* Support routines for open editor on separate window
/******************************************************/

var isReload = false

function openEditorWindow(editableContent) {
  var wnd = document.body.getAttribute('editorWindow');
  if (wnd == null || (typeof(wnd) == 'undefined') || (typeof(wnd) == 'object' && wnd.closed))
  {
    document.body.setAttribute('editorWindow', window.open('HtmlEditorDialog.aspx?editableContent='+editableContent,
    		'_blank','height=440,width=755;menubar=no,resizable=yes,scrollbars=yes,status=yes', ''));
    
  }
}

function closeEditorWindowAndSave(editor, editSpan, editableContent) {

  if(opener != null) {
  
    if (editor.isEditMode) showDesign(editor);
    
    opener.document.getElementById(editableContent).innerHTML = eval(editSpan).document.body.innerHTML;
    
  }
  window.close();
}

function onCloseEditorWindow() {
  if(opener != null) {
    opener.document.body.removeAttribute('editorWindow');
    opener.document.body.onfocus = null;
  }
}

function onEditorLoad(editSpan, editableContent) {
		if(opener != null ) {
		  //alert(opener.location);
			opener.document.body.setAttribute('editorWindow', window);
			var funcName = 'opener.document.body.getAttribute(\'editorWindow\').focus();';
			opener.document.body.onfocus = new Function(funcName);
      eval(editSpan).document.body.innerHTML = opener.document.getElementById(editableContent).innerHTML;
      eval(editSpan).focus();
		}
}



function disableAllButtons(currentForm) {
  if(currentForm != null) {
    for(i = 0; i < currentForm.elements.length; i++) {
      formChild = currentForm.elements.item(i);
      if(formChild.getAttribute("type") == "button" || formChild.getAttribute("type") == "submit" ||
          formChild.getAttribute("type") == "file" || formChild.getAttribute("type") == "reset")
        formChild.disabled = true;
    }
  }
}

