var onLink = false;
var onForm = false;
var inForm = false;

function flip (the_ids, c) {
	var b = "";
	var a = the_ids.split(', ');
	for (var j = 0; j < a.length; j++) {
		b = a[j];
		var target_id = window.document.getElementById(b);
		target_id.className = c;
	}
	return (false);
}

function hfl () {				// hide both forms and links
  flip ('GF, PF', 'UMDhide');
  flip ('GL, PL', 'UMDoff');
}

function cloak () {				// hide if not in form or over form or link
  if (!(inForm) && !(onForm) && !(onLink)) {  hfl ();  }
}

function onL (frm) {					// on link
  onLink = true;
  hfl ();
  var g = frm + "L";  var h = frm + "F";
  flip (g, 'UMDon');
  flip (h, 'UMDshow');
}  

function offL (frm) {					// off link
  onLink = false;
  var theTimer = setTimeout("cloak()",7000);
}

function inF (frm) {					// in form
  inForm = true;
}

function outF (frm) {					// out of form
  inForm = false;
  var theTimer = setTimeout("cloak()",7000);
}

function onF (frm) {					// on form
  onForm = true;
}

function offF (frm) {					// off form
  onForm = false;
  var theTimer = setTimeout("cloak()",5000);
}
