$(document).ready( function()
{
	// add no/js class to html
	$("html").removeClass("nojs").addClass("js");

	// Blur clicked links (purely aesthetic, sorry)
	$("a").live("focus",function(){if(this.blur)this.blur();});

    $('a[rel="external"]').click( function() {
        window.open( $(this).attr('href') );
        return false;
    });
   
	$('a[rel="popup"]').click(function(){
		var href = $(this).attr('href');
		window.open(href, 'popup', 'width=400,height=500,toolbar=no');
		return false;
	});

	$('a[rel="lightbox"]').fancybox({
		'titlePosition'	: 'inside',
		'cyclic'		: true,
		'swf'			: {wmode: 'transparent'},
		'titleFormat'	: function formatTitle(title, currentArray, currentIndex, currentOpts) {
			return '<span class="index">'+(currentIndex + 1) + '/' + currentArray.length + '</span>' + (title && title.length ? ' - '+title : '' );}
	});

});
