function renderMenu(menu)
{
var xmlHttp;
var menu;

var subcat;
var subcat2;
var items;

if (typeof(document.myform.subcat)!='undefined') {
	subcat = document.myform.subcat.selectedIndex;
	subcat = document.myform.subcat.options[subcat].value;
	//alert(subcat);
}
if (typeof(document.myform.subcat2)!='undefined') {
	subcat2 = document.myform.subcat2.selectedIndex;
	subcat2 = document.myform.subcat2.options[subcat2].value;

}
if (typeof(document.myform.items)!='undefined') {
	items = document.myform.items.selectedIndex;
	items = document.myform.items.options[items].value;
	
}

try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    try
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    catch (e)
      {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }
  
  xmlHttp.onreadystatechange=function()
    {
    if(xmlHttp.readyState==4)
      {
      document.getElementById(menu+"div").innerHTML=xmlHttp.responseText;
      }
    }
  
  url = '?cat=1&menu='+menu;
  if (menu=='subcat2') {
  	url = url + '&subcat=' + subcat;
  } else if (menu=='items') {
  	url = url + '&subcat=' + subcat + '&subcat2=' + subcat2;
  }

  xmlHttp.open("GET","dropdown.php"+url,true);  
  xmlHttp.send(null);
 }
 
 
 function goSoporte(id) {
	var url;
	var item_id;
	
	
	if (typeof(document.myform.items)!='undefined') {
		item_id = document.myform.items.selectedIndex;
		item_id = document.myform.items.options[item_id].value;
	}
	
	//cambiar productos por soporte
	url = "soporte_busqueda.php?id_item=" + item_id;
 	document.location.replace(url);
 }
 
  function goReferencias(id) {
	var url;
	var item_id;
	
	
	if (typeof(document.myform.items)!='undefined') {
		item_id = document.myform.items.selectedIndex;
		item_id = document.myform.items.options[item_id].value;
	}
	
	//cambiar productos por soporte
	url = "referencias_busqueda.php?id_item=" + item_id;
 	document.location.replace(url);
 }
 
 
