Object.prototype.extend = function(obj) {
	var f = function(){};
	f.prototype = Object(obj.prototype);
	this.prototype = new f();
}

function Creature(age) {
	this.age = age;
}

/*= class Person =*/
Person.extend(Creature);
function Person(name, age) {
	Creature.call(this, typeof age == "undefined" ? 10 : age);
	this.name = name; 
	return this; 
}

Person.prototype.say = function(message) { 
	alert(this.name + ": " + message);
};

/*= class Guy =*/
Guy.extend(Person);
function Guy(name) {
	Person.call(this,name, 25);
};

Guy.prototype.say = function(message) {
	alert(this.name + " grunts: " + message);
}

/*= class Girl =*/
Girl.extend(Person)
function Girl(name) {
	Person.call(this,name, 18);
};

Girl.prototype.say = function(message) {
	alert(this.name + " giggles: " + message);
	Person.prototype.say.call(this,"But a person would say '" + message + "'");
}

/*= redefining Person =*/
Person.prototype.say = function(message) { 
	alert(this.name + " says: " + message + " (Age: " + this.age + ")"); 
}

/*= class It =*/
It.extend(Person);
function It(name) {
	Person.call(this, name);
}

new Person("Tracy").say("Hello");
new Guy("Tim").say("Hello There");
new Girl("Tina").say("Hi");
new It("cousin").say("Hmph");