jQuery.noConflict();
jQuery(document).ready(function() {
	jQuery("#fundchooser").result( function(event, data, formatted) {
		surfto_detail( data[ 1 ] );
	});

	jQuery("#fundchooser").autocomplete("/fund_search", {
		width: 260,
		selectFirst: false,
		max: 500,
		cacheLength: 1,
		formatItem: function( row ) {
			if( row[ 1 ] == 0 ){
				return 'keine Suchergebnisse';
			} else {
				return '<div onclick=\'surfto_detail("' + row[ 1 ] + '")\' >' + row[ 0 ] +'&nbsp;<img style="display: inline; padding:0;margin:0" src="/static/images/foonds/symbols/pfeil_gross.gif"></div>';
			}
		}
	});
});

function surfto_detail( id ) {

	var url = '/detail/' + id;
	location.href=url;
}
