var xmlHttp

function AddIngredient(recipe_id,ingredient_id,ingredient_id_alternative,amount,amount_to,amount_type_id)
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="add_ingredient.php"
url=url+"?recipe_id="+recipe_id
url=url+"&ingredient_id="+ingredient_id
url=url+"&ingredient_id_alternative="+ingredient_id_alternative
url=url+"&amount="+amount
url=url+"&amount_to="+amount_to
url=url+"&amount_type_id="+amount_type_id
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChangedingredient
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function AddNewIngredient(recipe_id,ingredient_category_id,new_ingredient,amount,amount_to,amount_type_id)
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="add_new_ingredient.php"
url=url+"?recipe_id="+recipe_id
url=url+"&ingredient_category_id="+ingredient_category_id
url=url+"&new_ingredient="+new_ingredient
url=url+"&amount="+amount
url=url+"&amount_to="+amount_to
url=url+"&amount_type_id="+amount_type_id
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChangedingredient
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function DeleteIngredient(recipe_ingredient_id,recipe_id)
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="delete_ingredient.php"
url=url+"?recipe_ingredient_id="+recipe_ingredient_id
url=url+"&recipe_id="+recipe_id
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChangedingredient
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}


function stateChangedingredient()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 {
 document.getElementById("ingredient").innerHTML=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;
}