﻿function MenuClick(button, div) {

    ClearTopMenu();
    ClearLeftMenu();

    /*document.getElementById(button).setAttribute("class", "currentlySelectedMenuButton");*/
    document.getElementById(button).style.color = 'white';    
    document.getElementById(button).style.background = '#07B32B';  
    
    document.getElementById('leftMenu').style.display = 'none';

    ClearDivs();

    document.getElementById(div).style.display = 'block';

    if (button == 'topMenuInfo') {

        document.getElementById('leftMenu').style.display = 'block';
        /*document.getElementById('benefitsMenuButton').setAttribute("class", "currentlySelectedLeftMenuButton");*/
        document.getElementById('aboutUsMenuButton').style.color = '#A2A2A2';
        document.getElementById('aboutUsMenuButton').style.backgroundColor = 'white';
  

    }


}

function removeSpaces(string) {
    return string.split(' ').join('');
}

function SetScreenWidth() {
    if ((screen.width > 1024) && (screen.height > 768)) {

        if ((screen.width > 1280) && (screen.height > 800)) {
            var width = '20%';
            var main = '59%';
        }
        else {
            var width = '15%'
            var main = '69%';
        }

        var left = document.getElementById('left');
        var right = document.getElementById('right');
        var pageContent = document.getElementById('pageContent');

        left.style.width = width;
        right.style.width = width;
        pageContent.style.width = main;
    }
    else {
        var left = document.getElementById('left');
        var right = document.getElementById('right');
        var pageContent = document.getElementById('pageContent');

        left.style.width = '10%';
        right.style.width = '10%';
        pageContent.style.width = '79%';
        

    }

}


function LeftMenuClick(button, div) {

    ClearLeftMenu();
    ClearTopMenu();

    /*document.getElementById(button).setAttribute("class", "currentlySelectedLeftMenuButton");*/
    document.getElementById(button).style.color = '#A2A2A2';
    document.getElementById(button).style.backgroundColor = 'white';
  

    ClearDivs();

    document.getElementById(div).style.display = 'block';

    document.getElementById('topMenuInfo').style.color = '#07B32B';
    document.getElementById('topMenuInfo').style.backgroundColor = 'white';
    

}

function ClearDivs() {
    var home = document.getElementById('divHome').style.display = 'none';
    var contactUs = document.getElementById('divContactUs').style.display = 'none';
    var findTeam = document.getElementById('divFindTeam').style.display = 'none';
    var faq = document.getElementById('divFAQ').style.display = 'none';
    var benefits = document.getElementById('divBenefits').style.display = 'none';
    var giftAid = document.getElementById('divGiftAid').style.display = 'none';
    var aboutUs = document.getElementById('divAboutUs').style.display = 'none';
    var termsConditions = document.getElementById('divTermsConditions').style.display = 'none';
    var newsletters = document.getElementById('divNewsletters').style.display = 'none';
}



function ClearTopMenu() {
    var tmH = document.getElementById('topMenuHome');
    var tmD = document.getElementById('topMenuDonate');
    var tmI = document.getElementById('topMenuInfo');
    var tmCP = document.getElementById('topMenuCreatePage');
    var tmCU = document.getElementById('topMenuContactUs');
   

   /* tmH.setAttribute("class", "notSelectedMenuButton");
    tmD.setAttribute("class", "notSelectedMenuButton");
    tmI.setAttribute("class", "notSelectedMenuButton");
    tmCP.setAttribute("class", "notSelectedMenuButton");
    tmCU.setAttribute("class", "notSelectedMenuButton");*/

    tmH.style.color = '#00B02E';
    tmH.style.backgroundColor = 'white';
    tmH.style.background = 'url(images/TDImages/WhiteFade.jpg) repeat left bottom';
    tmD.style.color = '#00B02E';
    tmD.style.backgroundColor = 'white';
    tmD.style.background = 'url(images/TDImages/WhiteFade.jpg) repeat left bottom';
    tmI.style.color = '#00B02E';
    tmI.style.backgroundColor = 'white';
    tmI.style.background = 'url(images/TDImages/WhiteFade.jpg) repeat left bottom';
    tmCP.style.color = '#00B02E';
    tmCP.style.backgroundColor = 'white';
    tmCP.style.background = 'url(images/TDImages/WhiteFade.jpg) repeat left bottom';
    tmCU.style.color = '#00B02E';
    tmCU.style.backgroundColor = 'white';
    tmCU.style.background = 'url(images/TDImages/WhiteFade.jpg) repeat left bottom';
    
    
}

function ClearLeftMenu() {
    var b = document.getElementById('benefitsMenuButton');
    var au = document.getElementById('aboutUsMenuButton');
    var tac = document.getElementById('termsAndConditionsMenuButton');
    var faq = document.getElementById('faqMenuButton');
    var ga = document.getElementById('giftAidMenuButton');
    var n = document.getElementById('newslettersMenuButton')
    

    /*b.setAttribute("class", "notSelectedLeftMenuButton");
    au.setAttribute("class", "notSelectedLeftMenuButton");
    tac.setAttribute("class", "notSelectedLeftMenuButton");
    faq.setAttribute("class", "notSelectedLeftMenuButton");*/

    b.style.color = 'white';
    b.style.backgroundColor = '#A2A2A2';
    au.style.color = 'white';
    au.style.backgroundColor = '#A2A2A2';
    tac.style.color = 'white';
    tac.style.backgroundColor = '#A2A2A2';
    faq.style.color = 'white';
    faq.style.backgroundColor = '#A2A2A2';
    ga.style.color = 'white';
    ga.style.backgroundColor = '#A2A2A2';
    n.style.color = 'white';
    n.style.backgroundColor = '#A2A2A2';

}

function isNumberKey(evt) {
    var charCode = (evt.which) ? evt.which : event.keyCode
    if (charCode > 31 && (charCode < 48 || charCode > 57))
        return false;

    return true;
}
