function trimString(str) {
	str = ltrim(str);
	return rtrim(str);
}

function ltrim(str) {
	while(str.charAt(0) == " ") {
		str = str.replace(str.charAt(0), "");
	}
	return str;
}

function rtrim(str) {
	while(str.charAt(str.length-1) == " ") {
		str = str.substring(0, str.length-1);
	}
	return str;
}

function getCheckboxValueList(theFormName) {
	var theForm = document.getElementById(theFormName);
	var result = '';
	if(!theForm) {return result;};
	
	for (i=0; i<theForm.length; i++) {
		if(theForm[i].type == 'checkbox') {
			if(theForm[i].checked){
				if(result.length == 0) {
					result += theForm[i].value;
				}
				else {
					result += ',' + theForm[i].value;
				}
			}
		}
	}
	return result;
}

function getRandomNumber(max){
	if(!max) {
		max = 999999999999; 
	}
    var ranNum= Math.floor(Math.random()*max);
    return ranNum;
}
