var d=document;
var w=window;
var base_href=d.getElementsByTagName('base')[0].href;
// If any links are not in the current domain, force them to open in a new window & add another CSS class.
function externalLinks(){
	var _a = d.body.getElementsByTagName('a');
	var _c = w.location.href.split('/')[2];

	for(var i=0;i<_a.length;i++){
		// Links
		if(_a[i].href.indexOf(_c)==-1
		   && _a[i].href.indexOf('http:')==0 && _a[i].href.length>0){
			_a[i].setAttribute('target','_blank');		// target
			_a[i].className +=' ext';					// class to add icon
			if(_a[i].title.length>0) _a[i].title+=' ';
			_a[i].title+=' (Opens in a new window) ';	// title
		}
		// PDF files
		if(_a[i].href.indexOf('.pdf')>0 && _a[i].href.length>0){
			_a[i].setAttribute('target','_blank');		// target
			_a[i].className +=' pdf';					// class to add icon
			if(_a[i].title.length>0) _a[i].title+=' ';
			_a[i].title+='(PDF Document) ';			// title
		}
		if(_a[i].href=='#') _a[i].href='javascript:void(0);';
	}
}
function zoomImage(a){
	var img=a.getElementsByTagName('img')[0].src.split('/')[7];
	if(img)window.open(base_href+'zoom-image.php?img='+img,'image','location=0,width=320,height=320,scrollbars=1,resizable');
	return false;
}