jQuery(document).ready(function() {
	jQuery('#sidebarhome .showmore').click(function() {
													
		var showFull = jQuery(this).parents('.sidebarblock').find('.showfull');
		var showLess = jQuery(this).parents('.sidebarblock').find('.showprev');
		var contentLink = jQuery(this).attr("href");
		var toggleBlock = null;
		
		if (showFull.is(":visible")) {
			showFull.children().remove();
			showFull.hide();
			showLess.show();
			if (jQuery(this).parent().hasClass("distmore")) {
				jQuery(this).html('show all');
				toggleBlock = jQuery(this).parent().parent().children('.sidewrap').children('h2');
			} else {
				toggleBlock = jQuery(this).parent();
				jQuery(this).parent().parent().parent().children('.distmore').children('a').html('show all');
			}
		} else {
			showFull.show();
			showFull.html('<div style="text-align: center"<img src="/wp-content/themes/press/img/loading.gif" alt="loading..." />');
			showLess.hide();
			jQuery(showFull).load(contentLink);
			if (jQuery(this).parent().hasClass("distmore")) {
				jQuery(this).html('show less');
				toggleBlock = jQuery(this).parent().parent().children('.sidewrap').children('h2');
			} else {
				toggleBlock = jQuery(this).parent();
				jQuery(this).parent().parent().parent().children('.distmore').children('a').html('show less');
			}
		}
		
		// Plus/minus
		if (toggleBlock.hasClass("plus")) {
			toggleBlock.removeClass("plus");
			toggleBlock.addClass("minus");
		} else {
			toggleBlock.removeClass("minus");
			toggleBlock.addClass("plus");
		}
		return false;
	});
});