function update_meet_an_expert(i){
	var properName = expertFirstNames[i] + " " + expertLastNames[i];
	if(!(properName.length > 1)){
		properName = expertFullNames[i];
	}
	// Update Image
	if($('#featured-agent-photo img').attr("src") != expertPhotos[i]){
	    $('#featured-agent-photo').addClass('loading');
	    $('#featured-agent-photo img').fadeOut('slow', function(){
		    $(this).attr("src", expertPhotos[i]).load(function(){
		        $(this).fadeIn('slow', function(){
		            $('#featured-agent-photo').removeClass('loading');
		        });
	        });
	    })
	    .attr("alt", properName)
	    .attr("title", properName);
	}
	// Update Info
	$('#featured-agent-name .agentName').attr("href", expertUrls[i]);
    $('#featured-agent-name .firstName').html(expertFirstNames[i]);
    $('#featured-agent-name .lastName').html(expertLastNames[i]);
    $('#featured-agent-card .officeName').html(expertFullNames[i]);
    $('#featured-agent-card .agentAddress .agentCity').html(expertCities[i]);
    $('#featured-agent-card .agentAddress .agentState').html(expertStateAbbrevs[i]);
    $('#featured-agent-card .agentUrl').attr("href", expertLinks[i]);
    // Update Stats
    $('#featured-agent-stats #propertiesSold dd').html(expertTransactions[i]);
    $('#featured-agent-stats #millionSales dd').html(expertVolumes[i]);
    $('#featured-agent-stats #yearsExperience dd').html(expertYears[i]);
    $('#featured-agent-stats #numAssistants dd').html(expertTeams[i]);
}

function meet_an_expert(e){
	var target = $(e.target).closest('a');
	
	// Change "current" state
	$('#featured-agent-menu ul li').removeClass('current');		
	$(target).closest('li').addClass('current');
	
	// Update agent card
	for(var i=0; i<expertCount; i++){
		if($(target).attr("href") == ("#" + expertCustIds[i])){
			update_meet_an_expert(i);
			break;
		}
		/*if(expertLinks[i].match($(target).attr("href").replace("#",""))){
			update_meet_an_expert(i);
			break;
		}*/
	}

	return false;
}

function build_meet_an_expert(){
	// Build agent menu from javascript
	/*
	$('#featured-agent-menu ul li a').each(function(i){
		var properName = expertFirstNames[i] + " " + expertLastNames[i];
		if(!(properName.length > 1)){
			properName = expertFullNames[i];
		}
		$(this).attr("href", "#" + expertLinks[i]);
		$(this).attr("title", properName);
		$(this).find("img").attr("src", (expertUrls[i] + "/images/photo_small.jpg"));
		$(this).find("img").attr("alt", properName);
	});
	*/
	// Set current agent to first agent
	$("#featured-agent-menu ul li:first-child a").trigger('click.meet_an_expert');
}

