 function changeDocumentShare(document_id, oldState, documentsUrl) {
    var selectElement =  document.getElementById("shared_"+document_id);
    if(oldState == "0"){
        var confirmed = confirm("Are you sure you want to share this document?");
        if (confirmed){
            window.location = documentsUrl+"/share/"+document_id;
        }
    }
    if(oldState == "1"){
        var confirmed = confirm("Are you sure you want to stop sharing this document?");
        if (confirmed){
            window.location = documentsUrl+"/unshare/"+document_id; 
        }
    }
}

