/* root function: returns the root directory of the site */
function root() { return '/'; }

menuID = 0;
menuSel = -1;

function forcePopup()
{
  if ((ip!='134.7.118.222')&&(ip!='134.7.119.63')&&(ip!='134.7.167.10')&&(ip!='134.7.167.11'))
  {
    showPopup();
  }
}

function showPopup()
{
  winatt = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,';
  winatt += 'height=600,width=600';
  var notices = openWindow('popup.cfm','abnotice',winatt);
}

function openWindow(src,target,winatt,h,w)
{
  if (target == null || target == '') target = '_blank';
  if (h == null || h == '') h = 300;
  if (w == null || w == '') w = 300;
  if (winatt == null || winatt == '') winatt = 'height='+h+',width='+w;
  newWin = window.open(src,target,winatt)
}

/* noticeLink function: creates link to an Abacus Lab notice page, important can be 0 (no) or 1 (yes) */
function noticeLink(subject, href, important)
{
  if (href != null && href != '')
	{
		document.write('<p>');
		if (important == 1) document.write('<strong>');
    document.write('<a href="' + href + '">' + subject + '</a>');
		if (important == 1) document.write('</strong>');
		document.write('</p>');
	}
  else document.write('<p' + subject + '</p>');

}

/* leftMenuItem function: write an item on the left menu, highlight if it is the current page */
function leftMenuItem(title, href, indent, isMatch)
{
  menuID ++;
  if (href.indexOf('http://') == -1 && href.indexOf('https://') == -1) href = root() + href;
  if (indent == null || indent == '') indent = 0;
  href2 = href;
  if (href2.indexOf('index.cfm') != -1) href2 = href2.substr(0, href2.indexOf('index.cfm') - 1);
  
  if (href == document.location.href
    || href == document.location.pathname
    || href == document.location.pathname.substr(0, document.location.pathname.length - 1)
    || href2 == document.location.href
    || href2 == document.location.pathname
    || href2 == document.location.pathname.substr(0, document.location.pathname.length - 1)
    || isMatch
    && menuSel == -1)
  {
    document.write('<tr><td width="170" class="leftmenusel" ');
    document.write('onClick="document.location.href = \'' + href + '\';">');
    for (i = 0; i <= indent; i ++) document.write('&nbsp;&nbsp;');
    document.write('<a id="leftMenuItem' + menuID + 'Link" href="' + href + '" class="leftmenusel">');
    document.write(title + ' &#187;</a></td></tr>');
    menuSel = menuID;
  }
  else
  {
    document.write('<tr><td bgcolor="" width="170" id="leftMenuItem' + menuID + '" ');
    document.write('onMouseOver="leftMenuOver(\'leftMenuItem' + menuID + '\')" ');
    document.write('onMouseOut="leftMenuOut(\'leftMenuItem' + menuID + '\')" ');
    document.write('class="leftmenu" onClick="document.location.href = \'' + href + '\';">');
    for (i = 0; i <= indent; i ++) document.write('&nbsp;&nbsp;');
    document.write('<a id="leftMenuItem' + menuID + 'Link" href="' + href + '" class="leftmenu">');
    document.write(title + '</a></td></tr>');
  }
}

function leftMenuOver(thisID)
{
  /*if (document.all)
  {
    eval(thisID).style.backgroundColor = "#dddddd";
  }*/
}

function leftMenuOut(thisID)
{
  /*if (document.all)
  {
    eval(thisID + 'Link').style.color = "#ffffff";
    eval(thisID).style.backgroundColor = "#336699";
  }*/
}

/* Boolean variable: is Netscape Navigator 4 (or lower) */
var Nav4 = (browserType() == 'netscape' && browserVersion() < 5);

/* returns the visitor's browser type */
function browserType()
{
  if (navigator.appVersion.indexOf('MSIE ') != -1)
    type = 'ie';
  else if (navigator.appName == 'Netscape')
    type = 'netscape';
  else if (navigator.appName == 'Opera')
    type = 'opera';
  else type = 'unknown';
  return type;
}

/* returns the visitor's browser version */
function browserVersion()
{
  if (navigator.appVersion.indexOf('MSIE ') != -1)
    version = navigator.appVersion.substr(navigator.appVersion.indexOf('MSIE ') + 5, 1);
  else if (navigator.appName == 'Netscape')
    version = parseInt(navigator.appVersion);
  else if (navigator.appName == 'Opera')
    version = parseInt(navigator.appVersion);
  else version = -1;
  return version;
}

/* JavaScript API from quirksmode.org */
function getObj(name)
{
  if (document.all)
  {
    this.obj = document.all[name];
    this.style = document.all[name].style;
  }
  else if (document.getElementById)
  {
    this.obj = document.getElementById(name);
    this.style = document.getElementById(name).style;
  }
}

function showObj()
{
  argv = showObj.arguments;
  for (i = 0; i < argv.length; i ++)
  {
    thisObj = new getObj(argv[i]);
    thisObj.style.display = 'inline';
  }
}
function hideObj()
{
  argv = hideObj.arguments;
  for (i = 0; i < argv.length; i ++)
  {
    thisObj = new getObj(argv[i]);
    thisObj.style.display = 'none';
  }
}