function popupBrushDetails() {
	var brushesWidth = 0;
	$j("#new_popup").height($j("#product_main").height());
	$j("#new_popup").show();
	$j("#new_popup #popup_box .product_brush").each(function() {
		if ($j(this).width() < 72) {
			$j(this).width(72);
		}
		$j(this).height($j(this).find("img").height());
		$j(this).find("img").css({'display': 'block', 'margin': '0px auto', 'padding': '1px'});
		brushesWidth += $j(this).width();
		$j(this).mouseenter(function() {
			var id = $j(this).attr("id");
			var index = id.split("product_brush_")[1];
			showTooltip(index);
		}).mouseleave(function(e) {
			var offset = $j(".tooltip:visible").offset();
			var width = $j(".tooltip:visible").width();
			var height = $j(".tooltip:visible").height();
			if (e.pageX < offset.left || e.pageX > offset.left + width || e.pageY < offset.top || e.pageY > offset.top + height) {
				hideTooltip();
			}
		});
	});
	$j("#new_popup #popup_box").css({'width': brushesWidth, 'margin': '0px auto'});
}

function showTooltip(index) {
	hideTooltip();
	var position = $j("#product_brush_" + index).position();
	var width = $j("#product_brush_" + index).width();
	var popupwidth = $j("#new_popup").width();
	if (position.left + (width / 2) + 10 < (popupwidth / 2)) {
		$j("#tooltip_right").css("left", position.left + (width / 2) + 10);
		$j("#tooltip_right .tooltip_title").text(popupName[index]);
		$j("#tooltip_right .tooltip_content").text(popupDesc[index]);
		$j("#tooltip_right").mouseleave(function() {hideTooltip();});
		$j("#tooltip_right").show();
	}
	else {
		$j("#tooltip_left").css("left", position.left + (width / 2) - 5 - $j("#tooltip_left").width());
		$j("#tooltip_left .tooltip_title").text(popupName[index]);
		$j("#tooltip_left .tooltip_content").text(popupDesc[index]);
		$j("#tooltip_left").mouseleave(function() {hideTooltip();});
		$j("#tooltip_left").show();
	}
}

function hideTooltip() {
	$j("#tooltip_right").hide();
	$j("#tooltip_left").hide();
}

function setProductDetailsViewBrushDetailsPosition() {
	$j("a#detail_link").css("top", $j("a#detail_link").closest(".product_image").find("img").height() + 30);
}


