Logic gates simulation in html5