
// include this JS to display banner boxes via jsonp.

// this is the array holding the json objects (banner boxes) that we've processed
// and displayed.  this is different from json string via the callback because this
// array only contains banner boxes displayed.  filters may preclude
// certain banner boxes from displaying.
var banner_box_data = new Array();

function switch_banner(index) {
	var carousel = $('#banner-slider').data('jcarousel');
	carousel.scroll(index + 1, true);
	$('#banner_heading').html(banner_box_data[index].heading);
	$('#banner_description').html(banner_box_data[index].description);
}

function switch_text(index) {
	$('#banner_heading').html(banner_box_data[index].heading);
	$('#banner_description').html(banner_box_data[index].description);
}

// copied from fns.js
// sets hover function on the small images.
function set_banner_hover(a_id, hover_div_id, hover_image_src) {
	var xOffset = 120;
	var yOffset = -64;
	
	// these 2 variable determine popup's distance from the cursor
	// you might want to adjust to get the right result
	/* END CONFIG */
	$("#" + a_id).hover(function(e) {
		$("body").append(
			"<div id='" + hover_div_id + "' style=\"padding-left: 8px; padding-top: 15px; position: absolute; display: none; width: 131px; height: 104px; background: url(" 
			+ pageVar['static_path'] + "/css/images/items-slider-tip.png) no-repeat 0 0; z-index: 111;\">" 
			+ "<img src=\"" + hover_image_src + "\">" 
			+ "</div>"
		);
		$("#" + hover_div_id)
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");		
    },
	function(){
		$("#" + hover_div_id).remove();
    });	
	$("#" + a_id).mousemove(function(e) {
		$("#" + hover_div_id)
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});
};

