// JavaScript Document
function nuevoAjax(){
var xmlhttp=false;
 try {
  xmlhttp = new ActiveXObject('Msxml2.XMLHTTP');
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
  } catch (E) {
   xmlhttp = false;
  }
 }

if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
  xmlhttp = new XMLHttpRequest();
}
return xmlhttp;
}



function types(){

var contenedor;
contenedor = document.getElementById('subtype');

var types=document.getElementById('select_type').options[document.getElementById('select_type').selectedIndex].value;

ajax=nuevoAjax();
ajax.open('GET', 'subtype.php?id='+types, true);
ajax.onreadystatechange=function() {
if (ajax.readyState==4) {
contenedor.innerHTML = ajax.responseText
}
}
ajax.send(null)
}

function stp(){
var types=document.getElementById('s_subtype').options[document.getElementById('s_subtype').selectedIndex].value;
document.getElementById('select_subtype').value=types;
}


/*


	

function types(codigo)
{
	var contenedor;
    contenedor = document.getElementById('subtype1');
	// Extraigo el valor del combo que se ha cambiado
	var types=document.getElementById("select_type").options[document.getElementById("select_type").selectedIndex].value;

	ajax=nuevoAjax();
	
	// Envio al servidor el valor seleccionado y el combo al cual se le deben poner los datos
	ajax.open("GET", "subtype.php?id="+types, true);
	ajax.onreadystatechange=function() 
	{ 
		if (ajax.readyState==1)
		{
			// Mientras carga elimino la opcion "Elige" y pongo una que dice "Cargando"
			//elemento=document.getElementById("Select Subtype");
			//elemento.length=0;
			//var opcionCargando=document.createElement("option"); 
			//opcionCargando.value=0; 
			//opcionCargando.innerHTML="Cargando...";
			//elemento.appendChild(opcionCargando); 
			//elemento.disabled=true;	
		}
		if (ajax.readyState==4)	
		{
			// Coloco en la fila contenedora los datos que recivo del servidor
			document.getElementById("subtype1").innerHTML=ajax.responseText;

			
		} 
	}
	ajax.send(null);
	}
	
	*/