friendSearch = {
    downloadOnFocus : true,

	nonSelectOnType : true,
	hideOnClickOut: true,
    searchableField : ['fullName' , 'user_Id'],
    //searchableField : ['fullName', 'user_Id'],
    resultsClass : 'ac_search ac_main',
    preHtml : '<div class="tl"></div><div class="tr"></div>',
	resultCacheOn : 1,
	
	htmlCacheOn  : 1,

    display : {
		theObject : this.objects,
        resultsWidth:  '160px',
        //offsetLeft:  -6,
        offsetTop:  5,
		offsetLeft:   ($.browser.opera || $.browser.safari) ? -8 : -7,
        
	    innerItems :
	       function (item){
	                //return ono sto oces da bude u jednom div elementu matcha
                    divContent = '';                    
                    divContent += item['avatar'];
                    //divContent += item['firstName'] + ' ' + item['secondName'];
                    divContent += item['fullName'];
	                return divContent;
	            },
	     
	postShowHook:
		function (){
			//this.objects.results.fadeOut(150);
		}

    },
            callback : 
            {
            	caught:

            	function (){

            		window.location = '/trazilica?ime=' + jQuery('#search_input').val() + '&exf=off';
            	},
            
                call: 
                function (item){

	                this.objects.results.fadeOut(300);
	                this.objects.element.attr('value', item.firstName + ' ' + item.secondName)
	                this.objects.element.focus();
                    window.location = '/profil/' + item.user_Id;
                }
            }
}
	jQuery('#search_input').click(function(i){jQuery('#search_input').val('');})

	jQuery('#search_input').autosuggest('/?rpc=prijatelji.sviPrijateljiOdLogiranog&friend', friendSearch);
	

