main javascript

with all function