
function doVoteMaterial(document_srl) {
    if (!document_srl) {
        alert('잘못된 요청입니다!');
        return false;
    }

    if (!confirm("이 자료를 추천하시겠습니까?")) {
        return false;
    }

    var params = new Array();
    params["mid"] = current_mid;
    params["document_srl"] = document_srl;

    exec_xml("conference", "procConferenceVoteMaterial", params, completeVoteMaterial);
    return false;
}

function completeVoteMaterial(ret_obj, response_tags, callback_func_args, fo_obj) {
    var error = ret_obj['error'];
    var message = ret_obj['message'];

    if (message) alert(message);
    jQuery("#button-vote").css('display', 'none');
}


function doScrapMaterial(document_srl) {
    if (!document_srl) {
        alert('잘못된 요청입니다!');
        return false;
    }

    // check login
    if (!is_logged) {
        alert('로그인 후에 스크랩할 수 있습니다.');
        //jQuery("#button-scrap-" + document_srl).css('display', 'none');
        return false;
    }

    // check grant
    if (!grant_scrap) {
        alert('이 자료를 스크랩할 권한이 없습니다.');
        //jQuery("#button-scrap-" + document_srl).css('display', 'none');
        return false;
    }

    if (!confirm("이 자료를 스크랩하시겠습니까?")) return false;

    var params = new Array();
    params["mid"] = current_mid;
    params["document_srl"] = document_srl;

    var response_tags = new Array("error", "message", "mid", "document_srl");

    exec_xml("conference", "procConferenceScrapMaterial", params, completeScrapMaterial, response_tags, params);
    //return false;
}

function completeScrapMaterial(ret_obj, response_tags, params, fo_obj) {
    var error = ret_obj['error'];
    var message = ret_obj['message'];
    var mid = ret_obj['mid'];
    var document_srl = ret_obj['document_srl'];

    if (message) alert(message);
    if (document_srl)
        jQuery("#button-scrap-" + document_srl).css('display', 'none');
}

function doDownloadMaterial(document_srl, attached_file, attached_sid) {
    if (!document_srl) {
        alert('잘못된 요청입니다!');
        return false;
    }

    if (!attached_file) {
        alert('잘못된 요청입니다!');
        return false;
    }

    if (!attached_sid) {
        alert('잘못된 요청입니다!');
        return false;
    }

    // check login
    if (!is_logged) {
        alert('로그인 후에 다운로드할 수 있습니다.');
        //jQuery("#button-download-" + document_srl).css('display', 'none');
        return false;
    }

    // check grant
    if (!grant_download) {
        alert('이 자료를 다운로드할 권한이 없습니다.');
        //jQuery("#button-download-" + document_srl).css('display', 'none');
        return false;
    }

    if (!confirm("이 자료를 다운로드하시겠습니까?")) {
        return false;
    }

    location.href = "/?module=file&act=procFileDownload&file_srl=" + attached_file + "&sid=" + attached_sid;
    return false;
}



function doDeleteScrapMaterial(document_srl) {
    if (!document_srl) {
        alert('잘못된 요청입니다!');
        return false;
    }

    if (!confirm("스크랩 목록에서 이 자료를 지우시겠습니까?")) return false;

    var params = new Array();
    params["mid"] = current_mid;
    params["document_srl"] = document_srl;

    var response_tags = new Array("error", "message", "mid", "document_srl");

    exec_xml("conference", "procConferenceDeleteScrap", params, completeDeleteScrap, response_tags, params);
    return false;
}


function completeDeleteScrap(ret_obj) {
    var error = ret_obj['error'];
    var message = ret_obj['message'];
    var mid = ret_obj['mid'];
    var document_srl = ret_obj['document_srl'];

    if (message) alert(message);
    if (document_srl)
        jQuery("#material-item-" + document_srl).css('display', 'none');
}


