I'm a noob with Javascript, so be kind.

The variable system2 works until the line:
}).done(function( html ) {
After this line, it is using the last entry in the array rather then the proper entry. It is as if the 'for' statement has closed, yet it hasn't. Help?

function searchw(){

	var search = document.getElementById("walks").value;

	var systems = "'.$done4.'";
	var systems = systems.split(";;");

	var systems=cleanArray(systems);

	var length = systems.length;

	var system2;

	for(var i = 0; i < length; i++) {


		url: "userb.php",
		data: { user: "'.$user.'", system: system2, page: 1, sort: 1, search: search},
		cache: false
		}).done(function( html ) {