//Begin Refresh Page
var sURL = unescape(window.location.pathname);

function refresh()
{
    window.location.href = sURL;
}
//End Refresh Page

//Begin the "trim" function
function trim(inputString) {
   // Removes leading and trailing spaces from the passed string. Also removes
   // consecutive spaces and replaces it with one space. If something besides
   // a string is passed in (null, custom object, etc.) then return the input.
   if (typeof inputString != "string") { return inputString; }
   var retValue = inputString;
   var ch = retValue.substring(0, 1);
   while (ch == " ") { // Check for spaces at the beginning of the string
      retValue = retValue.substring(1, retValue.length);
      ch = retValue.substring(0, 1);
   }
   ch = retValue.substring(retValue.length-1, retValue.length);
   while (ch == " ") { // Check for spaces at the end of the string
      retValue = retValue.substring(0, retValue.length-1);
      ch = retValue.substring(retValue.length-1, retValue.length);
   }
   while (retValue.indexOf("  ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string
      retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings
   }
   return retValue; // Return the trimmed string back to the user
}
// Ends the "trim" function

/*
	Begin the "chkyes" function
	This function takes the length(amount) of radio buttons:
	If the radio button is yes it checks the corresponding field for null and returns true or false
*/ 
function chkyes(safetlength, docfname, docfield){
	x = safetlength;
	dn = docfname;
	df = docfield
	for (i=0; i < x; i++){
		if (dn[i].checked){
			if ((dn[i].value == "Yes") && (df =="")){
				safety = 1;
	  		}
			else
				safety = 0;
		}
	}
	return safety;
}
// Ends the "chkyes" function

function estimator() {
	var newest = window.open('estimator.html','estwin','width=240,height=215,menubar=no,scrollbar=no');
	newest.moveTo(360,250);
}