var s_amg_CurrTTransbox=""; //
var o_amg_TimerTTransbox=null; //

function amg_SetTTransBox(oToEl) {
	if (!oToEl) var oToEl=event.srcElement;
	if (oToEl && oToEl.id && oToEl.id.substr(0,1)=="%") {
		if (s_amg_CurrTTransbox) {
			var sTTransCode=oToEl.id;
			var sTTransValue=sTTransCode.substr(0, (sTTransCode.length-1)).substr(2);
			if (sTTransValue.length) {
				var oCurrTTransBox=document.getElementById(s_amg_CurrTTransbox+"_code");
				if (oCurrTTransBox) {
					oCurrTTransBox.value=sTTransValue;
					amg_HideTTransBox();
				}
			}
		}
	}
}

function amg_FixTTransBox() {
	if (o_amg_TimerTTransbox) window.clearTimeout(o_amg_TimerTTransbox);
	var oToEl=event.toElement;
	if (oToEl && oToEl.id && oToEl.id.substr(0,1)=="%") {
		var sTTransCode=oToEl.id;
		var sTTransValue=sTTransCode.substr(0, (sTTransCode.length-1)).substr(2);
	}
}

function amg_HiddTTransBox() {
	var oToEl=event.toElement;
	if (!oToEl) {
		amg_HideTTransBox();
	} else {
		var sToEl=oToEl.id;
		var sToElPar="";
		var oToElPar=oToEl.parentElement;
		if (oToElPar) sToElPar=oToElPar.id;
		if (sToEl || sToElPar) {
			if ((sToEl.substr(0,11)!="amg_poptab_")&&(sToElPar.substr(0,11)!="amg_poptab_")) {
				amg_HideTTransBox();
			}
		} else {
			amg_HideTTransBox();
		}
	}
}

function amg_HideTTransBox() {
	s_amg_CurrTTransbox="";
	var theTTransCtrl=document.getElementById("amg_poptab_ttransStd");
	if (theTTransCtrl) {
		theTTransCtrl.style.left=-1000;
		theTTransCtrl.style.top=-1000;
		theTTransCtrl.style.visibility="hidden";
	}
}

function amg_ShowTTransBox(sBoxId) {
	var theTTransCtrl=document.getElementById("amg_poptab_ttransStd");
	var theBox=document.getElementById(sBoxId+"_code");
	if (theTTransCtrl && theBox) {
		s_amg_CurrTTransbox=sBoxId;
		window.clearTimeout(o_amg_TimerTTransbox);
		o_amg_TimerTTransbox=null;
		o_amg_TimerTTransbox=window.setTimeout("amg_HideTTransBox()", 1500);
		theTTransCtrl.style.left=absLeft(theBox);
		theTTransCtrl.style.top=absTop(theBox);//+theBox.offsetHeight;
		if ((parseInt(theTTransCtrl.style.top)+theTTransCtrl.offsetHeight)>document.body.clientHeight+document.body.scrollTop) {
			theTTransCtrl.style.top=absTop(theBox)+theBox.offsetHeight-theTTransCtrl.offsetHeight;
		}
		while (parseInt(theTTransCtrl.style.top)<0) {
			theTTransCtrl.style.top=parseInt(theTTransCtrl.style.top)+8;
		}
		theTTransCtrl.style.visibility="visible";
	}
}