function show_feature_description(feature_id, caller)
{	
	feature_description = 'Invalid feature';
	feature_name ='Invalid feature';

	for (i=0; i<product_feature_definitions.length; i++)
	{
		if (product_feature_definitions[i][0] == feature_id)
		{
			feature_name = product_feature_definitions[i][1];
			feature_description = product_feature_definitions[i][2];
			break;
		}
	}
	
	//configure the element and position it properly...
	//we want to avoid having part of the div hidden, so we try to make sure
	//that it will fit in the window when we position it
	document.getElementById('feature_description_div_name').innerHTML = feature_name
	document.getElementById('feature_description_div_description').innerHTML = feature_description;
	
	caller_y_position = get_position_y(caller);
	page_bottom = get_scroll_offset() + get_viewport_height();
	top_position = caller_y_position + 20;
	bottom_position = top_position + document.getElementById('feature_description_div').offsetHeight;
	
	if (bottom_position > page_bottom)
	{
		top_position -= (bottom_position - page_bottom);
	}
		
	document.getElementById('feature_description_div').style.top = top_position + 'px';

	document.getElementById('feature_description_div').style.visibility = 'visible';
	document.getElementById('feature_description_div').style.left = (get_position_x(caller) + caller.offsetWidth * 0 + 100 - document.getElementById('feature_description_div').offsetWidth * 0 ) + 'px';
}

function hide_feature_description()
{
	document.getElementById('feature_description_div').style.visibility = 'hidden';
}

function show_stock_tooltip(text, caller)
{	
	document.getElementById('stock_tooltip_div').innerHTML = text;
	
	caller_y_position = get_position_y(caller);
	page_bottom = get_scroll_offset() + get_viewport_height();
	top_position = caller_y_position + 20;
	bottom_position = top_position + document.getElementById('stock_tooltip_div').offsetHeight;
	
	if (bottom_position > page_bottom)
	{
		top_position -= (bottom_position - page_bottom);
	}
	
	left_position = (get_position_x(caller) + 100 );
		
	document.getElementById('stock_tooltip_div').style.top = top_position + 'px';
	document.getElementById('stock_tooltip_div').style.visibility = 'visible';
	document.getElementById('stock_tooltip_div').style.left = left_position + 'px';
}

function hide_stock_tooltip()
{
	document.getElementById('stock_tooltip_div').style.visibility = 'hidden';
}

function show_shipping_quote(data)
{
	//alert(data);
	data_parts = data.split('|');
	document.getElementById('shipping_box_top_subtable').innerHTML = data_parts[0];
	document.getElementById('shipping_box_bottom').innerHTML = data_parts[1];
}

function tab_mouseover(tab_id)
{
	if (tab_id == selected_tab)
	{
		return;
	}
	
	$('info_tab'+tab_id+'_left').style.backgroundImage = "url('../images/viewitem/tab_hover_l.gif')";
	$('info_tab'+tab_id+'_right').style.backgroundImage = "url('../images/viewitem/tab_hover_r.gif')";
	$('info_tab'+tab_id+'_h2').style.backgroundImage = "url('../images/viewitem/tab_hover_m.gif')";

}

function tab_mouseout(tab_id)
{
	if (tab_id == selected_tab)
	{
		return;
	}

	$('info_tab'+tab_id+'_left').style.backgroundImage = "url('../images/viewitem/tab_off_l.gif')";
	$('info_tab'+tab_id+'_right').style.backgroundImage = "url('../images/viewitem/tab_off_r.gif')";
	$('info_tab'+tab_id+'_h2').style.backgroundImage = "url('../images/viewitem/tab_off_m.gif')";
}

function tab_select(tab_id)
{
	//unselect currently selected tab
	$('info_tab'+selected_tab+'_left').style.backgroundImage = "url('../images/viewitem/tab_off_l.gif')";
	$('info_tab'+selected_tab+'_right').style.backgroundImage = "url('../images/viewitem/tab_off_r.gif')";
	$('info_tab'+selected_tab+'_h2').style.backgroundImage = "url('../images/viewitem/tab_off_m.gif')";
	$('tab_content'+selected_tab).style.display = 'none';
	$('info_tab'+selected_tab).style.cursor = 'pointer';

	$('info_tab'+tab_id+'_left').style.backgroundImage = "url('../images/viewitem/tab_on_l.gif')";
	$('info_tab'+tab_id+'_right').style.backgroundImage = "url('../images/viewitem/tab_on_r.gif')";
	$('info_tab'+tab_id+'_h2').style.backgroundImage = "url('../images/viewitem/tab_on_m.gif')";	
	$('tab_content'+tab_id).style.display = 'block';
	$('info_tab'+tab_id).style.cursor = 'default';
	selected_tab = tab_id;	
}