var parse_str = '';
function ShowBlockComment() {
	if (jQuery('#comments').css('display') == 'none') {
		MP.ShowBlock('commbutt');
		return MP.ShowBlock('comments');
	} else {
		MP.HideBlock('commbutt');
		MP.HideBlock('commentform');
		return MP.HideBlock('comments');
	}
}
jQuery(document).ready(function() {
	parse_str = MP.ParseQueryString();
	// Если главная страница
	if (parse_str['an'] == 'index') {
		MP.PaintDiv('#contentblockmain div[class=news],#contentblockmain div[class=bloglist]','gray', 'class');
	}
	if (parse_str['an'] == 'anecdote' || parse_str['an'] == 'funny-story' || parse_str['an'] == 'anecdote_view' || parse_str['an'] == 'anecdote_rate'
		|| parse_str['an'] == 'anecdote_type' || parse_str['an'] == 'funny-story_rate' || parse_str['an'] == 'funny-story_view'  || parse_str['an'] == 'funny-story_type') 
	{
		MP.PaintDiv('#joke_main div[class=joke]', 'gray', 'class');
	}
	if (parse_str['an'] == 'cl_phorum'|| parse_str['an'] == 'phorum') {
		MP.PaintDiv('#data div[class=r2]', 'gray', 'class');
	}
	if (parse_str['an'] == 'thread') {
		MP.PaintDiv('#data div[class=message]', 'gray', 'class');
	}
        if (parse_str['an'] == 'exc_text' || parse_str['an'] == 'exc_text_rate'  || parse_str['an'] == 'exc_text_view') {
		MP.PaintDiv('#exc_text_main div[class=excl_audio]', 'gray', 'class');
	}
	// Делаем анализ выводимых данных. Если меньше 75% от общего блока - выводим полный блок
	if(parse_str['an']=='index' || parse_str['an']=='') {
		var max_length_sym = 500;
		jQuery('div[id^="text_off"]').each(function(){
			uid_block = jQuery(this).attr('id').replace('text_off','');
			text1 = jQuery(this).text().split('<a ');
			text2_length = jQuery('#text_on'+uid_block).text().length;
			text1 = text1[0];
			if(text1.length*2 > text2_length) {
				jQuery(this).find('a:first').click();
			}
			/*
			text2 = jQuery('#text_on'+uid_block).text();
			if(Math.round(100*(text1.length/(text2.length-8)))>=75) {
				jQuery(this).find('a:first').click();
			}
			*/
		})
	}
   liveinternet = 'http://www.liveinternet.ru/journal_post.php?action=n_add&cnurl='+encodeURIComponent(window.location.href)+'&cntitle_win='+(unescape(document.title));
   jQuery(".liveinternet").html('<img src="http://i.li.ru/images/icons/16.gif" border="0">');
   jQuery(".liveinternet").attr('href',liveinternet);
   jQuery(".liveinternet").attr('title','Запостить на LiveInternet');
   jQuery(".liveinternet").attr('target','_blank');

});

function showhide_onclick(layer,hrefid)
{
 if(jQuery('#'+layer).css('display')=='block') {
   jQuery('#'+layer).css('display','none');
   if(hrefid != '') {
      jQuery('#'+hrefid).attr('class',''); 
   }
  }
 else {
   jQuery('#'+layer).css('display','block');
   if(hrefid != '') jQuery('#'+hrefid).attr('class','a_link');
  }
 return false;
}

function show_div(d1,d2)
{
	document.getElementById(d1).style.display='block';
	document.getElementById(d2).style.display='none';
}

function sStyle(uid)
{
   hd01=document.getElementById(uid);
   hd01.style.display = "block";
}

function rStyle(uid)
{
   hd01=document.getElementById(uid);
   hd01.style.display = "none";
}
