// define your custom button
	$(document).ready(function() {
		if (in_editor)
		{
			$.fn.contextMenu.addAction({name: 'unlock', title: 'Lukusta lahti', bind: customAction});
		}
	});

    // function to be executed, when the menu item is clicked
    function customAction()
    {
        // get object info from the anchor
        var objectData = $(this).data('objectData');
       
        var attrs = objectData.anchor.getAttributes(/^scms_/);

		var object_id = attrs['scms_object_id'];
       
        $.get("/admin/checkin.php", { objekt_id: object_id, unlock: "1" },
		  function(data){
			alert(stripHTML(data));
		  });
       
        // return false to stop click propagation
        return false;
    }

// Strip HTML tags
function stripHTML(html)
{
   var tmp = document.createElement("DIV");
   tmp.innerHTML = html;
   return tmp.textContent||tmp.innerText;
}
