// JavaScript Document

function Replace(stringval, val1,val2){
    //removes all instances of a single character from a string
    var CanContinue = true;
    var pos = -1;
    if (stringval.length > 0){
        while (CanContinue == true){
            pos = stringval.indexOf(val1, pos+1);
            if (pos == -1) CanContinue = false;
            if (CanContinue == true){
                stringval = stringval.substring(0,pos)+val2+stringval.substring(pos+val1.length);
            }
        }
    }
    return stringval;
}

function RetCaps(option, val){
	//sets caps for text form values
	//     option of "FirstChar" returns the first character capitalized
	//     option of "AllFirstChars" returns the first characters of every word capitalized
	//     option of "Entire" returns the entire string capitalized
	var CanContinue = true;
	var pos = -1;
	var retval = "";
	if (val.length > 0){
		while (CanContinue == true){
			if (option == "Entire"){
				retval = val.toUpperCase();
			}else{
				retval = val.substring(0,pos+1)+val.substring(pos+1,pos+2).toUpperCase()+val.substring(pos+2);
			}
			pos = val.indexOf(" ", pos+1);
			if (pos == -1 || option == "FirstChar" || option == "Entire") CanContinue = false;
		}
	}
	return retval;
}