/**
 * The script shows hidden box with info about difference between unique and no unique prices.
 * Is called when hoverd "?" in "Price (?):" or "Unique Price(?):" strings
 * Works togather with "jquery.hints.css".
 * The script was written in base of "pice_info.js" of "default" by Ujeen.
 * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 * !!!!!!!!DEPENDS ON "jquery.offsetToPage.js"!!!!!!!!
 * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 * 
 * @author andrew
 *
 */

jQuery(document).ready(function($) {
    $('.price-hint').hover(
	function(e) {	    
	    var box_w = $('#priceTitle').outerWidth(),
		box_h = $('#priceTitle').outerHeight(),
		offsetX = 20,
		offsetY = 0,
		x = e.pageX,
		y = e.pageY,
		scrollTop = $(document).scrollTop(),
		left = 0,
		top = 0;
	    
	    if(x+box_w+offsetX > $(window).width())
		left = x-box_w-offsetX;
	    else
		left = x+offsetX;
	    if(y + box_h + offsetY > scrollTop + $(window).height())
		top = scrollTop + $(window).height() - box_h - offsetY;
	    else
		top = y+offsetY;
	    
	    $('#priceTitle').offsetToPage(left,top);
	},
	function() {
	    $('#priceTitle').hide();
	});
});


