Update 'extend' function.

Replace the extend function with one that does a genuine deep copy (copied from JQuery). The extend function no longer overwrites / links values in the source objects.
This fixes the problems reported in issue https://github.com/BlueSpire/Weyland/issues/3.