var currentSection = null;
var navigationEnabled = true;

function DisplaySection(sectionId, duration)
{
	if(sectionId != currentSection.attr("id") && jQuery("#" + sectionId).length > 0 && navigationEnabled)
	{
		navigationEnabled = false;
		
		
		try
		{
			eval(currentSection.attr("id") + "_onexit();");
		}
		catch(e)
		{
			console.log(e);
		}
		
		if(!IsMobile())
		{
		
			jQuery("#" + sectionId).css("left", "100%").show();
			currentSection.animate(
				{
					"left" : "-100%",
				},
				duration,
				function()
				{
					jQuery(this).hide();
					navigationEnabled = true;
				}
			);
			jQuery("#" + sectionId).animate(
				{
					"left" : "0%",
				},
				duration,
				function()
				{
					try
					{
						eval( sectionId + "_onenter();");
					}
					catch(e)
					{
						console.log(e);
					}
				}
			);
		}
		else
		{
			currentSection.hide();
			jQuery("#" + sectionId).show();
			eval( sectionId + "_onenter();");
			navigationEnabled = true;
		}

		currentSection = jQuery("#" + sectionId);
		
	}
}

