function loadSearch()
{
	//show message when the feed is loading
	$("#update-alert").text("Loading new results...");
	
	//ajax request to get the results from relatedsearch.php
	$.ajax({
			url : "<?php echo get_option('home'); ?>/wp-content/themes/arthemia/single.php", 
			success : function(results){
		
			//counter to count new results
			var counter = 0;
			
			//find each 'div' with class 'result'  from the response and loop through them
			$(results).find("div.result").each(function(i){
				
				//get the id of the div
				var div_id = $(this).attr("id");
				
				//check if any div with the same id already exists
				if( $("#twitter-update div#" + div_id).length == 0 )
				{
					//if doesn't exist then prepend this div
					$("#twitter-update").prepend(this);					
					
					//increase the counter
					counter++;
				}
			});
			
			//show the number of new results
			if(counter == 0)
				$("#update-alert").text("no new result");
			else if(counter == 1)
				$("#update-alert").text("1 new result");
			else
				$("#update-alert").text(counter + " new results");				
   		}
	});
	
		
}

$(document).ready(function(){	
	loadSearch();
	setInterval("loadSearch()",3000);
});