﻿// TODO: Work out where this file lives, and how to ensure it gets referenced 
// (presumably by PubliSiteTemplateBaseClass)

function showhide(id)
{
	if (document.getElementById)
	{
		obj = document.getElementById(id);
	
		if (obj.style.display != "block")
			obj.style.display = "block";
		else 
			obj.style.display = "none";
	}
}

// These functions control the display of the TinyMCE rich text edit control

function getOffSet(myEditor) {
  // Fetch the editor window
  if(document.getElementById) {
    currentEditor = document.getElementById(myEditor).style;
  } else if(document.all) {
      currentEditor = eval('document.all.'+myEditor+'.style');
  }
  currentEditor.display = "block";
  moveEditor(myEditor);
}

function moveEditor(myEditor) {
  if(currentEditor) {

    if (document.documentElement && document.documentElement.scrollTop) {
      var y_offset = document.documentElement.scrollTop;
    } else if (document.body) {
      var y_offset = document.body.scrollTop;
    } else if (window.pageYOffset) {
      var y_offset = window.pageYOffset;
    } else {
      var y_offset = 0;
    }

    if(y_offset > 0) {
      var y_pos = y_offset + 5;
    } else {
      var y_pos = 5;
    }
     currentEditor.top = y_pos;
  }
}

function closeEditor() {
  if(currentEditor) {
    currentEditor.display = "none";
  }
}
