/*Highlights Parent Menu Item of SubMenus*/
var newColor = false;
function highlightParent(id) {
   
   
    if (newColor==false) {
        document.getElementById(id).style.backgroundColor = '#0a6695'
        newColor = true;
    }
    else {
        document.getElementById(id).style.backgroundColor = "";
        newColor = false;
    }


}

function highlightLeftNav() {
    var pageId = document.getElementsByTagName('body')[0].getAttribute('id');
    navId = 'nav-' + pageId;
    if (document.getElementById(navId)) {
        document.getElementById(navId).className = 'highlight';
    }

}


function checkAction() {
    /* Make sure form url matches the host (with https) */
    var url_fmt = /https?:\/\/(.*?)\/?$/
    if (document.getElementById('home_myaccount')) {
        //var host = url_fmt.exec(location.href)[1];
        var host = location.hostname;
        document.getElementById('home_myaccount').setAttribute('action', 'https://' + host + '/myaccount/log_in.pl');
    }

} // End of checkAction()

function displayNews(obj) {
    var selectedNav = document.getElementById('news-index').className;
    document.getElementById(selectedNav).className = '';

    var navId = obj.getAttribute('id');
    document.getElementById(navId).className = 'selected';

    document.getElementById('news-index').className = navId;
}

/*Onload Events*/
window.onload = function() {
    /*highlights subnav option*/
highlightLeftNav()
/*changes action based on domain*/
checkAction();
/*Checks to see if cookie username exists*/
checkCookie();

}
