$().ready(function() {

	function findValueCallback(event, data, formatted) {
		$("<li>").html( !data ? "No match!" : "Selected: " + formatted).appendTo("#result");
	}
	
	function formatItem(row) {
		return row[0] + " (<strong>id: " + row[1] + "</strong>)";
	}
	function formatResult(row) {
		return row[0].replace(/(<.+?>)/gi, '');
	}
	
	$('#home-map-filter').jqm({ajax: '/kaart.asp', trigger: 'a.dialogs'});

	$("#addToFavourites").click(function(){	
		if (window.external) { 
			window.external.AddFavorite(location.href,document.title) 
		} 
		else { 
			alert("Deze functie wordt niet ondersteunt door uw internet browser.");
		}
		})
	$("#makeHomepage").click(function(){	
		this.style.behavior='url(#default#homepage)';
		this.setHomePage('http://www.wielevert.nl');
		})

	$("#what").autocomplete('/ajax/search.asp', {scrollHeight: 70, matchContains: true});
	$("#where").autocomplete('/ajax/location.asp', {scrollHeight: 70, matchContains: true});
	
	$("#where").result(function(event, data, formatted) {
		if (data){
			$("#where-id").val(data[1]);
			$("#where-name").val(data[0]);			
		}
	});	

	if (document.getElementById('list1a')) {
		$('#list1a').accordion({ event: 'mouseover', animated: 'easeslide' });
	}
	if (document.getElementById('spotlight-items-0')){
		$("#spotlight").eSlider();
		
		$("#spotlight-items a").tooltip({
			bodyHandler: function() {
				return $($(this).attr("rel")).html();
			},
			showURL: false
		});	
	}
	$('#recent-items').cycle({
		fx:    'scrollVert',
		speed:  600,
		pause:   1,
		timeout:       4000,
		next:   '#cycle-next', 
		prev:   '#cycle-prev'		
	});


});
