/*
    Open Browser Window
    copyright 1999 bnsDesigns - bob@bnsdesigns.com

    Call from onClick event in the A tag using
    onClick="openWindow(this.href,this.target,featureList)"
    
    Note:  the window featurs list MUST be provided.
    Note:  returns "false"  so the default href is cancelled.
    
    The href and target options MUST be defined in the A tag.
    ---------------------------------------------------------
    
    where featureList is one or more of:
    width      = width of window in pixels
    height     = height of window in pixels
    location   = yes/no - show location textbox
    menubar    = yes/no - show menu bar
    resizable  = yes/no - can be resized (NOTE spelling)
    scrollbars = yes/no - allow scroll bars (if needed)
    status     = yes/no - show status bar
    toolbar    = yes/no - show tool bar
*/

function openWindow(sURL,sTarget,sFeatures) { 
  if (! sFeatures) {
    alert("No popup window features.\nOpening default window.");
  }
  var objPopUpWindow = window.open(sURL,sTarget,sFeatures);
  if((navigator.appName == "Netscape") &&
     (parseInt(navigator.appVersion) == 2)) { // NS 2 bug fix
        objPopUpWindow = window.open(sURL,sTarget,features);  
  }
  if (document.images) objPopUpWindow.focus(); // only works with js 1.1
  return false;
}

function openCalculator() {
  var sFeatures = "width=700,height=500,resizable=yes,scrollbars=yes";
  var msg = "WARNING AND DISCLAIMER:\n";
  msg += "It is dangerous to rely on the calculator to determine your ability\n";
  msg += "to drive a vehicle or to operate machinery after drinking alcohol.\n";
  msg += "If you do so, you assume full risk of injury and death to yourself\nand others.";
  
//  var okToOpen = newConfirm("Blood Alcohol Calculator", msg, 3);
  var okToOpen = true;
  if (okToOpen) {
	  openWindow("BAC.htm","BAC",sFeatures);
  }
}

// IE special message boxes

IE4 = document.all;

function newAlert(title,mess,icon,mods) {
   (IE4) ? makeMsgBox(title,mess,icon,0,0,mods) : alert(mess);
}

function newConfirm(title,mess,icon,defbut,mods) {
   if (IE4) {
      icon = (icon==0) ? 0 : 3;
      defbut = (defbut==0) ? 0 : 1;
      retVal = makeMsgBox(title,mess,icon,4,defbut,mods);
      retVal = (retVal==6);
   }
   else {
      retVal = confirm(mess);
   }
   return retVal;
}

function newPrompt(title,mess,def) {
   retVal = (IE4) ? makeInputBox(title,mess,def) : prompt(mess,def);
   return retVal;
}

function IEBox(title,mess,icon,buts,defbut,mods) {
   retVal = (IE4) ? makeMsgBox(title,mess,icon,buts,defbut,mods) : null;
   return retVal;
}



