function clone(obj) {
        if (obj === null || typeof(obj) != 'object')
            return obj;

        var temp = obj.constructor(); // changed

        for (var key in obj)
            temp[key] = clone(obj[key]);
        return temp;
    }
@
#Crafty.clone
@category Core
@sign public Object .clone(Object obj)
@param obj - an object

Deep copy (a.k.a clone) of an object.