var s_amg_CurrFSizebox=""; //
var o_amg_TimerFSizebox=null; //

function amg_SetFSizeBox(oToEl) {
	if (!oToEl) var oToEl=event.srcElement;
	if (oToEl&&oToEl.id&&oToEl.id.substr(0,1)=="%") {
		if (s_amg_CurrFSizebox) {
			var sFSizeCode=oToEl.id;
			var sFSizeNum=sFSizeCode.substr(0, (sFSizeCode.length-1)).substr(2);
			var sFSizeValue="";
			if (arrFSizeCodes[sFSizeCode]) {
				sFSizeValue=arrFSizeCodes[sFSizeCode];
			}
			if (sFSizeValue.length) {
				var oCurrFSizeBox=document.getElementById(s_amg_CurrFSizebox);
				if (oCurrFSizeBox) {
					//oCurrFSizeBox.value=sFSizeValue;
					oCurrFSizeBox.innerHTML=sFSizeValue;
					var oHiddBox=document.getElementById(s_amg_CurrFSizebox+"_code");
					if (oHiddBox) oHiddBox.value=sFSizeCode;
					amg_HideFSizeBox();
				}
			}
		}
	}
}

function amg_FixFSizeBox() {
	if (o_amg_TimerFSizebox) window.clearTimeout(o_amg_TimerFSizebox);
	var oToEl=event.toElement;
	if (oToEl && oToEl.id && oToEl.id.substr(0,1)=="%") {
		var sFSizeCode=oToEl.id;
		var sFSizeNum=sFSizeCode.substr(0, (sFSizeCode.length-1)).substr(2);
		var sFSizeValue=sFSizeNum;
	}
}

function amg_HiddFSizeBox() {
	var oToEl=event.toElement;
	if (!oToEl) {
		amg_HideFSizeBox();
	} 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_HideFSizeBox();
			}
		} else {
			amg_HideFSizeBox();
		}
	}
}

function amg_HideFSizeBox() {
	s_amg_CurrFSizebox="";
	var theFSizeCtrl=document.getElementById("amg_poptab_fsizeStd");
	if (theFSizeCtrl) {
		theFSizeCtrl.style.left=-1000;
		theFSizeCtrl.style.top=-1000;
		theFSizeCtrl.style.visibility="hidden";
		if (document.getElementById("amg_poptab_ftr")) document.getElementById("amg_poptab_ftr").innerHTML="";
	}
}

function amg_ShowFSizeBox(sBoxId) {
	var theFSizeCtrl=document.getElementById("amg_poptab_fsizeStd");
	var theBox=document.getElementById(sBoxId);
	if (theFSizeCtrl&&theBox) {
		s_amg_CurrFSizebox=sBoxId;
		window.clearTimeout(o_amg_TimerFSizebox);
		o_amg_TimerFSizebox=null;
		o_amg_TimerFSizebox=window.setTimeout("amg_HideFSizeBox()",1500);
		theFSizeCtrl.style.left=absLeft(theBox);
		theFSizeCtrl.style.top=absTop(theBox);//+theBox.offsetHeight;
		if ((parseInt(theFSizeCtrl.style.top)+theFSizeCtrl.offsetHeight)>document.body.clientHeight+document.body.scrollTop) {
			theFSizeCtrl.style.top=absTop(theBox)+theBox.offsetHeight-theFSizeCtrl.offsetHeight;
			//theFSizeCtrl.style.top=parseInt(theFSizeCtrl.style.top)-theFSizeCtrl.offsetHeight-theBox.offsetHeight;
		}
		theFSizeCtrl.style.visibility="visible";
	}
}