function createRequestObject(){
	var request_o; //declare the variable to hold the object.
	var browser = navigator.appName; //find the browser name
	if(browser == "Microsoft Internet Explorer"){
		request_o = new ActiveXObject("Microsoft.XMLHTTP");
	}else{
		request_o = new XMLHttpRequest();
	}
	return request_o; //return the object
}

var http = createRequestObject(); 



/* Funzione 1*/
function getProducts_1(opt1,e){
  //alert('prova: ' + opt1);
	http.open('get', 'internal_request.php?action=get_product_1s&marca='+ opt1+'&e='+e);
	http.onreadystatechange = handleProducts_1;
	http.send(null);
}
function handleProducts_1(){
	if(http.readyState == 4){ //Finished loading the response
		var response = http.responseText;
		document.getElementById('modello_1').innerHTML = response;
	}
}

/* Funzione 2*/
function getProducts_2(opt2,e){
  //alert('prova: ' + opt1);
	http.open('get', 'internal_request.php?action=get_products_2&marca='+opt2+'&e='+e);
	http.onreadystatechange = handleProducts_2;
	http.send(null);
}
function handleProducts_2(){
	if(http.readyState == 4){ //Finished loading the response
		var response = http.responseText;
		document.getElementById('modello_2').innerHTML = response;
	}
}

/* Funzione 3*/
function getProducts_3(opt3,e){
	http.open('get', 'internal_request.php?action=get_products_3&marca='+ opt3+'&e='+e);
	http.onreadystatechange = handleProducts_3;
	http.send(null);
}
function handleProducts_3(){
	if(http.readyState == 4){ //Finished loading the response
		var response = http.responseText;
		document.getElementById('modello_3').innerHTML = response;
	}
}

/* Funzione 4*/
function getProducts_4(opt4,e){
	http.open('get', 'internal_request.php?action=get_products_4&marca='+ opt4+'&e='+e);
	http.onreadystatechange = handleProducts_4;
	http.send(null);
}
function handleProducts_4(){
	if(http.readyState == 4){ //Finished loading the response
		var response = http.responseText;
		document.getElementById('modello_4').innerHTML = response;
	}
}

/* Funzione 5*/
function getProducts_5(opt5,e){
	http.open('get', 'internal_request.php?action=get_products_5&marca='+ opt5+'&e='+e);
	http.onreadystatechange = handleProducts_5;
	http.send(null);
}
function handleProducts_5(){
	if(http.readyState == 4){ //Finished loading the response
		var response = http.responseText;
		document.getElementById('modello_5').innerHTML = response;
	}
}

/* Funzione 6*/
function getProducts_6(opt6,e){
	http.open('get', 'internal_request.php?action=get_products_6&marca='+ opt6+'&e='+e);
	http.onreadystatechange = handleProducts_6;
	http.send(null);
}
function handleProducts_6(){
	if(http.readyState == 4){ //Finished loading the response
		var response = http.responseText;
		document.getElementById('modello_6').innerHTML = response;
	}
}

/* Funzione 7*/
function getProducts_7(opt7,e){
	http.open('get', 'internal_request.php?action=get_products_7&marca='+ opt7+'&e='+e);
	http.onreadystatechange = handleProducts_7;
	http.send(null);
}
function handleProducts_7(){
	if(http.readyState == 4){ //Finished loading the response
		var response = http.responseText;
		document.getElementById('modello_7').innerHTML = response;
	}
}

/* Funzione 8*/
function getProducts_8(opt8,e){
	http.open('get', 'internal_request.php?action=get_products_8&marca='+ opt8+'&e='+e);
	http.onreadystatechange = handleProducts_8;
	http.send(null);
}
function handleProducts_8(){
	if(http.readyState == 4){ //Finished loading the response
		var response = http.responseText;
		document.getElementById('modello_8').innerHTML = response;
	}
}

/* Funzione 9*/
function getProducts_9(opt9,e){
	http.open('get', 'internal_request.php?action=get_products_9&marca='+ opt9+'&e='+e);
	http.onreadystatechange = handleProducts_9;
	http.send(null);
}
function handleProducts_9(){
	if(http.readyState == 4){ //Finished loading the response
		var response = http.responseText;
		document.getElementById('modello_9').innerHTML = response;
	}
}

/* Funzione 10*/
function getProducts_10(opt10,e){
	http.open('get', 'internal_request.php?action=get_products_10&marca='+opt10+'&e='+e);
	http.onreadystatechange = handleProducts_10;
	http.send(null);
}
function handleProducts_10(){
	if(http.readyState == 4){ //Finished loading the response
		var response = http.responseText;
		document.getElementById('modello_10').innerHTML = response;
	}
}


/* Funzione tipo 1*/
function get_tipo_1(tipo_1,e){
  //alert('prova: ' + opt1);
	http.open('get', 'select_marca.php?action=get_tipo_1&tipo='+tipo_1+'&e='+e);
	http.onreadystatechange = handle_tipo_1;
	http.send(null);
}
function handle_tipo_1(){
	if(http.readyState == 4){ //Finished loading the response
		var response = http.responseText;
		document.getElementById('marca_1').innerHTML = response;
	}
}

/* Funzione tipo 2*/
function get_tipo_2(tipo_2,e){
  //alert('prova: ' + opt2);
	http.open('get', 'select_marca.php?action=get_tipo_2&tipo='+tipo_2+'&e='+e);
	http.onreadystatechange = handle_tipo_2;
	http.send(null);
}
function handle_tipo_2(){
	if(http.readyState == 4){ //Finished loading the response
		var response = http.responseText;
		document.getElementById('marca_2').innerHTML = response;
	}
}


/* Funzione tipo 3*/
function get_tipo_3(tipo_3,e){
  //alert('prova: ' + opt3);
	http.open('get', 'select_marca.php?action=get_tipo_3&tipo='+tipo_3+'&e='+e);
	http.onreadystatechange = handle_tipo_3;
	http.send(null);
}
function handle_tipo_3(){
	if(http.readyState == 4){ //Finished loading the response
		var response = http.responseText;
		document.getElementById('marca_3').innerHTML = response;
	}
}


/* Funzione tipo 4*/
function get_tipo_4(tipo_4,e){
  //alert('prova: ' + opt4);
	http.open('get', 'select_marca.php?action=get_tipo_4&tipo='+tipo_4+'&e='+e);
	http.onreadystatechange = handle_tipo_4;
	http.send(null);
}
function handle_tipo_4(){
	if(http.readyState == 4){ //Finished loading the response
		var response = http.responseText;
		document.getElementById('marca_4').innerHTML = response;
	}
}


/* Funzione tipo 5*/
function get_tipo_5(tipo_5,e){
  //alert('prova: ' + opt5);
	http.open('get', 'select_marca.php?action=get_tipo_5&tipo='+tipo_5+'&e='+e);
	http.onreadystatechange = handle_tipo_5;
	http.send(null);
}
function handle_tipo_5(){
	if(http.readyState == 4){ //Finished loading the response
		var response = http.responseText;
		document.getElementById('marca_5').innerHTML = response;
	}
}


/* Funzione tipo 6*/
function get_tipo_6(tipo_6,e){
  //alert('prova: ' + opt6);
	http.open('get', 'select_marca.php?action=get_tipo_6&tipo='+tipo_6+'&e='+e);
	http.onreadystatechange = handle_tipo_6;
	http.send(null);
}
function handle_tipo_6(){
	if(http.readyState == 4){ //Finished loading the response
		var response = http.responseText;
		document.getElementById('marca_6').innerHTML = response;
	}
}


/* Funzione tipo 7*/
function get_tipo_7(tipo_7,e){
  //alert('prova: ' + opt7);
	http.open('get', 'select_marca.php?action=get_tipo_7&tipo='+tipo_7+'&e='+e);
	http.onreadystatechange = handle_tipo_7;
	http.send(null);
}
function handle_tipo_7(){
	if(http.readyState == 4){ //Finished loading the response
		var response = http.responseText;
		document.getElementById('marca_7').innerHTML = response;
	}
}


/* Funzione tipo 8*/
function get_tipo_8(tipo_8,e){
  //alert('prova: ' + opt8);
	http.open('get', 'select_marca.php?action=get_tipo_8&tipo='+tipo_8+'&e='+e);
	http.onreadystatechange = handle_tipo_8;
	http.send(null);
}
function handle_tipo_8(){
	if(http.readyState == 4){ //Finished loading the response
		var response = http.responseText;
		document.getElementById('marca_8').innerHTML = response;
	}
}


/* Funzione tipo 9*/
function get_tipo_9(tipo_9,e){
  //alert('prova: ' + opt9);
	http.open('get', 'select_marca.php?action=get_tipo_9&tipo='+tipo_9+'&e='+e);
	http.onreadystatechange = handle_tipo_9;
	http.send(null);
}
function handle_tipo_9(){
	if(http.readyState == 4){ //Finished loading the response
		var response = http.responseText;
		document.getElementById('marca_9').innerHTML = response;
	}
}


/* Funzione tipo 10*/
function get_tipo_10(tipo_10,e){
  //alert('prova: ' + opt10);
	http.open('get', 'select_marca.php?action=get_tipo_10&tipo='+tipo_10+'&e='+e);
	http.onreadystatechange = handle_tipo_10;
	http.send(null);
}
function handle_tipo_10(){
	if(http.readyState == 4){ //Finished loading the response
		var response = http.responseText;
		document.getElementById('marca_10').innerHTML = response;
	}
}








function getXhttp ( )
{
  var ajax_request;
 
  if (  window.ActiveXObject  )  {
      var mSoftVersions = [
          'MSXML2.DOMDocument.5.0',
          'MSXML2.DOMDocument.4.0',
          'MSXML2.DOMDocument.3.0',
          'MSXML2.DOMDocument.2.0',
          'MSXML2.DOMDocument',
          'Microsoft.XmlDom',
          'Msxml2.XMLHTTP',
          'Microsoft.XMLHTTP'
      ];
     
      for (  i=0; i<mSoftVersions.length; i++  )  {
          try {
              ajax_request = new ActiveXObject (  mSoftVersions[i]  );
          }  catch (  e  )  {    }
      }
  }  else if (  !ajax_request && typeof XMLHttpRequest != 'undefined'  )  {
      try {
          ajax_request = new XMLHttpRequest;
      }  catch (  e  )  {    }
  }  else if (  !ajax_request && window.createRequest  )  {
      try {
          ajax_request = window.createRequest;
      }  catch (  e  )  {    }
  }  else  {
      ajax_request = false;
  }
 
  return ajax_request;
}
//questa funzione effettua la chiamata al file form.php che si occuperà di inserire la
// news sul db
function addNews (opt,e)
{
 var xml = getXhttp( );
    if ( !xml )
       alert("Errore durante l'invio del form");
    xml.open('POST', 'nuova_richiesta_italiano.php');
    xml.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
   
    var valore = opt;
   // alert('--> ' + valore+ '-- e ' +e);
    if (e == 1){
      document.inserimento_richiesta.id_apparati_1.value=valore;
    }
    if (e == 2){
      document.inserimento_richiesta.id_apparati_2.value=valore;
    }
    if (e == 3){
      document.inserimento_richiesta.id_apparati_3.value=valore;
    }
    if (e == 4){
      document.inserimento_richiesta.id_apparati_4.value=valore;
    }
    if (e == 5){
      document.inserimento_richiesta.id_apparati_5.value=valore;
    }
    if (e == 6){
      document.inserimento_richiesta.id_apparati_6.value=valore;
    }
    if (e == 7){
      document.inserimento_richiesta.id_apparati_7.value=valore;
    }
    if (e == 8){
      document.inserimento_richiesta.id_apparati_8.value=valore;
    }
    if (e == 9){
      document.inserimento_richiesta.id_apparati_9.value=valore;
    }
    if (e == 10){
      document.inserimento_richiesta.id_apparati_10.value=valore;
    }
    
}
// fine del file js.js