﻿
//
//
//SUCKERFISH
//

startList = function() {

    var myObjColl = getElementsByClassName('suckerfish');
	//var s="startList : "+myObjColl.length +"\n";
    for (var i = 0, j = myObjColl.length; i < j; i++) {
        // Do your thing here.
        //if (document.all&&document.getElementById) {
        //navRoot = document.getElementById("nav");
        var navRoot = myObjColl[i].getElementsByTagName("LI");
		//s+="\n" +i +" : "+navRoot.length;
		//if (navRoot.childNodes)
		//{	s+="\n  : "+navRoot.childNodes
			if (navRoot.length)
			{	//s+="\n  : "+navRoot.length;
		        for (var m = 0, n = navRoot.length; m < n; m++) {
		            var node = navRoot[m];
		            //if (node.nodeName=="LI") {
		            node.onmouseover=function() {
		                this.className+=" over";
		            }
		            node.onmouseout=function() {
		                //this.className=this.className.replace(" over", "");
		                this.className=this.className.replace("over", "");
		            }
		           // }
		        }
			}
		//}
        // }  
    }
	//alert(s);
}
window.onload=startList;

/*
//SON OF SUCKERFISH CODE
sfHover = function() {     
    var sfEls = document.getElementById("nav").getElementsByTagName("LI");     
    for (var i=0; i<sfEls.length; i++) {         
        sfEls[i].onmouseover=function() {             
            this.className+=" sfhover";         
        }         
        sfEls[i].onmouseout=function() {             
            this.className=this.className.replace(new RegExp(" sfhover\\b"), "");         
        }     
    } 
} 
if (window.attachEvent) window.attachEvent("onload", sfHover); 
*/


//
//SUPPORT FUNCTIONS
//

//http://muffinresearch.co.uk/archives/2006/04/29/getelementsbyclassname-deluxe-edition/
//Stuart Colville 
//IE/Win 5+, IE/Mac 5.2+, Firefox 1.0+, Opera ?, Safari ?
//
//strClass: 
//  string containing the class(es) that you are looking for 
//strTag (optional, defaults to ‘*’) : 
//  An optional tag name to narrow the search to specific tags e.g. ‘a’ for links. 
//objContElm (optional, defaults to document) 
//  An optional object container to search inside. Again this narrows the scope of the search
//
function getElementsByClassName(strClass, strTag, objContElm) {
  strTag = strTag || "*";
  objContElm = objContElm || document;
  var objColl = objContElm.getElementsByTagName(strTag);
  if (!objColl.length &&  strTag == "*" &&  objContElm.all) objColl = objContElm.all;
  var arr = new Array();
  var delim = strClass.indexOf('|') != -1  ? '|' : ' ';
  var arrClass = strClass.split(delim);
  for (var i = 0, j = objColl.length; i < j; i++) {
    var arrObjClass = objColl[i].className.split(' ');
    if (delim == ' ' && arrClass.length > arrObjClass.length) continue;
    var c = 0;
    comparisonLoop:
    for (var k = 0, l = arrObjClass.length; k < l; k++) {
      for (var m = 0, n = arrClass.length; m < n; m++) {
        if (arrClass[m] == arrObjClass[k]) c++;
        if (( delim == '|' && c == 1) || (delim == ' ' && c == arrClass.length)) {
          arr.push(objColl[i]);
          break comparisonLoop;
        }
      }
    }
  }
  return arr;
}

// To cover IE 5.0's lack of the push method
Array.prototype.push = function(value) {
  this[this.length] = value;
}


