function searchprop(){
	var ajaxRequest;  // The variable that makes Ajax possible!
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} 
	catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e){
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			var ajaxDisplay = document.getElementById('searchajax');
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
		}
	}
	var town = document.getElementById('town').value;
	var county = document.getElementById('county').value;
	var zip = document.getElementById('zip').value;
	var minprice = document.getElementById('minprice').value;
	var maxprice = document.getElementById('maxprice').value;
	var minroom = document.getElementById('beds').value;
	var minbath = document.getElementById('baths').value;
	var proptype = document.getElementById('proptype').value;
	
	var string = "?minroom=" + minroom + "&minbath=" + minbath + "&minprice=" + minprice + "&maxprice=" + maxprice + "&zip=" + zip + "&county=" + county + "&town=" + town + "&proptype=" + proptype ;
	ajaxRequest.open("GET", "../functions/searchprop.php"+ string, true);
	ajaxRequest.send(null);
}

function addtennant(){
									var ajaxRequest;
									try{
										ajaxRequest = new XMLHttpRequest();
									} 
									catch (e){
									try{
											ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
										} 
										catch (e){
											try{
												ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
											} 
											catch (e){
												// Something went wrong
												alert("Your browser broke!");
												return false;
											}
										}
									}
									ajaxRequest.onreadystatechange = function(){
										if(ajaxRequest.readyState == 4){
											var ajaxDisplay = document.getElementById('editten');
											ajaxDisplay.innerHTML = ajaxRequest.responseText;
											$('#propresults').load('functions/propresults.php').fadeIn("slow");
										}
									}
									var theid = document.getElementById('theid').value;
									var title = document.getElementById('title').value;
									var firstname = document.getElementById('fname').value;
									var lastname = document.getElementById('lname').value;
									var address = document.getElementById('street').value;
									var post = document.getElementById('post').value;
									var town = document.getElementById('town').value;
									var county = document.getElementById('county').value;
									var mobile = document.getElementById('mobile').value;
									var homefone = document.getElementById('homefone').value;
									var email = document.getElementById('email').value;
									var budget = document.getElementById('budget').value;
									var beds = document.getElementById('beds').value;
									var baths = document.getElementById('baths').value;
									var offered = document.getElementById('offered').value;
									var proptype = document.getElementById('proptype').value;
									var town = document.getElementById('town').value;
									var term = document.getElementById('term').value;
									
									var string = "?title=" + title +"&theid=" + theid + "&firstname=" + firstname + "&lastname=" + lastname + 	
									"&email=" + email +"&address=" + address + "&post=" + post + "&town=" + town + "&county=" + county + "&homefone=" + homefone + 
									"&mobile=" + mobile + "&budget=" + budget + "&beds=" + beds +
									"&baths=" + baths + "&offered=" + offered + "&term=" + term + "&proptype=" + proptype + 
									"&town=" + town;
									
									ajaxRequest.open("GET", "functions/editten.php"+ string, true);
									ajaxRequest.send(null);	
									$('#propresults').load('record_count.php').fadeIn("slow");
								}

function reset(){
	var ajaxRequest;  // The variable that makes Ajax possible!
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} 
	catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e){
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			var ajaxDisplay = document.getElementById('searchajax');
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
		}
	}
	
	ajaxRequest.open("GET", "../functions/searchprop2.php", true);
	ajaxRequest.send(null);
}

function register(){
	var ajaxRequest;  // The variable that makes Ajax possible!
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} 
	catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e){
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			var ajaxDisplay = document.getElementById('searchajax');
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
		}
	}
	var fname = document.getElementById('fname').value;
	var lname = document.getElementById('lname').value;
	var email = document.getElementById('email').value;
	var password = document.getElementById('password').value;
	var street = document.getElementById('street').value;
	var postcode = document.getElementById('postcode').value;
	var budget = document.getElementById('budget').value;
	var town = document.getElementById('town').value;
	
	var string = "?fname=" + fname + "&lname=" + lname + "&email=" + email + "&password=" + password + "&street=" + street + "&postcode=" + postcode + "&town=" + town + "&budget=" + budget;
	ajaxRequest.open("GET", "functions/register.php"+ string, true);
	ajaxRequest.send(null);
}

function login(){
	var ajaxRequest;  // The variable that makes Ajax possible!
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} 
	catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e){
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			var ajaxDisplay = document.getElementById('popupContact');
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
		}
	}
	var user = document.getElementById('theuser').value;
	var pass = document.getElementById('thepass').value;
	var id = document.getElementById('theid').value;
	
	var string = "?user=" + user + "&pass=" + pass + "&id=" + id;
	ajaxRequest.open("GET", "../functions/member2.php"+ string, true);
	ajaxRequest.send(null);
}

	function memLog()
			{
				var email = document.getElementById('memuse').value;
				var pass = document.getElementById('mempass').value;
				var error = 0;
				if (email == "")
				{
					document.getElementById("memuse").style.backgroundColor="#FFA7A6";
					error = error +1;
				}
				else
				{
					var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
					if(reg.test(email) == false) 
					{
						document.getElementById("memuse").style.backgroundColor="#FFA7A6";
						error = error +1;
					}
					else
					{
						document.getElementById("memuse").style.backgroundColor="#AAFFA6";
					}
				}
				if (pass == "")
				{
					error = error +1;
					document.getElementById("mempass").style.backgroundColor="#FFA7A6";
				}
				else
				{
					document.getElementById("mempass").style.backgroundColor="#AAFFA6";
				}
				if (error > 0)
				{
					document.getElementById("memlog").disabled= true;
				}
				else
				{
					document.getElementById("memlog").disabled= false ;	
				}
			}
			
			function memReg()
			{
				var title = document.getElementById('memtit').value;
				var fname = document.getElementById('memf').value;
				var lname = document.getElementById('meml').value;
				var post = document.getElementById('mempost').value;
				var street = document.getElementById('memstreet').value;
				var town = document.getElementById('memtown').value;
				var county = document.getElementById('memcounty').value;
				var mobile = document.getElementById('memmob').value;
				var email = document.getElementById('mememail').value;
				var pass = document.getElementById('memword').value;
				var conf = document.getElementById('memconf').value;
				var error = 0;
				if (title == "")
				{
					error = error +1;
					document.getElementById("memtit").style.backgroundColor="#FFA7A6";
				}
				else
				{
					document.getElementById("memtit").style.backgroundColor="#AAFFA6";
				}
				if (fname == "")
				{
					error = error +1;
					document.getElementById("memf").style.backgroundColor="#FFA7A6";
				}
				else
				{
					document.getElementById("memf").style.backgroundColor="#AAFFA6";
				}
				if (lname == "")
				{
					error = error +1;
					document.getElementById("meml").style.backgroundColor="#FFA7A6";
				}
				else
				{
					document.getElementById("meml").style.backgroundColor="#AAFFA6";
				}
				if (post == "")
				{
					error = error +1;
					document.getElementById("mempost").style.backgroundColor="#FFA7A6";
				}
				else
				{
					document.getElementById("mempost").style.backgroundColor="#AAFFA6";
				}
				if (street == "")
				{
					error = error +1;
					document.getElementById("memstreet").style.backgroundColor="#FFA7A6";
				}
				else
				{
					document.getElementById("memstreet").style.backgroundColor="#AAFFA6";
				}
				if (town == "")
				{
					error = error +1;
					document.getElementById("memtown").style.backgroundColor="#FFA7A6";
				}
				else
				{
					document.getElementById("memtown").style.backgroundColor="#AAFFA6";
				}
				if (county == "")
				{
					error = error +1;
					document.getElementById("memcounty").style.backgroundColor="#FFA7A6";
				}
				else
				{
					document.getElementById("memcounty").style.backgroundColor="#AAFFA6";
				}
				if (mobile == "")
				{
					error = error +1;
					document.getElementById("memmob").style.backgroundColor="#FFA7A6";
				}
				else
				{
					document.getElementById("memmob").style.backgroundColor="#AAFFA6";
				}
				if (email == "")
				{
					document.getElementById("mememail").style.backgroundColor="#FFA7A6";
					error = error +1;
				}
				else
				{
					var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
					if(reg.test(email) == false) 
					{
						document.getElementById("mememail").style.backgroundColor="#FFA7A6";
						error = error +1;
					}
					else
					{
						document.getElementById("mememail").style.backgroundColor="#AAFFA6";
					}
				}
				if (pass == "")
				{
					error = error +1;
					document.getElementById("memword").style.backgroundColor="#FFA7A6";
				}
				else
				{
					document.getElementById("memword").style.backgroundColor="#AAFFA6";
				}
				if (conf == "")
				{
					error = error +1;
					document.getElementById("memconf").style.backgroundColor="#FFA7A6";
				}
				else
				{
					if (conf == pass)
					{
						document.getElementById("memconf").style.backgroundColor="#AAFFA6";
					}
					else
					{
						error = error +1;
						document.getElementById("memconf").style.backgroundColor="#FFA7A6";
					}
				}
				if (error > 0)
				{
					document.getElementById("memrega").disabled= true;
				}
				else
				{
					document.getElementById("memrega").disabled= false ;	
				}
			}
