// 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 SetCaps(option, retval, fieldname){
	//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;
	if (retval.length > 0){
		while (CanContinue == true){
			if (option == "Entire"){
				retval = retval.toUpperCase();
			}else{
				retval = retval.substring(0,pos+1)+retval.substring(pos+1,pos+2).toUpperCase()+retval.substring(pos+2);
			}
			pos = retval.indexOf(" ", pos+1);
			if (pos == -1 || option == "FirstChar" || option == "Entire") CanContinue = false;
		}
	}
	document.forms[0].elements[fieldname].value = retval;
}

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;
}

function SetCaps_Old(option, retval, fieldname){
	//sets caps for text form values
	retval = RetCaps(option, retval);
	if (retval.length > 0) document.forms[0].elements[fieldname].value = retval;
}

function WriteTodayDate(){
    // ***********************************************
    // AUTHOR: WWW.CGISCRIPT.NET, LLC
    // URL: http://www.cgiscript.net
    // Use the script, just leave this message intact.
    // Download your FREE CGI/Perl Scripts today!
    // ( http://www.cgiscript.net/scripts.htm )
    // ***********************************************
    var now = new Date();
    var days = new Array(
    'Sunday','Monday','Tuesday',
    'Wednesday','Thursday','Friday','Saturday');
    var months = new Array(
    'January','February','March','April','May',
    'June','July','August','September','October',
    'November','December');
    var date = ((now.getDate()<10) ? "0" : "")+ now.getDate();
    function fourdigits(number)	{
      return (number < 1000) ? number + 1900 : number;}
    today =  days[now.getDay()] + ", " +
    months[now.getMonth()] + " " +
    date + ", " +
      (fourdigits(now.getYear()));
    document.write(today);
}