Some simple javascript snippets