var ObjectUtils = {
	
	// Detector Explorer
	isIE: '\v'=='v',
	
	// Cadena aleatoria
	randomStr : function(length){
		var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
		var pass = "";
		for(var x=0; x<length; x++){
			var i = Math.floor(Math.random() * 62);
			pass += chars.charAt(i);
		}
		return pass;
	},
	
	// Herencia simple
	extend: function(subClass, superClass){
		var F = function(){
		};
		F.prototype = superClass.prototype;
		subClass.prototype = new F();
		subClass.prototype.constructor = subClass;
		
		subClass.superclass = superClass.prototype;
		if (superClass.prototype.constructor == Object.prototype.constructor) {
			superClass.prototype.constructor = superClass;
		}
	},
	
	// Duplicar objetos (útil para herencia prototipada)
	clone: function(object){
		function F() {}
		F.prototype = object;
		return new F;
	},
	
	// Tipado estricto
	// TODO: hacer que haya posibilidad de que algunos argumentos sean no obligatorios... y si no lo son que se inicialicen a sus valores por defecto, ¿no?
	strict: function(types, args){
		if (types.length != args.length){
			throw "Número incorrecto de argumentos. Se esperaban " + types.length +", se recogieron " + args.length;
		}
		for (var i=0; i<args.length; i++){
			if (args[i].constructor != types[i]){
				throw "Tipo erróneo en el argumento ("+ (i+1) +"). Se esperaba "+ types[i].name +" y se ha recibido "+ args[i].constructor.name;
			}
		}
	}
}