// window.onscroll = function()
// {
// 	if (window.XMLHttpRequest)
// 	{
// 	  e = gebi('sticky');
// 		s = document.documentElement.scrollTop;
// 		x = self.pageYOffset;
// 		if (s > 118 || x > 118)
// 		{
// 			e.style.position = 'fixed'; 
// 			e.style.top = '10px';
// 		}
// 		else
// 		{
// 			e.style.position = 'relative'; 
// 			e.style.top = '128px';
// 		}
// 	}
// }

function gebi(e)
{
  return document.getElementById(e);
}

window.onload = function()
{
	e = getElementsByClass('note', null, 'li');
	var total = e.length;
	var cc = 0;
	if (total > 0)
	{
		for (var i = 0; i < total; i++)
		{
			if (hasClass(e[i], 'like'))
			{
				e[i].style.display = 'none';
				cc++;
			}
		}
	}
	title = gebi('notes_title');
	if ((total-1) <= cc)
	{
		title.style.display = 'none';
	}	// 
		// else
		// {
		// 	title.innerHTML = title.innerHTML+' ('+cc+' like'+(cc == 1 ? '' : 's')+')';
		// }
	gebi('notes').style.visibility = 'visible';
}

function hasClass(obj, className)
{
	var re = new RegExp("(^|\\s)" + className + "(\\s|$)");
	if (obj.className)
	  return re.test(obj.className);
	return false;
}

function getElementsByClass(searchClass,node,tag)
{
	var classElements = new Array();
	if (node == null)
		node = document;
	if (tag == null)
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
	for (i = 0, j = 0; i < elsLen; i++)
	{
		if (pattern.test(els[i].className))
		{
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}

