// JavaScript Document
var sLanguage = 'de';

function manufDropdown(manuf){
	var requestUrl = "/php-bin/classes/ajax.class.inc.php";
	if(manuf != '-1'){
		try{
			
			
			var request = new Ajax.Request(
							
								requestUrl,
								{
								
								 method:'post',
								 parameters: 'func=modellDropdown&manuf='+manuf,
								 onComplete: manufDropdownCb
								}
							);
		}
		catch(e){
			alert("Fehler: " + e.toString());	
		}
	}
}

function manufDropdownCb(response){
	try{
		$('sd_Modell').innerHTML = response.responseText;
	
	}
	catch(e){
		alert("Fehlers: " + e.toString());	
	}
}

function typeDropdown(modell){
	var requestUrl = "/php-bin/classes/ajax.class.inc.php";
	if(modell != '-1'){
		try{
			
			
			var request = new Ajax.Request(
							
								requestUrl,
								{
								
								 method:'post',
								 parameters: 'func=typDropdown&modell='+modell,
								 onComplete: typDropdownCb
								}
							);
		}
		catch(e){
			alert("Fehler: " + e.toString());	
		}
	}
}

function typDropdownCb(response){
	try{
		$('sd_type').innerHTML = response.responseText;
		clean1Stage ();
	
	}
	catch(e){
		alert("Fehlers: " + e.toString());	
	}
}

function setVid(vid){
	$('vId').value = vid;
}
function setTid(tid){
	$('tId').value = tid;
}

function clean1Stage(){
		if(sLanguage == 'de'){
			$('sd_Modell').innerHTML = "<select name='vid' class='carselector_select'><option value='-1'>Bitte w&auml;hlen</option></select>";
		}else{
			$('sd_Modell').innerHTML = "<select name='vid' class='carselector_select'><option value='-1'>Please choose</option></select>";
		}
}

function setLanguage(sLang){
	sLanguage = sLang;
}


