function getSub(field,depth) {
	selectedOption = field.options.selectedIndex;
	subCat = field.options[selectedOption].value;
	if (subCat > 0) { 
		updateCat(subCat,depth); 
	} else {
		if (depth == 'sub') {
			$('select2').disabled = true;
			$('select2').selectedIndex = 0;
			$('select3').disabled = true;
			$('select3').selectedIndex = 0;
		}
		
		if (depth == 'sub2') {
			$('select3').disabled = true;
			$('select3').selectedIndex = 0;
		}
		
		$('submit').disabled = true;
	}
	
	
}

function allowSubmit() {
	field = $F('select3');
	if (field != "") {
		$('submit').disabled = false;
	} else {
		$('submit').disabled = true;
	}
}


var ajax;

function updateCat(subCat,div) {
$(div).innerHTML = "loading...";

ajax =  new Ajax.Updater(
         div,        					// DIV id must be declared before the method was called
         '/bmw/registration?subCat='+subCat+"&div="+div,    // URL
         {                				// options
         method:'get'             
             });
}


function gotoCat() {
	field = $F('select3');
	window.location = "/store/home.php?cat="+field;
	return false;
}