var Profile = {
	
	bind : function() {
		$('.details-info a').click(Profile.loadSection);

	    $('.hoverThumb').bind('mouseenter', function() {
			$('.' + $(this).attr('rel')).css({top:'31px', left:'0'}).show();
		});
		
		$('.hoverThumb').bind('mouseleave', function() {
			$('.hoverContent').hide();
		});
	
	},
	
	/**
	 * loads a specific profile section such as followers, following, comments etc.
	 * 
	 * @return {Boolean} false - prevents the default action
	 */
	loadSection : function() {  					 							  
		var sectionUrl = '/' + $(this).attr('id').substr(1).replace(/-/g, '/'); 	
                                 
		var containerId = $(this).attr('id').substr(1);							  
            
		$('.details-info a').removeClass('active');
		$(this).addClass('active');
		
		if (containerId.indexOf('education') > 0 || containerId.indexOf('job') > 0){ 
				$('.details-content > div').hide(); 
				$('#' + containerId).show();
				return false;
				}
		
		$.ajax({
			url : sectionUrl,
			success : function(text) {
				$('.details-content > div').hide();
				$('#' + containerId).html(text).show();
				
				// if this is my messages load javascript file 
				// to bind the events
				if (containerId.indexOf('messages') > 0) {
					$.ajax({
						dataType : 'script',
						url : '/scripts/mayomo_lib/messages.lib.js',
						success : function() {
							Messages.bind();
						}
					});
				}
			}
		});
		
		return false;
	}

	};
