/* @author lukas.sommer */

function getHome(){
	window.scroll(0,0);	
	$.post("blog_minimal/home.php", function(result) {
 		$('#blog_insert').html(result); 
	});
}

function getMenu() {
	window.scroll(0,0);	
	$.post("blog_minimal/menu.php", function(result) {
 		$('#blog_insert').html(result); 
	});
}

function Paginate(period){
	window.scroll(0,0);	
	$.post("blog_minimal/period" + period + ".php", function(result) {
 		$('#blog_insert').html(result); 
	});
}

function getArchives(archives_url){
	window.scroll(0,0);
	// ajax call
	$.post(archives_url, function(result) {
		// strip out links
		result=result.replace(/<a.*href="(.*?)".*>(.*?)<\/a>/gi, " $2 ");
 		$('#blog_insert').html($('#minimal_blog_insert', result)); 
		// hide comments, sharing and tags
 		$('.postmeta_hook').each(function(){
        	$(this).hide();
      	});
      	// count post-header class - if more then 4 posts in the archive display link to the maximal blog
      	if ($('.post-header').size() > 4) {   	
      		$('#blog_insert').append('<img src="images/underline.gif" alt="blog trenner" class="blogcont_img" /><p>We keep it minimal here. More of this archive at the <a href="' + archives_url + '" title="Link to the archives page of the maximal michelberger blog" target="_blank">maximal blog.</a></p>');
      	}
	});
}

function getCategories(category_url, setcat){
	// set news string through id
	if(setcat == 1) {
		setcat = "news";
	}
	else if (setcat == 3) {
		setcat = "events";
	}
	window.scroll(0,0);
	// ajax call
	$.post('blog/?cat=' + category_url, function(result) { 
		// strip out links
		result=result.replace(/<a.*href="(.*?)".*>(.*?)<\/a>/gi, " $2 ");
		$('#blog_insert').html($('#minimal_blog_insert', result));
		// hide comments, sharing and tags
		$('.postmeta_hook').each(function(){
        	$(this).hide();
      	});
      	// prepend text to title
      	$('.pagetitle').prepend('Latest posts from the ');      	
      	// count post-header class - if more then 4 posts in the category display link to the maximal blog
      	if ($('.post-header').size() > 4) {
      		$('#blog_insert').append('<img src="images/underline.gif" alt="blog trenner" class="blogcont_img" /><p>We keep it minimal here. More of this Category at the <a href="http://www.michelbergerhotel.com/blog/category/' + setcat + '/" title="Link to the event category of the maximal michelberger blog" target="_blank">maximal blog.</a></p>');
      	}
	});
}




