function get_element_by_id(id)
{
	var obj;

	if (document.all){
		eval('obj = document.all("' + id + '")');
	}
	else if (document.layers){		
		eval('obj = document.layers["' + id + '"]');
	}
	else if (document.getElementById){	
		eval ('obj = document.getElementById ("' + id + '")');
	}
	
	return obj;
}

// DOM MENU EFFECT SYSTEM ------------------------------------------------------------------------------------------------------------------------

function bmeffect(objName, container_id, css_default, css_over, css_selected, option_type, callback_function)
{
	/*####################################################################################################
	## OBJECT PROPERTIES
	###################################################################################################*/

	this.objName = objName;
	this.container_id = container_id;
	
	// set DIV as default element if none is provided
	this.option_type = option_type ? option_type : 'DIV';
	this.callback_function = callback_function;
	this.options_index = 0;

	this.css = new Array();
	this.css['default'] = css_default;
	this.css['over'] = css_over;
	this.css['selected'] = css_selected;

	this.last_selected = null;
	this.last_hovered = null;
	this.last_hovered_class = null;
	
	// get referrence to option container element
	this.options_container = document.getElementById(this.container_id);
	
	// set this object's name on the menu container so the eventCall function would know which object to call
	this.options_container.setAttribute("bmeObj", objName);

	/*####################################################################################################
	## OBJECT METHODS
	####################################################################################################*/
	
	// ----------------------------------------------------------------------------------------------------
	// DEFINE "MOUSE IS OVER OPTION" EVENT 
	// ----------------------------------------------------------------------------------------------------
	this.event_over = function(el)
	{
		// set last_hovered option's class to it's last class before selection
		if(this.last_hovered)
		{
			this.last_hovered.className = this.last_hovered_class;
		}

		// set last_hovered_class to hovered option's current class
		this.last_hovered_class = el.className;

		// set current hovered option to over class
		el.className = this.css['over'];

		// set last_hovered to current hovered option
		this.last_hovered = el;
		
		// if callback function is defined, run it
		if(callback_function)
		{
			callback_function(el, "over");
		}

	};

	// ----------------------------------------------------------------------------------------------------
	// DEFINE "MOUSE IS OUT" EVENT 
	// ----------------------------------------------------------------------------------------------------
	this.event_out = function(el)
	{
		// set last_hovered option's class to it's last class before selection
		if(this.last_hovered)
		{
			this.last_hovered.className = this.last_hovered_class;
		}

		// reset all effect variables
		this.last_hovered = null;
		this.last_hovered_class = null;
		
		// if callback function is defined, run it
		if(callback_function)
		{
			callback_function(el, "out");
		}
	};

	// ----------------------------------------------------------------------------------------------------
	// DEFINE "OPTION CLICK" EVENT 
	// ----------------------------------------------------------------------------------------------------
	this.event_click = function(el)
	{
		// set last selected option's class to default
		if(this.last_selected)
		{
			this.last_selected.className = this.css['default'];
		}

		// set this option's last hovered class to selected class
		this.last_hovered_class = this.css['selected'];

		// set class of hovered option to selected class
		el.className = this.css['selected'];

		// set last selected option to current option
		this.last_selected = el;

		// if callback function is defined, run it
		if(callback_function)
		{
			callback_function(el, "click");
		}

	};
	
	/*####################################################################################################
	## RUNTIME PROCESSES
	####################################################################################################*/

	// prepare options
	for (node_index=0; node_index < this.options_container.childNodes.length; node_index++)
	{
		if (this.options_container.childNodes[node_index].nodeName == option_type)
		{
			// index all options
			this.options_container.childNodes[node_index].setAttribute("optionIndex", this.options_index);
			
			// set all option's classes to default class
			this.options_container.childNodes[node_index].className = this.css['default'];

			// bind "mouse is over option" event
			this.options_container.childNodes[node_index].onmouseover = function()
			{
				eval(this.parentNode.getAttribute("bmeObj") + ".event_over(this);");
			};

			// bind "mouse is out" event
			this.options_container.childNodes[node_index].onmouseout = function()
			{
				eval(this.parentNode.getAttribute("bmeObj") + ".event_out(this);");
			};

			// bind "option click" event
			this.options_container.childNodes[node_index].onclick = function()
			{
				eval(this.parentNode.getAttribute("bmeObj") + ".event_click(this);");
			};
			
			this.options_index++;
		}
	}
}

function hidedivdis(name)
{
		document.getElementById(name).style.display="none";
	
}

function showdivdis(name)
{
		document.getElementById(name).style.display="block";
	
}


