function php(func,target,opts)
{
  php_ajax_file = '/php_ajax.php';
   
  detopts = '';
  if (opts) {
    if ( jQuery(opts).is('form') ) {
      detopts = $(opts).serialize();
    } else {
      detopts = opts;
    }
  }
  qstring='func='+func+'&opts='+escape(detopts);

  $("*").css("cursor", "wait");
  if ('NULL' != target) {
    var keeptarget = $(target).html();
    $(target).html($('#loadimg').html());
  }

  $.ajax({
    async: false,
    type: 'POST',
    url: php_ajax_file,
    data: qstring,
    success: function(data) {
      if ( 'arg_func_required' == data ) alert("Argument 'func' manquant");
      else if ( 'func_not_exist' == data ) alert("Fonction php 'ajax_"+func+"' inexistante");
      else
      {
        if ( 'FALSE' == data ) {
          if ( 'NULL' != target ) {
            $(target).html(keeptarget);
          }
          return false;
        }
        if ( 'NULL' != target ) {
          $(target).html(data);
        }
        php_hooks(func,target,opts,data);
      }
      $("*").css("cursor", "");
    }
  });
}
   
function php_hooks(func,target,opts,data)
{
  if ( 'badclient' == data ) {
    document.location.href="/pro_logout.php";
    return false;
  }
  if ( 'pro_update_cart' == func ) {
    $('div#pro_bdc_resultat_recherche').html('');
  } else
  if (( 'div#pro_bdc_resultat_recherche' == target ) || ('div#pro_bdc_panier' == target)) {
    PEPS.rollover.init();
  }
}


