function addBookmark(url, title)
{
	if (!url) url = location.href;
	if (!title) title = document.title;
	//Gecko
	if ((typeof window.sidebar == "object") && (typeof window.sidebar.addPanel == "function")) window.sidebar.addPanel (title, url, "");
	//IE4+
	else if (typeof window.external == "object") window.external.AddFavorite(url, title);
	//Opera7+
	else if (window.opera && document.createElement)
	{
		var a = document.createElement('A');
		if (!a) return false; //IF Opera 6
		a.setAttribute('rel','sidebar');
		a.setAttribute('href',url);
		a.setAttribute('title',title);
		a.click();
	}
	else return false;
	return true;
}
var local_re = new RegExp('http://[a-z\-]*\.ct24\.ru/');
function click_logger(e)
{
	if (!local_re.test(this.href))
	{
		var i = new Image();
		i.src = 'http://www.ct24.ru/click/' + this.href;
	}
	if (typeof(this.old_onclick) != 'undefined' && this.old_onclick)
	{
		return this.old_onclick();
	}
	return true;
}
function click_logger_init()
{
	var a = document.getElementsByTagName('A');
	for (i = 0; i < a.length; i++)
	{
		if (typeof(a[i].onclick) != 'undefined' && a[i].onclick)
		{
			a[i].old_onclick = a[i].onclick;
		}
		a[i].onclick = click_logger;
	}
}
function get_object_top(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop;
			obj = obj.offsetParent;
		}
	}
	else if (obj.y) curtop += obj.y;
	return curtop;
}
var scrolling = 0;
var scroll_base;
function scroller()
{
	scrolling = 1;
	var o = document.getElementById('right_ads');
	o.style.position = 'relative';
	var ot = get_object_top(o);
	if (typeof(scroll_base) == 'undefined')
	{
		scroll_base = ot;
	}
	if (ot - scroll_base != document.body.scrollTop)
	{
		o.style.top = (ot + (document.body.scrollTop - ot +scroll_base) / 5 - scroll_base) + 'px';
		setTimeout(scroller, 100);
		return;
	}
	scrolling = 0;
}
function scrollit()
{
	if (scrolling) return;
	scroller();
}
