PageRenderTime 54ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 1ms

/js/src/lib/util/core/dom/html5/swfupload.js

https://bitbucket.org/1625/frontend
JavaScript | 1136 lines | 743 code | 182 blank | 211 comment | 95 complexity | a0d0ea38715e189e767f0c717b0febd5 MD5 | raw file

Large files files are truncated, but you can click here to view the full file

  1. /**
  2. * SWFUpload: http://www.swfupload.org, http://swfupload.googlecode.com
  3. *
  4. * mmSWFUpload 1.0: Flash upload dialog - http://profandesign.se/swfupload/, http://www.vinterwebb.se/
  5. *
  6. * SWFUpload is (c) 2006-2007 Lars Huring, Olov Nilz?n and Mammon Media and is released under the MIT License:
  7. * http://www.opensource.org/licenses/mit-license.php
  8. *
  9. * SWFUpload 2 is (c) 2007-2008 Jake Roberts and is released under the MIT License:
  10. * http://www.opensource.org/licenses/mit-license.php
  11. *
  12. * SWFObject v2.2 <http://code.google.com/p/swfobject/>
  13. * is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
  14. */
  15. define(function(require, exports, module) {
  16. /* ******************* */
  17. /* Constructor & Init */
  18. /* ******************* */
  19. var SWFUpload;
  20. var swfobject;
  21. if (SWFUpload == undefined) {
  22. SWFUpload = function (settings) {
  23. this.initSWFUpload(settings);
  24. };
  25. }
  26. SWFUpload.prototype.initSWFUpload = function (userSettings) {
  27. try {
  28. this.customSettings = {}; // A container where developers can place their own settings associated with this instance.
  29. this.settings = {};
  30. this.eventQueue = [];
  31. this.movieName = "SWFUpload_" + SWFUpload.movieCount++;
  32. this.movieElement = null;
  33. // Setup global control tracking
  34. SWFUpload.instances[this.movieName] = this;
  35. // Load the settings. Load the Flash movie.
  36. this.initSettings(userSettings);
  37. this.loadSupport();
  38. if (this.swfuploadPreload()) {
  39. this.loadFlash();
  40. }
  41. this.displayDebugInfo();
  42. } catch (ex) {
  43. delete SWFUpload.instances[this.movieName];
  44. throw ex;
  45. }
  46. };
  47. /* *************** */
  48. /* Static Members */
  49. /* *************** */
  50. SWFUpload.instances = {};
  51. SWFUpload.movieCount = 0;
  52. SWFUpload.version = "2.5.0 2010-01-15 Beta 2";
  53. SWFUpload.QUEUE_ERROR = {
  54. QUEUE_LIMIT_EXCEEDED : -100,
  55. FILE_EXCEEDS_SIZE_LIMIT : -110,
  56. ZERO_BYTE_FILE : -120,
  57. INVALID_FILETYPE : -130
  58. };
  59. SWFUpload.UPLOAD_ERROR = {
  60. HTTP_ERROR : -200,
  61. MISSING_UPLOAD_URL : -210,
  62. IO_ERROR : -220,
  63. SECURITY_ERROR : -230,
  64. UPLOAD_LIMIT_EXCEEDED : -240,
  65. UPLOAD_FAILED : -250,
  66. SPECIFIED_FILE_ID_NOT_FOUND : -260,
  67. FILE_VALIDATION_FAILED : -270,
  68. FILE_CANCELLED : -280,
  69. UPLOAD_STOPPED : -290,
  70. RESIZE : -300
  71. };
  72. SWFUpload.FILE_STATUS = {
  73. QUEUED : -1,
  74. IN_PROGRESS : -2,
  75. ERROR : -3,
  76. COMPLETE : -4,
  77. CANCELLED : -5
  78. };
  79. SWFUpload.UPLOAD_TYPE = {
  80. NORMAL : -1,
  81. RESIZED : -2
  82. };
  83. SWFUpload.BUTTON_ACTION = {
  84. SELECT_FILE : -100,
  85. SELECT_FILES : -110,
  86. START_UPLOAD : -120,
  87. JAVASCRIPT : -130, // DEPRECATED
  88. NONE : -130
  89. };
  90. SWFUpload.CURSOR = {
  91. ARROW : -1,
  92. HAND : -2
  93. };
  94. SWFUpload.WINDOW_MODE = {
  95. WINDOW : "window",
  96. TRANSPARENT : "transparent",
  97. OPAQUE : "opaque"
  98. };
  99. SWFUpload.RESIZE_ENCODING = {
  100. JPEG : -1,
  101. PNG : -2
  102. };
  103. // Private: takes a URL, determines if it is relative and converts to an absolute URL
  104. // using the current site. Only processes the URL if it can, otherwise returns the URL untouched
  105. SWFUpload.completeURL = function (url) {
  106. try {
  107. var path = "", indexSlash = -1;
  108. if (typeof(url) !== "string" || url.match(/^https?:\/\//i) || url.match(/^\//) || url === "") {
  109. return url;
  110. }
  111. indexSlash = window.location.pathname.lastIndexOf("/");
  112. if (indexSlash <= 0) {
  113. path = "/";
  114. } else {
  115. path = window.location.pathname.substr(0, indexSlash) + "/";
  116. }
  117. return path + url;
  118. } catch (ex) {
  119. return url;
  120. }
  121. };
  122. // Public: assign a new function to onload to use swfobject's domLoad functionality
  123. SWFUpload.onload = function () {};
  124. /* ******************** */
  125. /* Instance Members */
  126. /* ******************** */
  127. // Private: initSettings ensures that all the
  128. // settings are set, getting a default value if one was not assigned.
  129. SWFUpload.prototype.initSettings = function (userSettings) {
  130. this.ensureDefault = function (settingName, defaultValue) {
  131. var setting = userSettings[settingName];
  132. if (setting != undefined) {
  133. this.settings[settingName] = setting;
  134. } else {
  135. this.settings[settingName] = defaultValue;
  136. }
  137. };
  138. // Upload backend settings
  139. this.ensureDefault("upload_url", "");
  140. this.ensureDefault("preserve_relative_urls", false);
  141. this.ensureDefault("file_post_name", "Filedata");
  142. this.ensureDefault("post_params", {});
  143. this.ensureDefault("use_query_string", false);
  144. this.ensureDefault("requeue_on_error", false);
  145. this.ensureDefault("http_success", []);
  146. this.ensureDefault("assume_success_timeout", 0);
  147. // File Settings
  148. this.ensureDefault("file_types", "*.*");
  149. this.ensureDefault("file_types_description", "All Files");
  150. this.ensureDefault("file_size_limit", 0); // Default zero means "unlimited"
  151. this.ensureDefault("file_upload_limit", 0);
  152. this.ensureDefault("file_queue_limit", 0);
  153. // Flash Settings
  154. this.ensureDefault("flash_url", "swfupload.swf");
  155. this.ensureDefault("flash9_url", "swfupload_fp9.swf");
  156. this.ensureDefault("prevent_swf_caching", true);
  157. // Button Settings
  158. this.ensureDefault("button_image_url", "");
  159. this.ensureDefault("button_width", 1);
  160. this.ensureDefault("button_height", 1);
  161. this.ensureDefault("button_text", "");
  162. this.ensureDefault("button_text_style", "color: #000000; font-size: 16pt;");
  163. this.ensureDefault("button_text_top_padding", 0);
  164. this.ensureDefault("button_text_left_padding", 0);
  165. this.ensureDefault("button_action", SWFUpload.BUTTON_ACTION.SELECT_FILES);
  166. this.ensureDefault("button_disabled", false);
  167. this.ensureDefault("button_placeholder_id", "");
  168. this.ensureDefault("button_placeholder", null);
  169. this.ensureDefault("button_cursor", SWFUpload.CURSOR.ARROW);
  170. this.ensureDefault("button_window_mode", SWFUpload.WINDOW_MODE.WINDOW);
  171. // Debug Settings
  172. this.ensureDefault("debug", false);
  173. this.settings.debug_enabled = this.settings.debug; // Here to maintain v2 API
  174. // Event Handlers
  175. this.settings.return_upload_start_handler = this.returnUploadStart;
  176. this.ensureDefault("swfupload_preload_handler", null);
  177. this.ensureDefault("swfupload_load_failed_handler", null);
  178. this.ensureDefault("swfupload_loaded_handler", null);
  179. this.ensureDefault("file_dialog_start_handler", null);
  180. this.ensureDefault("file_queued_handler", null);
  181. this.ensureDefault("file_queue_error_handler", null);
  182. this.ensureDefault("file_dialog_complete_handler", null);
  183. this.ensureDefault("upload_resize_start_handler", null);
  184. this.ensureDefault("upload_start_handler", null);
  185. this.ensureDefault("upload_progress_handler", null);
  186. this.ensureDefault("upload_error_handler", null);
  187. this.ensureDefault("upload_success_handler", null);
  188. this.ensureDefault("upload_complete_handler", null);
  189. this.ensureDefault("mouse_click_handler", null);
  190. this.ensureDefault("mouse_out_handler", null);
  191. this.ensureDefault("mouse_over_handler", null);
  192. this.ensureDefault("debug_handler", this.debugMessage);
  193. this.ensureDefault("custom_settings", {});
  194. // Other settings
  195. this.customSettings = this.settings.custom_settings;
  196. // Update the flash url if needed
  197. if (!!this.settings.prevent_swf_caching) {
  198. this.settings.flash_url = this.settings.flash_url + (this.settings.flash_url.indexOf("?") < 0 ? "?" : "&") + "preventswfcaching=" + new Date().getTime();
  199. this.settings.flash9_url = this.settings.flash9_url + (this.settings.flash9_url.indexOf("?") < 0 ? "?" : "&") + "preventswfcaching=" + new Date().getTime();
  200. }
  201. if (!this.settings.preserve_relative_urls) {
  202. this.settings.upload_url = SWFUpload.completeURL(this.settings.upload_url);
  203. this.settings.button_image_url = SWFUpload.completeURL(this.settings.button_image_url);
  204. }
  205. delete this.ensureDefault;
  206. };
  207. // Initializes the supported functionality based the Flash Player version, state, and event that occur during initialization
  208. SWFUpload.prototype.loadSupport = function () {
  209. this.support = {
  210. loading : swfobject.hasFlashPlayerVersion("9.0.28"),
  211. imageResize : swfobject.hasFlashPlayerVersion("10.0.0")
  212. };
  213. };
  214. // Private: loadFlash replaces the button_placeholder element with the flash movie.
  215. SWFUpload.prototype.loadFlash = function () {
  216. var targetElement, tempParent, wrapperType, flashHTML, els;
  217. if (!this.support.loading) {
  218. this.queueEvent("swfupload_load_failed_handler", ["Flash Player doesn't support SWFUpload"]);
  219. return;
  220. }
  221. // Make sure an element with the ID we are going to use doesn't already exist
  222. if (document.getElementById(this.movieName) !== null) {
  223. this.support.loading = false;
  224. this.queueEvent("swfupload_load_failed_handler", ["Element ID already in use"]);
  225. return;
  226. }
  227. // Get the element where we will be placing the flash movie
  228. targetElement = document.getElementById(this.settings.button_placeholder_id) || this.settings.button_placeholder;
  229. if (targetElement == undefined) {
  230. this.support.loading = false;
  231. this.queueEvent("swfupload_load_failed_handler", ["button place holder not found"]);
  232. return;
  233. }
  234. wrapperType = (targetElement.currentStyle && targetElement.currentStyle["display"] || window.getComputedStyle && document.defaultView.getComputedStyle(targetElement, null).getPropertyValue("display")) !== "block" ? "span" : "div";
  235. // Append the container and load the flash
  236. tempParent = document.createElement(wrapperType);
  237. flashHTML = this.getFlashHTML();
  238. try {
  239. tempParent.innerHTML = flashHTML; // Using innerHTML is non-standard but the only sensible way to dynamically add Flash in IE (and maybe other browsers)
  240. } catch (ex) {
  241. this.support.loading = false;
  242. this.queueEvent("swfupload_load_failed_handler", ["Exception loading Flash HTML into placeholder"]);
  243. return;
  244. }
  245. // Try to get the movie element immediately
  246. els = tempParent.getElementsByTagName("object");
  247. if (!els || els.length > 1 || els.length === 0) {
  248. this.support.loading = false;
  249. this.queueEvent("swfupload_load_failed_handler", ["Unable to find movie after adding to DOM"]);
  250. return;
  251. } else if (els.length === 1) {
  252. this.movieElement = els[0];
  253. }
  254. targetElement.parentNode.replaceChild(tempParent.firstChild, targetElement);
  255. // Fix IE Flash/Form bug
  256. if (window[this.movieName] == undefined) {
  257. window[this.movieName] = this.getMovieElement();
  258. }
  259. };
  260. // Private: getFlashHTML generates the object tag needed to embed the flash in to the document
  261. SWFUpload.prototype.getFlashHTML = function (flashVersion) {
  262. // Flash Satay object syntax: http://www.alistapart.com/articles/flashsatay
  263. return ['<object id="', this.movieName, '" type="application/x-shockwave-flash" data="', (this.support.imageResize ? this.settings.flash_url : this.settings.flash9_url), '" width="', this.settings.button_width, '" height="', this.settings.button_height, '" class="swfupload">',
  264. '<param name="wmode" value="', this.settings.button_window_mode, '" />',
  265. '<param name="movie" value="', (this.support.imageResize ? this.settings.flash_url : this.settings.flash9_url), '" />',
  266. '<param name="quality" value="high" />',
  267. '<param name="allowScriptAccess" value="always" />',
  268. '<param name="flashvars" value="' + this.getFlashVars() + '" />',
  269. '</object>'].join("");
  270. };
  271. // Private: getFlashVars builds the parameter string that will be passed
  272. // to flash in the flashvars param.
  273. SWFUpload.prototype.getFlashVars = function () {
  274. // Build a string from the post param object
  275. var httpSuccessString, paramString;
  276. paramString = this.buildParamString();
  277. httpSuccessString = this.settings.http_success.join(",");
  278. // Build the parameter string
  279. return ["movieName=", encodeURIComponent(this.movieName),
  280. "&amp;uploadURL=", encodeURIComponent(this.settings.upload_url),
  281. "&amp;useQueryString=", encodeURIComponent(this.settings.use_query_string),
  282. "&amp;requeueOnError=", encodeURIComponent(this.settings.requeue_on_error),
  283. "&amp;httpSuccess=", encodeURIComponent(httpSuccessString),
  284. "&amp;assumeSuccessTimeout=", encodeURIComponent(this.settings.assume_success_timeout),
  285. "&amp;params=", encodeURIComponent(paramString),
  286. "&amp;filePostName=", encodeURIComponent(this.settings.file_post_name),
  287. "&amp;fileTypes=", encodeURIComponent(this.settings.file_types),
  288. "&amp;fileTypesDescription=", encodeURIComponent(this.settings.file_types_description),
  289. "&amp;fileSizeLimit=", encodeURIComponent(this.settings.file_size_limit),
  290. "&amp;fileUploadLimit=", encodeURIComponent(this.settings.file_upload_limit),
  291. "&amp;fileQueueLimit=", encodeURIComponent(this.settings.file_queue_limit),
  292. "&amp;debugEnabled=", encodeURIComponent(this.settings.debug_enabled),
  293. "&amp;buttonImageURL=", encodeURIComponent(this.settings.button_image_url),
  294. "&amp;buttonWidth=", encodeURIComponent(this.settings.button_width),
  295. "&amp;buttonHeight=", encodeURIComponent(this.settings.button_height),
  296. "&amp;buttonText=", encodeURIComponent(this.settings.button_text),
  297. "&amp;buttonTextTopPadding=", encodeURIComponent(this.settings.button_text_top_padding),
  298. "&amp;buttonTextLeftPadding=", encodeURIComponent(this.settings.button_text_left_padding),
  299. "&amp;buttonTextStyle=", encodeURIComponent(this.settings.button_text_style),
  300. "&amp;buttonAction=", encodeURIComponent(this.settings.button_action),
  301. "&amp;buttonDisabled=", encodeURIComponent(this.settings.button_disabled),
  302. "&amp;buttonCursor=", encodeURIComponent(this.settings.button_cursor)
  303. ].join("");
  304. };
  305. // Public: get retrieves the DOM reference to the Flash element added by SWFUpload
  306. // The element is cached after the first lookup
  307. SWFUpload.prototype.getMovieElement = function () {
  308. if (this.movieElement == undefined) {
  309. this.movieElement = document.getElementById(this.movieName);
  310. }
  311. if (this.movieElement === null) {
  312. throw "Could not find Flash element";
  313. }
  314. return this.movieElement;
  315. };
  316. // Private: buildParamString takes the name/value pairs in the post_params setting object
  317. // and joins them up in to a string formatted "name=value&amp;name=value"
  318. SWFUpload.prototype.buildParamString = function () {
  319. var name, postParams, paramStringPairs = [];
  320. postParams = this.settings.post_params;
  321. if (typeof(postParams) === "object") {
  322. for (name in postParams) {
  323. if (postParams.hasOwnProperty(name)) {
  324. paramStringPairs.push(encodeURIComponent(name.toString()) + "=" + encodeURIComponent(postParams[name].toString()));
  325. }
  326. }
  327. }
  328. return paramStringPairs.join("&amp;");
  329. };
  330. // Public: Used to remove a SWFUpload instance from the page. This method strives to remove
  331. // all references to the SWF, and other objects so memory is properly freed.
  332. // Returns true if everything was destroyed. Returns a false if a failure occurs leaving SWFUpload in an inconsistant state.
  333. // Credits: Major improvements provided by steffen
  334. SWFUpload.prototype.destroy = function () {
  335. var movieElement;
  336. try {
  337. // Make sure Flash is done before we try to remove it
  338. this.cancelUpload(null, false);
  339. movieElement = this.cleanUp();
  340. // Remove the SWFUpload DOM nodes
  341. if (movieElement) {
  342. // Remove the Movie Element from the page
  343. try {
  344. movieElement.parentNode.removeChild(movieElement);
  345. } catch (ex) {}
  346. }
  347. // Remove IE form fix reference
  348. window[this.movieName] = null;
  349. // Destroy other references
  350. SWFUpload.instances[this.movieName] = null;
  351. delete SWFUpload.instances[this.movieName];
  352. this.movieElement = null;
  353. this.settings = null;
  354. this.customSettings = null;
  355. this.eventQueue = null;
  356. this.movieName = null;
  357. return true;
  358. } catch (ex2) {
  359. return false;
  360. }
  361. };
  362. // Public: displayDebugInfo prints out settings and configuration
  363. // information about this SWFUpload instance.
  364. // This function (and any references to it) can be deleted when placing
  365. // SWFUpload in production.
  366. SWFUpload.prototype.displayDebugInfo = function () {
  367. this.debug(
  368. [
  369. "---SWFUpload Instance Info---\n",
  370. "Version: ", SWFUpload.version, "\n",
  371. "Movie Name: ", this.movieName, "\n",
  372. "Settings:\n",
  373. "\t", "upload_url: ", this.settings.upload_url, "\n",
  374. "\t", "flash_url: ", this.settings.flash_url, "\n",
  375. "\t", "flash9_url: ", this.settings.flash9_url, "\n",
  376. "\t", "use_query_string: ", this.settings.use_query_string.toString(), "\n",
  377. "\t", "requeue_on_error: ", this.settings.requeue_on_error.toString(), "\n",
  378. "\t", "http_success: ", this.settings.http_success.join(", "), "\n",
  379. "\t", "assume_success_timeout: ", this.settings.assume_success_timeout, "\n",
  380. "\t", "file_post_name: ", this.settings.file_post_name, "\n",
  381. "\t", "post_params: ", this.settings.post_params.toString(), "\n",
  382. "\t", "file_types: ", this.settings.file_types, "\n",
  383. "\t", "file_types_description: ", this.settings.file_types_description, "\n",
  384. "\t", "file_size_limit: ", this.settings.file_size_limit, "\n",
  385. "\t", "file_upload_limit: ", this.settings.file_upload_limit, "\n",
  386. "\t", "file_queue_limit: ", this.settings.file_queue_limit, "\n",
  387. "\t", "debug: ", this.settings.debug.toString(), "\n",
  388. "\t", "prevent_swf_caching: ", this.settings.prevent_swf_caching.toString(), "\n",
  389. "\t", "button_placeholder_id: ", this.settings.button_placeholder_id.toString(), "\n",
  390. "\t", "button_placeholder: ", (this.settings.button_placeholder ? "Set" : "Not Set"), "\n",
  391. "\t", "button_image_url: ", this.settings.button_image_url.toString(), "\n",
  392. "\t", "button_width: ", this.settings.button_width.toString(), "\n",
  393. "\t", "button_height: ", this.settings.button_height.toString(), "\n",
  394. "\t", "button_text: ", this.settings.button_text.toString(), "\n",
  395. "\t", "button_text_style: ", this.settings.button_text_style.toString(), "\n",
  396. "\t", "button_text_top_padding: ", this.settings.button_text_top_padding.toString(), "\n",
  397. "\t", "button_text_left_padding: ", this.settings.button_text_left_padding.toString(), "\n",
  398. "\t", "button_action: ", this.settings.button_action.toString(), "\n",
  399. "\t", "button_cursor: ", this.settings.button_cursor.toString(), "\n",
  400. "\t", "button_disabled: ", this.settings.button_disabled.toString(), "\n",
  401. "\t", "custom_settings: ", this.settings.custom_settings.toString(), "\n",
  402. "Event Handlers:\n",
  403. "\t", "swfupload_preload_handler assigned: ", (typeof this.settings.swfupload_preload_handler === "function").toString(), "\n",
  404. "\t", "swfupload_load_failed_handler assigned: ", (typeof this.settings.swfupload_load_failed_handler === "function").toString(), "\n",
  405. "\t", "swfupload_loaded_handler assigned: ", (typeof this.settings.swfupload_loaded_handler === "function").toString(), "\n",
  406. "\t", "mouse_click_handler assigned: ", (typeof this.settings.mouse_click_handler === "function").toString(), "\n",
  407. "\t", "mouse_over_handler assigned: ", (typeof this.settings.mouse_over_handler === "function").toString(), "\n",
  408. "\t", "mouse_out_handler assigned: ", (typeof this.settings.mouse_out_handler === "function").toString(), "\n",
  409. "\t", "file_dialog_start_handler assigned: ", (typeof this.settings.file_dialog_start_handler === "function").toString(), "\n",
  410. "\t", "file_queued_handler assigned: ", (typeof this.settings.file_queued_handler === "function").toString(), "\n",
  411. "\t", "file_queue_error_handler assigned: ", (typeof this.settings.file_queue_error_handler === "function").toString(), "\n",
  412. "\t", "upload_resize_start_handler assigned: ", (typeof this.settings.upload_resize_start_handler === "function").toString(), "\n",
  413. "\t", "upload_start_handler assigned: ", (typeof this.settings.upload_start_handler === "function").toString(), "\n",
  414. "\t", "upload_progress_handler assigned: ", (typeof this.settings.upload_progress_handler === "function").toString(), "\n",
  415. "\t", "upload_error_handler assigned: ", (typeof this.settings.upload_error_handler === "function").toString(), "\n",
  416. "\t", "upload_success_handler assigned: ", (typeof this.settings.upload_success_handler === "function").toString(), "\n",
  417. "\t", "upload_complete_handler assigned: ", (typeof this.settings.upload_complete_handler === "function").toString(), "\n",
  418. "\t", "debug_handler assigned: ", (typeof this.settings.debug_handler === "function").toString(), "\n",
  419. "Support:\n",
  420. "\t", "Load: ", (this.support.loading ? "Yes" : "No"), "\n",
  421. "\t", "Image Resize: ", (this.support.imageResize ? "Yes" : "No"), "\n"
  422. ].join("")
  423. );
  424. };
  425. /* Note: addSetting and getSetting are no longer used by SWFUpload but are included
  426. the maintain v2 API compatibility
  427. */
  428. // Public: (Deprecated) addSetting adds a setting value. If the value given is undefined or null then the default_value is used.
  429. SWFUpload.prototype.addSetting = function (name, value, default_value) {
  430. if (value == undefined) {
  431. return (this.settings[name] = default_value);
  432. } else {
  433. return (this.settings[name] = value);
  434. }
  435. };
  436. // Public: (Deprecated) getSetting gets a setting. Returns an empty string if the setting was not found.
  437. SWFUpload.prototype.getSetting = function (name) {
  438. if (this.settings[name] != undefined) {
  439. return this.settings[name];
  440. }
  441. return "";
  442. };
  443. // Private: callFlash handles function calls made to the Flash element.
  444. // Calls are made with a setTimeout for some functions to work around
  445. // bugs in the ExternalInterface library.
  446. SWFUpload.prototype.callFlash = function (functionName, argumentArray) {
  447. var movieElement, returnValue, returnString;
  448. argumentArray = argumentArray || [];
  449. movieElement = this.getMovieElement();
  450. // Flash's method if calling ExternalInterface methods (code adapted from MooTools).
  451. try {
  452. if (movieElement != undefined) {
  453. returnString = movieElement.CallFunction('<invoke name="' + functionName + '" returntype="javascript">' + __flash__argumentsToXML(argumentArray, 0) + '</invoke>');
  454. returnValue = eval(returnString);
  455. } else {
  456. this.debug("Can't call flash because the movie wasn't found.");
  457. }
  458. } catch (ex) {
  459. this.debug("Exception calling flash function '" + functionName + "': " + ex.message);
  460. }
  461. // Unescape file post param values
  462. if (returnValue != undefined && typeof returnValue.post === "object") {
  463. returnValue = this.unescapeFilePostParams(returnValue);
  464. }
  465. return returnValue;
  466. };
  467. /* *****************************
  468. -- Flash control methods --
  469. Your UI should use these
  470. to operate SWFUpload
  471. ***************************** */
  472. // WARNING: this function does not work in Flash Player 10
  473. // Public: selectFile causes a File Selection Dialog window to appear. This
  474. // dialog only allows 1 file to be selected.
  475. SWFUpload.prototype.selectFile = function () {
  476. this.callFlash("SelectFile");
  477. };
  478. // WARNING: this function does not work in Flash Player 10
  479. // Public: selectFiles causes a File Selection Dialog window to appear/ This
  480. // dialog allows the user to select any number of files
  481. // Flash Bug Warning: Flash limits the number of selectable files based on the combined length of the file names.
  482. // If the selection name length is too long the dialog will fail in an unpredictable manner. There is no work-around
  483. // for this bug.
  484. SWFUpload.prototype.selectFiles = function () {
  485. this.callFlash("SelectFiles");
  486. };
  487. // Public: startUpload starts uploading the first file in the queue unless
  488. // the optional parameter 'fileID' specifies the ID
  489. SWFUpload.prototype.startUpload = function (fileID) {
  490. this.callFlash("StartUpload", [fileID]);
  491. };
  492. // Public: startUpload starts uploading the first file in the queue unless
  493. // the optional parameter 'fileID' specifies the ID
  494. SWFUpload.prototype.startResizedUpload = function (fileID, width, height, encoding, quality, allowEnlarging) {
  495. this.callFlash("StartUpload", [fileID, { "width": width, "height" : height, "encoding" : encoding, "quality" : quality, "allowEnlarging" : allowEnlarging }]);
  496. };
  497. // Public: cancelUpload cancels any queued file. The fileID parameter may be the file ID or index.
  498. // If you do not specify a fileID the current uploading file or first file in the queue is cancelled.
  499. // If you do not want the uploadError event to trigger you can specify false for the triggerErrorEvent parameter.
  500. SWFUpload.prototype.cancelUpload = function (fileID, triggerErrorEvent) {
  501. if (triggerErrorEvent !== false) {
  502. triggerErrorEvent = true;
  503. }
  504. this.callFlash("CancelUpload", [fileID, triggerErrorEvent]);
  505. };
  506. // Public: stopUpload stops the current upload and requeues the file at the beginning of the queue.
  507. // If nothing is currently uploading then nothing happens.
  508. SWFUpload.prototype.stopUpload = function () {
  509. this.callFlash("StopUpload");
  510. };
  511. // Public: requeueUpload requeues any file. If the file is requeued or already queued true is returned.
  512. // If the file is not found or is currently uploading false is returned. Requeuing a file bypasses the
  513. // file size, queue size, upload limit and other queue checks. Certain files can't be requeued (e.g, invalid or zero bytes files).
  514. SWFUpload.prototype.requeueUpload = function (indexOrFileID) {
  515. return this.callFlash("RequeueUpload", [indexOrFileID]);
  516. };
  517. /* ************************
  518. * Settings methods
  519. * These methods change the SWFUpload settings.
  520. * SWFUpload settings should not be changed directly on the settings object
  521. * since many of the settings need to be passed to Flash in order to take
  522. * effect.
  523. * *********************** */
  524. // Public: getStats gets the file statistics object.
  525. SWFUpload.prototype.getStats = function () {
  526. return this.callFlash("GetStats");
  527. };
  528. // Public: setStats changes the SWFUpload statistics. You shouldn't need to
  529. // change the statistics but you can. Changing the statistics does not
  530. // affect SWFUpload accept for the successful_uploads count which is used
  531. // by the upload_limit setting to determine how many files the user may upload.
  532. SWFUpload.prototype.setStats = function (statsObject) {
  533. this.callFlash("SetStats", [statsObject]);
  534. };
  535. // Public: getFile retrieves a File object by ID or Index. If the file is
  536. // not found then 'null' is returned.
  537. SWFUpload.prototype.getFile = function (fileID) {
  538. if (typeof(fileID) === "number") {
  539. return this.callFlash("GetFileByIndex", [fileID]);
  540. } else {
  541. return this.callFlash("GetFile", [fileID]);
  542. }
  543. };
  544. // Public: getFileFromQueue retrieves a File object by ID or Index. If the file is
  545. // not found then 'null' is returned.
  546. SWFUpload.prototype.getQueueFile = function (fileID) {
  547. if (typeof(fileID) === "number") {
  548. return this.callFlash("GetFileByQueueIndex", [fileID]);
  549. } else {
  550. return this.callFlash("GetFile", [fileID]);
  551. }
  552. };
  553. // Public: addFileParam sets a name/value pair that will be posted with the
  554. // file specified by the Files ID. If the name already exists then the
  555. // exiting value will be overwritten.
  556. SWFUpload.prototype.addFileParam = function (fileID, name, value) {
  557. return this.callFlash("AddFileParam", [fileID, name, value]);
  558. };
  559. // Public: removeFileParam removes a previously set (by addFileParam) name/value
  560. // pair from the specified file.
  561. SWFUpload.prototype.removeFileParam = function (fileID, name) {
  562. this.callFlash("RemoveFileParam", [fileID, name]);
  563. };
  564. // Public: setUploadUrl changes the upload_url setting.
  565. SWFUpload.prototype.setUploadURL = function (url) {
  566. this.settings.upload_url = url.toString();
  567. this.callFlash("SetUploadURL", [url]);
  568. };
  569. // Public: setPostParams changes the post_params setting
  570. SWFUpload.prototype.setPostParams = function (paramsObject) {
  571. this.settings.post_params = paramsObject;
  572. this.callFlash("SetPostParams", [paramsObject]);
  573. };
  574. // Public: addPostParam adds post name/value pair. Each name can have only one value.
  575. SWFUpload.prototype.addPostParam = function (name, value) {
  576. this.settings.post_params[name] = value;
  577. this.callFlash("SetPostParams", [this.settings.post_params]);
  578. };
  579. // Public: removePostParam deletes post name/value pair.
  580. SWFUpload.prototype.removePostParam = function (name) {
  581. delete this.settings.post_params[name];
  582. this.callFlash("SetPostParams", [this.settings.post_params]);
  583. };
  584. // Public: setFileTypes changes the file_types setting and the file_types_description setting
  585. SWFUpload.prototype.setFileTypes = function (types, description) {
  586. this.settings.file_types = types;
  587. this.settings.file_types_description = description;
  588. this.callFlash("SetFileTypes", [types, description]);
  589. };
  590. // Public: setFileSizeLimit changes the file_size_limit setting
  591. SWFUpload.prototype.setFileSizeLimit = function (fileSizeLimit) {
  592. this.settings.file_size_limit = fileSizeLimit;
  593. this.callFlash("SetFileSizeLimit", [fileSizeLimit]);
  594. };
  595. // Public: setFileUploadLimit changes the file_upload_limit setting
  596. SWFUpload.prototype.setFileUploadLimit = function (fileUploadLimit) {
  597. this.settings.file_upload_limit = fileUploadLimit;
  598. this.callFlash("SetFileUploadLimit", [fileUploadLimit]);
  599. };
  600. // Public: setFileQueueLimit changes the file_queue_limit setting
  601. SWFUpload.prototype.setFileQueueLimit = function (fileQueueLimit) {
  602. this.settings.file_queue_limit = fileQueueLimit;
  603. this.callFlash("SetFileQueueLimit", [fileQueueLimit]);
  604. };
  605. // Public: setFilePostName changes the file_post_name setting
  606. SWFUpload.prototype.setFilePostName = function (filePostName) {
  607. this.settings.file_post_name = filePostName;
  608. this.callFlash("SetFilePostName", [filePostName]);
  609. };
  610. // Public: setUseQueryString changes the use_query_string setting
  611. SWFUpload.prototype.setUseQueryString = function (useQueryString) {
  612. this.settings.use_query_string = useQueryString;
  613. this.callFlash("SetUseQueryString", [useQueryString]);
  614. };
  615. // Public: setRequeueOnError changes the requeue_on_error setting
  616. SWFUpload.prototype.setRequeueOnError = function (requeueOnError) {
  617. this.settings.requeue_on_error = requeueOnError;
  618. this.callFlash("SetRequeueOnError", [requeueOnError]);
  619. };
  620. // Public: setHTTPSuccess changes the http_success setting
  621. SWFUpload.prototype.setHTTPSuccess = function (http_status_codes) {
  622. if (typeof http_status_codes === "string") {
  623. http_status_codes = http_status_codes.replace(" ", "").split(",");
  624. }
  625. this.settings.http_success = http_status_codes;
  626. this.callFlash("SetHTTPSuccess", [http_status_codes]);
  627. };
  628. // Public: setHTTPSuccess changes the http_success setting
  629. SWFUpload.prototype.setAssumeSuccessTimeout = function (timeout_seconds) {
  630. this.settings.assume_success_timeout = timeout_seconds;
  631. this.callFlash("SetAssumeSuccessTimeout", [timeout_seconds]);
  632. };
  633. // Public: setDebugEnabled changes the debug_enabled setting
  634. SWFUpload.prototype.setDebugEnabled = function (debugEnabled) {
  635. this.settings.debug_enabled = debugEnabled;
  636. this.callFlash("SetDebugEnabled", [debugEnabled]);
  637. };
  638. // Public: setButtonImageURL loads a button image sprite
  639. SWFUpload.prototype.setButtonImageURL = function (buttonImageURL) {
  640. if (buttonImageURL == undefined) {
  641. buttonImageURL = "";
  642. }
  643. this.settings.button_image_url = buttonImageURL;
  644. this.callFlash("SetButtonImageURL", [buttonImageURL]);
  645. };
  646. // Public: setButtonDimensions resizes the Flash Movie and button
  647. SWFUpload.prototype.setButtonDimensions = function (width, height) {
  648. this.settings.button_width = width;
  649. this.settings.button_height = height;
  650. var movie = this.getMovieElement();
  651. if (movie != undefined) {
  652. movie.style.width = width + "px";
  653. movie.style.height = height + "px";
  654. }
  655. this.callFlash("SetButtonDimensions", [width, height]);
  656. };
  657. // Public: setButtonText Changes the text overlaid on the button
  658. SWFUpload.prototype.setButtonText = function (html) {
  659. this.settings.button_text = html;
  660. this.callFlash("SetButtonText", [html]);
  661. };
  662. // Public: setButtonTextPadding changes the top and left padding of the text overlay
  663. SWFUpload.prototype.setButtonTextPadding = function (left, top) {
  664. this.settings.button_text_top_padding = top;
  665. this.settings.button_text_left_padding = left;
  666. this.callFlash("SetButtonTextPadding", [left, top]);
  667. };
  668. // Public: setButtonTextStyle changes the CSS used to style the HTML/Text overlaid on the button
  669. SWFUpload.prototype.setButtonTextStyle = function (css) {
  670. this.settings.button_text_style = css;
  671. this.callFlash("SetButtonTextStyle", [css]);
  672. };
  673. // Public: setButtonDisabled disables/enables the button
  674. SWFUpload.prototype.setButtonDisabled = function (isDisabled) {
  675. this.settings.button_disabled = isDisabled;
  676. this.callFlash("SetButtonDisabled", [isDisabled]);
  677. };
  678. // Public: setButtonAction sets the action that occurs when the button is clicked
  679. SWFUpload.prototype.setButtonAction = function (buttonAction) {
  680. this.settings.button_action = buttonAction;
  681. this.callFlash("SetButtonAction", [buttonAction]);
  682. };
  683. // Public: setButtonCursor changes the mouse cursor displayed when hovering over the button
  684. SWFUpload.prototype.setButtonCursor = function (cursor) {
  685. this.settings.button_cursor = cursor;
  686. this.callFlash("SetButtonCursor", [cursor]);
  687. };
  688. /* *******************************
  689. Flash Event Interfaces
  690. These functions are used by Flash to trigger the various
  691. events.
  692. All these functions a Private.
  693. Because the ExternalInterface library is buggy the event calls
  694. are added to a queue and the queue then executed by a setTimeout.
  695. This ensures that events are executed in a determinate order and that
  696. the ExternalInterface bugs are avoided.
  697. ******************************* */
  698. SWFUpload.prototype.queueEvent = function (handlerName, argumentArray) {
  699. // Warning: Don't call this.debug inside here or you'll create an infinite loop
  700. var self = this;
  701. if (argumentArray == undefined) {
  702. argumentArray = [];
  703. } else if (!(argumentArray instanceof Array)) {
  704. argumentArray = [argumentArray];
  705. }
  706. if (typeof this.settings[handlerName] === "function") {
  707. // Queue the event
  708. this.eventQueue.push(function () {
  709. this.settings[handlerName].apply(this, argumentArray);
  710. });
  711. // Execute the next queued event
  712. setTimeout(function () {
  713. self.executeNextEvent();
  714. }, 0);
  715. } else if (this.settings[handlerName] !== null) {
  716. throw "Event handler " + handlerName + " is unknown or is not a function";
  717. }
  718. };
  719. // Private: Causes the next event in the queue to be executed. Since events are queued using a setTimeout
  720. // we must queue them in order to garentee that they are executed in order.
  721. SWFUpload.prototype.executeNextEvent = function () {
  722. // Warning: Don't call this.debug inside here or you'll create an infinite loop
  723. var f = this.eventQueue ? this.eventQueue.shift() : null;
  724. if (typeof(f) === "function") {
  725. f.apply(this);
  726. }
  727. };
  728. // Private: unescapeFileParams is part of a workaround for a flash bug where objects passed through ExternalInterface cannot have
  729. // properties that contain characters that are not valid for JavaScript identifiers. To work around this
  730. // the Flash Component escapes the parameter names and we must unescape again before passing them along.
  731. SWFUpload.prototype.unescapeFilePostParams = function (file) {
  732. var reg = /[$]([0-9a-f]{4})/i, unescapedPost = {}, uk, k, match;
  733. if (file != undefined) {
  734. for (k in file.post) {
  735. if (file.post.hasOwnProperty(k)) {
  736. uk = k;
  737. while ((match = reg.exec(uk)) !== null) {
  738. uk = uk.replace(match[0], String.fromCharCode(parseInt("0x" + match[1], 16)));
  739. }
  740. unescapedPost[uk] = file.post[k];
  741. }
  742. }
  743. file.post = unescapedPost;
  744. }
  745. return file;
  746. };
  747. // Private: This event is called by SWFUpload Init after we've determined what the user's Flash Player supports.
  748. // Use the swfupload_preload_handler event setting to execute custom code when SWFUpload has loaded.
  749. // Return false to prevent SWFUpload from loading and allow your script to do something else if your required feature is
  750. // not supported
  751. SWFUpload.prototype.swfuploadPreload = function () {
  752. var returnValue;
  753. if (typeof this.settings.swfupload_preload_handler === "function") {
  754. returnValue = this.settings.swfupload_preload_handler.call(this);
  755. } else if (this.settings.swfupload_preload_handler != undefined) {
  756. throw "upload_start_handler must be a function";
  757. }
  758. // Convert undefined to true so if nothing is returned from the upload_start_handler it is
  759. // interpretted as 'true'.
  760. if (returnValue === undefined) {
  761. returnValue = true;
  762. }
  763. return !!returnValue;
  764. }
  765. // Private: This event is called by Flash when it has finished loading. Don't modify this.
  766. // Use the swfupload_loaded_handler event setting to execute custom code when SWFUpload has loaded.
  767. SWFUpload.prototype.flashReady = function () {
  768. // Check that the movie element is loaded correctly with its ExternalInterface methods defined
  769. var movieElement = this.cleanUp();
  770. if (!movieElement) {
  771. this.debug("Flash called back ready but the flash movie can't be found.");
  772. return;
  773. }
  774. this.queueEvent("swfupload_loaded_handler");
  775. };
  776. // Private: removes Flash added fuctions to the DOM node to prevent memory leaks in IE.
  777. // This function is called by Flash each time the ExternalInterface functions are created.
  778. SWFUpload.prototype.cleanUp = function () {
  779. var key, movieElement = this.getMovieElement();
  780. // Pro-actively unhook all the Flash functions
  781. try {
  782. if (movieElement && typeof(movieElement.CallFunction) === "unknown") { // We only want to do this in IE
  783. this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)");
  784. for (key in movieElement) {
  785. try {
  786. if (typeof(movieElement[key]) === "function") {
  787. movieElement[key] = null;
  788. }
  789. } catch (ex) {
  790. }
  791. }
  792. }
  793. } catch (ex1) {
  794. }
  795. // Fix Flashes own cleanup code so if the SWF Movie was removed from the page
  796. // it doesn't display errors.
  797. window["__flash__removeCallback"] = function (instance, name) {
  798. try {
  799. if (instance) {
  800. instance[name] = null;
  801. }
  802. } catch (flashEx) {
  803. }
  804. };
  805. return movieElement;
  806. };
  807. /* When the button_action is set to None this event gets fired and executes the mouse_click_handler */
  808. SWFUpload.prototype.mouseClick = function () {
  809. this.queueEvent("mouse_click_handler");
  810. };
  811. SWFUpload.prototype.mouseOver = function () {
  812. this.queueEvent("mouse_over_handler");
  813. };
  814. SWFUpload.prototype.mouseOut = function () {
  815. this.queueEvent("mouse_out_handler");
  816. };
  817. /* This is a chance to do something before the browse window opens */
  818. SWFUpload.prototype.fileDialogStart = function () {
  819. this.queueEvent("file_dialog_start_handler");
  820. };
  821. /* Called when a file is successfully added to the queue. */
  822. SWFUpload.prototype.fileQueued = function (file) {
  823. file = this.unescapeFilePostParams(file);
  824. this.queueEvent("file_queued_handler", file);
  825. };
  826. /* Handle errors that occur when an attempt to queue a file fails. */
  827. SWFUpload.prototype.fileQueueError = function (file, errorCode, message) {
  828. file = this.unescapeFilePostParams(file);
  829. this.queueEvent("file_queue_error_handler", [file, errorCode, message]);
  830. };
  831. /* Called after the file dialog has closed and the selected files have been queued.
  832. You could call startUpload here if you want the queued files to begin uploading immediately. */
  833. SWFUpload.prototype.fileDialogComplete = function (numFilesSelected, numFilesQueued, numFilesInQueue) {
  834. this.queueEvent("file_dialog_complete_handler", [numFilesSelected, numFilesQueued, numFilesInQueue]);
  835. };
  836. SWFUpload.prototype.uploadResizeStart = function (file, resizeSettings) {
  837. file = this.unescapeFilePostParams(file);
  838. this.queueEvent("upload_resize_start_handler", [file, resizeSettings.width, resizeSettings.height, resizeSettings.encoding, resizeSettings.quality]);
  839. };
  840. SWFUpload.prototype.uploadStart = function (file) {
  841. file = this.unescapeFilePostParams(file);
  842. this.queueEvent("return_upload_start_handler", file);
  843. };
  844. SWFUpload.prototype.returnUploadStart = function (file) {
  845. var returnValue;
  846. if (typeof this.settings.upload_start_handler === "function") {
  847. file = this.unescapeFilePostParams(file);
  848. returnValue = this.settings.upload_start_handler.call(this, file);
  849. } else if (this.settings.upload_start_handler != undefined) {
  850. throw "upload_start_handler must be a function";
  851. }
  852. // Convert undefined to true so if nothing is returned from the upload_start_handler it is
  853. // interpretted as 'true'.
  854. if (returnValue === undefined) {
  855. returnValue = true;
  856. }
  857. returnValue = !!returnValue;
  858. this.callFlash("ReturnUploadStart", [returnValue]);
  859. };
  860. SWFUpload.prototype.uploadProgress = function (file, bytesComplete, bytesTotal) {
  861. file = this.unescapeFilePostParams(file);
  862. this.queueEvent("upload_progress_handler", [file, bytesComplete, bytesTotal]);
  863. };
  864. SWFUpload.prototype.uploadError = function (file, errorCode, message) {
  865. file = this.unescapeFilePostParams(file);
  866. this.queueEvent("upload_error_handler", [file, errorCode, message]);
  867. };
  868. SWFUpload.prototype.uploadSuccess = function (file, serverData, responseReceived) {
  869. file = this.unescapeFilePostParams(file);
  870. this.queueEvent("upload_success_handler", [file, serverData, responseReceived]);
  871. };
  872. SWFUpload.prototype.uploadComplete = function (file) {
  873. file = this.unescapeFilePostParams(file);
  874. this.queueEvent("upload_complete_handler", file);
  875. };
  876. /* Called by SWFUpload JavaScript and Flash functions when debug is enabled. By default it writes messages to the
  877. internal debug console. You can override this event and have messages written where you want. */
  878. SWFUpload.prototype.debug = function (message) {
  879. this.queueEvent("debug_handler", message);
  880. };
  881. /* **********************************
  882. Debug Console
  883. The debug console is a self contained, in page location
  884. for debug message to be sent. The Debug Console adds
  885. itself to the body if necessary.
  886. The console is automatically scrolled as messages appear.
  887. If you are using your own debug handler or when you deploy to production and
  888. have debug disabled you can remove these functions to reduce the file size
  889. and complexity.
  890. ********************************** */
  891. // Private: debugMessage is the default debug_handler. If you want to print debug messages
  892. // call the debug() function. When overriding the function your own function should
  893. // check to see if the debug setting is true before outputting debug information.
  894. SWFUpload.prototype.debugMessage = function (message) {
  895. var exceptionMessage, exceptionValues, key;
  896. if (this.settings.debug) {
  897. exceptionValues = [];
  898. // Check for an exception object and print it nicely
  899. if (typeof message === "object" && typeof message.name === "string" && typeof message.message === "string") {
  900. for (key in message) {
  901. if (message.hasOwnProperty(key)) {
  902. exceptionValues.push(key + ": " + message[key]);
  903. }
  904. }
  905. exceptionMessage = exceptionValues.join("\n") || "";
  906. exceptionValues = exceptionMessage.split("\n");
  907. exceptionMessage = "EXCEPTION: " + exceptionValues.join("\nEXCEPTION: ");
  908. SWFUpload.Console.writeLine(exceptionMessage);
  909. } else {
  910. SWFUpload.Console.writeLine(message);
  911. }
  912. }
  913. };
  914. SWFUpload.Console = {};
  915. SWFUpload.Console.writeLine = function (message) {
  916. var console, documentForm;
  917. try {
  918. console = document.getElementById("SWFUpload_Console");
  919. if (!console) {
  920. documentForm = document.createElement("form");
  921. document.getElementsByTagName("body")[0].appendChild(documentForm);
  922. console = document.createElement("textarea");
  923. console.id = "SWFUpload_Console";
  924. console.style.fontFamily = "monospace";
  925. console.setAttribute("wrap", "off");
  926. console.wrap = "off";
  927. console.style.overflow = "auto";
  928. console.style.width = "700px";
  929. console.style.height = "350px";
  930. console.style.margin = "5px";
  931. documentForm.appendChild(console);
  932. }
  933. console.value += message + "\n";
  934. console.scrollTop = console.scrollHeight - console.clientHeight;
  935. } catch (ex) {
  936. alert("Exception: " + ex.name + " Message: " + ex.message);
  937. }
  938. };
  939. /* SWFObject v2.2 <http://code.google.com/p/swfobject/>
  940. is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
  941. */
  942. swfobject = function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttr

Large files files are truncated, but you can click here to view the full file