/*************************************************/
/*	Fonctions d'ouverture d'une popup	 */
/*************************************************/
function OuvrirPopup(page,nom,option) { window.open(page,nom,option); }

function check_bague(id){ document.getElementById("checkbague").value = id;}

function creeXMLHttpRequestObject(){ try{ Req = new ActiveXObject("Microsoft.XMLHTTP"); } catch(Error){ try{Req = new ActiveXObjet("MSXML2.XMLHTTP");} catch(Error){try{Req = new XMLHttpRequest();} catch(Error){alert("Impossible de créer l'objet");}}} return Req; }


function i_have_car(choose){

	if(choose == '1')
	{
		
	document.getElementById('int_1').style.display = "block";
	document.getElementById('brand_name_id').style.display = "block";
	document.getElementById('brand_model_id').style.display = "block";

	}else if(choose == '2')
	{
	
	document.getElementById('int_1').style.display = "none";
	document.getElementById('brand_name_id').style.display = "none";
	document.getElementById('brand_model_id').style.display = "none";
	}
}

function choose_model(brand,model)
{
	  if( Req = creeXMLHttpRequestObject()){
            Req.onreadystatechange = function(){
                if(Req.readyState == 4){
                    if(Req.status == 200){     
					
							document.getElementById("brand_model_id").innerHTML = Req.responseText;
					
					}
                } 
            }
        }
	Req.open("GET","libs/ajax/model.php?brand="+ brand +"&brand_model="+model, true);
	Req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 
	Req.send(null); 
}



function choose_car(choose){

	if(choose < '4' && choose > '0')
	{
	document.getElementById('int_2').style.display = "block";
	document.getElementById('brand_name_id2').style.display = "block";
	document.getElementById('brand_model_id2').style.display = "block";

	}else
	{
	
	document.getElementById('int_2').style.display = "none";
	document.getElementById('brand_name_id2').style.display = "none";
	document.getElementById('brand_model_id2').style.display = "none";
	}
}

function choose_model2(brand,model)
{
	  if( Req = creeXMLHttpRequestObject()){
            Req.onreadystatechange = function(){
                if(Req.readyState == 4){
                    if(Req.status == 200){     
					
							document.getElementById("brand_model_id2").innerHTML = Req.responseText;
					
					}
                } 
            }
        }
	Req.open("GET","libs/ajax/model2.php?brand="+ brand +"&brand_model="+model, true);
	Req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 
	Req.send(null); 
}



