Tips for Writing Good JavaScript Code
•Add comments to your code to document the purpose of each script •Initialize all variables at the top of your script and insert comments describing the purpose and nature of your variables •Create customized functions that can be reused in different scripts.  Place your customized functions in external files to make them available to your entire Web site