Corrected javascript errors (elseif, ...)