var toId=0;
var cDiv=null;

function mTab(oTab) {
    if (cDiv!=null) {
    	closeTab(cDiv);
    }
    clearTimeout(toId);
    var tabnum = parseInt(oTab.id.substr(2,2));
	var tabId = 't'+oTab.id;
	var aId = 'ab'+tabnum;
	var parent = document.getElementById(aId);
	cDiv = document.getElementById(tabId);	
	//var top = parseInt(parent.offsetTop) + parseInt(parent.height) + parseInt(cDiv.style.top);
	//var left = parseInt(parent.offsetLeft) + parseInt(cDiv.style.left);
	cDiv.style.display = 'block';
	var aPos = getPosition(oTab);
	if (tabnum == 25 || tabnum == 26){cDiv.style.left = (aPos[0] + 263)+'px';}else{cDiv.style.left = (aPos[0] + 28)+'px';}
	cDiv.style.top = (aPos[1] - 5)+'px';
	//cDiv.style.left = (aPos[0] - 30)+'px';
}

function moTab(oTab) {
    var tabnum = parseInt(oTab.id.substr(2,1));

	toId = setTimeout(closeTab,500);
}

function overTab() {
	clearTimeout(toId);
}

function timeoutTab() {
	toId = setTimeout(closeTab,1000)
}

function closeTab() {
	cDiv.style.display = 'none';
}

function tabClick(objA) {
	if (cDiv!=null) {
    	closeTab(cDiv);
    }
	//alert('Replace me with document.location='+objA.id+'.html');
	return false;
}

function getPosition(who){
    var T= 0,L= 0;
    while(who){
        L+= who.offsetLeft;
        T+= who.offsetTop;
        who= who.offsetParent;
    }
    return [L,T];    
}
