//
// javascript functions for elizabeth rowell site at www.rowellfamily.org/elizabeth
//

// load the appropriate stylesheet
var agt    = navigator.userAgent.toLowerCase();
var is_mac = (agt.indexOf("mac")!=-1);
var is_nav = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) && (agt.indexOf('webtv')==-1));

var levelsDeepDelimeter = "";

for (i = 1; i<howManyLevelsDeep; i++) {
  levelsDeepDelimeter = levelsDeepDelimeter + "../"
}

// write the appropriate stylesheet depending on platform and browser
if (is_nav) {
  if (is_mac) {
    document.writeln("<link rel='stylesheet' type='text/css' href='" + levelsDeepDelimeter + "styles_ns_mac.css'>");
  } else {
    document.writeln("<link rel='stylesheet' type='text/css' href='" + levelsDeepDelimeter + "styles_ns_pc.css'>");
  }
} else {
  document.writeln("<link rel='stylesheet' type='text/css' href='" + levelsDeepDelimeter + "styles_ie_all.css'>");
}

// preload and instantiate button images
//if (document.images) {
//  btn_about_us_lo          = new Image();
//  btn_about_us_lo.src      = levelsDeepDelimeter + "images/btn_about_us_lo.gif";  
//}

// swap button images
function changeImages() {
  if (document.images) {
    for (var i=0; i<changeImages.arguments.length; i+=2) {
      document[changeImages.arguments[i]].src = eval(changeImages.arguments[i+1] + ".src");
    }
  }
}

// pop up a sized window (no scrollbar)
function popUpWindow( pageURL, winName, width, height) {
    xpos = (screen.width - width) / 2;
    ypos = (screen.height - height) / 2;
    window.open(pageURL,
        winName,
        "width=" + width + "," +
        "height=" + height + "," +
        "screenx=" + xpos + "," + //ns
        "screeny=" + ypos + "," + //ns
        "left=" + xpos + "," + //ie
        "top=" + ypos + "," + //ie
        "resizable=1" + "," +
        "scrollbars=1");
}

// pop up a sized window (with scrollbar)
function popUpWindowNoScroll( pageURL, winName, width, height) {
    xpos = (screen.width - width) / 2;
    ypos = (screen.height - height) / 2;
    window.open(
        pageURL,
        winName,
        "width=" + width + "," +
        "height=" + height + "," +
        "screenx=" + xpos + "," + //ns
        "screeny=" + ypos + "," + //ns
        "left=" + xpos + "," + //ie
        "top=" + ypos + "," + //ie
        "resizable=0" + "," +
        "scrollbars=0");
}

// go to some URL
function go(theURL) {
  location = eval("'"+theURL+"'");
}

// Get a cookie.
function getCookie(name){
  var cname = name + "=";               
  var dc = document.cookie;             
  if (dc.length > 0) {              
    begin = dc.indexOf(cname);       
    if (begin != -1) {           
      begin += cname.length;       
      end = dc.indexOf(";", begin);
      if (end == -1) end = dc.length;
        return unescape(dc.substring(begin, end));
    } 
  }
  return null;
}

// Set a cookie.
function setCookie(name, value, expires, path, domain, secure) {
  document.cookie = name + "=" + escape(value) + 
  ((expires == null) ? "" : "; expires=" + expires.toGMTString()) +
  ((path == null) ? "" : "; path=" + path) +
  ((domain == null) ? "" : "; domain=" + domain) +
  ((secure == null) ? "" : "; secure");
}

// Delete a cookie
function delCookie (name,path,domain) {
  if (getCookie(name)) {
    document.cookie = name + "=" +
    ((path == null) ? "" : "; path=" + path) +
    ((domain == null) ? "" : "; domain=" + domain) +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}








	