function sendmessage2()
{
	var http = new XMLHttpRequest();
	var url = "sendmessage2.php";
	var params = "lorem=ipsum&name=binny";
	
	params="name="+document.getElementById("name").value;
	params=params+"&email="+document.getElementById("email").value;
	params=params+"&telephone="+document.getElementById("telephone").value;
	params=params+"&message="+document.getElementById("message").value;
		
	http.open("POST", url, true);

	//Send the proper header information along with the request
	http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	http.setRequestHeader("Content-length", params.length);
	http.setRequestHeader("Connection", "close");

	http.onreadystatechange = function() {//Call a function when the state changes.
		if(http.readyState == 4 && http.status == 200) {
			document.getElementById("requestform").innerHTML ="<h1>Message Sent</h1><p>Your request has been sent to Maphouse.</p>";
		}
	}
	http.send(params);

}
function sendmessage()
{
	var http = new XMLHttpRequest();
	var url = "sendmessage.php";
	var params = "lorem=ipsum&name=binny";
	
	params="first_name="+document.getElementById("yourname").value;
	params=params+"&email="+document.getElementById("youremail").value;
	params=params+"&message="+document.getElementById("message").value;
		
	http.open("POST", url, true);

	//Send the proper header information along with the request
	http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	http.setRequestHeader("Content-length", params.length);
	http.setRequestHeader("Connection", "close");

	http.onreadystatechange = function() {//Call a function when the state changes.
		if(http.readyState == 4 && http.status == 200) {
			window.location = "/thanyoucontact.php"
		}
	}
	http.send(params);

}
function searchsystem()
{
	var http = GetXmlHttpObject();
	if (http==null)
 	{
 		alert ("Browser does not support HTTP Request");
 		return;
 	}
	var url="/includes/searchsys.php?str="+document.getElementById("search").value;
	http.open("GET",url,true);
	http.onreadystatechange = function() 
	{//Call a function when the state changes.
		if(http.readyState == 4 && http.status == 200) 
		{
			window.location="/searchresults.php";
		}
	}
	http.send(null);
}
function checksearch()
{
	if(document.getElementById("search").value==" Enter Keyword(s)")
	{
		document.getElementById("search").value = "";
	}
}
function deleteitem(mID)
{
	
	var http = GetXmlHttpObject();
	if (http==null)
 	{
 		alert ("Browser does not support HTTP Request");
 		return;
 	}

	
	
	var url="/ajax/deleteitem.php?id="+mID;
	
	http.open("GET",url,true);
	http.onreadystatechange = function() 
	{//Call a function when the state changes.
		if(http.readyState == 4 && http.status == 200) 
		{
			window.location.reload();
		}
	}
	http.send(null);
	$.jGrowl(mTitle+'<br /><br />Added to basket'); 
}
function addtobasketprint(mTitle,mID)
{
	
	var http = GetXmlHttpObject();
	if (http==null)
 	{
 		alert ("Browser does not support HTTP Request");
 		return;
 	}

	
	
	var url="/ajax/addbasket_print.php?id="+mID;
	//url=url+"?item="+mItem+"&price="+mPrice;
//	url=url+"&sid="+Math.random();
	//alert(url);
	//http.onreadystatechange=stateChanged;
	http.open("GET",url,true);
	http.onreadystatechange = function() 
	{//Call a function when the state changes.
		if(http.readyState == 4 && http.status == 200) 
		{
			//alert(http.responseText);
			//document.getElementById(divtochange).innerHTML=http.responseText;
			showbasket();
		}
	}
	http.send(null);
	$.jGrowl(mTitle+'<br /><br />Added to basket'); 
}
function addtobasket(mTitle,mID)
{
	
	var http = GetXmlHttpObject();
	if (http==null)
 	{
 		alert ("Browser does not support HTTP Request");
 		return;
 	}

	
	
	var url="/ajax/addbasket.php?id="+mID;
	//url=url+"?item="+mItem+"&price="+mPrice;
//	url=url+"&sid="+Math.random();
	//alert(url);
	//http.onreadystatechange=stateChanged;
	http.open("GET",url,true);
	http.onreadystatechange = function() 
	{//Call a function when the state changes.
		if(http.readyState == 4 && http.status == 200) 
		{
			//alert(http.responseText);
			//document.getElementById(divtochange).innerHTML=http.responseText;
			showbasket();
		}
	}
	http.send(null);
	$.jGrowl(mTitle+'<br /><br />Added to basket'); 
}
function showbasket()
{
	
	var http = GetXmlHttpObject();
	if (http==null)
 	{
 		alert ("Browser does not support HTTP Request");
 		return;
 	}

	
	
	var url="/ajax/getbasket.php";
	http.open("GET",url,true);
	http.onreadystatechange = function() 
	{//Call a function when the state changes.
		if(http.readyState == 4 && http.status == 200) 
		{
			//alert(http.responseText);
			document.getElementById("basket").innerHTML=http.responseText;
		}
	}
	http.send(null);

}
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;
}
