﻿hoverList = function() {

 	if (document.all || document.getElementById) {

        // SORT OUT THE SUB NAVIGATION (RIGHT HAND PANEL) FIRST
		navRoot = document.getElementById("subnavigation");
		for (i=0; i<navRoot.childNodes.length; i++) {	
			node = navRoot.childNodes[i];
			if (node.nodeName=="DIV" && node.className != "selected") {
				
				node.onmouseover=function() {
					this.className=" over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}
				node.onclick=function() {
				    for(c=0; c<this.childNodes.length; c++) {
				        child = this.childNodes[c];
				        for(d=0; d<child.childNodes.length; d++) {
				            if(child.childNodes[d].nodeName=="A") {
				                url = child.childNodes[d].href;
				            }
				        }
				    }
				    window.location=url;
				}
			}
		}
		
		// THEN DO THE 'WHAT' TABLE
		whatNav = document.getElementById("whatnav");
		
		// FIND THE TABLE BODY
	    for (x=0; x<whatNav.childNodes.length; x++) {
	    
	        if(whatNav.childNodes[x].nodeName=="TBODY") {
	            tbody = whatNav.childNodes[x];
	        
	            for (y=0; y<tbody.childNodes.length; y++) {
	            
	                if(tbody.childNodes[y].nodeName=="TR") {
	                    trow = tbody.childNodes[y];
            		    
	                    for (i=0; i<trow.childNodes.length; i++) {
	                        node = trow.childNodes[i];
            		   
		                    if (node.nodeName=="TD" && node.className=="off") {
			                    //alert("Success on row '"+y+"', class name: "+node.className);
            			    
			                    node.onmouseover=function() {
			                        //alert("over");
				                    this.className="off over";
			                    }
			                    node.onmouseout=function() {
			                        //alert("out");
				                    this.className="off";
			                    }
			                    node.onclick=function() {
			                        url = this.childNodes[0].href;
			                        window.location=url;
			                    }
		                    }
		                }
		            }
	            }
	        }
	    }
 	}
}

window.onload=hoverList;