
//The currently selected node id
var s_selected_node_id = "";

/**************************************************************************
 Description:	Changes the style of the node on mouse over event 
 Parameters:	none
 Return:		nothing
***************************************************************************/
function OnMouseOver()
{
	var o_src = event.srcElement;
	if(o_src.tagName == "TD" && o_src.id !=  s_selected_node_id)
	{
		if(o_src.STATIC == "1")
			return;
		o_src.className = "ON_CELL_OVER";
	}
}

// Added by Yuri on 07/11/10 (Firefox fix)
function OnMouseOver_this(o_src)
{
	if(o_src.tagName == "TD" && o_src.id !=  s_selected_node_id)
	{
		if(o_src.STATIC == "1")
			return;
		o_src.className = "ON_CELL_OVER";
	}
}

/**************************************************************************
 Description:	Nullyfies the style of the node on mouse out event 
 Parameters:	none
 Return:		nothing
***************************************************************************/
function OnMouseOut()
{		
	var o_src = event.srcElement;
	if(o_src.tagName == "TD" && o_src.id !=  s_selected_node_id)
	{
		if(o_src.STATIC == "1")
			return;
		o_src.className = "";				
	}			
}

// Added by Yuri on 07/11/10 (Firefox fix)
function OnMouseOut_this(o_src)
{		
	if(o_src.tagName == "TD" && o_src.id !=  s_selected_node_id)
	{
		if(o_src.STATIC == "1")
			return;
		o_src.className = "";				
	}			
}

/**************************************************************************
 Description:	Executes an On Click event 
 Parameters:	o_node_clicked	- HTML td - the node which was clicked
				b_change_url	- bollean - Boolean. Indicated wether to change the url of the page
 Return:		nothing
***************************************************************************/
function OnClick(o_node_clicked , b_change_url)
{
	var o_node;
	if(o_node_clicked == null)
		o_node = event.srcElement; 
	else
		o_node = o_node_clicked;
		
	if(o_node.tagName != "TD" || o_node.STATIC == "1" )
		return;
		
	var o_selected = GetNode(s_selected_node_id);
			
		
	//if(o_selected != null && o_selected.id == o_node.id)
	//	return;
		
	//o_selected.SELECTED		= "0";
	if(o_selected != null)
		o_selected.className	= "";
	o_node.className		= "SELECTED_NODE";
	//o_node.SELECTED			= "1";
	
	if(b_change_url == null || b_change_url == true)
		eval(o_node.ON_CLICK_TARGET);	
	s_selected_node_id		= o_node.id;
	top.selected_btn_top	= o_node.id;
}

// Added by Yuri on 07/11/10 (Firefox fix)
function OnClick_FF(o_node, sItemUrl)
{
	var o_selected = document.getElementById(s_selected_node_id);
	if(o_selected != null)
		o_selected.className	= "";
	o_node.className		= "SELECTED_NODE";
	eval(o_node.ON_CLICK_TARGET);	
	s_selected_node_id		= o_node.id;
	top.selected_btn_top	= o_node.id;
	top.main_frame.location.href = sItemUrl;
}

/**************************************************************************
 Description:	Gets the node through the node id
 Parameters:	s_id	- string.The node id
 Return:		HTML td - The requeted node
***************************************************************************/
function GetNode(s_id)
{
	//var o_node = tool_bar.all(s_id)
	var o_node = document.getElementById(s_id);
	if(o_node != null)
		return o_node;
}

/**************************************************************************
 Description:	sets a node as selected
 Parameters:	s_node_id		- string. the new node
 				b_change_url	- Boolean. Indicated wether to change the url of the page
 Return:		Nothing
***************************************************************************/

// Changed by Yuri on 07/11/10 (Firefox fix)
function SetSelectedNode(s_node_id, b_change_url)
{
	//var o_node = GetNode(s_node_id)
	var o_node = document.getElementById(s_node_id);
	if(o_node == null)
		return;
	OnClick(o_node , b_change_url);
}
