	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;
	}
	
	var xmlHttp = GetXmlHttpObject();
	var db_query = "recipes.php";
	var default_img = 'url(images.php?typ=recipes&src=Nothing)';
	var device_used = "All";
	
	function prepare()
	{	
		var select_1 = document.getElementById("food_1");
		var select_2 = document.getElementById("food_2");
		var select_3 = document.getElementById("food_3");
		
		for (i = 1; i < select_1.length; i++)
		{
			select_1.options[i].disabled = false;
			select_2.options[i].disabled = false;
			select_3.options[i].disabled = false;
		}
		
		select_2.options[select_1.selectedIndex].disabled = true;
		select_3.options[select_1.selectedIndex].disabled = true;			
		
		select_1.options[select_2.selectedIndex].disabled = true;
		select_3.options[select_2.selectedIndex].disabled = true;
		
		select_1.options[select_3.selectedIndex].disabled = true;
		select_2.options[select_3.selectedIndex].disabled = true;
		
		select_1.options[0].disabled = false;
		select_2.options[0].disabled = false;
		select_3.options[0].disabled = false;
		
		document.getElementById("food_1_img").style.background = 'url(images.php?typ=w_shop_foods&src=' + select_1.options[select_1.selectedIndex].value + ')';
		document.getElementById("food_2_img").style.background = 'url(images.php?typ=w_shop_foods&src=' + select_2.options[select_2.selectedIndex].value + ')';
		document.getElementById("food_3_img").style.background = 'url(images.php?typ=w_shop_foods&src=' + select_3.options[select_3.selectedIndex].value + ')';
		
		db_query = "recipes.php?f1=" + select_1.options[select_1.selectedIndex].value + "&f2=" + select_2.options[select_2.selectedIndex].value + "&f3=" + select_3.options[select_3.selectedIndex].value + "&d=" + device_used;
		
		xmlHttp.open("GET", db_query, false);
		xmlHttp.send(null);
		
		document.getElementById("recipe_results").innerHTML = "";
		
		if(xmlHttp.readyState == 4)
		{
			if(xmlHttp.status == 200)
			{
				document.getElementById("recipe_results").innerHTML = xmlHttp.responseText;
			}
		}
		
		default_img = 'url(images.php?typ=recipes&src=Nothing)';
		document.getElementById("recipe_image").style.background = default_img;
	}
	
	function highLightLock(this_line)
	{
		var result_lists = document.getElementById("recipe_results").getElementsByTagName("LI");
		var number_of_rows = result_lists.length;
		
		for (i=0; i<number_of_rows; i++)
		{
			result_lists[i].style.backgroundColor = original_style.backgroundColor;
		}
		
		this_line.style.backgroundColor = '#ffd6ff';
	}
	
	function showImg(img_name)
	{
		document.getElementById("recipe_image").style.background = 'url(images.php?typ=recipes&src=' + img_name + ')';
	}
	
	function setImg(img_name, line_clicked)
	{
		document.getElementById("recipe_image").style.background = 'url(images.php?typ=recipes&src=' + img_name + ')';
		default_img = 'url(images.php?typ=recipes&src=' + img_name + ')';
	}
	
	function clearImg()
	{
		document.getElementById("recipe_image").style.background = default_img;
	}