

 var isIEBr        = 0;

 function Browser()
 {
	var ua, s, i;

	this.isIE    = false;  // Internet Explorer
	this.isNS    = false;  // Netscape
	this.version = null;

	ua = navigator.userAgent;

	s = "MSIE";
	if ((i = ua.indexOf(s)) >= 0)
	{
		this.isIE = true;
		this.version = parseFloat(ua.substr(i + s.length));
		return;
	}

	s = "Netscape6/";
	if ((i = ua.indexOf(s)) >= 0)
	{
		this.isNS = true;
		this.version = parseFloat(ua.substr(i + s.length));
		return;
	}

	s = "Gecko";
	if ((i = ua.indexOf(s)) >= 0)
	{
		this.isNS = true;
		this.version = 6.1;
		return;
	}
 }

 var browser = new Browser();


 function setCarForm(mode)
 {
	if( document.getElementById('autoKontakt').style.display == "none" )
	{
		document.getElementById('autoKontakt').style.display    = "block";
		document.getElementById('autoKontakt').style.visibility = "visible";
	} else
	  {
		document.getElementById('autoKontakt').style.display    = "none";
		document.getElementById('autoKontakt').style.visibility = "hidden";
	  }
 }


 function setImage(fahrzeug, nummer)
 {
	document.getElementById('bild_0').src = 'showPicture.php?fahrzeug='+fahrzeug+'&vorschau=0&nummer='+nummer;
 }


 function suchTreffer_callback()
 {
	if( xhttp.readyState != 4 || xhttp.status != 200 )
	{
		return;
	}

	var neuerInhalt = xhttp.responseText;

	document.getElementById('preNum').innerHTML = neuerInhalt;
 }


 function schnellSuche_callback()
 {
	if( xhttp.readyState != 4 || xhttp.status != 200 )
	{
		return;
	}

	var neuerInhalt = xhttp.responseText;

	document.getElementById('modell').length = 0;

	var teile = neuerInhalt.split("|||");

	for( i = 0; i < teile.length; i++ )
	{
		if( teile[i] != "" )
		{
			var subTeile = teile[i].split("###");
			if( i == 0 )
			{
				document.getElementById('modell').options[document.getElementById('modell').length] = new Option(subTeile[1], subTeile[0], false, true);
			} else
			  {
				document.getElementById('modell').options[document.getElementById('modell').length] = new Option(subTeile[1], subTeile[0], false, false);
			  }
		}
	}

	document.getElementById('modell').disabled = false;
 }


 function initAjax()
 {
	// Ajax
	if( window.ActiveXObject )
	{
		try
		{
			// IE 6.0
			xhttp = new ActiveXObject("Msxml2.XMLHTTP");
			isIEBr = 1;
		} catch(e)
		  {
			// IE 5.x
			try
			{
				xhttp = new ActiveXObject("Microsoft.XMLHTTP");
				isIEBr = 1;
			} catch(e)
			  {
				xhttp = false;
			  }
		  }
	} else
		if( window.XMLHttpRequest )
		{
			// Mozilla, Opera, Safari
			try
			{
				xhttp = new XMLHttpRequest();
			} catch(e)
			  {
				xhttp = false;
			  }
		}
 }


 function init()
 {
	initAjax();
 }
