

function setInputText(id)
{
	if(document.getElementById('text').value == "")
	{
		document.getElementById('text').value = "snelzoeken";
	}
	

	
	
	if(id == '16' || id == '')
	{
		if(document.getElementById('text').value == "")
		{
			document.getElementById('text').value = "gericht zoeken";
		}		
	}
}

var url = ""; // The server-side script 
		function verwijderZeker()
		{

			bConfirmed = window.confirm("Weet u zeker dat u dit item wilt verwijderen?");
			
			if(bConfirmed)
			{
			true;
			}
			else
			{
			return false;
			}
			
		}
		
		function setStatus(par)
		{
			document.getElementById('status').value = par;
		}		
		
		function doSubmit(par)
		{
			setStatus(par);
			document.frm1.submit();
		}
		
function checkBestelling()
{
var velden = "";

		if(document.getElementById('naam').value == "")
	{
	velden += "Naam: leeg\r\n";
	}	
	if(document.getElementById('achternaam').value == "")
	{
	velden += "Achternaam: leeg\r\n";
	}	
	if(document.getElementById('telefoon').value == "")
	{
	velden += "Telefoon: leeg\r\n";
	}	
	if(document.getElementById('email').value == "")
	{
	velden += "Email: leeg\r\n";
	}	
	if(document.getElementById('straat').value == "" || document.getElementById('nr').value == "" )
	{
	velden += "Straat: leeg\r\n";
	}
	if(document.getElementById('postcode').value == "")
	{
	velden += "Postcode: leeg\r\n";
	}	
	if(document.getElementById('plaats').value == "")
	{
	velden += "Plaats: leeg\r\n";
	}	
	if(document.getElementById('land').value == "")
	{
	velden += "Land: leeg\r\n";
	}	
	


	if(velden != "")
	{
	alert(velden);
	return false;
	}

}		


    function handleHttpResponseSelec() {    
	
        if (http.readyState == 4) { 
              if(http.status==200) { 
			  
                  var results=http.responseText; 
				
				  
             document.getElementById('selecties').innerHTML = results; 
			 
			 document.getElementById('select_omschrijving').value = document.getElementById('zw').value;
              } 
              } 
        } 
		
       function handleHttpResponseSoort() {    
        if (http.readyState == 4) { 
              if(http.status==200) { 
                  var results=http.responseText; 
              document.getElementById('formSoort').innerHTML = results; 
			   proj('-1'); 
			   
              } 
              } 
        } 
		
		
	
		
		       function handleHttpResponseOn() {    
        if (http.readyState == 4) { 
              if(http.status==200) { 
                  var results=http.responseText; 
              document.getElementById('ond').innerHTML = results; 
			  
			 
			  
              } 
              } 
        } 
		
				       function handleHttpResponseZoeken() {  
					   	            document.getElementById('onderdelen2').innerHTML = "<span class='boldRood'>bezig met zoeken...</span>"; 

        if (http.readyState == 4) { 
              if(http.status==200) { 
                  var results=http.responseText; 
              document.getElementById('onderdelen2').innerHTML = results; 
			  
			 
			  
              } 
              } 
        } 

		
       function handleHttpResponse() {    
        if (http.readyState == 4) { 
              if(http.status==200) { 
                  var results=http.responseText; 
              document.getElementById('divCustomerInfo').innerHTML = results; 
              } 
              } 
        } 
		
       function handleHttpResponse2() {    
        if (http.readyState == 4) { 
              if(http.status==200) { 
                  var results=http.responseText; 
   //           document.getElementById('winkelmandje').innerHTML = results; 
              } 
              } 
        } 	
		
		
       function handleHttpResponseAantal() {    
        if (http.readyState == 4) { 
              if(http.status==200) { 
                  var results=http.responseText; 
				  
             document.getElementById('aantalItems').innerHTML = results; 
              } 
              } 
        } 			
		
		
		       function handleHttpResponse10() {    
        if (http.readyState == 4) { 
              if(http.status==200) { 
                  var results=http.responseText; 
			
				  getWinkelmandje();
				  
   alert("Item is toegevoegd aan het winkelmandje!");
              } 
              } 
        } 	
		
       function handleHttpResponse5() { 
	            document.getElementById('sc1').innerHTML = "<span class='boldRood'>bezig met laden...</span>"; 
				   
        if (http.readyState == 4) { 
              if(http.status==200) { 
                  var results=http.responseText; 
				  
				  //alert(results);
				  
            document.getElementById('sc1').innerHTML = results; 
              } 
              } 
        } 	
		
       function handleHttpResponse6() {    
        if (http.readyState == 4) { 
              if(http.status==200) { 
                  var results=http.responseText; 
            document.getElementById('project_items').innerHTML = results; 
              } 
              } 
        } 		
		
       function handleHttpResponse6() {    
        if (http.readyState == 4) { 
              if(http.status==200) { 
                  var results=http.responseText; 
            document.getElementById('project_items').innerHTML = results; 
              } 
              } 
        } 							
			
        
        function requestCustomerInfo() {   
		url = "GetCustomerData_test.php?id=";
            var sId = document.getElementById("txtCustomerId").value; 
			
			//if(sId.length >= 3)
		//	{
            http.open("GET", url + escape(sId), true); 
			
            http.onreadystatechange = handleHttpResponse; 
            http.send(null); 
		//	}
        } 
		
		function getOnderdelenAanbiedingProject(id) {   
		url = "getonderdelen_aanbieding_project.php?id="+id;
			
			//if(sId.length >= 3)
		//	{
            http.open("GET",url, true); 
			
            http.onreadystatechange = handleHttpResponse5; 
            http.send(null); 
		//	}
        } 
		
		
        function getOnderdelenProject(id,soort,waarde,t) { 
		
		
		url = "getonderdelen_project_def3.php?id="+id+"&soort="+soort+"&waarde="+waarde+"&type="+t;
			
			//if(sId.length >= 3)
		//	{
            http.open("GET",url, true); 
			
            http.onreadystatechange = handleHttpResponse5; 
            http.send(null); 
		//	}
        } 
		
        function getTuningProject(id) {   
		url = "gettuning_project.php?id="+id;
			
			//if(sId.length >= 3)
		//	{
            http.open("GET",url, true); 
			
            http.onreadystatechange = handleHttpResponse5; 
            http.send(null); 
		//	}
        } 		
		
        function getSnuffelhoekProject(id) {   
		url = "getsnuffelhoek_project.php?id="+id;
			
			//if(sId.length >= 3)
		//	{
            http.open("GET",url, true); 
			
            http.onreadystatechange = handleHttpResponse5; 
            http.send(null); 
		//	}
        } 	
		
        function getAanbiedingenProject(id) {   
		url = "getaanbiedingen_project.php?id="+id;
			
			//if(sId.length >= 3)
		//	{
            http.open("GET",url, true); 
			
            http.onreadystatechange = handleHttpResponse5; 
            http.send(null); 
		//	}
        } 				
		
		function leegProjectItems()
		{
		//document.getElementById("project_items").innerHTML = "";
		document.getElementById("sc1").innerHTML = "";
		}
		
		function changeActualProjectFoto(path)
		{
		//document.getElementById('projectFoto').src = path;
		
		document.getElementById('projectFoto').style.backgroundImage='url('+path+')';  
		
		//alert(document.getElementById('projectFoto').style.backgroundImage);
		}
		
		function changeActualProjectFoto1(path,w,h)
		{
		//document.getElementById('projectFoto').src = path;
		
		//alert(path+" - "+w+" - "+h);
		
		document.getElementById('projectFoto').style.backgroundImage='url('+path+')';  
		document.getElementById('projectFoto').style.width=w;
		document.getElementById('projectFoto').style.height=h;		
		
		//alert(document.getElementById('projectFoto').style.backgroundImage);
		}		
		

		
        function getFotosProject(id) {   
		url = "getfotos_project.php?id="+id;
			
			//if(sId.length >= 3)
		//	{
            http.open("GET",url, true); 
			
            http.onreadystatechange = handleHttpResponse6; 
            http.send(null); 
		//	}
        } 	
		
        function getPdfProject(id) {   
		url = "getpdf_project.php?id="+id;
			
			//if(sId.length >= 3)
		//	{
            http.open("GET",url, true); 
			
            http.onreadystatechange = handleHttpResponse5; 
            http.send(null); 
		//	}
        } 						

	        function getWinkelmandje() {   
			url =  "winkelmandje_aantal.php";
            http.open("GET",url, true);
			 
            http.onreadystatechange = handleHttpResponseAantal; 
            http.send(null); 
        } 		
		function setWinkelmandje2() {   
		var id= "";
		id = document.getElementById('id').value;
		var aantal = "";
		aantal = document.getElementById('aantal').value;
			url =  "winkelmandje.php?code="+id+"&aantal="+aantal+"&s=aanbieding";
			http.open("GET",url, true);
			
			//alert(url);
			
			http.onreadystatechange = handleHttpResponse10; 
						
			http.send(null); 
			
			
			
			//window.close();
		} 
		
		    function deleteItem(id) {   
			
			bConfirmed = window.confirm("Weet u zeker dat u dit item wilt verwijderen?");

				if(bConfirmed)
				{
						url =  "winkelmandje.php?j=delete&id=";
						http.open("GET",url+escape(id), true); 
						http.onreadystatechange = handleHttpResponse2; 
						http.send(null); 
				}
        } 	
			function gon(id)
{
	//alert(id);
				url = "getonderdelen_project2.php?groep="+id;

			
			//if(sId.length >= 3)
		//	{
            http.open("GET",url, true); 
			
            http.onreadystatechange = handleHttpResponseOn; 
            http.send(null); 
		//	}
}

			function a(id)
{
				url = "getgroepen.php?id="+id;
				
				             


			
			//if(sId.length >= 3)
		//	{
            http.open("GET",url, true); 
			
            http.onreadystatechange = handleHttpResponseSoort; 
            http.send(null); 
		//	}
}



			function proj(id)
{
				url = "getproj.php?gid="+id;

			
			//if(sId.length >= 3)
		//	{
            http.open("GET",url, true); 
			
            http.onreadystatechange = handleHttpResponseOn; 
            http.send(null); 
		//	}
}
	
	function getSelecties()
	{
		url = "getselecties.php?veld=ok";
		http.open("GET",url, true); 
		
		
		http.onreadystatechange = handleHttpResponseSelec; 

		http.send(null); 
	}
			
			
        function getOnderdelenZoeken() {   
		var model = "";
		var merk = "";
		var categorie = "";
		var omschrijving = "";
		var tuning = "";
		var aanbieding = "";
		
		model = document.getElementById('select_project').value;
		
		
		
		merk = document.getElementById('select_merk').value;
		categorie =document.getElementById('select_categorie').value;
		omschrijving= document.getElementById('select_omschrijving').value;
		
		if(document.getElementById('select_tuning').checked == true)
		{
			tuning= document.getElementById('select_tuning').value;
		}
		if(document.getElementById('select_aanbieding').checked == true)
		{
			aanbieding= document.getElementById('select_aanbieding').value;
		}		
		
		url = "getonderdelen_zoeken.php?model="+model+"&merk="+merk+"&categorie="+categorie+"&omschrijving="+omschrijving+"&tuning="+tuning+"&aanbieding="+aanbieding;
		
		http.open("GET",url, true); 
		
		http.onreadystatechange = handleHttpResponseZoeken; 
		http.send(null); 
		
        } 			
   
   
   function enableField(id)
{
document.getElementById(id).disabled=false;
}

   
		
function getHTTPObject() { 
  var xmlhttp; 

  if(window.XMLHttpRequest){ 
    xmlhttp = new XMLHttpRequest(); 
  } 
  else if (window.ActiveXObject){ 
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 
    if (!xmlhttp){ 
        xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
    } 
    
} 
  return xmlhttp; 

  
} 
var http = getHTTPObject(); // We create the HTTP Object 

