// $Header: /commerce/stores.net/buynokia/assets/local/js/productselectorui.js,v 1.1 2007/06/22 20:08:26 ALiu Exp $
function drawWizardTree(tree)
{
	writeHtml("<div class=\"wizard\">");
	var wizardTag = getAttributeValue(tree, "wizardTag", "");
	var prompts = selectNodes(tree, "Prompt");
	for (var i = 0; i < prompts.length; i++)
	{
		drawWizardPrompt(wizardTag, prompts[i], i+1);
	}
	writeHtml("</div>");
}

function drawWizardPrompt(wizardTag, prompt, index)
{
	writeHtml("<div class=\"wizardlabel" + index + "\">");
	writeHtml(getAttributeValue(prompt, "label", null));
	writeHtml("</div>");
	writeHtml("<div class=\"wizarddropdown" + index + "\">");
	writeHtml("<select name=\""+getChoiceName()+"\" onchange=\"wizardSelected('"+wizardTag+"', this)\">");
	var choices = selectNodes(prompt, "Choice");
	for (var i = 0; i < choices.length; i++)
	{
		drawWizardChoice(wizardTag, choices[i]);
	}
	writeHtml("</select>");
	writeHtml("</div>");
}
function drawWizardChoice(wizardTag, choice)
{
	var selected = (getAttributeValue(choice, "selected", "0") == "1");
	writeHtml("<option value=\""+getAttributeValue(choice, "lineage", null)+"\" ");
	if (selected)
		writeHtml("selected");
	writeHtml(">"+getAttributeValue(choice, "action", null)+"</option>");
}


