//***********************AJAX - Funktionen******************************//
//*****************Erstellt von Christoph Burth************************//

var DetailDiv, globalCar;
var iBoxId = -1;

//*********Newsletterregistrierung******************************//
//*********Darstellung der DropDowns zur Fahrzeugauswahl*******//
function typeDropdown(model){
	var requestUrl = "/content/php-bin/ACA/aca_ajaxfunctions.php";

	try{
		
		
		var request = new Ajax.Request(
						
						  requestUrl,
						  {
							
							 method:'post',
							 parameters: 'func=typeDropdown&model='+model,
							 onComplete: typdropdownCb
						  }
					  );
	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}
}


function CleargetCarForProd(id){
	$('scrollThisByCars_'+id).innerHTML = "";
	globalCar = "";
}

function getCarForProd(car, status, id){
	
	globalCar = id;
	$('scrollThisByCars_'+globalCar).innerHTML = "<center><span class = 'LoadingDivSpanText'><br><br>Loading ... </span><br><br><img id='Layer3' src='/Templates/09/pics/loading2.gif' /></center>";
	var requestUrl = "/content/php-bin/ACA/aca_ajaxfunctions.php";
	try{
		
		var request = new Ajax.Request(
						  requestUrl,
						  {
							 method:'post',
							 parameters: 'func=getCarForProd&car='+car+'&status='+status,
							 onComplete: CreategetCarForProd
						  }
					  );
	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}
	
}

function CreategetCarForProd(response){
	
	try{
		$('scrollThisByCars_'+globalCar).innerHTML = response.responseText;
	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}				
	
	
	globalCar = "";
	
}



function getSearchModels(manuf, selected){
	
	//$('useThisCarID').checked = "checked";
	
	var requestUrl = "/content/php-bin/ACA/aca_ajaxfunctions.php";
	try{
		
		var request = new Ajax.Request(
						  requestUrl,
						  {
							 method:'post',
							 parameters: 'func=getSearchModel&manuf='+manuf+'&selected='+selected,
							 onComplete: CreateSearchModel
						  }
					  );
	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}
	
}
function getSearchModelsRaeder(manuf, selected){
	
	//$('useThisCarID').checked = "checked";
	
	var requestUrl = "/content/php-bin/ACA/aca_ajaxfunctions.php";
	try{
		
		var request = new Ajax.Request(
						  requestUrl,
						  {
							 method:'post',
							 parameters: 'func=getSearchModelRaeder&manuf='+manuf+'&selected='+selected,
							 onComplete: CreateSearchModelRaeder
						  }
					  );
	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}
	
}


function getSearchModelsHTML(manuf, selected){
	
	//$('useThisCarID').checked = "checked";
	
	var requestUrl = "/content/php-bin/ACA/aca_ajaxfunctions.php";
	try{
		
		var request = new Ajax.Request(
						  requestUrl,
						  {
							 method:'post',
							 parameters: 'func=getSearchModelHTML&manuf='+manuf+'&selected='+selected,
							 onComplete: CreateSearchModelHTML
						  }
					  );
	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}
	
}



function Clear2StagesNow(){
	$('myCarForSearch_Ausfuehrung').innerHTML = "<div id='myCarForSearch_Ausfuehrung'> \n<select name = 's_Ausfuehrung' id = 'idS_Ausfuehrung' style = 'width:400px;'><option value = '' >w&auml;hlen</option></select></div>";
	$('myCarForSearch_Type').innerHTML = "<div id='myCarForSearch_Type'> \n<select name = 's_type' id = 'idS_type' style = 'width:200px;' ><option value = '' >w&auml;hlen</option></select></div>";
}

function Clear2StagesNowRaeder(){
	$('myCarForSearch_AusfuehrungRaeder').innerHTML = "<div id='myCarForSearch_AusfuehrungRaeder'> \n<select name = 's_AusfuehrungRaeder' id = 'idS_AusfuehrungRaeder' style = 'width:400px;'><option value = '' >w&auml;hlen</option></select></div>";
	$('myCarForSearch_TypeRaeder').innerHTML = "<div id='myCarForSearch_TypeRaeder'> \n<select name = 's_typeRaeder' id = 'idS_typeRaeder' style = 'width:200px;' ><option value = '' >w&auml;hlen</option></select></div>";
}

function Clear1StagesNow(){
	$('myCarForSearch_Ausfuehrung').innerHTML = "<div id='myCarForSearch_Ausfuehrung'> \n<select name = 's_Ausfuehrung' id = 'idS_Ausfuehrung' style = 'width:400px;'><option value = '' >w&auml;hlen</option></select></div>";
}
function Clear1StagesNowRaeder(){
	$('myCarForSearch_AusfuehrungRaeder').innerHTML = "<div id='myCarForSearch_AusfuehrungRaeder'> \n<select name = 's_AusfuehrungRaeder' id = 'idS_AusfuehrungRaeder' style = 'width:400px;'><option value = '' >w&auml;hlen</option></select></div>";
}


function ClearAllStagesNowHTML(){
	
	 
	$('hersteller').selectedIndex = 0;
	$('ModellCell').innerHTML = "<select name = 's_Model' id = 'idS_Model' onChange='Clear1StagesNowHTML(); getSearchTypesHTML(document.getElementById(\"hersteller\").value,this.value);' style = 'width:200px;' ><option value = '' ></option></select>";
	$('AusfuehrungCell').innerHTML = "<div id='myCarForSearch_Ausfuehrung'> \n<select name = 's_Ausfuehrung' id = 'idS_Ausfuehrung' style = 'width:200px;'><option value = '' ></option></select></div>";
	$('TypCell').innerHTML = "<div id='myCarForSearch_Type'> \n<select name = 's_type' id = 'idS_type' style = 'width:200px;' ><option value = '' ></option></select></div>";
}

function Clear2StagesNowHTML(){
	$('AusfuehrungCell').innerHTML = "<div id='myCarForSearch_Ausfuehrung'> \n<select name = 's_Ausfuehrung' id = 'idS_Ausfuehrung' style = 'width:200px;'><option value = '' >w&auml;hlen</option></select></div>";
	$('TypCell').innerHTML = "<div id='myCarForSearch_Type'> \n<select name = 's_type' id = 'idS_type' style = 'width:200px;' ><option value = '' >w&auml;hlen</option></select></div>";
}

function Clear1StagesNowHTML(){
	$('AusfuehrungCell').innerHTML = "<div id='myCarForSearch_Ausfuehrung'> \n<select name = 's_Ausfuehrung' id = 'idS_Ausfuehrung' style = 'width:200px;'><option value = '' >w&auml;hlen</option></select></div>";
}




function CreateSearchModel(response){
	try{
		
		
		
		//$('myCarForSearch_Ausfuehrung').innerHTML = "<div id='myCarForSearch_Ausfuehrung'> \n<select name = 's_Ausfuehrung' id = 'idS_Ausfuehrung' style = 'width:400px;'><option value = '' >w&auml;hlen</option></select></div>";
		//$('myCarForSearch_Type').innerHTML = "<div id='myCarForSearch_Type'> \n<select name = 's_type' id = 'idS_type' style = 'width:200px;' ><option value = '' >w&auml;hlen</option></select></div>";
		$('myCarForSearch_Model').innerHTML = response.responseText;
		
	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}				
}

function CreateSearchModelRaeder(response){
	try{
		
		
		
		//$('myCarForSearch_Ausfuehrung').innerHTML = "<div id='myCarForSearch_Ausfuehrung'> \n<select name = 's_Ausfuehrung' id = 'idS_Ausfuehrung' style = 'width:400px;'><option value = '' >w&auml;hlen</option></select></div>";
		//$('myCarForSearch_Type').innerHTML = "<div id='myCarForSearch_Type'> \n<select name = 's_type' id = 'idS_type' style = 'width:200px;' ><option value = '' >w&auml;hlen</option></select></div>";
		$('myCarForSearch_ModelRaeder').innerHTML = response.responseText;
		
	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}				
}



function CreateSearchModelHTML(response){
	try{
		
		$('ModellCell').innerHTML = response.responseText;
		
	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}				
}

function selectSearchModels(manuf){
	
	
}

function getSearchTypes(manuf,model,selected){
	
	//alert(manuf);
	//alert(model);
	//alert(selected);
	
	var requestUrl = "/content/php-bin/ACA/aca_ajaxfunctions.php";
	try{
		
		var request = new Ajax.Request(
						  requestUrl,
						  {
							 method:'post',
							 parameters: 'func=getSearchType&manuf='+manuf+'&model='+model+'&myselected='+selected,
							 onComplete: CreateSearchType
						  }
					  );
	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}
	
}
function getSearchTypesRaeder(manuf,model,selected){
	
	//alert(manuf);
	//alert(model);
	//alert(selected);
	
	var requestUrl = "/content/php-bin/ACA/aca_ajaxfunctions.php";
	try{
		
		var request = new Ajax.Request(
						  requestUrl,
						  {
							 method:'post',
							 parameters: 'func=getSearchTypeRaeder&manuf='+manuf+'&model='+model+'&myselected='+selected,
							 onComplete: CreateSearchTypeRaeder
						  }
					  );
	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}
	
}

function getSearchTypesHTML(manuf,model,selected){
	
	//alert(manuf);
	//alert(model);
	//alert(selected);
	
	var requestUrl = "/content/php-bin/ACA/aca_ajaxfunctions.php";
	try{
		
		var request = new Ajax.Request(
						  requestUrl,
						  {
							 method:'post',
							 parameters: 'func=getSearchTypeHTML&manuf='+manuf+'&model='+model+'&myselected='+selected,
							 onComplete: CreateSearchTypeHTML
						  }
					  );
	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}
	
}



function getSearchAusfuehrung(manuf,model,selected, usethisone){
	
	//alert(manuf);
	//alert(model);
	//alert(selected);
	//alert(usethisone);
	
	var requestUrl = "/content/php-bin/ACA/aca_ajaxfunctions.php";
	try{
		
		var request = new Ajax.Request(
						  requestUrl,
						  {
							 method:'post',
							 parameters: 'func=getSearchAusfuehrung&manuf='+manuf+'&model='+model+'&myselected='+selected+'&usethisone='+usethisone,
							 onComplete: CreateSearchAusfuehrung
						  }
					  );
	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}
	
}

function getSearchAusfuehrungRaeder(manuf,model,selected, usethisone){
	
	//alert(manuf);
	//alert(model);
	//alert(selected);
	//alert(usethisone);
	
	var requestUrl = "/content/php-bin/ACA/aca_ajaxfunctions.php";
	try{
		
		var request = new Ajax.Request(
						  requestUrl,
						  {
							 method:'post',
							 parameters: 'func=getSearchAusfuehrungRaeder&manuf='+manuf+'&model='+model+'&myselected='+selected+'&usethisone='+usethisone,
							 onComplete: CreateSearchAusfuehrungRaeder
						  }
					  );
	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}
	
}


function getSearchAusfuehrungHTML(manuf,model,selected, usethisone){
	
	//alert(manuf);
	//alert(model);
	//alert(selected);
	//alert(usethisone);
	
	var requestUrl = "/content/php-bin/ACA/aca_ajaxfunctions.php";
	try{
		
		var request = new Ajax.Request(
						  requestUrl,
						  {
							 method:'post',
							 parameters: 'func=getSearchAusfuehrungHTML&manuf='+manuf+'&model='+model+'&myselected='+selected+'&usethisone='+usethisone,
							 onComplete: CreateSearchAusfuehrungHTML
						  }
					  );
	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}
	
}


function CreateSearchAusfuehrung(response){
	try{

		$('myCarForSearch_Ausfuehrung').innerHTML = response.responseText;
	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}				
}

function CreateSearchAusfuehrungRaeder(response){
	try{

		$('myCarForSearch_AusfuehrungRaeder').innerHTML = response.responseText;
	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}				
}


function CreateSearchAusfuehrungHTML(response){
	try{

		$('AusfuehrungCell').innerHTML = response.responseText;
	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}				
}

function CreateSearchType(response){
	
	try{
		$('myCarForSearch_Type').innerHTML = response.responseText;
		//$('myCarForSearch_Ausfuehrung').innerHTML = "<div id='myCarForSearch_Ausfuehrung'> \n<select name = 's_Ausfuehrung' id = 'idS_Ausfuehrung' style = 'width:400px;'><option value = '' >w&auml;hlen</option></select></div>";
	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}				
}

function CreateSearchTypeRaeder(response){
	
	try{
		$('myCarForSearch_TypeRaeder').innerHTML = response.responseText;
		//$('myCarForSearch_Ausfuehrung').innerHTML = "<div id='myCarForSearch_Ausfuehrung'> \n<select name = 's_Ausfuehrung' id = 'idS_Ausfuehrung' style = 'width:400px;'><option value = '' >w&auml;hlen</option></select></div>";
	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}				
}

function CreateSearchTypeHTML(response){
	
	try{
		$('TypCell').innerHTML = response.responseText;
		//$('myCarForSearch_Ausfuehrung').innerHTML = "<div id='myCarForSearch_Ausfuehrung'> \n<select name = 's_Ausfuehrung' id = 'idS_Ausfuehrung' style = 'width:400px;'><option value = '' >w&auml;hlen</option></select></div>";
	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}				
}

function typdropdownCb(response){

	try{
		$('typselect').style.visibility = "visible";

		$('typselect').innerHTML = response.responseText;
	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}
}

function exaktDropdown(type){
	var requestUrl = "/content/php-bin/ACA/aca_ajaxfunctions.php";
	try{
		var request = new Ajax.Request(
						  requestUrl,
						  {
							 method:'post',
							 parameters: 'func=exaktDropdown&type='+type,
							 onComplete: exaktdropdownCb
						  }
					  );
	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}
}

function exaktdropdownCb(response){

	try{
		
		$('exaktselect').style.visibility = "visible";
		$('exaktselect').innerHTML = response.responseText;
	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}
}



//********************Userbereich, Warenkorb******************************//
//*********Darstellung der Ebenen zur Adressauswahl und Adressbuch*******//

function DisplayAdress(shipA, index) {
	
	
	if (shipA == 'changeAdress'){
		$('selectAdress').style.visibility = "hidden";
		$('change_adress').style.visibility = "visible";
	}
	
	if (shipA == 'userbereich'){
		
		$('change_adress').style.visibility = "visible";
		$('changeAdress').style.visibility  = "visible";
		if($('divPositioner')) $('divPositioner').style.visibility = "visible";
	}
	
	var requestUrl = "/content/php-bin/ACA/aca_ajaxfunctions.php";
	
	try{
		
		var request = new Ajax.Request(
						  requestUrl,
						  {
							 method:'post',
							 parameters: 'func=changeIt&shipA='+index+'&adress='+shipA,
							 onComplete: showAdress
						  }
					  );

	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}
	
}

function showAdress(response){
	
	try{
		$('changeAdress').style.visibility = "visible";
		
		$('change_adress').innerHTML = response.responseText;
	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}
}


function SaveAdress(id, vorname, nachname, adresse, stadt, plz, telefon, anrede, land) {
	var requestUrl = "/content/php-bin/ACA/aca_ajaxfunctions.php";

	try{
		
		var error = '';
		
		if(vorname.length<1){
			error = 'Bitte geben Sie einen Vornamen ein';	
		}
		if(nachname.length<1){
			error = 'Bitte geben Sie einen Nachname ein';	
		}
		if(adresse.length<2){
			error = 'Bitte geben Sie eine Adresse ein';	
		}
		if(stadt.length<2){
			error = 'Bitte geben Sie eine Stadt ein';	
		}
		if(plz.length<2){
			error = 'Bitte geben Sie eine Postleitzahl ein';
		}
		
		if(anrede.length<2){
			error = 'Bitte waehle eine Anrede aus';	
		}
		if(land.length<2){
			error = 'Bitte waehle ein Land aus';	
		}
		
		if(error.length > 2){ 
			alert (error);
		
		}else{
			//alert ('Juhu');
			var request = new Ajax.Request(
							  requestUrl,
							  {
								 method:'post',
								 parameters: 'func=saveIt&id='+id+'&vorname='+vorname+'&nachname='+nachname+'&adresse='+adresse+'&stadt='+stadt+'&plz='+plz+'&telefon='+telefon+'&anrede='+anrede+'&land='+land,
								 onComplete: useThisNewAdress
							  }
						  );
			
		}

	}
	catch(e){
		alert("Fehlerle: " + e.toString());	
	}
	
}

function useThisNewAdress(response){
	//alert(response.responseText);
	self.location='/shopping_cart.php?shipA='+response.responseText+'&cart=go';
	
}


function CloseIt(response){
	
	try{
		$('changeAdress').style.visibility = "hidden";
		//$('change_Adress').style.visibility = "hidden";
		parent.location.reload();
		DisplayLoginLayer('selectAdress');
				
	}
	catch(e){
		alert("Fehlerle: " + e.toString());	
	}
}


//*********Userbereich******************************//
//*******Darstellung zum ndern der Hauptadresse***//


function DisplayMain(userId) {
	var requestUrl = "/content/php-bin/ACA/aca_ajaxfunctions.php";
	
	
	try{
		
		var request = new Ajax.Request(
						  requestUrl,
						  {
							 method:'post',
							 parameters: 'func=showMain&userId='+userId,
							 onComplete: showMainAdress
						  }
					  );

	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}
	
}

function showMainAdress(response){
	
	try{

		$('changeMainAdress').style.visibility = "visible";
		$('change_MainAdress').innerHTML = response.responseText;
		$('change_MainAdress').style.visibility = "visible";
		$('change_MainAdress').style.top = -100+'px';
		$('change_MainAdress').style.postition = 'fixed';
		if($('divPositioner')) $('divPositioner').style.visibility = "visible";
	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}
}


function changeMainAdress(userId, email, anrede, vorname, nachname, street, adress_plus, city, zip, country, phone, fax, hersteller){
	var requestUrl = "/content/php-bin/ACA/aca_ajaxfunctions.php";
	
	try{
		
		var error = '';
		
		if(email.length<2){
			error = 'Bitte gebe Deine E-Mail ein';	
		}
		if(anrede.length<2){
			error = 'Bitte waehle eine Anrede aus';	
		}
		if(vorname.length<1){
			error = 'Bitte geben Sie einen Vornamen ein';	
		}
		if(nachname.length<1){
			error = 'Bitte geben Sie einen Nachname ein';	
		}
		if(street.length<2){
			error = 'Bitte geben Sie eine Adresse ein';	
		}
		if(city.length<2){
			error = 'Bitte geben Sie eine Stadt ein';	
		}
		if(zip.length<2){
			error = 'Bitte geben Sie eine Postleitzahl ein';
		}
		if(phone.length<2){
			error = 'Bitte geb Deine Telefonnummer ein';	
		}
		
		if(country.length<2){
			error = 'Bitte waehle ein Land aus';	
		}
		
		if(error.length > 2){ 
			alert (error);
		
		}else{
			var request = new Ajax.Request(
						  requestUrl,
						  {
							 method:'post',
							 parameters: 'func=saveMain&userId='+userId+'&email='+email+'&anrede='+anrede+'&vorname='+vorname+'&nachname='+nachname+'&street='+street+'&adress_plus='+adress_plus+'&city='+city+'&zip='+zip+'&country='+country+'&phone='+phone+'&fax='+fax+'&hersteller='+hersteller,
							 onComplete: CloseMain
						  }
					  );
		}

	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}
}

function CloseMain(response){
	
	try{
		$('change_MainAdress').style.visibility = "hidden";
		$('changeMainAdress').style.visibility = "hidden";
		
		parent.location.reload()
				
	}
	catch(e){
		alert("Fehlerle: " + e.toString());	
	}
}



function ShowNameTree(marke) {
	var requestUrl = "/content/php-bin/ACA/aca_ajaxfunctions.php";
	
	try{
		$('markenTree').style.visibility = "visible";
		$('showTree').style.visibility = "visible";
		var request = new Ajax.Request(
						  requestUrl,
						  {
							 method:'post',
							 parameters: 'func=showTree&marke='+marke,
							 onComplete: showTrees
						  }
					  );

	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}
	
}

function showTrees(response){
	
	try{
		//alert(response.responseText);
		

		$('markenTree').innerHTML = response.responseText;
		
		
	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}
}


function CloseTree(){
	$('markenTree').style.visibility = "hidden";
	$('showTree').style.visibility = "hidden";
		
}


function ShowDetail(ind){
	$('MarkenDetail_'+ind).style.visibility = "visible";
	$('MarkenDetail_'+ind).style.height = "auto";
	$('MarkenDetail_'+ind).style.padding = "10";

}

function CloseDetail(ind){
	DetailDiv = setTimeout('tempCloseDetail('+ind+')', 1000);
}

function tempCloseDetail(ind){
	$('MarkenDetail_'+ind).style.visibility = "hidden";
	$('MarkenDetail_'+ind).style.height = "0";
	$('MarkenDetail_'+ind).style.padding = "0";

}

function HoldDetail(){
	clearTimeout(DetailDiv);
}
function getSearchHSN(sId){

	var requestUrl = "/content/php-bin/ACA/aca_ajaxfunctions.php";
	try{
		
		var request = new Ajax.Request(
						  requestUrl,
						  {
							 method:'post',
							 parameters: 'func=getHSNType&sId='+sId,
							 onComplete: CreateHSNButton
						  }
					  );
	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}
}
function CreateHSNButton(response){
	try{

		$('CSS_ID_CARSELECTOR_HSN').innerHTML = response.responseText;
	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}	
}
function CarSelectorClearText(sElement){
		sElement.value = '';
		if(sElement.className == 'CSS_TEXT_SERIAL')
			sElement.className  = 'CSS_TEXT_SERIAL_ACTIVE';
		else
			sElement.className  = 'CSS_TEXT_SERIAL_2_ACTIVE';
			
		if(sElement.id == 's_Serial1'){
			$('s_Serial2').className = 'CSS_TEXT_SERIAL_2';
			$('s_Serial3').className = 'CSS_TEXT_SERIAL';
			$('s_Serial4').className = 'CSS_TEXT_SERIAL_2';
		}else if(sElement.id == 's_Serial2'){
			$('s_Serial1').className = 'CSS_TEXT_SERIAL';
			$('s_Serial3').className = 'CSS_TEXT_SERIAL';
			$('s_Serial4').className = 'CSS_TEXT_SERIAL_2';
		}else if(sElement.id == 's_Serial3'){
			$('s_Serial2').className = 'CSS_TEXT_SERIAL_2';
			$('s_Serial1').className = 'CSS_TEXT_SERIAL';
			$('s_Serial4').className = 'CSS_TEXT_SERIAL_2';
		}else if(sElement.id == 's_Serial4'){
			$('s_Serial2').className = 'CSS_TEXT_SERIAL_2';
			$('s_Serial3').className = 'CSS_TEXT_SERIAL';
			$('s_Serial1').className = 'CSS_TEXT_SERIAL';
		}
		
}

function CarSelectorWithHSN(sElement, sHsnDiv){
	
	var sTsn = sElement.value;
	var sHsn = $(sHsnDiv).value;
	
	if(sElement.value.length > 2){
		
		var requestUrl = "/content/php-bin/ACA/aca_ajaxfunctions.php";
		try{
			
			var request = new Ajax.Request(
								requestUrl,
								{
								 method:'post',
								 parameters: 'func=getDropDownByHsn&sHsn='+sHsn+'&sTsn='+sTsn+'&shop=-1',
								 onComplete: CreateCarSelectorByHSN
								}
							);
		}
		catch(e){
			alert("Fehler: " + e.toString());	
		}
	}
}
function CarSelectorWithHSNShop(sElement, sHsnDiv){
	
	var sTsn = sElement.value;
	var sHsn = $(sHsnDiv).value;
	
	if(sElement.value.length > 2){
		
		var requestUrl = "/content/php-bin/ACA/aca_ajaxfunctions.php";
		try{
			
			var request = new Ajax.Request(
								requestUrl,
								{
								 method:'post',
								 parameters: 'func=getDropDownByHsn&sHsn='+sHsn+'&sTsn='+sTsn+'&shop=1',
								 onComplete: CreateCarSelectorByHSNShop
								}
							);
		}
		catch(e){
			alert("Fehler: " + e.toString());	
		}
	}
}

function CreateCarSelectorByHSN(response){
	try{
		if(response.responseText.length > 0)
			$('CSS_ID_CARSELECTOR_DROPDOWN').innerHTML = response.responseText;
		else
			$('CSS_ID_CARSELECTOR_WARNING').style.visibility = 'visible';
	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}	
}

function CreateCarSelectorByHSNShop(response){
	try{
		if(response.responseText.length > 0)
			$('CSS_ID_CARSELECTOR_DROPDOWN').innerHTML = response.responseText;
		else
			$('CSS_ID_CARSELECTOR_WARNING_SHOP').style.visibility = 'visible';
	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}	
}

function closeCarSelectWarning(){
		$('CSS_ID_CARSELECTOR_WARNING').style.visibility = 'hidden';
}

function closeCarSelectWarningShop(){
		$('CSS_ID_CARSELECTOR_WARNING_SHOP').style.visibility = 'hidden';
}

function CarSelectorClear2StagesNow(){
	
}

function CarSelectorClear2StagesNowShop(){

}

function getCarSelectorSearchModels(manuf, selected){
	
	//$('useThisCarID').checked = "checked";
	
	var requestUrl = "/content/php-bin/ACA/aca_ajaxfunctions.php";
	try{
		
		var request = new Ajax.Request(
						  requestUrl,
						  {
							 method:'post',
							 parameters: 'func=getSearchModelCarSelector&manuf='+manuf+'&selected='+selected,
							 onComplete: CarSelectorCreateSearchModel
						  }
					  );
	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}
	
}
function getCarSelectorSearchModelsShop(manuf, selected){
	
	//$('useThisCarID').checked = "checked";
	
	var requestUrl = "/content/php-bin/ACA/aca_ajaxfunctions.php";
	try{
		
		var request = new Ajax.Request(
						  requestUrl,
						  {
							 method:'post',
							 parameters: 'func=getSearchModelCarSelectorShop&manuf='+manuf+'&selected='+selected,
							 onComplete: CarSelectorCreateSearchModel
						  }
					  );
	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}
	
}

function CarSelectorCreateSearchModel(response){
	try{
		
		$('myCarSelectorForSearch_Model').innerHTML = response.responseText;
	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}				
}

function getCarSelectorSearchTypes(manuf,model,selected){
	
	//alert(manuf);
	//alert(model);
	//alert(selected);
	
	var requestUrl = "/content/php-bin/ACA/aca_ajaxfunctions.php";
	try{
		
		var request = new Ajax.Request(
						  requestUrl,
						  {
							 method:'post',
							 parameters: 'func=getCarSelectorSearchType&manuf='+manuf+'&model='+model+'&myselected='+selected,
							 onComplete: CarSelectorCreateSearchType
						  }
					  );
	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}
	
}
function getCarSelectorSearchTypesShop(manuf,model,selected){
	
	//alert(manuf);
	//alert(model);
	//alert(selected);
	
	var requestUrl = "/content/php-bin/ACA/aca_ajaxfunctions.php";
	try{
		
		var request = new Ajax.Request(
						  requestUrl,
						  {
							 method:'post',
							 parameters: 'func=getCarSelectorSearchTypeShop&manuf='+manuf+'&model='+model+'&myselected='+selected,
							 onComplete: CarSelectorCreateSearchType
						  }
					  );
	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}
	
}




function CarSelectorCreateSearchType(response){
	
	try{
		$('myCarSelectorForSearch_Type').innerHTML = response.responseText;
		//$('myCarForSearch_Ausfuehrung').innerHTML = "<div id='myCarForSearch_Ausfuehrung'> \n<select name = 's_Ausfuehrung' id = 'idS_Ausfuehrung' style = 'width:400px;'><option value = '' >w&auml;hlen</option></select></div>";
	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}				
}

function getCarSelectorSearchAusfuehrung(manuf,model,selected, usethisone){
	var requestUrl = "/content/php-bin/ACA/aca_ajaxfunctions.php";
	try{
		
		var request = new Ajax.Request(
						  requestUrl,
						  {
							 method:'post',
							 parameters: 'func=getCarSelectorSearchAusfuehrung&manuf='+manuf+'&model='+model+'&myselected='+selected+'&usethisone='+usethisone,
							 onComplete: CarSelectorCreateSearchAusfuehrung
						  }
					  );
	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}
	
}
function getCarSelectorSearchAusfuehrungShop(manuf,model,selected, usethisone){

	var requestUrl = "/content/php-bin/ACA/aca_ajaxfunctions.php";
	try{
		
		var request = new Ajax.Request(
						  requestUrl,
						  {
							 method:'post',
							 parameters: 'func=getCarSelectorSearchAusfuehrungShop&manuf='+manuf+'&model='+model+'&myselected='+selected+'&usethisone='+usethisone,
							 onComplete: CarSelectorCreateSearchAusfuehrung
						  }
					  );
	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}
	
}

function CarSelectorCreateSearchAusfuehrung(response){
	try{

		$('myCarSelectorForSearch_Ausfuehrung').innerHTML = response.responseText;
	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}				
}

function ClearAllTabs(){
	$('myCarSelectorForSearch_Model').innerHTML = "<div id='myCarSelectorForSearch_Model'> \n<select name = 'idS_Model' id = 'idS_Model' style = 'width:200px;'><option value = '' >w&auml;hlen</option></select></div>";
	$('myCarSelectorForSearch_Type').innerHTML = "<div id='myCarSelectorForSearch_Type'> \n<select name = 'idS_type' id = 'idS_type' style = 'width:200px;'><option value = '' >w&auml;hlen</option></select></div>";
	$('myCarSelectorForSearch_Ausfuehrung').innerHTML = "<div id='myCarSelectorForSearch_Ausfuehrung'> \n<select name = 's_Ausfuehrung' id = 'idS_Ausfuehrung' style = 'width:200px;'><option value = '' >w&auml;hlen</option></select></div>";
	$('CSS_ID_CARSELECTOR_HSN').innerHTML = '<img src="/Templates/10/layout/carselector_takeCar_off.png" border="0" />';


}

function Clear2Tabs(){
	
	$('myCarSelectorForSearch_Type').innerHTML = "<div id='myCarSelectorForSearch_Type'> \n<select name = 'idS_type' id = 'idS_type' style = 'width:200px;'><option value = '' >w&auml;hlen</option></select></div>";
	$('myCarSelectorForSearch_Ausfuehrung').innerHTML = "<div id='myCarSelectorForSearch_Ausfuehrung'> \n<select name = 's_Ausfuehrung' id = 'idS_Ausfuehrung' style = 'width:200px;'><option value = '' >w&auml;hlen</option></select></div>";
	$('CSS_ID_CARSELECTOR_HSN').innerHTML = '<img src="/Templates/10/layout/carselector_takeCar_off.png" border="0" />';
}

function Clear1Tabs(){
	$('myCarSelectorForSearch_Ausfuehrung').innerHTML = "<div id='myCarSelectorForSearch_Ausfuehrung'> \n<select name = 's_Ausfuehrung' id = 'idS_Ausfuehrung' style = 'width:200px;'><option value = '' >w&auml;hlen</option></select></div>";
	
	$('CSS_ID_CARSELECTOR_HSN').innerHTML = '<img src="/Templates/10/layout/carselector_takeCar_off.png" border="0" />';
}

function checkCountryToShipcosts(element){
	var requestUrl = "/content/php-bin/ACA/aca_ajaxfunctions.php";
	var sCountry = element.value;

	try{
		
		var request = new Ajax.Request(
						  requestUrl,
						  {
							 method:'post',
							 parameters: 'func=getShippingCosts&country='+sCountry,
							 onComplete: warnOfShipping
						  }
					  );
	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}
}

function warnOfShipping(response){
	try{
		//alert(response.responseText+'****');
		if(response.responseText == '-1'){
			$('WARNING_NO_SHIPPING').innerHTML = 'In das von dir gew&auml;hlte Land liefern wir leider nicht';
		}else{
			$('WARNING_NO_SHIPPING').innerHTML = '';
		}
	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}	
}



function LoadHinweisInBox(iBox, iProdId){
	var requestUrl = "/content/php-bin/ACA/aca_ajaxfunctions.php";
	iBoxId = iBox;
	
	try{
		
		var request = new Ajax.Request(
						  requestUrl,
						  {
							 method:'post',
							 parameters: 'func=getHinweisHTML&prodId='+iProdId,
							 onComplete: LoadThisInHinweisBox
						  }
					  );
	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}
	
}
function LoadThisInHinweisBox(response){
	
	try{
		var sDIvName = 'ACAHinweisBoxContent_'+iBoxId;
		if(document.getElementById(sDIvName) != null && typeof(document.getElementById(sDIvName)) != "undefiened"){
			document.getElementById(sDIvName).innerHTML = response.responseText;
		}
		
	}
	catch(e){
		alert("Fehler: " + e.toString());	
	}	
}

