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)
{
	data_parts = data.split('|');
	document.getElementById('shipping_box_top_subtable').innerHTML = data_parts[0];
	document.getElementById('shipping_box_bottom').innerHTML = data_parts[1];
}

//pictures
var showing_picture = '-1';
function shift_onmouseover(main_picture_url, selected_picture_id)
{
	document.getElementById('item_image').src = main_picture_url
	showing_picture = selected_picture_id;
}
function pop_up(product_id)
{
	return window.open('/pictures_new.php?id='+product_id+'&picture_id='+showing_picture, 'pictures', 'location=0,scrollbars=1,resizable=1');
}
function pop_up_360(product_id)
{
	return window.open('/pictures_new.php?id='+product_id+'&picture_id=-360', 'pictures', 'location=0,scrollbars=1,resizable=1');
}