function ge (id) {
	return document.getElementById (id);
}

function foldOut(id){
	if(ge('fold_'+id).style.display == 'none'){
		document.getElementById('fold_'+id).style.display = 'block';
	}else{
		document.getElementById('fold_'+id).style.display = 'none';
	}
}

function getLeft (e) {
	if (!e) return;
	x		= e.offsetLeft;
	pe	= e.offsetParent;
	while (pe != null) {
		x  += pe.offsetLeft;
		pe	= pe.offsetParent;
	}
	return x;
}

function getTop (e) {
	if (!e) return;
	y		= e.offsetTop;
	pe	= e.offsetParent;
	while (pe != null) {
		y  += pe.offsetTop;
		pe	= pe.offsetParent;
	}
	return y;
}

function addTT (element, text, cls, bottom) {
	var e = ge (element);
	if (!e) return;
	e.onmouseover	= function () { showTT (element, text, cls, bottom); }
	if(bottom != 2){
		e.onmouseout	= function () { hideTT (); }
	}
}

function showTT (element, text, cls, bottom) {
	var e		= ge (element);
	var tt	= ge ('toolTip');
	if (!e || !tt || e.disabled) return;
	tt.style.display	= 'none';
	tt.innerHTML			= text;
	if (bottom == 1) {
		tt.style.left			= getLeft (e) + 'px';
		tt.style.top			= getTop (e) + e.offsetHeight + 2 + 'px';
	}else if(bottom == 2){
		tt.style.left			= getLeft (e) + 'px';
		tt.style.top			= getTop (e) + 2 + 'px';
	} else {
		tt.style.left			= getLeft (e) + e.offsetWidth + 2 + 'px';
		tt.style.top			= getTop (e) + 'px';
	}
	tt.className			= cls ? cls:'';
	tt.style.display	= 'block';
}

function hideTT () {
	e = ge ('toolTip');
	if (e) e.style.display = 'none';
}