<!-- 
//================================= Constants ===============================================

var lsWebServerPath = '';

var undefined;
var isNetscape4 = (document.layers && navigator.appName == 'Netscape');
var isNetscape6 = (document.getElementById && !document.all && 
                   (navigator.appName == 'Netscape6' || navigator.appName == 'Netscape') &&
                   navigator.vendor != 'Firefox');
var isIE4 = (document.all && !document.getElementById);
var isIE5 = (document.all && document.getElementById());
var isIE6 = (navigator.appName == 'Microsoft Internet Explorer' && navigator.appVersion.indexOf('MSIE 6') > -1);
var isFirefox = (navigator.vendor == 'Firefox');

// Store a reference to all open windows and use stored values to close them when page changes
var laWindows = new Array();
self.onunload = function () {
                         for (var i=0; i<laWindows.length; i++) {
                           if (laWindows[i] && !laWindows[i].closed) {
                            laWindows[i].close(); 
                           }
                         }
                        }

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Trim leading and trailing spaces
function allTrim(s) {
  return lTrim(rTrim(s));
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Return the selected value from a radio group
function checkRadio(radioCollection) {
  var lsSelectedValue = null;
  for (i=0; i<radioCollection.length; i++) {
    if (radioCollection[i].checked) {
      lsSelectedValue = radioCollection[i].value;
      break;
    }
  }
  return lsSelectedValue;
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// (Left) trim leading spaces
function lTrim(s) {
  return s.replace(/^\s*([\S])/, '$1');
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//function nextPage(page) {
function nextPage(page) {
  if (lbOKtoProceed) {
    //document.location = page;
    document.location = lsNextPage;
  } else {
    var msg = 'The dialog on this page is an important part of the course material.  ' +
              '\n\nPlease play the audio or view the transcript of the scenario before proceeding.';
    alert(msg);
  }
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Function to standardize handling of links and pop-ups.  Pop-ups are opened in named windows
// so that windows for each type can be re-used if user leaves a previous window open.  Although
// default sizes are suggested for each type, the default width and height can be overridden by 
// passing the preferred values.  (In general, if not using the defaults, use the "C" (Custom) 
// window type, since this will ensure that a new window is opened and the previous size isn't 
// re-used.)
function popUp(poLink, psType, pnWidth, pnHeight) {
  if (poLink == null || poLink == '')     {
 //  if (poLink == '') {
    return void(0);   
  } else {
    var lsURL = poLink;
  }
  if (arguments.length < 2) {
    var lsType = 'C';
  } else {
    var lsType = psType.toUpperCase();
  }
  // Set default options based on type of window 
  switch (lsType) {

    case 'E':                                      // External site
      if (lsURL.substr(0,4).toLowerCase() != 'http') {
        lsURL = 'http://' + lsURL;
      }
      var lnWidth = 700;
      var lnHeight = 550;
	  var lnOffset = 25;
	  var addFeat = 'toolbar=';
      var lsWinName = 'External';
      break;

    case 'R':                                      // Handout
      var lnWidth = 420;
      var lnHeight = 150;
      var lnOffset = 10;
      var lsWinName = 'Handout';
      break;
	
	case 'H':                                      // Handout
      var lnWidth = 500;
      var lnHeight = 300;
      var lnOffset = 10;
      var lsWinName = 'Handout';
      break;

    case 'C':                                      // Custom 
      var lnWidth = 420;
      var lnHeight = 250;
      var lnOffset = 15;
      var lsWinName = 'C' + poLink.replace(/[:\/.?]/g,'');
      break;

    case 'S':                                      // Symbol (default)
    default:
      var lnWidth = 480;
      var lnHeight = 550;
      var lnOffset = 10;
      var lsWinName = 'Handout';
      break;
	  
	case 'M':                                      // Symbol (default)
      var lnWidth = 420;
      var lnHeight = 450;
      var lnOffset = 10;
      var lsWinName = 'Handout';
      break;  
	  
	  case 'X':                                      // Symbol (default)
      var lnWidth = 590;
      var lnHeight = 480;
      var lnOffset = 10;
      var lsWinName = 'Handout';
      break;  
	  
	  case 'L':                                      // Symbol (default)
      var lnWidth = 420;
      var lnHeight = 260;
      var lnOffset = 10;
      var lsWinName = 'Handout';
      break;  
	  
	  case 'T':                                      // Symbol (default)
      var lnWidth = 700;
      var lnHeight = 800;
      var lnOffset = 10;
      var lsWinName = 'Handout';
      break; 
  }

  // Override default size if custom values provided
  if (arguments.length >= 3) {
    var lnWidth = pnWidth;
  }
  if (arguments.length >= 4) {
    var lnHeight = pnHeight;
  }

 var winFeat;
 if (lsType =='E'){        //Add naviagtion toolbar & etc...
   winFeat = 'toolbar,resizable,scrollbars,left=' + lnOffset + ',top=' + lnOffset + ',screenX=' + lnOffset + ',screenY=' + lnOffset + ',width=' + lnWidth + ',height=' + lnHeight;
   }
 else{  //toolbar=yes,scrollbars=yes but without navigation toolbar
   winFeat = 'resizable,scrollbars,left=' + lnOffset + ',top=' + lnOffset + ',screenX=' + lnOffset + ',screenY=' + lnOffset + ',width=' + lnWidth + ',height=' + lnHeight;
 }

  // Create a window reference so that, if an existing window of same name/type is already open,  
  // it can be closed and new features will take effect
  var loWin = window.open("", lsWinName, winFeat);
  loWin.close();
  loWin = window.open(lsURL, lsWinName, winFeat);
  laWindows[laWindows.length] = loWin;
  loWin.focus(); 
 
}
//---------------------------------------------------------------
//Check if external links are broken, alert Users and send broken link
//info to PHN Admin. VanN March 23 2010

function popUpExt(poLink, psType, pnWidth, pnHeight) {
  if (poLink == null || poLink == '')     {
    return void(0);   
  } else {
    var lsURL = poLink;
  }
  var lsType = 'E';
  var lnWidth = 700;
  var lnHeight = 550;
  var lnOffset = 10;
  var lsWinName = 'Handout';

  // Override default size if custom values provided
  if (arguments.length >= 2) {
    lsType = psType;
  }
  if (arguments.length >= 3) {
    lnWidth = pnWidth;
  }
  if (arguments.length >= 4) {
    lnHeight = pnHeight;
  }

 var winFeat = 'toolbar,location,resizable,scrollbars,left=' + lnOffset + ',top=' + lnOffset + ',screenX=' + lnOffset + ',screenY=' + lnOffset + ',width=' + lnWidth + ',height=' + lnHeight;
 if (lsType == 'E') {

    // Pass current page location to function since Request.ServerVariables("HTTP_Referer") doesn't work in IE
    // when opening a new window.
    lsURL = lsWebServerPath + "loadExternalPage.asp?referer=" + location.href + "&URL=" + lsURL;
  } else {
    lsURL = poLink;
  }

//   // Create a window reference so that, if an existing window of same name/type is already open,  
//   // it can be closed and new features will take effect
   loWin = window.open(lsURL, lsWinName, winFeat);
//   laWindows[laWindows.length] = loWin;
   loWin.focus(); 
}

//------------ by Van Nguyen June 2010 ---------
//Close the popup and open link in the main window



function CloseWindow() {

  window.close();

}

function CloseAndNewPage(poLink) {
  //alert (poLink);
   var lsURL = poLink;
  window.close();
//  opener.location.href = "http://studydev.neriscience.com/phnmk/website/"+lsURL;
  opener.location.href = lsURL;

}


//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// (Right) Trim trailing spaces
function rTrim(s) {
  return s.replace(/([\S])\s*$/, '$1');
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



// -->