// JavaScript Document

<!--//--><![CDATA[//><!--

function save_comment(id) {
	document.getElementById('cm_btn['+id+']').disabled = true;
	var req = new JsHttpRequest();
	req.onreadystatechange = function() {
		if (req.readyState == 4) {
			if(req.responseJS.r=='OK') {
				cm_form_last = null;
				document.getElementById('comment_list').innerHTML = req.responseJS.out;
				if(document.getElementById('cm_form_text['+id+']')) {
					document.getElementById('cm_form_text['+id+']').value = '';
				}
			} else {
				alert(req.responseJS.r);
			}
			document.getElementById('cm_btn['+id+']').disabled = false;
		}
	}
	req.open(null, '/workouts/actions/save_comment.php', true);
	req.send( { id: id, text: document.getElementById('cm_form_text['+id+']').value, object_id: document.getElementById('object_id').value, object_type: 10, out: 1 } );
}

function delete_comment(id,type) {
	var req = new JsHttpRequest();
	req.onreadystatechange = function() {
		if (req.readyState == 4) {
			if(req.responseJS.r=='OK') {
				document.location = document.location;
			} else {
				alert(req.responseJS.r);
			}
		}
	}
	req.open(null, '/workouts/actions/save_comment.php', true);
	req.send( { id: id, f: 1} );
}

//--><!]]>