function smbarver(relativePath, f, u, t, m1, m2) {
	if(!u) u = location.href;
	if(!t) t = document.title;
	u = encodeURIComponent(u);
	t = encodeURIComponent(t);
	if(!m1) m1 = 162;
	if(!m2) m2 = 162;
	
	document.write('<div id="smbarver">');
	var s = new Array('"http://www.facebook.com/sharer.php?u=' + u + '&t=' + t + '" title="Поделиться в Facebook"',
		'"#" 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://twitter.com/share?text=' + t + '&url=' + u + '" title="Добавить в Twitter"',
		'"http://www.livejournal.com/update.bml?event=' + u + '&subject=' + t + '" title="Опубликовать в LiveJournal"',
		'"" onclick="return fav(this);" title="Сохранить в избранное браузера"',
		'"#" onclick="print();return false" title="Распечатать"');
		
	for(i=0; i<s.length; i++) 
		document.write('<a rel="nofollow" style="display:block;width:32px;height:32px;margin:0 0 6px;background:url(' + relativePath + f + '../img/design/sm-bar.png) -' + 32*i + 'px 0" href=' + s[i] + ' target="_blank"></a>');
	
	document.write('</div>');
	
	window.onload = function() {
		var p = document.getElementById('smbarver');
		function m() {
			var top = Math.max(document.body.scrollTop, document.documentElement.scrollTop);
			if(top+m2 < m1) {
				p.style.top = m1-top+'px';
			} else {
				p.style.top = m2+'px';
			}
		} m();
		window.onscroll = m;
	}
} 

function fav(a) {
	title = document.title;
	url = document.location;
	
	try {
		window.external.AddFavorite(url, title);
	} catch(e) {
		try {
			window.sidebar.addPanel(title, url, "");
		} catch(e) {
			if(typeof(opera) == "object") {
				a.rel = "sidebar";
				a.title = title;
				a.url = url;
				return true;
			} else {
				alert('Нажмите Ctrl-D, чтобы добавить страницу в закладки');
			}
		}
	}
	return false;
}
