$(function() {

	var cache = new Array();

	$('#mc_mid_menu a').click(function() {
	
		var page = $(this).attr('cap');
		if(page) 
		{
			
			var newcontent = fetchContent(page);
		
		}
	
	});
	
	function fetchContent(pageid)
	{
	
		if(pageid)
		{
		
			$('#mc_mid_slide').fadeOut('slow',function() { 
			$('#mc_mid_slide').html(cache[pageid]); $(this).fadeIn('slow'); });
		
		}
	
	}
	
	function init()
	{
		
		var res = $.ajax({
		
			type:"POST",
			url:"ajax/pages.cache.php",
			data:"all=yes",
			async:false
		
		}).responseText;
		if(res)
		{
		
			var breakdown = res.split("&|&");
			if(breakdown.length)
			{
			
				for(var i=0; i<breakdown.length; i++)
				{
				
					var tmp = breakdown[i].split("[&]");
					if(tmp.length)
					{
						cache[parseInt(tmp[0])] = tmp[1];
					}
				
				}
			
			}
		
		}
	
	}
	
	init();

});
