
	//Das Objekt, das gerade bewegt wird.
	var dragobjekt = null;
	// Position, an der das Objekt angeklickt wurde.

	var dragx = 0;
	var dragy = 0;

	// Mausposition
	var posx = 0;
	var posy = 0;
	var posx1 = 0;
	var posy1 = 0;
	var positionen = {left:0, top:0};
	var borderstyle = '';

	// Scrollen von DIVs
	animate		= false;
	kollision	= false;
	leftvar		= 0;
	topvar		= 0;
	outerw		= 0;
	outerh		= 0;
	leftstep	= 2;	// Geschwindigkeit nach links & rechts
	topstep		= 2;	// Geschwindigkeit nach oben & unten

	//layer anordnung
	var enabledBoxes = new Array();
	var zetti = 999;
	
	var delayed = false;
	
	function findTop(obj) {						
		var curtop = 0;
		
		obj=document.getElementById(obj);

		if (obj) {
			if (obj.offsetParent) {
				do {
					curtop += obj.offsetTop;
				} while (obj = obj.offsetParent);
			}
		}
		
		return curtop;
	}											
	
	function ShowCategoryMenu(current,offset) {
		
		var menu='';
		
		if (document.getElementById('specialcategory_comfort') && current!='specialcategory_comfort') {
			menu=menu+'<a href="javascript: window.scrollTo(0,0);"><b>>&nbsp;Komfort und besondere Pakete</b></a><div style="height:6px; width:1px;"></div>';
		}
		
		if (document.getElementById('specialcategory_internal') && current!='specialcategory_internal') {
			menu=menu+'<a href="javascript: window.scrollTo(0,findTop(\'specialcategory_internal\')-16+'+offset+');"><b>>&nbsp;Ausstattungen innen</b></a><div style="height:6px; width:1px;"></div>';
		}
		
		if (document.getElementById('specialcategory_external') && current!='specialcategory_external') {
			menu=menu+'<a href="javascript: window.scrollTo(0,findTop(\'specialcategory_external\')-16+'+offset+');"><b>>&nbsp;Ausstattungen au&szlig;en</b></a><div style="height:6px; width:1px;"></div>';
		}	
		
		if (document.getElementById('specialcategory_secure') && current!='specialcategory_secure') {
			menu=menu+'<a href="javascript: window.scrollTo(0,findTop(\'specialcategory_secure\')-16+'+offset+');"><b>>&nbsp;Sicherheit</b></a><div style="height:6px; width:1px;"></div>';
		}	
		
		if (document.getElementById('specialcategory_media') && current!='specialcategory_media') {
			menu=menu+'<a href="javascript: window.scrollTo(0,findTop(\'specialcategory_media\')-16+'+offset+');"><b>>&nbsp;Multimedia</b></a><div style="height:6px; width:1px;"></div>';
		}
		
		if (document.getElementById('specialcategory_wheels') && current!='specialcategory_wheels') {
			menu=menu+'<a href="javascript: window.scrollTo(0,findTop(\'specialcategory_wheels\')-16+'+offset+');"><b>>&nbsp;Bereifung und Felgen</b></a><div style="height:6px; width:1px;"></div>';
		}		
		
		if (document.getElementById('specialcategory_misc') && current!='specialcategory_misc') {
			menu=menu+'<a href="javascript: window.scrollTo(0,findTop(\'specialcategory_misc\')-16+'+offset+');"><b>>&nbsp;Weitere Ausstattungen und Zubeh&ouml;r</b></a><div style="height:6px; width:1px;"></div>';
		}	
		
		if (menu.length>0 && document.getElementById('category_window')) {
			menu='Gehe zu Ausstattungen:<br><br>'+menu;
			invisible("category_window");
			inserthtml("category_window",menu);
			visible("category_window");		
		}
	}
	
	function hasSpecialCategories() {
		var r=false;
		if (document.getElementById('specialcategory_comfort') || document.getElementById('specialcategory_internal') || document.getElementById('specialcategory_external') || document.getElementById('specialcategory_secure') || document.getElementById('specialcategory_media') || document.getElementById('specialcategory_wheels') || document.getElementById('specialcategory_misc')) {
			r=true;
		}
		return r;
	}
	
	function SwitchUser(user) {
		var url=document.location.href;
		if (url.indexOf('configstatus=tree')>-1) {
			
			
			var cid=document.getElementById('configurationids').value+'|0';
			var cst=document.getElementById('configstep').value;
			var cls=document.getElementById('lastselection').value;
							   

			//Letzes Konfigurationselement löschen
			
			if (cid.length>0) {
				cid=cid.split('|');	
				
				var s='';
				for (var n=0;n<(cid.length-1);n++) {
					if (s.length>0) {
						s=s+'|';
					}
					s=s+cid[n];
				}				
				cid=s;
			}
			
			if (cst.length>0) {
				cst=cst-1;
			}
			
			if (cls.length>0) {
				cls=cls.substring(0,cls.length-1);
			}
			
			for (var n=0;n<document.configuration.length;n++) {
				if (document.configuration.elements[n].type=='radio') {
					document.configuration.elements[n].checked=false;			
				}
			}	
			
			document.getElementById('configurationids').value=cid;
			document.getElementById('configstep').value=cst;
			document.getElementById('lastselection').value=cls;
			document.getElementById('state').value=user;			
			
			loadingWin(1);
			document.configuration.submit();
			
		} else if (url.indexOf('configstatus=special')>-1) {
			document.getElementById('state').value=user;			
			if (document.getElementById('orderstatus').value=='compare') {				
				document.configuration.ypos.value=window.pageYOffset;
				checkCalcState('compare','','_self',true);
			} else if (document.getElementById('orderstatus').value=='order') {
				loadingWin(1);
				document.configuration.entrysubmit.value='yes';
				document.configuration.anfragetyp.value='';				
				document.configuration.submit();				
			} else {
				checkCalcState('calc','','_self',true);
			}
		}
	}
	
	function autoClickFirst() {
		var url=document.location.href;
		if (url.indexOf('configstatus=tree')>-1) {
			for (var n=0;n<document.configuration.length;n++) {
				if (document.configuration.elements[n].type=='radio') {
					if (document.configuration.elements[n].checked==true) {
						document.configuration.elements[n].click();
						break;
					}
				}
			}
		}
	}
	
	function autoCheckFirst() {
		var url=document.location.href;
		if (url.indexOf('configstatus=tree')>-1) {
			for (var n=0;n<document.configuration.length;n++) {
				if (document.configuration.elements[n].type=='radio') {
					document.configuration.elements[n].checked=true
					document.configuration.elements[n].click();
					break;
				}
			}
		}
	}
		
	
	function delayedCalc() {
		if (delayed==false) {
			delayed=true;
			setTimeout("checkCalcState('calc','','_self',true);", 600);
		} else {
			checkCalcState('calc','','_self',true);
		}
	}
	
	function format(zahl, TZ)
	{
		if(!TZ) TZ = '.';
		var new_string = [];
		var tmp = parseInt(zahl) + '';
		while( tmp.length > 3)
		{
			new_string[new_string.length] = tmp.substr(tmp.length - 3 ) ;
			tmp = tmp.substr(0, tmp.length -3 )
		}
		if(tmp)  new_string[new_string.length] = tmp;
		return new_string.reverse().join(TZ);
	}	
	
	function getWindowHeight() {   
		var win = window;   
		if (win.innerHeight) {   
			return win.innerHeight;   
		} else {   
			if (win.document.documentElement && win.document.documentElement.clientHeight) {   
				return win.document.documentElement.clientHeight;   
			}   
			return win.document.body.offsetHeight;   
		}   
	}  	
	
	function getScrollY() {
		var scrOfY = 0;
	 
		if( typeof( window.pageYOffset ) == 'number' ) {
			//Netscape compliant
			scrOfY = window.pageYOffset;
		} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
			//DOM compliant
			scrOfY = document.body.scrollTop;
		} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
		   //IE6 standards compliant mode
			scrOfY = document.documentElement.scrollTop;
		}
		return scrOfY;
	}	
		
	function ShowTypeImage(filepath) {
		var y=0;
		if (document.getElementById('info_window')) {
			document.getElementById('info_window').innerHTML='<img src="'+filepath+'" WIDTH=300 HEIGHT=200 />';
			
			if (navigator.appName == "Microsoft Internet Explorer") {
				LayerPosition(document.getElementById('info_window').onmouseup);				
			} else {
				LayerPosition(document.onmouseup);				
			}
			document.getElementById('info_window').style.overflow='hidden';
			visible('info_window');

			if ((document.getElementById('info_window').offsetTop+document.getElementById('info_window').offsetHeight)-getScrollY() > getWindowHeight()) {
				y=document.getElementById('info_window').offsetHeight+(document.getElementById('info_window').offsetTop-getWindowHeight()-getScrollY());
				document.getElementById('info_window').style.top=(document.getElementById('info_window').offsetTop-y-12)+'px';						
			}
		}
	}
	
	function HideTypeImage() {
		if (document.getElementById('info_window')) {
			invisible('info_window');
		}
	}	
	
	function HasSpecialElements() {
		var result=false;	
		for (var i = 0; i < document.configuration.length; i++) {
			if (document.configuration.elements[i].type=='checkbox') {
				result=true;
				break;				
			}
		}	
		
		return result;
	}

	function ElementSelected() {
		var result=false;		
		
		for (var i = 0; i < document.configuration.length; i++) {
			if (document.configuration.elements[i].type=='radio' && document.configuration.elements[i].checked==true) {
				result=true;
				break;
			} else if (document.configuration.elements[i].type=='checkbox') {
				result=true;
				break;				
			}
		}

		if (result==false) {
			loadingWin(0);
			alert('Bitte entscheiden Sie sich zunächst für eine der aufgeführten Ausstattungen.');			
		}
		
		return result;
	}
	

	function SendGenericMail(mailfrom, name, text) {
			if (name == '') {
				alert('Bitte geben Sie Ihren Name ein.');
				return;
			}
			if (mailfrom == '') {
				alert('Bitte geben Sie Ihre E-Mail Adresse ein.');
				return;
			}
			if (text == '') {
				alert('Bitte geben Sie Ihre Frage ein.');
				return;
			}
			loadingWin(1);
			document.configuration.target='embframe';
			document.configuration.orderstatus.value='ask_mail';
			document.configuration.submit();
			document.configuration.target='';
			document.configuration.orderstatus.value='';
	}

	function PrintConfiguration(codebefore, codeafter, useprint2, windowwidth) {
		if (windowwidth) {
		} else {
			windowwidth=680;
		}
		nw = window.open("about:blank", "PrintWindow", "width="+windowwidth+",height=750,resizable=no,scrollbars=yes");
		if (!nw) {
			alert("Um diese Funktion nutzen zu können, müssen Sie Popups für diese Seite zulassen.");
		} else {
			nw.focus();

			var ostatus=document.configuration.orderstatus.value;

			document.configuration.orderstatus.value='order';
			document.configuration.printstate.value='1';

			if (useprint2==true) {
				document.configuration.printstate.value='2';
			}

			document.configuration.target='PrintWindow';
			loadingWin(1);

			if (codebefore) {
				if (codebefore.length>0) {
					setTimeout(codebefore,0);
				}
			}

			document.configuration.submit();

			document.configuration.printstate.value='0';
			document.configuration.orderstatus.value=ostatus;
			document.configuration.target='';
			loadingWin(0);

			if (codeafter) {
				if (codeafter.length>0) {
					setTimeout(codeafter,0);
				}
			}
		}
	}

	function ShowCurrentCarLink() {
		nw = window.open("about:blank", "LinkWindow", "width=750,height=275");
		if (!nw) {
			alert("Um diese Funktion nutzen zu können, müssen Sie Popups für diese Seite zulassen.");
		} else {
			nw.focus();

			document.configuration.orderstatus.value='linknow';
			document.configuration.target='LinkWindow';
			loadingWin(1);

			document.configuration.submit();

			document.configuration.orderstatus.value='';
			document.configuration.target='';
			loadingWin(0);
		}
	}

	function SaveCurrentCarLink() {
		document.configuration.orderstatus.value='savelinknow';
		loadingWin(1);
		document.configuration.submit();
	}

	function CheckLinkedOptionalIds(ids) {
		var data = ids.split("|");
		var l=document.getElementById("configuration").elements.length;
		for (var i = 0; i < l; ++i) {
			if (document.getElementById("configuration").elements[i].type=="checkbox") 	{
				for (var j = 0; j < data.length; ++j) {
					if (document.getElementById("configuration").elements[i].id=="c"+data[j]) 	{
						if (document.getElementById("configuration").elements[i].checked==false) {
							document.getElementById("configuration").elements[i].checked=true;
						}
					}
				}
			}
		}
	}

	function HideSpecialWindow()
	{
		invisible("special_window");
		if (borderstyle != '')
		{
			document.getElementById("special_window").style.border = borderstyle;
		}
		FreeEquipSelection();

	}
	// Layer "Anfrage wird verarbeitet" / "Konfiguration wird bearbeitet" ein- / ausblenden
	function loadingWin(todo)
	{
		if (todo == 1)
		{
			var scrollPos;
			if (typeof window.pageYOffset != 'undefined') {
				scrollPos = window.pageYOffset;
			}
			else if (typeof document.compatMode != 'undefined' &&
				document.compatMode != 'BackCompat') {
				scrollPos = document.documentElement.scrollTop;
			}
			else if (typeof document.body != 'undefined') {
			scrollPos = document.body.scrollTop;
			}

			document.body.style.overflow = "hidden";
			window.scrollTo(0,scrollPos);
			document.getElementById("loading_window").style.left = 0 + "px";
			document.getElementById("loading_window").style.top = scrollPos + "px";
			document.getElementById("loading_window").style.right = 0  + "px";
			document.getElementById("loading_window").style.bottom = 0  + "px";
			document.getElementById("loading_window").style.width =   "100%";
			document.getElementById("loading_window").style.height =   "100%";
			visible("loading_window");
			//document.getElementById("loading_window").style.visibility = "visible";
			//document.getElementById("loading_window").style.display = "block";
		}
		else if (todo == 0)
		{
			document.body.style.overflow = "auto";
			invisible("loading_window");
			//document.getElementById("loading_window").style.visibility = "hidden";
			//document.getElementById("loading_window").style.display = "none";
		}
	}

	// Initialisierung der Überwachung der Events (Drag/Drop)
	function draginit()
	{
		document.onmousemove = drag;
		document.onmouseup = dragstop;
	}

	//Wird aufgerufen, wenn ein Objekt bewegt werden soll.
	function dragstart(element)
	{
		dragobjekt = element;
		zetti = (zetti + 10);
		dragobjekt.style.zIndex = zetti;
		dragx = posx - dragobjekt.offsetLeft;
		dragy = posy - dragobjekt.offsetTop;
	}

	//Wird aufgerufen, wenn ein Objekt nicht mehr bewegt werden soll.
	function dragstop()
	{
		dragobjekt=null;
	}

	//Wird aufgerufen, wenn die Maus bewegt wird und bewegt bei Bedarf das Objekt.
	function drag(ereignis)
	{
		posx = document.all ? window.event.clientX : ereignis.pageX;
		posy = document.all ? window.event.clientY : ereignis.pageY;
		if(dragobjekt != null)
		{
			dragobjekt.style.left = (posx - dragx) + "px";
			dragobjekt.style.top = (posy - dragy) + "px";
		}
	}

	// Mausposition ermitteln (InternetExploiter kompatibel)
	function mouse_pos(event)
	{
		if(!event)
		{
			event = window.event;
		}
		positionen.left = event.pageX ? event.pageX : event.clientX;
		positionen.top = event.pageY ? event.pageY : event.clientY;
		if (navigator.appName == "Microsoft Internet Explorer")
		{
			// Der IE 6 braucht wie immer eine Sonderbehandlung
			if(document.compatMode && document.compatMode == "BackCompat")
			{
				// der IE 6 im Quirks-(BackCompat) Modus...
				positionen.left +=  document.body.scrollLeft;
				positionen.top += document.body.scrollTop;
			}
			else if (document.compatMode && document.compatMode == "CSS1Compat")
			{
				// der IE 6 im CSS1Compat Modus...
				positionen.left += document.documentElement.scrollLeft;
				positionen.top += document.documentElement.scrollTop;
			}
			else if (document.body)
			{
				// kein IE 6 also ein noch älteres / fehlerhaftes Teil
				positionen.left += document.body.scrollLeft;
				positionen.top += document.body.scrollTop;
			}
		}
		else
		{
			posx1 = document.all ? window.event.clientX : event.pageX;
			posy1 = document.all ? window.event.clientY : event.pageY;
		}
	}

	// Positionieren des DIVs bei Mausclick
	function LayerPosition(ereignis)
	{
		mouse_pos(ereignis);
		if (navigator.appName == "Microsoft Internet Explorer")
		{ 
			if (document.getElementById("info_window")) {
				document.getElementById("info_window").style.left = (positionen.left - 10) + "px";
				document.getElementById("info_window").style.top = (positionen.top - 10)  + "px";
			}
			
			if (document.getElementById("category_window")) {
				if (document.getElementById("category_window").style.visibility=="hidden") {
					document.getElementById("category_window").style.left = (positionen.left - 10) + "px";
					document.getElementById("category_window").style.top = (positionen.top - 10)  + "px";
				}
			}			
			
			if (document.getElementById("enduser_car_menu")) {
				document.getElementById("enduser_car_menu").style.left = (positionen.left - 10) + "px";
				document.getElementById("enduser_car_menu").style.top = (positionen.top - 10)  + "px";			
			}
		}
		else
		{
			if (document.getElementById("info_window")) {
				document.getElementById("info_window").style.left = (posx - 10) + "px";
				document.getElementById("info_window").style.top = (posy - 10)  + "px";
			}
			
			if (document.getElementById("category_window")) {
				if (document.getElementById("category_window").style.visibility=="hidden") {
					document.getElementById("category_window").style.left = (posx - 10) + "px";
					document.getElementById("category_window").style.top = (posy - 10)  + "px";
				}
			}			
			
			if (document.getElementById("enduser_car_menu")) {
				document.getElementById("enduser_car_menu").style.left = (posx - 10) + "px";
				document.getElementById("enduser_car_menu").style.top = (posy - 10)  + "px";			
			}
		}
	}

	// DIV ausblenden
	function invisible(elementid) {
		if (document.getElementById(elementid)) {	
			if (elementid == 'special_window') {
				if (borderstyle != '') {
					document.getElementById("special_window").style.border = borderstyle;
					document.getElementById("special_windowredtext").innerHTML = '';
				}
			}
			document.getElementById(elementid).style.visibility = "hidden";
			document.getElementById(elementid).style.display = "none";
		}
	}

	// DIV einblenden
	function visible(elementid)	{
		if (document.getElementById(elementid)) {	
			if (elementid == 'special_window') {			
				if ((positionen.left<0 || positionen.top<0) || positionen.left=='' || positionen.top=='') {
					if (document.innerWidth) {
						if (document.innerWidth>0) {
							document.getElementById("special_window").style.left = (Math.round(document.innerWidth/2)-200) + "px";
						} else {
							document.getElementById("special_window").style.left = "100px";
						}
					} else {
						document.getElementById("special_window").style.left = "100px";
					}
					document.getElementById("special_window").style.top = "150px";
					window.scrollTo(0, 0);
				} else {
					document.getElementById("special_window").style.left = (positionen.left - 30) + "px";
					document.getElementById("special_window").style.top = (positionen.top - 30)  + "px";
				}
				document.getElementById("special_windowredtext").innerHTML = "<div style=\"color:green;\">"+jstxt[1]+"</div><br />";
				document.getElementById("special_window").style.border = 'solid green 1px';
			}
			zetti=zetti+10;
			document.getElementById(elementid).style.zIndex=zetti;
			document.getElementById(elementid).style.visibility = "visible";
			document.getElementById(elementid).style.display = "block";
		}
	}

	// DIV mit Inhalt füllen
	function inserthtml(elementid,message)
	{
		document.getElementById(elementid).innerHTML = message;
	}

	// DIV leeren
	function clearhtml(elementid)
	{
		document.getElementById(elementid).innerHTML = '';
	}

	// MouseMove Event verwalten
	function handleMove (ev)
	{
		if (!ev)
		{
			ev = window.event;
		}
		mouse_pos(ev);
	}

	// Mausbewegung verfolgen
	function Event_init ()
	{
		if (document.addEventListener)
		{
			document.addEventListener("mousemove", handleMove, true);
		}
		else
		{
			document.body.onmousemove = handleMove;
		}
	}

	function BlockEquipSelection() {
		var l=document.getElementById("configuration").elements.length;
		for (var i = 0; i < l; ++i) {
			if (document.getElementById("configuration").elements[i].type=="checkbox") 	{
				document.getElementById("configuration").elements[i].style.display="none";
				document.getElementById("configuration").elements[i].style.visibility="hidden";
			}
		}
	}

	function FreeEquipSelection() {
		var l=document.getElementById("configuration").elements.length;
		for (var i = 0; i < l; ++i) {
			if (document.getElementById("configuration").elements[i].type=="checkbox") 	{
				document.getElementById("configuration").elements[i].style.display="block";
				document.getElementById("configuration").elements[i].style.visibility="visible";
			}
		}
	}

	function PrepareOptionalIDs() {
		var l=document.getElementById("configuration").elements.length;
		for (var i = 0; i < l; ++i) {
			if (document.getElementById("configuration").elements[i].type=="checkbox") 	{
				if (document.getElementById("configuration").elements[i].checked==true && document.getElementById("configuration").elements[i].disabled==true) {
					document.getElementById("configuration").elements[i].disabled=false;
				}
			}
		}
	}

	function CheckMultiselectPartners() {
		var l=document.getElementById("configuration").elements.length;
		for (var i = 0; i < l; ++i) {
			if (document.getElementById("configuration").elements[i].type=="checkbox") 	{
				var cn=document.getElementById("configuration").elements[i].name;
				if (cn.indexOf("partnerselected_")>-1) {
					if (document.getElementById("configuration").elements[i].checked==true) {
						return true;
					}
				}
			}
		}
	}

	function checkCalcState(btn, nopartnersmessage, configformtarget, silent)
	{		
		
		if (document.getElementById("special_window").style.visibility == "visible" && document.getElementById("special_window").style.display == "block")
		{
			
			if (silent!=true) {				
				document.getElementById("special_windowredtext").innerHTML = jstxt[1]+"<br /><br />";
				if (document.getElementById("special_window").style.border != 'solid red 5px')
				{
					borderstyle = document.getElementById("special_window").style.border;
				}
				document.getElementById("special_window").style.border = 'solid red 5px';
				document.getElementById("special_window").style.top = (positionen.top - 10)  + "px";
				document.getElementById("special_window").style.left = (positionen.left - 30)  + "px";
				loadingWin(0);
				alert(jstxt[0]);							
			}
			
		}
		else
		{
			if (borderstyle != '')
			{
				document.getElementById("special_window").style.border = borderstyle;
			}
			if (btn == 'calc')
			{
				if (hasSpecialCategories()!=true) {
					document.configuration.ypos.value=window.pageYOffset;
					alert('test');
				}
				document.configuration.orderstatus.value='';
			}
			else if (btn == 'final')
			{
				document.configuration.orderstatus.value='order';
			}
			else if (btn == 'mycar')
			{
				document.configuration.orderstatus.value='mycar';
			}
			else if (btn == 'compare')
			{
				document.configuration.orderstatus.value='compare';
			}
			else if (btn == 'ordercompare')
			{
				if (CheckMultiselectPartners() == true) {
					document.configuration.orderstatus.value='ordercompare';
				} else {
					alert(nopartnersmessage);
					return false;
				}
			}
			else if (btn == 'savenow')
			{
				document.configuration.orderstatus.value='savenow';
			}
			else if (btn == 'twin_new')
			{
				document.configuration.orderstatus.value='twin_new';
			}
			else if (btn == 'twin_split')
			{
				document.configuration.orderstatus.value='twin_split';
			}

			
			loadingWin(1);
			
			if (document.getElementById("configformtarget")) {
				if (configformtarget.length>0) {
					document.configuration.target=configformtarget;
				}
				
			}
					
			document.configuration.submit();
			
		}
	}

	function switchToPartner(partnerid) {
		document.configuration.partnerid.value=partnerid;
		document.configuration.ypos.value=window.pageYOffset;
		checkCalcState('final');
	}

	function setCompareSeekMode(mode) {
		document.configuration.compareseekmode.value=mode;
	}

	function setCompareSeekRequest(request) {
		document.configuration.compareseekrequest.value=request;
	}

	function doCompareSeek() {
		checkCalcState('compare','');
	}

	function arrangeCompareSeekElements() {
		if (document.configuration.rb_seekmode_0 && document.configuration.rb_seekmode_2 && document.configuration.rb_seekmode_1 && document.configuration.rb_seekmode_3) {
			if (document.configuration.rb_seekmode_0.checked==true) {
				document.configuration.menu_cities.disabled=true;
				document.configuration.menu_postcode.disabled=true;
				document.configuration.menu_provinces.disabled=true;
			} else if (document.configuration.rb_seekmode_2.checked==true) {
				document.configuration.menu_cities.disabled=true;
				document.configuration.menu_postcode.disabled=false;
				document.configuration.menu_provinces.disabled=true;
			} else if (document.configuration.rb_seekmode_1.checked==true) {
				document.configuration.menu_cities.disabled=false;
				document.configuration.menu_postcode.disabled=true;
				document.configuration.menu_provinces.disabled=true;
			} else if (document.configuration.rb_seekmode_3.checked==true) {
				document.configuration.menu_cities.disabled=true;
				document.configuration.menu_postcode.disabled=true;
				document.configuration.menu_provinces.disabled=false;
			}
		}
	}

	// Scrollen starten
	function startScroll(direction,innerelement,outerelement)
	{
		// Funktion um in alle 4 Richtungen ermöglichen
		// Breite & Höhe des Innerelements & des Outerelements müssen per CSS angegeben sein, sonnst funktioniert die Kollisionsabfrage nicht

		// Positionen des innernen DIVs auslesen
		leftvar = parseInt(document.getElementById(innerelement).style.left);
		topvar = parseInt(document.getElementById(innerelement).style.top);

		// Größen ermitteln
		outerw = parseInt(document.getElementById(outerelement).style.width);
		outerh = parseInt(document.getElementById(outerelement).style.height);
		innerw = parseInt(document.getElementById(innerelement).style.width);
		innerh = parseInt(document.getElementById(innerelement).style.height);

		// Kollisionserkennung an allen 4 Seiten
		if (direction == 'right')
		{
			// nicht nach rechts raus scrollen
			if(leftvar >= 0)
			{
				kollision = true;
			}
			else
			{
				kollision = false;
			}
		}
		else if (direction == 'left')
		{
			// nicht nach links raus scrollen
			if(leftvar <= -(innerw - outerw))
			{
				kollision = true;
			}
			else
			{
				kollision = false;
			}
		}
		else if (direction == 'up')
		{
			// nicht nach oben raus scrollen
			if(topvar <= -(innerh - outerh))
			{
				kollision = true;
			}
			else
			{
				kollision = false;
			}
		}
		else if (direction == 'down')
		{
			// nicht nach unten raus scrollen
			if(topvar >= 0)
			{
				kollision = true;
			}
			else
			{
				kollision = false;
			}
		}

		// bei Kollision bewegt sich nichts
		if (kollision == false)
		{
			// Bewebungsrichtung auslesen und berechnen
			if(direction == 'left')
			{
				document.getElementById(innerelement).style.left = (leftvar - leftstep) +'px';
			}
			else if(direction == 'right')
			{
				document.getElementById(innerelement).style.left = (leftvar + leftstep) +'px';
			}
			else if(direction == 'up')
			{
				document.getElementById(innerelement).style.top = (topvar - topstep) +'px';
			}
			else if(direction == 'down')
			{
				document.getElementById(innerelement).style.top = (topvar + topstep) +'px';
			}

			// so lange MouseOver aktiv wird gescrollt
			if (animate == true)
			{
				timeout = '';
				timeout = "startScroll('"+direction+"','"+innerelement+"','"+outerelement+"')";
				setTimeout(timeout, 25);
			}
		}
	}

	//Scrollen stoppen
	function stopScroll()
	{
		animate = false;
	}

	// Fahrzeugbilder wechseln
	function changeowncarimage(source,w,h)
	{
		document.getElementById('bigcarimage').src = source;
		document.getElementById('bigcarimage').style.width = w;
		document.getElementById('bigcarimage').style.height = h;
	}

	function SendForm() {
		document.TwinForm.action = "empfang.html";
		document.TwinForm.submit();
	}

	function ProcessPageBuild() {
		var s=frames[0].document.getElementsByTagName("html")[0].innerHTML;
		var i=s.indexOf("angebot_id");
		if (i==-1) {
			i=s.indexOf("orderstatus");
			if (i==-1) {
				location.reload();
			} else {
				document.getElementById("CarKonfigurator_MainFrame").style.visibility="visible";
				document.getElementById("CarKonfigurator_MainFrame").style.display="block";
			}
		} else {
			document.getElementById("CarKonfigurator_MainFrame").style.visibility="visible";
			document.getElementById("CarKonfigurator_MainFrame").style.display="block";
		}
	}

	function checkSubmitSearch() {
		loadingWin(1);
		if (document.search.freetext.value.length>0) {
			return true;
		} else {
			if (document.search.hsn.value.length>0 && document.search.tsn.value.length>0) {
				if (document.search.hsn.value.length!=4 || document.search.tsn.value.length!=3) {
					alert("Die Angaben zum Hersteller- und Typcode sind ungültig.\n\nDer Herstellercode muß aus 4 und der Typcode aus 3 Zeichen bestehen.\n\n");
					loadingWin(0)
				} else {
					return true;
				}
			} else if ((document.search.hsn.value.length>0 && document.search.tsn.value.length==0) || (document.search.hsn.value.length==0 && document.search.tsn.value.length>0)) {
				alert("Wenn Sie ein Fahrzeug anhand von Hersteller- und Typcodes suchen, füllen Sie bitte sowohl\ndas Eingabefeld \"HSN\" als auch das Eingabefeld \"TSN\" aus.");
				loadingWin(0);
			} else {
				alert("Bitte füllen Sie eines der Eingabefelder für Ihre Suchanfrage aus.");
				loadingWin(0);
			}
		}
		return false;
	}

	function searchSwitchHersteller() {
		var s='';
		if (document.search.action.indexOf("?")==-1) {
			s="?";
		} else {
			s="&";
		}
		document.search.action=document.search.action+s+"setparameters=1";
		document.search.submit();
	}

	//////////////////////////////////////////////
	// Leasingrechner Funktionen
	//////////////////////////////////////////////

	// Anzeige des Leasingrechners
	function changeAnzeigeLeasing() {
		if (document.configuration.leasingrechner_visibility.value == '0' || document.configuration.leasingrechner_visibility.value == '') {
			invisible('leasingrechner');
			document.getElementById('leasing_link_txt').innerHTML = 'einblenden';
			document.configuration.leasingrechner_visibility.value = '1';
		} else {
			document.getElementById('leasing_link_txt').innerHTML = 'ausblenden';
			visible('leasingrechner');
			document.configuration.leasingrechner_visibility.value = '0';
		}
	}

	// Laufzeit Hiddenfeld ändern
	function changeLaufzeitLeasing() {
		document.configuration.leasingrechner_laufzeit.value = document.configuration.laufzeit_leasing.value;
	}

	// Anzahlung Hiddenfeld ändern
	function changeAnzahlungLeasing(anzahlung_min,anzahlung_max) {
		anzahlung_min = parseFloat(anzahlung_min);
		anzahlung_max = parseFloat(anzahlung_max);
		if (document.configuration.anzahlung_leasing.value < anzahlung_min) {
			document.configuration.anzahlung_leasing.value = anzahlung_min;
		} else if (document.configuration.anzahlung_leasing.value > anzahlung_max) {
			document.configuration.anzahlung_leasing.value = anzahlung_max;
		}
		document.configuration.leasingrechner_anzahlung.value = document.configuration.anzahlung_leasing.value;
	}

	function changeAbschlussrateLeasing() {
		document.configuration.leasingrechner_abschlussrate.value = document.configuration.abschlussrate_leasing.value;
	}

	function changeRestschuldversicherungLeasing() {
		if (document.configuration.restschuldversicherung_leasing.value == 0) {
			document.configuration.restschuldversicherung_leasing.value = 1;
		} else if (document.configuration.restschuldversicherung_leasing.value == 1) {
			document.configuration.restschuldversicherung_leasing.value = 0;
		}
		document.configuration.leasingrechner_restschuldversicherung.value = document.configuration.restschuldversicherung_leasing.value;
	}

	function calcLeasing(gesamtpreis, zinssaetze_orsv, zinssaetze_mrsv, variante, restwert_prozent) {
		// Deklarieren aller wichtigen Variabeln als Grundlage der Berechnung
		var gesamtpreis = parseFloat(gesamtpreis);
		var anzahlung = document.configuration.anzahlung_leasing.value;
		//anzahlung = anzahlung.replace('.','');
		anzahlung = anzahlung.replace(',','.');
		if (anzahlung == '') {
			anzahlung = 0;
			document.configuration.anzahlung_leasing.value = 0;
		}
		anzahlung = parseFloat(anzahlung);
		var laufzeit = document.configuration.laufzeit_leasing.value;
		var rsv = document.configuration.restschuldversicherung_leasing.value;
		var zinssatz = '';
		var rate_start = '';
		var rate_monat = '';
		var leasingpreis = '';

		// Variante der Berechnung wählen je nach Kundenwunsch
		if (variante == 1) {
			var abschlussrate = document.configuration.abschlussrate_leasing.value;
			abschlussrate = abschlussrate.replace('.',"");
			abschlussrate = abschlussrate.replace(',','.');
			if (abschlussrate == '') {
				abschlussrate = 0;
				document.configuration.abschlussrate_leasing.value = 0;
			}
			abschlussrate = parseFloat(abschlussrate);
		} else if (variante == 2) {
			var restwert = document.getElementById('restwert_leasing').innerHTML;
			restwert = restwert.replace('€',"");
			restwert = restwert.replace(' ',"");
			restwert = restwert.replace('.',"");
			restwert = restwert.replace(',','.');
			restwert = parseFloat(restwert);
		}

		// Entsprechenden Zinssatz aus den Arrays filtern
		if (document.configuration.restschuldversicherung_leasing.value == 1) {
			zinssatz = zinssaetze_mrsv[laufzeit];
		} else if (document.configuration.restschuldversicherung_leasing.value == 0) {
			zinssatz = zinssaetze_orsv[laufzeit];
		}

		// Laufzeit anpassen, bei Abschlussratenvariante 1 Monat Abzug
		if (variante == 1) {
			laufzeit = laufzeit - 1;
		}

		// Leasingpreis errechnen auf Grundlage der Berechnungsvariante
		if (variante == 1) {
			leasingpreis = gesamtpreis - anzahlung - abschlussrate;
		} else if (variante == 2) {
			leasingpreis = gesamtpreis - anzahlung - restwert;
		}

		zinsen_monatlich = 0;
		zinsen_gesamt = 0;
		rate_start = leasingpreis/laufzeit;

		for (i=1; i <= laufzeit; i++) {
			zinsen_monatlich = (leasingpreis/12)*(zinssatz/100);
			zinsen_gesamt = zinsen_gesamt+zinsen_monatlich;
			leasingpreis = leasingpreis-rate_start;
		}

		// Leasingpreis errechnen auf Grundlage der Berechnungsvariante
		if (variante == 1) {
			leasingpreis = gesamtpreis - anzahlung - abschlussrate;
		} else if (variante == 2) {
			leasingpreis = gesamtpreis - anzahlung - restwert;
		}

		rate_monat = (leasingpreis+zinsen_gesamt)/laufzeit;

		document.getElementById('rate_leasing').innerHTML = rate_monat.toFixed(2).replace(".", ",") + ' €';
		document.getElementById('zinssatz_leasing').innerHTML = '' + zinssatz + '% eff. Jahreszins';
		document.getElementById('leasingpreis_leasing').innerHTML = format(leasingpreis.toFixed(2)) + ' €';
	}
	
	function ExpandOverviewTable(framenumber, url) {
		if (framenumber!=-1) {
			parent.frames[framenumber].location.href=url;
			if (framenumber==1) {
				parent.frames[2].location.href='about:blank';
				parent.frames[3].location.href='about:blank';			
			}
			if (framenumber==2) {
				parent.frames[3].location.href='about:blank';			
			}			
		} else {
			window.location.href=url;
		}
	}

	function ShowEnduserCarMenu(hersteller,typ,config,basiclink,completelink,imagepath)
	{
		var infomessage = '<div onmousedown="if (document.getElementById("enduser_car_menu")) {invisible(\'enduser_car_menu\');}"><b>Mein&nbsp;'+hersteller+'&nbsp;'+typ+'</b><br><br>'+config+'<br><br><br><img src="'+imagepath+'menu_arrow.gif" /><a href="#" onmousedown="var test=\''+completelink+'\'; if (test.length>0) {window.location.href=\''+completelink+'&noreg=1\';} else {if (confirm(\'Das Fahrzeug hat sich seit Ihrer letzten Zusammenstellung geändert, wodurch das Aufrufen Ihrer Fahrzeugkonfiguration nicht mehr möglich ist. Möchten Sie das Fahrzeug jetzt neu zusammenstellen ?.\')==true) {window.location.href=\''+basiclink+'&noreg=1\';} }"><b>Meine Zusammenstellung öffnen...</b></a><br><br><img src="'+imagepath+'menu_arrow.gif" /><a href="#" target="_blank" onmousedown="window.location.href=\''+basiclink+'&noreg=1\';"><b>Dieses Fahrzeug neu zusammenstellen...</b></a>';

		if (infomessage != "")
		{
			if (document.getElementById("enduser_car_menu")) {
				invisible("enduser_car_menu");
				inserthtml("enduser_car_menu",infomessage);
				visible("enduser_car_menu");
			}
		}
	}


	// Events
	document.onmousedown = LayerPosition;
	document.onmouseup = LayerPosition;
	
	
	