Only rebuild plain object when merging options

In my use case, I have a bunch of javascript to manage Highcharts charts and options. And that bunch of javascript store data and behaviours in the options of the charts. Some of these data are instances of javascript "classes".
This used to work fine with Highcharts 2.2. I have tried to upgrade to Highcharts 3; my custom data are rebuild in plain objects, which then break my js code.
So here is the suggested patch which doesn't rebuild class instances. It is based on the isPlainObject from jQuery (which is used by jQuery.extend).