var url = "http://"+document.domain+"/p.php";

// example registering simple callback function for messages
php.messages.myCallBack = function (msg, params){
    alert ("My messages CallBack func: " + msg);
}

// example registering simple callback function for errors
php.errors.myCallBack = function (msg, params){
    alert ("My errors CallBack func: " + msg);
}

// example registering simple callback function for data
php.data.myCallBack = function (key, value){
    alert ("My data CallBack func: " + key +" = " + value);
}


formAjax = function () {
    $.php(url, $('form#form').formToArray(true));
    return false;
    
    // do an ajax post request
    $.ajax({
       // AJAX-specified URL
       url: url,
       // JSON
       type: "POST",
       data: $('form#form').formToArray(true),
       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);
       }
    });
    return false;
    
}

php.beforeSend = function (){
$('#loading').slideDown('fast');
}

php.complete = function (){ 
$('#loading').slideUp('slow');
}

$(window).ready(function(){
    $(document).bind("contextmenu",function(e){
        return false;
    });
});
