function externalLinks() {
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") {
			anchor.target = "_blank";
		}
	}
}


document.observe("dom:loaded", function() {
	externalLinks();
	if (location.hash !== '') {
		var locs = location.hash.replace('#','');
		locs = locs.split('/');
		if (locs.length === 1) {
			locs[1] = 0;
		}
		new Ajax.Updater(
			'content',
			'/selectedwork?display=' + locs[0] + '&index=' + locs[1], 
			{
				asynchronous:true, 
				evalScripts:true, 
				onLoaded:function(request) {}, 
				requestHeaders:['X-Update', 'content']
			}
		) 	
	}
});
