//	-----   feel free to use this stuff   ---   play with it   ---   copy as You  like   -----
//	-----   but leave this authors 2 lines untouched:   pseliger@gmx.net  [july 2003]    -----
//
//  extended javascript-api-methods     :
//  * jsApi-extension-name / file-name  : "jsApi.ObjectArray.clone.js"
//  * original download-location        : "http://www.pseliger.de/jsExtendedApi/jsApi.ObjectArray.clone.js"
//
//  last revision       :  july 08-2003 - still not happy - new code starting from the scratch with 771 bytes;
//                                      - further revisions ? we will se;
//  fifth revision      :  june 17-2003 - there was still a tiny bit of tuning to do according to size
//                                        and performance of the code  -  no further revision planned;
//                                      - the pure js-code comes with 1.260 bytes;
//	fourth revision     :   may 25-2003 - "Object.getConstructorName()" is now part of package "jsApi.ObjectArray.getScanLog.js";
//	third revision      :   may 15-2003
//	second revision     : april 28-2003
//	first revision      : april 23-2003
//	first public release: april 17-2003 - clones every build-in-js-object regardless of its level of complexity;
//
//netscape navigator 4.x only:
//Object.prototype.clone=function(){if(typeof(this)!="object"){return this;}var cloneDepth=((arguments.length>=1)?((isNaN(+(arguments[0])))?(null):(+(arguments[0]))):(null));if(cloneDepth){cloneDepth=((cloneDepth<=0)?(null):(cloneDepth));}var cloneObject=new Object();cloneObject.constructor=this.constructor;cloneObject.prototype=this.constructor.prototype;for(var i in this){if(!cloneObject.prototype[i]){if(typeof this[i]=="object"){if(this[i]===null){cloneObject[i]=null;}else{if(cloneDepth){if(cloneDepth==1){cloneObject[i]=null;}else{cloneObject[i]=this[i].clone(--cloneDepth);}}else{cloneObject[i]=this[i].clone();}}}else{cloneObject[i]=this[i];}}}return cloneObject;};
//Object.prototype.clone = function(){if(typeof(this)!="object"){return this;}var cloneDepth=((arguments.length>=1)?((isNaN(+(arguments[0])))?(null):(+(arguments[0]))):(null));if(cloneDepth){cloneDepth=((cloneDepth<=0)?(null):(cloneDepth));}try{var cloneObject=new this.constructor;cloneObject.prototype=new this.constructor;}catch(exception){var cloneObject=new Object();cloneObject.constructor=this.constructor;cloneObject.prototype=this.constructor.prototype;cloneObject.cloneException=exception;}for(i in this){if(!cloneObject.prototype[i]){if(typeof this[i]=="object"){if(this[i]===null){cloneObject[i]=null;}else{if(cloneDepth){if(cloneDepth==1){cloneObject[i]=null;}else{cloneObject[i]=this[i].clone(--cloneDepth);}}else{cloneObject[i]=this[i].clone();}}}else{cloneObject[i]=this[i];}}}return cloneObject;};

//netscape navigator 4.x only:
//Object.prototype.clone=function(){if(typeof(this)!="object"){return this;}var cloneDepth=((arguments.length>=1)?((isNaN(parseInt(arguments[0])))?(null):(parseInt(arguments[0]))):(null));if(cloneDepth){cloneDepth=((cloneDepth<=0)?(null):(cloneDepth));}var cloneObject=null;var thisConstructor=this.constructor;var thisConstructorPrototype=thisConstructor.prototype;if(thisConstructor==Array){cloneObject=new Array();}else if(thisConstructor==Object){cloneObject=new Object();}else{cloneObject=new Object();cloneObject.constructor=thisConstructor;cloneObject.prototype=thisConstructorPrototype;}var propertyName="";var newObject=null;for(propertyName in this){newObject=this[propertyName];if(!thisConstructorPrototype[propertyName]){if(typeof(newObject)=="object"){if(newObject===null){cloneObject[propertyName]=null;}else{if(cloneDepth){if(cloneDepth==1){cloneObject[propertyName]=null;}else{cloneObject[propertyName]=newObject.clone(--cloneDepth);}}else{cloneObject[propertyName]=newObject.clone();}}}else{cloneObject[propertyName]=newObject;}}}return cloneObject;};
Object.prototype.clone = function(){if(typeof(this)!="object"){return this;}var cloneDepth=((arguments.length>=1)?((isNaN(parseInt(arguments[0])))?(null):(parseInt(arguments[0]))):(null));if(cloneDepth){cloneDepth=((cloneDepth<=0)?(null):(cloneDepth));}var cloneObject=null;var thisConstructor=this.constructor;var thisConstructorPrototype=thisConstructor.prototype;if(thisConstructor==Array){cloneObject=new Array();}else if(thisConstructor==Object){cloneObject=new Object();}else{try{cloneObject=new thisConstructor;}catch(exception){cloneObject=new Object();cloneObject.constructor=thisConstructor;cloneObject.prototype=thisConstructorPrototype;}}var propertyName="";var newObject=null;for(propertyName in this){newObject=this[propertyName];if(!thisConstructorPrototype[propertyName]){if(typeof(newObject)=="object"){if(newObject===null){cloneObject[propertyName]=null;}else{if(cloneDepth){if(cloneDepth==1){cloneObject[propertyName]=null;}else{cloneObject[propertyName]=newObject.clone(--cloneDepth);}}else{cloneObject[propertyName]=newObject.clone();}}}else{cloneObject[propertyName]=newObject;}}}return cloneObject;};
