vpoLinks = function(text) {
	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")) {
			switch (anchor.getAttribute("rel")) {
				case "external":
					anchor.target = "_blank";
					anchor.onclick = function(anchor) {
						return function() {
							if (typeof(pageTracker) == 'object')
								pageTracker._trackPageview('/.out/' + anchor.href.replace(/^http:\/\/(?:www[0-9]*\.)?([^\/]+)(?:\/.*)$/, "$1"));
							else if (typeof(urchinTracker) == 'function')
								urchinTracker('/.out/' + anchor.href.replace(/^http:\/\/(?:www[0-9]*\.)?([^\/]+)(?:\/.*)$/, "$1"));
						}
					}(anchor);
					break;
				case "magnify":
					anchor.imageLow = anchor.firstChild;
					anchor.onclickSave = anchor.onclick = function(anchor) {
						return function() {
							anchor.imageHigh = new Image();
							anchor.imageHigh.onload = function() {
								anchor.blur();
								anchor.imageHigh.origData = {
										width: anchor.imageHigh.width,
										height: anchor.imageHigh.height
									};
								anchor.imageHigh.style.position = 'absolute';
								anchor.style.width = (anchor.imageHigh.width = anchor.imageLow.width) + 'px';
								anchor.style.height = (anchor.imageHigh.height = anchor.imageLow.height) + 'px';
								anchor.imageHigh.style.zIndex = 999999;
								anchor.replaceChild(anchor.imageHigh, anchor.imageLow);
								anchor.onclick = function() { return false; };
								new Animator(
										{
											duration: 500,
											interval: 50,
											onComplete: function() {
													if (document.body.attachEvent) document.body.attachEvent('onclick', anchor.hidefunc);
													else document.body.addEventListener('click', anchor.hidefunc, true);
												}
										}
									)
									.addSubject(new NumericalStyleSubject(anchor.imageHigh, 'height', anchor.imageHigh.height, anchor.imageHigh.origData.height))
									.addSubject(new NumericalStyleSubject(anchor.imageHigh, 'width', anchor.imageHigh.width, anchor.imageHigh.origData.width))
									.seekFromTo(0,1);
							}
							anchor.imageHigh.src = anchor.href;
							return false;
						}
					}(anchor);
					anchor.hidefunc = function(anchor) {
						return function() {
							anchor.imageHigh.style.zIndex = anchor.imageHigh.style.zIndex - 1;
							new Animator(
									{
										duration: 500,
										interval: 50,
										onComplete: function() {
												anchor.onclick = anchor.onclickSave;
												if (document.body.detachEvent) document.body.detachEvent('onclick', anchor.hidefunc);
												else document.body.removeEventListener('click', anchor.hidefunc, true);
												anchor.replaceChild(anchor.imageLow, anchor.imageHigh);
											}
									}
								)
								.addSubject(new NumericalStyleSubject(anchor.imageHigh, 'height', anchor.imageHigh.height, anchor.imageLow.height))
								.addSubject(new NumericalStyleSubject(anchor.imageHigh, 'width', anchor.imageHigh.width, anchor.imageLow.width))
								.seekFromTo(0,1);
							return false;
						}
					}(anchor);
					break;
			}
		}
	}
}


// Mozilla
if (document.addEventListener)
	document.addEventListener("DOMContentLoaded", vpoLinks, false);
else {
	// for Internet Explorer (using conditional comments)
	/*@cc_on @*/
	/*@if (@_win32)
	document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>");
	var script = document.getElementById("__ie_onload");
	script.onreadystatechange = function() {
		if (this.readyState == "complete") {
			vpoLinks(); // call the onload handler
		}
	};
	/*@end @*/

	if (/WebKit/i.test(navigator.userAgent)) { // sniff
		var _timer = setInterval(function() {
			if (/loaded|complete/.test(document.readyState)) {
				clearInterval(_timer);
				vpoLinks(); // call the onload handler
			}
		}, 10);
	}
}
