function abotooltip(obj,id){
	var coords = getPageCoords(obj);
	var div = $("abotooltip");
	div.style.left = coords.x+"px";
	div.style.top = coords.y+obj.offsetHeight+"px";
	div.style.display = "block";
	var url = "site_content/scripts/ajax.php?id="+id;
	dorequest(url,div);
}

function hideabotooltip(obj){
	$("abotooltip").style.display = "none";
	$("infotooltip").style.display = "none";
}

function hidetooltip(obj){
	$(obj).style.display = "none";
}

function getPageCoords (element) {
	var coords = {x: 0, y: 0};
	while (element) {
	coords.x += element.offsetLeft;
	coords.y += element.offsetTop;
	element = element.offsetParent;
	}
	return coords;
}

function display(text,div){
	if (text.substr(0,4) == "info"){
		div.innerHTML = text.substr(4);
	}
}

function dorequest(url,passOn){
	var ajaxRequest;
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Request failed");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
		   display(ajaxRequest.responseText,passOn); 
		}
	}
	ajaxRequest.open("GET",url , true);
	ajaxRequest.send(null); 
}	

function mytooltip(obj,text,tooltip){
	var coords = getPageCoords(obj);
	var div = $(tooltip);
	if (tooltip == "bigtooltip") {
		div.style.left = coords.x-30+"px";
		div.style.top = coords.y+obj.offsetHeight-30+"px";
		$("innertooltip").innerHTML = text;
	}
	else {
		if (tooltip == "infotooltip") div.style.left = coords.x-30+"px";
		else div.style.left = coords.x+"px";
		div.style.top = coords.y+obj.offsetHeight+10+"px";
		div.innerHTML = text;
	}
	
	div.style.display = "block";
}


