﻿var HasPointerOnhelpLayer = false;
var config = {
    sensitivity: 3, // number=sensitivity threshold (must be 1 or higher)    
    interval: 20, // number=milliseconds for onMouseOver polling interval
    over: function() { ShowHoverBox($("div[id='dvHoverBox']"), this, 'Price Info', null, null, 500,0,0); }, // function = onMouseOver callback (REQUIRED)    
    timeout: 50, // number = milliseconds delay before onMouseOut
    out: function() { hideHoverBox($("div[id='dvHoverBox']")); } // function = onMouseOut callback (REQUIRED)
};

//Attaching the Hover functionality to elements.
$(document).ready(function() {
        $('.cHover').hoverIntent(config);
});

// Function to display the HoverBox with given title,text,heigh,width,top,left properties.
function ShowHoverBox(hoverObject, targetObject, title, text, height, width, top, left) {
 var pos = $(targetObject).position();
    $('#hoverTitle').html(title);
    $(hoverObject).css({'visibility': 'visible','display': 'block','width':width });
    $(hoverObject).css({ 'left': (pos.left) + 'px', 'top': $(targetObject).height() + parseInt(pos.top) + top + 'px' });
    $(hoverObject).css({ 'width': (width) + 'px'});
}

// Function to hide the HoverBox.
function hideHoverBox(hoverObject) {
   
   if(!HasPointerOnhelpLayer)
   {
        $(hoverObject).css({'visibility': 'hidden','display': 'none' }).hide();
   }
}

//Show info layer when mouse over the info box.
function ShowHover()
{
    HasPointerOnhelpLayer = true;
    $($("div[id='dvHoverBox']")).css({'visibility': 'visible','display': 'block' }).show();
}

//Hide info layer when mouse out the info box.
function HideHover()
{
    HasPointerOnhelpLayer = false;
    hideHoverBox($("div[id='dvHoverBox']"));
}
