<!--
var scrollBarWidth = -1;
var isDeviceMobile = isNavigatorMobileDevice();

function getURLPage() {
  var urlRegExp = new RegExp("(\\?page)=([^?]+)");

  if (urlRegExp.test(window.location.search)) {
    var matchArray = urlRegExp.exec(window.location.search);

    return(matchArray[2]);
  }
  return(null);
}

function getURLStatus() {
  var urlRegExp = new RegExp("(\\?status)=([^?]+)");

  if (urlRegExp.test(window.location.search)) {
    var matchArray = urlRegExp.exec(window.location.search);

    return(matchArray[2]);
  }
  return(null);
}

function addVarToSearch(name, value) {
  var regExp = new RegExp("\\?" + name + "=");
  
  if (regExp.test(window.location.search)) {
    var valRegExp = new RegExp("^(.*\\?" + name + "=)([^?]+)(\\??.*)");

    if (valRegExp.test(window.location.search)) {
      var matchArray = valRegExp.exec(window.location.search);

      return(matchArray[1] + value + matchArray[3]);
    }
    alert("valRegExp::ERROR");
  } else {
    return(window.location.search + "?" + name + "=" + value);
  }
  alert("regExp::ERROR");
  return(window.location.search);
}

function deleteVarFromSearch(name) {
  var regExp = new RegExp("\\?" + name + "=");

  if (regExp.test(window.location.search)) {
    var valRegExp = new RegExp("^(.*)\\?" + name + "=[^?]+(\\??.*)");

    if (valRegExp.test(window.location.search)) {
      var matchArray = valRegExp.exec(window.location.search);

      return(matchArray[1] + matchArray[2]);
    }
    alert("valRegExp::ERROR");
  }
  return(window.location.search);
}

function getBaseURL() {
  var baseURL = window.location.protocol + "//" + window.location.hostname + window.location.pathname;

  if (window.location.pathname == "") {
    baseURL += "index.html";
  }
  
  return(baseURL);
}

function writeCookie(name, value, days) {
  var expires = "";

  if (days) {
    var date = new Date();

    date.setTime(date.getTime() + (days * 24 * 3600 * 1000));
    expires = "; expires=" + date.toGMTString();
  }

  document.cookie = name + "=" + value + expires + "; path=/";
}

function readCookie(name) {
  var searchName = name + "=";
  var cookies = document.cookie.split(';');

  for (var i = 0; i < cookies.length; i++) {
    var c = cookies[i];

    while(c.charAt(0) == ' ') {
      c = c.substring(1, c.length);
    }

    if (c.indexOf(searchName) == 0) {
      return(c.substring(searchName.length, c.length));
    }
  }
  return(null);
}

function eraseCookie(name) {
  writeCookie(name, "", -1);
}

function updateURL(url) {
  window.location = url;
}
function preLoadAllPages() {
  showTabs("home.html");

  showTabs("about_TheTeam.html");
  showTabs("about_TheVision.html", 1);
  showTabs("about_TheSuccesses.html", 1);

  showTabs("services_ChangeManagement.html", 1);
  showTabs("services_LeadershipCoaching.html", 1);
  showTabs("services_ProjectLaunch.html", 1);
  showTabs("services_ProjectManagement.html", 1);
  showTabs("services_StrategyDevelopment.html", 1);

  showTabs("resources_BooksAndArticles.html", 1);
  showTabs("resources_CaseStudies.html", 1);
  showTabs("resources_UpcomingEvents.html", 1);

  showTabs("contact.html", 1);

  // updateURL(getBaseURL() + addVarToSearch("status", "loaded"));
  writeCookie("pageIsLoaded", 1);
}

function getCookiePage() {
  return(readCookie("iFramePage"));
}

function changePage(page) {
  var pageIsLoaded = readCookie("pageIsLoaded");

  if (!pageIsLoaded) {
    preLoadAllPages();
  }

  if (page == "FROM_URL") {
    page = getURLPage();

    if (page == null) {
      page = readCookie("iFramePage");
    }

    if (page == null) {
      page = "home.html";
    }
  }

  // write the cookie so we can get its value on the next load FROM_URL (someone
  // hit the reload page button)
  writeCookie("iFramePage", page);

  // remove page var from url if it exists. This is done since we now will be
  // using cookies so we do not need to set window.location (which will cause
  // another reload which will cause flickers)
  if (deleteVarFromSearch("page") != window.location.search) {
    window.location = getBaseURL() + deleteVarFromSearch("page");
    return;
  }

  document.all.IFrame.src = page;

  showTabs(page);
  hideAllMenus();
}

function getPageCategory(page) {
  var pageRegExp = new RegExp("^([^_]+)_");
  var category   = "unknown";
  
  if (pageRegExp.test(page)) {
    var matchArray = pageRegExp.exec(page);
    
    category = matchArray[1];

    return(category);
  }
  return(null);
}

function getScrollerWidth() {
  var scr       = null;
  var inn       = null;
  var wNoScroll = 0;
  var wScroll   = 0;
  
  // outer scroll div
  scr = document.createElement("div");
  scr.style.position = "absolute";
  scr.style.top      = "-1000px";
  scr.style.left     = "-1000px";
  scr.style.width    = "100px";
  scr.style.height   = "50px";

  // start with no scrollbar
  scr.style.overflow = "hidden";
  
  // inner content div
  inn = document.createElement("div");
  inn.style.width  = "100%";
  inn.style.height = "200px";
  
  // put the inner div in the scroll div
  scr.appendChild(inn);
  // append the scroll div to the doc
  document.body.appendChild(scr);
  
  // width of inner div w/o scrollbar
  wNoScroll = inn.offsetWidth;

  // add scrollbar
  scr.style.overflow = "auto";

  // width of inner div with scrollbar
  wScroll = inn.offsetWidth;

  var scrollWidth = wNoScroll - wScroll;

  // remove scroll div from doc
  document.body.removeChild(document.body.lastChild);
  
  // return pixel width of scrollbar
  return(scrollWidth);
}

function resizeAll() {
  var minCenterWidth     = 570;
  var browserType        = "Unknown";

  var topBannerHeight    = parseInt(document.all.TopBanner.style.height  ? document.all.TopBanner.style.height  : 150);
  var leftBannerWidth    = parseInt(document.all.LeftBanner.style.width  ? document.all.LeftBanner.style.width  : 150);
  var rightBannerWidth   = parseInt(document.all.RightBanner.style.width ? document.all.RightBanner.style.width : 290);
  var picScrollHeight    = parseInt(document.all.PictureScroller.height  ? document.all.PictureScroller.height  : 400);

  var pageWidth          = window.innerWidth;  // will need to set based on browser
  var pageHeight         = window.innerHeight; // will need to set based on browser

  if (scrollBarWidth < 0) {
    scrollBarWidth = readCookie("scrollBarWidth");
    
    if (scrollBarWidth == null) {
      scrollBarWidth = getScrollerWidth();
    }
    
    writeCookie("scrollBarWidth", scrollBarWidth);
  }

  if (typeof(window.innerWidth) == "number") {
    // not IE, so set width/height from window.inner*
    browserType    = "NotInternetExplorer";
  } else if (document.documentElement && ((document.documentElement.clientWidth > 0) || (document.documentElement.clientHeight > 0))) {
    // IE 6+ in standard mode
    browserType = "InternetExplorer6+";
    pageWidth   = document.documentElement.clientWidth;
    pageHeight  = document.documentElement.clientHeight;
  } else {
    // IE 4
    browserType = "InternetExplorer4";
    pageWidth   = document.body.clientWidth;
    pageHeight  = document.body.clientHeight;
  }

  var centerWidth    = pageWidth - leftBannerWidth - rightBannerWidth;
  var totalMinHeight = topBannerHeight + picScrollHeight + (browserType=="NotInternetExplorer"?0:3);

  // determine whether or not the browser width/height is large enough to
  // display page without scroll bars
  if ((centerWidth >= minCenterWidth) && (pageHeight >= totalMinHeight)) {
    // we are wider and taller than the min, so no scroll bars
    // setTimeout(myAlert, 0);
  } else if ((centerWidth < minCenterWidth) && (pageHeight >= totalMinHeight)) {
    // we are not wide enough, but we are tall enough (just bottom scroll bar)
    centerWidth  = minCenterWidth;
    pageHeight  -= scrollBarWidth; // compensate for scrollbar width
    
    if (pageHeight < totalMinHeight) {
      // we just caused the need for right scroll bar
      pageHeight = totalMinHeight;
    }
  } else if ((centerWidth >= minCenterWidth) && (pageHeight < totalMinHeight)) {
    // we are wide enough, but not tall enough (just right scroll bar)
    centerWidth -= scrollBarWidth;
    pageHeight   = totalMinHeight;
    
    if (centerWidth < minCenterWidth) {
      // we just caused the need for bottom scroll bar
      centerWidth = minCenterWidth;
    }
  } else if ((centerWidth < minCenterWidth) && (pageHeight < totalMinHeight)) {
    // right and bottom scroll bars (no need to compensate)
    centerWidth  = minCenterWidth;
    pageHeight   = totalMinHeight;
  }
  
  if (!document.all.IFrame.style.top) {
    document.all.IFrame.style.top  = 175;
  }
  if (!document.all.IFrame.style.left) {
    document.all.IFrame.style.left = 175;
  }

  var iFrameTop          = parseInt(document.all.IFrame.style.top);
  var iFrameLeft         = parseInt(document.all.IFrame.style.left);
  var iFrameBorderWidth  = iFrameLeft - leftBannerWidth;
  var iFrameBorderHeight = iFrameTop - topBannerHeight;
  var iFrameHeight       = pageHeight - topBannerHeight - iFrameBorderHeight;
  var iFrameWidth        = centerWidth - (2 * iFrameBorderWidth);

  // set all relevant width/height/position values
  document.all.RightBanner.style.left   = centerWidth + leftBannerWidth;
  document.all.TopRightImage.style.left = parseInt(document.all.RightBanner.style.left) - 160;

  document.all.IFrame.width             = iFrameWidth;
  document.all.TopBanner.style.width    = centerWidth + rightBannerWidth;
  document.all.BannerTitle.style.width  = centerWidth;

  document.all.IFrame.height            = iFrameHeight;
  document.all.RightBanner.style.height = pageHeight - topBannerHeight;
  document.all.LeftBanner.style.height  = pageHeight - topBannerHeight;
}

function isNavigatorMobileDevice() {
  if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))){
    return(1);
  }
  return(0);
}
//-->

