﻿/*
------------------------------------------------------------------------------
File: browser.js Browser detection and generic DOM getObj function
Common mandatewire functions
------------------------------------------------------------------------------
Last Updated: 19 September 2007
------------------------------------------------------------------------------
*/

function getObj(id) {
  return document.getElementById(id)
}

// Detect keypress
var captureKeys = function(ev) {
  ev = ev || window.event;             // gets the event in ie or ns
  kCode = ev.keyCode || ev.which;      // gets the keycode in ie or ns

  /* in ie, when pressing the ctrl + shift + key, it gives the key code for the capitalized key (probably because shift is pressed) 
  in ns pressing ctrl, shift and another key doesn't change the keycode
  thus, the || and two different numbers */

  if (ev.ctrlKey && ev.shiftKey && kCode == 19 || ev.ctrlKey && ev.shiftKey && kCode == 83) {	// ctrl+alt+s
    ShowStatus();   // another function that does something
    return false;   // make it so the browser ignores key combo
  }
  if (ev.ctrlKey && kCode == 119) { // ctrl+w
    closeWin();  // run your own script to close the window, doesn't work in ie, ie just closes the window
    return false;
  }
}
function ShowStatus() {
  window.status = "This browser is using " + ((document.compatMode == 'CSS1Compat') ? "'standards'" : "'quirks'") + " mode.";
}
function back() {
  window.history.go(-1);
}
