var excludetags=["input", "textarea", "select"];

function allowselect(e) {
  for (i=0;i<excludetags.length;i++)
    if (e.srcElement.tagName.toLowerCase()==excludetags[i]) return true;
  return false;
}

if (typeof document.onselectstart!="undefined")
  document.onselectstart=new Function("return allowselect(event)");