


window.onloadFunctions		= new Array();
window.onresizeFunctions	= new Array();
window.addOnload	= function(ourFunction) {window.onloadFunctions[window.onloadFunctions.length] = ourFunction;}
window.addOnresize= function(ourFunction) {window.onresizeFunctions[window.onresizeFunctions.length] = ourFunction;}
window.onload = function() {
  for (var i = 0; i < onloadFunctions.length; i++) onloadFunctions[i]();
}
window.onresize = function() { 
	for (var i = 0; i < onresizeFunctions.length; i++) onresizeFunctions[i]();
}
if (!document.all) {
  try {
		document.createElement('a');
		HTMLElement.prototype.click = function () {
			if (typeof this.onclick == 'function') {
				if (this.onclick({type: 'click'}) && this.href) 
					window.open(this.href, this.target ? this.target : '_self');
			}
			else if (this.href) window.open(this.href, this.target ? this.target : '_self');
		}
	}
	catch (e) {
		window.status='Warning: your browser is unable to attach click methods to all elements.';
	}
}


// general purpose Browser detection object.
function Browser(){
  this.ua = navigator.userAgent.toLowerCase();
  this.dom = document.getElementById?1:0;
	this.ie =  document.all?1:0;
  this.ie5 = (this.dom && this.ie)?1:0;
  this.ie50 = (navigator.appVersion.indexOf("MSIE 5.0")!=-1);
  this.ie55 = (navigator.appVersion.indexOf("MSIE 5.5")!=-1);
  this.mac = (navigator.appVersion.indexOf('Mac') == -1)?0:1;
  this.platform = navigator.platform;
  this.safari = (this.ua.indexOf("safari") != -1)?1:0;
  this.opera  = (this.ua.indexOf("opera") != -1)?1:0;
  if (this.unSupported()) {
    alert("hey, this browser will give you no end of trouble. ");
  }
}
Browser.prototype.unSupported = function() {
	if (
		(!this.dom) 
	) 
  return true;
  else return false;  
}
var is = new Browser();
var cmm = null;
var tam = null;
var tm = null;




function getEventOriginator(mozEvent) {
	return (document.all) ?  event.srcElement : mozEvent.target;
}


function init() {
	if (typeof(CommandMenuManager)!="undefined") cmm = new CommandMenuManager();
	if (typeof(TextareaManager)!="undefined")			tam = new TextareaManager();
	if (typeof(TableManager)!="undefined")			tam = new TableManager();
}
window.addOnload(init);



function getInlinePosition(elt) {
//	alert(elt.tagName+"."+elt.className);
  var workerBee = elt;
  var inlinePosition = new Array(); 
  inlinePosition[0] = inlinePosition[1] = 0;
  while (workerBee.offsetParent) { 
    inlinePosition[0] += workerBee.offsetLeft;
    inlinePosition[1] += workerBee.offsetTop;
    workerBee = workerBee.offsetParent;
  }  
  return inlinePosition;
}

function stripClassName (elt, classNameToRemove) {
  var oldClassName = elt.className;
  var newClassName = elt.className.replace(" "+classNameToRemove +" ","");
  newClassName = elt.className.replace(" "+classNameToRemove,"");
  newClassName = elt.className.replace(classNameToRemove,"");
  elt.className = newClassName
}
function addClassName(elt,newClassName) {
	elt.className = elt.className + " " + newClassName
}

function getWindowHeight() {
  if (self.innerHeight) { 
    return self.innerHeight;
  }
  else if (document.documentElement && document.documentElement.clientWidth)
	{
		return document.documentElement.clientHeight;
	}
  else if (document.body) {
   return document.body.clientHeight;
  }
}
