function disabletext(e){
  var targ;
  if (e.target) targ = e.target;
  else if (e.srcElement) targ = e.srcElement;
  if (targ.nodeType == 3) // defeat Safari bug
    targ = targ.parentNode;
  if(targ.tagName != 'INPUT' && targ.tagName != 'TEXTAREA'){
    return false
  }
}

function reEnable(){
  return true
}

//if the browser is IE4+
document.onselectstart = new Function ("return false")

//if the browser is NS6
if (window.sidebar){
  document.onmousedown=disabletext
  document.onclick=reEnable
}