function init () {
	anchors = document.getElementsByTagName('a');
	for (var i = anchors.length - 1; i >= 0; i--){
		if (anchors[i].rel == 'external') {
			anchors[i].onclick =  newWindow;
		} else if (anchors[i].className.indexOf('enlarge') > -1) {
			anchors[i].onclick = newZoomWindow;
		};
	};
}

function newWindow (e) {
	if (!e) var e = window.event;
	if (e.srcElement) {
		destinationURL = e.srcElement.href;
	} else if (e.currentTarget) {
		destinationURL = e.currentTarget.href;
	};
	window.open(destinationURL);
	e.cancelBubble = true;
	if (e.stopPropagation) e.stopPropagation();
	return false;
}

function newZoomWindow(e) {
	if (!e) var e = window.event;
	if (e.srcElement) {
		destinationURL = e.srcElement.parentNode.href;
	} else if (e.currentTarget) {
		destinationURL = e.currentTarget.href;
	};
	window.open(destinationURL, 'crc_gallery', 'width=800,height=500');
	e.cancelBubble = true;
	if (e.stopPropagation) e.stopPropagation();
	return false;
}

init();