nullsrc = "img/blank.gif";
var offsetfromcursorY=20 // y offset of tooltip
var offsetfromcursorX=20 // y offset of tooltip
var ie=document.all && !window.opera;
var ns6=document.getElementById && !document.all;
var tipobj;
		
function tooltip(el,txt) {
	tipobj=document.getElementById('vtip');
	tipobj.innerHTML = txt;
	el.onmousemove=positiontip;
	tipobj.style.display="block";

}

function hide_info(el) {
	document.getElementById('vtip').style.display='none';
	el.onmousemove='';
}

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function positiontip(e) {
	var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
	var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
	var winwidth=ie? ietruebody().clientWidth : window.innerWidth-20
	var winheight=ie? ietruebody().clientHeight : window.innerHeight-20

	var rightedge=ie? winwidth-event.clientX : winwidth-e.clientX;
	var bottomedge=ie? winheight-event.clientY-offsetfromcursorY : winheight-e.clientY-offsetfromcursorY;
	
	topedge = winheight - bottomedge;
	tipwidth = tipobj.offsetWidth;
	tipheight = tipobj.offsetHeight;
	if (rightedge-offsetfromcursorX < tipobj.offsetWidth) tipobj.style.left=curX-tipwidth-offsetfromcursorX+"px";
	else tipobj.style.left=curX+offsetfromcursorX+"px";	
	
	if (bottomedge <= tipheight) {
		Y = curY-offsetfromcursorY-tipheight;
		if (topedge-offsetfromcursorY<=tipheight) {
			tale = tipheight-bottomedge;			
			Y = curY-offsetfromcursorY-tale;
		}
	} else {

		Y = curY+offsetfromcursorY;
	}
	tipobj.style.top=Y+"px";

}

$(document).ready(function(){
$("body").append('<div id="vtip" style="display:none;"><div id="imgholder"></div></div>');
	$(".tipholder").unbind().bind("mouseenter", function(e) {
		tipsrc = $(this).attr('href').replace("-b.jpg","-s.jpg");;
		tooltip(this,'<div id="imgholder" style="background-image:url('+tipsrc+')"></div>');
		}).bind("mouseleave", function() {
		$("#imgholder").css("background-image","url("+nullsrc+")");
		hide_info(this);
	});
});	


