

$(document).ready(function(){ 

	//recent additions on home page
	$.get("wp-rss2.php",{},function(recent){
      	
		var myHTMLOutput = '';
	 	myHTMLOutput += '<h2>Recent Recipes:</h2><ul>';
	  	
		$('item',recent).each(function(findTitles) {
			var recTitle = $(this).find("title").text();
			var recLink = $(this).find("link").text();
			
			var mydata = '<li><a href="' + recLink + '" rel="bookmark">'+ recTitle + '</a></li>';
			myHTMLOutput = myHTMLOutput + mydata;
		});
		myHTMLOutput += '</ul>';
		
		$("#recentadds").append(myHTMLOutput);
	});
	
	
	//creates draggable ingredients and adds them to the search query
	$("#searchsubmit").hide(); //hide the submit button
	
	$(".dragme").draggable();
	
	var myItem = '';
	
	$("#searchpan").droppable({
	accept: ".dragme",
	hoverClass: 'droppable-hover',
	drop: function(ev, ui) {
		myItem += $(ui.draggable).attr("alt") + ' ';
		$("#s").attr("value", myItem); //adding the food item to the search query
		$("#searchpan").css({'background' : 'url("../wp-content/themes/reciplex/images/hot_stove.gif")' }); //displaying hot stove image
    	$('input:submit').click(); //click the hidden button
	}
	});

	
}); //end ready function
