
/* 
  JAVASCRIPT MOUSEOVER MENU EFFECT
  ================================
  
  Description:
    Applies a nice little effect to the menus
  
  Developer(s): 
    Derek Harvey (lotsofcode.com), 
    Matthew Pusey (gtastunting.net),
    Olivers Mum (God she looks so hot today, oliversmum.ca)
  
*/

function menuEffect() {
  // For the mouse over effects
  this.over = function(obj) {
    // Grab the sub elements
    var childNodeList = obj.childNodes;
    // Change the background 
    obj.className = obj.className.replace('hoverClass', 'hoverClassMO');
    // Loop through all the sub elementss
    for (var i = 0; i < childNodeList.length; i++) {
      if (childNodeList[i].className != '') {
        // If we can find the object with the className of 'titleBox' then change the source file it is looking for
        if (childNodeList[i].className == 'titleBox') {
          childNodeList[i].src = childNodeList[i].src.replace('.gif', '_mo.gif');
        }
        // If we have a class name of 'contentBottom' then change it to 'contentBottomMOs'
        if (childNodeList[i].className == 'contentBottom') {
          childNodeList[i].className = childNodeList[i].className.replace('contentBottom', 'contentBottomMO');
        }
      }
    }
  }
  // For the mouse out effects
  this.out = function(obj) {
    // Grab the sub elements
    var childNodeList = obj.childNodes;
    // Change the background back
    obj.className = obj.className.replace('hoverClassMO', 'hoverClass');
    // Loop through all the sub elementss
    for (var i = 0; i < childNodeList.length; i++) {
      if (childNodeList[i].className != '') {
        // If we can find the object with the className of 'titleBox' then change the source file it is looking for
        if (childNodeList[i].className == 'titleBox') {
          childNodeList[i].src = childNodeList[i].src.replace('_mo.gif', '.gif');
        }
        // If we have a class name of 'contentBottomMO' then change it to 'contentBottom'
        if (childNodeList[i].className == 'contentBottomMO') {
          childNodeList[i].className = childNodeList[i].className.replace('contentBottomMO', 'contentBottom');
        }
      }
    }
  }
}
