//---------------------------------------------------------
//
// Property Searching
//
//---------------------------------------------------------

function showData(start, amount, where, order, dir, data) {
	$.get("/includes/propsearch/getData.php", {start: start, amount: amount, where: where, order: order, dir: dir, data: data}, function(searchData) {
	
		var temp = searchData.split("$$$");		
		$("#tabledata").html(temp[0]);
		$("#tableinfo").html(temp[1]);
		$("#sortmenu").html(temp[2]);
		$("#pagelinks").html(temp[3]);
		$("#pagelinks2").html(temp[3]);
		
		try {
			if(document.documentElement && document.documentElement.scrollTop) {
				document.documentElement.scrollTop = 0;
			}
			else if (document.body) {
				document.body.scrollTop = 0;
			}
		}
		catch(e){}
	});
}

/* 

var XMLData;

function showData(start, amount, where, order, dir, data) {

		$.ajax({
			url: "/test_sites/includes/propsearch/getXmlData.php",
			cache: false,
			data: {where: where, order: order, data: data},
			success: function(searchData) {
				XMLData = searchData;
				TemplateXML(XMLData, data);
			}
		});
	
}

function TemplateXML(xml, start, amount, rowTemplate) {
	$.ajax({
		url: "/test_sites/includes/propsearch/applyRowTemplate.php",
		type: "POST",
		cache: false,
		contentType: "text/xml",
		processData: false,
		//data: { xmlData: escape(xml), start: start, amount: amount, rowTemplate: rowTemplate },
		data: {data: xml},
		success: function(searchData) {
			$("#tabledata").html(searchData);
		}
	});
} */

//------------------------------------------------------
//
// Add to short list
//
//------------------------------------------------------

function addToShortlist(propref) {
	$.get("/includes/addtoshortlist.php", {prop: propref}, function() {
		alert("Added to shortlist");
	});
}

function removeFromShortlist(propref) {
	$.get("/includes/removefromshortlist.php", {prop: propref}, function() {
		alert("Removed from shortlist");
	});
}