	
	/* auto-best-preis.de */
	abpOrderForm = function() {
		
		this.params = PHP_Unserialize($('params').innerHTML);
		
		/* hide elements */
		if ($('asg12').value == "")
			$('cell_asg12').style.display = 'none';
		if ($('asg24').value == "")
			$('cell_asg24').style.display = 'none';
		
		if ($('auslieferung_L').value == "")
			$('cell_auslieferung_L').style.display = 'none';
		if ($('auslieferung_XL').value == "")
			$('cell_auslieferung_XL').style.display = 'none';
		if ($('auslieferung_XXL').value == "")
			$('cell_auslieferung_XXL').style.display = 'none';
		
		if ($('auslieferung_L').value == "" && $('auslieferung_XL').value == "" && $('auslieferung_XXL').value == "") {
			$('cell_auslieferung_none').style.display = 'none';
			$('cell_auslieferung_space1').style.display = 'none';
			$('cell_auslieferung_space2').style.display = 'none';
			$('cell_auslieferung_space3').style.display = 'none';
		}
		
		if (this.params['val_gewerbe'] == null)
			$('cell_gewerbetreibend').style.display = 'none';
		
		if (this.params['gewerbe'] == 1)
			$('gewerbetreibend').checked = true;
		
		/* function */
		this.update = function(Element) {
			
			/* floatval */
			this.params['val_abp'] = parseFloat(this.params['val_abp']);
			this.params['val_price'] = parseFloat(this.params['val_price']);
			this.params['val_gewerbe'] = this.params['val_gewerbe'] ? parseFloat(this.params['val_gewerbe']) : 1 ;
			
			/* uncheck wrong set checkboxes */
			if (Element.id == 'asg24' && $('asg24').checked)
				$('asg12').checked = false;
			if (Element.id == 'asg12' && $('asg12').checked)
				$('asg24').checked = false;
			
			this.abp = this.params['forumla_rabatt'];
  		this.abp = this.abp.replace(new RegExp("UPE", "g"), this.params['val_price']);
			this.abp = eval(this.abp);
			
			/* gewerbetreibend */
			if($('gewerbetreibend').checked)
				this.abp = this.abp - (this.params['val_price'] - this.params['val_price'] * this.params['val_gewerbe']);
			
			
			/* abp = gesamtpreis */
			this.gesamtpreis = this.abp;
			
			/* misc */
			if ($('auslieferung_L').checked)
				this.gesamtpreis += parseFloat($('auslieferung_L').value);
			
			if ($('auslieferung_XL').checked)
				this.gesamtpreis += parseFloat($('auslieferung_XL').value);
			
			if ($('auslieferung_XXL').checked)
				this.gesamtpreis += parseFloat($('auslieferung_XXL').value);
			
			if ($('stvo').checked)
				this.gesamtpreis += parseFloat($('stvo').value);
			
			if ($('feinstaubplakette').checked)
				this.gesamtpreis += parseFloat($('feinstaubplakette').value);

			if ($('zulassung').checked)
				this.gesamtpreis += parseFloat($('zulassung').value);				
			
			if ($('asg12').checked)
				this.gesamtpreis += parseFloat($('asg12').value);
			
			if ($('asg24').checked)
				this.gesamtpreis += parseFloat($('asg24').value);
  		
			/* put in html */
			$('abp').innerHTML = number_format(this.abp, 0, "",".") + " &euro;";
			$('gesamtpreis').innerHTML = number_format(this.gesamtpreis, 0, "",".") + " &euro;";
			
			/* put in form */
			document.forms[0].car_abp.value = number_format(this.abp, 0, "",".");
			
		}
		
		/* function */
		this.checkStep2 = function() {
			
			if (!document.orderform.Bestellen.checked) {
				alert ('Bitte wählen Sie zuerst \"Ja, ich will bestellen\".');
				return false;
			}
			
			if (document.orderform.Vorname.value == ''
					|| document.orderform.Nachname.value == ''
					|| document.orderform.Strasse.value == ''
					|| document.orderform.PLZ.value == ''
					|| document.orderform.Ort.value == ''
					|| document.orderform.Geburtsdatum.value == ''
					|| document.orderform.Fon.value == ''
					|| document.orderform.EMail.value == ''
					) {
				alert ('Bitte geben Sie die mit * gekennzeichneten Felder ein.');
				return false;
			}
			
			//Browser ermitteln
      if (navigator.appName.indexOf("Explorer") != -1){
  			$('check_order_01').style.display = 'inline';
  			$('check_order_02').style.display = 'inline';
  			$('check_order_03').style.display = 'inline';
  			$('check_order_04').style.display = 'inline';
  			$('check_order_05').style.display = 'inline';
  			$('check_order_56').style.display = 'inline';
  			$('check_order_06').style.display = 'inline';
  			$('check_order_07').style.display = 'inline';
  			$('check_order_08').style.display = 'inline';
  			$('check_order_09').style.display = 'inline';
  			$('check_order_10').style.display = 'inline';
      }else{
  			$('check_order_01').style.display = 'table-row';
  			$('check_order_02').style.display = 'table-row';
  			$('check_order_03').style.display = 'table-row';
  			$('check_order_04').style.display = 'table-row';
  			$('check_order_05').style.display = 'table-row';
  			$('check_order_56').style.display = 'table-row';
  			$('check_order_06').style.display = 'table-row';
  			$('check_order_07').style.display = 'table-row';
  			$('check_order_08').style.display = 'table-row';
  			$('check_order_09').style.display = 'table-row';
  			$('check_order_10').style.display = 'table-row';
      }			
			

			
			$('check_order_headline_1').style.display = 'none';
			$('check_step1_01').style.display = 'none';
			$('check_order_11').style.display = 'none';
			$('cell_auslieferung_L').style.display = 'none';
			$('cell_auslieferung_XL').style.display = 'none';
			$('cell_auslieferung_XXL').style.display = 'none';
			$('cell_auslieferung_none').style.display = 'none';
			$('cell_auslieferung_space1').style.display = 'none';
			$('cell_auslieferung_space2').style.display = 'none';
			$('cell_auslieferung_space3').style.display = 'none';
			$('cell_paket').style.display = 'none';
			$('cell_Bestellen_01').style.display = 'none';
			
			$('check_order_headline_2').style.display = 'inline';
			$('check_order_services').style.display = 'inline';
			$('cell_Fahrzeugdaten_01').style.display = 'inline';
			$('change_01').style.display = 'inline';
			$('change_02').style.display = 'inline';
			$('change_03').style.display = 'inline';
			
			
			$('check_Vorname').style.display = 'inline';
			$('check_Nachname').style.display = 'inline';
			$('check_Strasse').style.display = 'inline';
			$('check_Geburtsdatum').style.display = 'inline';
			$('check_PLZ').style.display = 'inline';
			$('check_Ort').style.display = 'inline';
			$('check_Fon').style.display = 'inline';
			$('check_Fax').style.display = 'inline';
			$('check_Mobil').style.display = 'inline';
			$('check_EMail').style.display = 'inline';
			$('check_Nachricht').style.display = 'inline';
			
			$('Vorname').style.display = 'none';
			$('Nachname').style.display = 'none';
			$('Strasse').style.display = 'none';
			$('Geburtsdatum').style.display = 'none';
			$('PLZ').style.display = 'none';
			$('Ort').style.display = 'none';
			$('Fon').style.display = 'none';
			$('Fax').style.display = 'none';
			$('Mobil').style.display = 'none';
			$('EMail').style.display = 'none';
			$('Nachricht').style.display = 'none';
			
			$('check_Vorname').innerHTML = $('Vorname').value;
			$('check_Nachname').innerHTML = $('Nachname').value;
			$('check_Strasse').innerHTML = $('Strasse').value;
			$('check_Geburtsdatum').innerHTML = $('Geburtsdatum').value;
			$('check_PLZ').innerHTML = $('PLZ').value;
			$('check_Ort').innerHTML = $('Ort').value;
			$('check_Fon').innerHTML = $('Fon').value;
			$('check_Fax').innerHTML = $('Fax').value;
			$('check_Mobil').innerHTML = $('Mobil').value;
			$('check_EMail').innerHTML = $('EMail').value;
			$('check_Nachricht').innerHTML = $('Nachricht').value;
			
			var auslieferungspaket = 'kein Paket gewählt';
			if ($('auslieferung_L').checked)
				auslieferungspaket = "L";
			else if ($('auslieferung_XL').checked)
				auslieferungspaket = "XL";
			else if ($('auslieferung_XXL').checked)
				auslieferungspaket = "XL";
			
			var asg = 'nein';
			if ($('asg12').checked)
				asg = "12 Monate";
			else if ($('asg24').checked)
				asg = "24 Monate";
			
			// "Inzahlungnahme: <b>" + ($('inzahlungnahme').checked ? 'ja' : 'nein') + "</b><br>" + 
			
			
			$('check_order_services_inner').innerHTML = 
				"Gewerbetreibend: <b>" + ($('gewerbetreibend').checked ? 'ja' : 'nein') + "</b><br>" + 
				"Auslieferungspaket: <b>" + auslieferungspaket + "</b><br>" + 
				"StVo-Paket: <b>" + ($('stvo').checked ? 'ja' : 'nein') + "</b><br>" + 
				"Anschlussgarantie: <b>" + asg + "</b><br>" + 
				"Feinstaubplakette: <b>" + ($('feinstaubplakette').checked ? 'ja' : 'nein') + "</b><br>" + 
				"Volltanken: <b>" + ($('volltanken').checked ? 'ja' : 'nein') + "</b><br>" +
				"Zulassung: <b>" + ($('zulassung').checked ? 'ja' : 'nein') + "</b><br><br>"
				;
			
			document.location.href = '#';
			
		}
		
		
		/* function */
		this.goStep2 = function() {
			
			$('check_order_01').style.display = 'none';
			$('check_order_02').style.display = 'none';
			$('check_order_03').style.display = 'none';
			$('check_order_04').style.display = 'none';
			$('check_order_05').style.display = 'none';
			$('check_order_06').style.display = 'none';
			$('check_order_07').style.display = 'none';
			$('check_order_08').style.display = 'none';
			$('check_order_09').style.display = 'none';
			$('check_order_10').style.display = 'none';
			
			$('check_order_headline_1').style.display = 'inline';
			$('check_step1_01').style.display = 'inline';
			$('check_order_11').style.display = 'inline';
			
			if ($('auslieferung_L').value != "")
				$('cell_auslieferung_L').style.display = 'inline';
			if ($('auslieferung_XL').value != "")
				$('cell_auslieferung_XL').style.display = 'inline';
			if ($('auslieferung_XXL').value != "")
				$('cell_auslieferung_XXL').style.display = 'inline';
			
			if ($('auslieferung_L').value == "" && $('auslieferung_XL').value == "" && $('auslieferung_XXL').value == "") {
  			$('cell_auslieferung_none').style.display = 'none';
  			$('cell_auslieferung_space1').style.display = 'none';
  			$('cell_auslieferung_space2').style.display = 'none';
  			$('cell_auslieferung_space3').style.display = 'none';
			}
			
			$('cell_paket').style.display = 'inline';
			$('cell_Bestellen_01').style.display = 'inline';
			
			$('check_order_headline_2').style.display = 'none';
			$('check_order_services').style.display = 'none';
			$('cell_Fahrzeugdaten_01').style.display = 'none';
			$('change_01').style.display = 'none';
			$('change_02').style.display = 'none';
			$('change_03').style.display = 'none';
			
			$('check_Vorname').style.display = 'none';
			$('check_Nachname').style.display = 'none';
			$('check_Strasse').style.display = 'none';
			$('check_Geburtsdatum').style.display = 'none';
			$('check_PLZ').style.display = 'none';
			$('check_Ort').style.display = 'none';
			$('check_Fon').style.display = 'none';
			$('check_Fax').style.display = 'none';
			$('check_Mobil').style.display = 'none';
			$('check_EMail').style.display = 'none';
			$('check_Nachricht').style.display = 'none';
			
			$('Vorname').style.display = 'inline';
			$('Nachname').style.display = 'inline';
			$('Strasse').style.display = 'inline';
			$('Geburtsdatum').style.display = 'inline';
			$('PLZ').style.display = 'inline';
			$('Ort').style.display = 'inline';
			$('Fon').style.display = 'inline';
			$('Fax').style.display = 'inline';
			$('Mobil').style.display = 'inline';
			$('EMail').style.display = 'inline';
			$('Nachricht').style.display = 'inline';
			
			document.location.href = '#';
			
		}
		
		
		/* function */
		this.send = function () {
			
			if (!document.orderform.AGBs.checked) {
				alert ('Bitte erkennen Sie unsere AGBs an.');
				return;
			}
			if (!document.orderform.Widerruf.checked) {
				alert ('Bitte erkennen Sie unser Widerrufssrecht an.');
				return;
			}
			if (!document.orderform.sicherheitscode.value) {
				alert ('Bitte geben Sie den dargestellten Code ein.');
				return;
			}
			
			var xmlhttp = Ajax.createAJAX();
			var PostStr = Ajax.PostStr();
						
  		with(xmlhttp) {
  			
  			onreadystatechange = function() {
					if (xmlhttp.readyState != 4)
						return;
					
					switch (xmlhttp.responseText) {
						case "0":
							document.location.href = "index.php?page_id=18";
							break;
						case "1":
							alert("Der Sicherheitscode war nicht korrekt.\nBitte prüfen und wiederholen Sie Ihre Eingabe.");
							break;
						default:
							alert("Bei Ihrer Bestellung ist ein Fehler aufgetreten.")
							break;
					}
				};
        open("post", "index.php", true);
				setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=iso-8859-1");
        setRequestHeader("Content-length", PostStr.length);
        setRequestHeader("Connection", "close");
				send(PostStr);
				
    	}
		}
	}
	
	
	/* auto-best-preis.de */
	abpConfigForm = function() {
		
		this.params = PHP_Unserialize($('params').innerHTML);
		
		/* function */
		this.update = function() {
			
			this.params['val_gewerbe'] = this.params['val_gewerbe'] ? parseFloat(this.params['val_gewerbe']) : 1 ;
			
			this.upe = $('upe').value;
			this.upe = this.upe.replace(/\./g, "");
			this.upe = this.upe.replace(/,/g, ".");
			
			this.abp = this.params['forumla_rabatt'];
  		this.abp = this.abp.replace(new RegExp("UPE", "g"), parseFloat(this.upe));
			this.abp = eval(this.abp);
			
			/* gewerbetreibend */
			if($('gewerbetreibend').checked)
				this.abp = this.abp - (parseFloat(this.upe) - parseFloat(this.upe) * this.params['val_gewerbe']);
			
			/* put in html */
			if (parseFloat(this.upe) < this.abp || this.upe == "") {
				$('abp').innerHTML = "0 &euro;";
				$('sie_sparen').innerHTML = "0 &euro;";
			} else {
				$('abp').innerHTML = number_format(this.abp, 0, "",".") + " &euro;";
				$('sie_sparen').innerHTML = number_format(this.upe - this.abp, 0, "",".") + " &euro;";
			}
		}
		
		/* function */
		this.checkSending = function() {
			
			if (document.forms[0].upe.value == "") {
				alert("Bitte tragen Sie zuerst den Gesamtpreis ein.");
				return false; 
			}
			
			if (document.forms[0].configuration.value == "") {
				alert("Bitte wählen Sie die Datei mit Ihrer Fahrzeugkonfiguration aus.");
				return false; 
			}
		}
		
  	/* function */
  	this.carcredit = function (link) {
  		
			if ($('upe').value == "") {
				alert("Bitte geben Sie zuerst den Gesamtpreis ein.");
				return;
			}
			
			this.upe = $('upe').value;
			this.upe = this.upe.replace(/\./g, "");
			this.upe = this.upe.replace(/,/g, ".");
			
			this.abp = this.params['forumla_rabatt'];
  		this.abp = this.abp.replace(new RegExp("UPE", "g"), parseFloat(this.upe));
			this.abp = eval(this.abp);
  		
			window.open(link.replace(/CAR_ABP/g, this.abp),'','');
			
  	}
	}
	
	/* auto-best-preis.de */
	abpDetailsForm = function() {
		
		this.params = PHP_Unserialize($('params').innerHTML);
		
		if (this.params['val_gewerbe'] == null)
			$('cell_gewerbetreibend').style.display = 'none';
		
		/* function */
		this.update = function() {
			
			/* floatval */
			this.params['val_abp'] = parseFloat(this.params['val_abp']);
			this.params['val_price'] = parseFloat(this.params['val_price']);
			this.params['val_gewerbe'] = this.params['val_gewerbe'] ? parseFloat(this.params['val_gewerbe']) : 1 ;
			
			this.abp = this.params['forumla_rabatt'];
  		this.abp = this.abp.replace(new RegExp("UPE", "g"), this.params['val_price']);
			this.abp = eval(this.abp);
			
			if($('gewerbetreibend').checked)
				this.abp = this.abp - (this.params['val_price'] - this.params['val_price'] * this.params['val_gewerbe']);
			
			
			/* put in html */
			$('abp').innerHTML = number_format(this.abp, 0, "",".") + " &euro;";
			$('sie_sparen').innerHTML = number_format(this.params['val_price'] - this.abp + 500, 0, "",".") + " &euro;";
			
		}
		
		/* function */
		this.order = function(page_id, cat_id, car_id) {
			
			var gewerbe = ($('gewerbetreibend').checked ? "&gewerbe=1" : "")
			document.location.href = "index.php?page_id=" + page_id + "&cat_id=" + cat_id + "&car_id=" + car_id + "&order" + gewerbe;
		
		}
	}
	
	
	
	
	/* auto-best-preis.de */
	var abpOffersObj = new Array();
	
	abpOffers = function(offer, page_id) {
		
		// init reload
		setTimeout("abpOffersObj[" + offer + "].reload(" + offer + ", " + page_id + ")", 1000 * 8 + 1000 * offer);
		
		/* function */
		this.reload = function(offer, page_id) {
			
			var xmlhttp = Ajax.createAJAX();
			
  		with(xmlhttp) {
  			
				onreadystatechange = function() {
					
					if (xmlhttp.readyState != 4)
						return;
					
					// put to html
					$('offer_' + offer).innerHTML = decode_base64(xmlhttp.responseText);
					
					// init reload
					setTimeout("abpOffersObj[" + offer + "].reload(" + offer + ", " + page_id + ")", 1000 * 8);
					
				};
				
        open("get", "index.php?page_id=" + page_id + "&PHPSESSID=" + $('PHPSESSID').innerHTML + "&random");
      	send("");
				
    	}
		}
		
	}
	
	/* auto-best-preis.de */
	function abp_search(page_id) {
		if ($('search_field').value.length < 4) {
			alert("Bitte geben Sie mindestens 3 Zeichen ein.");
			return;
		}
		document.location.href= 'index.php?page_id=' + page_id + '&search=' + encode_base64($('search_field').value);
	}
	
	/* auto-best-preis.de */
	function abp_search_check(event, page_id) {
		
		if(event.keyCode == 13)
			abp_search(page_id)
	
	}
	
	/* auto-best-preis.de */
	var mouseX, mouseY;
	function abp_tooltipp(page_id) {
		
		mouseX = window.event.x;
		mouseY = window.event.y;
		
		var xmlhttp = Ajax.createAJAX();
		with(xmlhttp) {
  			
  		onreadystatechange = function() {
  			if (xmlhttp.readyState != 4)
  				return;
  			
  			$('tooltipp').innerHTML =  xmlhttp.responseText;
  			$('tooltipp').style.display =  "inline";
				
  			$('tooltipp').style.left = mouseX;
  			$('tooltipp').style.top = mouseY + 5;
  			
  		};
  		
      open("get", "index.php?lan_id=1&page_id=" + page_id);
  		send("");
		
  	}
		
	}
	
	
	/* orchidee */
	function MenuShow(page_id) {
		if ($('menu2_' + page_id))
			$('menu2_' + page_id).style.display = 'inline';
	}
	function MenuHide(page_id) {
		if ($('menu2_' + page_id))
			$('menu2_' + page_id).style.display = 'none';
	}
	
	/* orchidee */
	function cookie_save() {
		
		if (!document.tbl_order)
			return;
		
		var FORM	 = document.tbl_order;
		
		for (var num = 0; num < FORM.length; num++)
			document.cookie = FORM[num].name + "=" + FORM[num].value + ";";
		
	}
	
	
	/* orchidee */
	function cookie_load() {
		
  	var COOKIE = document.cookie.split(";");
  	
  	for (var cn = 0; cn < COOKIE.length; cn++) {
  		
  		var TEMP 				= COOKIE[cn].split("=");
  		var TEMP_COOKIE = TEMP[0].replace(/ /, "");
  		
  		if (document.getElementById(TEMP_COOKIE) && TEMP[1] && document.getElementById(TEMP_COOKIE).type != 'hidden')
  			eval('document.tbl_order.' + TEMP_COOKIE + '.value = "' + TEMP[1] + '";');
  	
  	}
  }
	
	
	/* orchidee */
	function $(id) {
		if (document.getElementById(id))
			return document.getElementById(id);
	}
	
	function MoveBanner() {
		$('Banner').style.left = (parseInt($('Banner').style.left) + 10) + "px";
		if(parseInt($('Banner').style.left)+10 >= 50) {
			$('Banner').style.left = "50px";
			return;
		}
		setTimeout("MoveBanner()", 20);
	}	