/*
Javascript rollover handlers
Author: Antony Castle
Date: 20/10/2007
Description: Uses the bubble capture phase of the DOM event model to listen for hyperlink mouse overs
             bubling through the parent div (only requires one event listener for unlimited links).
Dependency:  Rollover images must have the same name as the image to be replaced but with the suffix 'roll'
			 The image to be swapped must be the dirct child of the A tag.
Directions:  Call setNav() from the body onLoad event or an init function called at this time. listenerTarget is
             the object which will be listened to for bubbling mouse events. The object name is passed as the functions 
			 only argument.
*/
function setNav(listenerTarget){
//get the element to place the eventlistener on - the parent node of the nav links
var nav = document.getElementById(listenerTarget);
//attach the event listener for FF and IE
  if( nav.addEventListener ) {
    nav.addEventListener('mouseover',overHandler,false);
    nav.addEventListener('mouseout',outHandler,false);
  } else if( nav.attachEvent ) {
    nav.attachEvent('onmouseover',overHandler);
    nav.attachEvent('onmouseout',outHandler);
  }
}
//called on mouse over - swaps link image for mouseover image
function overHandler(e){
  var theTarget = e.target ? e.target : e.srcElement;
  if(theTarget.parentNode.nodeName=='A'){
  var src = theTarget.src;
  var ftype = src.substring(src.lastIndexOf('.'), src.length);
  var hsrc = src.replace(ftype, 'roll'+ftype);
  theTarget.src=hsrc;}
}
//called on mouse out - swaps link image
function outHandler(e){
  var theTarget = e.target ? e.target : e.srcElement;
  if(theTarget.parentNode.nodeName=='A'){
  var src = theTarget.src;
  var ftype = src.substring(src.lastIndexOf('.')-4, src.length);
  var hsrc = src.replace(ftype, ftype.substring(4,ftype.length));
  theTarget.src=hsrc;}
}