﻿
function accordion(item,sequence)
{
    var arrClasses = getElementsByClassName(item.parentNode.parentNode.parentNode, "div", "accordionHeader");
    if(arrClasses[2])
    {
        switch(sequence)
        {
            case 0:
                arrClasses[0].style.background = "url(/img/1024/accordion/header_active_top.gif) top left no-repeat";
                arrClasses[1].style.background = "url(/img/1024/accordion/header_inactive.gif) top left no-repeat";
                arrClasses[2].style.background = "url(/img/1024/accordion/header_inactive.gif) top left no-repeat";
                document.getElementById('right').getElementsByTagName('h4')[0].style.color = "#fff";
                document.getElementById('right').getElementsByTagName('h4')[1].style.color = "#474747";
                document.getElementById('right').getElementsByTagName('h4')[2].style.color = "#474747";
                document.getElementById("accordionbottom").style.backgroundImage = "url('/img/1024/accordion/bottom_inactive.png')";
                break;
            
            case 1:
                arrClasses[0].style.background = "url(/img/1024/accordion/header_inactive_top.gif) top left no-repeat";
                arrClasses[1].style.background = "url(/img/1024/accordion/header_active.gif) top left no-repeat";
                arrClasses[2].style.background = "url(/img/1024/accordion/header_inactive.gif) top left no-repeat";
                document.getElementById('right').getElementsByTagName('h4')[0].style.color = "#474747";
                document.getElementById('right').getElementsByTagName('h4')[1].style.color = "#fff";
                document.getElementById('right').getElementsByTagName('h4')[2].style.color = "#474747";
                document.getElementById("accordionbottom").style.backgroundImage = "url('/img/1024/accordion/bottom_inactive.png')";
                break;
            
            case 2:
                arrClasses[0].style.background = "url(/img/1024/accordion/header_inactive_top.gif) top left no-repeat";
                arrClasses[1].style.background = "url(/img/1024/accordion/header_inactive.gif) top left no-repeat";
                arrClasses[2].style.background = "url(/img/1024/accordion/header_active.gif) top left no-repeat";
                document.getElementById('right').getElementsByTagName('h4')[0].style.color = "#474747";
                document.getElementById('right').getElementsByTagName('h4')[1].style.color = "#474747";
                document.getElementById('right').getElementsByTagName('h4')[2].style.color = "#fff";
                document.getElementById("accordionbottom").style.backgroundImage = "url('/img/1024/accordion/bottom_active.png')";
                break;
        }
    }
    else
    {
        switch(sequence)
        {
            case 0:
                arrClasses[0].style.background = "url(/img/1024/accordion/header_active_top.gif) top left no-repeat";
                document.getElementById('right').getElementsByTagName('h4')[0].style.color = "#fff";
                arrClasses[1].style.background = "url(/img/1024/accordion/header_inactive.gif) top left no-repeat";
                document.getElementById('right').getElementsByTagName('h4')[1].style.color = "#474747";
                document.getElementById("accordionbottom").style.backgroundImage = "url('/img/1024/accordion/bottom_inactive.png')";
                break;
            case 1:
                arrClasses[0].style.background = "url(/img/1024/accordion/header_inactive_top.gif) top left no-repeat";
                document.getElementById('right').getElementsByTagName('h4')[0].style.color = "#474747";
                arrClasses[1].style.background = "url(/img/1024/accordion/header_active.gif) top left no-repeat";
                document.getElementById('right').getElementsByTagName('h4')[1].style.color = "#fff";
                document.getElementById("accordionbottom").style.backgroundImage = "url('/img/1024/accordion/bottom_active.png')";
                break;
        }
    }
    
}
//$(document).ready(function() {
    var arrClasses = getElementsByClassName(document, "div", "accordionHeader");
    if(arrClasses[2])
    {
        arrClasses[2].style.backgroundImage = "url('/img/1024/accordion/header_active.gif')";
        document.getElementById('right').getElementsByTagName('h4')[2].style.color = "#fff";
        document.getElementById("accordionbottom").style.backgroundImage = "url('/img/1024/accordion/bottom_active.png')";    
        arrClasses[0].style.background = "url(/img/1024/accordion/header_inactive_top.gif) top left no-repeat";
    }
    else
    {
        if(arrClasses[1])
        {
            arrClasses[1].style.backgroundImage = "url('/img/1024/accordion/header_active.gif')";
            document.getElementById('right').getElementsByTagName('h4')[1].style.color = "#fff";
            document.getElementById("accordionbottom").style.backgroundImage = "url('/img/1024/accordion/bottom_active.png')";    
            arrClasses[0].style.background = "url(/img/1024/accordion/header_inactive_top.gif) top left no-repeat";
        }
    }
    
    var RightElement = document.getElementById("right");
    if (RightElement != null){document.getElementById("right").style.display = 'block';}
//});

function accordionie5(newcurrent)
{
    document.getElementById("news").style.display = 'none';
    document.getElementById("quicklinks").style.display = 'none';
    document.getElementById("investnow").style.display = 'none';
    document.getElementById(newcurrent).style.display = 'block';
}

// TODO: Remove after all is on new template.
function InitialiseAccordion() {
    var arrClasses = getElementsByClassName(document, "div", "accordionHeader");
    if (arrClasses[2]) {
        arrClasses[2].style.backgroundImage = "url('/img/1024/accordion/header_active.gif')";
        document.getElementById('right').getElementsByTagName('h4')[2].style.color = "#fff";
        document.getElementById("accordionbottom").style.backgroundImage = "url('/img/1024/accordion/bottom_active.png')";
        arrClasses[0].style.background = "url(/img/1024/accordion/header_inactive_top.gif) top left no-repeat";
    }
    else {
        if (arrClasses[1]) {
            arrClasses[1].style.backgroundImage = "url('/img/1024/accordion/header_active.gif')";
            document.getElementById('right').getElementsByTagName('h4')[1].style.color = "#fff";
            document.getElementById("accordionbottom").style.backgroundImage = "url('/img/1024/accordion/bottom_active.png')";
            arrClasses[0].style.background = "url(/img/1024/accordion/header_inactive_top.gif) top left no-repeat";
        }
    }

    var RightElement = document.getElementById("right");
    if (RightElement != null) { document.getElementById("right").style.display = 'block'; }
}

