$(document).ready(
function() {
  $(document).bind('contextmenu',function(e){return false;}).bind('mousemove',function(e){if(preventSelection)removeSelection()}).bind('keydown',function(e){killCtrlA(e)} );
  $(document).bind('mousedown', function(event){var event=event||window.event;var sender=event.target||event.srcElement;preventSelection=!sender.tagName.match(/INPUT|TEXTAREA/i);});
  $(document).bind('mouseup', function(){if (preventSelection) removeSelection(); preventSelection = false;});
});

var preventSelection = false;
function killCtrlA(event){
  var event = event || window.event;
  var sender = event.target || event.srcElement;
  if (sender.tagName.match(/INPUT|TEXTAREA/i)) return;
  var key = event.keyCode || event.which;
  if (event.ctrlKey && key == 'A'.charCodeAt(0)) window.location="/";removeSelection();if (event.preventDefault) event.preventDefault(); else event.returnValue = false;
}
function removeSelection(){
  if (window.getSelection){window.getSelection().removeAllRanges();} else if (document.selection && document.selection.clear) document.selection.clear();
}




