function ToggleFaq(id) {
    var item = document.getElementById(id);
    
    if (item.style.display == 'none') {
        item.style.display = 'block';
    }
    else {
        item.style.display = 'none';
    }
}

function ToggleNewsEvents(tab) {
    if(tab == "events") {
        document.getElementById("news-tab").className = "news-tab-behind";
        document.getElementById("events-tab").className = "events-tab";
        document.getElementById("news-tab-content").className = "hidden";
        document.getElementById("events-tab-content").className = "";
    }
    if(tab == "news") {
        document.getElementById("news-tab").className = "news-tab";
        document.getElementById("events-tab").className = "events-tab-behind";
        document.getElementById("news-tab-content").className = "";
        document.getElementById("events-tab-content").className = "hidden";
    }
}

function SetRSS(id){
    if (document.getElementById('rssIcon')){
     document.getElementById('rssIcon').style.display='block';
     document.getElementById('rssIcon').onclick = new Function("location.href = '/crp_Rss.aspx?FolderID="+id+"'");
    }
}

function LoadSearch(ddl,searchtext){

    var dropdown = document.getElementById(ddl);
    var searchtxt = document.getElementById(searchtext);

    if (searchtxt.value != '')
    {
        if (Number(dropdown.value) == 18) {
            location.href = "/edu_SearchResults.aspx?FolderID="+dropdown.value+"&SearchText="+escape(searchtxt.value);
        }
        else {
            location.href = "http://www.moodyministries.net/crp_SearchResults.aspx?FolderID="+dropdown.value+"&SearchText="+escape(searchtxt.value);
        }
    }
    else 
    {
        alert('Please enter a search criteria.');
    }
}

function checkHistory(id) {
    if(document.referrer.indexOf("moody.edu") > 0) {
        document.getElementById(id).style.display = 'block';
    }
}

function open_window(url, name){
    newwindow = window.open(url,name, 'width=560,height=525,toolbar=0,resizable=0,atatus=0,scrollbars=1');
}

function newWindow(url, name, width, height){
    newwindow = window.open(url, name, 'width=' + width + ',height=' + height + ',toolbar=0,resizable=0,atatus=0,scrollbars=1');
}