added working switch jscript