var oneStepMode = false;

function getPrevOptionsString(step, SelectPrefix) {
	var options = "0";
	for (var i = 1; i < step; i++)
		if ($(SelectPrefix + i) != null)
			options += "," + $(SelectPrefix + i).options[$(SelectPrefix + i).selectedIndex].value;
		else
			options += ",0";
	return options;
}

function stepOptionSelected(step) {
	if (oneStepMode)
		return;

	var nextStep = step + 1;

	if ($("Options" + step).selectedIndex > 0) {
		var options = getPrevOptionsString(nextStep, "Options");

		var req = new Request.HTML({
			url: "get-next-step.jsp?tmp=" + Math.random(),
			data : {
				SelectedOptionID : $("Options" + step).options[$("Options" + step).selectedIndex].value,
				SelectedOptionIDs : options
			}, 
			onSuccess: function(html, responseElements, responseHTML, responseJavaScript) {
				$("areaStep" + nextStep).set('html', responseHTML);
// this doesn't work in IE, because of unknown reason... select.onchange is not called.
//				$("areaStep" + nextStep).set('text', '');
//				$("areaStep" + nextStep).adopt(html);
			}
		}).send();
		
	}
	else
		$("areaStep" + nextStep).set('text', '');
}

