var courseFinder_select = new Object();
courseFinder_select["option"] = new Array();
courseFinder_select["option"][0] = "Angielski";
courseFinder_select["option"][1] = "Hiszpański";
courseFinder_select["option"][2] = "Niemiecki";
courseFinder_select["option"][3] = "Włoski";
courseFinder_select["option"][4] = "Francuski";
courseFinder_select["option"][5] = "Chiński";
courseFinder_select["option"][6] = "Arabski";
courseFinder_select["select2"] = new Array();
courseFinder_select["select2"][0] = new Object();
courseFinder_select["select2"][0]["option"] = new Array();
courseFinder_select["select2"][0]["option"][0] = "Anglia";
courseFinder_select["select2"][0]["option"][1] = "Malta";
courseFinder_select["select2"][0]["option"][2] = "Kanada";
courseFinder_select["select2"][0]["option"][3] = "USA";
courseFinder_select["select2"][0]["option"][4] = "Australia";
courseFinder_select["select2"][0]["option"][5] = "Hiszpania";
courseFinder_select["select2"][0]["select3"] = new Array();
courseFinder_select["select2"][0]["select3"][0] = new Object();
courseFinder_select["select2"][0]["select3"][0]["option"] = new Array();
courseFinder_select["select2"][0]["select3"][0]["option"][0] = "Brighton";
courseFinder_select["select2"][0]["select3"][0]["option"][1] = "Brighton U20";
courseFinder_select["select2"][0]["select3"][0]["option"][2] = "Londyn";
courseFinder_select["select2"][0]["select3"][0]["option"][3] = "Londyn U20";
courseFinder_select["select2"][0]["select3"][0]["option"][4] = "Devon";
courseFinder_select["select2"][0]["select3"][0]["option"][5] = "Devon U20";
courseFinder_select["select2"][0]["select3"][1] = new Object();
courseFinder_select["select2"][0]["select3"][1]["option"] = new Array();
courseFinder_select["select2"][0]["select3"][1]["option"][0] = "St. Julian's";
courseFinder_select["select2"][0]["select3"][1]["option"][1] = "St. Julian's U20";
courseFinder_select["select2"][0]["select3"][1]["option"][2] = "St. Paul's Bay";
courseFinder_select["select2"][0]["select3"][1]["option"][3] = "St. Paul's Bay U20";
courseFinder_select["select2"][0]["select3"][2] = new Object();
courseFinder_select["select2"][0]["select3"][2]["option"] = new Array();
courseFinder_select["select2"][0]["select3"][2]["option"][0] = "Toronto";
courseFinder_select["select2"][0]["select3"][2]["option"][1] = "Toronto U20";
courseFinder_select["select2"][0]["select3"][2]["option"][2] = "Calgary";
courseFinder_select["select2"][0]["select3"][2]["option"][3] = "Montreal";
courseFinder_select["select2"][0]["select3"][2]["option"][4] = "Montreal U20";
courseFinder_select["select2"][0]["select3"][2]["option"][5] = "Vancouver";
courseFinder_select["select2"][0]["select3"][2]["option"][6] = "Victoria";
courseFinder_select["select2"][0]["select3"][2]["option"][7] = "Ottawa";
courseFinder_select["select2"][0]["select3"][3] = new Object();
courseFinder_select["select2"][0]["select3"][3]["option"] = new Array();
courseFinder_select["select2"][0]["select3"][3]["option"][0] = "Nowy Jork";
courseFinder_select["select2"][0]["select3"][3]["option"][1] = "Nowy Jork U20";
courseFinder_select["select2"][0]["select3"][3]["option"][2] = "Los Angeles";
courseFinder_select["select2"][0]["select3"][3]["option"][3] = "Orange County";
courseFinder_select["select2"][0]["select3"][3]["option"][4] = "Orange County U20";
courseFinder_select["select2"][0]["select3"][3]["option"][5] = "Boston";
courseFinder_select["select2"][0]["select3"][3]["option"][6] = "Boston U20";
courseFinder_select["select2"][0]["select3"][3]["option"][7] = "San Francisco";
courseFinder_select["select2"][0]["select3"][3]["option"][8] = "Miami";
courseFinder_select["select2"][0]["select3"][4] = new Object();
courseFinder_select["select2"][0]["select3"][4]["option"] = new Array();
courseFinder_select["select2"][0]["select3"][4]["option"][0] = "Sydney";
courseFinder_select["select2"][0]["select3"][5] = new Object();
courseFinder_select["select2"][0]["select3"][5]["option"] = new Array();
courseFinder_select["select2"][0]["select3"][5]["option"][0] = "Majorka";
courseFinder_select["select2"][1] = new Object();
courseFinder_select["select2"][1]["option"] = new Array();
courseFinder_select["select2"][1]["option"][0] = "Hiszpania";
courseFinder_select["select2"][1]["option"][1] = "Kuba";
courseFinder_select["select2"][1]["option"][2] = "Meksyk";
courseFinder_select["select2"][1]["select3"] = new Array();
courseFinder_select["select2"][1]["select3"][0] = new Object();
courseFinder_select["select2"][1]["select3"][0]["option"] = new Array();
courseFinder_select["select2"][1]["select3"][0]["option"][0] = "Barcelona";
courseFinder_select["select2"][1]["select3"][0]["option"][1] = "Barcelona U20";
courseFinder_select["select2"][1]["select3"][0]["option"][2] = "Madryt";
courseFinder_select["select2"][1]["select3"][0]["option"][3] = "Malaga";
courseFinder_select["select2"][1]["select3"][0]["option"][4] = "Malaga U20";
courseFinder_select["select2"][1]["select3"][0]["option"][5] = "Majorka";
courseFinder_select["select2"][1]["select3"][1] = new Object();
courseFinder_select["select2"][1]["select3"][1]["option"] = new Array();
courseFinder_select["select2"][1]["select3"][1]["option"][0] = "Hawana";
courseFinder_select["select2"][1]["select3"][2] = new Object();
courseFinder_select["select2"][1]["select3"][2]["option"] = new Array();
courseFinder_select["select2"][1]["select3"][2]["option"][0] = "Playa del Carmen";
courseFinder_select["select2"][1]["select3"][2]["option"][1] = "Playa del Carmen U20";
courseFinder_select["select2"][2] = new Object();
courseFinder_select["select2"][2]["option"] = new Array();
courseFinder_select["select2"][2]["option"][0] = "Niemcy";
courseFinder_select["select2"][2]["select3"] = new Array();
courseFinder_select["select2"][2]["select3"][0] = new Object();
courseFinder_select["select2"][2]["select3"][0]["option"] = new Array();
courseFinder_select["select2"][2]["select3"][0]["option"][0] = "Frankfurt";
courseFinder_select["select2"][2]["select3"][0]["option"][1] = "Frankfurt U20";
courseFinder_select["select2"][2]["select3"][0]["option"][2] = "Düsseldorf";
courseFinder_select["select2"][2]["select3"][0]["option"][3] = "Oberwesel U20";
courseFinder_select["select2"][3] = new Object();
courseFinder_select["select2"][3]["option"] = new Array();
courseFinder_select["select2"][3]["option"][0] = "Włochy";
courseFinder_select["select2"][3]["select3"] = new Array();
courseFinder_select["select2"][3]["select3"][0] = new Object();
courseFinder_select["select2"][3]["select3"][0]["option"] = new Array();
courseFinder_select["select2"][3]["select3"][0]["option"][0] = "Rzym";
courseFinder_select["select2"][3]["select3"][0]["option"][1] = "Rzym U20";
courseFinder_select["select2"][3]["select3"][0]["option"][2] = "Florencja";
courseFinder_select["select2"][3]["select3"][0]["option"][3] = "Kalabria";
courseFinder_select["select2"][4] = new Object();
courseFinder_select["select2"][4]["option"] = new Array();
courseFinder_select["select2"][4]["option"][0] = "Francja";
courseFinder_select["select2"][4]["select3"] = new Array();
courseFinder_select["select2"][4]["select3"][0] = new Object();
courseFinder_select["select2"][4]["select3"][0]["option"] = new Array();
courseFinder_select["select2"][4]["select3"][0]["option"][0] = "Paryż";
courseFinder_select["select2"][4]["select3"][0]["option"][1] = "Paryż U20";
courseFinder_select["select2"][4]["select3"][0]["option"][2] = "Nicea";
courseFinder_select["select2"][4]["select3"][0]["option"][3] = "Nicea U20";
courseFinder_select["select2"][5] = new Object();
courseFinder_select["select2"][5]["option"] = new Array();
courseFinder_select["select2"][5]["option"][0] = "Chiny";
courseFinder_select["select2"][5]["select3"] = new Array();
courseFinder_select["select2"][5]["select3"][0] = new Object();
courseFinder_select["select2"][5]["select3"][0]["option"] = new Array();
courseFinder_select["select2"][5]["select3"][0]["option"][0] = "Pekin";
courseFinder_select["select2"][5]["select3"][0]["option"][1] = "Pekin U20";
courseFinder_select["select2"][6] = new Object();
courseFinder_select["select2"][6]["option"] = new Array();
courseFinder_select["select2"][6]["option"][0] = "Moroko";
courseFinder_select["select2"][6]["select3"] = new Array();
courseFinder_select["select2"][6]["select3"][0] = new Object();
courseFinder_select["select2"][6]["select3"][0]["option"] = new Array();
courseFinder_select["select2"][6]["select3"][0]["option"][0] = "Rabat";


			function courseFinder_updateSelects(lev, textLev2, textLev3)
			{
				var sel1 = document.getElementById('sel1');
				var sel2 = document.getElementById('sel2');
				var sel3 = document.getElementById('sel3');
				
				document.getElementById('cf-submit').disabled = true;
				
				if (sel1.length > 0) {
					var selectedValue1 = sel1.options[sel1.selectedIndex].value;
				}
				if (sel2.length > 0) {
					var selectedValue2 = sel2.options[sel2.selectedIndex].value;
				}
				if (sel3.length > 0) {
					var selectedValue3 = sel3.options[sel3.selectedIndex].value;
				}
				
				if (lev == 1) {
					if (selectedValue1 == 999) {
						courseFinder_removeOptions(sel2);
						courseFinder_removeOptions(sel3);
						return;
					}
					else {
						optionsSel2 = courseFinder_select["select2"][selectedValue1]["option"];
	
						courseFinder_removeOptions(sel2);
						courseFinder_removeOptions(sel3);
						courseFinder_addOptions(sel2, optionsSel2, textLev2);
					}
				}
				
				if (lev == 2) {
					if (selectedValue2 == 999) {
						courseFinder_removeOptions(sel3);
						return;
					}
					else {				
						optionsSel3 = courseFinder_select["select2"][selectedValue1]["select3"][selectedValue2]["option"]; 
	
						courseFinder_removeOptions(sel3);
						courseFinder_addOptions(sel3, optionsSel3, textLev3);
					}
				}
			}
			
			function courseFinder_removeOptions(elSel)
			{
			  var i;
			  for (i = elSel.length - 1; i>=0; i--) {
			      elSel.remove(i);
			  }
			  elSel.disabled = true;
			}
			
			function courseFinder_addOptions(elSel, aOpt, chooseText)
			{
			  var i;
			  
			  var elOptNew = document.createElement('option');
			  elOptNew.text = chooseText;
			  elOptNew.value = 999;
			  elOptNew.style.display = "none";
			
			  try {
			    elSel.add(elOptNew, null); // standards compliant; doesn't work in IE
			  }
			  catch(ex) {
			    elSel.add(elOptNew); // IE only
			  }			  
			  
			  for (i=0; i<aOpt.length; i++) {
				  var elOptNew = document.createElement('option');
				  elOptNew.text = aOpt[i];
				  elOptNew.value = i;
				
				  try {
				    elSel.add(elOptNew, null); // standards compliant; doesn't work in IE
				  }
				  catch(ex) {
				    elSel.add(elOptNew); // IE only
				  }
			  }
			  
			  elSel.disabled = false;
			}
