/* Scholastic 2008 */

var currId=0;
var oOffset = 20;
var disappeardelay = 500;
var delayhide;
var timer;

jQuery(function() {
	jQuery(".td_Title a").each(function(index){
		jQuery(this).next().attr("id","callout"+index);
		jQuery(this).bind("mouseenter",function() {
			callout(jQuery(this),index);
			return false;
		}).bind("mouseleave",function() {
			delayhidecallout();
		}).bind("click",function() {
			return false;
		}).css("cursor","default");//bind
	});//each
	
	// create callout box
	if (jQuery("#callout").length==0) {
		jQuery("<div></div>").attr("id","callout").addClass("callout").css("display","none").bind("mouseenter",function(){
			clearhidecallout();
		}).bind("mouseleave",function(){
			delayhidecallout();
		}).appendTo("body");
		jQuery("<img>").attr("src","/content/presentation/techsupport/images/callout_top.gif").addClass("border").appendTo("#callout");
		jQuery("<div></div>").attr("id","calloutContent").appendTo("#callout");
		jQuery("<img>").attr("src","/content/presentation/techsupport/images/callout_btm.gif").addClass("border").appendTo("#callout");
	}
});


function callout(o, index) {
	currId=index;
	if (timer) clearTimeout(timer);
	timer = setTimeout(function(){

		var obj = document.getElementById("callout");
		var curobj = o;

		var offsett=jQuery(o).offset();
		var tempTop = offsett.top+jQuery(o).height()/2;
//		alert(tempTop);
		var tempLeft = offsett.left+oOffset;

//alert(tempTop+';'+tempLeft);
		
		obj.style.display = "block";
		obj.style.top = tempTop + "px";	
		obj.style.left = tempLeft + "px";
		jQuery("#calloutContent").html(jQuery("#callout"+index).html());
	}, 500);
}

function delayhidecallout(){
	clearTimeout(timer);
	delayhide=setTimeout("hidecallout()",disappeardelay);
}
function hidecallout(){
	if(document.getElementById("callout")) 
		document.getElementById("callout").style.display = "none";	
}
function clearhidecallout(){
	if ( typeof delayhide != "undefined" ) clearTimeout(delayhide);
}

