$(document).ready(function() {

	// / Add nifty corners
	if (!($.browser.msie && $.browser.version <= 6.0)) {
		$('.right-col > ul > li.nifty-inside > ul > li')
				.corners('transparent 4px');
	} else {
		// Fucked IE!
	}

	// /
	// $('li.current-cat').addClass('selected');

	// / Unselect current page (in #menu & #sidebar)
	var loc = [];
	loc.push('');
	loc.push(window.location.href);
	loc.push(window.location.href.replace(/\/$/, ''));
	loc.push(window.location.pathname);
	loc.push(window.location.pathname.replace(/\/$/, ''));
	for (var i = 0; i < loc.length; i++) {
		loc[i] = "#menu a[href='" + loc[i] + "'], #sidebar a[href='" + loc[i]
				+ "']";
	}
	var ahref = loc.join(', ');
	$(ahref).removeAttr('href').addClass('selected').parent()
			.addClass('selected');

	// / Make beauty links
	$("div.link a:contains('«')").each(function() {
				var $this = $(this);
				var cont = $this.html();
				var newcont = cont.match(/^(.*)«(.+?)»(.*)$/);
				if (typeof newcont[1] != 'undefined' && newcont[1]) {
					$this.before(newcont[1]);
				}
				if (typeof newcont[2] != 'undefined' && newcont[2]) {
					$this.before('&laquo;');
					$this.html(newcont[2]);
					$this.after('&raquo;');
				}
				if (typeof newcont[3] != 'undefined' && newcont[3]) {
					$this.after(newcont[3]);
				}
			});
	$("div.link a:contains('&laquo;')").each(function() {
				var $this = $(this);
				var cont = $this.html();
				var newcont = cont.match(/^(.*)&laquo;(.+?)&raquo;(.*)$/);
				if (typeof newcont[1] != 'undefined' && newcont[1]) {
					$this.before(newcont[1]);
				}
				if (typeof newcont[2] != 'undefined' && newcont[2]) {
					$this.before('&laquo;');
					$this.html(newcont[2]);
					$this.after('&raquo;');
				}
				if (typeof newcont[3] != 'undefined' && newcont[3]) {
					$this.after(newcont[3]);
				}
			});
});

