/*Inova Health System
External Javascript File
Last Updated August 30, 2006*/


/*DATE & TIME FUNCTION
-----------------------------------------------------*/
function DateAndTime ()
{
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")
document.write("<small><font color='#999999' face='verdana'>"+dayarray[day]+", "+montharray[month]+" "+daym+", "+year+"</font></small>")
}

/*TEXT INCREASE/DECREASE
-----------------------------------------------------*/
function fontsizeup() {
  active = getActiveStyleSheet();
  switch (active) {
    case 'A--' : 
      setActiveStyleSheet('A-');
      break;
    case 'A-' : 
      setActiveStyleSheet('A');
      break;
    case 'A' : 
      setActiveStyleSheet('A+');
      break;
    case 'A+' : 
      setActiveStyleSheet('A++');
      break;
    case 'A++' :
      break;
    default :
      setActiveStyleSheet('A');
      break;
  }
}

function fontsizedown() {
  active = getActiveStyleSheet();
  switch (active) {
    case 'A++' : 
      setActiveStyleSheet('A+');
      break;
    case 'A+' : 
      setActiveStyleSheet('A');
      break;
    case 'A' : 
      setActiveStyleSheet('A-');
      break;
    case 'A-' : 
      setActiveStyleSheet('A--');
      break;
    case 'A--' : 
       break;
    default :
      setActiveStyleSheet('A--');
      break;
  }
}

function setActiveStyleSheet(title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
  return ('A-');
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

window.onload = function(e) {
  var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
  setActiveStyleSheet(title);
}

window.onunload = function(e) {
  var title = getActiveStyleSheet();
createCookie("style", title, 365);
}

var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
if (title == 'null') {
  title = getPreferredStyleSheet();
}

setActiveStyleSheet(title);









function DropDownMenu(entered)
{
// *********************************
// DROP DOWN MENU (c) Henrik Petersen / NetKontoret 1998 - All rights reserved
// Explained along with other useful scripts at: http://www.echoecho.com/javascript.htm
// You may freely use this script as long as you do not remove this line and the 2 lines above.
// ******************************************d
with (entered)
{
// Store the selected option in a variable called ref
ref=options[selectedIndex].value;
// Count the position of the optional &
splitcharacter=ref.lastIndexOf("&");

// The three lines below checks if a target goes along with the URL
// That is: (if a "&" is in the option-value).
// If so, the URL is stored in a variable called loc and the target
// is stored in a variable called target.
// If not the URL is stored in a variable called loc and "_self" is
// stored in the variable called target.
if (splitcharacter!=-1) {loc=ref.substring(0,splitcharacter); target=ref.substring(splitcharacter+1,1000).toLowerCase();}
else {loc=ref; target="_self";};

// create a varible called lowloc to store loc in lowercase characters.
lowloc=loc.toLowerCase();

// Skip the rest of this function if the selected optionvalue is "false".
if (lowloc=="false") {return;}

// Open link in current document
if (target=="_self") {document.location=loc;}

// Cancel eventual framesets and open link in current window
else {if (target=="_top") {top.location=loc;}

// Open link in new window
else {if (target=="_blank") {window.open(loc);}

// Open link in parent frame
else{if (target=="_parent") {parent.location=loc;}

// Open link in the specified frame
else {parent.frames[target].location=loc;};
}}}}
}

/*BEGIN MAIL FORM----------------------------------------------------------*/
 function mailpage()
{
mail_str = "mailto:?subject=Check out the " + document.title;
mail_str += "&body=I thought you might be interested in the " + document.title;
mail_str += ". You can view it at, " + location.href;
location.href = mail_str;
}
/*END MAIL FORM----------------------------------------------------------*/