function filenameCheck(field) {
	var file = document.getElementById(field);
	var error = "There is a problem with the file name.\n\n";
	if (file.value.indexOf("'") != -1) {
		error += 'Please choose a filename that does not contain an apostrophe (\').\n';
	}
	if (file.value.indexOf("\&") != -1) {
		error += 'Please choose a filename that does not contain an ampersand (\&).\n';
	}
	if (error != "There is a problem with the file name.\n\n") {
		alert(error+"\n\n");
		// Use to clear the file field of the bad file name input
		//use browser sniffing to determine if IE or Opera (ugly, but required)
		// IE makes the name field readonly
  		var isOpera, isIE = false;
  		if(typeof(window.opera) != 'undefined'){isOpera = true;}
  		if(!isOpera && navigator.userAgent.indexOf('Internet Explorer')){isIE = true};
		var newFile = null;
		if(!isIE){
			newFile = document.createElement('input');
			newFile.setAttribute('name', field);
		} else {
			newFile = document.createElement('<input name="'+field+'"/>');
		}
		newFile.setAttribute('type', 'file');
		newFile.setAttribute('id', field);
		newFile.setAttribute('name', field);
		newFile.setAttribute('onchange', 'filenameCheck(\''+field+'\')');
		newFile.setAttribute('size', 32);
		var fileParent = file.parentNode;
		while (fileParent.hasChildNodes()) { fileParent.removeChild(fileParent.lastChild) }
		// End Clear File field
		fileParent.appendChild(newFile);
		fileParent.innerHTML = fileParent.innerHTML+"<span id=\"error_"+field+"\" style=\"color:#FF0000;\"><br />Please correct this file's name before uploading it.</span>";
		return false;
	} else {
		if (document.getElementById('error_'+field)) {
			file.parentNode.removeChild(document.getElementById('error_'+field));
		}
		return true;
	}
}