//here we are declaring a global variable Xmlhttp or it can be anything 
var Xmlhttp = false; 

//we are trying to create an XMLHttpRequest Object using try catch method 
try 
	{ 
		//This statement is to create an activex object for the internet explorer with version greater than 5 
		Xmlhttp = new ActivexObject("Msxml2.XMLHTTP"); 
		//alert("XmlObject Created And You Are Using Microsoft Internet Explorer With Version Greater Than 5"); 
	}
	//if any error occurs in creating an activex object for the internet explorer with version > 5 then this block executes 
	//this block will catch the error which occured in the try block 
	catch(e) 
	{ 
		//In this block we again are trying to create an activex object for internet explorer with version < 5 
		try 
		{ 
			//This statement is to create an activex object for internet explorer with version < 5 
			Xmlhttp = new ActivexObject("Microsoft.XMLHTTP"); 
			//alert("XmlObject Created And You Are Using Microsoft Internet Explorer With Older Version Lass Than 5"); 
		} 
		catch(e) 
		{ 
			//if the browser is not internet explorer the ctrl comes here 
			//And now still no xmlhttp object is not created 
			Xmlhttp = false; 
			//alert("No XmlObject Created BCOZ This Is Not Microsoft Internet Explorer"); 
		} 
	} 
//here we are checking that is the xmlhttprequest object is created or not      
//In the case of mozilla and safari (!Xmlhttp) will return true 
//(typeof XMLHttpRequest != 'undefined') will return true for Firefox and Safari so we can create an object. 
if(!Xmlhttp && typeof XMLHttpRequest != 'undefined') 
{ 
//now we are creating a xmlhttprequest object for the firefox and safari,opera etc... 
Xmlhttp = new XMLHttpRequest(); 
//alert("XmlObject Created And You Are Not Using Microsoft Internet Explorer"); 
} 



function cake_detail(cake)
	{
		var cake_detail_span = document.getElementById('cake_detail_span'); 
		//alert(cake);
		var url = "cake-detail.php";
		var params =  'cake=' + cake;
		Xmlhttp.open("POST", url, true);
		
		//Send the proper header information along with the request
		Xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		Xmlhttp.setRequestHeader("Content-length", params.length);
		Xmlhttp.setRequestHeader("Connection", "close");
		
		Xmlhttp.onreadystatechange = function() {//Call a function when the state changes.
			if(Xmlhttp.readyState == 4 && Xmlhttp.status == 200)
				{
					cake_detail_span.innerHTML = Xmlhttp.responseText;
				}
		}
		Xmlhttp.send(params);
	}

