Added thumbnail directive. Changes in template files. Minor js changes.