imagine_cms 3.0.0.beta6 → 3.0.0.beta7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (278) hide show
  1. data/README.rdoc +1 -1
  2. data/app/assets/images/codepress/line-numbers.png +0 -0
  3. data/app/assets/images/cropper/marqueeHoriz.gif +0 -0
  4. data/app/assets/images/cropper/marqueeVert.gif +0 -0
  5. data/app/assets/images/management/btn_add.gif +0 -0
  6. data/app/assets/images/management/btn_archive.gif +0 -0
  7. data/app/assets/images/management/btn_delete.gif +0 -0
  8. data/app/assets/images/management/btn_duplicate.gif +0 -0
  9. data/app/assets/images/management/btn_edit.gif +0 -0
  10. data/app/assets/images/management/btn_help.gif +0 -0
  11. data/app/assets/images/management/btn_new_page.gif +0 -0
  12. data/app/assets/images/management/btn_preview.gif +0 -0
  13. data/app/assets/images/management/btn_properties.gif +0 -0
  14. data/app/assets/images/management/btn_restore.gif +0 -0
  15. data/app/assets/images/management/btn_top_delete.gif +0 -0
  16. data/app/assets/images/management/btn_top_duplicate.gif +0 -0
  17. data/app/assets/images/management/btn_top_edit.gif +0 -0
  18. data/app/assets/images/management/btn_top_new.gif +0 -0
  19. data/app/assets/images/management/btn_top_preview.gif +0 -0
  20. data/app/assets/images/management/btn_top_properties.gif +0 -0
  21. data/app/assets/{manage → images/management}/bullet.gif +0 -0
  22. data/app/assets/images/management/cvv2_graphic.gif +0 -0
  23. data/app/assets/images/management/error.gif +0 -0
  24. data/app/assets/images/management/gallery_index.gif +0 -0
  25. data/app/assets/images/management/gallery_preview_overlay.png +0 -0
  26. data/app/assets/images/management/gallery_small_drag_overlay.png +0 -0
  27. data/app/assets/images/management/gallery_small_overlay.png +0 -0
  28. data/app/assets/images/management/gallery_sort.gif +0 -0
  29. data/app/assets/images/management/icon_download.gif +0 -0
  30. data/app/assets/images/management/icon_locked.png +0 -0
  31. data/app/assets/images/management/icon_page.gif +0 -0
  32. data/app/assets/images/management/icon_time.gif +0 -0
  33. data/app/assets/images/management/icon_unlocked.png +0 -0
  34. data/app/assets/images/management/page_loading.gif +0 -0
  35. data/app/assets/{manage → images/management}/start.gif +0 -0
  36. data/app/assets/images/management/vcard.gif +0 -0
  37. data/app/assets/javascripts/builder.js +101 -0
  38. data/app/assets/javascripts/codepress/codepress.html +36 -0
  39. data/app/assets/javascripts/codepress/codepress.js +130 -0
  40. data/app/assets/javascripts/codepress/engines/gecko.js +240 -0
  41. data/{vendor/gems/acts_as_tree/test/abstract_unit.rb → app/assets/javascripts/codepress/engines/khtml.js} +0 -0
  42. data/app/assets/javascripts/codepress/engines/msie.js +263 -0
  43. data/{vendor/gems/acts_as_tree/test/database.yml → app/assets/javascripts/codepress/engines/older.js} +0 -0
  44. data/app/assets/javascripts/codepress/engines/opera.js +259 -0
  45. data/app/assets/javascripts/codepress/languages/css.js +23 -0
  46. data/app/assets/javascripts/codepress/languages/generic.js +25 -0
  47. data/app/assets/javascripts/codepress/languages/html.js +63 -0
  48. data/app/assets/javascripts/codepress/languages/java.js +24 -0
  49. data/app/assets/javascripts/codepress/languages/javascript.js +30 -0
  50. data/app/assets/javascripts/codepress/languages/perl.js +27 -0
  51. data/app/assets/javascripts/codepress/languages/php.js +60 -0
  52. data/app/assets/javascripts/codepress/languages/ruby.js +26 -0
  53. data/app/assets/javascripts/codepress/languages/sql.js +30 -0
  54. data/app/assets/javascripts/codepress/languages/text.js +9 -0
  55. data/app/assets/javascripts/cropper.js +568 -0
  56. data/app/assets/javascripts/dojo/dojo.js +14155 -0
  57. data/app/assets/javascripts/dojo/src/html/images/shadowB.png +0 -0
  58. data/app/assets/javascripts/dojo/src/html/images/shadowBL.png +0 -0
  59. data/app/assets/javascripts/dojo/src/html/images/shadowBR.png +0 -0
  60. data/app/assets/javascripts/dojo/src/html/images/shadowL.png +0 -0
  61. data/app/assets/javascripts/dojo/src/html/images/shadowR.png +0 -0
  62. data/app/assets/javascripts/dojo/src/html/images/shadowT.png +0 -0
  63. data/app/assets/javascripts/dojo/src/html/images/shadowTL.png +0 -0
  64. data/app/assets/javascripts/dojo/src/html/images/shadowTR.png +0 -0
  65. data/app/assets/javascripts/dojo/src/widget/templates/Editor2/showtableborder_gecko.css +19 -0
  66. data/app/assets/javascripts/dojo/src/widget/templates/HslColorPicker.svg +30 -0
  67. data/app/assets/javascripts/dojo/src/widget/templates/buttons/aggregate.gif +0 -0
  68. data/app/assets/javascripts/dojo/src/widget/templates/buttons/aggregate.psd +0 -0
  69. data/app/assets/javascripts/dojo/src/widget/templates/buttons/backcolor.gif +0 -0
  70. data/app/assets/javascripts/dojo/src/widget/templates/buttons/bg-fade.png +0 -0
  71. data/app/assets/javascripts/dojo/src/widget/templates/buttons/bold.gif +0 -0
  72. data/app/assets/javascripts/dojo/src/widget/templates/buttons/cancel.gif +0 -0
  73. data/app/assets/javascripts/dojo/src/widget/templates/buttons/copy.gif +0 -0
  74. data/app/assets/javascripts/dojo/src/widget/templates/buttons/createlink.gif +0 -0
  75. data/app/assets/javascripts/dojo/src/widget/templates/buttons/cut.gif +0 -0
  76. data/app/assets/javascripts/dojo/src/widget/templates/buttons/delete.gif +0 -0
  77. data/app/assets/javascripts/dojo/src/widget/templates/buttons/forecolor.gif +0 -0
  78. data/app/assets/javascripts/dojo/src/widget/templates/buttons/hilitecolor.gif +0 -0
  79. data/app/assets/javascripts/dojo/src/widget/templates/buttons/indent.gif +0 -0
  80. data/app/assets/javascripts/dojo/src/widget/templates/buttons/inserthorizontalrule.gif +0 -0
  81. data/app/assets/javascripts/dojo/src/widget/templates/buttons/insertimage.gif +0 -0
  82. data/app/assets/javascripts/dojo/src/widget/templates/buttons/insertorderedlist.gif +0 -0
  83. data/app/assets/javascripts/dojo/src/widget/templates/buttons/inserttable.gif +0 -0
  84. data/app/assets/javascripts/dojo/src/widget/templates/buttons/insertunorderedlist.gif +0 -0
  85. data/app/assets/javascripts/dojo/src/widget/templates/buttons/italic.gif +0 -0
  86. data/app/assets/javascripts/dojo/src/widget/templates/buttons/justifycenter.gif +0 -0
  87. data/app/assets/javascripts/dojo/src/widget/templates/buttons/justifyfull.gif +0 -0
  88. data/app/assets/javascripts/dojo/src/widget/templates/buttons/justifyleft.gif +0 -0
  89. data/app/assets/javascripts/dojo/src/widget/templates/buttons/justifyright.gif +0 -0
  90. data/app/assets/javascripts/dojo/src/widget/templates/buttons/left_to_right.gif +0 -0
  91. data/app/assets/javascripts/dojo/src/widget/templates/buttons/list_bullet_indent.gif +0 -0
  92. data/app/assets/javascripts/dojo/src/widget/templates/buttons/list_bullet_outdent.gif +0 -0
  93. data/app/assets/javascripts/dojo/src/widget/templates/buttons/list_num_indent.gif +0 -0
  94. data/app/assets/javascripts/dojo/src/widget/templates/buttons/list_num_outdent.gif +0 -0
  95. data/app/assets/javascripts/dojo/src/widget/templates/buttons/outdent.gif +0 -0
  96. data/app/assets/javascripts/dojo/src/widget/templates/buttons/paste.gif +0 -0
  97. data/app/assets/javascripts/dojo/src/widget/templates/buttons/redo.gif +0 -0
  98. data/app/assets/javascripts/dojo/src/widget/templates/buttons/removeformat.gif +0 -0
  99. data/app/assets/javascripts/dojo/src/widget/templates/buttons/right_to_left.gif +0 -0
  100. data/app/assets/javascripts/dojo/src/widget/templates/buttons/save.gif +0 -0
  101. data/app/assets/javascripts/dojo/src/widget/templates/buttons/sep.gif +0 -0
  102. data/app/assets/javascripts/dojo/src/widget/templates/buttons/space.gif +0 -0
  103. data/app/assets/javascripts/dojo/src/widget/templates/buttons/strikethrough.gif +0 -0
  104. data/app/assets/javascripts/dojo/src/widget/templates/buttons/subscript.gif +0 -0
  105. data/app/assets/javascripts/dojo/src/widget/templates/buttons/superscript.gif +0 -0
  106. data/app/assets/javascripts/dojo/src/widget/templates/buttons/underline.gif +0 -0
  107. data/app/assets/javascripts/dojo/src/widget/templates/buttons/undo.gif +0 -0
  108. data/app/assets/javascripts/dojo/src/widget/templates/buttons/wikiword.gif +0 -0
  109. data/app/assets/javascripts/dojo/src/widget/templates/check.gif +0 -0
  110. data/app/assets/javascripts/dojo/src/widget/templates/decrementMonth.gif +0 -0
  111. data/app/assets/javascripts/dojo/src/widget/templates/decrementWeek.gif +0 -0
  112. data/app/assets/javascripts/dojo/src/widget/templates/grabCorner.gif +0 -0
  113. data/app/assets/javascripts/dojo/src/widget/templates/images/floatingPaneClose.gif +0 -0
  114. data/app/assets/javascripts/dojo/src/widget/templates/images/soriaAccordionOff.gif +0 -0
  115. data/app/assets/javascripts/dojo/src/widget/templates/images/soriaAccordionSelected.gif +0 -0
  116. data/app/assets/javascripts/dojo/src/widget/templates/images/soriaActive-c.gif +0 -0
  117. data/app/assets/javascripts/dojo/src/widget/templates/images/soriaActive-l.gif +0 -0
  118. data/app/assets/javascripts/dojo/src/widget/templates/images/soriaActive-r.gif +0 -0
  119. data/app/assets/javascripts/dojo/src/widget/templates/images/soriaBarBg.gif +0 -0
  120. data/app/assets/javascripts/dojo/src/widget/templates/images/soriaButton-c.gif +0 -0
  121. data/app/assets/javascripts/dojo/src/widget/templates/images/soriaButton-l.gif +0 -0
  122. data/app/assets/javascripts/dojo/src/widget/templates/images/soriaButton-r.gif +0 -0
  123. data/app/assets/javascripts/dojo/src/widget/templates/images/soriaDisabled-c.gif +0 -0
  124. data/app/assets/javascripts/dojo/src/widget/templates/images/soriaDisabled-l.gif +0 -0
  125. data/app/assets/javascripts/dojo/src/widget/templates/images/soriaDisabled-r.gif +0 -0
  126. data/app/assets/javascripts/dojo/src/widget/templates/images/soriaMenuBg.gif +0 -0
  127. data/app/assets/javascripts/dojo/src/widget/templates/images/soriaPressed-c.gif +0 -0
  128. data/app/assets/javascripts/dojo/src/widget/templates/images/soriaPressed-l.gif +0 -0
  129. data/app/assets/javascripts/dojo/src/widget/templates/images/soriaPressed-r.gif +0 -0
  130. data/app/assets/javascripts/dojo/src/widget/templates/images/tab_close.gif +0 -0
  131. data/app/assets/javascripts/dojo/src/widget/templates/images/toolbar-bg.gif +0 -0
  132. data/app/assets/javascripts/dojo/src/widget/templates/incrementMonth.gif +0 -0
  133. data/app/assets/javascripts/dojo/src/widget/templates/incrementWeek.gif +0 -0
  134. data/app/assets/javascripts/dojo/src/widget/templates/richtextframe.html +24 -0
  135. data/app/assets/javascripts/imagine.js +1385 -0
  136. data/app/assets/javascripts/jquery_no_conflict.js +9405 -0
  137. data/app/assets/stylesheets/codepress/codepress.css +7 -0
  138. data/app/assets/stylesheets/codepress/languages/css.css +10 -0
  139. data/app/assets/stylesheets/codepress/languages/generic.css +9 -0
  140. data/app/assets/stylesheets/codepress/languages/html.css +18 -0
  141. data/app/assets/stylesheets/codepress/languages/java.css +7 -0
  142. data/app/assets/stylesheets/codepress/languages/javascript.css +8 -0
  143. data/app/assets/stylesheets/codepress/languages/perl.css +11 -0
  144. data/app/assets/stylesheets/codepress/languages/php.css +12 -0
  145. data/app/assets/stylesheets/codepress/languages/ruby.css +10 -0
  146. data/app/assets/stylesheets/codepress/languages/sql.css +10 -0
  147. data/app/assets/stylesheets/codepress/languages/text.css +5 -0
  148. data/app/assets/stylesheets/cropper.css +182 -0
  149. data/app/assets/stylesheets/management.css +96 -0
  150. data/app/assets/stylesheets/reset.css +58 -0
  151. data/app/controllers/cms/content_controller.rb +318 -2
  152. data/app/controllers/management/cms_controller.rb +1669 -0
  153. data/app/controllers/management/user_controller.rb +4 -4
  154. data/app/controllers/management/users_controller.rb +18 -4
  155. data/app/controllers/util_controller.rb +45 -0
  156. data/app/helpers/cms_application_helper.rb +662 -15
  157. data/app/models/cms_content_sweeper.rb +21 -0
  158. data/app/models/cms_page.rb +126 -0
  159. data/app/models/cms_page_object.rb +23 -0
  160. data/app/models/cms_page_tag.rb +5 -0
  161. data/app/models/cms_page_version.rb +3 -0
  162. data/app/models/cms_snippet.rb +16 -0
  163. data/app/models/cms_template.rb +29 -0
  164. data/app/models/user.rb +6 -3
  165. data/app/views/management/cms/_complete_gallery.html.erb +5 -0
  166. data/app/views/management/cms/_create_file_link.html.erb +21 -0
  167. data/app/views/management/cms/_crop_feature_image.html.erb +188 -0
  168. data/app/views/management/cms/_crop_image.html.erb +188 -0
  169. data/app/views/management/cms/_crop_results.html.erb +1 -0
  170. data/app/views/management/cms/_crop_results_feature_image.html.erb +1 -0
  171. data/app/views/management/cms/_crop_results_thumb.html.erb +1 -0
  172. data/app/views/management/cms/_crop_thumb.html.erb +188 -0
  173. data/app/views/management/cms/_dialogs.html.erb +39 -0
  174. data/app/views/management/cms/_edit_page.html.erb +176 -0
  175. data/app/views/management/cms/_gallery_index.html.erb +10 -0
  176. data/app/views/management/cms/_gallery_setup.html.erb +22 -0
  177. data/app/views/management/cms/_image.html.erb +3 -0
  178. data/app/views/management/cms/_image_details.html.erb +26 -0
  179. data/app/views/management/cms/_image_draggable.html.erb +4 -0
  180. data/app/views/management/cms/_list_page.html.erb +8 -0
  181. data/app/views/management/cms/_list_page_select.html.erb +8 -0
  182. data/app/views/management/cms/_list_pages.html.erb +1 -0
  183. data/app/views/management/cms/_list_pages_select.html.erb +1 -0
  184. data/app/views/management/cms/_page_attribute.html.erb +6 -0
  185. data/app/views/management/cms/_page_list.html.erb +171 -0
  186. data/app/views/management/cms/_page_list_source_folder.html.erb +20 -0
  187. data/app/views/management/cms/_page_list_source_tag.html.erb +18 -0
  188. data/app/views/management/cms/_select_gallery.html.erb +117 -0
  189. data/app/views/management/cms/_snippet.html.erb +3 -0
  190. data/app/views/management/cms/_sort_images.html.erb +15 -0
  191. data/app/views/management/cms/_temp.html.erb +3 -0
  192. data/app/views/management/cms/_template_options.html.erb +21 -0
  193. data/app/views/management/cms/_template_reference.html.erb +42 -0
  194. data/app/views/management/cms/_upload_feature_image.html.erb +35 -0
  195. data/app/views/management/cms/_upload_file.html.erb +31 -0
  196. data/app/views/management/cms/_upload_image.html.erb +74 -0
  197. data/app/views/management/cms/_upload_thumb.html.erb +35 -0
  198. data/app/views/management/cms/edit_master.html.erb +48 -0
  199. data/app/views/management/cms/edit_page_content.html.erb +4 -0
  200. data/app/views/management/cms/edit_snippet.html.erb +47 -0
  201. data/app/views/management/cms/edit_template.html.erb +48 -0
  202. data/app/views/management/cms/gallery_management.html.erb +108 -0
  203. data/app/views/management/cms/index.html.erb +20 -0
  204. data/app/views/management/cms/page_tags_for_lookup.html.erb +5 -0
  205. data/app/views/management/cms/pages.html.erb +99 -0
  206. data/app/views/management/cms/permission_denied.html.erb +1 -0
  207. data/app/views/management/cms/select_page.html.erb +57 -0
  208. data/app/views/management/cms/snippets.html.erb +14 -0
  209. data/app/views/management/cms/templates.html.erb +14 -0
  210. data/app/views/management/cms/toolbar_edit.html.erb +269 -0
  211. data/app/views/management/cms/toolbar_preview.html.erb +109 -0
  212. data/app/views/util/_calendar_days.html.erb +72 -0
  213. data/app/views/util/_calendar_month_year.html.erb +1 -0
  214. data/app/views/util/_date_picker.html.erb +56 -0
  215. data/app/views/util/_message.html.erb +1 -0
  216. data/app/views/util/_show_message.js.erb +6 -0
  217. data/app/views/util/_tab.html.erb +4 -0
  218. data/config/routes.rb +4 -1
  219. data/imagine_cms.gemspec +4 -0
  220. data/{vendor/gems → lib}/acts_as_versioned/.document +0 -0
  221. data/{vendor/gems → lib}/acts_as_versioned/.gitignore +2 -0
  222. data/{vendor/gems → lib}/acts_as_versioned/CHANGELOG +0 -0
  223. data/lib/acts_as_versioned/Gemfile +7 -0
  224. data/{vendor/gems → lib}/acts_as_versioned/MIT-LICENSE +0 -0
  225. data/{vendor/gems → lib}/acts_as_versioned/README +0 -0
  226. data/{vendor/gems → lib}/acts_as_versioned/RUNNING_UNIT_TESTS +0 -0
  227. data/{vendor/gems → lib}/acts_as_versioned/Rakefile +1 -1
  228. data/{vendor/gems → lib}/acts_as_versioned/acts_as_versioned.gemspec +4 -4
  229. data/{vendor/gems → lib}/acts_as_versioned/init.rb +0 -0
  230. data/{vendor/gems → lib}/acts_as_versioned/lib/acts_as_versioned.rb +109 -107
  231. data/{vendor/gems → lib}/acts_as_versioned/test/abstract_unit.rb +0 -0
  232. data/{vendor/gems → lib}/acts_as_versioned/test/database.yml +0 -0
  233. data/{vendor/gems → lib}/acts_as_versioned/test/fixtures/authors.yml +0 -0
  234. data/{vendor/gems → lib}/acts_as_versioned/test/fixtures/landmark.rb +0 -0
  235. data/{vendor/gems → lib}/acts_as_versioned/test/fixtures/landmark_versions.yml +0 -0
  236. data/{vendor/gems → lib}/acts_as_versioned/test/fixtures/landmarks.yml +0 -0
  237. data/{vendor/gems → lib}/acts_as_versioned/test/fixtures/locked_pages.yml +0 -0
  238. data/{vendor/gems → lib}/acts_as_versioned/test/fixtures/locked_pages_revisions.yml +0 -0
  239. data/{vendor/gems/acts_as_versioned/test/fixtures/migrations/1_add_versioned_tables.rb → lib/acts_as_versioned/test/fixtures/migrations/2_add_versioned_tables.rb} +0 -0
  240. data/{vendor/gems → lib}/acts_as_versioned/test/fixtures/page.rb +0 -0
  241. data/{vendor/gems → lib}/acts_as_versioned/test/fixtures/page_versions.yml +0 -0
  242. data/{vendor/gems → lib}/acts_as_versioned/test/fixtures/pages.yml +0 -0
  243. data/{vendor/gems → lib}/acts_as_versioned/test/fixtures/widget.rb +0 -0
  244. data/{vendor/gems → lib}/acts_as_versioned/test/migration_test.rb +0 -1
  245. data/{vendor/gems → lib}/acts_as_versioned/test/schema.rb +0 -0
  246. data/{vendor/gems → lib}/acts_as_versioned/test/versioned_test.rb +0 -0
  247. data/lib/extensions/action_controller.rb +154 -143
  248. data/lib/imagine_cms/engine.rb +33 -12
  249. data/lib/imagine_cms/version.rb +1 -1
  250. data/lib/imagine_cms.rb +30 -6
  251. data/lib/prototype_legacy_helper/README.markdown +13 -0
  252. data/lib/prototype_legacy_helper/init.rb +1 -0
  253. data/lib/prototype_legacy_helper/lib/prototype_legacy_helper.rb +430 -0
  254. data/lib/prototype_legacy_helper/test/test_prototype_helper.rb +297 -0
  255. data/lib/upload_progress/CHANGELOG +5 -0
  256. data/lib/upload_progress/MIT-LICENSE +20 -0
  257. data/lib/upload_progress/README +45 -0
  258. data/{vendor/gems/acts_as_tree → lib/upload_progress}/Rakefile +6 -5
  259. data/lib/upload_progress/init.rb +7 -0
  260. data/lib/upload_progress/lib/multipart_progress.rb +176 -0
  261. data/lib/upload_progress/lib/progress.rb +145 -0
  262. data/lib/upload_progress/lib/upload_progress.rb +303 -0
  263. data/lib/upload_progress/lib/upload_progress_helper.rb +425 -0
  264. data/lib/upload_progress/public/stylesheets/upload_progress.css +21 -0
  265. data/lib/upload_progress/test/multipart_progress_testx.rb +364 -0
  266. data/lib/upload_progress/test/upload_progress_helper_testx.rb +134 -0
  267. data/lib/upload_progress/test/upload_progress_testx.rb +88 -0
  268. metadata +305 -43
  269. data/app/assets/manage/btn_delete.gif +0 -0
  270. data/vendor/gems/.DS_Store +0 -0
  271. data/vendor/gems/acts_as_tree/README +0 -26
  272. data/vendor/gems/acts_as_tree/init.rb +0 -1
  273. data/vendor/gems/acts_as_tree/lib/active_record/acts/tree.rb +0 -96
  274. data/vendor/gems/acts_as_tree/test/acts_as_tree_test.rb +0 -219
  275. data/vendor/gems/acts_as_tree/test/fixtures/mixin.rb +0 -0
  276. data/vendor/gems/acts_as_tree/test/fixtures/mixins.yml +0 -0
  277. data/vendor/gems/acts_as_tree/test/schema.rb +0 -0
  278. data/vendor/gems/acts_as_versioned/Gemfile +0 -7
@@ -0,0 +1,1385 @@
1
+ /********************************
2
+ * default settings, override *
3
+ * in application.js *
4
+ ********************************/
5
+
6
+ var defaultXMenuOffset = 0;
7
+ var defaultYMenuOffset = 0;
8
+ var defaultXOffset = 0;
9
+ var defaultYOffset = 0;
10
+ var showRolloverEffect = Effect.Appear;
11
+ var showRolloverEffectOptions = { duration: 0.2 };
12
+ var showRolloverMenuEffect = Effect.BlindDown;
13
+ var showRolloverMenuEffectOptions = { duration: 0.2 };
14
+ var hideRolloverDelay = 120;
15
+ var hideRolloverEffect = Effect.Fade;
16
+ var hideRolloverEffectOptions = { duration: 0.3 };
17
+ var hideRolloverMenuEffect = Effect.BlindUp;
18
+ var hideRolloverMenuEffectOptions = { duration: 0.2 };
19
+
20
+
21
+ /********************************
22
+ * framework code follows *
23
+ ********************************/
24
+
25
+ var currentEffect = [];
26
+
27
+ function getElementPosition(sourceObj) {
28
+ if (sourceObj.style.left && sourceObj.style.top) {
29
+ // for the W3C-compliant crowd
30
+ return [parseInt(sourceObj.style.left), parseInt(sourceObj.style.top)];
31
+ } else {
32
+ // for the other awful browsers...
33
+ x = sourceObj.offsetLeft;
34
+ y = sourceObj.offsetTop;
35
+ temp = sourceObj;
36
+ while (temp = temp.offsetParent) {
37
+ x += temp.offsetLeft;
38
+ y += temp.offsetTop;
39
+ }
40
+
41
+ return [x, y];
42
+ }
43
+ }
44
+
45
+ /********************************
46
+ * rollover/menu functions *
47
+ ********************************/
48
+
49
+ var hideRolloverTimeouts = [];
50
+ var hoveredButtons = [];
51
+
52
+ function showRollover(target, xMenuOffset, yMenuOffset, xOffset, yOffset) {
53
+ try {
54
+ if (hideRolloverTimeouts[target]) {
55
+ clearTimeout(hideRolloverTimeouts[target]);
56
+ hideRolloverTimeouts[target] = null;
57
+ return;
58
+ }
59
+
60
+ if (hoveredButtons[target]) {
61
+ return;
62
+ }
63
+
64
+ var el = $(target + '_hover');
65
+ var sourceObj = $(target + '_std');
66
+
67
+ var coords = getElementPosition(sourceObj);
68
+ if (typeof(xMenuOffset) == 'undefined') xMenuOffset = defaultXMenuOffset;
69
+ if (typeof(yMenuOffset) == 'undefined') yMenuOffset = defaultYMenuOffset;
70
+ if (typeof(xOffset) == 'undefined') xOffset = defaultXOffset;
71
+ if (typeof(yOffset) == 'undefined') yOffset = defaultYOffset;
72
+
73
+ el.style.position = 'absolute';
74
+ el.style.left = coords[0] + xOffset + 'px';
75
+ el.style.top = coords[1] + yOffset + 'px';
76
+ el.style.margin = '0';
77
+ el.style.zIndex = '100';
78
+
79
+ if (currentEffect[el.id]) currentEffect[el.id].cancel();
80
+ currentEffect[el.id] = showRolloverEffect(el.id, showRolloverEffectOptions);
81
+
82
+ if (el = $(target + '_menu')) {
83
+ el.style.display = 'none';
84
+ el.style.position = 'absolute';
85
+ el.style.left = (coords[0] + xMenuOffset) + 'px';
86
+ el.style.top = (coords[1] + yMenuOffset) + 'px';
87
+ el.style.margin = '0';
88
+ el.style.zIndex = '100';
89
+
90
+ for (var i = 0; i < el.childNodes.length; i++) {
91
+ if (el.childNodes[i].tagName == 'DIV') {
92
+ el.style.width = el.childNodes[i].style.width;
93
+ el.style.height = el.childNodes[i].style.height;
94
+ break;
95
+ }
96
+ }
97
+ if (currentEffect[el.id]) currentEffect[el.id].cancel();
98
+ currentEffect[el.id] = showRolloverMenuEffect(el.id, showRolloverMenuEffectOptions);
99
+ }
100
+
101
+ hoveredButtons[target] = true;
102
+ } catch (e) { }
103
+ }
104
+
105
+ function hideRollover(target) {
106
+ try {
107
+ hideRolloverTimeouts[target] = setTimeout('hideRolloverComplete("' + target + '");', hideRolloverDelay);
108
+ } catch (e) {}
109
+ }
110
+
111
+ function hideRolloverComplete(target) {
112
+ try {
113
+ hideRolloverTimeouts[target] = null;
114
+
115
+ if (el = $(target + '_hover')) {
116
+ if (currentEffect[el.id]) currentEffect[el.id].cancel();
117
+ currentEffect[el.id] = hideRolloverEffect(el.id, hideRolloverEffectOptions);
118
+ }
119
+
120
+ if (el = $(target + '_menu')) {
121
+ if (currentEffect[el.id]) currentEffect[el.id].cancel();
122
+ currentEffect[el.id] = hideRolloverMenuEffect(el.id, hideRolloverMenuEffectOptions);
123
+ }
124
+
125
+ hoveredButtons[target] = false;
126
+ } catch (e) {}
127
+ }
128
+
129
+
130
+ var hideSimpleRolloverTimeouts = [];
131
+ function showSimpleRollover(target, xOffset, yOffset) {
132
+ try {
133
+ // if we were planning to hide this element in the future, no need for that now
134
+ if (hideSimpleRolloverTimeouts[target]) {
135
+ clearTimeout(hideSimpleRolloverTimeouts[target]);
136
+ hideSimpleRolloverTimeouts[target] = null;
137
+ return;
138
+ }
139
+
140
+ // if other elements are waiting to be hidden, get it over with now
141
+ $H(hideSimpleRolloverTimeouts)._each(function (pair) {
142
+ clearTimeout(pair[1]);
143
+ hideSimpleRolloverComplete(pair[0]);
144
+ });
145
+ } catch (e) {}
146
+
147
+ try {
148
+ var el = document.getElementById(target + '_std');
149
+ el.oldsrc = el.src;
150
+ el.src = el.src.replace(/(_hover)?.gif$/, '_hover.gif');
151
+ if (!(is.ie && is.mac)) showSimpleRolloverMenu(target, xOffset, yOffset);
152
+ } catch (e) {}
153
+ }
154
+
155
+ function showSimpleRolloverMenu(target, xOffset, yOffset, useRelative) {
156
+ try {
157
+ if (hideSimpleRolloverTimeouts[target]) {
158
+ clearTimeout(hideSimpleRolloverTimeouts[target]);
159
+ hideSimpleRolloverTimeouts[target] = null;
160
+ return;
161
+ }
162
+
163
+ var el = document.getElementById(target + '_std');
164
+ if (el) {
165
+ var coords = getElementPosition(el);
166
+
167
+ if (typeof(xOffset) == 'undefined') xOffset = 0;
168
+ if (typeof(yOffset) == 'undefined') yOffset = 30;
169
+ if (typeof(useRelative) == 'undefined') useRelative = false;
170
+
171
+ if (el = document.getElementById(target + '_menu')) {
172
+ el.style.zIndex = 100;
173
+ el.style.position = 'absolute';
174
+ if (useRelative) {
175
+ el.style.left = xOffset + 'px';
176
+ el.style.top = yOffset + 'px';
177
+ } else {
178
+ el.style.left = (coords[0] + xOffset) + 'px';
179
+ el.style.top = (coords[1] + yOffset) + 'px';
180
+ }
181
+ el.style.display = '';
182
+ }
183
+ }
184
+ } catch (e) {}
185
+ }
186
+
187
+ function hideSimpleRollover(target) {
188
+ try {
189
+ hideSimpleRolloverTimeouts[target] = setTimeout('hideSimpleRolloverComplete("' + target + '")', 200);
190
+ } catch (e) {}
191
+ }
192
+
193
+ function hideSimpleRolloverComplete(target) {
194
+ try {
195
+ var el = document.getElementById(target + '_std');
196
+ if (el.oldsrc) el.src = el.oldsrc;
197
+ hideSimpleRolloverMenuComplete(target);
198
+ } catch (e) {}
199
+ }
200
+
201
+ function hideSimpleRolloverMenu(target) {
202
+ try {
203
+ hideSimpleRolloverTimeouts[target] = setTimeout('hideSimpleRolloverMenuComplete("' + target + '")', 200);
204
+ } catch (e) {}
205
+ }
206
+
207
+ function hideSimpleRolloverMenuComplete(target) {
208
+ try {
209
+ hideSimpleRolloverTimeouts[target] = null;
210
+
211
+ var el = document.getElementById(target + '_std');
212
+ var coords = getElementPosition(el);
213
+
214
+ if (el = document.getElementById(target + '_menu')) {
215
+ el.style.display = 'none';
216
+ }
217
+ } catch (e) {}
218
+ }
219
+
220
+
221
+ /********************************
222
+ * slideshow functions *
223
+ ********************************/
224
+
225
+ var currentSlideIndex = 0;
226
+ var maxSlideIndex = -1;
227
+
228
+ function getNumSlides() {
229
+ if (maxSlideIndex > -1) return maxSlideIndex;
230
+ maxSlideIndex = 0;
231
+
232
+ while ($('img_slideshow' + maxSlideIndex)) maxSlideIndex++;
233
+ return maxSlideIndex;
234
+ }
235
+
236
+ function nextSlide(delay, transition) {
237
+ if (typeof(transition) == 'undefined') transition = 'SlideAppear';
238
+ changeSlide(delay, transition, 1);
239
+ }
240
+
241
+ function prevSlide(delay, transition) {
242
+ if (typeof(transition) == 'undefined') transition = 'SlideAppear';
243
+ changeSlide(delay, transition, -1);
244
+ }
245
+
246
+ // controls elements named img_slideshowX
247
+ // uses a global named currentSlideIndex to keep track of its state
248
+ // uses a global named maxSlideIndex to cache the discovered maximum slide index
249
+ function changeSlide(delay, transition, increment) {
250
+ try {
251
+ if (typeof(delay) == 'undefined') delay = -1;
252
+ if (typeof(transition) == 'undefined') transition = 'SlideAppear';
253
+
254
+ // this element is used for positioning
255
+ origimg = $('img_slideshow');
256
+
257
+ nextSlideIndex = currentSlideIndex + increment;
258
+ if (!$('img_slideshow' + nextSlideIndex)) {
259
+ if (increment > 0) {
260
+ nextSlideIndex = 0;
261
+ } else {
262
+ nextSlideIndex = getNumSlides() - 1;
263
+ }
264
+ }
265
+
266
+ if ((curimg = $('img_slideshow' + currentSlideIndex)) &&
267
+ (nextimg = $('img_slideshow' + nextSlideIndex))) {
268
+ // push old images back
269
+ for (var i = 0; i < getNumSlides(); i++) {
270
+ $('img_slideshow' + i).style.zIndex = ((increment > 0) ? i : (getNumSlides() - i));
271
+ }
272
+ nextimg.style.zIndex = '90';
273
+ nextimg.style.margin = '0';
274
+
275
+ // really shouldn't have to do this, but I just can't figure it out...
276
+ curimg.style.zIndex = '89';
277
+
278
+ // drag the new image over the main image
279
+ var coords = getElementPosition(origimg);
280
+ nextimg.style.position = 'absolute';
281
+ nextimg.style.left = coords[0] + 'px';
282
+ nextimg.style.top = coords[1] + 'px';
283
+
284
+ eval('Effect.' + transition + '(nextimg.id, { duration: 1.8 });');
285
+ setTimeout('$("' + curimg.id + '").style.display = "none"', 1900);
286
+ if (delay > 0) setTimeout('changeSlide(' + delay + ', "' + transition + '", ' + increment + ');', delay);
287
+
288
+ currentSlideIndex = nextSlideIndex;
289
+ }
290
+ } catch (e) {}
291
+ }
292
+
293
+ // positions slide navigation elements (named btn_slidenext and btn_slideprev)
294
+ // relative to img_slideshow (x and y are the relative offsets)
295
+ function positionSlideNav(x, y) {
296
+ try {
297
+ img = $('img_slideshow');
298
+ nav = $('div_slidenav');
299
+
300
+ // move the buttons to their proper places
301
+ nav.style.zIndex = '95';
302
+ nav.style.position = 'relative';
303
+ nav.style.left = x + 'px';
304
+ nav.style.top = y + 'px';
305
+ } catch (e) {}
306
+ }
307
+
308
+
309
+ /********************************
310
+ * dialog/popup functions *
311
+ ********************************/
312
+
313
+ function openDialog(url, w, h, opts) {
314
+ window.open(url, '_blank', (w && h ? 'width=' + w + ',height=' + h : '') + (typeof(opts) == 'undefined' ? '' : ',' + opts));
315
+ }
316
+
317
+ // resize the window to fit the content
318
+ function autoResize(masterDiv) {
319
+ if (typeof(masterDiv) == 'undefined') {
320
+ masterDiv = $('masterDiv');
321
+ } else {
322
+ masterDiv = $(masterDiv);
323
+ }
324
+ var max = Math.min(screen.height - 100, 800);
325
+ var ht = Math.min(masterDiv.scrollHeight, max);
326
+
327
+ if (typeof(window.innerWidth) == 'number') {
328
+ //Non-IE
329
+ myWidth = window.innerWidth;
330
+ myHeight = window.innerHeight;
331
+ } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
332
+ //IE 6+ in 'standards compliant mode'
333
+ myWidth = document.documentElement.clientWidth;
334
+ myHeight = document.documentElement.clientHeight;
335
+ } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
336
+ //IE 4 compatible
337
+ myWidth = document.body.clientWidth;
338
+ myHeight = document.body.clientHeight;
339
+ }
340
+
341
+ resizeBy(0, ht - myHeight);
342
+ }
343
+
344
+
345
+ // the opposite... resize the content to fit the window
346
+ function autoResizeDiv(masterDiv, adjustment) {
347
+ if (typeof(masterDiv) == 'undefined') {
348
+ masterDiv = $('masterDiv');
349
+ } else {
350
+ masterDiv = $(masterDiv);
351
+ }
352
+ if (typeof(adjustment) == 'undefined') adjustment = 0;
353
+
354
+ var max = Math.min(screen.height - 100, 800);
355
+ var ht = Math.min(masterDiv.scrollHeight, max);
356
+
357
+ if (typeof(window.innerWidth) == 'number') {
358
+ //Non-IE
359
+ myWidth = window.innerWidth;
360
+ myHeight = window.innerHeight;
361
+ } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
362
+ //IE 6+ in 'standards compliant mode'
363
+ myWidth = document.documentElement.clientWidth;
364
+ myHeight = document.documentElement.clientHeight;
365
+ } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
366
+ //IE 4 compatible
367
+ myWidth = document.body.clientWidth;
368
+ myHeight = document.body.clientHeight;
369
+ }
370
+
371
+ masterDiv.style.height = myHeight - 200 + adjustment + 'px';
372
+ }
373
+
374
+
375
+ /********************************
376
+ * date picker functions *
377
+ ********************************/
378
+
379
+ function showDatePicker(object, method_prefix) {
380
+ // anchor picker to the icon
381
+ var coords = getElementPosition($('date_picker_' + object + '_' + method_prefix + 'icon'));
382
+ var el = $('date_picker_' + object + '_' + method_prefix + 'main');
383
+ el.hide();
384
+ el.style.position = 'absolute';
385
+ /* el.style.left = (coords[0] - 120) + 'px';*/
386
+ /* el.style.top = (coords[1] + 14) + 'px';*/
387
+ el.show();
388
+ }
389
+
390
+ function hideDatePicker(object, method_prefix) {
391
+ $('date_picker_' + object + '_' + method_prefix + 'main').hide();
392
+ }
393
+
394
+ function dpPrevMonth(object, method_prefix, min_year) {
395
+ try {
396
+ if ($(object + '_' + method_prefix + '_month_sel').value > 1) {
397
+ $(object + '_' + method_prefix + '_month_sel').value--;
398
+ } else if ($(object + '_' + method_prefix + '_year_sel').value > min_year) {
399
+ $(object + '_' + method_prefix + '_month_sel').value = 12;
400
+ $(object + '_' + method_prefix + '_year_sel').value--;
401
+ }
402
+ } catch (e) {}
403
+ }
404
+
405
+ function dpNextMonth(object, method_prefix, max_year) {
406
+ try {
407
+ if ($(object + '_' + method_prefix + '_month_sel').value < 12) {
408
+ $(object + '_' + method_prefix + '_month_sel').value++;
409
+ } else if ($(object + '_' + method_prefix + '_year_sel').value < max_year) {
410
+ $(object + '_' + method_prefix + '_month_sel').value = 1;
411
+ $(object + '_' + method_prefix + '_year_sel').value++;
412
+ }
413
+ } catch (e) {}
414
+ }
415
+
416
+
417
+ /********************************
418
+ * custom effects *
419
+ ********************************/
420
+
421
+ Effect.BlindRight = function(element) {
422
+ element = $(element);
423
+ var oldWidth = Element.getStyle(element, 'width');
424
+ var elementDimensions = Element.getDimensions(element);
425
+ return new Effect.Scale(element, 100,
426
+ Object.extend({
427
+ scaleContent: false,
428
+ scaleY: false,
429
+ scaleFrom: 0,
430
+ scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
431
+ restoreAfterFinish: true,
432
+ afterSetup: function(effect) { with(Element) {
433
+ makeClipping(effect.element);
434
+ setStyle(effect.element, {width: '0px'});
435
+ show(effect.element);
436
+ }}
437
+ }, arguments[1] || {})
438
+ );
439
+ }
440
+
441
+ Effect.SlideAppear = function(element) {
442
+ element = $(element);
443
+ new Effect.Appear(element, arguments[2] || arguments[1] || {});
444
+ new Effect.BlindRight(element, arguments[1] || {});
445
+ }
446
+
447
+
448
+ /********************************
449
+ * column browser interface *
450
+ ********************************/
451
+
452
+ var cbNumColumns = 0;
453
+ var cbColWidth = '200px';
454
+ var cbColHeight = '240px';
455
+ var cbBorderWidth = '1px';
456
+ var cbColWidthFull = 202;
457
+
458
+ function cbAddColumn() {
459
+ var currentWidth = parseInt($('columnBrowser').style.width, 10);
460
+ if (currentWidth < ((cbNumColumns+1) * cbColWidthFull)) $('columnBrowser').style.width = '' + ((cbNumColumns+1) * cbColWidthFull) + 'px';
461
+ $('columnBrowser').innerHTML += "<div id=\"columnBrowserLevel" + cbNumColumns + "\" style=\"width: " + cbColWidth + "; height: " + cbColHeight + "; overflow: auto; float: left; border-width: " + cbBorderWidth + " " + cbBorderWidth + " " + cbBorderWidth + " " + (cbNumColumns == 0 ? cbBorderWidth : '0') + "; border-style: solid; border-color: gray;\">Loading...</div>";
462
+ $('columnBrowserLevel' + cbNumColumns).scrollIntoView();
463
+ cbNumColumns++;
464
+ }
465
+
466
+ function getScrollbarPosition(el) {
467
+ el = $(el);
468
+ return { x: el.scrollLeft, y: el.scrollTop };
469
+ }
470
+
471
+ function setScrollbarPosition(el, coords) {
472
+ el = $(el);
473
+ el.scrollLeft = coords.x;
474
+ el.scrollTop = coords.y;
475
+ }
476
+
477
+ function cbSelectItem(el, currentLevel, urlForNextLevel) {
478
+ var el = $(el);
479
+ coords = getScrollbarPosition(el.parentNode);
480
+
481
+ // remove all higher levels and unselect all other same-level divs
482
+ for (var i = currentLevel + 1; i <= cbNumColumns; i++) {
483
+ d = $('columnBrowserLevel' + i);
484
+ if (d) d.parentNode.removeChild(d);
485
+ }
486
+ cbNumColumns = currentLevel + 1;
487
+
488
+ prefix = 'cb_item_';
489
+ $A(el.parentNode.childNodes).each(function (d) {
490
+ if (d.id && d.id.substring(0, prefix.length) == prefix) {
491
+ d.className = 'cb_item';
492
+ }
493
+ })
494
+
495
+ // select and expand current dept div
496
+ el.className = 'cb_item cb_item_selected';
497
+
498
+ cbAddColumn();
499
+ el = $(el.id);
500
+ new Ajax.Updater('columnBrowserLevel' + (currentLevel+1), urlForNextLevel, {asynchronous:true, evalScripts:true});
501
+
502
+ setScrollbarPosition(el.parentNode, coords);
503
+ }
504
+
505
+
506
+ /********************************
507
+ * text field hints *
508
+ ********************************/
509
+
510
+ function addLoadEvent(func) {
511
+ var oldonload = window.onload;
512
+ if (typeof window.onload != 'function') {
513
+ window.onload = func;
514
+ } else {
515
+ window.onload = function() {
516
+ oldonload();
517
+ func();
518
+ }
519
+ }
520
+ }
521
+
522
+ function addUnloadEvent(func) {
523
+ var oldonunload = window.onunload;
524
+ if (typeof window.onunload != 'function') {
525
+ window.onunload = func;
526
+ } else {
527
+ window.onunload = function() {
528
+ oldonunload();
529
+ func();
530
+ }
531
+ }
532
+ }
533
+
534
+ var textFieldHints = new Array();
535
+ function setupTextFieldHints() {
536
+ textFieldHints.each(function (a) {
537
+ $A(document.getElementsByName(a.name)).each(function (el) {
538
+ var clearHint = function () {
539
+ el.value = '';
540
+ el.style.color = el.style.origColor ? el.style.origColor : 'black';
541
+ el.onfocus = el.oldOnFocus;
542
+ el.oldOnBlur = el.onblur;
543
+ el.onblur = function () {
544
+ if (typeof(el.oldOnBlur) == 'function') el.oldOnBlur();
545
+ setHint();
546
+ }
547
+ };
548
+ var setHint = function () {
549
+ if (!el.value || el.value == a.hint) {
550
+ el.value = a.hint;
551
+ el.style.origColor = el.style.color;
552
+ el.style.color = 'gray';
553
+ if (typeof(el.oldOnBlur) != 'undefined') el.onblur = el.oldOnBlur;
554
+ el.oldOnFocus = el.onfocus;
555
+ el.onfocus = function () {
556
+ if (typeof(el.oldOnFocus) == 'function') el.oldOnFocus();
557
+ clearHint();
558
+ }
559
+ }
560
+ }
561
+ setHint();
562
+ })
563
+ });
564
+ }
565
+ addLoadEvent(setupTextFieldHints);
566
+
567
+ function teardownTextFieldHints() {
568
+ textFieldHints.each(function (a) {
569
+ var el = document.getElementsByName(a.name)[0];
570
+ if (el.value == a.hint) {
571
+ el.value = '';
572
+ el.style.color = el.origColor ? el.origColor : 'black';
573
+ el.onfocus = null;
574
+ }
575
+ });
576
+ }
577
+
578
+ function addTextFieldHint(name, hint) {
579
+ if (textFieldHints.select(function (a) { return a.name == name }).length == 0) {
580
+ textFieldHints.push({ name: name, hint: hint });
581
+ }
582
+ }
583
+
584
+
585
+ /********************************
586
+ * horizontal tab interface *
587
+ ********************************/
588
+
589
+ function setPageVisibility() {
590
+ var opts = $A($('page_select').options);
591
+ opts.each(function (opt) {
592
+ $(opt.value).hide();
593
+ });
594
+ $($F('page_select')).show();
595
+ }
596
+
597
+
598
+ /********************************
599
+ * vertical tab interface *
600
+ ********************************/
601
+
602
+ function selectTab(tabName, tabArray, tabBtnPrefix, tabDivPrefix, hiddenTextFieldId) {
603
+ tabArray._each(function (tab) {
604
+ $(tabBtnPrefix + tab).className = 'tab_normal';
605
+ $(tabDivPrefix + tab).style.display = 'none';
606
+ })
607
+ $('pmtbtn_' + tabName).className = 'tab_selected';
608
+ $('pmtinfo_' + tabName).style.display = '';
609
+ $(hiddenTextFieldId).value = tabName;
610
+ }
611
+
612
+
613
+ /********************************
614
+ * cms support *
615
+ ********************************/
616
+
617
+ // support for autocompletes
618
+ var attrlist = [];
619
+ var taglist = [];
620
+
621
+ var dialogStack = [];
622
+ function showDojoDialog(id, titleText) {
623
+ if (!is.ie) changeOverflowAutoToHidden();
624
+
625
+ dlg = dojo.widget.byId(id);
626
+ if (!dlg) dlg = dojo.widget.createWidget(id);
627
+ if (!dlg) return false;
628
+
629
+ dlg.closeWindow = function () { hideDojoDialog(id); };
630
+ dlg.show();
631
+
632
+ if (typeof(titleText) != 'undefined') {
633
+ try {
634
+ document.getElementById('propertiesDialog').getElementsByTagName('div')[0].getElementsByTagName('div')[4].innerHTML = titleText;
635
+ } catch (e) {}
636
+ }
637
+
638
+ if (dialogStack.length > 0) dojo.widget.byId(dialogStack[dialogStack.length-1]).hide();
639
+ dialogStack.push(id);
640
+ }
641
+
642
+ function hideDojoDialog(id) {
643
+ dialogStack.pop();
644
+
645
+ dojo.widget.byId(id).hide();
646
+ if (!is.ie) changeOverflowHiddenToAuto();
647
+
648
+ if (dialogStack.length > 0) {
649
+ dojo.widget.byId(dialogStack[dialogStack.length-1]).show();
650
+ }
651
+ }
652
+
653
+ function editProperties(url, titleText) {
654
+ $('properties_dialog_content').innerHTML = 'Loading...';
655
+ new Ajax.Updater('properties_dialog_content', url, {asynchronous:true, evalScripts:true});
656
+
657
+ showDojoDialog('properties_dialog', titleText);
658
+ }
659
+
660
+ function cancelEditProperties() {
661
+ hideDojoDialog('properties_dialog');
662
+ }
663
+
664
+ function insertImage(url) {
665
+ var curInst = dojo.widget.Editor2Manager.getCurrentInstance();
666
+ imageNode = dojo.withGlobal(curInst.window, "getSelectedElement", dojo.html.selection);
667
+ if (!imageNode) {
668
+ imageNode = dojo.withGlobal(curInst.window, "getAncestorElement", dojo.html.selection, ['img']);
669
+ }
670
+ if (imageNode) {
671
+ dojo.require("dojo.widget.Editor2Plugin.InsertImageDialog");
672
+ w = dojo.widget.createWidget("Editor2InsertImageDialog");
673
+ w.show();
674
+ } else {
675
+ $('insert_image_dialog_content').innerHTML = 'Loading...';
676
+ new Ajax.Updater('insert_image_dialog_content', url, {asynchronous:true, evalScripts:true});
677
+ showDojoDialog('insert_image_dialog');
678
+ }
679
+ try { if (cropper) cropper.remove(); } catch (e) {}
680
+ }
681
+
682
+ function cancelInsertImage() {
683
+ hideDojoDialog('insert_image_dialog');
684
+ try { if (cropper) cropper.remove(); } catch (e) {}
685
+ }
686
+
687
+ function insertFile(url) {
688
+ var curInst = dojo.widget.Editor2Manager.getCurrentInstance();
689
+ curInst.saveSelection(); //save selection (none-activeX IE)
690
+ var html = dojo.withGlobal(curInst.window, "getSelectedText", dojo.html.selection);
691
+ if (html == null || html.length == 0) {
692
+ alert("Please select some text to create a file link.");
693
+ return false; //do not show the dialog
694
+ }
695
+
696
+ $('insert_file_dialog_content').innerHTML = 'Loading...';
697
+ new Ajax.Updater('insert_file_dialog_content', url, {asynchronous:true, evalScripts:true});
698
+ showDojoDialog('insert_file_dialog');
699
+ }
700
+
701
+ function cancelInsertFile() {
702
+ hideDojoDialog('insert_file_dialog');
703
+ }
704
+
705
+ function selectThumbnail(url) {
706
+ $('select_thumbnail_dialog_content').innerHTML = 'Loading...';
707
+ new Ajax.Updater('select_thumbnail_dialog_content', url, {asynchronous:true, evalScripts:true});
708
+ showDojoDialog('select_thumbnail_dialog');
709
+ }
710
+
711
+ function cancelSelectThumbnail() {
712
+ hideDojoDialog('select_thumbnail_dialog');
713
+ }
714
+
715
+ var gallerySize = [];
716
+ function changeGalleryImage(galleryName, index) {
717
+ var target = galleryName + '_image_' + index;
718
+ var caption = galleryName + '_caption_' + index;
719
+ if (!$(target)) return false;
720
+
721
+ var queue = Effect.Queues.get('global');
722
+ queue.each(function(e) { e.cancel() });
723
+
724
+ for (var i = 0; i < gallerySize[galleryName]; i++) {
725
+ el = $(galleryName + '_image_' + i);
726
+ if (el.id != target && el.style.display != 'none') Effect.Fade(el, { duration: 0.6 });
727
+
728
+ el = $(galleryName + '_thumb_' + i);
729
+ if (el) {
730
+ if (i == index) {
731
+ el.style.borderColor = 'white';
732
+ el.onmouseover = null;
733
+ el.onmouseout = null;
734
+ } else {
735
+ el.style.borderColor = '#6B6B6B';
736
+ el.onmouseover = function () { this.style.borderColor = 'white' };
737
+ el.onmouseout = function () { this.style.borderColor = '#6B6B6B' };
738
+ }
739
+ }
740
+ }
741
+
742
+ Effect.Appear(target, { duration: 0.6 });
743
+
744
+ if($(caption).innerHTML != '') {
745
+ $(galleryName + '_caption').style.display = 'block';
746
+ $(galleryName + '_caption').innerHTML = $(caption).innerHTML;
747
+ } else {
748
+ $(galleryName + '_caption').style.display = 'none';
749
+ }
750
+
751
+ prevIndex = index == 0 ? gallerySize[galleryName] - 1 : index-1;
752
+ nextIndex = index == gallerySize[galleryName] - 1 ? 0 : index+1;
753
+ $(galleryName + '_prev_button').onclick = function () { changeGalleryImage(galleryName, prevIndex) };
754
+ $(galleryName + '_next_button').onclick = function () { changeGalleryImage(galleryName, nextIndex) };
755
+ }
756
+
757
+ var galleryTimeouts = [];
758
+ function advanceGallerySlideshow(galleryName, delay) {
759
+ $(galleryName + '_next_button').onclick();
760
+ galleryTimeouts[galleryName] = setTimeout(function() { advanceGallerySlideshow(galleryName, delay); }, delay);
761
+ }
762
+
763
+
764
+ // this doesn't seem to work... argh
765
+ function disableEnterKey(e) {
766
+ // get event if not passed
767
+ if (!e) var e = window.event;
768
+
769
+ var numCharCode;
770
+
771
+ // get character code of key pressed
772
+ if (e.keyCode) {
773
+ numCharCode = e.keyCode;
774
+ } else if (e.which) {
775
+ numCharCode = e.which;
776
+ }
777
+
778
+ if (numCharCode == 13) {
779
+ e.cancelBubble = true;
780
+ if (e.stopPropagation) e.stopPropagation();
781
+ return false;
782
+ }
783
+ }
784
+
785
+ var overflowAutoDivs = [];
786
+ function changeOverflowAutoToHidden() {
787
+ var divs = [];
788
+ $$('div').each(function (div) {
789
+ if (div.style.overflow == 'auto') {
790
+ divs.push(div);
791
+ div.style.overflow = 'hidden';
792
+ }
793
+ });
794
+ overflowAutoDivs.push(divs);
795
+ }
796
+
797
+ function changeOverflowHiddenToAuto() {
798
+ $A(overflowAutoDivs.pop).each(function (div) {
799
+ div.style.overflow = 'auto';
800
+ });
801
+ }
802
+
803
+ var pageBrowserFieldID = null;
804
+ function showPageBrowser(field_id) {
805
+ pageBrowserFieldID = field_id;
806
+ path = $(field_id).value;
807
+
808
+ $('page_browser').innerHTML = 'Loading...'
809
+ new Ajax.Updater('page_browser', '/manage/cms/select_page?path=' + path, {asynchronous:true, evalScripts:true});
810
+ $('page_browser_selection').value = path;
811
+ showDojoDialog('page_browser_dialog');
812
+ }
813
+
814
+ function closePageBrowser() {
815
+ hideDojoDialog('page_browser_dialog');
816
+ $(pageBrowserFieldID).value = $('page_browser_selection').value;
817
+ }
818
+
819
+ var cmsPageObjects = [];
820
+ function scanForPageObjects(page_id, parent_key, version) {
821
+ found = [];
822
+
823
+ var regex = /<%=\s*insert_object\(?\s*['"]([-\w\s\d]+)['"],\s*:(\w+)\s*(.*?)\)?\s*%>/gm;
824
+ var matches = $A($('page_objects_' + parent_key).value.match(regex));
825
+
826
+ matches.each(function (match) {
827
+ if (regex.test(match)) {
828
+ name = match.replace(regex, "$1");
829
+ type = match.replace(regex, "$2");
830
+ opts = match.replace(regex, "$3");
831
+ found[name] = type;
832
+ }
833
+ });
834
+
835
+ // remove the cruft
836
+ $H(cmsPageObjects).each(function(pair) {
837
+ if (cmsPageObjects[pair.key] != found[pair.key]) {
838
+ type = cmsPageObjects[pair.key];
839
+ obj_key = type + '_container_obj-' + pair.value + '-' + pair.key.replace(/[^\w]/g, '_');
840
+ if ($(obj_key)) {
841
+ $(obj_key).parentNode.removeChild($(obj_key));
842
+ }
843
+ cmsPageObjects[pair.key] = null;
844
+ }
845
+ });
846
+
847
+ // bring in the new
848
+ $H(found).each(function (obj) {
849
+ name = obj.key
850
+ type = obj.value
851
+ if (!cmsPageObjects[name]) {
852
+ cmsPageObjects[name] = type;
853
+ new Ajax.Request('/manage/cms/insert_page_object_config/' + page_id + '?version= ' + version +
854
+ '&name=' + name + '&type=' + type + '&parent_key=' + parent_key,
855
+ { asynchronous: true, evalScripts: true });
856
+ }
857
+ });
858
+ }
859
+
860
+ function blockUserInput() {
861
+ var dims = { width: document.body.scrollWidth, height: document.body.scrollHeight };
862
+ $('preview_cover').show();
863
+ $('preview_cover').style.position = 'absolute';
864
+ $('preview_cover').style.left = '0px';
865
+ $('preview_cover').style.top = '0px';
866
+ $('preview_cover').style.width = dims.width + 'px';
867
+ $('preview_cover').style.height = dims.height + 'px';
868
+ }
869
+
870
+ function insertAtCaret(obj, text) {
871
+ if(document.selection) {
872
+ obj.focus();
873
+ var orig = obj.value.replace(/\r\n/g, "\n");
874
+ var range = document.selection.createRange();
875
+
876
+ if(range.parentElement() != obj) {
877
+ return false;
878
+ }
879
+
880
+ range.text = text;
881
+
882
+ var actual = tmp = obj.value.replace(/\r\n/g, "\n");
883
+
884
+ for(var diff = 0; diff < orig.length; diff++) {
885
+ if(orig.charAt(diff) != actual.charAt(diff)) break;
886
+ }
887
+
888
+ for(var index = 0, start = 0;
889
+ tmp.match(text)
890
+ && (tmp = tmp.replace(text, ""))
891
+ && index <= diff;
892
+ index = start + text.length
893
+ ) {
894
+ start = actual.indexOf(text, index);
895
+ }
896
+ } else if(obj.selectionStart) {
897
+ var start = obj.selectionStart;
898
+ var end = obj.selectionEnd;
899
+
900
+ obj.value = obj.value.substr(0, start)
901
+ + text
902
+ + obj.value.substr(end, obj.value.length);
903
+ }
904
+
905
+ if(start != null) {
906
+ setCaretTo(obj, start + text.length);
907
+ } else {
908
+ obj.value += text;
909
+ }
910
+ }
911
+
912
+ function setCaretTo(obj, pos) {
913
+ if(obj.createTextRange) {
914
+ var range = obj.createTextRange();
915
+ range.move('character', pos);
916
+ range.select();
917
+ } else if(obj.selectionStart) {
918
+ obj.focus();
919
+ obj.setSelectionRange(pos, pos);
920
+ }
921
+ }
922
+
923
+
924
+
925
+ // utility function to fix # of decimal places
926
+ function setPrecision(val, p, dontPad, addCommas) {
927
+ if (typeof(p) == 'undefined') p = 2;
928
+ if (typeof(dontPad) == 'undefined') dontPad = false;
929
+ if (typeof(addCommas) == 'undefined') addCommas = true;
930
+
931
+ if (val.toString() == 'NaN') return '';
932
+ var m = Math.pow(10, p);
933
+ var ret = parseInt(Math.round(val * m), 10) / m;
934
+ var idx = (''+ret).indexOf('.');
935
+ if (idx < 0) {
936
+ ret += '.';
937
+ idx = (''+ret).indexOf('.');
938
+ }
939
+
940
+ if (!dontPad && (''+ret).substring(idx).length <= p) {
941
+ for (var i = (''+ret).substring(idx).length; i <= p; i++) {
942
+ ret += '0';
943
+ }
944
+ }
945
+
946
+ if (addCommas) {
947
+ var pieces = (''+ret).split('.');
948
+ if (p > 0) {
949
+ ret = '.' + pieces[1];
950
+ } else {
951
+ ret = pieces[1];
952
+ }
953
+ for (var i = 0; i < pieces[0].length; i++) {
954
+ if (i % 3 == 2) {
955
+ ret = ',' + pieces[0].charAt(pieces[0].length - i - 1) + ret;
956
+ } else {
957
+ ret = pieces[0].charAt(pieces[0].length - i - 1) + ret;
958
+ }
959
+ }
960
+ ret = ret.replace(/^,/, '');
961
+ }
962
+
963
+ return ret;
964
+ }
965
+
966
+
967
+ function setReportDates(interval) {
968
+ startDateField = $('report_start_date');
969
+ endDateField = $('report_end_date');
970
+ today = startDate = endDate = new Date();
971
+
972
+ switch (interval) {
973
+ case 'yesterday':
974
+ startDate = new Date('' + (today.getMonth()+1) + '/' + (today.getDate()-1) + '/' + today.getYear());
975
+ endDate = startDate;
976
+ break;
977
+
978
+ case 'last_month':
979
+ startDate = new Date('' + today.getMonth() + '/1/' + today.getYear());
980
+ endDate = new Date('' + (today.getMonth()+1) + '/0/' + today.getYear());
981
+ break;
982
+
983
+ case 'last_quarter':
984
+ startMonth = Math.floor(today.getMonth() / 3) * 3 - 3;
985
+ startYear = today.getYear();
986
+ if (startMonth < 0) {
987
+ startMonth += 12;
988
+ startYear--;
989
+ }
990
+ endMonth = startMonth + 3;
991
+ endYear = startYear;
992
+ if (endMonth > 11) {
993
+ endMonth -= 12;
994
+ endYear++;
995
+ }
996
+ startDate = new Date('' + (startMonth+1) + '/1/' + startYear);
997
+ endDate = new Date('' + (endMonth+1) + '/0/' + endYear);
998
+ break;
999
+
1000
+ case 'last_year':
1001
+ startDate = new Date('1/1/' + (today.getYear()-1));
1002
+ endDate = new Date('12/31/' + (today.getYear()-1));
1003
+ break;
1004
+
1005
+ case 'today':
1006
+ startDate = new Date('' + (today.getMonth()+1 )+ '/' + today.getDate() + '/' + today.getYear());
1007
+ endDate = startDate;
1008
+ break;
1009
+
1010
+ case 'this_month':
1011
+ startDate = new Date('' + (today.getMonth()+1) + '/1/' + today.getYear());
1012
+ endDate = new Date('' + (today.getMonth()+2) + '/0/' + today.getYear());
1013
+ break;
1014
+
1015
+ case 'this_quarter':
1016
+ startMonth = Math.floor(today.getMonth() / 3) * 3;
1017
+ endMonth = startMonth + 3;
1018
+ endYear = startYear;
1019
+ if (endMonth > 11) {
1020
+ endMonth -= 12;
1021
+ endYear++;
1022
+ }
1023
+ startDate = new Date('' + (startMonth+1) + '/1/' + today.getYear());
1024
+ endDate = new Date('' + (endMonth+1) + '/0/' + endYear);
1025
+ break;
1026
+
1027
+ case 'this_year':
1028
+ startDate = new Date('1/1/' + today.getYear());
1029
+ endDate = new Date('12/31/' + today.getYear());
1030
+ break;
1031
+
1032
+ case 'all_time':
1033
+ startDate = new Date('1/1/' + (today.getYear()-5));
1034
+ endDate = new Date('12/31/' + (today.getYear()+50));
1035
+ break;
1036
+
1037
+ default:
1038
+ // same as "today"
1039
+ startDate = new Date('' + (today.getMonth()+1 )+ '/' + today.getDate() + '/' + today.getYear());
1040
+ endDate = startDate;
1041
+ break;
1042
+ }
1043
+
1044
+ startDateField.value = startDate.format('mm/dd/yyyy');
1045
+ endDateField.value = endDate.format('mm/dd/yyyy');
1046
+ }
1047
+
1048
+
1049
+
1050
+ /*
1051
+ Date Format 1.1
1052
+ (c) 2007 Steven Levithan <stevenlevithan.com>
1053
+ MIT license
1054
+ With code by Scott Trenda (Z and o flags, and enhanced brevity)
1055
+ */
1056
+
1057
+ /*** dateFormat
1058
+ Accepts a date, a mask, or a date and a mask.
1059
+ Returns a formatted version of the given date.
1060
+ The date defaults to the current date/time.
1061
+ The mask defaults ``"ddd mmm d yyyy HH:MM:ss"``.
1062
+ */
1063
+ var dateFormat = function () {
1064
+ var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloZ]|"[^"]*"|'[^']*'/g,
1065
+ timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,
1066
+ timezoneClip = /[^-+\dA-Z]/g,
1067
+ pad = function (value, length) {
1068
+ value = String(value);
1069
+ length = parseInt(length) || 2;
1070
+ while (value.length < length)
1071
+ value = "0" + value;
1072
+ return value;
1073
+ };
1074
+
1075
+ // Regexes and supporting functions are cached through closure
1076
+ return function (date, mask) {
1077
+ // Treat the first argument as a mask if it doesn't contain any numbers
1078
+ if (
1079
+ arguments.length == 1 &&
1080
+ (typeof date == "string" || date instanceof String) &&
1081
+ !/\d/.test(date)
1082
+ ) {
1083
+ mask = date;
1084
+ date = undefined;
1085
+ }
1086
+
1087
+ date = date ? new Date(date) : new Date();
1088
+ if (isNaN(date))
1089
+ throw "invalid date";
1090
+
1091
+ var dF = dateFormat;
1092
+ mask = String(dF.masks[mask] || mask || dF.masks["default"]);
1093
+
1094
+ var d = date.getDate(),
1095
+ D = date.getDay(),
1096
+ m = date.getMonth(),
1097
+ y = date.getFullYear()+1900,
1098
+ H = date.getHours(),
1099
+ M = date.getMinutes(),
1100
+ s = date.getSeconds(),
1101
+ L = date.getMilliseconds(),
1102
+ o = date.getTimezoneOffset(),
1103
+ flags = {
1104
+ d: d,
1105
+ dd: pad(d),
1106
+ ddd: dF.i18n.dayNames[D],
1107
+ dddd: dF.i18n.dayNames[D + 7],
1108
+ m: m + 1,
1109
+ mm: pad(m + 1),
1110
+ mmm: dF.i18n.monthNames[m],
1111
+ mmmm: dF.i18n.monthNames[m + 12],
1112
+ yy: String(y).slice(2),
1113
+ yyyy: y,
1114
+ h: H % 12 || 12,
1115
+ hh: pad(H % 12 || 12),
1116
+ H: H,
1117
+ HH: pad(H),
1118
+ M: M,
1119
+ MM: pad(M),
1120
+ s: s,
1121
+ ss: pad(s),
1122
+ l: pad(L, 3),
1123
+ L: pad(L > 99 ? Math.round(L / 10) : L),
1124
+ t: H < 12 ? "a" : "p",
1125
+ tt: H < 12 ? "am" : "pm",
1126
+ T: H < 12 ? "A" : "P",
1127
+ TT: H < 12 ? "AM" : "PM",
1128
+ Z: (String(date).match(timezone) || [""]).pop().replace(timezoneClip, ""),
1129
+ o: (o > 0 ? "-" : "+") + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4)
1130
+ };
1131
+
1132
+ return mask.replace(token, function ($0) {
1133
+ return ($0 in flags) ? flags[$0] : $0.slice(1, $0.length - 1);
1134
+ });
1135
+ };
1136
+ }();
1137
+
1138
+ // Some common format strings
1139
+ dateFormat.masks = {
1140
+ "default": "ddd mmm d yyyy HH:MM:ss",
1141
+ shortDate: "m/d/yy",
1142
+ mediumDate: "mmm d, yyyy",
1143
+ longDate: "mmmm d, yyyy",
1144
+ fullDate: "dddd, mmmm d, yyyy",
1145
+ shortTime: "h:MM TT",
1146
+ mediumTime: "h:MM:ss TT",
1147
+ longTime: "h:MM:ss TT Z",
1148
+ isoDate: "yyyy-mm-dd",
1149
+ isoTime: "HH:MM:ss",
1150
+ isoDateTime: "yyyy-mm-dd'T'HH:MM:ss",
1151
+ isoFullDateTime: "yyyy-mm-dd'T'HH:MM:ss.lo"
1152
+ };
1153
+
1154
+ // Internationalization strings
1155
+ dateFormat.i18n = {
1156
+ dayNames: [
1157
+ "Sun", "Mon", "Tue", "Wed", "Thr", "Fri", "Sat",
1158
+ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
1159
+ ],
1160
+ monthNames: [
1161
+ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
1162
+ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
1163
+ ]
1164
+ };
1165
+
1166
+ // For convenience...
1167
+ Date.prototype.format = function (mask) {
1168
+ return dateFormat(this, mask);
1169
+ }
1170
+
1171
+
1172
+ // Ultimate client-side JavaScript client sniff. Version 3.03
1173
+ // (C) Netscape Communications 1999. Permission granted to reuse and distribute.
1174
+ // Revised 17 May 99 to add is.nav5up and is.ie5up (see below).
1175
+ // Revised 21 Nov 00 to add is.gecko and is.ie5_5 Also Changed is.nav5 and is.nav5up to is.nav6 and is.nav6up
1176
+ // Revised 22 Feb 01 to correct Javascript Detection for IE 5.x, Opera 4,
1177
+ // correct Opera 5 detection
1178
+ // add support for winME and win2k
1179
+ // synch with browser-type-oo.js
1180
+ // Revised 26 Mar 01 to correct Opera detection
1181
+ // Revised 02 Oct 01 to add IE6 detection
1182
+
1183
+ // Everything you always wanted to know about your JavaScript client
1184
+ // but were afraid to ask ... "Is" is the constructor function for "is" object,
1185
+ // which has properties indicating:
1186
+ // (1) browser vendor:
1187
+ // is.nav, is.ie, is.opera, is.hotjava, is.webtv, is.TVNavigator, is.AOLTV
1188
+ // (2) browser version number:
1189
+ // is.major (integer indicating major version number: 2, 3, 4 ...)
1190
+ // is.minor (float indicating full version number: 2.02, 3.01, 4.04 ...)
1191
+ // (3) browser vendor AND major version number
1192
+ // is.nav2, is.nav3, is.nav4, is.nav4up, is.nav6, is.nav6up, is.gecko, is.ie3,
1193
+ // is.ie4, is.ie4up, is.ie5, is.ie5up, is.ie5_5, is.ie5_5up, is.ie6, is.ie6up, is.hotjava3, is.hotjava3up
1194
+ // (4) JavaScript version number:
1195
+ // is.js (float indicating full JavaScript version number: 1, 1.1, 1.2 ...)
1196
+ // (5) OS platform and version:
1197
+ // is.win, is.win16, is.win32, is.win31, is.win95, is.winnt, is.win98, is.winme, is.win2k
1198
+ // is.os2
1199
+ // is.mac, is.mac68k, is.macppc
1200
+ // is.unix
1201
+ // is.sun, is.sun4, is.sun5, is.suni86
1202
+ // is.irix, is.irix5, is.irix6
1203
+ // is.hpux, is.hpux9, is.hpux10
1204
+ // is.aix, is.aix1, is.aix2, is.aix3, is.aix4
1205
+ // is.linux, is.sco, is.unixware, is.mpras, is.reliant
1206
+ // is.dec, is.sinix, is.freebsd, is.bsd
1207
+ // is.vms
1208
+ //
1209
+ // See http://www.it97.de/JavaScript/JS_tutorial/bstat/navobj.html and
1210
+ // http://www.it97.de/JavaScript/JS_tutorial/bstat/Browseraol.html
1211
+ // for detailed lists of userAgent strings.
1212
+ //
1213
+ // Note: you don't want your Nav4 or IE4 code to "turn off" or
1214
+ // stop working when Nav5 and IE5 (or later) are released, so
1215
+ // in conditional code forks, use is.nav4up ("Nav4 or greater")
1216
+ // and is.ie4up ("IE4 or greater") instead of is.nav4 or is.ie4
1217
+ // to check version in code which you want to work on future
1218
+ // versions.
1219
+
1220
+
1221
+ function Is ()
1222
+ { // convert all characters to lowercase to simplify testing
1223
+ var agt=navigator.userAgent.toLowerCase();
1224
+
1225
+ // *** BROWSER VERSION ***
1226
+ // Note: On IE5, these return 4, so use is.ie5up to detect IE5.
1227
+
1228
+ this.major = parseInt(navigator.appVersion);
1229
+ this.minor = parseFloat(navigator.appVersion);
1230
+
1231
+ // Note: Opera and WebTV spoof Navigator. We do strict client detection.
1232
+ // If you want to allow spoofing, take out the tests for opera and webtv.
1233
+ this.nav = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
1234
+ && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
1235
+ && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
1236
+ this.nav2 = (this.nav && (this.major == 2));
1237
+ this.nav3 = (this.nav && (this.major == 3));
1238
+ this.nav4 = (this.nav && (this.major == 4));
1239
+ this.nav4up = (this.nav && (this.major >= 4));
1240
+ this.navonly = (this.nav && ((agt.indexOf(";nav") != -1) ||
1241
+ (agt.indexOf("; nav") != -1)) );
1242
+ this.nav6 = (this.nav && (this.major == 5));
1243
+ this.nav6up = (this.nav && (this.major >= 5));
1244
+ this.gecko = (agt.indexOf('gecko') != -1);
1245
+
1246
+
1247
+ this.ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
1248
+ this.ie3 = (this.ie && (this.major < 4));
1249
+ this.ie4 = (this.ie && (this.major == 4) && (agt.indexOf("msie 4")!=-1) );
1250
+ this.ie4up = (this.ie && (this.major >= 4));
1251
+ this.ie5 = (this.ie && (this.major == 4) && (agt.indexOf("msie 5.0")!=-1) );
1252
+ this.ie5_5 = (this.ie && (this.major == 4) && (agt.indexOf("msie 5.5") !=-1));
1253
+ this.ie5up = (this.ie && !this.ie3 && !this.ie4);
1254
+ this.ie5_5up =(this.ie && !this.ie3 && !this.ie4 && !this.ie5);
1255
+ this.ie6 = (this.ie && (this.major == 4) && (agt.indexOf("msie 6.")!=-1) );
1256
+ this.ie6up = (this.ie && !this.ie3 && !this.ie4 && !this.ie5 && !this.ie5_5);
1257
+ this.ie7 = (this.ie && (this.major == 4) && (agt.indexOf("msie 7.")!=-1) );
1258
+ this.ie7up = (this.ie && !this.ie3 && !this.ie4 && !this.ie5 && !this.ie5_5 && !this.ie6);
1259
+
1260
+ // KNOWN BUG: On AOL4, returns false if IE3 is embedded browser
1261
+ // or if this is the first browser window opened. Thus the
1262
+ // variables is.aol, is.aol3, and is.aol4 aren't 100% reliable.
1263
+ this.aol = (agt.indexOf("aol") != -1);
1264
+ this.aol3 = (this.aol && this.ie3);
1265
+ this.aol4 = (this.aol && this.ie4);
1266
+ this.aol5 = (agt.indexOf("aol 5") != -1);
1267
+ this.aol6 = (agt.indexOf("aol 6") != -1);
1268
+
1269
+ this.opera = (agt.indexOf("opera") != -1);
1270
+ this.opera2 = (agt.indexOf("opera 2") != -1 || agt.indexOf("opera/2") != -1);
1271
+ this.opera3 = (agt.indexOf("opera 3") != -1 || agt.indexOf("opera/3") != -1);
1272
+ this.opera4 = (agt.indexOf("opera 4") != -1 || agt.indexOf("opera/4") != -1);
1273
+ this.opera5 = (agt.indexOf("opera 5") != -1 || agt.indexOf("opera/5") != -1);
1274
+ this.opera5up = (this.opera && !this.opera2 && !this.opera3 && !this.opera4);
1275
+
1276
+ this.webtv = (agt.indexOf("webtv") != -1);
1277
+
1278
+ this.TVNavigator = ((agt.indexOf("navio") != -1) || (agt.indexOf("navio_aoltv") != -1));
1279
+ this.AOLTV = this.TVNavigator;
1280
+
1281
+ this.hotjava = (agt.indexOf("hotjava") != -1);
1282
+ this.hotjava3 = (this.hotjava && (this.major == 3));
1283
+ this.hotjava3up = (this.hotjava && (this.major >= 3));
1284
+
1285
+ // *** JAVASCRIPT VERSION CHECK ***
1286
+ if (this.nav2 || this.ie3) this.js = 1.0;
1287
+ else if (this.nav3) this.js = 1.1;
1288
+ else if (this.opera5up) this.js = 1.3;
1289
+ else if (this.opera) this.js = 1.1;
1290
+ else if ((this.nav4 && (this.minor <= 4.05)) || this.ie4) this.js = 1.2;
1291
+ else if ((this.nav4 && (this.minor > 4.05)) || this.ie5) this.js = 1.3;
1292
+ else if (this.hotjava3up) this.js = 1.4;
1293
+ else if (this.nav6 || this.gecko) this.js = 1.5;
1294
+ // NOTE: In the future, update this code when newer versions of JS
1295
+ // are released. For now, we try to provide some upward compatibility
1296
+ // so that future versions of Nav and IE will show they are at
1297
+ // *least* JS 1.x capable. Always check for JS version compatibility
1298
+ // with > or >=.
1299
+ else if (this.nav6up) this.js = 1.5;
1300
+ // note ie5up on mac is 1.4
1301
+ else if (this.ie5up) this.js = 1.3
1302
+
1303
+ // HACK: no idea for other browsers; always check for JS version with > or >=
1304
+ else this.js = 0.0;
1305
+
1306
+ // *** PLATFORM ***
1307
+ this.win = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
1308
+ // NOTE: On Opera 3.0, the userAgent string includes "Windows 95/NT4" on all
1309
+ // Win32, so you can't distinguish between Win95 and WinNT.
1310
+ this.win95 = ((agt.indexOf("win95")!=-1) || (agt.indexOf("windows 95")!=-1));
1311
+
1312
+ // is this a 16 bit compiled version?
1313
+ this.win16 = ((agt.indexOf("win16")!=-1) ||
1314
+ (agt.indexOf("16bit")!=-1) || (agt.indexOf("windows 3.1")!=-1) ||
1315
+ (agt.indexOf("windows 16-bit")!=-1) );
1316
+
1317
+ this.win31 = ((agt.indexOf("windows 3.1")!=-1) || (agt.indexOf("win16")!=-1) ||
1318
+ (agt.indexOf("windows 16-bit")!=-1));
1319
+
1320
+ // NOTE: Reliable detection of Win98 may not be possible. It appears that:
1321
+ // - On Nav 4.x and before you'll get plain "Windows" in userAgent.
1322
+ // - On Mercury client, the 32-bit version will return "Win98", but
1323
+ // the 16-bit version running on Win98 will still return "Win95".
1324
+ this.win98 = ((agt.indexOf("win98")!=-1) || (agt.indexOf("windows 98")!=-1));
1325
+ this.winnt = ((agt.indexOf("winnt")!=-1) || (agt.indexOf("windows nt")!=-1));
1326
+ this.win32 = (this.win95 || this.winnt || this.win98 ||
1327
+ ((this.major >= 4) && (navigator.platform == "Win32")) ||
1328
+ (agt.indexOf("win32")!=-1) || (agt.indexOf("32bit")!=-1));
1329
+
1330
+ this.winme = ((agt.indexOf("win 9x 4.90")!=-1));
1331
+ this.win2k = ((agt.indexOf("windows nt 5.0")!=-1));
1332
+
1333
+ this.os2 = ((agt.indexOf("os/2")!=-1) ||
1334
+ (navigator.appVersion.indexOf("OS/2")!=-1) ||
1335
+ (agt.indexOf("ibm-webexplorer")!=-1));
1336
+
1337
+ this.mac = (agt.indexOf("mac")!=-1);
1338
+ // hack ie5 js version for mac
1339
+ if (this.mac && this.ie5up) this.js = 1.4;
1340
+ this.mac68k = (this.mac && ((agt.indexOf("68k")!=-1) ||
1341
+ (agt.indexOf("68000")!=-1)));
1342
+ this.macppc = (this.mac && ((agt.indexOf("ppc")!=-1) ||
1343
+ (agt.indexOf("powerpc")!=-1)));
1344
+
1345
+ this.sun = (agt.indexOf("sunos")!=-1);
1346
+ this.sun4 = (agt.indexOf("sunos 4")!=-1);
1347
+ this.sun5 = (agt.indexOf("sunos 5")!=-1);
1348
+ this.suni86= (this.sun && (agt.indexOf("i86")!=-1));
1349
+ this.irix = (agt.indexOf("irix") !=-1); // SGI
1350
+ this.irix5 = (agt.indexOf("irix 5") !=-1);
1351
+ this.irix6 = ((agt.indexOf("irix 6") !=-1) || (agt.indexOf("irix6") !=-1));
1352
+ this.hpux = (agt.indexOf("hp-ux")!=-1);
1353
+ this.hpux9 = (this.hpux && (agt.indexOf("09.")!=-1));
1354
+ this.hpux10= (this.hpux && (agt.indexOf("10.")!=-1));
1355
+ this.aix = (agt.indexOf("aix") !=-1); // IBM
1356
+ this.aix1 = (agt.indexOf("aix 1") !=-1);
1357
+ this.aix2 = (agt.indexOf("aix 2") !=-1);
1358
+ this.aix3 = (agt.indexOf("aix 3") !=-1);
1359
+ this.aix4 = (agt.indexOf("aix 4") !=-1);
1360
+ this.linux = (agt.indexOf("inux")!=-1);
1361
+ this.sco = (agt.indexOf("sco")!=-1) || (agt.indexOf("unix_sv")!=-1);
1362
+ this.unixware = (agt.indexOf("unix_system_v")!=-1);
1363
+ this.mpras = (agt.indexOf("ncr")!=-1);
1364
+ this.reliant = (agt.indexOf("reliantunix")!=-1);
1365
+ this.dec = ((agt.indexOf("dec")!=-1) || (agt.indexOf("osf1")!=-1) ||
1366
+ (agt.indexOf("dec_alpha")!=-1) || (agt.indexOf("alphaserver")!=-1) ||
1367
+ (agt.indexOf("ultrix")!=-1) || (agt.indexOf("alphastation")!=-1));
1368
+ this.sinix = (agt.indexOf("sinix")!=-1);
1369
+ this.freebsd = (agt.indexOf("freebsd")!=-1);
1370
+ this.bsd = (agt.indexOf("bsd")!=-1);
1371
+ this.unix = ((agt.indexOf("x11")!=-1) || this.sun || this.irix || this.hpux ||
1372
+ this.sco ||this.unixware || this.mpras || this.reliant ||
1373
+ this.dec || this.sinix || this.aix || this.linux || this.bsd || this.freebsd);
1374
+
1375
+ this.vms = ((agt.indexOf("vax")!=-1) || (agt.indexOf("openvms")!=-1));
1376
+ }
1377
+
1378
+ var is;
1379
+ var isIE3Mac = false;
1380
+ // this section is designed specifically for IE3 for the Mac
1381
+
1382
+ if ((navigator.appVersion.indexOf("Mac")!=-1) && (navigator.userAgent.indexOf("MSIE")!=-1) &&
1383
+ (parseInt(navigator.appVersion)==3))
1384
+ isIE3Mac = true;
1385
+ else is = new Is();