// Global variables
var ApplicationPathContainer;
var ApplicationPath;

// Initialize the main Interface on document load
function InitializeInterface() {
    //Set up ApplicationPath
    ApplicationPathContainer = $get("ApplicationPathContainer");
    ApplicationPath = ApplicationPathContainer.value;
    
    //Interface2 (Membership2.master)
    if (typeof(window.InitializeInterface_Interface2) != 'undefined') InitializeInterface_Interface2();

    //Committees (Committees.master)
    if (typeof (window.InitializeInterface_Committees) != 'undefined') InitializeInterface_Committees();
}

//Interface Search
function Search_Membership(SearchText) {
    window.open(ApplicationPath + 'MembershipSearch.aspx?SearchText=' + encodeURI(SearchText));
}
function Search_Documents(SearchText) {
    window.open(ApplicationPath + 'Documents/Documents.aspx?SearchText=' + encodeURI(SearchText));
}
function Search_Abstracts(SearchText) {
    window.open(ApplicationPath + 'Abstracts/AbstractsSearch.aspx?SearchText=' + encodeURI(SearchText));
}
function Search_Reviews(SearchText) {
    window.open('http://www.f1000medicine.com/search/results.asp?terms=' + encodeURI(SearchText) + '&drpPhrase1=and&type=f1000_advanced_results&drpArticleType=9472&Search.x=10');
}
function Search_PubMed(SearchText) {
    window.open('http://www.ncbi.nlm.nih.gov/sites/entrez?term=' + encodeURI(SearchText));
}
function Search_News(SearchText) {
    window.open('http://www.medworm.com/rss/search.php?qu=' + encodeURI(SearchText));
}
function Search_Google(SearchText) {
    window.open('http://www.google.co.uk/search?hl=en&q=' + encodeURI(SearchText));
}
function CloseSearch() {
    var SearchPopup = $find("PCE_InterfaceSearch");
    if (SearchPopup != null) {
        SearchPopup.hidePopup();
        return true;
    }
    else {
        return false;
    }
}
function ViewContact(ContactID) {
    window.open(ApplicationPath + 'ContactView.aspx?ViewContactID=' + encodeURI(ContactID));
}