<!--

//The Almighty POM

function displayNews(x) {
   var winHeight = document.body.clientHeight - 20;
   var newWindow = window.open(x, "MedicalNews", 'width=620,height='+winHeight+',screenX=10,screenY=10,top=10,left=10,resizable=yes,scrollbars=yes,menubar=no,status=no,location=no,directories=no,toolbar=no');
   newWindow.focus();
}

function qs(el) {
  if (window.RegExp && window.encodeURIComponent) {
    var qe = encodeURIComponent(document.f.q.value);
    if (el.href.indexOf("q=") != -1) {
      el.href = el.href.replace(new RegExp("q=[^&$]*"),"q="+qe);
    } else {
      el.href += "&q="+qe;
    }
  }
  return 1;
}

function rTrim(str) {
   var whitespace = new String(" \t\n\r");
   var s = new String(str);
   if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
      var i = s.length - 1;
      while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1) i--;
      s = s.substring(0, i+1);
   }
   return s;
}

function pomTime() {
  var timerKey;
  var now = new Date();
  var pomHr = now.getHours();
  var pomMin = now.getMinutes();
  var pomSec = now.getSeconds();
  if (pomHr == 0) pomHr = 12;
  pomDisplayTime.innerHTML = ((pomHr > 12) ? pomHr - 12 : pomHr) + ((pomMin < 10) ? ":0" : ":") + pomMin + ((pomSec < 10) ? ":0" : ":") + pomSec + ((pomHr > 11) ? " PM" : " AM");
  timerKey = setTimeout("pomTime()", 1000);
}

window.onerror = null;
var bName = navigator.appName;
var bVer = parseInt(navigator.appVersion);
var NS4 = (bName == "Netscape" && bVer >= 4);
var IE4 = (bName == "Microsoft Internet Explorer" && bVer >= 4);
var NS3 = (bName == "Netscape" && bVer < 4);
var IE3 = (bName == "Microsoft Internet Explorer" && bVer < 4);
var blinkSpeed=100;
var i=0;

if (NS4 || IE4) {
  if (navigator.appName == "Netscape") {
    layerStyleRef = "layer.";
    layerRef = "document.layers";
    styleSwitch = "";
  } else {
    layerStyleRef = "layer.style.";
    layerRef = "document.all";
    styleSwitch = ".style";
  }
}

function startTextBlink(layerName){
  if (NS4 || IE4) {
    if(i % 2 == 0) {
      eval(layerRef+'["'+layerName+'"]'+
      styleSwitch+'.visibility="visible"');
    } else {
      eval(layerRef+'["'+layerName+'"]'+
      styleSwitch+'.visibility="hidden"');
    }
  }

  if(i < 1) i++;
  else i--;

  setTimeout("startTextBlink('"+layerName+"')", blinkSpeed);
}

function openSearch() {
  var h = window.screen.height - 150;
  var w = window.screen.width - 30;
  if (rTrim(document.f.q.value) != "") {
    var gUrl = "http://www.google.com/search?hl=en&q=" + document.f.q.value;
    var newWindow = window.open(gUrl, "", 'width='+w+',height='+h+',screenX=10,screenY=10,top=10,left=10,resizable=yes,scrollbars=yes,menubar=yes,status=no,location=no,directories=no,toolbar=yes');
  } else document.f.q.value = "";
  return false;
}

function pomUpdTime(strContent, strTagId, strColor) {
  var objHandle = document.getElementById(strTagId);
  if(objHandle && (typeof objHandle.innerHTML).toString().toLowerCase() != 'undefined') {
    objHandle.innerHTML = strContent;
    if (strColor != "black") objHandle.style.color = strColor;
  }
}

function pomTickTock(strTagId, strEventDate) {
  var objDateNow = new Date();
  var compDate = new Date(strEventDate).getTime();
  var nowDate = objDateNow.getTime();
  if (nowDate > compDate) {
    //strTimeString = "It's here!"
    strTimeString = "It's time for the fun."
    pomUpdTime(strTimeString, strTagId, "black");
  } else {
    var intMsDelay = 1000 - objDateNow.getMilliseconds();
    var intEventDate = new Date(strEventDate).valueOf();
    pomCreateTime(objDateNow, strTagId, intEventDate);
    setTimeout("pomTickTock(\""+strTagId+"\","+intEventDate+")", intMsDelay);
  }
}

function pomCreateTime(strDate, strTagId, intEventDate) {
  var intMs = intEventDate - new Date(strDate).valueOf();
  if(intMs <= 0) {
    intMs = intMs *- 1;
  }
  var intDays = Math.floor(intMs / 864E5);
  intMs = intMs - (intDays * 864E5);
  var intHours = Math.floor(intMs / 36E5);
  intMs = intMs - (intHours * 36E5);
  var intMinutes = Math.floor(intMs / 6E4);
  intMs = intMs - (intMinutes * 6E4);
  var intSeconds = Math.floor(intMs / 1000);
  //var strTimeString = intDays + " day" + (intDays == 1 ? ", ":"s, ") + intHours + " hour" + (intHours == 1 ? ", ":"s, ") + intMinutes + " minute" + (intMinutes == 1 ? " and ":"s and ") + intSeconds + " second" + (intSeconds == 1 ? " ":"s");
  var strTimeString = intDays + " day" + (intDays == 1 ? ", ":"s, ") + intHours + " hr" + (intHours == 1 ? ", ":"s, ") + intMinutes + " min" + (intMinutes == 1 ? " and ":"s & ") + intSeconds + " sec" + (intSeconds == 1 ? " ":"s");
  if (intDays < 10) {
    pomUpdTime(strTimeString, strTagId, "red");
  } else {
    pomUpdTime(strTimeString, strTagId, "black");
  }
}

function pomZeroPrefix(objVal) {
  var str = "" + objVal;
  return(str.length < 2 ? "" + str:str);
}

function pomInit() {
  var strTagPrefix = "pomCountDown";
  var objHandle = true;
  if(document.getElementById) {
    for(var i = 1; objHandle; ++i) {
      var strElementName = strTagPrefix + i;
      objHandle = document.getElementById(strElementName);
      if(objHandle && (typeof objHandle.innerHTML).toString().toLowerCase() != 'undefined') {
        var strDate = objHandle.innerHTML;
        //var strDate = "08 Aug 2005 08:00:00 UTC-0600";
        if(!isNaN(new Date(strDate))) {
          pomTickTock(strElementName, strDate);
          if(objHandle.style) {
            objHandle.style.visibility = "visible";
          }
        } else {
          objHandle.innerHTML=strDate+"&nbsp;";
        }
      }
    }
  }
}

function toggleLayers(id, NNtype, IEtype, WC3type) {
  if (document.getElementById) {
    eval("document.getElementById(id).style.visibility = \"" + WC3type + "\"");
  } else {
    if (document.layers) {
      document.layers[id].visibility = NNtype;
    } else {
      if (document.all) {
        eval("document.all." + id + ".style.visibility = \"" + IEtype + "\"");
      }
    }
  }
}

if(window.attachEvent) {
  window.attachEvent('onload', pomInit);
} else if(window.addEventListener) {
  window.addEventListener("load", pomInit, false);
} else {
  window.onload=pomInit();
}

// -->
