// Inheritance 

Object.prototype.extend = function(vSuper) {
	oSuper = (typeof(vSuper) == 'string') ? eval('new '+vSuper+'()') : vSuper; 
	for (sProperty in oSuper) { 
		this[sProperty] = oSuper[sProperty]; 
	} 
	delete(oSuper); 
}; 

// Add a method
Object.prototype.method = function(name, func){
	this.prototype[name] = func;
  return this;
}

// Add a property, getter, and setter
Object.prototype.addProperty = function (sType, sName, vValue) { 
	if (sType != '' && sType != null && typeof(vValue) != sType) { 
		alert('Property ' + sName + ' must be of type ' + sType + ', was ' + typeof(vValue) + '.'); 
	} 

	this[sName] = vValue; 
  
	var sFuncName = sName.charAt(0).toUpperCase() + sName.substring(1, sName.length); 

	this['get' + sFuncName] = function () { return this[sName] }; 
	this['set' + sFuncName] = function (vNewValue) { 
		if (sType != '' && sType != null && typeof(vNewValue) != sType) { 
			alert('Property ' + sName + ' must be of type ' + sType + ', was ' + typeof(vValue) + '.'); 
		} 
		this[sName] = vNewValue; 
	};
}
