var d = document;
var offsetfromcursorY=15 // y offset of tooltip
var ie=d.all && !window.opera;
var ns6=d.getElementById && !d.all;
var tipobj,op;


function tooltip(el) {
	tipobj=d.getElementById('mess');
	id_tr=el.id;	
	id_tr=id_tr.substring(1, id_tr.length);
	
	tipobj.innerHTML = $j('#tdtooltip'+id_tr).html();//el.tooltip;
	op = 0.1;	
	tipobj.style.opacity = op; 
	tipobj.style.visibility="visible";
	el.onmousemove=positiontip;	
	appear();
}

function hide_info(el) {
	d.getElementById('mess').style.visibility='hidden';
	el.onmousemove='';
	
	//alert($j(el).data("tooltip"));
}

function ietruebody(){
	return (d.compatMode && d.compatMode!="BackCompat")? d.documentElement : d.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;

	if (rightedge < tipobj.offsetWidth)	tipobj.style.left=curX-tipobj.offsetWidth+"px";
	else tipobj.style.left=curX+"px";

	if (bottomedge < tipobj.offsetHeight) tipobj.style.top=curY-tipobj.offsetHeight-offsetfromcursorY+"px"
	else tipobj.style.top=curY+offsetfromcursorY+"px";
	
}

function appear() {	
	if(op < 1) {
		op +=1;
		tipobj.style.opacity = op;
		tipobj.style.filter = 'alpha(opacity='+op*100+')';
		t = setTimeout('appear()', 10);
	}
}

function tdover(num_row){
	var max_x=4;
	for (i=1;i<max_x;i++) {
		//alert('td'+num_row+'_'+i);
		document.getElementById('td'+num_row+'_'+i).style.backgroundColor="#0082a7";
		document.getElementById('td'+num_row+'_'+i).style.color="#fff";
    }
}

function tdout(num_row){
	var max_x=4;
	for (i=1;i<max_x;i++) {
		document.getElementById('td'+num_row+'_'+i).style.backgroundColor="#fff";
		document.getElementById('td'+num_row+'_'+i).style.color="#000";
    }
}


