aAllowedMethods = [ "display", "visibility" ];

show = function( mId, sMethod )
{
	sMethod = sMethod || "display";

	if( !aAllowedMethods.in_array( sMethod ) )
		return false;

	if( mId instanceof Array )
		for( var i = 0; i < mId.length; ++i )
		{
			oElement = document.getElementById( mId[ i ] );
			if( oElement )
				oElement.style[ sMethod ] = ( sMethod == "display" ? "block" : "visible" );
		}
	else
	{
		oElement = document.getElementById( mId );
		if( oElement )
			oElement.style[ sMethod ] = ( sMethod == "display" ? "block" : "visible" );
	}
}

hide = function( mId, sMethod )
{
	sMethod = sMethod || "display";

	if( !aAllowedMethods.in_array( sMethod ) )
		return false;

	if( mId instanceof Array )
		for( var i = 0; i < mId.length; ++i )
		{
			oElement = document.getElementById( mId[ i ] );
			if( oElement )
				oElement.style[ sMethod ] = ( sMethod == "display" ? "none" : "hidden" );
		}
	else
	{
		oElement = document.getElementById( mId );
		if( oElement )
			oElement.style[ sMethod ] = ( sMethod == "display" ? "none" : "hidden" );
	}
}

check = function( mId )
{
	if( mId instanceof Array )
		for( var i = 0; i < mId.length; ++i )
		{
			oElement = document.getElementById( mId[ i ] );
			if( oElement )
				oElement.checked = true;
		}
	else
	{
		oElement = document.getElementById( mId );
		if( oElement )
			oElement.checked = true;
	}
}

uncheck = function( mId )
{
	if( mId instanceof Array )
		for( var i = 0; i < mId.length; ++i )
		{
			oElement = document.getElementById( mId[ i ] );
			if( oElement )
				oElement.checked = false;
		}
	else
	{
		oElement = document.getElementById( mId );
		if( oElement )
			oElement.checked = false;
	}
}

Array.prototype.in_array = function( sNeedle )
{
	for( var i = 0; i < this.length; ++i )
		if( this[ i ] == sNeedle )
			return true;
	return false;
}

MouseEvent = function( sClass, sAddClass, aEvent )
{
	this._class = sClass;
	this._addclass = sAddClass;
	this._regex = new RegExp( "\s?" + this._addclass + "" );
	this._events = aEvent;
	this.init();
}

MouseEvent.prototype.init = function()
{
	this._elements = document.getElementsByClassName( this._class );
	for( var i = 0; i < this._elements.length; ++i )
		this._addEvents( this._elements[ i ] );
}

MouseEvent.prototype._addEvents = function( oElement )
{
	oElement._parent = this;
	for( var i = 0; i < this._events.length; ++i )
		if( this[ this._events[ i ] ] )
			oElement[ this._events[ i ] ] = this[ this._events[ i ] ];
}

MouseEvent.prototype.onmouseover = function()
{
	sClass = this.className;
	sNewClass = "";
	if( sClass.length > 0 )
		sNewClass += " ";
	this.className = sClass + sNewClass + this._parent._addclass;
}

MouseEvent.prototype.onmouseout = function()
{
	sClass = this.className;
	sClass = sClass.replace( this._parent._regex, "" );
	this.className = sClass;
}
