function getAbsoluteTop(elem) {
  var top = elem.offsetTop;
  while (elem.offsetParent) {
    elem = elem.offsetParent;
    top += elem.offsetTop;
  }
  return top;
}



//function to render projects from the project_id passed as a get variable
function renderRecProject(project_id) {

  var url = '?';
  var pars = "CoMeT_function=run_module&module=ModProjects&function=render_project&project_id=" + project_id;

  var myAjax = new Ajax.Request(
    url,
    {
      method: 'post',
      postBody: pars,
      encoding: 'ISO-8859-1',
      onComplete: renderRecProjectResponse
    });
}

function renderRecProjectResponse(resp) {

  var top = getAbsoluteTop($('content_container'));

  $('project_details').style.top = top - 20 + "px";
  $('project_details').innerHTML = resp.responseText;
  $('project_details').setStyle({ display: 'block' });
}



//function to render staff from the staff_id passed as a get variable
function renderRecStaff(staff_id) {

  var url = '?';
  var pars = "CoMeT_function=run_module&module=ModStaff&function=render_staff&staff_id=" + staff_id;

  var myAjax = new Ajax.Request(
    url,
    {
      method: 'post',
      postBody: pars,
      encoding: 'ISO-8859-1',
      onComplete: renderRecStaffResponse
    });
}

function renderRecStaffResponse(resp) {

  var top = getAbsoluteTop($('content_container'));

  $('staff_details').style.top = top - 20 + "px";
  $('staff_details').innerHTML = resp.responseText;
  $('staff_details').setStyle({ display: 'block' });
}
