var clone = function (type) {
var o;
var typeA = typeof type;
switch (typeA){
case 'string':
o = typeA+'';
break;
case 'number':
o = typeA-0;
break;
case 'undefined':
break;
case 'boolean':
o = typeA;
break;
case 'object':
if(type===null){
o = null;
}else {
if(Object.prototype.toString.call(type).slice(8,-1)==='Array'){
o = [];
for(var i = 0;i<type.length;i++){
o.push(clone(type[i]));
}
}else {
o = {};
for(var key in type){
o[key] = clone(type[key]);
}
}
}
break;
default:
break;
}
return o;
};