/*
  Site specific.
*/

// The global variable holding the dropdown menu.
var listMenu = null;
// This gets called body.onload.
function pageInit(){
  // Initialize the main navigation, using the FSMenu class of Angus Turnbull http://www.twinhelix.com.
  listMenu = new FSMenu('listMenu', true, 'display', 'block', 'none');
  listMenu.animations[listMenu.animations.length] = FSMenu.animFade;
  listMenu.animations[listMenu.animations.length] = FSMenu.animSwipeDown;
  
  var arrow = null;
  if (document.createElement && document.documentElement)
  {
   arrow = document.createElement('span');
   arrow.appendChild(document.createTextNode('>'));
   // Feel free to replace the above two lines with these for a small arrow image...
   //arrow = document.createElement('img');
   //arrow.src = '/images/arrow.gif';
   //arrow.style.borderWidth = '0';
   arrow.className = 'subind';
  }
  listMenu.activateMenu("navigationroot", arrow);
}

/*
  Utilities.
*/
function buildEmailLink(username, domain, subject, body){
	var email = username + '@' + domain;
	if (subject == null) subject = '';
	if (body == null) body = '';
	return '<a href="mailto:' + email + '?subject=' + encodeURIComponent(subject) + '&body=' + encodeURIComponent(body) + '">' + email + '</a>';
}
function $(element) {
  if (arguments.length > 1) {
    for (var i = 0, elements = [], length = arguments.length; i < length; i++)
      elements.push($(arguments[i]));
    return elements;
  }
  if (typeof element == 'string')
    element = document.getElementById(element);
  return element;
}
