function showLogin() {
    var login_div = document.getElementById('login-box');
    login_div.style.visibility = "visible";
}
function hideLogin() {
    var login_div = document.getElementById('login-box');
    login_div.style.visibility = "hidden";
}
function validateTextFields(check_fields) {
    var passed = true;
    var cur_field = null;
    var input_vals = new Array();
    input_vals = check_fields.split(',');

    for(var index = 0; index < input_vals.length; index++) {
        cur_field = document.getElementById(input_vals[index]);
        cur_field.style.backgroundColor = "#ffffff";
        cur_field.style.color = "#000000";
        cur_field.style.fontWeight = "normal";
        if(((cur_field.type == 'text') || (cur_field.type == 'password') || (cur_field.type == 'textarea')) && (cur_field.value == '')) {
            passed = false
            cur_field.style.backgroundColor = "#ff0000";
            cur_field.style.color = "#ffffff";
            cur_field.style.fontWeight = "bold";
        }
        else if((cur_field.type == 'select-one') && (cur_field.value == '-1')) {
            passed = false
            cur_field.style.backgroundColor = "#ff0000";
            cur_field.style.color = "#ffffff";
            cur_field.style.fontWeight = "bold";
        }
    }

    if(! passed) {
        alert("Missing Fields!");
        return(false);
    }
    else {
        return(true);
    }
}
function clearTerms() {
    var view_form = document.getElementById('view');
    var term_select = document.getElementById('view_terms');
    if(term_select) {
        term_select.selectedIndex = 0;
    }
    
    view_form.submit();
}
function hideSearch(searchState) {
    var searchArea = document.getElementById('search');
    var searchMore = document.getElementById('search_more');
    if(searchState) {
        searchArea.style.display = "none";
        searchMore.style.display = "block";
    }
    else {
        searchArea.style.display = "block";
        searchMore.style.display = "none";
    }
}
