var isNS = (navigator.appName == "Netscape") ? 1 : 0;
if(navigator.appName == "Netscape") document.captureEvents(Event.MOUSEDOWN||Event.MOUSEUP);
function mischandler() {
   return false;
}

function mousehandler(e){
  var myevent = (isNS) ? e : event;
  var eventbutton = (isNS) ? myevent.which : myevent.button;
  if((eventbutton==2)||(eventbutton==3)) return false;
}
document.oncontextmenu = mischandler;
document.onmousedown = mousehandler;
document.onmouseup = mousehandler;


// this function will get the keycode
function getKeyCode(e) {
  if (window.event) {
    return window.event.keyCode;
  } else if (e) {
    return e.which;
  } else {
    return null;
  }
}

// this function will either allow numeric or alphabet entry only.
function keyRestrict(e, validchars) {
  var key='', keychar='';

  key = getKeyCode(e);

  if (key == null) return true;

  keychar = String.fromCharCode(key);
  keychar = keychar.toLowerCase();
  validchars = validchars.toLowerCase();

  if (validchars.indexOf(keychar) != -1) {
    return true;
  }

  if ( key==null || key==0 || key==8 || key==9 || key==13 || key==27 ) {
    return true;
  }

  return false;
}

// this function will add comma to numeric amount
function addCommas(nStr) {
  nStr += '';
  x = nStr.split('.');
  x1 = x[0];
  x2 = x.length > 1 ? '.' + x[1] : '';
  var rgx = /(\d+)(\d{3})/;
  while (rgx.test(x1)) {
    x1 = x1.replace(rgx, '$1' + ',' + '$2');
  }
  return x1 + x2;
}


var loHelpWin;
function uf_LoadHelp(asType) {
  if (loHelpWin) {
    loHelpWin.close();
  }

  loHelpWin = window.open("help.php?type=" + asType + "", "_blank", "width=320,height=410,location=no,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,toolbar=no");
}


function isValidEmail(str) {
  return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
 
}

