
	function appendToSelect(select, value, content) {
	    try{
  	    var opt;
  	    opt = document.createElement("option");
  	    //alert(value);
  	    //alert(content);
  	    opt.value = value;
  	    //opt.appendChild(content);
  	    opt.innerHTML = content;
  	    select.appendChild(opt);
  	  }catch(e){}
	}
	
	function appendToSelect2(select, value, content, selected) {
	    var opt;
	    opt = document.createElement("option");
	    //alert(value);
	    //alert(content);
	    opt.value = value;
	    opt.selected = selected;
	    //opt.appendChild(content);
	    opt.innerHTML = content;
	    select.appendChild(opt);
	}


	function appendGroupToSelect(select, groupName) {
	    var opt;
	    opt = document.createElement("optgroup");
	    //alert(value);
	    //alert(content);
	    opt.label = groupName;
	    //opt.appendChild(content);
	    select.appendChild(opt);
	}
	
	function ltrim(str, chars) {
		chars = chars || "\\s";
		return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
	}
	 
	function rtrim(str, chars) {
		chars = chars || "\\s";
		return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
	}
	
	function trim(str, chars) {
		return ltrim(rtrim(str, chars), chars);
	}
	
	function getFormValue(inputId) {
		var elem = document.getElementById(inputId);
		var val = "";
		if (elem)
			val = elem.value;
		if(val) {
			val = trim(val);
		}
		return val;
	}
	

	function getFormValueNumber(inputId) {

		var val = document.getElementById(inputId).value;

		if (val == null || val == "" || isNaN(val)) {
			val = 0;
		} else {
			val = trim(val);
			val = 1 * val;		
		}
		return val;
	}


	function GetXmlHttpObject() {
		var xmlHttp = null;
		if (window.XMLHttpRequest) { // Mozilla, Safari,...
			xmlHttp = new XMLHttpRequest();
			if (xmlHttp.overrideMimeType) {
				xmlHttp.overrideMimeType('text/xml');
			}
		} else if (window.ActiveXObject) { // IE
			try {
				xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
				try {
					xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (e) {
				}
			}
			//xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		}

		return xmlHttp;
	}
	
	function roundTo2(n){
		units = n * 100;
		units = Math.round(units);
		strUnits = " " + units;
		len = strUnits.length
	}

