//<script>

var wObj	= document.forms["quickBuyForm"];
var s1Obj	= wObj.elements["qb_select1"];
var s2Obj	= wObj.elements["qb_select2"];

function emptySelect(nr) {
	wObj.elements["qb_select"+nr].options.length = 0;
}

function initWizard() {

	emptySelect(1);
	emptySelect(2);

	//1
	var t1Obj = new Object();
	t1Obj = document.createElement("option");
	t1Obj.text	= transSelectCurriculum;
	t1Obj.value	= "select";
	if (isIE) s1Obj.add(t1Obj); else s1Obj.add(t1Obj,null);
	
	//2
	var t2Obj = new Object();
	t2Obj = document.createElement("option");
	t2Obj.text	= transSelectCategory;
	t2Obj.value	= "select";
	if (isIE) s2Obj.add(t2Obj); else s2Obj.add(t2Obj,null);
	
	var oObj	= new Object();
	
	for (var i=0; i < quickbuy.length; i++) {
		oObj = document.createElement("option");
		oObj.text = quickbuy[i][0];
		if (isIE) s1Obj.add(oObj); else s1Obj.add(oObj,null);
	}
	
	//dont show the 2nd dropdown box items at the initial stage	
	/*
	for (var i=1; i < quickbuy[0].length; i++) {
		oObj = document.createElement("option");
		oObj.text	= quickbuy[0][i][0];
		oObj.value	= quickbuy[0][i][1];
		if (isIE) s2Obj.add(oObj); else s2Obj.add(oObj,null);
	}
	*/
	
	s2Obj.selectedIndex = 0;
}


function changeWizard() {

	if (s1Obj.options[s1Obj.selectedIndex].value == "select") {		
		//empty 2nd dropdown box
		emptySelect(2);
		var t2Obj = new Object();
		t2Obj = document.createElement("option");
		t2Obj.text	= transSelectCategory;
		t2Obj.value	= "select";
		if (isIE) s2Obj.add(t2Obj); else s2Obj.add(t2Obj,null);
		return false;
	}

	emptySelect(2);
	var oObj	= new Object();
	var t2Obj = new Object();
	t2Obj = document.createElement("option");
	t2Obj.text	= transSelectCategory;
	t2Obj.value	= "select";
	if (isIE) s2Obj.add(t2Obj); else s2Obj.add(t2Obj,null);
		
	for (var i=1; i < quickbuy[s1Obj.selectedIndex-1].length; i++) {
		oObj = document.createElement("option");
		oObj.text	= quickbuy[s1Obj.selectedIndex-1][i][0];
		oObj.value	= quickbuy[s1Obj.selectedIndex-1][i][1];
		if (isIE) s2Obj.add(oObj); else s2Obj.add(oObj,null);
	}
	s2Obj.selectedIndex = 0;
}


function goWizard(loading) {
	if (loading) {
		document.getElementById("quickbuyIntroText").innerHTML = loading + "...";
	}
	if(s2Obj.options[s2Obj.selectedIndex].value == "select") {
		alert(transMakeCategorySelection);
		return false;
	} else {
		location.href = s2Obj.options[s2Obj.selectedIndex].value;
		return false;
	}
}

initWizard();

//</script>