﻿        $(document).ready(function() {

            
            $('#finder .person').hover(function() {
                $(this).addClass('hoverPerson');
            }, function() {
                $(this).removeClass('hoverPerson');
            }).click(function() {
                $(this).toggleClass('selectPerson');
            });
            
            BindTypeAhead();
        });
        
        /*function ShareFriends_Send() {
        
        }*/
        
        	    
	    function BindTypeAhead() {
	    	$('#txtFriend').autocomplete('/services/FriendNameSug.ashx', {
	    		        matchCase: false, mustMatch: true,
	    		        minChars: 3, max: 25,
	    		        width: 410,
	                    formatItem: function(item) {
	                        var row = eval('(' + item.toString() + ')' );
	                        
	                        //if (row.text.indexOf( $('#txtFriend').val()) > 0)
	                            return row.text;
	                        //else
	                        //    return '';
	                        
	                        //var row = eval('(' + item.toString() + ')' );
	                        //return row.text;
	                    },
	    		        formatResult: function(row) {
	    		            //return row;
	    		            return eval('(' + row.toString()+ ')' ).text;
	    		        }
	    	        }).result(function(event, item) {
	                    var row = eval('(' + item.toString() + ')' );
	                    $('.person[@id=' + row.id + ']').addClass('selectPerson')
	                    $(this).val('').focus();
	                    
	                    //location.href = 'http://' + row.url;
            	});
	    }

