
function updatePlateQS(string) {
	// set variables.
	var replace_this = " ";
	var with_this  = "_";
	var output = "";
	var valid = "0123456789abcdefghijklmnoprstuvwxyzABCDEFGHIJKLMNOPRSTUVWXYZ\ ";
	var baseSrc = "images/plates/quickSearch/char";
	var platePositions = 8;
	var normalWidth = 25;
	var thinWidth = 8;
	var spaceWidth = 4;
	var spaceUsed = 0;
	// ----------------------------------------------
	// check validity.
	// ----------------------------------------------
	for (i=0; i<string.length; ++i) {
		if (valid.indexOf(string.charAt(i)) != -1) {
			output += string.charAt(i);
		} 	
	}
	// ----------------------------------------------
	// replace spaces so src has a target. 
	// ----------------------------------------------
	output = output.split(replace_this).join(with_this);
	// ----------------------------------------------
	// update plate graphics + set width.
	// ----------------------------------------------	
	function display(z){
		for (i=1; i<= platePositions; ++i) {
			y = output.charAt(i-1);
			if (i<= z) {

				if (y == 1 || y == "i") {
					src = baseSrc + y.toUpperCase() + ".gif";
					document.getElementById("blank"+i).src = src;
					document.getElementById("blank"+i).width = thinWidth;
				}else if ( y == "_") {
					src = baseSrc + y.toUpperCase() + ".gif";
					document.getElementById("blank"+i).src = src;
					document.getElementById("blank"+i).width = spaceWidth;
					spaceUsed = 1;
				}else if (i == 8 && spaceUsed == 0) {
				} else {
					src = baseSrc + y.toUpperCase() + ".gif";
					document.getElementById("blank"+i).src = src;
					document.getElementById("blank"+i).width = normalWidth;
				}				
				
			} else if (i<= platePositions) {
				src = baseSrc + "_.gif";
				document.getElementById("blank"+i).src = src;
				document.getElementById("blank"+i).width = 1;	
			}
		}
	}
	// call function.
	for (i=1; i<= platePositions; ++i) {
		if (output.length == i) {
			display(i);		
		}
	}
	// ----------------------------------------------
	// replace spaces ready for search cgi. 
	// ----------------------------------------------
	output = output.split(with_this).join(replace_this);
	// ----------------------------------------------
	// update search box.
	// ----------------------------------------------
	return output;
}
