<script language="javascript" type="text/javascript">
var xmlHttp
var rowcount=1;
function Manufacture()
{
	var str1 = document.getElementById("make").value;
	var str2 = document.getElementById("color").value;
	var str3 = document.getElementById("grade").value;
    xmlHttp=GetXmlHttpObject();
	 
	if(str1!="" && str2!="" && str3!="")
	{	  
		if (xmlHttp==null)
		{
		    alert ("Your browser does not support AJAX!");
		    return;
		} 
		var url="manufacture.php";
		url=url+"?makeId="+str1+"&colorId="+str2+"&gradeId="+str3+"&Rowcount="+rowcount;
		//alert(url);
		xmlHttp.onreadystatechange=AddRow;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
	}
}

function AddRow() 
{ 
	if (xmlHttp.readyState==4)
	{ 
   		var old_add_value = document.getElementById("Add").innerHTML;
		var new_value = xmlHttp.responseText;
	    var final_value = old_add_value + new_value;
	    document.getElementById("Add").innerHTML=final_value;
		rowcount++;
	}
}

 
function putnumber1(str)
{ 
   xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)
		  {
		    alert ("Your browser does not support AJAX!");
		    return;
		  } 
	var url="randomnumber.php";
	url=url+"?Category1="+str;
	//alert(url);
	//url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=NumberChanged1;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function NumberChanged1() 
{ 
	if (xmlHttp.readyState==4)
	{ 
	   document.getElementById("change").innerHTML=xmlHttp.responseText;
	}
}

function putnumber(str)
{ 
	xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)
		  {
		    alert ("Your browser does not support AJAX!");
		    return;
		  } 
	var url="stockNumber.php";
	url=url+"?itemcode="+str;
	//alert(url);
	//url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=NumberChanged2;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function NumberChanged2() 
{ 
	if (xmlHttp.readyState==4)
	{ 
	    document.getElementById("StockID").value=xmlHttp.responseText;
	}
}


function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
	  {
	  // Firefox, Opera 8.0+, Safari
	  xmlHttp=new XMLHttpRequest();
	  }
	catch (e)
	  {
	  // Internet Explorer
	  try
		{
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
	  catch (e)
		{
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	  }
	return xmlHttp;
}
function check_runroll(str)
{
	if (str.length==0)
  {
  document.getElementById("flexo_id").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("flexo_id").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","get_run_roll.php?q="+str,true);
xmlhttp.send();
}
function get_url()
{
	var str=document.getElementById("category").value;
	alert(str);
	if(str!='')
	{
	location.replace("item_master.php?type="+str);
	}
}

if (str.length==0)
  {
  document.getElementById("main_id").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("main_id").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","get_category.php?q="+str,true);
xmlhttp.send();
}

</script>