// window.alert("LOADED: theOutlook.js");

function bindEvents() {

    if(document.getElementById("aboutOutlook")) {
        document.getElementById("aboutOutlook").onmouseover = function() {
            //window.alert("over");
            this.src = "images/about_outlook_over.jpg";
        };

        document.getElementById("aboutOutlook").onmouseout = function() {
            //window.alert("out");
            this.src = "images/about_outlook_off.jpg";
        };
    }
    
    if(document.getElementById("aboutSP")) {
        document.getElementById("aboutSP").onmouseover = function() {
            //window.alert("over");
            this.src = "images/about_sp_over.jpg";
        };

        document.getElementById("aboutSP").onmouseout = function() {
            //window.alert("out");
            this.src = "images/about_sp_off.jpg";
        };
    }
    
    if(document.getElementById("signIn")) {
        document.getElementById("signIn").onmouseover = function() {
            //window.alert("over");
            this.src = "images/button_sign_on.jpg";
        };

        document.getElementById("signIn").onmouseout = function() {
            //window.alert("out");
            this.src = "images/button_sign_off.jpg";
        };
    }
    
    if(document.getElementById("reggy")) {
        document.getElementById("reggy").onmouseover = function() {
            //window.alert("over");
            this.src = "images/button_reg_on.jpg";
        };

        document.getElementById("reggy").onmouseout = function() {
            //window.alert("out");
            this.src = "images/button_reg_off.jpg";
        };
    }
    
    if(document.getElementById("subscribe")) {
        document.getElementById("subscribe").onmouseover = function() {
            //window.alert("over");
            this.src = "images/button_subscribe_on.jpg";
        };

        document.getElementById("subscribe").onmouseout = function() {
            //window.alert("out");
            this.src = "images/button_subscribe_off.jpg";
        };
    }
    
    
    /*var allDivs = document.getElementsByTagName("div");
    var allDivsLength = allDivs.length;
    
    for(var j = 0; j < allDivsLength; j++) {
        //window.alert(j);
        //var classy = (getAttribute("className")) ? getAttribute("className") : getAttribute("class");
        window.alert(allDivs.getAttribute("class"));
        if(allDivs[j].getAttribute("class").toUpperCase() == "LISTNAV") {
            window.alert(j);
            var allAs = allDivs[j].getElementsByTagName("a");
            var allAsLength = allAs.length;
            window.alert(allAsLength);
            for(var i = 0; i < allAsLength; i++) {
                window.alert(j + " : " + i);
                document.getElementsByTagName("div")[j].getElementsByTagName("a")[i].onmouseover = function() {
                    //window.alert(this.nodeName);
                    this.parentNode.style.backgroundColor = "#3e587a";
                    this.parentNode.style.borderBottom = "1px solid #1b345b";
                };
                
                document.getElementsByTagName("div")[j].getElementsByTagName("a")[i].onmouseout = function() {
                    //window.alert(this.nodeName);
                    this.parentNode.style.backgroundColor = "#617b9c";
                    this.parentNode.style.borderBottom = "1px solid #40546d";
                };
            }
        }
    }*/
    
    
    var listNavArray = document.getElementById("listNavOne").getElementsByTagName("a");
    
    for(var i = 0; i < listNavArray.length; i++) {
        listNavArray[i].onmouseover = function() {
            //window.alert(this.nodeName);
            this.parentNode.style.backgroundColor = "#3e587a";
            this.parentNode.style.borderBottom = "1px solid #1b345b";
        };
        
        listNavArray[i].onmouseout = function() {
            //window.alert(this.nodeName);
            this.parentNode.style.backgroundColor = "#617b9c";
            this.parentNode.style.borderBottom = "1px solid #40546d";
        };
    }
    
    
    var listNavArray = document.getElementById("listNavTwo").getElementsByTagName("a");
    
    for(var i = 0; i < listNavArray.length; i++) {
        listNavArray[i].onmouseover = function() {
            //window.alert(this.nodeName);
            this.parentNode.style.backgroundColor = "#3e587a";
            this.parentNode.style.borderBottom = "1px solid #1b345b";
        };
        
        listNavArray[i].onmouseout = function() {
            //window.alert(this.nodeName);
            this.parentNode.style.backgroundColor = "#617b9c";
            this.parentNode.style.borderBottom = "1px solid #40546d";
        };
    }
    
    
}


function init() {
    bindEvents();
}


window.onload = init;
