alfa 0.0.1.pre → 0.0.2.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (238) hide show
  1. data/assets/css/960gs/960.css +653 -0
  2. data/assets/css/960gs/960_12_col.css +357 -0
  3. data/assets/css/960gs/960_12_col_rtl.css +357 -0
  4. data/assets/css/960gs/960_16_col.css +446 -0
  5. data/assets/css/960gs/960_16_col_rtl.css +446 -0
  6. data/assets/css/960gs/960_24_col.css +621 -0
  7. data/assets/css/960gs/960_24_col_rtl.css +621 -0
  8. data/assets/css/960gs/960_rtl.css +653 -0
  9. data/assets/css/960gs/demo.css +55 -0
  10. data/assets/css/960gs/min/960.css +1 -0
  11. data/assets/css/960gs/min/960_12_col.css +1 -0
  12. data/assets/css/960gs/min/960_12_col_rtl.css +1 -0
  13. data/assets/css/960gs/min/960_16_col.css +1 -0
  14. data/assets/css/960gs/min/960_16_col_rtl.css +1 -0
  15. data/assets/css/960gs/min/960_24_col.css +1 -0
  16. data/assets/css/960gs/min/960_24_col_rtl.css +1 -0
  17. data/assets/css/960gs/min/960_rtl.css +1 -0
  18. data/assets/css/960gs/min/reset.css +1 -0
  19. data/assets/css/960gs/min/reset_rtl.css +1 -0
  20. data/assets/css/960gs/min/text.css +1 -0
  21. data/assets/css/960gs/min/text_rtl.css +1 -0
  22. data/assets/css/960gs/reset.css +211 -0
  23. data/assets/css/960gs/reset_rtl.css +211 -0
  24. data/assets/css/960gs/text.css +86 -0
  25. data/assets/css/960gs/text_rtl.css +86 -0
  26. data/assets/js/jquery/jquery-1.3.2.js +4376 -0
  27. data/assets/js/jquery/jquery-1.3.2.min.js +19 -0
  28. data/assets/js/jquery/jquery-1.4.2.js +6240 -0
  29. data/assets/js/jquery/jquery-1.4.2.min.js +154 -0
  30. data/assets/js/jquery/jquery-1.4.4.js +7179 -0
  31. data/assets/js/jquery/jquery-1.4.4.min.js +167 -0
  32. data/assets/js/jquery/jquery-1.8.2.js +9440 -0
  33. data/assets/js/jquery/jquery-1.8.2.min.js +2 -0
  34. data/assets/js/jquery/jquery-latest.js +2 -0
  35. data/assets/js/jquery/plugins/corner.js +178 -0
  36. data/assets/js/jquery/plugins/corner_12x.js +503 -0
  37. data/assets/js/jquery/plugins/datepick/calendar-green.gif +0 -0
  38. data/assets/js/jquery/plugins/datepick/calendar.gif +0 -0
  39. data/assets/js/jquery/plugins/datepick/datepickBasics.html +34 -0
  40. data/assets/js/jquery/plugins/datepick/flora.datepick.css +221 -0
  41. data/assets/js/jquery/plugins/datepick/humanity.datepick.css +192 -0
  42. data/assets/js/jquery/plugins/datepick/jquery.datepick-ar.js +27 -0
  43. data/assets/js/jquery/plugins/datepick/jquery.datepick-az.js +26 -0
  44. data/assets/js/jquery/plugins/datepick/jquery.datepick-bg.js +26 -0
  45. data/assets/js/jquery/plugins/datepick/jquery.datepick-ca.js +26 -0
  46. data/assets/js/jquery/plugins/datepick/jquery.datepick-cs.js +26 -0
  47. data/assets/js/jquery/plugins/datepick/jquery.datepick-da.js +26 -0
  48. data/assets/js/jquery/plugins/datepick/jquery.datepick-de.js +26 -0
  49. data/assets/js/jquery/plugins/datepick/jquery.datepick-el.js +26 -0
  50. data/assets/js/jquery/plugins/datepick/jquery.datepick-eo.js +26 -0
  51. data/assets/js/jquery/plugins/datepick/jquery.datepick-es.js +26 -0
  52. data/assets/js/jquery/plugins/datepick/jquery.datepick-et.js +26 -0
  53. data/assets/js/jquery/plugins/datepick/jquery.datepick-fa.js +26 -0
  54. data/assets/js/jquery/plugins/datepick/jquery.datepick-fi.js +26 -0
  55. data/assets/js/jquery/plugins/datepick/jquery.datepick-fr.js +26 -0
  56. data/assets/js/jquery/plugins/datepick/jquery.datepick-he.js +26 -0
  57. data/assets/js/jquery/plugins/datepick/jquery.datepick-hr.js +26 -0
  58. data/assets/js/jquery/plugins/datepick/jquery.datepick-hu.js +26 -0
  59. data/assets/js/jquery/plugins/datepick/jquery.datepick-hy.js +26 -0
  60. data/assets/js/jquery/plugins/datepick/jquery.datepick-id.js +26 -0
  61. data/assets/js/jquery/plugins/datepick/jquery.datepick-is.js +26 -0
  62. data/assets/js/jquery/plugins/datepick/jquery.datepick-it.js +26 -0
  63. data/assets/js/jquery/plugins/datepick/jquery.datepick-ja.js +26 -0
  64. data/assets/js/jquery/plugins/datepick/jquery.datepick-ko.js +26 -0
  65. data/assets/js/jquery/plugins/datepick/jquery.datepick-lt.js +26 -0
  66. data/assets/js/jquery/plugins/datepick/jquery.datepick-lv.js +26 -0
  67. data/assets/js/jquery/plugins/datepick/jquery.datepick-ms.js +26 -0
  68. data/assets/js/jquery/plugins/datepick/jquery.datepick-nl.js +26 -0
  69. data/assets/js/jquery/plugins/datepick/jquery.datepick-no.js +26 -0
  70. data/assets/js/jquery/plugins/datepick/jquery.datepick-pl.js +26 -0
  71. data/assets/js/jquery/plugins/datepick/jquery.datepick-pt-BR.js +26 -0
  72. data/assets/js/jquery/plugins/datepick/jquery.datepick-ro.js +26 -0
  73. data/assets/js/jquery/plugins/datepick/jquery.datepick-ru.js +26 -0
  74. data/assets/js/jquery/plugins/datepick/jquery.datepick-sk.js +26 -0
  75. data/assets/js/jquery/plugins/datepick/jquery.datepick-sl.js +27 -0
  76. data/assets/js/jquery/plugins/datepick/jquery.datepick-sq.js +26 -0
  77. data/assets/js/jquery/plugins/datepick/jquery.datepick-sr-SR.js +25 -0
  78. data/assets/js/jquery/plugins/datepick/jquery.datepick-sr.js +25 -0
  79. data/assets/js/jquery/plugins/datepick/jquery.datepick-sv.js +26 -0
  80. data/assets/js/jquery/plugins/datepick/jquery.datepick-th.js +26 -0
  81. data/assets/js/jquery/plugins/datepick/jquery.datepick-tr.js +26 -0
  82. data/assets/js/jquery/plugins/datepick/jquery.datepick-uk.js +26 -0
  83. data/assets/js/jquery/plugins/datepick/jquery.datepick-validation.js +141 -0
  84. data/assets/js/jquery/plugins/datepick/jquery.datepick-validation.min.js +8 -0
  85. data/assets/js/jquery/plugins/datepick/jquery.datepick-validation.pack.js +8 -0
  86. data/assets/js/jquery/plugins/datepick/jquery.datepick-zh-CN.js +26 -0
  87. data/assets/js/jquery/plugins/datepick/jquery.datepick-zh-TW.js +26 -0
  88. data/assets/js/jquery/plugins/datepick/jquery.datepick.css +216 -0
  89. data/assets/js/jquery/plugins/datepick/jquery.datepick.ent +76 -0
  90. data/assets/js/jquery/plugins/datepick/jquery.datepick.js +1974 -0
  91. data/assets/js/jquery/plugins/datepick/jquery.datepick.min.js +8 -0
  92. data/assets/js/jquery/plugins/datepick/jquery.datepick.pack.js +8 -0
  93. data/assets/js/jquery/plugins/datepick/redmond.datepick.css +204 -0
  94. data/assets/js/jquery/plugins/datepick/smoothness.datepick.css +205 -0
  95. data/assets/js/jquery/plugins/fancybox/blank.gif +0 -0
  96. data/assets/js/jquery/plugins/fancybox/fancy_close.png +0 -0
  97. data/assets/js/jquery/plugins/fancybox/fancy_loading.png +0 -0
  98. data/assets/js/jquery/plugins/fancybox/fancy_nav_left.png +0 -0
  99. data/assets/js/jquery/plugins/fancybox/fancy_nav_right.png +0 -0
  100. data/assets/js/jquery/plugins/fancybox/fancy_shadow_e.png +0 -0
  101. data/assets/js/jquery/plugins/fancybox/fancy_shadow_n.png +0 -0
  102. data/assets/js/jquery/plugins/fancybox/fancy_shadow_ne.png +0 -0
  103. data/assets/js/jquery/plugins/fancybox/fancy_shadow_nw.png +0 -0
  104. data/assets/js/jquery/plugins/fancybox/fancy_shadow_s.png +0 -0
  105. data/assets/js/jquery/plugins/fancybox/fancy_shadow_se.png +0 -0
  106. data/assets/js/jquery/plugins/fancybox/fancy_shadow_sw.png +0 -0
  107. data/assets/js/jquery/plugins/fancybox/fancy_shadow_w.png +0 -0
  108. data/assets/js/jquery/plugins/fancybox/fancy_title_left.png +0 -0
  109. data/assets/js/jquery/plugins/fancybox/fancy_title_main.png +0 -0
  110. data/assets/js/jquery/plugins/fancybox/fancy_title_over.png +0 -0
  111. data/assets/js/jquery/plugins/fancybox/fancy_title_right.png +0 -0
  112. data/assets/js/jquery/plugins/fancybox/fancybox-x.png +0 -0
  113. data/assets/js/jquery/plugins/fancybox/fancybox-y.png +0 -0
  114. data/assets/js/jquery/plugins/fancybox/fancybox.png +0 -0
  115. data/assets/js/jquery/plugins/fancybox/jquery.easing-1.3.pack.js +72 -0
  116. data/assets/js/jquery/plugins/fancybox/jquery.fancybox-1.3.2.css +359 -0
  117. data/assets/js/jquery/plugins/fancybox/jquery.fancybox-1.3.2.js +1136 -0
  118. data/assets/js/jquery/plugins/fancybox/jquery.fancybox-1.3.2.pack.js +46 -0
  119. data/assets/js/jquery/plugins/fancybox/jquery.fancybox-1.3.4.css +359 -0
  120. data/assets/js/jquery/plugins/fancybox/jquery.fancybox-1.3.4.js +1156 -0
  121. data/assets/js/jquery/plugins/fancybox/jquery.fancybox-1.3.4.pack.js +46 -0
  122. data/assets/js/jquery/plugins/fancybox/jquery.mousewheel-3.0.4.pack.js +14 -0
  123. data/assets/js/jquery/plugins/jquery.cookie.js +96 -0
  124. data/assets/js/jquery/plugins/jquery.easing.1.3.js +205 -0
  125. data/assets/js/jquery/plugins/jquery.flash.js +288 -0
  126. data/assets/js/jquery/plugins/jquery.flash.min.js +1 -0
  127. data/assets/js/jquery/plugins/jquery.ifixpng.js +137 -0
  128. data/assets/js/jquery/plugins/jquery.mousewheel.js +84 -0
  129. data/assets/js/jquery/plugins/jquery.mousewheel.min.js +12 -0
  130. data/assets/js/jquery/plugins/jquery.numberformatter-1.2.2.js +486 -0
  131. data/assets/js/jquery/plugins/jquery.sifr.js +224 -0
  132. data/assets/js/jquery/plugins/jquery.sifr.min.js +1 -0
  133. data/assets/js/jquery/plugins/jquery.swfobject.js +1 -0
  134. data/assets/js/jquery/plugins/jquery.timers-1.1.2.js +147 -0
  135. data/assets/js/jquery/plugins/simplegallery.js +167 -0
  136. data/assets/js/jquery/ui/external/jquery.bgiframe-2.1.2.js +39 -0
  137. data/assets/js/jquery/ui/external/jquery.cookie.js +89 -0
  138. data/assets/js/jquery/ui/external/jquery.metadata.js +122 -0
  139. data/assets/js/jquery/ui/external/qunit.css +153 -0
  140. data/assets/js/jquery/ui/external/qunit.js +1261 -0
  141. data/assets/js/jquery/ui/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  142. data/assets/js/jquery/ui/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  143. data/assets/js/jquery/ui/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  144. data/assets/js/jquery/ui/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  145. data/assets/js/jquery/ui/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  146. data/assets/js/jquery/ui/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  147. data/assets/js/jquery/ui/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  148. data/assets/js/jquery/ui/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  149. data/assets/js/jquery/ui/images/ui-icons_222222_256x240.png +0 -0
  150. data/assets/js/jquery/ui/images/ui-icons_2e83ff_256x240.png +0 -0
  151. data/assets/js/jquery/ui/images/ui-icons_454545_256x240.png +0 -0
  152. data/assets/js/jquery/ui/images/ui-icons_888888_256x240.png +0 -0
  153. data/assets/js/jquery/ui/images/ui-icons_cd0a0a_256x240.png +0 -0
  154. data/assets/js/jquery/ui/jquery-ui-latest.min.js +778 -0
  155. data/assets/js/jquery/ui/themes/base/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  156. data/assets/js/jquery/ui/themes/base/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  157. data/assets/js/jquery/ui/themes/base/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  158. data/assets/js/jquery/ui/themes/base/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  159. data/assets/js/jquery/ui/themes/base/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  160. data/assets/js/jquery/ui/themes/base/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  161. data/assets/js/jquery/ui/themes/base/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  162. data/assets/js/jquery/ui/themes/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  163. data/assets/js/jquery/ui/themes/base/images/ui-icons_222222_256x240.png +0 -0
  164. data/assets/js/jquery/ui/themes/base/images/ui-icons_2e83ff_256x240.png +0 -0
  165. data/assets/js/jquery/ui/themes/base/images/ui-icons_454545_256x240.png +0 -0
  166. data/assets/js/jquery/ui/themes/base/images/ui-icons_888888_256x240.png +0 -0
  167. data/assets/js/jquery/ui/themes/base/images/ui-icons_cd0a0a_256x240.png +0 -0
  168. data/assets/js/jquery/ui/themes/base/jquery.ui.accordion.css +19 -0
  169. data/assets/js/jquery/ui/themes/base/jquery.ui.all.css +11 -0
  170. data/assets/js/jquery/ui/themes/base/jquery.ui.autocomplete.css +53 -0
  171. data/assets/js/jquery/ui/themes/base/jquery.ui.base.css +11 -0
  172. data/assets/js/jquery/ui/themes/base/jquery.ui.button.css +38 -0
  173. data/assets/js/jquery/ui/themes/base/jquery.ui.core.css +41 -0
  174. data/assets/js/jquery/ui/themes/base/jquery.ui.datepicker.css +68 -0
  175. data/assets/js/jquery/ui/themes/base/jquery.ui.dialog.css +21 -0
  176. data/assets/js/jquery/ui/themes/base/jquery.ui.progressbar.css +11 -0
  177. data/assets/js/jquery/ui/themes/base/jquery.ui.resizable.css +20 -0
  178. data/assets/js/jquery/ui/themes/base/jquery.ui.selectable.css +10 -0
  179. data/assets/js/jquery/ui/themes/base/jquery.ui.slider.css +24 -0
  180. data/assets/js/jquery/ui/themes/base/jquery.ui.tabs.css +18 -0
  181. data/assets/js/jquery/ui/themes/base/jquery.ui.theme.css +252 -0
  182. data/assets/js/jquery/ui/themes/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  183. data/assets/js/jquery/ui/themes/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  184. data/assets/js/jquery/ui/themes/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  185. data/assets/js/jquery/ui/themes/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  186. data/assets/js/jquery/ui/themes/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  187. data/assets/js/jquery/ui/themes/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  188. data/assets/js/jquery/ui/themes/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  189. data/assets/js/jquery/ui/themes/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  190. data/assets/js/jquery/ui/themes/smoothness/images/ui-icons_222222_256x240.png +0 -0
  191. data/assets/js/jquery/ui/themes/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  192. data/assets/js/jquery/ui/themes/smoothness/images/ui-icons_454545_256x240.png +0 -0
  193. data/assets/js/jquery/ui/themes/smoothness/images/ui-icons_888888_256x240.png +0 -0
  194. data/assets/js/jquery/ui/themes/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  195. data/assets/js/jquery/ui/themes/smoothness/jquery-ui-1.8.6.custom.css +572 -0
  196. data/assets/js/jquery/ui/themes/smoothness/jquery.ui.accordion.css +19 -0
  197. data/assets/js/jquery/ui/themes/smoothness/jquery.ui.all.css +11 -0
  198. data/assets/js/jquery/ui/themes/smoothness/jquery.ui.autocomplete.css +53 -0
  199. data/assets/js/jquery/ui/themes/smoothness/jquery.ui.base.css +11 -0
  200. data/assets/js/jquery/ui/themes/smoothness/jquery.ui.button.css +38 -0
  201. data/assets/js/jquery/ui/themes/smoothness/jquery.ui.core.css +41 -0
  202. data/assets/js/jquery/ui/themes/smoothness/jquery.ui.datepicker.css +68 -0
  203. data/assets/js/jquery/ui/themes/smoothness/jquery.ui.dialog.css +21 -0
  204. data/assets/js/jquery/ui/themes/smoothness/jquery.ui.progressbar.css +11 -0
  205. data/assets/js/jquery/ui/themes/smoothness/jquery.ui.resizable.css +20 -0
  206. data/assets/js/jquery/ui/themes/smoothness/jquery.ui.selectable.css +10 -0
  207. data/assets/js/jquery/ui/themes/smoothness/jquery.ui.slider.css +24 -0
  208. data/assets/js/jquery/ui/themes/smoothness/jquery.ui.tabs.css +18 -0
  209. data/assets/js/jquery/ui/themes/smoothness/jquery.ui.theme.css +254 -0
  210. data/bin/alfa +15 -0
  211. data/lib/alfa/application.rb +36 -0
  212. data/lib/alfa/cli_application.rb +11 -3
  213. data/lib/alfa/commands/new.rb +4 -0
  214. data/lib/alfa/config.rb +11 -0
  215. data/lib/alfa/controller.rb +1 -1
  216. data/lib/alfa/database/mysql.rb +60 -8
  217. data/lib/alfa/database.rb +2 -1
  218. data/lib/alfa/logger.rb +38 -0
  219. data/lib/alfa/models/base.rb +1 -1
  220. data/lib/alfa/models/base_sql.rb +1 -1
  221. data/lib/alfa/models/dummy.rb +1 -1
  222. data/lib/alfa/models/mysql.rb +36 -26
  223. data/lib/alfa/models.rb +1 -1
  224. data/lib/alfa/query_logger.rb +29 -0
  225. data/lib/alfa/router.rb +155 -0
  226. data/lib/alfa/support.rb +58 -2
  227. data/lib/alfa/tfile.rb +97 -0
  228. data/lib/alfa/web_application.rb +106 -85
  229. data/lib/alfa.rb +1 -1
  230. data/lib/ruty/bugfix.rb +21 -0
  231. data/lib/ruty/tags/resources.rb +45 -2
  232. data/lib/ruty/upgrade.rb +61 -0
  233. data/test/data/test_router/config/routes.rb +4 -0
  234. data/test/test_alfa.rb +1 -52
  235. data/test/test_router.rb +132 -0
  236. data/test/test_support.rb +26 -0
  237. data/test/test_tfile.rb +186 -0
  238. metadata +259 -100
@@ -0,0 +1,1136 @@
1
+ /*
2
+ * FancyBox - jQuery Plugin
3
+ * Simple and fancy lightbox alternative
4
+ *
5
+ * Examples and documentation at: http://fancybox.net
6
+ *
7
+ * Copyright (c) 2008 - 2010 Janis Skarnelis
8
+ * That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated.
9
+ *
10
+ * Version: 1.3.2 (20/10/2010)
11
+ * Requires: jQuery v1.3+
12
+ *
13
+ * Dual licensed under the MIT and GPL licenses:
14
+ * http://www.opensource.org/licenses/mit-license.php
15
+ * http://www.gnu.org/licenses/gpl.html
16
+ */
17
+
18
+ ;(function($) {
19
+ var tmp, loading, overlay, wrap, outer, content, close, title, nav_left, nav_right,
20
+
21
+ selectedIndex = 0, selectedOpts = {}, selectedArray = [], currentIndex = 0, currentOpts = {}, currentArray = [],
22
+
23
+ ajaxLoader = null, imgPreloader = new Image(), imgRegExp = /\.(jpg|gif|png|bmp|jpeg)(.*)?$/i, swfRegExp = /[^\.]\.(swf)\s*$/i,
24
+
25
+ loadingTimer, loadingFrame = 1,
26
+
27
+ titleHeight = 0, titleStr = '', start_pos, final_pos, busy = false, fx = $.extend($('<div/>')[0], { prop: 0 }),
28
+
29
+ isIE6 = $.browser.msie && $.browser.version < 7 && !window.XMLHttpRequest,
30
+
31
+ /*
32
+ * Private methods
33
+ */
34
+
35
+ _abort = function() {
36
+ loading.hide();
37
+
38
+ imgPreloader.onerror = imgPreloader.onload = null;
39
+
40
+ if (ajaxLoader) {
41
+ ajaxLoader.abort();
42
+ }
43
+
44
+ tmp.empty();
45
+ },
46
+
47
+ _error = function() {
48
+ if (false === selectedOpts.onError(selectedArray, selectedIndex, selectedOpts)) {
49
+ loading.hide();
50
+ busy = false;
51
+ return;
52
+ }
53
+
54
+ selectedOpts.titleShow = false;
55
+
56
+ selectedOpts.width = 'auto';
57
+ selectedOpts.height = 'auto';
58
+
59
+ tmp.html( '<p id="fancybox-error">The requested content cannot be loaded.<br />Please try again later.</p>' );
60
+
61
+ _process_inline();
62
+ },
63
+
64
+ _start = function() {
65
+ var obj = selectedArray[ selectedIndex ],
66
+ href,
67
+ type,
68
+ title,
69
+ str,
70
+ emb,
71
+ ret;
72
+
73
+ _abort();
74
+
75
+ selectedOpts = $.extend({}, $.fn.fancybox.defaults, (typeof $(obj).data('fancybox') == 'undefined' ? selectedOpts : $(obj).data('fancybox')));
76
+
77
+ ret = selectedOpts.onStart(selectedArray, selectedIndex, selectedOpts);
78
+
79
+ if (ret === false) {
80
+ busy = false;
81
+ return;
82
+ } else if (typeof ret == 'object') {
83
+ selectedOpts = $.extend(selectedOpts, ret);
84
+ }
85
+
86
+ title = selectedOpts.title || (obj.nodeName ? $(obj).attr('title') : obj.title) || '';
87
+
88
+ if (obj.nodeName && !selectedOpts.orig) {
89
+ selectedOpts.orig = $(obj).children("img:first").length ? $(obj).children("img:first") : $(obj);
90
+ }
91
+
92
+ if (title === '' && selectedOpts.orig && selectedOpts.titleFromAlt) {
93
+ title = selectedOpts.orig.attr('alt');
94
+ }
95
+
96
+ href = selectedOpts.href || (obj.nodeName ? $(obj).attr('href') : obj.href) || null;
97
+
98
+ if ((/^(?:javascript)/i).test(href) || href == '#') {
99
+ href = null;
100
+ }
101
+
102
+ if (selectedOpts.type) {
103
+ type = selectedOpts.type;
104
+
105
+ if (!href) {
106
+ href = selectedOpts.content;
107
+ }
108
+
109
+ } else if (selectedOpts.content) {
110
+ type = 'html';
111
+
112
+ } else if (href) {
113
+ if (href.match(imgRegExp)) {
114
+ type = 'image';
115
+
116
+ } else if (href.match(swfRegExp)) {
117
+ type = 'swf';
118
+
119
+ } else if ($(obj).hasClass("iframe")) {
120
+ type = 'iframe';
121
+
122
+ } else if (href.indexOf("#") === 0) {
123
+ type = 'inline';
124
+
125
+ } else {
126
+ type = 'ajax';
127
+ }
128
+ }
129
+
130
+ if (!type) {
131
+ _error();
132
+ return;
133
+ }
134
+
135
+ if (type == 'inline') {
136
+ obj = href.substr(href.indexOf("#"));
137
+ type = $(obj).length > 0 ? 'inline' : 'ajax';
138
+ }
139
+
140
+ selectedOpts.type = type;
141
+ selectedOpts.href = href;
142
+ selectedOpts.title = title;
143
+
144
+ if (selectedOpts.autoDimensions && selectedOpts.type !== 'iframe' && selectedOpts.type !== 'swf') {
145
+ selectedOpts.width = 'auto';
146
+ selectedOpts.height = 'auto';
147
+ }
148
+
149
+ if (selectedOpts.modal) {
150
+ selectedOpts.overlayShow = true;
151
+ selectedOpts.hideOnOverlayClick = false;
152
+ selectedOpts.hideOnContentClick = false;
153
+ selectedOpts.enableEscapeButton = false;
154
+ selectedOpts.showCloseButton = false;
155
+ }
156
+
157
+ selectedOpts.padding = parseInt(selectedOpts.padding, 10);
158
+ selectedOpts.margin = parseInt(selectedOpts.margin, 10);
159
+
160
+ tmp.css('padding', (selectedOpts.padding + selectedOpts.margin));
161
+
162
+ $('.fancybox-inline-tmp').unbind('fancybox-cancel').bind('fancybox-change', function() {
163
+ $(this).replaceWith(content.children());
164
+ });
165
+
166
+ switch (type) {
167
+ case 'html' :
168
+ tmp.html( selectedOpts.content );
169
+ _process_inline();
170
+ break;
171
+
172
+ case 'inline' :
173
+ if ( $(obj).parent().is('#fancybox-content') === true) {
174
+ busy = false;
175
+ return;
176
+ }
177
+
178
+ $('<div class="fancybox-inline-tmp" />')
179
+ .hide()
180
+ .insertBefore( $(obj) )
181
+ .bind('fancybox-cleanup', function() {
182
+ $(this).replaceWith(content.children());
183
+ }).bind('fancybox-cancel', function() {
184
+ $(this).replaceWith(tmp.children());
185
+ });
186
+
187
+ $(obj).appendTo(tmp);
188
+
189
+ _process_inline();
190
+ break;
191
+
192
+ case 'image':
193
+ busy = false;
194
+
195
+ $.fancybox.showActivity();
196
+
197
+ imgPreloader = new Image();
198
+
199
+ imgPreloader.onerror = function() {
200
+ _error();
201
+ };
202
+
203
+ imgPreloader.onload = function() {
204
+ busy = true;
205
+
206
+ imgPreloader.onerror = imgPreloader.onload = null;
207
+
208
+ _process_image();
209
+ };
210
+
211
+ imgPreloader.src = href;
212
+ break;
213
+
214
+ case 'swf':
215
+ str = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + selectedOpts.width + '" height="' + selectedOpts.height + '"><param name="movie" value="' + href + '"></param>';
216
+ emb = '';
217
+
218
+ $.each(selectedOpts.swf, function(name, val) {
219
+ str += '<param name="' + name + '" value="' + val + '"></param>';
220
+ emb += ' ' + name + '="' + val + '"';
221
+ });
222
+
223
+ str += '<embed src="' + href + '" type="application/x-shockwave-flash" width="' + selectedOpts.width + '" height="' + selectedOpts.height + '"' + emb + '></embed></object>';
224
+
225
+ tmp.html(str);
226
+
227
+ _process_inline();
228
+ break;
229
+
230
+ case 'ajax':
231
+ busy = false;
232
+
233
+ $.fancybox.showActivity();
234
+
235
+ selectedOpts.ajax.win = selectedOpts.ajax.success;
236
+
237
+ ajaxLoader = $.ajax($.extend({}, selectedOpts.ajax, {
238
+ url : href,
239
+ data : selectedOpts.ajax.data || {},
240
+ error : function(XMLHttpRequest, textStatus, errorThrown) {
241
+ if ( XMLHttpRequest.status > 0 ) {
242
+ _error();
243
+ }
244
+ },
245
+ success : function(data, textStatus, XMLHttpRequest) {
246
+ if ( XMLHttpRequest.status == 200 ) {
247
+ if ( typeof selectedOpts.ajax.win == 'function' ) {
248
+ ret = selectedOpts.ajax.win(href, data, textStatus, XMLHttpRequest);
249
+
250
+ if (ret === false) {
251
+ loading.hide();
252
+ return;
253
+ } else if (typeof ret == 'string' || typeof ret == 'object') {
254
+ data = ret;
255
+ }
256
+ }
257
+
258
+ tmp.html( data );
259
+ _process_inline();
260
+ }
261
+ }
262
+ }));
263
+
264
+ break;
265
+
266
+ case 'iframe' :
267
+ _show();
268
+ break;
269
+ }
270
+ },
271
+
272
+ _process_inline = function() {
273
+ tmp.width( selectedOpts.width );
274
+ tmp.height( selectedOpts.height );
275
+
276
+ if (selectedOpts.width == 'auto') {
277
+ selectedOpts.width = tmp.width();
278
+ }
279
+
280
+ if (selectedOpts.height == 'auto') {
281
+ selectedOpts.height = tmp.height();
282
+ }
283
+
284
+ _show();
285
+ },
286
+
287
+ _process_image = function() {
288
+ selectedOpts.width = imgPreloader.width;
289
+ selectedOpts.height = imgPreloader.height;
290
+
291
+ $("<img />").attr({
292
+ 'id' : 'fancybox-img',
293
+ 'src' : imgPreloader.src,
294
+ 'alt' : selectedOpts.title
295
+ }).appendTo( tmp );
296
+
297
+ _show();
298
+ },
299
+
300
+ _show = function() {
301
+ var pos, equal;
302
+
303
+ loading.hide();
304
+
305
+ if (wrap.is(":visible") && false === currentOpts.onCleanup(currentArray, currentIndex, currentOpts)) {
306
+ $.event.trigger('fancybox-cancel');
307
+
308
+ busy = false;
309
+ return;
310
+ }
311
+
312
+ busy = true;
313
+
314
+ $(content.add( overlay )).unbind();
315
+
316
+ $(window).unbind("resize.fb scroll.fb");
317
+ $(document).unbind('keydown.fb');
318
+
319
+ if (wrap.is(":visible") && currentOpts.titlePosition !== 'outside') {
320
+ wrap.css('height', wrap.height());
321
+ }
322
+
323
+ currentArray = selectedArray;
324
+ currentIndex = selectedIndex;
325
+ currentOpts = selectedOpts;
326
+
327
+ if (currentOpts.overlayShow) {
328
+ overlay.css({
329
+ 'background-color' : currentOpts.overlayColor,
330
+ 'opacity' : currentOpts.overlayOpacity,
331
+ 'cursor' : currentOpts.hideOnOverlayClick ? 'pointer' : 'auto',
332
+ 'height' : $(document).height()
333
+ });
334
+
335
+ if (!overlay.is(':visible')) {
336
+ if (isIE6) {
337
+ $('select:not(#fancybox-tmp select)').filter(function() {
338
+ return this.style.visibility !== 'hidden';
339
+ }).css({'visibility' : 'hidden'}).one('fancybox-cleanup', function() {
340
+ this.style.visibility = 'inherit';
341
+ });
342
+ }
343
+
344
+ overlay.show();
345
+ }
346
+ } else {
347
+ overlay.hide();
348
+ }
349
+
350
+ content.get(0).scrollTop = 0;
351
+ content.get(0).scrollLeft = 0;
352
+
353
+ final_pos = _get_zoom_to();
354
+
355
+ _process_title();
356
+
357
+ if (wrap.is(":visible")) {
358
+ $( close.add( nav_left ).add( nav_right ) ).hide();
359
+
360
+ pos = wrap.position(),
361
+
362
+ start_pos = {
363
+ top : pos.top,
364
+ left : pos.left,
365
+ width : wrap.width(),
366
+ height : wrap.height()
367
+ };
368
+
369
+ equal = (start_pos.width == final_pos.width && start_pos.height == final_pos.height);
370
+
371
+ content.fadeTo(currentOpts.changeFade, 0.3, function() {
372
+ var finish_resizing = function() {
373
+ content.html( tmp.contents() ).fadeTo(currentOpts.changeFade, 1, _finish);
374
+ };
375
+
376
+ $.event.trigger('fancybox-change');
377
+
378
+ content
379
+ .empty()
380
+ .removeAttr('filter')
381
+ .css({
382
+ 'border-width' : currentOpts.padding,
383
+ 'width' : final_pos.width - currentOpts.padding * 2,
384
+ 'height' : currentOpts.type == 'image' || currentOpts.type == 'swf' || currentOpts.type == 'iframe' ? final_pos.height - titleHeight - currentOpts.padding * 2 : 'auto'
385
+ });
386
+
387
+ if (equal) {
388
+ finish_resizing();
389
+
390
+ } else {
391
+ fx.prop = 0;
392
+
393
+ $(fx).animate({prop: 1}, {
394
+ duration : currentOpts.changeSpeed,
395
+ easing : currentOpts.easingChange,
396
+ step : _draw,
397
+ complete : finish_resizing
398
+ });
399
+ }
400
+ });
401
+
402
+ return;
403
+ }
404
+
405
+ wrap.removeAttr("style");
406
+
407
+ content.css('border-width', currentOpts.padding);
408
+
409
+ if (currentOpts.transitionIn == 'elastic') {
410
+ start_pos = _get_zoom_from();
411
+
412
+ content.html( tmp.contents() );
413
+
414
+ wrap.show();
415
+
416
+ if (currentOpts.opacity) {
417
+ final_pos.opacity = 0;
418
+ }
419
+
420
+ fx.prop = 0;
421
+
422
+ $(fx).animate({prop: 1}, {
423
+ duration : currentOpts.speedIn,
424
+ easing : currentOpts.easingIn,
425
+ step : _draw,
426
+ complete : _finish
427
+ });
428
+
429
+ return;
430
+ }
431
+
432
+ if (currentOpts.titlePosition == 'inside' && titleHeight > 0) {
433
+ title.show();
434
+ }
435
+
436
+ content
437
+ .css({
438
+ 'width' : final_pos.width - currentOpts.padding * 2,
439
+ 'height' : currentOpts.type == 'image' || currentOpts.type == 'swf' || currentOpts.type == 'iframe' ? final_pos.height - titleHeight - currentOpts.padding * 2 : 'auto'
440
+ })
441
+ .html( tmp.contents() );
442
+
443
+ wrap
444
+ .css(final_pos)
445
+ .fadeIn( currentOpts.transitionIn == 'none' ? 0 : currentOpts.fadeIn, _finish );
446
+ },
447
+
448
+ _format_title = function(title) {
449
+ if (title && title.length) {
450
+ if (currentOpts.titlePosition == 'float') {
451
+ return '<table id="fancybox-title-float-wrap" cellpadding="0" cellspacing="0"><tr><td id="fancybox-title-float-left"></td><td id="fancybox-title-float-main">' + title + '</td><td id="fancybox-title-float-right"></td></tr></table>';
452
+ }
453
+
454
+ return '<div id="fancybox-title-' + currentOpts.titlePosition + '">' + title + '</div>';
455
+ }
456
+
457
+ return false;
458
+ },
459
+
460
+ _process_title = function() {
461
+ titleStr = currentOpts.title || '';
462
+ titleHeight = 0;
463
+
464
+ title
465
+ .empty()
466
+ .removeAttr('style')
467
+ .removeClass();
468
+
469
+ if (currentOpts.titleShow === false) {
470
+ title.hide();
471
+ return;
472
+ }
473
+
474
+ titleStr = $.isFunction(currentOpts.titleFormat) ? currentOpts.titleFormat(titleStr, currentArray, currentIndex, currentOpts) : _format_title(titleStr);
475
+
476
+ if (!titleStr || titleStr === '') {
477
+ title.hide();
478
+ return;
479
+ }
480
+
481
+ title
482
+ .addClass('fancybox-title-' + currentOpts.titlePosition)
483
+ .html( titleStr )
484
+ .appendTo( 'body' )
485
+ .show();
486
+
487
+ switch (currentOpts.titlePosition) {
488
+ case 'inside':
489
+ title
490
+ .css({
491
+ 'width' : final_pos.width - (currentOpts.padding * 2),
492
+ 'marginLeft' : currentOpts.padding,
493
+ 'marginRight' : currentOpts.padding
494
+ });
495
+
496
+ titleHeight = title.outerHeight(true);
497
+
498
+ title.appendTo( outer );
499
+
500
+ final_pos.height += titleHeight;
501
+ break;
502
+
503
+ case 'over':
504
+ title
505
+ .css({
506
+ 'marginLeft' : currentOpts.padding,
507
+ 'width' : final_pos.width - (currentOpts.padding * 2),
508
+ 'bottom' : currentOpts.padding
509
+ })
510
+ .appendTo( outer );
511
+ break;
512
+
513
+ case 'float':
514
+ title
515
+ .css('left', parseInt((title.width() - final_pos.width - 40)/ 2, 10) * -1)
516
+ .appendTo( wrap );
517
+ break;
518
+
519
+ default:
520
+ title
521
+ .css({
522
+ 'width' : final_pos.width - (currentOpts.padding * 2),
523
+ 'paddingLeft' : currentOpts.padding,
524
+ 'paddingRight' : currentOpts.padding
525
+ })
526
+ .appendTo( wrap );
527
+ break;
528
+ }
529
+
530
+ title.hide();
531
+ },
532
+
533
+ _set_navigation = function() {
534
+ if (currentOpts.enableEscapeButton || currentOpts.enableKeyboardNav) {
535
+ $(document).bind('keydown.fb', function(e) {
536
+ if (e.keyCode == 27 && currentOpts.enableEscapeButton) {
537
+ e.preventDefault();
538
+ $.fancybox.close();
539
+
540
+ } else if ((e.keyCode == 37 || e.keyCode == 39) && currentOpts.enableKeyboardNav && e.target.tagName !== 'INPUT' && e.target.tagName !== 'TEXTAREA' && e.target.tagName !== 'SELECT') {
541
+ e.preventDefault();
542
+ $.fancybox[ e.keyCode == 37 ? 'prev' : 'next']();
543
+ }
544
+ });
545
+ }
546
+
547
+ if (!currentOpts.showNavArrows) {
548
+ nav_left.hide();
549
+ nav_right.hide();
550
+ return;
551
+ }
552
+
553
+ if ((currentOpts.cyclic && currentArray.length > 1) || currentIndex !== 0) {
554
+ nav_left.show();
555
+ }
556
+
557
+ if ((currentOpts.cyclic && currentArray.length > 1) || currentIndex != (currentArray.length -1)) {
558
+ nav_right.show();
559
+ }
560
+ },
561
+
562
+ _finish = function () {
563
+ if (!$.support.opacity) {
564
+ content.get(0).style.removeAttribute('filter');
565
+ wrap.get(0).style.removeAttribute('filter');
566
+ }
567
+
568
+ wrap.css('height', 'auto');
569
+
570
+ if (currentOpts.type !== 'image' && currentOpts.type !== 'swf' && currentOpts.type !== 'iframe') {
571
+ content.css('height', 'auto');
572
+ }
573
+
574
+ if (titleStr && titleStr.length) {
575
+ title.show();
576
+ }
577
+
578
+ if (currentOpts.showCloseButton) {
579
+ close.show();
580
+ }
581
+
582
+ _set_navigation();
583
+
584
+ if (currentOpts.hideOnContentClick) {
585
+ content.bind('click', $.fancybox.close);
586
+ }
587
+
588
+ if (currentOpts.hideOnOverlayClick) {
589
+ overlay.bind('click', $.fancybox.close);
590
+ }
591
+
592
+ $(window).bind("resize.fb", $.fancybox.resize);
593
+
594
+ if (currentOpts.centerOnScroll) {
595
+ $(window).bind("scroll.fb", $.fancybox.center);
596
+ }
597
+
598
+ if (currentOpts.type == 'iframe') {
599
+ $('<iframe id="fancybox-frame" name="fancybox-frame' + new Date().getTime() + '" frameborder="0" hspace="0" ' + ($.browser.msie ? 'allowtransparency="true""' : '') + ' scrolling="' + selectedOpts.scrolling + '" src="' + currentOpts.href + '"></iframe>').appendTo(content);
600
+ }
601
+
602
+ wrap.show();
603
+
604
+ busy = false;
605
+
606
+ $.fancybox.center();
607
+
608
+ currentOpts.onComplete(currentArray, currentIndex, currentOpts);
609
+
610
+ _preload_images();
611
+ },
612
+
613
+ _preload_images = function() {
614
+ var href,
615
+ objNext;
616
+
617
+ if ((currentArray.length -1) > currentIndex) {
618
+ href = currentArray[ currentIndex + 1 ].href;
619
+
620
+ if (typeof href !== 'undefined' && href.match(imgRegExp)) {
621
+ objNext = new Image();
622
+ objNext.src = href;
623
+ }
624
+ }
625
+
626
+ if (currentIndex > 0) {
627
+ href = currentArray[ currentIndex - 1 ].href;
628
+
629
+ if (typeof href !== 'undefined' && href.match(imgRegExp)) {
630
+ objNext = new Image();
631
+ objNext.src = href;
632
+ }
633
+ }
634
+ },
635
+
636
+ _draw = function(pos) {
637
+ var dim = {
638
+ width : parseInt(start_pos.width + (final_pos.width - start_pos.width) * pos, 10),
639
+ height : parseInt(start_pos.height + (final_pos.height - start_pos.height) * pos, 10),
640
+
641
+ top : parseInt(start_pos.top + (final_pos.top - start_pos.top) * pos, 10),
642
+ left : parseInt(start_pos.left + (final_pos.left - start_pos.left) * pos, 10)
643
+ };
644
+
645
+ if (typeof final_pos.opacity !== 'undefined') {
646
+ dim.opacity = pos < 0.5 ? 0.5 : pos;
647
+ }
648
+
649
+ wrap.css(dim);
650
+
651
+ content.css({
652
+ 'width' : dim.width - currentOpts.padding * 2,
653
+ 'height' : dim.height - (titleHeight * pos) - currentOpts.padding * 2
654
+ });
655
+ },
656
+
657
+ _get_viewport = function() {
658
+ return [
659
+ $(window).width() - (currentOpts.margin * 2),
660
+ $(window).height() - (currentOpts.margin * 2),
661
+ $(document).scrollLeft() + currentOpts.margin,
662
+ $(document).scrollTop() + currentOpts.margin
663
+ ];
664
+ },
665
+
666
+ _get_zoom_to = function () {
667
+ var view = _get_viewport(),
668
+ to = {},
669
+ resize = currentOpts.autoScale,
670
+ double_padding = currentOpts.padding * 2,
671
+ ratio;
672
+
673
+ if (currentOpts.width.toString().indexOf('%') > -1) {
674
+ to.width = parseInt((view[0] * parseFloat(currentOpts.width)) / 100, 10);
675
+ } else {
676
+ to.width = currentOpts.width + double_padding;
677
+ }
678
+
679
+ if (currentOpts.height.toString().indexOf('%') > -1) {
680
+ to.height = parseInt((view[1] * parseFloat(currentOpts.height)) / 100, 10);
681
+ } else {
682
+ to.height = currentOpts.height + double_padding;
683
+ }
684
+
685
+ if (resize && (to.width > view[0] || to.height > view[1])) {
686
+ if (selectedOpts.type == 'image' || selectedOpts.type == 'swf') {
687
+ ratio = (currentOpts.width ) / (currentOpts.height );
688
+
689
+ if ((to.width ) > view[0]) {
690
+ to.width = view[0];
691
+ to.height = parseInt(((to.width - double_padding) / ratio) + double_padding, 10);
692
+ }
693
+
694
+ if ((to.height) > view[1]) {
695
+ to.height = view[1];
696
+ to.width = parseInt(((to.height - double_padding) * ratio) + double_padding, 10);
697
+ }
698
+
699
+ } else {
700
+ to.width = Math.min(to.width, view[0]);
701
+ to.height = Math.min(to.height, view[1]);
702
+ }
703
+ }
704
+
705
+ to.top = parseInt(Math.max(view[3] - 20, view[3] + ((view[1] - to.height - 40) * 0.5)), 10);
706
+ to.left = parseInt(Math.max(view[2] - 20, view[2] + ((view[0] - to.width - 40) * 0.5)), 10);
707
+
708
+ return to;
709
+ },
710
+
711
+ _get_obj_pos = function(obj) {
712
+ var pos = obj.offset();
713
+
714
+ pos.top += parseInt( obj.css('paddingTop'), 10 ) || 0;
715
+ pos.left += parseInt( obj.css('paddingLeft'), 10 ) || 0;
716
+
717
+ pos.top += parseInt( obj.css('border-top-width'), 10 ) || 0;
718
+ pos.left += parseInt( obj.css('border-left-width'), 10 ) || 0;
719
+
720
+ pos.width = obj.width();
721
+ pos.height = obj.height();
722
+
723
+ return pos;
724
+ },
725
+
726
+ _get_zoom_from = function() {
727
+ var orig = selectedOpts.orig ? $(selectedOpts.orig) : false,
728
+ from = {},
729
+ pos,
730
+ view;
731
+
732
+ if (orig && orig.length) {
733
+ pos = _get_obj_pos(orig);
734
+
735
+ from = {
736
+ width : pos.width + (currentOpts.padding * 2),
737
+ height : pos.height + (currentOpts.padding * 2),
738
+ top : pos.top - currentOpts.padding - 20,
739
+ left : pos.left - currentOpts.padding - 20
740
+ };
741
+
742
+ } else {
743
+ view = _get_viewport();
744
+
745
+ from = {
746
+ width : currentOpts.padding * 2,
747
+ height : currentOpts.padding * 2,
748
+ top : parseInt(view[3] + view[1] * 0.5, 10),
749
+ left : parseInt(view[2] + view[0] * 0.5, 10)
750
+ };
751
+ }
752
+
753
+ return from;
754
+ },
755
+
756
+ _animate_loading = function() {
757
+ if (!loading.is(':visible')){
758
+ clearInterval(loadingTimer);
759
+ return;
760
+ }
761
+
762
+ $('div', loading).css('top', (loadingFrame * -40) + 'px');
763
+
764
+ loadingFrame = (loadingFrame + 1) % 12;
765
+ };
766
+
767
+ /*
768
+ * Public methods
769
+ */
770
+
771
+ $.fn.fancybox = function(options) {
772
+ if (!$(this).length) {
773
+ return this;
774
+ }
775
+
776
+ $(this)
777
+ .data('fancybox', $.extend({}, options, ($.metadata ? $(this).metadata() : {})))
778
+ .unbind('click.fb')
779
+ .bind('click.fb', function(e) {
780
+ e.preventDefault();
781
+
782
+ if (busy) {
783
+ return;
784
+ }
785
+
786
+ busy = true;
787
+
788
+ $(this).blur();
789
+
790
+ selectedArray = [];
791
+ selectedIndex = 0;
792
+
793
+ var rel = $(this).attr('rel') || '';
794
+
795
+ if (!rel || rel == '' || rel === 'nofollow') {
796
+ selectedArray.push(this);
797
+
798
+ } else {
799
+ selectedArray = $("a[rel=" + rel + "], area[rel=" + rel + "]");
800
+ selectedIndex = selectedArray.index( this );
801
+ }
802
+
803
+ _start();
804
+
805
+ return;
806
+ });
807
+
808
+ return this;
809
+ };
810
+
811
+ $.fancybox = function(obj) {
812
+ var opts;
813
+
814
+ if (busy) {
815
+ return;
816
+ }
817
+
818
+ busy = true;
819
+ opts = typeof arguments[1] !== 'undefined' ? arguments[1] : {};
820
+
821
+ selectedArray = [];
822
+ selectedIndex = parseInt(opts.index, 10) || 0;
823
+
824
+ if ($.isArray(obj)) {
825
+ for (var i = 0, j = obj.length; i < j; i++) {
826
+ if (typeof obj[i] == 'object') {
827
+ $(obj[i]).data('fancybox', $.extend({}, opts, obj[i]));
828
+ } else {
829
+ obj[i] = $({}).data('fancybox', $.extend({content : obj[i]}, opts));
830
+ }
831
+ }
832
+
833
+ selectedArray = jQuery.merge(selectedArray, obj);
834
+
835
+ } else {
836
+ if (typeof obj == 'object') {
837
+ $(obj).data('fancybox', $.extend({}, opts, obj));
838
+ } else {
839
+ obj = $({}).data('fancybox', $.extend({content : obj}, opts));
840
+ }
841
+
842
+ selectedArray.push(obj);
843
+ }
844
+
845
+ if (selectedIndex > selectedArray.length || selectedIndex < 0) {
846
+ selectedIndex = 0;
847
+ }
848
+
849
+ _start();
850
+ };
851
+
852
+ $.fancybox.showActivity = function() {
853
+ clearInterval(loadingTimer);
854
+
855
+ loading.show();
856
+ loadingTimer = setInterval(_animate_loading, 66);
857
+ };
858
+
859
+ $.fancybox.hideActivity = function() {
860
+ loading.hide();
861
+ };
862
+
863
+ $.fancybox.next = function() {
864
+ return $.fancybox.pos( currentIndex + 1);
865
+ };
866
+
867
+ $.fancybox.prev = function() {
868
+ return $.fancybox.pos( currentIndex - 1);
869
+ };
870
+
871
+ $.fancybox.pos = function(pos) {
872
+ if (busy) {
873
+ return;
874
+ }
875
+
876
+ pos = parseInt(pos);
877
+
878
+ selectedArray = currentArray;
879
+
880
+ if (pos > -1 && pos < currentArray.length) {
881
+ selectedIndex = pos;
882
+ _start();
883
+
884
+ } else if (currentOpts.cyclic && currentArray.length > 1) {
885
+ selectedIndex = pos >= currentArray.length ? 0 : currentArray.length - 1;
886
+ _start();
887
+ }
888
+
889
+ return;
890
+ };
891
+
892
+ $.fancybox.cancel = function() {
893
+ if (busy) {
894
+ return;
895
+ }
896
+
897
+ busy = true;
898
+
899
+ $.event.trigger('fancybox-cancel');
900
+
901
+ _abort();
902
+
903
+ selectedOpts.onCancel(selectedArray, selectedIndex, selectedOpts);
904
+
905
+ busy = false;
906
+ };
907
+
908
+ // Note: within an iframe use - parent.$.fancybox.close();
909
+ $.fancybox.close = function() {
910
+ if (busy || wrap.is(':hidden')) {
911
+ return;
912
+ }
913
+
914
+ busy = true;
915
+
916
+ if (currentOpts && false === currentOpts.onCleanup(currentArray, currentIndex, currentOpts)) {
917
+ busy = false;
918
+ return;
919
+ }
920
+
921
+ _abort();
922
+
923
+ $(close.add( nav_left ).add( nav_right )).hide();
924
+
925
+ $(content.add( overlay )).unbind();
926
+
927
+ $(window).unbind("resize.fb scroll.fb");
928
+ $(document).unbind('keydown.fb');
929
+
930
+ content.find('iframe').attr('src', isIE6 && /^https/i.test(window.location.href || '') ? 'javascript:void(false)' : 'about:blank');
931
+
932
+ if (currentOpts.titlePosition !== 'inside') {
933
+ title.empty();
934
+ }
935
+
936
+ wrap.stop();
937
+
938
+ function _cleanup() {
939
+ overlay.fadeOut('fast');
940
+
941
+ title.empty().hide();
942
+ wrap.hide();
943
+
944
+ $.event.trigger('fancybox-cleanup');
945
+
946
+ content.empty();
947
+
948
+ currentOpts.onClosed(currentArray, currentIndex, currentOpts);
949
+
950
+ currentArray = selectedOpts = [];
951
+ currentIndex = selectedIndex = 0;
952
+ currentOpts = selectedOpts = {};
953
+
954
+ busy = false;
955
+ }
956
+
957
+ if (currentOpts.transitionOut == 'elastic') {
958
+ start_pos = _get_zoom_from();
959
+
960
+ var pos = wrap.position();
961
+
962
+ final_pos = {
963
+ top : pos.top ,
964
+ left : pos.left,
965
+ width : wrap.width(),
966
+ height : wrap.height()
967
+ };
968
+
969
+ if (currentOpts.opacity) {
970
+ final_pos.opacity = 1;
971
+ }
972
+
973
+ title.empty().hide();
974
+
975
+ fx.prop = 1;
976
+
977
+ $(fx).animate({ prop: 0 }, {
978
+ duration : currentOpts.speedOut,
979
+ easing : currentOpts.easingOut,
980
+ step : _draw,
981
+ complete : _cleanup
982
+ });
983
+
984
+ } else {
985
+ wrap.fadeOut( currentOpts.transitionOut == 'none' ? 0 : currentOpts.speedOut, _cleanup);
986
+ }
987
+ };
988
+
989
+ $.fancybox.resize = function() {
990
+ if (overlay.is(':visible')) {
991
+ overlay.css('height', $(document).height());
992
+ }
993
+
994
+ $.fancybox.center(true);
995
+ };
996
+
997
+ $.fancybox.center = function() {
998
+ var view, align;
999
+
1000
+ if (busy) {
1001
+ return;
1002
+ }
1003
+
1004
+ align = arguments[0] === true ? 1 : 0;
1005
+ view = _get_viewport();
1006
+
1007
+ if (!align && (wrap.width() > view[0] || wrap.height() > view[1])) {
1008
+ return;
1009
+ }
1010
+
1011
+ wrap
1012
+ .stop()
1013
+ .animate({
1014
+ 'top' : parseInt(Math.max(view[3] - 20, view[3] + ((view[1] - content.height() - 40) * 0.5) - currentOpts.padding)),
1015
+ 'left' : parseInt(Math.max(view[2] - 20, view[2] + ((view[0] - content.width() - 40) * 0.5) - currentOpts.padding))
1016
+ }, typeof arguments[0] == 'number' ? arguments[0] : 200);
1017
+ };
1018
+
1019
+ $.fancybox.init = function() {
1020
+ if ($("#fancybox-wrap").length) {
1021
+ return;
1022
+ }
1023
+
1024
+ $('body').append(
1025
+ tmp = $('<div id="fancybox-tmp"></div>'),
1026
+ loading = $('<div id="fancybox-loading"><div></div></div>'),
1027
+ overlay = $('<div id="fancybox-overlay"></div>'),
1028
+ wrap = $('<div id="fancybox-wrap"></div>')
1029
+ );
1030
+
1031
+ outer = $('<div id="fancybox-outer"></div>')
1032
+ .append('<div class="fancybox-bg" id="fancybox-bg-n"></div><div class="fancybox-bg" id="fancybox-bg-ne"></div><div class="fancybox-bg" id="fancybox-bg-e"></div><div class="fancybox-bg" id="fancybox-bg-se"></div><div class="fancybox-bg" id="fancybox-bg-s"></div><div class="fancybox-bg" id="fancybox-bg-sw"></div><div class="fancybox-bg" id="fancybox-bg-w"></div><div class="fancybox-bg" id="fancybox-bg-nw"></div>')
1033
+ .appendTo( wrap );
1034
+
1035
+ outer.append(
1036
+ content = $('<div id="fancybox-content"></div>'),
1037
+ close = $('<a id="fancybox-close"></a>'),
1038
+ title = $('<div id="fancybox-title"></div>'),
1039
+
1040
+ nav_left = $('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),
1041
+ nav_right = $('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>')
1042
+ );
1043
+
1044
+ close.click($.fancybox.close);
1045
+ loading.click($.fancybox.cancel);
1046
+
1047
+ nav_left.click(function(e) {
1048
+ e.preventDefault();
1049
+ $.fancybox.prev();
1050
+ });
1051
+
1052
+ nav_right.click(function(e) {
1053
+ e.preventDefault();
1054
+ $.fancybox.next();
1055
+ });
1056
+
1057
+ if ($.fn.mousewheel) {
1058
+ wrap.bind('mousewheel.fb', function(e, delta) {
1059
+ e.preventDefault();
1060
+
1061
+ $.fancybox[ delta > 0 ? 'prev' : 'next']();
1062
+ });
1063
+ }
1064
+
1065
+ if (!$.support.opacity) {
1066
+ wrap.addClass('fancybox-ie');
1067
+ }
1068
+
1069
+ if (isIE6) {
1070
+ loading.addClass('fancybox-ie6');
1071
+ wrap.addClass('fancybox-ie6');
1072
+
1073
+ $('<iframe id="fancybox-hide-sel-frame" src="' + (/^https/i.test(window.location.href || '') ? 'javascript:void(false)' : 'about:blank' ) + '" scrolling="no" border="0" frameborder="0" tabindex="-1"></iframe>').prependTo(outer);
1074
+ }
1075
+ };
1076
+
1077
+ $.fn.fancybox.defaults = {
1078
+ padding : 10,
1079
+ margin : 40,
1080
+ opacity : false,
1081
+ modal : false,
1082
+ cyclic : false,
1083
+ scrolling : 'auto', // 'auto', 'yes' or 'no'
1084
+
1085
+ width : 560,
1086
+ height : 340,
1087
+
1088
+ autoScale : true,
1089
+ autoDimensions : true,
1090
+ centerOnScroll : false,
1091
+
1092
+ ajax : {},
1093
+ swf : { wmode: 'transparent' },
1094
+
1095
+ hideOnOverlayClick : true,
1096
+ hideOnContentClick : false,
1097
+
1098
+ overlayShow : true,
1099
+ overlayOpacity : 0.7,
1100
+ overlayColor : '#777',
1101
+
1102
+ titleShow : true,
1103
+ titlePosition : 'float', // 'float', 'outside', 'inside' or 'over'
1104
+ titleFormat : null,
1105
+ titleFromAlt : false,
1106
+
1107
+ transitionIn : 'fade', // 'elastic', 'fade' or 'none'
1108
+ transitionOut : 'fade', // 'elastic', 'fade' or 'none'
1109
+
1110
+ speedIn : 300,
1111
+ speedOut : 300,
1112
+
1113
+ changeSpeed : 300,
1114
+ changeFade : 'fast',
1115
+
1116
+ easingIn : 'swing',
1117
+ easingOut : 'swing',
1118
+
1119
+ showCloseButton : true,
1120
+ showNavArrows : true,
1121
+ enableEscapeButton : true,
1122
+ enableKeyboardNav : true,
1123
+
1124
+ onStart : function(){},
1125
+ onCancel : function(){},
1126
+ onComplete : function(){},
1127
+ onCleanup : function(){},
1128
+ onClosed : function(){},
1129
+ onError : function(){}
1130
+ };
1131
+
1132
+ $(document).ready(function() {
1133
+ $.fancybox.init();
1134
+ });
1135
+
1136
+ })(jQuery);