/**
 * Send post requests to the api request.php page
 * which controls the incoming command and returns the
 * correct data.
 * 
 * Requires jquery.js
 */
function requestAPI(data, callback, area, format)
{
	if('undefined' == format) {
		format		=	'html';
	}

    switch(area) {
    case 'admin':
      $.post('../../../api/request.php', data, callback, format); // files in modules directory
      break;
    case 'admin_customised':
      $.post('../../../api/request.php?scope=customised', data, callback, format); // files in modules directory
      break;
    case 'public':
      $.post('diy/api/request.php', data, callback, format); //TODO: Make dynamic somehow - currently won't work with pages that are not on the root
      break;
    case 'public_customised':
      $.post('diy/api/request.php?scope=customised', data, callback, format); // public custom modules
      break;
    case 'help':
      $.post('../../../api/request.php?scope=global', data, callback, format); // does this work?
      break;
    case 'global':
      $.post('../../api/request.php?scope=global', data, callback, format); // files not in modules directory
      break;
    }
}
