﻿/* --------- Java Script To Heighlight Current Page Link On Left Navigation : Starts------------------*/

// Main function, called when the page loads
// Searches through the document looking for links
// Changes class of the current link to /currentlink
function highlightCurrentLink() {

    var currentLocation = document.location.href;
    var targetNode;

    targetNode = document;

    targetNode = document.getElementById("leftNavId");

    links = targetNode.getElementsByTagName("a");

    // Search thorugh all links
    for (i = 0; i < links.length; i++) {
        linkHref = links[i].href;

        if (linkHref == currentLocation) {
            // alert('hello');
            // Set class for different browsers, if link is this link
            links[i].setAttribute("className", "currentlink");
            links[i].setAttribute("class", "currentlink");
        }
    }
}

// Piggy-back fucntion onto onLoad event ............................................
function addLoadEvent(func) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = func;
    } else {
        window.onload = function() {
            oldonload();
            func();
        }
    }
}

addLoadEvent(highlightCurrentLink);

/* --------- Java Script To Heighlight Current Page Link On Left Navigation : Ends ------------------*/
