    function general_show_hide_full_results(main_id, small_id, full_id, current, action) {
        curr_parent = $(current).parent().parent();
        placeholder = curr_parent.find("#"+main_id);
        if (action == "show") {
            placeholder.empty();
            placeholder.html(curr_parent.find("#"+full_id).html());
        }

        if (action == "hide") {
            placeholder.empty();
            placeholder.html(curr_parent.find("#"+small_id).html());
        }
    }

    function check_date_validity(element, message) {
        // Date value format should be: "19.04.2009" or "dd.MM.yyyy"
        var el_value = $(element).val();
        re = /^(0[1-9]|[12][0-9]|3[01])\.(0[1-9]|1[012])\.(19|20?\d\d)$/;
        var isError = false;
        // We do nothing in case of totally empty value
        if (el_value != "") {
            if ( regs = el_value.match(re)) {
                if ((regs[1] == 31) && (regs[2] == 4 || regs[2] == 6 || regs[2] == 9 || regs[2] == 11)) {
                    isError = true;// 31st of month with 30 days
                } else if (regs[1] >= 30 && regs[2] == 2) {
                    isError = true;// February 30 or 31
                } else if (regs[2] == 2 && regs[1] == 29 && !(regs[3] % 4 == 0 && (regs[3] % 100 != 0 || regs[3] % 400 == 0))) {
                    isError = true; // February 29'th outside a leap year
                }
            } else {
                isError = true;
            }
        }

        if (isError) {
            // Raise error message provided
            alert(message);
            // Empty the value
            $(element).val("");
        }
    }

    // display's popup area
    function display_general_popup(mask_id, id) {
        var maskHeight = $(document).height();
        var maskWidth = $(window).width();

        //Set heigth and width to mask to fill up the whole screen
        $(mask_id).css({'width':maskWidth,'height':maskHeight});

        //transition effect
        $(mask_id).fadeIn(1000);
        $(mask_id).fadeTo("slow",0.8);

        var winH = $(window).height();
        var winW = $(window).width();

        //Set the popup window to center
        $(id).css('top',  winH/2-$(id).height()/2);
        $(id).css('left', winW/2-$(id).width()/2);

        //transition effect
        $(id).fadeIn(1000);

    }

    // Show disclaimer
    function showKoolieluDisclaimer() {
        display_general_popup('#disclaimer_mask', '#koolielu_disclaimer');
    }

    function _close_disclaimer() {
         $('#koolielu_disclaimer').hide();
         $('#disclaimer_mask').hide();
    }

    // show helptext
    function show_general_helptext(fid) {
        display_general_popup('#helpmask', '#helptext_area');
        var text = $("#"+fid+"_helptext").html();
        $('#helptext_area').html(text);
    }

    function _close_general_helpmask() {
        $('#helptext_area').hide();
        $('#helpmask').hide();
    }

