﻿function showControl(ctlname, flag) 
{
    var ctl = document.getElementById(ctlname);

    if (ctl == null) return;

    ctl.style.display = flag ? "block" : "none";
}

var minheight = '18px';

function expandDiv(divctlname, maxheight) {
    var divctl = document.getElementById(divctlname);

    if (divctl == null) return;

    var height = divctl.style.height;

    if(height == minheight)
    {
        height = maxheight
        divctl.style.borderColor = 'red';
    }
    else
    {
        height = minheight;
        divctl.style.borderColor = '';
    }
    divctl.style.height = height;
}

function changeBorderColor(ctl, color) {
    ctl.style.borderColor = color;
}

function searchMember(contryctlname, practiceareactlname, searchfieldctlname, searchkeywordctlname)
{
    var country = '', practicearea = '', searchfield = '', searchkeyword = '';

    //Country
    var countryctl = document.getElementById(contryctlname);
    if(countryctl != null)
    {
        country = countryctl.options[countryctl.selectedIndex].value;
    }
    
    //Practice Area
    var practiceareactl = document.getElementById(practiceareactlname);
    if(practiceareactl != null)
    {
        practicearea = practiceareactl.options[practiceareactl.selectedIndex].value;
    }

    //Search Field
    var searchfieldctl = document.getElementById(searchfieldctlname);
    if(searchfieldctl != null)
    {
        searchfield = searchfieldctl.options[searchfieldctl.selectedIndex].value;
    }

    //Search Keyword
    var searchkeywordctl = document.getElementById(searchkeywordctlname);
    if(searchkeywordctl != null)
    {
        searchkeyword = searchkeywordctl.value;
    }

    window.location = 'members.aspx?country=' + country + '&practicearea=' + practicearea + 
                        '&searchfield=' + searchfield + '&searchkeyword=' + searchkeyword;
}


/*
function isPublicEmailAddress(email) {
    var publicemailaddresses = new String[] {"gmail", "hotmail"};
    
    for(i = 0; i < publicemailaddresses.length; i++)
    {
        var publicemailaddress = publicemailaddresses[i];
        if(email.toLower().indexOf(publicemailaddress.toLower()> >= 0)
        {
            return true;
        }
    }
    
    return false;
}
*/
