function showDiv(baliseId)
{
  document.getElementById(baliseId).style.visibility='visible';
  document.getElementById(baliseId).style.display='block';
}

function hideDiv(baliseId)
{
  document.getElementById(baliseId).style.visibility='hidden';
  document.getElementById(baliseId).style.display='none';
}

function af_clearObject(obj) {
	// so long as obj has children, remove them
	while(obj.firstChild) obj.removeChild(obj.firstChild);
}

function af_insertTextarea(id, string) {
  var position;
	var textarea = document.getElementById(id);

	if (typeof textarea.selectionStart != 'undefined' ) {
		position = textarea.selectionStart;
	} else {
  	textarea.focus();
  	var range = textarea.createTextRange();
  	range.moveToBookmark(document.selection.createRange().getBookmark());
  	range.moveEnd('character', textarea.value.length);
  	position = textarea.value.length - range.text.length;
  }

	var text_value = textarea.value;

	var string_start = text_value.substring(0, position);
	var string_end = text_value.substring(position);

	textarea.value = string_start + string + string_end;

	textarea.focus();

	if (textarea.setSelectionRange) {
	  textarea.setSelectionRange(position + string.length, position + string.length);
	}	else {
		if (document.selection) {
  		var range = textarea.createTextRange();
	  	range.moveStart('character', position + string.length);
		  range.moveEnd('character', - textarea.value.length + position + string.length);
		  range.select();
	  }
  }

}