check whether tidy commands exist before defining them (prevents warnings).
Set tab size to 2 for Javascript and fixed the whitespace removal for javascript on save