Start of javascript handling