IE4plus = (document.all) ? true : false;
NS4 = (document.layers) ? true : false;

function clickIE()
{
	if (IE4plus)
	    document.selection.empty();
    return false;
}

function clickNS(e)
{
	
	if ((e.which==1) && NS4)
	{
		return (e.target!=document);
	}
	else if (e.which==1 || e.which==2 || e.which==3 ) 
    {
       return false;
    }
}
if (!IE4plus) 
{
   document.captureEvents(Event.MOUSEDOWN || Event.MOUSEUP);
   document.onmousedown=clickNS;
   document.onmouseup= clickNS;
   document.oncontextmenu=clickIE;
} 
else 
{
   document.onmouseup= clickIE;
   document.oncontextmenu=clickIE;
}

