// Обработка новостей на главной странице
$(function main_news () {
    nNews = $("div[id^=m-id-]")
    nNews.each(function (nid) {
		if ($(this).text().length<305){text = $(this).text();}else{text = $(this).text().substr(0,305) + "&hellip;";}
		$(this).replaceWith("<div id='n1-id-"+nid+"' class='modnews descript'><div class='image'></div>" + text + "</div>");
		$(this).find("img").filter("img:first").unwrap().removeAttr("align").fadeIn(10).prependTo("div[id='n1-id-"+nid+"'] div[class*=image]");
		$("div[class*=image]:empty").hide(10);		
	});	
	$(".main-short").click(function(){window.location=$(this).find("a").attr("href"); return false;}); 
});
// Форма авторизации
$(function() {
	$( "#logindialog" ).dialog({
		autoOpen: false,
		width: 325,
		modal:'true'
	});
	$('#loginlink').click(function(){
		$('#logindialog').dialog('open');
		return false;
	});
});
/*
 * http://share42.com
 * Date: 11.06.2011
 * (c) 2011, Dimox
 */
function share42(f,u,t){if(!u)u=location.href;if(!t)t=document.title;u=encodeURIComponent(u);t=encodeURIComponent(t);var s=new Array('"http://www.facebook.com/sharer.php?u='+u+'&t='+t+'" title="Поделиться в Facebook"','"http://www.livejournal.com/update.bml?event='+u+'&subject='+t+'" title="Опубликовать в LiveJournal"','"http://connect.mail.ru/share?url='+u+'&title='+t+'" title="Поделиться в Моем Мире@Mail.Ru"','"http://www.odnoklassniki.ru/dk?st.cmd=addShare&st._surl='+u+'&title='+t+'" title="Добавить в Одноклассники"','"http://twitter.com/share?text='+t+'&url='+u+'" title="Добавить в Twitter"','"#" onclick="window.open(\'http://vkontakte.ru/share.php?url='+u+'\', \'_blank\', \'scrollbars=0, resizable=1, menubar=0, left=200, top=200, width=554, height=421, toolbar=0, status=0\');return false" title="Поделиться В Контакте"','"http://zakladki.yandex.ru/newlink.xml?url='+u+'&name='+t+'" title="Добавить в Яндекс.Закладки"');for(i=0;i<s.length;i++)document.write('<a rel="nofollow" style="display:inline-block;width:24px;height:24px;margin:0 7px 7px 0;background:url('+f+'icons.png) -'+24*i+'px 0" href='+s[i]+' target="_blank"></a>')}
