// Name		    openWindow//// Description	Function to open small browser window with no chrome.//// Parameters	url   	The destination URL//              name   	The name of the window//// Returns	    Window  Handle to the opened window//function openWindow(url, name) {  var options = "toolbar=yes,location=no,directories=no,status=no,menubar=yes," +								"scrollbars=yes,resizable=yes";  return window.open(url, name ,options);} // openWindow// Name		    openSizedWindow//// Description	Function to open a new browser window with no chrome to a given size.//// Parameters	url   	The destination URL//              name   	The name of the window//// Returns	    Window  Handle to the opened window//function openSizedWindow(url, name, sizeX, sizeY) {  var options = "toolbar=no,location=no,directories=no,status=no,menubar=no," +  				"scrollbars=yes,resizable=yes,width="+sizeX+",height="+sizeY;  return window.open(url, name, options);} // openSizedWindow// Name		    trim//// Description	Function to strip beginning and trailing blanks from a string.//// Parameters	inString   The string to strip//// Returns	    String     Original string minus beginning and trailing spaces//function trim(inString) {  var retVal = "";  var start = 0;  while ((start < inString.length) && (inString.charAt(start) == ' ')) {    ++start;  }  var end = inString.length;  while ((end > 0) && (inString.charAt(end - 1) == ' ')) {    --end;  }		if(start < end) retVal = inString.substring(start, end);	  return retVal;} // trim// Name		    total_amount//// Description	Adds up the values of a list of numeric fields and places//		        total in the first field.  Works with integers and floats.//// Parameters	total_field     The field to place the total in//              sum_fields      List of fields to sum//// Returns	    true/false      Success of operation//function total_amount(total_field) // variable length parameter list{    var total = 0.0;    var value = 0.0;    // Loop through arguments 2 and on summing them    //    for (var i = 1; i < total_amount.arguments.length; i++) {        // Attemp to extract floating point value from field        //        value = parseFloat(total_amount.arguments[i].value);        // If a float value was extracted then add it on        //        if (!(isNaN(value)))            total += value;                } // end for    // Assign total value back to total field and return successful    //	total_field.value = total;	return true;	} // total_amount// Name		    imageBrowser//// Description	Allows image browsing/selection/uploading/deletion. //				A "browse" button can be put in a form that allows the user to//				locate an image on their computer, upload it, and select it...//				having its name be put into a text field on the form.//              // Requirements The files image_browse.tpl, image_preview.tpl, and image_upload.tpl must be present.//              The uploadPath must contain a file named ".upload" to allow uploading.//// Parameters	returnForm     The name of the form containing the textfield to populate. //              returnField    The field to populate with the image name.//              uploadPath     The path to upload the image to.  Path MUST be relative to the //                             location of the image_ utility files (or absolute).//              utilityPath    The path to the image_ utility files. Path MUST be relative to the //                             location of THIS file (or absolute).//// Returns	    true/false      Success of operation//function imageBrowser(returnForm, returnField, uploadPath, utilityPath) {	if( uploadPath.length > 0) {		if (uploadPath.charAt(uploadPath.length - 1) != '/') {			uploadPath = uploadPath + '/';		}	}		if( utilityPath.length > 0) {		if (utilityPath.charAt(utilityPath.length - 1) != '/') {			utilityPath = utilityPath + '/';		}	}	popwin = openSizedWindow( utilityPath + 'image_browse.tpl?returnform=' +returnForm+ '&returnfield=' +returnField+ '&uploadPath=' +uploadPath, 'browseWin', 525, 500);	} // browseImage