B
A
Javascript taken from
www.switchonthecode.com