//============================
//disable rightclick on images
//============================

function disableclick(e) {
	if (document.all) {
		if (event.button==2 || event.button==3) {
			if (event.srcElement.tagName=="IMG") {
				alert(clickmessage);
				return false;
			}
		}
	}
	else if (document.layers) {
		if (e.which == 3) {
			alert(clickmessage);
			return false;
		}
	}
	else if (document.getElementById) {
		if (e.which==3 && e.target.tagName=="IMG") {
			alert(clickmessage);
			return false;
		}
	}
}

function associateimages(){
	for(i=0 ; i<document.images.length ; i++) {
		document.images[i].onmousedown=disableclick;
	}
}
if (document.all) {
	document.onmousedown=disableclick;
}
else if (document.getElementById) {
	document.onmouseup=disableclick;
}
else if (document.layers) {
	associateimages();
}

//======================
//confirm external links
//======================

function tagExternalLinks() {
	var aTags = document.getElementsByTagName("A");
	var URLparts = new Array();
	for (var i=0; i < aTags.length; i++) {
		URLparts = aTags[i].href.split('/');
		if (
			URLparts[2] != window.location.host && 
			aTags[i].href.substring(0,11) != 'javascript:' && 
			aTags[i].href.substring(0,7) != 'mailto:'
			) {
			aTags[i].onclick = doExternalClick;
		}
	}
}

function doExternalClick() {
	if (confirm(externalclickmessage)) {
		window.open(this.href);
	}
	return false;
}

if( window.addEventListener ) {
	window.addEventListener("load", tagExternalLinks, false);
} else {
	if(window.attachEvent) {
		window.attachEvent("onload", tagExternalLinks);
	} else {
		window.onload = tagExternalLinks;
	}
}


