// -----------------------------------------------------------------------------------
//
//	OxfordLearning.com v1.1
//	by Joe Radman - http://OxfordLearning.com
//	1/2/08
//
// -----------------------------------------------------------------------------------

function show_map(locationmap){
	var imageurl = '<img src=\'/blackboard_media/' + locationmap + '\' alt=\"Map of the location\" />';
	Element.update('showmap', imageurl);
}


// Simple Post function and reset comment form
function post_comment(form) {
  new Ajax.Request("/ajaxpost/", {asynchronous:true, parameters:Form.serialize(form),onSuccess:handlerFunc, onFailure:errFunc});
  Form.reset(form);
  return false;
}

var handlerFunc = function(t) {
	new Insertion.Bottom('newcommentbox', t.responseText);
	new Effect.Highlight('newcommentbox');
}
// Should an error occur, insert error message in comment location
var errFunc = function(t) {
    alert('Error ' + t.status + ' -- ' + t.statusText);
	new Insertion.Bottom('newcommentbox', '<p>Something went wrong. I hope your post was saved. I will look into it.</p>');
}

