// JavaScript Document
$(document).ready(function(){
	// Handle the menu items in the bottom content area.
	$("#common-useless").click(function(e) {
		SetArticleContent(e, "/content/bodyshaping-articles/5-common-but-useless-fat-burning-exercises.php", this)
	});
	
    $("#better-arms").click(function(e) {
		SetArticleContent(e, "/content/bodyshaping-articles/7-minutes-better-arms.php", this);
	});
	
    $("#change-yourself").click(function(e) {
		SetArticleContent(e, "/content/bodyshaping-articles/why-change-yourself.php", this);
	});
	
	//$("#common-useless").click();	
});

function SetArticleContent(e, url, menuItem)
{
	e.preventDefault();
	
	$.ajax({ url: url, 
	   	context: document.body, 
	   	dataType: "html",
	   	processData: false,
	   	success: function(data){
		  	$("#article-content").html(data);
	   	},
	   	error:function(xhr,err,e){ 
	   		alert( "Error: " + err ); 
		}
	})
	
	currentTab = menuItem.id;
		
	var oldCurrent = $("#article-items").children(".article-item-selected");
	
	oldCurrent.removeClass('article-item-selected');
	
	//$(menuItem).removeClass('video-tab');
	$(menuItem).parent().addClass('article-item-selected');
	
	$('html, body').animate({
		scrollTop: $("#article-content").offset().top
	}, 500);
	
	var videoDiv = $("#video-menu");
	if (window.PausePlayer) {
		PausePlayer();
	}
}
