function removeChildren(arg) {
	//alert ("arg is "+arg);
	var parent = document.getElementById(arg);
	while(parent.hasChildNodes()) {
		var firstChild = parent.firstChild;
		parent.removeChild(firstChild);
	}
}

function addChild(parent, child_content,classN) {
	spanElement = document.createElement("span");
	spanElement.className = classN;
	textNode = document.createTextNode(child_content);
	spanElement.appendChild(textNode);
	spanElement.value
	parent.appendChild(spanElement);
}

function addOption(parent, child_content) {
	optionElement = document.createElement("option");
	textNode = document.createTextNode(child_content);
	optionElement.setAttribute("value",child_content);
	optionElement.appendChild(textNode);
	parent.appendChild(optionElement);
}

function addtext(what, where){
	if (document.createTextNode){
		var mytext=document.createTextNode(what);
		where.appendChild(mytext);
	}
}

function addBR(parent) {
	brElement = document.createElement('br');
	parent.appendChild(brElement);
}

function replaceText(el, text) {
  if (el != null) {
    clearText(el);
    var newNode = document.createTextNode(text);
    el.appendChild(newNode);
  }
}

function clearText(el) {
  if (el != null) {
    if (el.childNodes) {
      for (var i = 0; i < el.childNodes.length; i++) {
        var childNode = el.childNodes[i];
        el.removeChild(childNode);
      }
    }
  }
}

function getText(el) {
  var text = "";
  if (el != null) {
    if (el.childNodes) {
      for (var i = 0; i < el.childNodes.length; i++) {
        var childNode = el.childNodes[i];
        if (childNode.nodeValue != null) {
          text = text + childNode.nodeValue;
        }
      }
    }
  }
  return text;
}