sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

$(window).resize(function(){
	if($('.sidebarNav li').hasClass('current-cat')) {
		var off, offLeft, offTop;		
		off = $('.sidebarNav li.current-cat a').offset();
		offLeft = off.left + 184;
		offLeft += 'px';
		offTop = off.top - 5;
		offTop += 'px';
		$('span.ribbonFixed').css('left', offLeft);
		$('span.ribbonFixed').css('top', offTop);
		$('span.ribbonFixed').show();
	}
});

$(document).ready(function(){
	$(document).pngFix();
	$('a.wantToKnow').corner('7px');
	$('.sidebarTwitter').corner('7px');
	$('.tweets').corner('7px');
	
	
	$('#content .post:last').css('border-bottom', '0');
	$('#content .post:last').css('padding-bottom', '0');
	
	$('.tweets p:last').css('border-bottom', '0');
	$('.tweets p:last').css('padding-bottom', '0');
	$('.tweets p:last').css('margin-bottom', '0');
	
	if($('.sidebarNav li').hasClass('current-cat')) {
		var off, offLeft, offTop;		
		off = $('.sidebarNav li.current-cat a').offset();
		offLeft = off.left + 184;
		offLeft += 'px';
		offTop = off.top - 5;
		offTop += 'px';
		$('span.ribbonFixed').css('left', offLeft);
		$('span.ribbonFixed').css('top', offTop);
		$('span.ribbonFixed').show();
	}
	
	$('.sidebarNav li a').mouseover(function(){
		var off, offLeft, offTop;		
		off = $(this).offset();
		offLeft = off.left + 184;
		offLeft += 'px';
		offTop = off.top - 5;
		offTop += 'px';
		$('span.ribbon').css('left', offLeft);
		$('span.ribbon').css('top', offTop);
		$('span.ribbon').show();
	}).mouseout(function(){
		$('span.ribbon').hide();
	});
	
	$('#nav li ul').mouseenter(function(){
		$(this).show();
		$(this).parents('li:eg(0)').addClass('activ');
		
	})
	.mouseleave(function(){
		$(this).parents('li:eg(0)').removeClass('activ');
		$(this).hide();
	});
	
	$('#nav li a').mouseenter(function(){
		$(this).parents('li:eq(0)').children('ul:eq(0)').show();
	})
	.mouseleave(function(){
		if(!$(this).parents('li:eq(0)').hasClass('activ'))
			$(this).parents('li:eq(0)').children('ul:eq(0)').hide();
	});
	
});