jQuery.extend({
    php: function (params) {
        // do an ajax post request
        $.ajax({
           // AJAX-specified URL
           url: "http://www.open-sustainability.org/common/ajax/jquery.php",
           // JSON
           type: "POST",
           data: params,
           dataType : "json",
           
           /* Handlers */
           
           // Handle the beforeSend event
           beforeSend: function(){
               return php.beforeSend();
           },
           // Handle the success event
           success: function(data, textStatus){
               return php.success(data, textStatus);
           },
           // Handle the error event
           error: function (xmlEr, typeEr, except) {
               return php.error(xmlEr, typeEr, except);                  
           },
           // Handle the complete event
           complete: function (XMLHttpRequest, textStatus) {              
               return php.complete(XMLHttpRequest, textStatus);
           }
        })
    }
});


php.messages.myCallBack = function (msg, params){
    alert ("Message: " + msg);
}

php.errors.myCallBack = function (msg, params){
    alert ("Error: " + msg);
}