/* util.js, //lib
 * Website Utilities
 * JavaScript 1.2
 * (c)2001 Network Design Consulting.  All rights reserved.
 * -----------------------------------------------------------------
 * 1.0.0  12/07/2001  rmg  created at NetDCon.com
 * -----------------------------------------------------------------
 * This script provides a variety of small semi-useful functions
 * See comments above each function for further details.
 * ----------------------------------------------------------------- */

/* // Preload button images --------------------------------------
if (document.images) {
  chgo = new Image();      
  chgo.src = "media/chgo.gif";
  chgu = new Image(); 
  chgu.src = "media/chgu.gif";
  chgd = new Image();
  chgd.src = "media/chgd.gif";
  delo = new Image();      
  delo.src = "media/delo.gif";
  delu = new Image(); 
  delu.src = "media/delu.gif";
  deld = new Image();
  deld.src = "media/deld.gif";
  newo = new Image();      
  newo.src = "media/newo.gif";
  newu = new Image(); 
  newu.src = "media/newu.gif";
  newd = new Image();
  newd.src = "media/newd.gif";
} */
// Initialize document cookie ---------------------------------
function bake() {
  // Set Cookie to Expire in 30 days ------------------
  xtic = 1000 * 60 * 60 * 24 * 30
  var sellby = new Date();
  sellby.setTime(sellby.getTime() + xtic);
  document.cookie = 'GIPCo=0; expires=' + sellby.toGMTString();
  document.cookie = 'VIDXRES=' + screen.width + '; expires=' + sellby.toGMTString();
  document.cookie = 'VIDYRES=' + screen.height + '; expires=' + sellby.toGMTString();
return; }

// Detect browser ---------------------------------------------
function cli(dflag) {
  // Check for Object Modelling -----------------
  var cli_dom = (document.getElementById)? true : false;
  var cli_id = "zz"
  // Look for Opera versions --------------------
  var cli_op = (window.opera)? true : false;
  if (cli_op) {
    if (cli_dom) {
      var cli_op5 = true;
      var cli_id = "op5"; } 
    else {
      var cli_id = "op4"; } }
  // Look for Netscape versions -----------------
  var cli_ns = (window.outerWidth)? true : false;
  if (cli_ns) {
    if (cli_dom) {
      var cli_ns6 = true;
      var cli_id = "ns6"; }
    else {
      var cli_ns4 = true;
      var cli_id = "ns4"; } }
  // Look for IE versions -----------------------
  var cli_ie = (document.all)? true : false;
  if (cli_ie) {
    if (cli_dom) {
      var cli_ie = true;
      var cli_id = "ie6"; }
    else {
      var cli_ie4 = true;
      var cli_id = "ie4"; } }
  if (dflag > 0) {
    document.write("Browser: " + cli_id); }
}
// Set display info -------------------------------------------
function ckr(clisr) {
   clisr = 1
   if (screen.width <= 801) clisr = 0;
   if (screen.width > 800)  clisr = 1;
   if (screen.width > 1152) clisr = 2;
   return [clisr];
}
// Write display info ---------------
function ckp() {
   clisr = 1
   if (screen.width <= 801) clisr = 0;
   if (screen.width > 801)  clisr = 1;
   if (screen.width > 1152) clisr = 2;
   document.write(clisr);
   return;
}
/* -----------------------------------------------------------------
   Output default frameset based on user's screen resolution                  */
function dframe() {
   clisr = ckr();
   if (clisr == 0) hhead = 140; wsnav = 176;
   if (clisr == 1) hhead = 140; wsnav = 176;
   if (clisr == 2) hhead = 140; wsnav = 176;
   document.writeln("<frameset rows=\"" + hhead + ",*\" border=\"0\">");
   document.writeln("  <frame name=\"head\" scrolling=\"no\" src=\"head.php\">");
   document.writeln("  <frameset cols=\"" + wsnav + ",*\" border=\"0\">");
   document.writeln("    <frame name=\"snav\" scrolling=\"auto\" src=\"snav.php\">");
   document.writeln("    <frame name=\"info\" scrolling=\"auto\" src=\"home.php\">");
   document.writeln("  </frameset>");
   document.writeln("</frameset>");
}
/* -----------------------------------------------------------------
   Embed CSS based on user's screen resolution                       */
function dscss() {
   clisr = ckr();
   document.writeln("<link rel=\"stylesheet\" href=\"_css/main-r" + clisr + ".css\">");
   return;
 }
/* -----------------------------------------------------------------    
   Print a Date/Time-sensitive greeting to the client                */
function hullo() {
  rightnow = new Date();
  righthour = rightnow.getHours();
  if (righthour < 12) {
     greeting = "Good Morning,";
  }
  else if (righthour < 18) {
     greeting = "Good Afternoon,";
  }
  else {
     greeting = "Good Evening,";
  }
  document.write(greeting);
}

// Pop-up Photograph ------------------------------------------
function picpop(lurl) {
  var pic = new Array();
  pic[1] = new Image();
  pic[1].src = lurl;
  pic[1].border = 0;
  picw = pic[1].width + (pic[1].width * .05);
  pich = pic[1].height + (pic[1].height * .05);
  popfeat = "height=" + pich + ","
          + "width=" + picw + ","
          + "resizable=no";
  popup = window.open(lurl,"",popfeat,true);
}

// Dynamic Clock ----------------------------------------------
function clock() {
  if (!document.layers && !document.all) return;
    var digital = new Date();
    var hours = digital.getHours();
    var minutes = digital.getMinutes();
    var seconds = digital.getSeconds();
    var amOrPm = "AM";
  if (hours > 11) amOrPm = "PM";
  if (hours > 12) hours = hours - 12;
  if (hours == 0) hours = 12;
  if (minutes <= 9) minutes = "0" + minutes;
  if (seconds <= 9) seconds = "0" + seconds;
  dispTime = hours + ":" + minutes + ":" + seconds + " " + amOrPm;
  if (document.layers) {
    document.layers.pendule.document.write(dispTime);
    document.layers.pendule.document.close();
  }
  else
    if (document.all)
      pendule.innerHTML = dispTime;
      setTimeout("clock()", 1000);
  }

// Push to new URL --------------------------------------------
function pushURL(urlid) { location.replace(urlid); return; }

// Display form message ---------------------------------------
function dmesg(mesg) {
  if (!document.layers && !document.all) return;
  if (document.layers) {
    document.layers.xmsg.document.write(mesg);
    tic = setTimeout('document.layers.xmsg.document.write(\'&nbsp;\')', 5000);
    document.layers.xmsg.document.close(); }
  if (document.all) {
    xmsg.innerHTML = mesg;
    tic = setTimeout('xmsg.innerHTML = \'&nbsp;\'', 5000); }
  return;
}
// Display form message ---------------------------------------
function nmesg(mesg) {
  if (!document.layers && !document.all) return;
  if (document.layers) {
    document.layers.nmsg.document.write(mesg);
    tic = setTimeout('document.layers.nmsg.document.write(\'&nbsp;\')', 5000);
    document.layers.nmsg.document.close(); }
  if (document.all) {
    nmsg.innerHTML = mesg;
    tic = setTimeout('nmsg.innerHTML = \'&nbsp;\'', 5000); }
  return;
}
// Swap in mouseover image ------------------------------------
function buto(buti, iobj) {
  if (document.images) {
  document[iobj].src = eval(buti + "o.src"); }
}
// Swap in mouseout image -------------------------------------
function butu(buti, iobj) {
  if (document.images) {
  document[iobj].src = eval(buti + "u.src"); }
}
// Swap in mousedown image ------------------------------------
function butd(buti, iobj) {
  if (document.images) {
  document[iobj].src = eval(buti + "d.src"); }
}