Javascript inheritance tool