var s_amg_CurrFFamilybox=""; //
var o_amg_TimerFFamilybox=null; //

function amg_SetFFamilyBox(oToEl) {
	if (!oToEl) var oToEl=event.srcElement;
	if (oToEl&&oToEl.id&&oToEl.id.substr(0,1)=="%") {
		if (s_amg_CurrFFamilybox) {
			var sFFamilyCode=oToEl.id;
			var sFFamilyNum=sFFamilyCode.substr(0, (sFFamilyCode.length-1)).substr(2);
			var sFFamilyValue="";
			if (arrFFamilyCodes[sFFamilyCode]) {
				sFFamilyValue=arrFFamilyCodes[sFFamilyCode];
			}
			if (sFFamilyValue.length) {
				var oCurrFFamilyBox=document.getElementById(s_amg_CurrFFamilybox);
				if (oCurrFFamilyBox) {
					//oCurrFFamilyBox.value=sFFamilyValue;
					oCurrFFamilyBox.innerHTML=sFFamilyValue.split(",")[0];
					var oHiddBox=document.getElementById(s_amg_CurrFFamilybox+"_code");
					if (oHiddBox) oHiddBox.value=sFFamilyCode;
					amg_HideFFamilyBox();
				}
			}
		}
	}
}

function amg_FixFFamilyBox() {
	if (o_amg_TimerFFamilybox) window.clearTimeout(o_amg_TimerFFamilybox);
	var oToEl=event.toElement;
	if (oToEl&&oToEl.id&&oToEl.id.substr(0,1)=="%") {
		var sFFamilyCode=oToEl.id;
		var sFFamilyNum=sFFamilyCode.substr(0, (sFFamilyCode.length-1)).substr(2);
		var sFFamilyValue=sFFamilyNum;
		//if (arrFFamilyCodes[sFFamilyCode]) {
		//	sFFamilyValue=arrFFamilyCodes[sFFamilyCode];
		//}
	}
}

function amg_HiddFFamilyBox() {
	var oToEl=event.toElement;
	if (!oToEl) {
		amg_HideFFamilyBox();
	} 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_HideFFamilyBox();
			}
		} else {
			amg_HideFFamilyBox();
		}
	}
}

function amg_HideFFamilyBox() {
	s_amg_CurrFFamilybox="";
	var theFFamilyCtrl=document.getElementById("amg_poptab_fontStd");
	if (theFFamilyCtrl) {
		theFFamilyCtrl.style.left=-1000;
		theFFamilyCtrl.style.top=-1000;
		theFFamilyCtrl.style.visibility="hidden";
		if (document.getElementById("amg_poptab_ftr")) document.getElementById("amg_poptab_ftr").innerHTML="";
	}
}

function amg_ShowFFamilyBox(sBoxId) {
	var theFFamilyCtrl=document.getElementById("amg_poptab_fontStd");
	var theBox=document.getElementById(sBoxId);
	if (theFFamilyCtrl&&theBox) {
		s_amg_CurrFFamilybox=sBoxId;
		window.clearTimeout(o_amg_TimerFFamilybox);
		o_amg_TimerFFamilybox=null;
		o_amg_TimerFFamilybox=window.setTimeout("amg_HideFFamilyBox()",1500);
		theFFamilyCtrl.style.left=absLeft(theBox);
		theFFamilyCtrl.style.top=absTop(theBox);//+theBox.offsetHeight;
		if ((parseInt(theFFamilyCtrl.style.top)+theFFamilyCtrl.offsetHeight)>document.body.clientHeight+document.body.scrollTop) {
			theFFamilyCtrl.style.top=absTop(theBox)+theBox.offsetHeight-theFFamilyCtrl.offsetHeight;
		}
		theFFamilyCtrl.style.visibility="visible";
	}
}