
function replaceText(argElemID, elValue){
	var el = document.getElementById(argElemID);
	if (el != null) {
		clearText(el);
		var newNode = document.createTextNode(elValue);
		el.appendChild(newNode);
	}
}

function replaceHtml(argElemID, elValue) {
	var el = document.getElementById(argElemID);
	if (el != null) {
		clearText(el);
		el.innerHTML=elValue;
	}
}

function replaceImage(argElemID, elValue){
	var elName = document.getElementById(argElemID);
	elName.src=elValue;
}

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 documentRelocation(el, elValue){
	el.document.location=elValue;
}

function setHidden ( argName ){
	var ojFeature = document.getElementById(argName);
	ojFeature.style.visibility="hidden"; 	
}

function setVisible ( argName ){
	var ojFeature = document.getElementById(argName);
	ojFeature.style.visibility="visible"; 	
}

function setNone ( argName ){
	var ojFeature = document.getElementById(argName);
	ojFeature.style.display="none";
}

function setBlock ( argName ){
	var ojFeature = document.getElementById(argName);
	ojFeature.style.display="block"; 
}

function trim(str) {
		return str.replace(/^\s+|\s+$/g,"");
}

function changeSpecialChar(str){
	str = str.replace(/&/g, "|amp;");
	str = str.replace(/=/g, "|eql;");
	str = str.replace(/'/g, "''");
	return str
}

function addEventHandler(obj, eventName, handler){
	try{
		if(document.attachEvent){
			obj.attachEvent("on" + eventName, handler);
		}else if (document.addEventListener){
			obj.addEventListener(eventName, handler, false);
		}

	}catch(e){
		window.alert ( "addEventHandler :" + e);
	}	
}

function getActivatedObject(e) {
  var obj;
  if (!e) {
    obj = window.event.srcElement;
  } else if (e.srcElement) {
    obj = e.srcElement;
  } else {
    obj = e.target;
  }
  return obj;
}


