PageRenderTime 81ms CodeModel.GetById 30ms RepoModel.GetById 0ms app.codeStats 1ms

/VivoWebControls/SWFUpload/swfupload.js

https://bitbucket.org/xfernal/vivosocial
JavaScript | 1132 lines | 739 code | 182 blank | 211 comment | 95 complexity | bb1a52feaaec467fc670f7c1e95652a4 MD5 | raw file
Possible License(s): LGPL-3.0, MPL-2.0-no-copyleft-exception

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

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