
	/*
	NOTE: This should change if we have more than one autocompletable field on a page
*/

function acOnItemSelect(li) {
	// Put focus back on the input box
	$(".autocompletable").focus();
}

$(function() {
	var acOptions = {
		delay: 0,
		//minChars : 2,
		maxItemsToShow: 10,
		onItemSelect: acOnItemSelect
	};
	updateSearch($("#listingTypeID").val());	
	
	$(".autocompletable").autocomplete("/ajax/suggest/", acOptions);
	//$(".autocompletable").autocompleteArray(["W1", "W2", "W3", "N15", "N22", "NW1"]);
	$("#listingTypeID").change(function() {
		updateSearch($(this).val());
	});	

	//$(".accordionWrapper").msAccordion({defaultid:0});
	//$().runSlideShow();
	$(".addbasket").click(function() {
		
		var shortlistValSplitter 	= (this.id).split("_");
		var shortlistVal 			= shortlistValSplitter[1];

		$.ajax({
		type: "POST",
		url: "/my-account/add-to-basket/",
		data: { propertyID: shortlistVal, action: "addToBasket"},
		success: function(theResponse) {
				$("#shortlist_" + shortlistVal).animate({ opacity: 0 }, 500);
				$("#shortlist_" + shortlistVal).addClass('saved');
				$("#shortlist_" + shortlistVal).animate({ opacity: 1 }, 500);
		}

		});  
		return false;
	});

});
$(document).ready(function() { 
	$("#nav ul").superfish({ 
		delay:       600,                            // one second delay on mouseout 
		animation:   {opacity:'show',height:'show'},  // fade-in and slide-down animation 
		speed:       'normal',                          // faster animation speed 
		autoArrows:  false,                           // disable generation of arrow mark-up 
		dropShadows: false                            // disable drop shadows 
	}); 
}); 

