var dom = new Object();

dom.version = new Object();
dom.version = "2.56 BETA Build 100601";

dom.get = new Object();
dom.get=function(ids,getwhat)
{
	if((typeof ids)=="string"){ var input = ids.split(",");  } else { var input = ids; }
	var output = new Array();

	for (forDomGet=0;forDomGet<input.length;forDomGet++)
	{
		output[forDomGet] = eval("document.getElementById('"+input[forDomGet]+"')."+getwhat);
	}
	return output;
}

dom.doc = new Object(); 
dom.doc = function()
{
	if(window.innerHeight!=window.undefined){ var vpHeight = window.innerHeight; } else
	if(document.compatMode=='CSS1Compat'){ var vpHeight = document.documentElement.clientHeight; } else
	if(document.body){ var vpHeight = document.body.clientHeight; } else { var vpHeight = false; }

	if(window.innerWidth!=window.undefined){ var vpWidth = window.innerWidth;  } else
	if(document.compatMode=='CSS1Compat'){ var vpWidth = document.documentElement.clientWidth; } else
	if(document.body){ var vpWidth = document.body.clientWidth; } else { var vpWidth = false; }

	if(self.pageYOffset){ var scHeight = self.pageYOffset; } else
	if(document.documentElement && document.documentElement.scrollTop){ var scHeight = document.documentElement.scrollTop; } else
	if (document.body){ var scHeight = document.body.scrollTop; } else { var scHeight = false; }

	if(self.pageXOffset){ var scWidth = self.pageXOffset; } else
	if(document.documentElement && document.documentElement.scrollLeft){ var scWidth = document.documentElement.scrollLeft; } else
	if(document.body){ var scWidth = document.body.scrollLeft; } else { var scWidth = false; }
	
	if(vpHeight>=scHeight){ var midHeight = vpHeight/2; } else { var midHeight = scHeight/2; }
	if(vpWidth>=scWidth){ var midWidth = vpWidth/2; } else { var midWidth = scWidth/2; }
	
	var docStats = new Array();
	docStats[0] = vpHeight; //Viewport height
	docStats[1] = vpWidth; //Viewport width
	docStats[2] = scHeight; //Scroll height (top)
	docStats[3] = scWidth; //Scroll width (right)
	
	//alert("\n0: " + docStats[0] + "\n1: " + docStats[1] + "\n2: " + docStats[2] + "\n3: " + docStats[3]);
	return docStats;
}

dom.c = new Object(); //center X and Y in visible window
dom.c=function(ids)
{
	var input = ids.split(",");
	for (forDomC=0;forDomC<input.length;forDomC++)
	{
		var element = document.getElementById(ids);
		var bodyHeight=dom.doc()[0];
		var bodyWidth=dom.doc()[1];
		var scrollTop=dom.doc()[2];
		var scrollLeft=dom.doc()[3];

		element.style.position="absolute";
		//element.style.top=(bodyHeight/2)-(element.offsetHeight/2)+scrollTop+"px";
		element.style.left=(bodyWidth/2)-(element.offsetWidth/2)+scrollLeft+"px";
	}
}

/* 
Function:		dom.chg(ids,chgwhat,chgto)
Description:	Changes the value of a specified property of one or more elements then returns the values of those elements.
Parameters:
	ids - One or more comma-separated element IDs
	chgwhat - The property to change and collect the value of
Output:			returns an array with the value of the property of each ID in the order they were passed to the function after they are changed 
Sample:			dom.chg("id1,id2,id3","style.color","#CCC");
				returns an array where array[0] = "#CCC"; array[1] = "#CCC"; array[2] = "#CCC";
*/


dom.chg = new Object();
dom.chg=function(ids,chgwhat,chgto)
{
	if((typeof ids)=="string"){ var input = ids.split(",");  } else { var input = ids; }
	var output = new Array();
	
	for (forDomChg=0;forDomChg<input.length;forDomChg++)
	{
		eval("document.getElementById('"+input[forDomChg]+"')."+chgwhat+"='"+chgto+"'");
		output[forDomChg] = eval("document.getElementById('"+input[forDomChg]+"')."+chgwhat);
	}
	return output;
}

/* Aliases for dom.chg */

dom.set = new Object(); // To address a legacy script concern
dom.set=function(ids,chgwhat,chgto){ dom.chg(ids,chgwhat,chgto); }

dom.s = new Object(); // Show function - sets display:block
dom.s=function(ids){ dom.chg(ids,"style.display","block"); }

dom.h = new Object(); // Show function - sets display:none
dom.h=function(ids){ dom.chg(ids,"style.display","none"); }

dom.v = new Object(); // Show function - sets visibility:visible
dom.v=function(ids){ dom.chg(ids,"style.visibility","visible"); }

dom.i = new Object(); // Show function - sets visibility:hidden
dom.i=function(ids){ dom.chg(ids,"style.visibility","hidden"); }

dom.sc = new Object(); // Show function - sets visibility:hidden
dom.sc=function(ids){ dom.s(ids); dom.c(ids); }

/* Toggle function - toggles display property */
dom.t = new Object(); 
dom.t=function(ids)
{
	if((typeof ids)=="string"){ var input = ids.split(",");  } else { var input = ids; }
	var output = new Array();

	for(domt=0;domt<input.length;domt++)
	{
		if(dom.get(input[domt],"style.display")=="block")
		{
			dom.chg(input[domt],"style.display","none");
		} else
		{
			dom.chg(input[domt],"style.display","block");	
		}
		output[domt] = dom.get(input[domt],"style.display");
	}
}

function centerContainer()
{
	dom.c("container");	
}

window.onload = centerContainer;

var mmOpenContainer = null;
var mmOpenMenus = null;
var mmHideMenuTimer = null;

function MM_menuStartTimeout(hideTimeout) {
	mmHideMenuTimer = setTimeout("MM_menuHideMenus()", hideTimeout);	
}

function MM_menuHideMenus() {
	MM_menuResetTimeout();
	if(mmOpenContainer) {
		var c = document.getElementById(mmOpenContainer);
		c.style.visibility = "inherit";
		mmOpenContainer = null;
	}
	if( mmOpenMenus ) {
		for(var i = 0; i < mmOpenMenus.length ; i++) {
			var m = document.getElementById(mmOpenMenus[i]);
			m.style.visibility = "hidden";			
		}
		mmOpenMenus = null;
	}
}

function MM_menuHideSubmenus(menuName) {
	if( mmOpenMenus ) {
		var h = false;
		var c = 0;
		for(var i = 0; i < mmOpenMenus.length ; i++) {
			if( h ) {
				var m = document.getElementById(mmOpenMenus[i]);
				m.style.visibility = "hidden";
			} else if( mmOpenMenus[i] == menuName ) {
				h = true;
			} else {
				c++;
			}
		}
		mmOpenMenus.length = c+1;
	}
}

function MM_menuOverMenuItem(menuName, subMenuSuffix) {
	MM_menuResetTimeout();
	MM_menuHideSubmenus(menuName);
	if( subMenuSuffix ) {
		var subMenuName = "" + menuName + "_" + subMenuSuffix;
		MM_menuShowSubMenu(subMenuName);
	}
}

function MM_menuShowSubMenu(subMenuName) {
	MM_menuResetTimeout();
	var e = document.getElementById(subMenuName);
	e.style.visibility = "inherit";
	if( !mmOpenMenus ) {
		mmOpenMenus = new Array;
	}
	mmOpenMenus[mmOpenMenus.length] = "" + subMenuName;
}

function MM_menuResetTimeout() {
	if (mmHideMenuTimer) clearTimeout(mmHideMenuTimer);
	mmHideMenuTimer = null;
}

function MM_menuShowMenu(containName, menuName, xOffset, yOffset, triggerName) {
	MM_menuHideMenus();
	MM_menuResetTimeout();
	MM_menuShowMenuContainer(containName, xOffset, yOffset, triggerName);
	MM_menuShowSubMenu(menuName);
}

function MM_menuShowMenuContainer(containName, x, y, triggerName) {	
	var c = document.getElementById(containName);
	var s = c.style;
	s.visibility = "inherit";
	
	mmOpenContainer = "" + containName;
}
