var xmlHttp;
function showUser(str, type, pagina, dealer_id)
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request");
 return;
 }
var url="get_ir.php";
url=url+"?id="+str;
url=url+"&type="+type;
url=url+"&pagina="+pagina;
url=url+"&dealer_id="+dealer_id;

if(type == 'merk')
{
	soort = document.getElementById('soort').value;
	url=url+"&soort="+soort;
}
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 array = new Array();
 array =  xmlHttp.responseText.split("@");
  
 array[0] =  array[0].split("|");
 
 if(array[0][1] != '')
 {
	 pagina = array[0][1];
	 array[0] = array[0][0];	 
 }
 totaal = array.length;
 if(array[0] == "merk") 
 { 
		i = 1;
		while (i < totaal)
		{
			array[i] = array[i].split("|");
			i++;
		}
 }

 if(array[0] == "type")
 {
	//document.print(array[1]);
	document.getElementById("specs").innerHTML = array[1];
 }
 else
 {
	 if(array[0] == "soort") 
	 {
		 selbox = document.formName.merk;
		 if(!pagina) document.formName.type.options.length = 0;
		 document.getElementById("specs").innerHTML = "";
		 selbox.options.length = 0;
		 selbox.options[selbox.options.length] = new Option("Kies een merk"," ");
		 if(!pagina) document.formName.type.options[document.formName.type.options.length] = new Option("Kies eerst een merk"," ");
		 i = 1;
		 while (i < totaal)
		 {
			 selbox.options[selbox.options.length] = new Option(array[i],array[i]);
			 i++;
		 }
	 }
	 else if(array[0] == "merk" && pagina == 'dealers') 
	 {
		 inhoud = '';
		 inhoud = inhoud+'<form action="dealers.php?page=toevoegen" method="post">';
		 i = 1;
		 
		 while (i < totaal)
		 {
			 if(array[i][2] == 'ja')
			 {
				 inhoud = inhoud+'<img src="cms/images/icons/ok.gif" alt="url_ok" border="0">&nbsp;&nbsp;' + array[i][0] + '<br>';
			 }
			 else
			 {
			 	inhoud = inhoud+'<input type="checkbox" name="voertuig[]" value="' + array[i][1] + '" /> ' + array[i][0] + '<br>';
			 }
			 i++;
		 }
		 inhoud = inhoud+'<br><input type="submit" class="buttoninloggen" name="submit_toevoegen" value="Voertuigen toevoegen">';
		 inhoud = inhoud+'</form>';
	 	 document.getElementById("specs").innerHTML = inhoud;
	 }
	 else if(array[0] == "merk") 
	 {
		 selbox = document.formName.type;
		 selbox.options.length = 0;
		 selbox.options[selbox.options.length] = new Option("Kies een type"," ");
		 document.getElementById("specs").innerHTML = "";
		 i = 1;
		 while (i < totaal)
		 {
			 selbox.options[selbox.options.length] = new Option(array[i][0],array[i][1]);
			 i++;
		 }
	 }
	

	 } 
 }
}function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 //Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}