//<![CDATA[

var rcSpecialCase = ((navigator.userAgent.indexOf('Mac') != -1) || document.all);
var rcMSIE = (navigator.userAgent.indexOf('MSIE') != -1);
var rcFlag = 0;
var rcMsg = 'Some images on this site are protected by copyright.\nWe kindly request that you do not copy them.';
var rcX,rcY,rcX1,rcY1,rcCopyAttempt;

function detectRclick()
{
	///<summary>Detect Mouse Right-Click on images on the page, and issue a message.</summary>

	if (!(document.getElementById || document.all || document.layers)) return;
	if (rcSpecialCase && document.layers)
	{
		document.captureEvents(Event.MOUSEMOVE);
		document.onmousemove = rcSpecial;
	}
	for (i=0;i<document.images.length;i++)
	{
		document.images[i].onmousedown = rcCheckIt;
		document.images[i].onmouseup = function() {return false};
		if (rcSpecialCase)
		{
			document.images[i].onmousemove = rcSpecial;
			document.images[i].onclick = rcClearIt;
		}
	}
}

function rcCheckIt(e)
{
	rcCopyAttempt = 0;

    if (rcMSIE)
    {
		rcX = window.event.clientX;
		rcY = window.event.clientY;
		theButt = (window.event.button == 2);
    }
    else
    {
	    if (window.Event)
	    {
    	    if (!e) {e = event;}
		    rcX = e.screenX;
	        rcY = e.screenY;
    		
		    theButt = (e.which == 3);
	    }
	    else
	    {
		    rcX = window.event.clientX;
		    rcY = window.event.clientY;
		    theButt = (window.event.button == 2);
	    }
    }

	if (theButt)
	{
		rcCopyAttempt = 1;
		rcFlag = 0;
		alert(rcMsg);
		return false; // NN4 only
	}
	if (rcSpecialCase) rcFlag = 1;
	return false;
}

function rcSpecial(e)
{
	theObj = '';

    if (rcMSIE)
    {
		rcX1 = window.event.clientX;
		rcY1 = window.event.clientY;
		theObj = window.event.srcElement.parentElement.tagName;
    }
    else
    {
	    if (window.Event)
	    {
    	    if (!e) {e = event;}
		    rcX1 = e.screenX;
		    rcY1 = e.screenY;
    		
		    if (e.target.parentNode) theObj = e.target.parentNode.tagName;
	    }
	    else
	    {
		    rcX1 = window.event.clientX;
		    rcY1 = window.event.clientY;
		    theObj = window.event.srcElement.parentElement.tagName;
	    }
    }
    
	var isLink = (theObj == 'A');
	if (rcFlag && (!isLink || ((Math.abs(rcX-rcX1) > 10) || (Math.abs(rcY-rcY1) > 10))))
	{
		rcCopyAttempt = 1;
		rcFlag = 0;
		alert(rcMsg);
		return false;
	}
}

function rcClearIt()
{
	rcFlag = 0;
	if (rcCopyAttempt)
	{
		rcCopyAttempt = 0;
		return false;
	}
}

//]]>
