jQuery().ready(function(){

	jQuery('.viewConsole').click(function() {
        var linkPosition = findPos(this);
        
        var consoleBox = document.getElementById("console_" + this.rel);

        consoleBox.style.top = (linkPosition.top - 180) + "px";
        consoleBox.style.left = (linkPosition.left - 110) + "px";
        consoleBox.style.display = "block";
              
        return false;
	});
	
	jQuery('.consoleBox').click(function() {
	    this.style.display = "none";
	    
	    return false;
	});
});

// code from http://www.quirksmode.org/js/findpos.html
// QuirksMode.org is the personal site of Peter-Paul Koch
function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return {left: curleft,top: curtop};
}