﻿window.onload = init;
function init(){}

//Language change option
function ShowLanOption(){
    var ParentId = document.getElementById(ChangeLanguage);var ChangeLanguage = document.getElementById('ChangeLanguage');
    if (ChangeLanguage.addEventListener){ChangeLanguage.addEventListener('click', HideandShowOption, false);ChangeLanguage.style.cursor = "hand";}
    else if (ChangeLanguage.attachEvent){ChangeLanguage.attachEvent("onclick", HideandShowOption);ChangeLanguage.style.cursor = "hand";}
    HideandShowOption();}

function HideandShowOption(){
    var LanOptionId = document.getElementById('SelectLanguage');
    if(LanOptionId.style.display == 'none'){LanOptionId.style.display = '';}
    else{LanOptionId.style.display = 'none';}}

//Media Archive Year Selection
function ShowNews(divYear){
    var NewsYear = document.getElementById('divYear').options[document.getElementById('divYear').selectedIndex].value;
    
    var YR09 = document.getElementById('YR2009');
    var YR08 = document.getElementById('YR2008');
    var YR07 = document.getElementById('YR2007');
    var YR06 = document.getElementById('YR2006');
    //debugger;
    switch (NewsYear){
        case '--- Select ---':  YR09.style.display = 'none';    YR08.style.display = 'none';    YR07.style.display = 'none';    YR06.style.display = 'none';    break
        case 'ShowAll':         YR09.style.display = '';        YR08.style.display = '';        YR07.style.display = '';        YR06.style.display = '';        break
        case '2010':            YR09.style.display = 'none';    YR08.style.display = 'none';    YR07.style.display = 'none';    YR06.style.display = 'none';    break
        case '2009':            YR09.style.display = '';        YR08.style.display = 'none';    YR07.style.display = 'none';    YR06.style.display = 'none';    break
        case '2008':            YR09.style.display = 'none';    YR08.style.display = '';        YR07.style.display = 'none';    YR06.style.display = 'none';    break
        case '2007':            YR09.style.display = 'none';    YR08.style.display = 'none';    YR07.style.display = '';        YR06.style.display = 'none';    break
        case '2006':            YR09.style.display = 'none';    YR08.style.display = 'none';    YR07.style.display = 'none';    YR06.style.display = '';        break}}

//Content Show and Hide finctionality
function HideShowMgmt(){
    var PageContentRight = document.getElementById('PageContentRight');var H3Count = 1;var ULCount = 1;
    if (null != PageContentRight) {
        var AllH3Tags = PageContentRight.getElementsByTagName('h3');
        var AllULTags = PageContentRight.getElementsByTagName('ul');
        var AllH3TagsLength = AllH3Tags.length;
        var AllULTagsLength = AllULTags.length;
        for (var NthH3 = 0; NthH3 < AllH3TagsLength; NthH3++){
            var CurrentH3 = AllH3Tags[NthH3];
            if (CurrentH3.nodeName == 'H3') {
                CurrentH3.style.backgroundImage = 'url(../../images/icon/expand.gif)';
                CurrentH3.style.backgroundRepeat = 'no-repeat';
                CurrentH3.style.backgroundPosition = 'left center';
                CurrentH3.style.cursor = "hand";
                if (CurrentH3.addEventListener)
                {
                    CurrentH3.addEventListener('click', HideShow, false);
                   
                }
                else if (CurrentH3.attachEvent)
                {
                    CurrentH3.attachEvent("onclick", HideShow);
                }
                CurrentH3.setAttribute("ItemIndex", H3Count);
                CurrentH3.id = "_T_" + H3Count;
                CurrentH3.setAttribute("CurrentId", CurrentH3.id);
                H3Count ++;}}
        for (var NthUL = 0; NthUL < AllULTagsLength; NthUL++){
            var CurrentUL = AllULTags[NthUL];
            if (CurrentUL.className == "txtIndent1"){
                CurrentUL.style.display = 'none';
                CurrentUL.setAttribute("ItemIndex", ULCount);
                CurrentUL.id = "_C_" + ULCount;
                CurrentUL.setAttribute("CurrentId", CurrentUL.id);
                ULCount ++;}}}}

//Media News Show and Hide Functionality
function HideShowNews() {
    var PageContentRight = document.getElementById('PageContentRight');
    var H3Count = 1;var ULCount = 1;
    if (null != PageContentRight) {
        var AllH3Tags = PageContentRight.getElementsByTagName('h4');
        var AllULTags = PageContentRight.getElementsByTagName('p');
        var AllH3TagsLength = AllH3Tags.length;
        var AllULTagsLength = AllULTags.length;
        for (var NthH3 = 0; NthH3 < AllH3TagsLength; NthH3++){
            var CurrentH3 = AllH3Tags[NthH3];
            if (CurrentH3.nodeName == 'H4') {
                CurrentH3.style.backgroundImage = 'url(../../images/icon/expand.gif)';
                CurrentH3.style.backgroundRepeat = 'no-repeat';
                CurrentH3.style.backgroundPosition = 'left center';
                CurrentH3.style.cursor = 'pointer';
                if (CurrentH3.addEventListener){CurrentH3.addEventListener('click', HideShow, false);}
                else if (CurrentH3.attachEvent){CurrentH3.attachEvent("onclick", HideShow);}
                CurrentH3.setAttribute('ItemIndex', H3Count);
                CurrentH3.id = "_T_" + H3Count;
                CurrentH3.setAttribute('CurrentId', CurrentH3.id);
                H3Count ++;}}
        for (var NthUL = 0; NthUL < AllULTagsLength; NthUL++){
            var CurrentUL = AllULTags[NthUL];
            if (CurrentUL.className == 'ShortNews'){
                CurrentUL.style.display = 'none';
                CurrentUL.setAttribute('ItemIndex', ULCount);
                CurrentUL.id = "_C_" + ULCount;
                CurrentUL.setAttribute('CurrentId', CurrentUL.id);
                ULCount ++;}}}}

function HideShow(e){
    
    if (window.event) e = window.event;
    var CurrentH3 = e.srcElement? e.srcElement : e.target; 
    
    var CurrentUL = document.getElementById(CurrentH3.getAttribute('CurrentId').replace('T', 'C'));
    if (CurrentUL.style.display == 'none') {
        CurrentUL.style.display = '';
        CurrentH3.style.backgroundImage = 'url(../../images/icon/collapse.gif)';
        CurrentH3.style.backgroundRepeat = 'no-repeat';
        CurrentH3.style.backgroundPosition = 'left center';
        CurrentH3.style.cursor = "hand";}
    else{
        CurrentUL.style.display = 'none';
        CurrentH3.style.backgroundImage = 'url(../../images/icon/expand.gif)';
        CurrentH3.style.backgroundRepeat = 'no-repeat';
        CurrentH3.style.backgroundPosition = 'left center';
        CurrentH3.style.cursor = 'hand';}}
