Merge branch 'fixes' into main/rendor-staging
[ryzomcore.git] / web / public_php / ams / js / jquery.uploadify-3.1.js
blob95906815063a0377b19fff86d654da6b5e2a1ad5
1 /*\r
2 Uploadify v3.1.1\r
3 Copyright (c) 2012 Reactive Apps, Ronnie Garcia\r
4 Released under the MIT License <http://www.opensource.org/licenses/mit-license.php>\r
5 \r
6 SWFUpload: http://www.swfupload.org, http://swfupload.googlecode.com\r
7 mmSWFUpload 1.0: Flash upload dialog - http://profandesign.se/swfupload/,  http://www.vinterwebb.se/\r
8 SWFUpload is (c) 2006-2007 Lars Huring, Olov Nilzén and Mammon Media and is released under the MIT License:\r
9 http://www.opensource.org/licenses/mit-license.php\r
10 SWFUpload 2 is (c) 2007-2008 Jake Roberts and is released under the MIT License:\r
11 http://www.opensource.org/licenses/mit-license.php\r
13 SWFObject v2.2 <http://code.google.com/p/swfobject/> \r
14 is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>\r
15 */\r
16 ;\r
17 var swfobject = function () {\r
18         var aq = "undefined",\r
19                 aD = "object",\r
20                 ab = "Shockwave Flash",\r
21                 X = "ShockwaveFlash.ShockwaveFlash",\r
22                 aE = "application/x-shockwave-flash",\r
23                 ac = "SWFObjectExprInst",\r
24                 ax = "onreadystatechange",\r
25                 af = window,\r
26                 aL = document,\r
27                 aB = navigator,\r
28                 aa = false,\r
29                 Z = [aN],\r
30                 aG = [],\r
31                 ag = [],\r
32                 al = [],\r
33                 aJ, ad, ap, at, ak = false,\r
34                 aU = false,\r
35                 aH, an, aI = true,\r
36                 ah = function () {\r
37                         var a = typeof aL.getElementById != aq && typeof aL.getElementsByTagName != aq && typeof aL.createElement != aq,\r
38                                 e = aB.userAgent.toLowerCase(),\r
39                                 c = aB.platform.toLowerCase(),\r
40                                 h = c ? /win/.test(c) : /win/.test(e),\r
41                                 j = c ? /mac/.test(c) : /mac/.test(e),\r
42                                 g = /webkit/.test(e) ? parseFloat(e.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false,\r
43                                 d = !+"\v1",\r
44                                 f = [0, 0, 0],\r
45                                 k = null;\r
46                         if (typeof aB.plugins != aq && typeof aB.plugins[ab] == aD) {\r
47                                 k = aB.plugins[ab].description;\r
48                                 if (k && !(typeof aB.mimeTypes != aq && aB.mimeTypes[aE] && !aB.mimeTypes[aE].enabledPlugin)) {\r
49                                         aa = true;\r
50                                         d = false;\r
51                                         k = k.replace(/^.*\s+(\S+\s+\S+$)/, "$1");\r
52                                         f[0] = parseInt(k.replace(/^(.*)\..*$/, "$1"), 10);\r
53                                         f[1] = parseInt(k.replace(/^.*\.(.*)\s.*$/, "$1"), 10);\r
54                                         f[2] = /[a-zA-Z]/.test(k) ? parseInt(k.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;\r
55                                 }\r
56                         } else {\r
57                                 if (typeof af.ActiveXObject != aq) {\r
58                                         try {\r
59                                                 var i = new ActiveXObject(X);\r
60                                                 if (i) {\r
61                                                         k = i.GetVariable("$version");\r
62                                                         if (k) {\r
63                                                                 d = true;\r
64                                                                 k = k.split(" ")[1].split(",");\r
65                                                                 f = [parseInt(k[0], 10), parseInt(k[1], 10), parseInt(k[2], 10)];\r
66                                                         }\r
67                                                 }\r
68                                         } catch (b) {}\r
69                                 }\r
70                         }\r
71                         return {\r
72                                 w3: a,\r
73                                 pv: f,\r
74                                 wk: g,\r
75                                 ie: d,\r
76                                 win: h,\r
77                                 mac: j\r
78                         };\r
79                 }(),\r
80                 aK = function () {\r
81                         if (!ah.w3) {\r
82                                 return;\r
83                         }\r
84                         if ((typeof aL.readyState != aq && aL.readyState == "complete") || (typeof aL.readyState == aq && (aL.getElementsByTagName("body")[0] || aL.body))) {\r
85                                 aP();\r
86                         }\r
87                         if (!ak) {\r
88                                 if (typeof aL.addEventListener != aq) {\r
89                                         aL.addEventListener("DOMContentLoaded", aP, false);\r
90                                 }\r
91                                 if (ah.ie && ah.win) {\r
92                                         aL.attachEvent(ax, function () {\r
93                                                 if (aL.readyState == "complete") {\r
94                                                         aL.detachEvent(ax, arguments.callee);\r
95                                                         aP();\r
96                                                 }\r
97                                         });\r
98                                         if (af == top) {\r
99                                                 (function () {\r
100                                                         if (ak) {\r
101                                                                 return;\r
102                                                         }\r
103                                                         try {\r
104                                                                 aL.documentElement.doScroll("left");\r
105                                                         } catch (a) {\r
106                                                                 setTimeout(arguments.callee, 0);\r
107                                                                 return;\r
108                                                         }\r
109                                                         aP();\r
110                                                 })();\r
111                                         }\r
112                                 }\r
113                                 if (ah.wk) {\r
114                                         (function () {\r
115                                                 if (ak) {\r
116                                                         return;\r
117                                                 }\r
118                                                 if (!/loaded|complete/.test(aL.readyState)) {\r
119                                                         setTimeout(arguments.callee, 0);\r
120                                                         return;\r
121                                                 }\r
122                                                 aP();\r
123                                         })();\r
124                                 }\r
125                                 aC(aP);\r
126                         }\r
127                 }();\r
129         function aP() {\r
130                 if (ak) {\r
131                         return;\r
132                 }\r
133                 try {\r
134                         var b = aL.getElementsByTagName("body")[0].appendChild(ar("span"));\r
135                         b.parentNode.removeChild(b);\r
136                 } catch (a) {\r
137                         return;\r
138                 }\r
139                 ak = true;\r
140                 var d = Z.length;\r
141                 for (var c = 0; c < d; c++) {\r
142                         Z[c]();\r
143                 }\r
144         }\r
145         function aj(a) {\r
146                 if (ak) {\r
147                         a();\r
148                 } else {\r
149                         Z[Z.length] = a;\r
150                 }\r
151         }\r
152         function aC(a) {\r
153                 if (typeof af.addEventListener != aq) {\r
154                         af.addEventListener("load", a, false);\r
155                 } else {\r
156                         if (typeof aL.addEventListener != aq) {\r
157                                 aL.addEventListener("load", a, false);\r
158                         } else {\r
159                                 if (typeof af.attachEvent != aq) {\r
160                                         aM(af, "onload", a);\r
161                                 } else {\r
162                                         if (typeof af.onload == "function") {\r
163                                                 var b = af.onload;\r
164                                                 af.onload = function () {\r
165                                                         b();\r
166                                                         a();\r
167                                                 };\r
168                                         } else {\r
169                                                 af.onload = a;\r
170                                         }\r
171                                 }\r
172                         }\r
173                 }\r
174         }\r
175         function aN() {\r
176                 if (aa) {\r
177                         Y();\r
178                 } else {\r
179                         am();\r
180                 }\r
181         }\r
182         function Y() {\r
183                 var d = aL.getElementsByTagName("body")[0];\r
184                 var b = ar(aD);\r
185                 b.setAttribute("type", aE);\r
186                 var a = d.appendChild(b);\r
187                 if (a) {\r
188                         var c = 0;\r
189                         (function () {\r
190                                 if (typeof a.GetVariable != aq) {\r
191                                         var e = a.GetVariable("$version");\r
192                                         if (e) {\r
193                                                 e = e.split(" ")[1].split(",");\r
194                                                 ah.pv = [parseInt(e[0], 10), parseInt(e[1], 10), parseInt(e[2], 10)];\r
195                                         }\r
196                                 } else {\r
197                                         if (c < 10) {\r
198                                                 c++;\r
199                                                 setTimeout(arguments.callee, 10);\r
200                                                 return;\r
201                                         }\r
202                                 }\r
203                                 d.removeChild(b);\r
204                                 a = null;\r
205                                 am();\r
206                         })();\r
207                 } else {\r
208                         am();\r
209                 }\r
210         }\r
211         function am() {\r
212                 var g = aG.length;\r
213                 if (g > 0) {\r
214                         for (var h = 0; h < g; h++) {\r
215                                 var c = aG[h].id;\r
216                                 var l = aG[h].callbackFn;\r
217                                 var a = {\r
218                                         success: false,\r
219                                         id: c\r
220                                 };\r
221                                 if (ah.pv[0] > 0) {\r
222                                         var i = aS(c);\r
223                                         if (i) {\r
224                                                 if (ao(aG[h].swfVersion) && !(ah.wk && ah.wk < 312)) {\r
225                                                         ay(c, true);\r
226                                                         if (l) {\r
227                                                                 a.success = true;\r
228                                                                 a.ref = av(c);\r
229                                                                 l(a);\r
230                                                         }\r
231                                                 } else {\r
232                                                         if (aG[h].expressInstall && au()) {\r
233                                                                 var e = {};\r
234                                                                 e.data = aG[h].expressInstall;\r
235                                                                 e.width = i.getAttribute("width") || "0";\r
236                                                                 e.height = i.getAttribute("height") || "0";\r
237                                                                 if (i.getAttribute("class")) {\r
238                                                                         e.styleclass = i.getAttribute("class");\r
239                                                                 }\r
240                                                                 if (i.getAttribute("align")) {\r
241                                                                         e.align = i.getAttribute("align");\r
242                                                                 }\r
243                                                                 var f = {};\r
244                                                                 var d = i.getElementsByTagName("param");\r
245                                                                 var k = d.length;\r
246                                                                 for (var j = 0; j < k; j++) {\r
247                                                                         if (d[j].getAttribute("name").toLowerCase() != "movie") {\r
248                                                                                 f[d[j].getAttribute("name")] = d[j].getAttribute("value");\r
249                                                                         }\r
250                                                                 }\r
251                                                                 ae(e, f, c, l);\r
252                                                         } else {\r
253                                                                 aF(i);\r
254                                                                 if (l) {\r
255                                                                         l(a);\r
256                                                                 }\r
257                                                         }\r
258                                                 }\r
259                                         }\r
260                                 } else {\r
261                                         ay(c, true);\r
262                                         if (l) {\r
263                                                 var b = av(c);\r
264                                                 if (b && typeof b.SetVariable != aq) {\r
265                                                         a.success = true;\r
266                                                         a.ref = b;\r
267                                                 }\r
268                                                 l(a);\r
269                                         }\r
270                                 }\r
271                         }\r
272                 }\r
273         }\r
274         function av(b) {\r
275                 var d = null;\r
276                 var c = aS(b);\r
277                 if (c && c.nodeName == "OBJECT") {\r
278                         if (typeof c.SetVariable != aq) {\r
279                                 d = c;\r
280                         } else {\r
281                                 var a = c.getElementsByTagName(aD)[0];\r
282                                 if (a) {\r
283                                         d = a;\r
284                                 }\r
285                         }\r
286                 }\r
287                 return d;\r
288         }\r
289         function au() {\r
290                 return !aU && ao("6.0.65") && (ah.win || ah.mac) && !(ah.wk && ah.wk < 312);\r
291         }\r
292         function ae(f, d, h, e) {\r
293                 aU = true;\r
294                 ap = e || null;\r
295                 at = {\r
296                         success: false,\r
297                         id: h\r
298                 };\r
299                 var a = aS(h);\r
300                 if (a) {\r
301                         if (a.nodeName == "OBJECT") {\r
302                                 aJ = aO(a);\r
303                                 ad = null;\r
304                         } else {\r
305                                 aJ = a;\r
306                                 ad = h;\r
307                         }\r
308                         f.id = ac;\r
309                         if (typeof f.width == aq || (!/%$/.test(f.width) && parseInt(f.width, 10) < 310)) {\r
310                                 f.width = "310";\r
311                         }\r
312                         if (typeof f.height == aq || (!/%$/.test(f.height) && parseInt(f.height, 10) < 137)) {\r
313                                 f.height = "137";\r
314                         }\r
315                         aL.title = aL.title.slice(0, 47) + " - Flash Player Installation";\r
316                         var b = ah.ie && ah.win ? "ActiveX" : "PlugIn",\r
317                                 c = "MMredirectURL=" + af.location.toString().replace(/&/g, "%26") + "&MMplayerType=" + b + "&MMdoctitle=" + aL.title;\r
318                         if (typeof d.flashvars != aq) {\r
319                                 d.flashvars += "&" + c;\r
320                         } else {\r
321                                 d.flashvars = c;\r
322                         }\r
323                         if (ah.ie && ah.win && a.readyState != 4) {\r
324                                 var g = ar("div");\r
325                                 h += "SWFObjectNew";\r
326                                 g.setAttribute("id", h);\r
327                                 a.parentNode.insertBefore(g, a);\r
328                                 a.style.display = "none";\r
329                                 (function () {\r
330                                         if (a.readyState == 4) {\r
331                                                 a.parentNode.removeChild(a);\r
332                                         } else {\r
333                                                 setTimeout(arguments.callee, 10);\r
334                                         }\r
335                                 })();\r
336                         }\r
337                         aA(f, d, h);\r
338                 }\r
339         }\r
340         function aF(a) {\r
341                 if (ah.ie && ah.win && a.readyState != 4) {\r
342                         var b = ar("div");\r
343                         a.parentNode.insertBefore(b, a);\r
344                         b.parentNode.replaceChild(aO(a), b);\r
345                         a.style.display = "none";\r
346                         (function () {\r
347                                 if (a.readyState == 4) {\r
348                                         a.parentNode.removeChild(a);\r
349                                 } else {\r
350                                         setTimeout(arguments.callee, 10);\r
351                                 }\r
352                         })();\r
353                 } else {\r
354                         a.parentNode.replaceChild(aO(a), a);\r
355                 }\r
356         }\r
357         function aO(b) {\r
358                 var d = ar("div");\r
359                 if (ah.win && ah.ie) {\r
360                         d.innerHTML = b.innerHTML;\r
361                 } else {\r
362                         var e = b.getElementsByTagName(aD)[0];\r
363                         if (e) {\r
364                                 var a = e.childNodes;\r
365                                 if (a) {\r
366                                         var f = a.length;\r
367                                         for (var c = 0; c < f; c++) {\r
368                                                 if (!(a[c].nodeType == 1 && a[c].nodeName == "PARAM") && !(a[c].nodeType == 8)) {\r
369                                                         d.appendChild(a[c].cloneNode(true));\r
370                                                 }\r
371                                         }\r
372                                 }\r
373                         }\r
374                 }\r
375                 return d;\r
376         }\r
377         function aA(e, g, c) {\r
378                 var d, a = aS(c);\r
379                 if (ah.wk && ah.wk < 312) {\r
380                         return d;\r
381                 }\r
382                 if (a) {\r
383                         if (typeof e.id == aq) {\r
384                                 e.id = c;\r
385                         }\r
386                         if (ah.ie && ah.win) {\r
387                                 var f = "";\r
388                                 for (var i in e) {\r
389                                         if (e[i] != Object.prototype[i]) {\r
390                                                 if (i.toLowerCase() == "data") {\r
391                                                         g.movie = e[i];\r
392                                                 } else {\r
393                                                         if (i.toLowerCase() == "styleclass") {\r
394                                                                 f += ' class="' + e[i] + '"';\r
395                                                         } else {\r
396                                                                 if (i.toLowerCase() != "classid") {\r
397                                                                         f += " " + i + '="' + e[i] + '"';\r
398                                                                 }\r
399                                                         }\r
400                                                 }\r
401                                         }\r
402                                 }\r
403                                 var h = "";\r
404                                 for (var j in g) {\r
405                                         if (g[j] != Object.prototype[j]) {\r
406                                                 h += '<param name="' + j + '" value="' + g[j] + '" />';\r
407                                         }\r
408                                 }\r
409                                 a.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + f + ">" + h + "</object>";\r
410                                 ag[ag.length] = e.id;\r
411                                 d = aS(e.id);\r
412                         } else {\r
413                                 var b = ar(aD);\r
414                                 b.setAttribute("type", aE);\r
415                                 for (var k in e) {\r
416                                         if (e[k] != Object.prototype[k]) {\r
417                                                 if (k.toLowerCase() == "styleclass") {\r
418                                                         b.setAttribute("class", e[k]);\r
419                                                 } else {\r
420                                                         if (k.toLowerCase() != "classid") {\r
421                                                                 b.setAttribute(k, e[k]);\r
422                                                         }\r
423                                                 }\r
424                                         }\r
425                                 }\r
426                                 for (var l in g) {\r
427                                         if (g[l] != Object.prototype[l] && l.toLowerCase() != "movie") {\r
428                                                 aQ(b, l, g[l]);\r
429                                         }\r
430                                 }\r
431                                 a.parentNode.replaceChild(b, a);\r
432                                 d = b;\r
433                         }\r
434                 }\r
435                 return d;\r
436         }\r
437         function aQ(b, d, c) {\r
438                 var a = ar("param");\r
439                 a.setAttribute("name", d);\r
440                 a.setAttribute("value", c);\r
441                 b.appendChild(a);\r
442         }\r
443         function aw(a) {\r
444                 var b = aS(a);\r
445                 if (b && b.nodeName == "OBJECT") {\r
446                         if (ah.ie && ah.win) {\r
447                                 b.style.display = "none";\r
448                                 (function () {\r
449                                         if (b.readyState == 4) {\r
450                                                 aT(a);\r
451                                         } else {\r
452                                                 setTimeout(arguments.callee, 10);\r
453                                         }\r
454                                 })();\r
455                         } else {\r
456                                 b.parentNode.removeChild(b);\r
457                         }\r
458                 }\r
459         }\r
460         function aT(a) {\r
461                 var b = aS(a);\r
462                 if (b) {\r
463                         for (var c in b) {\r
464                                 if (typeof b[c] == "function") {\r
465                                         b[c] = null;\r
466                                 }\r
467                         }\r
468                         b.parentNode.removeChild(b);\r
469                 }\r
470         }\r
471         function aS(a) {\r
472                 var c = null;\r
473                 try {\r
474                         c = aL.getElementById(a);\r
475                 } catch (b) {}\r
476                 return c;\r
477         }\r
478         function ar(a) {\r
479                 return aL.createElement(a);\r
480         }\r
481         function aM(a, c, b) {\r
482                 a.attachEvent(c, b);\r
483                 al[al.length] = [a, c, b];\r
484         }\r
485         function ao(a) {\r
486                 var b = ah.pv,\r
487                         c = a.split(".");\r
488                 c[0] = parseInt(c[0], 10);\r
489                 c[1] = parseInt(c[1], 10) || 0;\r
490                 c[2] = parseInt(c[2], 10) || 0;\r
491                 return (b[0] > c[0] || (b[0] == c[0] && b[1] > c[1]) || (b[0] == c[0] && b[1] == c[1] && b[2] >= c[2])) ? true : false;\r
492         }\r
493         function az(b, f, a, c) {\r
494                 if (ah.ie && ah.mac) {\r
495                         return;\r
496                 }\r
497                 var e = aL.getElementsByTagName("head")[0];\r
498                 if (!e) {\r
499                         return;\r
500                 }\r
501                 var g = (a && typeof a == "string") ? a : "screen";\r
502                 if (c) {\r
503                         aH = null;\r
504                         an = null;\r
505                 }\r
506                 if (!aH || an != g) {\r
507                         var d = ar("style");\r
508                         d.setAttribute("type", "text/css");\r
509                         d.setAttribute("media", g);\r
510                         aH = e.appendChild(d);\r
511                         if (ah.ie && ah.win && typeof aL.styleSheets != aq && aL.styleSheets.length > 0) {\r
512                                 aH = aL.styleSheets[aL.styleSheets.length - 1];\r
513                         }\r
514                         an = g;\r
515                 }\r
516                 if (ah.ie && ah.win) {\r
517                         if (aH && typeof aH.addRule == aD) {\r
518                                 aH.addRule(b, f);\r
519                         }\r
520                 } else {\r
521                         if (aH && typeof aL.createTextNode != aq) {\r
522                                 aH.appendChild(aL.createTextNode(b + " {" + f + "}"));\r
523                         }\r
524                 }\r
525         }\r
526         function ay(a, c) {\r
527                 if (!aI) {\r
528                         return;\r
529                 }\r
530                 var b = c ? "visible" : "hidden";\r
531                 if (ak && aS(a)) {\r
532                         aS(a).style.visibility = b;\r
533                 } else {\r
534                         az("#" + a, "visibility:" + b);\r
535                 }\r
536         }\r
537         function ai(b) {\r
538                 var a = /[\\\"<>\.;]/;\r
539                 var c = a.exec(b) != null;\r
540                 return c && typeof encodeURIComponent != aq ? encodeURIComponent(b) : b;\r
541         }\r
542         var aR = function () {\r
543                 if (ah.ie && ah.win) {\r
544                         window.attachEvent("onunload", function () {\r
545                                 var a = al.length;\r
546                                 for (var b = 0; b < a; b++) {\r
547                                         al[b][0].detachEvent(al[b][1], al[b][2]);\r
548                                 }\r
549                                 var d = ag.length;\r
550                                 for (var c = 0; c < d; c++) {\r
551                                         aw(ag[c]);\r
552                                 }\r
553                                 for (var e in ah) {\r
554                                         ah[e] = null;\r
555                                 }\r
556                                 ah = null;\r
557                                 for (var f in swfobject) {\r
558                                         swfobject[f] = null;\r
559                                 }\r
560                                 swfobject = null;\r
561                         });\r
562                 }\r
563         }();\r
564         return {\r
565                 registerObject: function (a, e, c, b) {\r
566                         if (ah.w3 && a && e) {\r
567                                 var d = {};\r
568                                 d.id = a;\r
569                                 d.swfVersion = e;\r
570                                 d.expressInstall = c;\r
571                                 d.callbackFn = b;\r
572                                 aG[aG.length] = d;\r
573                                 ay(a, false);\r
574                         } else {\r
575                                 if (b) {\r
576                                         b({\r
577                                                 success: false,\r
578                                                 id: a\r
579                                         });\r
580                                 }\r
581                         }\r
582                 },\r
583                 getObjectById: function (a) {\r
584                         if (ah.w3) {\r
585                                 return av(a);\r
586                         }\r
587                 },\r
588                 embedSWF: function (k, e, h, f, c, a, b, i, g, j) {\r
589                         var d = {\r
590                                 success: false,\r
591                                 id: e\r
592                         };\r
593                         if (ah.w3 && !(ah.wk && ah.wk < 312) && k && e && h && f && c) {\r
594                                 ay(e, false);\r
595                                 aj(function () {\r
596                                         h += "";\r
597                                         f += "";\r
598                                         var q = {};\r
599                                         if (g && typeof g === aD) {\r
600                                                 for (var o in g) {\r
601                                                         q[o] = g[o];\r
602                                                 }\r
603                                         }\r
604                                         q.data = k;\r
605                                         q.width = h;\r
606                                         q.height = f;\r
607                                         var n = {};\r
608                                         if (i && typeof i === aD) {\r
609                                                 for (var p in i) {\r
610                                                         n[p] = i[p];\r
611                                                 }\r
612                                         }\r
613                                         if (b && typeof b === aD) {\r
614                                                 for (var l in b) {\r
615                                                         if (typeof n.flashvars != aq) {\r
616                                                                 n.flashvars += "&" + l + "=" + b[l];\r
617                                                         } else {\r
618                                                                 n.flashvars = l + "=" + b[l];\r
619                                                         }\r
620                                                 }\r
621                                         }\r
622                                         if (ao(c)) {\r
623                                                 var m = aA(q, n, e);\r
624                                                 if (q.id == e) {\r
625                                                         ay(e, true);\r
626                                                 }\r
627                                                 d.success = true;\r
628                                                 d.ref = m;\r
629                                         } else {\r
630                                                 if (a && au()) {\r
631                                                         q.data = a;\r
632                                                         ae(q, n, e, j);\r
633                                                         return;\r
634                                                 } else {\r
635                                                         ay(e, true);\r
636                                                 }\r
637                                         }\r
638                                         if (j) {\r
639                                                 j(d);\r
640                                         }\r
641                                 });\r
642                         } else {\r
643                                 if (j) {\r
644                                         j(d);\r
645                                 }\r
646                         }\r
647                 },\r
648                 switchOffAutoHideShow: function () {\r
649                         aI = false;\r
650                 },\r
651                 ua: ah,\r
652                 getFlashPlayerVersion: function () {\r
653                         return {\r
654                                 major: ah.pv[0],\r
655                                 minor: ah.pv[1],\r
656                                 release: ah.pv[2]\r
657                         };\r
658                 },\r
659                 hasFlashPlayerVersion: ao,\r
660                 createSWF: function (a, b, c) {\r
661                         if (ah.w3) {\r
662                                 return aA(a, b, c);\r
663                         } else {\r
664                                 return undefined;\r
665                         }\r
666                 },\r
667                 showExpressInstall: function (b, a, d, c) {\r
668                         if (ah.w3 && au()) {\r
669                                 ae(b, a, d, c);\r
670                         }\r
671                 },\r
672                 removeSWF: function (a) {\r
673                         if (ah.w3) {\r
674                                 aw(a);\r
675                         }\r
676                 },\r
677                 createCSS: function (b, a, c, d) {\r
678                         if (ah.w3) {\r
679                                 az(b, a, c, d);\r
680                         }\r
681                 },\r
682                 addDomLoadEvent: aj,\r
683                 addLoadEvent: aC,\r
684                 getQueryParamValue: function (b) {\r
685                         var a = aL.location.search || aL.location.hash;\r
686                         if (a) {\r
687                                 if (/\?/.test(a)) {\r
688                                         a = a.split("?")[1];\r
689                                 }\r
690                                 if (b == null) {\r
691                                         return ai(a);\r
692                                 }\r
693                                 var c = a.split("&");\r
694                                 for (var d = 0; d < c.length; d++) {\r
695                                         if (c[d].substring(0, c[d].indexOf("=")) == b) {\r
696                                                 return ai(c[d].substring((c[d].indexOf("=") + 1)));\r
697                                         }\r
698                                 }\r
699                         }\r
700                         return "";\r
701                 },\r
702                 expressInstallCallback: function () {\r
703                         if (aU) {\r
704                                 var a = aS(ac);\r
705                                 if (a && aJ) {\r
706                                         a.parentNode.replaceChild(aJ, a);\r
707                                         if (ad) {\r
708                                                 ay(ad, true);\r
709                                                 if (ah.ie && ah.win) {\r
710                                                         aJ.style.display = "block";\r
711                                                 }\r
712                                         }\r
713                                         if (ap) {\r
714                                                 ap(at);\r
715                                         }\r
716                                 }\r
717                                 aU = false;\r
718                         }\r
719                 }\r
720         };\r
721 }();\r
722 var SWFUpload;\r
723 if (SWFUpload == undefined) {\r
724         SWFUpload = function (b) {\r
725                 this.initSWFUpload(b);\r
726         };\r
728 SWFUpload.prototype.initSWFUpload = function (c) {\r
729         try {\r
730                 this.customSettings = {};\r
731                 this.settings = c;\r
732                 this.eventQueue = [];\r
733                 this.movieName = "SWFUpload_" + SWFUpload.movieCount++;\r
734                 this.movieElement = null;\r
735                 SWFUpload.instances[this.movieName] = this;\r
736                 this.initSettings();\r
737                 this.loadFlash();\r
738                 this.displayDebugInfo();\r
739         } catch (d) {\r
740                 delete SWFUpload.instances[this.movieName];\r
741                 throw d;\r
742         }\r
743 };\r
744 SWFUpload.instances = {};\r
745 SWFUpload.movieCount = 0;\r
746 SWFUpload.version = "2.2.0 2009-03-25";\r
747 SWFUpload.QUEUE_ERROR = {\r
748         QUEUE_LIMIT_EXCEEDED: -100,\r
749         FILE_EXCEEDS_SIZE_LIMIT: -110,\r
750         ZERO_BYTE_FILE: -120,\r
751         INVALID_FILETYPE: -130\r
752 };\r
753 SWFUpload.UPLOAD_ERROR = {\r
754         HTTP_ERROR: -200,\r
755         MISSING_UPLOAD_URL: -210,\r
756         IO_ERROR: -220,\r
757         SECURITY_ERROR: -230,\r
758         UPLOAD_LIMIT_EXCEEDED: -240,\r
759         UPLOAD_FAILED: -250,\r
760         SPECIFIED_FILE_ID_NOT_FOUND: -260,\r
761         FILE_VALIDATION_FAILED: -270,\r
762         FILE_CANCELLED: -280,\r
763         UPLOAD_STOPPED: -290\r
764 };\r
765 SWFUpload.FILE_STATUS = {\r
766         QUEUED: -1,\r
767         IN_PROGRESS: -2,\r
768         ERROR: -3,\r
769         COMPLETE: -4,\r
770         CANCELLED: -5\r
771 };\r
772 SWFUpload.BUTTON_ACTION = {\r
773         SELECT_FILE: -100,\r
774         SELECT_FILES: -110,\r
775         START_UPLOAD: -120\r
776 };\r
777 SWFUpload.CURSOR = {\r
778         ARROW: -1,\r
779         HAND: -2\r
780 };\r
781 SWFUpload.WINDOW_MODE = {\r
782         WINDOW: "window",\r
783         TRANSPARENT: "transparent",\r
784         OPAQUE: "opaque"\r
785 };\r
786 SWFUpload.completeURL = function (e) {\r
787         if (typeof(e) !== "string" || e.match(/^https?:\/\//i) || e.match(/^\//)) {\r
788                 return e;\r
789         }\r
790         var f = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ":" + window.location.port : "");\r
791         var d = window.location.pathname.lastIndexOf("/");\r
792         if (d <= 0) {\r
793                 path = "/";\r
794         } else {\r
795                 path = window.location.pathname.substr(0, d) + "/";\r
796         }\r
797         return path + e;\r
798 };\r
799 SWFUpload.prototype.initSettings = function () {\r
800         this.ensureDefault = function (c, d) {\r
801                 this.settings[c] = (this.settings[c] == undefined) ? d : this.settings[c];\r
802         };\r
803         this.ensureDefault("upload_url", "");\r
804         this.ensureDefault("preserve_relative_urls", false);\r
805         this.ensureDefault("file_post_name", "Filedata");\r
806         this.ensureDefault("post_params", {});\r
807         this.ensureDefault("use_query_string", false);\r
808         this.ensureDefault("requeue_on_error", false);\r
809         this.ensureDefault("http_success", []);\r
810         this.ensureDefault("assume_success_timeout", 0);\r
811         this.ensureDefault("file_types", "*.*");\r
812         this.ensureDefault("file_types_description", "All Files");\r
813         this.ensureDefault("file_size_limit", 0);\r
814         this.ensureDefault("file_upload_limit", 0);\r
815         this.ensureDefault("file_queue_limit", 0);\r
816         this.ensureDefault("flash_url", "swfupload.swf");\r
817         this.ensureDefault("prevent_swf_caching", true);\r
818         this.ensureDefault("button_image_url", "");\r
819         this.ensureDefault("button_width", 1);\r
820         this.ensureDefault("button_height", 1);\r
821         this.ensureDefault("button_text", "");\r
822         this.ensureDefault("button_text_style", "color: #000000; font-size: 16pt;");\r
823         this.ensureDefault("button_text_top_padding", 0);\r
824         this.ensureDefault("button_text_left_padding", 0);\r
825         this.ensureDefault("button_action", SWFUpload.BUTTON_ACTION.SELECT_FILES);\r
826         this.ensureDefault("button_disabled", false);\r
827         this.ensureDefault("button_placeholder_id", "");\r
828         this.ensureDefault("button_placeholder", null);\r
829         this.ensureDefault("button_cursor", SWFUpload.CURSOR.ARROW);\r
830         this.ensureDefault("button_window_mode", SWFUpload.WINDOW_MODE.WINDOW);\r
831         this.ensureDefault("debug", false);\r
832         this.settings.debug_enabled = this.settings.debug;\r
833         this.settings.return_upload_start_handler = this.returnUploadStart;\r
834         this.ensureDefault("swfupload_loaded_handler", null);\r
835         this.ensureDefault("file_dialog_start_handler", null);\r
836         this.ensureDefault("file_queued_handler", null);\r
837         this.ensureDefault("file_queue_error_handler", null);\r
838         this.ensureDefault("file_dialog_complete_handler", null);\r
839         this.ensureDefault("upload_start_handler", null);\r
840         this.ensureDefault("upload_progress_handler", null);\r
841         this.ensureDefault("upload_error_handler", null);\r
842         this.ensureDefault("upload_success_handler", null);\r
843         this.ensureDefault("upload_complete_handler", null);\r
844         this.ensureDefault("debug_handler", this.debugMessage);\r
845         this.ensureDefault("custom_settings", {});\r
846         this.customSettings = this.settings.custom_settings;\r
847         if ( !! this.settings.prevent_swf_caching) {\r
848                 this.settings.flash_url = this.settings.flash_url + (this.settings.flash_url.indexOf("?") < 0 ? "?" : "&") + "preventswfcaching=" + new Date().getTime();\r
849         }\r
850         if (!this.settings.preserve_relative_urls) {\r
851                 this.settings.upload_url = SWFUpload.completeURL(this.settings.upload_url);\r
852                 this.settings.button_image_url = SWFUpload.completeURL(this.settings.button_image_url);\r
853         }\r
854         delete this.ensureDefault;\r
855 };\r
856 SWFUpload.prototype.loadFlash = function () {\r
857         var d, c;\r
858         if (document.getElementById(this.movieName) !== null) {\r
859                 throw "ID " + this.movieName + " is already in use. The Flash Object could not be added";\r
860         }\r
861         d = document.getElementById(this.settings.button_placeholder_id) || this.settings.button_placeholder;\r
862         if (d == undefined) {\r
863                 throw "Could not find the placeholder element: " + this.settings.button_placeholder_id;\r
864         }\r
865         c = document.createElement("div");\r
866         c.innerHTML = this.getFlashHTML();\r
867         d.parentNode.replaceChild(c.firstChild, d);\r
868         if (window[this.movieName] == undefined) {\r
869                 window[this.movieName] = this.getMovieElement();\r
870         }\r
871 };\r
872 SWFUpload.prototype.getFlashHTML = function () {\r
873         return ['<object id="', this.movieName, '" type="application/x-shockwave-flash" data="', this.settings.flash_url, '" width="', this.settings.button_width, '" height="', this.settings.button_height, '" class="swfupload">', '<param name="wmode" value="', this.settings.button_window_mode, '" />', '<param name="movie" value="', this.settings.flash_url, '" />', '<param name="quality" value="high" />', '<param name="menu" value="false" />', '<param name="allowScriptAccess" value="always" />', '<param name="flashvars" value="' + this.getFlashVars() + '" />', "</object>"].join("");\r
874 };\r
875 SWFUpload.prototype.getFlashVars = function () {\r
876         var c = this.buildParamString();\r
877         var d = this.settings.http_success.join(",");\r
878         return ["movieName=", encodeURIComponent(this.movieName), "&amp;uploadURL=", encodeURIComponent(this.settings.upload_url), "&amp;useQueryString=", encodeURIComponent(this.settings.use_query_string), "&amp;requeueOnError=", encodeURIComponent(this.settings.requeue_on_error), "&amp;httpSuccess=", encodeURIComponent(d), "&amp;assumeSuccessTimeout=", encodeURIComponent(this.settings.assume_success_timeout), "&amp;params=", encodeURIComponent(c), "&amp;filePostName=", encodeURIComponent(this.settings.file_post_name), "&amp;fileTypes=", encodeURIComponent(this.settings.file_types), "&amp;fileTypesDescription=", encodeURIComponent(this.settings.file_types_description), "&amp;fileSizeLimit=", encodeURIComponent(this.settings.file_size_limit), "&amp;fileUploadLimit=", encodeURIComponent(this.settings.file_upload_limit), "&amp;fileQueueLimit=", encodeURIComponent(this.settings.file_queue_limit), "&amp;debugEnabled=", encodeURIComponent(this.settings.debug_enabled), "&amp;buttonImageURL=", encodeURIComponent(this.settings.button_image_url), "&amp;buttonWidth=", encodeURIComponent(this.settings.button_width), "&amp;buttonHeight=", encodeURIComponent(this.settings.button_height), "&amp;buttonText=", encodeURIComponent(this.settings.button_text), "&amp;buttonTextTopPadding=", encodeURIComponent(this.settings.button_text_top_padding), "&amp;buttonTextLeftPadding=", encodeURIComponent(this.settings.button_text_left_padding), "&amp;buttonTextStyle=", encodeURIComponent(this.settings.button_text_style), "&amp;buttonAction=", encodeURIComponent(this.settings.button_action), "&amp;buttonDisabled=", encodeURIComponent(this.settings.button_disabled), "&amp;buttonCursor=", encodeURIComponent(this.settings.button_cursor)].join("");\r
879 };\r
880 SWFUpload.prototype.getMovieElement = function () {\r
881         if (this.movieElement == undefined) {\r
882                 this.movieElement = document.getElementById(this.movieName);\r
883         }\r
884         if (this.movieElement === null) {\r
885                 throw "Could not find Flash element";\r
886         }\r
887         return this.movieElement;\r
888 };\r
889 SWFUpload.prototype.buildParamString = function () {\r
890         var f = this.settings.post_params;\r
891         var d = [];\r
892         if (typeof(f) === "object") {\r
893                 for (var e in f) {\r
894                         if (f.hasOwnProperty(e)) {\r
895                                 d.push(encodeURIComponent(e.toString()) + "=" + encodeURIComponent(f[e].toString()));\r
896                         }\r
897                 }\r
898         }\r
899         return d.join("&amp;");\r
900 };\r
901 SWFUpload.prototype.destroy = function () {\r
902         try {\r
903                 this.cancelUpload(null, false);\r
904                 var g = null;\r
905                 g = this.getMovieElement();\r
906                 if (g && typeof(g.CallFunction) === "unknown") {\r
907                         for (var j in g) {\r
908                                 try {\r
909                                         if (typeof(g[j]) === "function") {\r
910                                                 g[j] = null;\r
911                                         }\r
912                                 } catch (h) {}\r
913                         }\r
914                         try {\r
915                                 g.parentNode.removeChild(g);\r
916                         } catch (f) {}\r
917                 }\r
918                 window[this.movieName] = null;\r
919                 SWFUpload.instances[this.movieName] = null;\r
920                 delete SWFUpload.instances[this.movieName];\r
921                 this.movieElement = null;\r
922                 this.settings = null;\r
923                 this.customSettings = null;\r
924                 this.eventQueue = null;\r
925                 this.movieName = null;\r
926                 return true;\r
927         } catch (i) {\r
928                 return false;\r
929         }\r
930 };\r
931 SWFUpload.prototype.displayDebugInfo = function () {\r
932         this.debug(["---SWFUpload Instance Info---\n", "Version: ", SWFUpload.version, "\n", "Movie Name: ", this.movieName, "\n", "Settings:\n", "\t", "upload_url:               ", this.settings.upload_url, "\n", "\t", "flash_url:                ", this.settings.flash_url, "\n", "\t", "use_query_string:         ", this.settings.use_query_string.toString(), "\n", "\t", "requeue_on_error:         ", this.settings.requeue_on_error.toString(), "\n", "\t", "http_success:             ", this.settings.http_success.join(", "), "\n", "\t", "assume_success_timeout:   ", this.settings.assume_success_timeout, "\n", "\t", "file_post_name:           ", this.settings.file_post_name, "\n", "\t", "post_params:              ", this.settings.post_params.toString(), "\n", "\t", "file_types:               ", this.settings.file_types, "\n", "\t", "file_types_description:   ", this.settings.file_types_description, "\n", "\t", "file_size_limit:          ", this.settings.file_size_limit, "\n", "\t", "file_upload_limit:        ", this.settings.file_upload_limit, "\n", "\t", "file_queue_limit:         ", this.settings.file_queue_limit, "\n", "\t", "debug:                    ", this.settings.debug.toString(), "\n", "\t", "prevent_swf_caching:      ", this.settings.prevent_swf_caching.toString(), "\n", "\t", "button_placeholder_id:    ", this.settings.button_placeholder_id.toString(), "\n", "\t", "button_placeholder:       ", (this.settings.button_placeholder ? "Set" : "Not Set"), "\n", "\t", "button_image_url:         ", this.settings.button_image_url.toString(), "\n", "\t", "button_width:             ", this.settings.button_width.toString(), "\n", "\t", "button_height:            ", this.settings.button_height.toString(), "\n", "\t", "button_text:              ", this.settings.button_text.toString(), "\n", "\t", "button_text_style:        ", this.settings.button_text_style.toString(), "\n", "\t", "button_text_top_padding:  ", this.settings.button_text_top_padding.toString(), "\n", "\t", "button_text_left_padding: ", this.settings.button_text_left_padding.toString(), "\n", "\t", "button_action:            ", this.settings.button_action.toString(), "\n", "\t", "button_disabled:          ", this.settings.button_disabled.toString(), "\n", "\t", "custom_settings:          ", this.settings.custom_settings.toString(), "\n", "Event Handlers:\n", "\t", "swfupload_loaded_handler assigned:  ", (typeof this.settings.swfupload_loaded_handler === "function").toString(), "\n", "\t", "file_dialog_start_handler assigned: ", (typeof this.settings.file_dialog_start_handler === "function").toString(), "\n", "\t", "file_queued_handler assigned:       ", (typeof this.settings.file_queued_handler === "function").toString(), "\n", "\t", "file_queue_error_handler assigned:  ", (typeof this.settings.file_queue_error_handler === "function").toString(), "\n", "\t", "upload_start_handler assigned:      ", (typeof this.settings.upload_start_handler === "function").toString(), "\n", "\t", "upload_progress_handler assigned:   ", (typeof this.settings.upload_progress_handler === "function").toString(), "\n", "\t", "upload_error_handler assigned:      ", (typeof this.settings.upload_error_handler === "function").toString(), "\n", "\t", "upload_success_handler assigned:    ", (typeof this.settings.upload_success_handler === "function").toString(), "\n", "\t", "upload_complete_handler assigned:   ", (typeof this.settings.upload_complete_handler === "function").toString(), "\n", "\t", "debug_handler assigned:             ", (typeof this.settings.debug_handler === "function").toString(), "\n"].join(""));\r
933 };\r
934 SWFUpload.prototype.addSetting = function (d, f, e) {\r
935         if (f == undefined) {\r
936                 return (this.settings[d] = e);\r
937         } else {\r
938                 return (this.settings[d] = f);\r
939         }\r
940 };\r
941 SWFUpload.prototype.getSetting = function (b) {\r
942         if (this.settings[b] != undefined) {\r
943                 return this.settings[b];\r
944         }\r
945         return "";\r
946 };\r
947 SWFUpload.prototype.callFlash = function (functionName, argumentArray) {\r
948         argumentArray = argumentArray || [];\r
949         var movieElement = this.getMovieElement();\r
950         var returnValue, returnString;\r
951         try {\r
952                 returnString = movieElement.CallFunction('<invoke name="' + functionName + '" returntype="javascript">' + __flash__argumentsToXML(argumentArray, 0) + "</invoke>");\r
953                 returnValue = eval(returnString);\r
954         } catch (ex) {\r
955                 throw "Call to " + functionName + " failed";\r
956         }\r
957         if (returnValue != undefined && typeof returnValue.post === "object") {\r
958                 returnValue = this.unescapeFilePostParams(returnValue);\r
959         }\r
960         return returnValue;\r
961 };\r
962 SWFUpload.prototype.selectFile = function () {\r
963         this.callFlash("SelectFile");\r
964 };\r
965 SWFUpload.prototype.selectFiles = function () {\r
966         this.callFlash("SelectFiles");\r
967 };\r
968 SWFUpload.prototype.startUpload = function (b) {\r
969         this.callFlash("StartUpload", [b]);\r
970 };\r
971 SWFUpload.prototype.cancelUpload = function (d, c) {\r
972         if (c !== false) {\r
973                 c = true;\r
974         }\r
975         this.callFlash("CancelUpload", [d, c]);\r
976 };\r
977 SWFUpload.prototype.stopUpload = function () {\r
978         this.callFlash("StopUpload");\r
979 };\r
980 SWFUpload.prototype.getStats = function () {\r
981         return this.callFlash("GetStats");\r
982 };\r
983 SWFUpload.prototype.setStats = function (b) {\r
984         this.callFlash("SetStats", [b]);\r
985 };\r
986 SWFUpload.prototype.getFile = function (b) {\r
987         if (typeof(b) === "number") {\r
988                 return this.callFlash("GetFileByIndex", [b]);\r
989         } else {\r
990                 return this.callFlash("GetFile", [b]);\r
991         }\r
992 };\r
993 SWFUpload.prototype.addFileParam = function (e, d, f) {\r
994         return this.callFlash("AddFileParam", [e, d, f]);\r
995 };\r
996 SWFUpload.prototype.removeFileParam = function (d, c) {\r
997         this.callFlash("RemoveFileParam", [d, c]);\r
998 };\r
999 SWFUpload.prototype.setUploadURL = function (b) {\r
1000         this.settings.upload_url = b.toString();\r
1001         this.callFlash("SetUploadURL", [b]);\r
1002 };\r
1003 SWFUpload.prototype.setPostParams = function (b) {\r
1004         this.settings.post_params = b;\r
1005         this.callFlash("SetPostParams", [b]);\r
1006 };\r
1007 SWFUpload.prototype.addPostParam = function (d, c) {\r
1008         this.settings.post_params[d] = c;\r
1009         this.callFlash("SetPostParams", [this.settings.post_params]);\r
1010 };\r
1011 SWFUpload.prototype.removePostParam = function (b) {\r
1012         delete this.settings.post_params[b];\r
1013         this.callFlash("SetPostParams", [this.settings.post_params]);\r
1014 };\r
1015 SWFUpload.prototype.setFileTypes = function (d, c) {\r
1016         this.settings.file_types = d;\r
1017         this.settings.file_types_description = c;\r
1018         this.callFlash("SetFileTypes", [d, c]);\r
1019 };\r
1020 SWFUpload.prototype.setFileSizeLimit = function (b) {\r
1021         this.settings.file_size_limit = b;\r
1022         this.callFlash("SetFileSizeLimit", [b]);\r
1023 };\r
1024 SWFUpload.prototype.setFileUploadLimit = function (b) {\r
1025         this.settings.file_upload_limit = b;\r
1026         this.callFlash("SetFileUploadLimit", [b]);\r
1027 };\r
1028 SWFUpload.prototype.setFileQueueLimit = function (b) {\r
1029         this.settings.file_queue_limit = b;\r
1030         this.callFlash("SetFileQueueLimit", [b]);\r
1031 };\r
1032 SWFUpload.prototype.setFilePostName = function (b) {\r
1033         this.settings.file_post_name = b;\r
1034         this.callFlash("SetFilePostName", [b]);\r
1035 };\r
1036 SWFUpload.prototype.setUseQueryString = function (b) {\r
1037         this.settings.use_query_string = b;\r
1038         this.callFlash("SetUseQueryString", [b]);\r
1039 };\r
1040 SWFUpload.prototype.setRequeueOnError = function (b) {\r
1041         this.settings.requeue_on_error = b;\r
1042         this.callFlash("SetRequeueOnError", [b]);\r
1043 };\r
1044 SWFUpload.prototype.setHTTPSuccess = function (b) {\r
1045         if (typeof b === "string") {\r
1046                 b = b.replace(" ", "").split(",");\r
1047         }\r
1048         this.settings.http_success = b;\r
1049         this.callFlash("SetHTTPSuccess", [b]);\r
1050 };\r
1051 SWFUpload.prototype.setAssumeSuccessTimeout = function (b) {\r
1052         this.settings.assume_success_timeout = b;\r
1053         this.callFlash("SetAssumeSuccessTimeout", [b]);\r
1054 };\r
1055 SWFUpload.prototype.setDebugEnabled = function (b) {\r
1056         this.settings.debug_enabled = b;\r
1057         this.callFlash("SetDebugEnabled", [b]);\r
1058 };\r
1059 SWFUpload.prototype.setButtonImageURL = function (b) {\r
1060         if (b == undefined) {\r
1061                 b = "";\r
1062         }\r
1063         this.settings.button_image_url = b;\r
1064         this.callFlash("SetButtonImageURL", [b]);\r
1065 };\r
1066 SWFUpload.prototype.setButtonDimensions = function (f, e) {\r
1067         this.settings.button_width = f;\r
1068         this.settings.button_height = e;\r
1069         var d = this.getMovieElement();\r
1070         if (d != undefined) {\r
1071                 d.style.width = f + "px";\r
1072                 d.style.height = e + "px";\r
1073         }\r
1074         this.callFlash("SetButtonDimensions", [f, e]);\r
1075 };\r
1076 SWFUpload.prototype.setButtonText = function (b) {\r
1077         this.settings.button_text = b;\r
1078         this.callFlash("SetButtonText", [b]);\r
1079 };\r
1080 SWFUpload.prototype.setButtonTextPadding = function (c, d) {\r
1081         this.settings.button_text_top_padding = d;\r
1082         this.settings.button_text_left_padding = c;\r
1083         this.callFlash("SetButtonTextPadding", [c, d]);\r
1084 };\r
1085 SWFUpload.prototype.setButtonTextStyle = function (b) {\r
1086         this.settings.button_text_style = b;\r
1087         this.callFlash("SetButtonTextStyle", [b]);\r
1088 };\r
1089 SWFUpload.prototype.setButtonDisabled = function (b) {\r
1090         this.settings.button_disabled = b;\r
1091         this.callFlash("SetButtonDisabled", [b]);\r
1092 };\r
1093 SWFUpload.prototype.setButtonAction = function (b) {\r
1094         this.settings.button_action = b;\r
1095         this.callFlash("SetButtonAction", [b]);\r
1096 };\r
1097 SWFUpload.prototype.setButtonCursor = function (b) {\r
1098         this.settings.button_cursor = b;\r
1099         this.callFlash("SetButtonCursor", [b]);\r
1100 };\r
1101 SWFUpload.prototype.queueEvent = function (d, f) {\r
1102         if (f == undefined) {\r
1103                 f = [];\r
1104         } else {\r
1105                 if (!(f instanceof Array)) {\r
1106                         f = [f];\r
1107                 }\r
1108         }\r
1109         var e = this;\r
1110         if (typeof this.settings[d] === "function") {\r
1111                 this.eventQueue.push(function () {\r
1112                         this.settings[d].apply(this, f);\r
1113                 });\r
1114                 setTimeout(function () {\r
1115                         e.executeNextEvent();\r
1116                 }, 0);\r
1117         } else {\r
1118                 if (this.settings[d] !== null) {\r
1119                         throw "Event handler " + d + " is unknown or is not a function";\r
1120                 }\r
1121         }\r
1122 };\r
1123 SWFUpload.prototype.executeNextEvent = function () {\r
1124         var b = this.eventQueue ? this.eventQueue.shift() : null;\r
1125         if (typeof(b) === "function") {\r
1126                 b.apply(this);\r
1127         }\r
1128 };\r
1129 SWFUpload.prototype.unescapeFilePostParams = function (l) {\r
1130         var j = /[$]([0-9a-f]{4})/i;\r
1131         var i = {};\r
1132         var k;\r
1133         if (l != undefined) {\r
1134                 for (var h in l.post) {\r
1135                         if (l.post.hasOwnProperty(h)) {\r
1136                                 k = h;\r
1137                                 var g;\r
1138                                 while ((g = j.exec(k)) !== null) {\r
1139                                         k = k.replace(g[0], String.fromCharCode(parseInt("0x" + g[1], 16)));\r
1140                                 }\r
1141                                 i[k] = l.post[h];\r
1142                         }\r
1143                 }\r
1144                 l.post = i;\r
1145         }\r
1146         return l;\r
1147 };\r
1148 SWFUpload.prototype.testExternalInterface = function () {\r
1149         try {\r
1150                 return this.callFlash("TestExternalInterface");\r
1151         } catch (b) {\r
1152                 return false;\r
1153         }\r
1154 };\r
1155 SWFUpload.prototype.flashReady = function () {\r
1156         var b = this.getMovieElement();\r
1157         if (!b) {\r
1158                 this.debug("Flash called back ready but the flash movie can't be found.");\r
1159                 return;\r
1160         }\r
1161         this.cleanUp(b);\r
1162         this.queueEvent("swfupload_loaded_handler");\r
1163 };\r
1164 SWFUpload.prototype.cleanUp = function (f) {\r
1165         try {\r
1166                 if (this.movieElement && typeof(f.CallFunction) === "unknown") {\r
1167                         this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)");\r
1168                         for (var h in f) {\r
1169                                 try {\r
1170                                         if (typeof(f[h]) === "function") {\r
1171                                                 f[h] = null;\r
1172                                         }\r
1173                                 } catch (e) {}\r
1174                         }\r
1175                 }\r
1176         } catch (g) {}\r
1177         window.__flash__removeCallback = function (c, b) {\r
1178                 try {\r
1179                         if (c) {\r
1180                                 c[b] = null;\r
1181                         }\r
1182                 } catch (a) {}\r
1183         };\r
1184 };\r
1185 SWFUpload.prototype.fileDialogStart = function () {\r
1186         this.queueEvent("file_dialog_start_handler");\r
1187 };\r
1188 SWFUpload.prototype.fileQueued = function (b) {\r
1189         b = this.unescapeFilePostParams(b);\r
1190         this.queueEvent("file_queued_handler", b);\r
1191 };\r
1192 SWFUpload.prototype.fileQueueError = function (e, f, d) {\r
1193         e = this.unescapeFilePostParams(e);\r
1194         this.queueEvent("file_queue_error_handler", [e, f, d]);\r
1195 };\r
1196 SWFUpload.prototype.fileDialogComplete = function (d, f, e) {\r
1197         this.queueEvent("file_dialog_complete_handler", [d, f, e]);\r
1198 };\r
1199 SWFUpload.prototype.uploadStart = function (b) {\r
1200         b = this.unescapeFilePostParams(b);\r
1201         this.queueEvent("return_upload_start_handler", b);\r
1202 };\r
1203 SWFUpload.prototype.returnUploadStart = function (d) {\r
1204         var c;\r
1205         if (typeof this.settings.upload_start_handler === "function") {\r
1206                 d = this.unescapeFilePostParams(d);\r
1207                 c = this.settings.upload_start_handler.call(this, d);\r
1208         } else {\r
1209                 if (this.settings.upload_start_handler != undefined) {\r
1210                         throw "upload_start_handler must be a function";\r
1211                 }\r
1212         }\r
1213         if (c === undefined) {\r
1214                 c = true;\r
1215         }\r
1216         c = !! c;\r
1217         this.callFlash("ReturnUploadStart", [c]);\r
1218 };\r
1219 SWFUpload.prototype.uploadProgress = function (e, f, d) {\r
1220         e = this.unescapeFilePostParams(e);\r
1221         this.queueEvent("upload_progress_handler", [e, f, d]);\r
1222 };\r
1223 SWFUpload.prototype.uploadError = function (e, f, d) {\r
1224         e = this.unescapeFilePostParams(e);\r
1225         this.queueEvent("upload_error_handler", [e, f, d]);\r
1226 };\r
1227 SWFUpload.prototype.uploadSuccess = function (d, e, f) {\r
1228         d = this.unescapeFilePostParams(d);\r
1229         this.queueEvent("upload_success_handler", [d, e, f]);\r
1230 };\r
1231 SWFUpload.prototype.uploadComplete = function (b) {\r
1232         b = this.unescapeFilePostParams(b);\r
1233         this.queueEvent("upload_complete_handler", b);\r
1234 };\r
1235 SWFUpload.prototype.debug = function (b) {\r
1236         this.queueEvent("debug_handler", b);\r
1237 };\r
1238 SWFUpload.prototype.debugMessage = function (h) {\r
1239         if (this.settings.debug) {\r
1240                 var f, g = [];\r
1241                 if (typeof h === "object" && typeof h.name === "string" && typeof h.message === "string") {\r
1242                         for (var e in h) {\r
1243                                 if (h.hasOwnProperty(e)) {\r
1244                                         g.push(e + ": " + h[e]);\r
1245                                 }\r
1246                         }\r
1247                         f = g.join("\n") || "";\r
1248                         g = f.split("\n");\r
1249                         f = "EXCEPTION: " + g.join("\nEXCEPTION: ");\r
1250                         SWFUpload.Console.writeLine(f);\r
1251                 } else {\r
1252                         SWFUpload.Console.writeLine(h);\r
1253                 }\r
1254         }\r
1255 };\r
1256 SWFUpload.Console = {};\r
1257 SWFUpload.Console.writeLine = function (g) {\r
1258         var e, f;\r
1259         try {\r
1260                 e = document.getElementById("SWFUpload_Console");\r
1261                 if (!e) {\r
1262                         f = document.createElement("form");\r
1263                         document.getElementsByTagName("body")[0].appendChild(f);\r
1264                         e = document.createElement("textarea");\r
1265                         e.id = "SWFUpload_Console";\r
1266                         e.style.fontFamily = "monospace";\r
1267                         e.setAttribute("wrap", "off");\r
1268                         e.wrap = "off";\r
1269                         e.style.overflow = "auto";\r
1270                         e.style.width = "700px";\r
1271                         e.style.height = "350px";\r
1272                         e.style.margin = "5px";\r
1273                         f.appendChild(e);\r
1274                 }\r
1275                 e.value += g + "\n";\r
1276                 e.scrollTop = e.scrollHeight - e.clientHeight;\r
1277         } catch (h) {\r
1278                 alert("Exception: " + h.name + " Message: " + h.message);\r
1279         }\r
1280 };\r
1281 (function (c) {\r
1282         var b = {\r
1283                 init: function (d, e) {\r
1284                         return this.each(function () {\r
1285                                 var n = c(this);\r
1286                                 var m = n.clone();\r
1287                                 var j = c.extend({\r
1288                                         id: n.attr("id"),\r
1289                                         swf: "uploadify.swf",\r
1290                                         uploader: "uploadify.php",\r
1291                                         auto: true,\r
1292                                         buttonClass: "",\r
1293                                         buttonCursor: "hand",\r
1294                                         buttonImage: null,\r
1295                                         buttonText: "SELECT FILES",\r
1296                                         checkExisting: false,\r
1297                                         debug: false,\r
1298                                         fileObjName: "Filedata",\r
1299                                         fileSizeLimit: 0,\r
1300                                         fileTypeDesc: "All Files",\r
1301                                         fileTypeExts: "*.*",\r
1302                                         height: 30,\r
1303                                         method: "post",\r
1304                                         multi: true,\r
1305                                         formData: {},\r
1306                                         preventCaching: true,\r
1307                                         progressData: "percentage",\r
1308                                         queueID: false,\r
1309                                         queueSizeLimit: 999,\r
1310                                         removeCompleted: true,\r
1311                                         removeTimeout: 3,\r
1312                                         requeueErrors: false,\r
1313                                         successTimeout: 30,\r
1314                                         uploadLimit: 0,\r
1315                                         width: 120,\r
1316                                         overrideEvents: []\r
1317                                 }, d);\r
1318                                 var g = {\r
1319                                         assume_success_timeout: j.successTimeout,\r
1320                                         button_placeholder_id: j.id,\r
1321                                         button_width: j.width,\r
1322                                         button_height: j.height,\r
1323                                         button_text: null,\r
1324                                         button_text_style: null,\r
1325                                         button_text_top_padding: 0,\r
1326                                         button_text_left_padding: 0,\r
1327                                         button_action: (j.multi ? SWFUpload.BUTTON_ACTION.SELECT_FILES : SWFUpload.BUTTON_ACTION.SELECT_FILE),\r
1328                                         button_disabled: false,\r
1329                                         button_cursor: (j.buttonCursor == "arrow" ? SWFUpload.CURSOR.ARROW : SWFUpload.CURSOR.HAND),\r
1330                                         button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,\r
1331                                         debug: j.debug,\r
1332                                         requeue_on_error: j.requeueErrors,\r
1333                                         file_post_name: j.fileObjName,\r
1334                                         file_size_limit: j.fileSizeLimit,\r
1335                                         file_types: j.fileTypeExts,\r
1336                                         file_types_description: j.fileTypeDesc,\r
1337                                         file_queue_limit: j.queueSizeLimit,\r
1338                                         file_upload_limit: j.uploadLimit,\r
1339                                         flash_url: j.swf,\r
1340                                         prevent_swf_caching: j.preventCaching,\r
1341                                         post_params: j.formData,\r
1342                                         upload_url: j.uploader,\r
1343                                         use_query_string: (j.method == "get"),\r
1344                                         file_dialog_complete_handler: a.onDialogClose,\r
1345                                         file_dialog_start_handler: a.onDialogOpen,\r
1346                                         file_queued_handler: a.onSelect,\r
1347                                         file_queue_error_handler: a.onSelectError,\r
1348                                         swfupload_loaded_handler: j.onSWFReady,\r
1349                                         upload_complete_handler: a.onUploadComplete,\r
1350                                         upload_error_handler: a.onUploadError,\r
1351                                         upload_progress_handler: a.onUploadProgress,\r
1352                                         upload_start_handler: a.onUploadStart,\r
1353                                         upload_success_handler: a.onUploadSuccess\r
1354                                 };\r
1355                                 if (e) {\r
1356                                         g = c.extend(g, e);\r
1357                                 }\r
1358                                 g = c.extend(g, j);\r
1359                                 var o = swfobject.getFlashPlayerVersion();\r
1360                                 var h = (o.major >= 9);\r
1361                                 if (h) {\r
1362                                         window["uploadify_" + j.id] = new SWFUpload(g);\r
1363                                         var i = window["uploadify_" + j.id];\r
1364                                         n.data("uploadify", i);\r
1365                                         var l = c("<div />", {\r
1366                                                 id: j.id,\r
1367                                                 "class": "uploadify",\r
1368                                                 css: {\r
1369                                                         height: j.height + "px",\r
1370                                                         width: j.width + "px"\r
1371                                                 }\r
1372                                         });\r
1373                                         c("#" + i.movieName).wrap(l);\r
1374                                         l = c("#" + j.id);\r
1375                                         l.data("uploadify", i);\r
1376                                         var f = c("<div />", {\r
1377                                                 id: j.id + "-button",\r
1378                                                 "class": "uploadify-button " + j.buttonClass\r
1379                                         });\r
1380                                         if (j.buttonImage) {\r
1381                                                 f.css({\r
1382                                                         "background-image": "url('" + j.buttonImage + "')",\r
1383                                                         "text-indent": "-9999px"\r
1384                                                 });\r
1385                                         }\r
1386                                         f.html('<span class="uploadify-button-text">' + j.buttonText + "</span>").css({\r
1387                                                 height: j.height + "px",\r
1388                                                 "line-height": j.height + "px",\r
1389                                                 width: j.width + "px"\r
1390                                         });\r
1391                                         l.append(f);\r
1392                                         c("#" + i.movieName).css({\r
1393                                                 position: "absolute",\r
1394                                                 "z-index": 1\r
1395                                         });\r
1396                                         if (!j.queueID) {\r
1397                                                 var k = c("<div />", {\r
1398                                                         id: j.id + "-queue",\r
1399                                                         "class": "uploadify-queue"\r
1400                                                 });\r
1401                                                 l.after(k);\r
1402                                                 i.settings.queueID = j.id + "-queue";\r
1403                                                 i.settings.defaultQueue = true;\r
1404                                         }\r
1405                                         i.queueData = {\r
1406                                                 files: {},\r
1407                                                 filesSelected: 0,\r
1408                                                 filesQueued: 0,\r
1409                                                 filesReplaced: 0,\r
1410                                                 filesCancelled: 0,\r
1411                                                 filesErrored: 0,\r
1412                                                 uploadsSuccessful: 0,\r
1413                                                 uploadsErrored: 0,\r
1414                                                 averageSpeed: 0,\r
1415                                                 queueLength: 0,\r
1416                                                 queueSize: 0,\r
1417                                                 uploadSize: 0,\r
1418                                                 queueBytesUploaded: 0,\r
1419                                                 uploadQueue: [],\r
1420                                                 errorMsg: "Some files were not added to the queue:"\r
1421                                         };\r
1422                                         i.original = m;\r
1423                                         i.wrapper = l;\r
1424                                         i.button = f;\r
1425                                         i.queue = k;\r
1426                                         if (j.onInit) {\r
1427                                                 j.onInit.call(n, i);\r
1428                                         }\r
1429                                 } else {\r
1430                                         if (j.onFallback) {\r
1431                                                 j.onFallback.call(n);\r
1432                                         }\r
1433                                 }\r
1434                         });\r
1435                 },\r
1436                 cancel: function (d, f) {\r
1437                         var e = arguments;\r
1438                         this.each(function () {\r
1439                                 var l = c(this),\r
1440                                         i = l.data("uploadify"),\r
1441                                         j = i.settings,\r
1442                                         h = -1;\r
1443                                 if (e[0]) {\r
1444                                         if (e[0] == "*") {\r
1445                                                 var g = i.queueData.queueLength;\r
1446                                                 c("#" + j.queueID).find(".uploadify-queue-item").each(function () {\r
1447                                                         h++;\r
1448                                                         if (e[1] === true) {\r
1449                                                                 i.cancelUpload(c(this).attr("id"), false);\r
1450                                                         } else {\r
1451                                                                 i.cancelUpload(c(this).attr("id"));\r
1452                                                         }\r
1453                                                         c(this).find(".data").removeClass("data").html(" - Cancelled");\r
1454                                                         c(this).find(".uploadify-progress-bar").remove();\r
1455                                                         c(this).delay(1000 + 100 * h).fadeOut(500, function () {\r
1456                                                                 c(this).remove();\r
1457                                                         });\r
1458                                                 });\r
1459                                                 i.queueData.queueSize = 0;\r
1460                                                 i.queueData.queueLength = 0;\r
1461                                                 if (j.onClearQueue) {\r
1462                                                         j.onClearQueue.call(l, g);\r
1463                                                 }\r
1464                                         } else {\r
1465                                                 for (var m = 0; m < e.length; m++) {\r
1466                                                         i.cancelUpload(e[m]);\r
1467                                                         c("#" + e[m]).find(".data").removeClass("data").html(" - Cancelled");\r
1468                                                         c("#" + e[m]).find(".uploadify-progress-bar").remove();\r
1469                                                         c("#" + e[m]).delay(1000 + 100 * m).fadeOut(500, function () {\r
1470                                                                 c(this).remove();\r
1471                                                         });\r
1472                                                 }\r
1473                                         }\r
1474                                 } else {\r
1475                                         var k = c("#" + j.queueID).find(".uploadify-queue-item").get(0);\r
1476                                         $item = c(k);\r
1477                                         i.cancelUpload($item.attr("id"));\r
1478                                         $item.find(".data").removeClass("data").html(" - Cancelled");\r
1479                                         $item.find(".uploadify-progress-bar").remove();\r
1480                                         $item.delay(1000).fadeOut(500, function () {\r
1481                                                 c(this).remove();\r
1482                                         });\r
1483                                 }\r
1484                         });\r
1485                 },\r
1486                 destroy: function () {\r
1487                         this.each(function () {\r
1488                                 var f = c(this),\r
1489                                         d = f.data("uploadify"),\r
1490                                         e = d.settings;\r
1491                                 d.destroy();\r
1492                                 if (e.defaultQueue) {\r
1493                                         c("#" + e.queueID).remove();\r
1494                                 }\r
1495                                 c("#" + e.id).replaceWith(d.original);\r
1496                                 if (e.onDestroy) {\r
1497                                         e.onDestroy.call(this);\r
1498                                 }\r
1499                                 delete d;\r
1500                         });\r
1501                 },\r
1502                 disable: function (d) {\r
1503                         this.each(function () {\r
1504                                 var g = c(this),\r
1505                                         e = g.data("uploadify"),\r
1506                                         f = e.settings;\r
1507                                 if (d) {\r
1508                                         e.button.addClass("disabled");\r
1509                                         if (f.onDisable) {\r
1510                                                 f.onDisable.call(this);\r
1511                                         }\r
1512                                 } else {\r
1513                                         e.button.removeClass("disabled");\r
1514                                         if (f.onEnable) {\r
1515                                                 f.onEnable.call(this);\r
1516                                         }\r
1517                                 }\r
1518                                 e.setButtonDisabled(d);\r
1519                         });\r
1520                 },\r
1521                 settings: function (e, g, h) {\r
1522                         var d = arguments;\r
1523                         var f = g;\r
1524                         this.each(function () {\r
1525                                 var k = c(this),\r
1526                                         i = k.data("uploadify"),\r
1527                                         j = i.settings;\r
1528                                 if (typeof(d[0]) == "object") {\r
1529                                         for (var l in g) {\r
1530                                                 setData(l, g[l]);\r
1531                                         }\r
1532                                 }\r
1533                                 if (d.length === 1) {\r
1534                                         f = j[e];\r
1535                                 } else {\r
1536                                         switch (e) {\r
1537                                         case "uploader":\r
1538                                                 i.setUploadURL(g);\r
1539                                                 break;\r
1540                                         case "formData":\r
1541                                                 if (!h) {\r
1542                                                         g = c.extend(j.formData, g);\r
1543                                                 }\r
1544                                                 i.setPostParams(j.formData);\r
1545                                                 break;\r
1546                                         case "method":\r
1547                                                 if (g == "get") {\r
1548                                                         i.setUseQueryString(true);\r
1549                                                 } else {\r
1550                                                         i.setUseQueryString(false);\r
1551                                                 }\r
1552                                                 break;\r
1553                                         case "fileObjName":\r
1554                                                 i.setFilePostName(g);\r
1555                                                 break;\r
1556                                         case "fileTypeExts":\r
1557                                                 i.setFileTypes(g, j.fileTypeDesc);\r
1558                                                 break;\r
1559                                         case "fileTypeDesc":\r
1560                                                 i.setFileTypes(j.fileTypeExts, g);\r
1561                                                 break;\r
1562                                         case "fileSizeLimit":\r
1563                                                 i.setFileSizeLimit(g);\r
1564                                                 break;\r
1565                                         case "uploadLimit":\r
1566                                                 i.setFileUploadLimit(g);\r
1567                                                 break;\r
1568                                         case "queueSizeLimit":\r
1569                                                 i.setFileQueueLimit(g);\r
1570                                                 break;\r
1571                                         case "buttonImage":\r
1572                                                 i.button.css("background-image", settingValue);\r
1573                                                 break;\r
1574                                         case "buttonCursor":\r
1575                                                 if (g == "arrow") {\r
1576                                                         i.setButtonCursor(SWFUpload.CURSOR.ARROW);\r
1577                                                 } else {\r
1578                                                         i.setButtonCursor(SWFUpload.CURSOR.HAND);\r
1579                                                 }\r
1580                                                 break;\r
1581                                         case "buttonText":\r
1582                                                 c("#" + j.id + "-button").find(".uploadify-button-text").html(g);\r
1583                                                 break;\r
1584                                         case "width":\r
1585                                                 i.setButtonDimensions(g, j.height);\r
1586                                                 break;\r
1587                                         case "height":\r
1588                                                 i.setButtonDimensions(j.width, g);\r
1589                                                 break;\r
1590                                         case "multi":\r
1591                                                 if (g) {\r
1592                                                         i.setButtonAction(SWFUpload.BUTTON_ACTION.SELECT_FILES);\r
1593                                                 } else {\r
1594                                                         i.setButtonAction(SWFUpload.BUTTON_ACTION.SELECT_FILE);\r
1595                                                 }\r
1596                                                 break;\r
1597                                         }\r
1598                                         j[e] = g;\r
1599                                 }\r
1600                         });\r
1601                         if (d.length === 1) {\r
1602                                 return f;\r
1603                         }\r
1604                 },\r
1605                 stop: function () {\r
1606                         this.each(function () {\r
1607                                 var e = c(this),\r
1608                                         d = e.data("uploadify");\r
1609                                 d.queueData.averageSpeed = 0;\r
1610                                 d.queueData.uploadSize = 0;\r
1611                                 d.queueData.bytesUploaded = 0;\r
1612                                 d.queueData.uploadQueue = [];\r
1613                                 d.stopUpload();\r
1614                         });\r
1615                 },\r
1616                 upload: function () {\r
1617                         var d = arguments;\r
1618                         this.each(function () {\r
1619                                 var f = c(this),\r
1620                                         e = f.data("uploadify");\r
1621                                 e.queueData.averageSpeed = 0;\r
1622                                 e.queueData.uploadSize = 0;\r
1623                                 e.queueData.bytesUploaded = 0;\r
1624                                 e.queueData.uploadQueue = [];\r
1625                                 if (d[0]) {\r
1626                                         if (d[0] == "*") {\r
1627                                                 e.queueData.uploadSize = e.queueData.queueSize;\r
1628                                                 e.queueData.uploadQueue.push("*");\r
1629                                                 e.startUpload();\r
1630                                         } else {\r
1631                                                 for (var g = 0; g < d.length; g++) {\r
1632                                                         e.queueData.uploadSize += e.queueData.files[d[g]].size;\r
1633                                                         e.queueData.uploadQueue.push(d[g]);\r
1634                                                 }\r
1635                                                 e.startUpload(e.queueData.uploadQueue.shift());\r
1636                                         }\r
1637                                 } else {\r
1638                                         e.startUpload();\r
1639                                 }\r
1640                         });\r
1641                 }\r
1642         };\r
1643         var a = {\r
1644                 onDialogOpen: function () {\r
1645                         var d = this.settings;\r
1646                         this.queueData.errorMsg = "Some files were not added to the queue:";\r
1647                         this.queueData.filesReplaced = 0;\r
1648                         this.queueData.filesCancelled = 0;\r
1649                         if (d.onDialogOpen) {\r
1650                                 d.onDialogOpen.call(this);\r
1651                         }\r
1652                 },\r
1653                 onDialogClose: function (d, f, g) {\r
1654                         var e = this.settings;\r
1655                         this.queueData.filesErrored = d - f;\r
1656                         this.queueData.filesSelected = d;\r
1657                         this.queueData.filesQueued = f - this.queueData.filesCancelled;\r
1658                         this.queueData.queueLength = g;\r
1659                         if (c.inArray("onDialogClose", e.overrideEvents) < 0) {\r
1660                                 if (this.queueData.filesErrored > 0) {\r
1661                                         alert(this.queueData.errorMsg);\r
1662                                 }\r
1663                         }\r
1664                         if (e.onDialogClose) {\r
1665                                 e.onDialogClose.call(this, this.queueData);\r
1666                         }\r
1667                         if (e.auto) {\r
1668                                 c("#" + e.id).uploadify("upload", "*");\r
1669                         }\r
1670                 },\r
1671                 onSelect: function (g) {\r
1672                         var h = this.settings;\r
1673                         var e = {};\r
1674                         for (var f in this.queueData.files) {\r
1675                                 e = this.queueData.files[f];\r
1676                                 if (e.uploaded != true && e.name == g.name) {\r
1677                                         var d = confirm('The file named "' + g.name + '" is already in the queue.\nDo you want to replace the existing item in the queue?');\r
1678                                         if (!d) {\r
1679                                                 this.cancelUpload(g.id);\r
1680                                                 this.queueData.filesCancelled++;\r
1681                                                 return false;\r
1682                                         } else {\r
1683                                                 c("#" + e.id).remove();\r
1684                                                 this.cancelUpload(e.id);\r
1685                                                 this.queueData.filesReplaced++;\r
1686                                         }\r
1687                                 }\r
1688                         }\r
1689                         var i = Math.round(g.size / 1024);\r
1690                         var l = "KB";\r
1691                         if (i > 1000) {\r
1692                                 i = Math.round(i / 1000);\r
1693                                 l = "MB";\r
1694                         }\r
1695                         var k = i.toString().split(".");\r
1696                         i = k[0];\r
1697                         if (k.length > 1) {\r
1698                                 i += "." + k[1].substr(0, 2);\r
1699                         }\r
1700                         i += l;\r
1701                         var j = g.name;\r
1702                         if (j.length > 25) {\r
1703                                 j = j.substr(0, 25) + "...";\r
1704                         }\r
1705                         if (c.inArray("onSelect", h.overrideEvents) < 0) {\r
1706                                 c("#" + h.queueID).append('<div id="' + g.id + '" class="uploadify-queue-item">                                 <div class="cancel">                                            <a href="javascript:$(\'#' + h.id + "').uploadify('cancel', '" + g.id + '\')">X</a>                                     </div>                                  <span class="fileName">' + j + " (" + i + ')</span><span class="data"></span>                                   <div class="uploadify-progress">                                                <div class="uploadify-progress-bar"><!--Progress Bar--></div>                                   </div>                          </div>');\r
1707                         }\r
1708                         this.queueData.queueSize += g.size;\r
1709                         this.queueData.files[g.id] = g;\r
1710                         if (h.onSelect) {\r
1711                                 h.onSelect.apply(this, arguments);\r
1712                         }\r
1713                 },\r
1714                 onSelectError: function (d, g, f) {\r
1715                         var e = this.settings;\r
1716                         if (c.inArray("onSelectError", e.overrideEvents) < 0) {\r
1717                                 switch (g) {\r
1718                                 case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED:\r
1719                                         if (e.queueSizeLimit > f) {\r
1720                                                 this.queueData.errorMsg += "\nThe number of files selected exceeds the remaining upload limit (" + f + ").";\r
1721                                         } else {\r
1722                                                 this.queueData.errorMsg += "\nThe number of files selected exceeds the queue size limit (" + e.queueSizeLimit + ").";\r
1723                                         }\r
1724                                         break;\r
1725                                 case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:\r
1726                                         this.queueData.errorMsg += '\nThe file "' + d.name + '" exceeds the size limit (' + e.fileSizeLimit + ").";\r
1727                                         break;\r
1728                                 case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:\r
1729                                         this.queueData.errorMsg += '\nThe file "' + d.name + '" is empty.';\r
1730                                         break;\r
1731                                 case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:\r
1732                                         this.queueData.errorMsg += '\nThe file "' + d.name + '" is not an accepted file type (' + e.fileTypeDesc + ").";\r
1733                                         break;\r
1734                                 }\r
1735                         }\r
1736                         if (g != SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED) {\r
1737                                 delete this.queueData.files[d.id];\r
1738                         }\r
1739                         if (e.onSelectError) {\r
1740                                 e.onSelectError.apply(this, arguments);\r
1741                         }\r
1742                 },\r
1743                 onQueueComplete: function () {\r
1744                         if (this.settings.onQueueComplete) {\r
1745                                 this.settings.onQueueComplete.call(this, this.settings.queueData);\r
1746                         }\r
1747                 },\r
1748                 onUploadComplete: function (f) {\r
1749                         var g = this.settings,\r
1750                                 d = this;\r
1751                         var e = this.getStats();\r
1752                         this.queueData.queueLength = e.files_queued;\r
1753                         if (this.queueData.uploadQueue[0] == "*") {\r
1754                                 if (this.queueData.queueLength > 0) {\r
1755                                         this.startUpload();\r
1756                                 } else {\r
1757                                         this.queueData.uploadQueue = [];\r
1758                                         if (g.onQueueComplete) {\r
1759                                                 g.onQueueComplete.call(this, this.queueData);\r
1760                                         }\r
1761                                 }\r
1762                         } else {\r
1763                                 if (this.queueData.uploadQueue.length > 0) {\r
1764                                         this.startUpload(this.queueData.uploadQueue.shift());\r
1765                                 } else {\r
1766                                         this.queueData.uploadQueue = [];\r
1767                                         if (g.onQueueComplete) {\r
1768                                                 g.onQueueComplete.call(this, this.queueData);\r
1769                                         }\r
1770                                 }\r
1771                         }\r
1772                         if (c.inArray("onUploadComplete", g.overrideEvents) < 0) {\r
1773                                 if (g.removeCompleted) {\r
1774                                         switch (f.filestatus) {\r
1775                                         case SWFUpload.FILE_STATUS.COMPLETE:\r
1776                                                 setTimeout(function () {\r
1777                                                         if (c("#" + f.id)) {\r
1778                                                                 d.queueData.queueSize -= f.size;\r
1779                                                                 d.queueData.queueLength -= 1;\r
1780                                                                 delete d.queueData.files[f.id];\r
1781                                                                 c("#" + f.id).fadeOut(500, function () {\r
1782                                                                         c(this).remove();\r
1783                                                                 });\r
1784                                                         }\r
1785                                                 }, g.removeTimeout * 1000);\r
1786                                                 break;\r
1787                                         case SWFUpload.FILE_STATUS.ERROR:\r
1788                                                 if (!g.requeueErrors) {\r
1789                                                         setTimeout(function () {\r
1790                                                                 if (c("#" + f.id)) {\r
1791                                                                         d.queueData.queueSize -= f.size;\r
1792                                                                         d.queueData.queueLength -= 1;\r
1793                                                                         delete d.queueData.files[f.id];\r
1794                                                                         c("#" + f.id).fadeOut(500, function () {\r
1795                                                                                 c(this).remove();\r
1796                                                                         });\r
1797                                                                 }\r
1798                                                         }, g.removeTimeout * 1000);\r
1799                                                 }\r
1800                                                 break;\r
1801                                         }\r
1802                                 } else {\r
1803                                         f.uploaded = true;\r
1804                                 }\r
1805                         }\r
1806                         if (g.onUploadComplete) {\r
1807                                 g.onUploadComplete.call(this, f);\r
1808                         }\r
1809                 },\r
1810                 onUploadError: function (e, i, h) {\r
1811                         var f = this.settings;\r
1812                         var g = "Error";\r
1813                         switch (i) {\r
1814                         case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:\r
1815                                 g = "HTTP Error (" + h + ")";\r
1816                                 break;\r
1817                         case SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL:\r
1818                                 g = "Missing Upload URL";\r
1819                                 break;\r
1820                         case SWFUpload.UPLOAD_ERROR.IO_ERROR:\r
1821                                 g = "IO Error";\r
1822                                 break;\r
1823                         case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:\r
1824                                 g = "Security Error";\r
1825                                 break;\r
1826                         case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:\r
1827                                 alert("The upload limit has been reached (" + h + ").");\r
1828                                 g = "Exceeds Upload Limit";\r
1829                                 break;\r
1830                         case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:\r
1831                                 g = "Failed";\r
1832                                 break;\r
1833                         case SWFUpload.UPLOAD_ERROR.SPECIFIED_FILE_ID_NOT_FOUND:\r
1834                                 break;\r
1835                         case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:\r
1836                                 g = "Validation Error";\r
1837                                 break;\r
1838                         case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:\r
1839                                 g = "Cancelled";\r
1840                                 this.queueData.queueSize -= e.size;\r
1841                                 this.queueData.queueLength -= 1;\r
1842                                 if (e.status == SWFUpload.FILE_STATUS.IN_PROGRESS || c.inArray(e.id, this.queueData.uploadQueue) >= 0) {\r
1843                                         this.queueData.uploadSize -= e.size;\r
1844                                 }\r
1845                                 if (f.onCancel) {\r
1846                                         f.onCancel.call(this, e);\r
1847                                 }\r
1848                                 delete this.queueData.files[e.id];\r
1849                                 break;\r
1850                         case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:\r
1851                                 g = "Stopped";\r
1852                                 break;\r
1853                         }\r
1854                         if (c.inArray("onUploadError", f.overrideEvents) < 0) {\r
1855                                 if (i != SWFUpload.UPLOAD_ERROR.FILE_CANCELLED && i != SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED) {\r
1856                                         c("#" + e.id).addClass("uploadify-error");\r
1857                                 }\r
1858                                 c("#" + e.id).find(".uploadify-progress-bar").css("width", "1px");\r
1859                                 if (i != SWFUpload.UPLOAD_ERROR.SPECIFIED_FILE_ID_NOT_FOUND && e.status != SWFUpload.FILE_STATUS.COMPLETE) {\r
1860                                         c("#" + e.id).find(".data").html(" - " + g);\r
1861                                 }\r
1862                         }\r
1863                         var d = this.getStats();\r
1864                         this.queueData.uploadsErrored = d.upload_errors;\r
1865                         if (f.onUploadError) {\r
1866                                 f.onUploadError.call(this, e, i, h, g);\r
1867                         }\r
1868                 },\r
1869                 onUploadProgress: function (g, m, j) {\r
1870                         var h = this.settings;\r
1871                         var e = new Date();\r
1872                         var n = e.getTime();\r
1873                         var k = n - this.timer;\r
1874                         if (k > 500) {\r
1875                                 this.timer = n;\r
1876                         }\r
1877                         var i = m - this.bytesLoaded;\r
1878                         this.bytesLoaded = m;\r
1879                         var d = this.queueData.queueBytesUploaded + m;\r
1880                         var p = Math.round(m / j * 100);\r
1881                         var o = "KB/s";\r
1882                         var l = 0;\r
1883                         var f = (i / 1024) / (k / 1000);\r
1884                         f = Math.floor(f * 10) / 10;\r
1885                         if (this.queueData.averageSpeed > 0) {\r
1886                                 this.queueData.averageSpeed = Math.floor((this.queueData.averageSpeed + f) / 2);\r
1887                         } else {\r
1888                                 this.queueData.averageSpeed = Math.floor(f);\r
1889                         }\r
1890                         if (f > 1000) {\r
1891                                 l = (f * 0.001);\r
1892                                 this.queueData.averageSpeed = Math.floor(l);\r
1893                                 o = "MB/s";\r
1894                         }\r
1895                         if (c.inArray("onUploadProgress", h.overrideEvents) < 0) {\r
1896                                 if (h.progressData == "percentage") {\r
1897                                         c("#" + g.id).find(".data").html(" - " + p + "%");\r
1898                                 } else {\r
1899                                         if (h.progressData == "speed" && k > 500) {\r
1900                                                 c("#" + g.id).find(".data").html(" - " + this.queueData.averageSpeed + o);\r
1901                                         }\r
1902                                 }\r
1903                                 c("#" + g.id).find(".uploadify-progress-bar").css("width", p + "%");\r
1904                         }\r
1905                         if (h.onUploadProgress) {\r
1906                                 h.onUploadProgress.call(this, g, m, j, d, this.queueData.uploadSize);\r
1907                         }\r
1908                 },\r
1909                 onUploadStart: function (d) {\r
1910                         var e = this.settings;\r
1911                         var f = new Date();\r
1912                         this.timer = f.getTime();\r
1913                         this.bytesLoaded = 0;\r
1914                         if (this.queueData.uploadQueue.length == 0) {\r
1915                                 this.queueData.uploadSize = d.size;\r
1916                         }\r
1917                         if (e.checkExisting) {\r
1918                                 c.ajax({\r
1919                                         type: "POST",\r
1920                                         async: false,\r
1921                                         url: e.checkExisting,\r
1922                                         data: {\r
1923                                                 filename: d.name\r
1924                                         },\r
1925                                         success: function (h) {\r
1926                                                 if (h == 1) {\r
1927                                                         var g = confirm('A file with the name "' + d.name + '" already exists on the server.\nWould you like to replace the existing file?');\r
1928                                                         if (!g) {\r
1929                                                                 this.cancelUpload(d.id);\r
1930                                                                 c("#" + d.id).remove();\r
1931                                                                 if (this.queueData.uploadQueue.length > 0 && this.queueData.queueLength > 0) {\r
1932                                                                         if (this.queueData.uploadQueue[0] == "*") {\r
1933                                                                                 this.startUpload();\r
1934                                                                         } else {\r
1935                                                                                 this.startUpload(this.queueData.uploadQueue.shift());\r
1936                                                                         }\r
1937                                                                 }\r
1938                                                         }\r
1939                                                 }\r
1940                                         }\r
1941                                 });\r
1942                         }\r
1943                         if (e.onUploadStart) {\r
1944                                 e.onUploadStart.call(this, d);\r
1945                         }\r
1946                 },\r
1947                 onUploadSuccess: function (f, h, d) {\r
1948                         var g = this.settings;\r
1949                         var e = this.getStats();\r
1950                         this.queueData.uploadsSuccessful = e.successful_uploads;\r
1951                         this.queueData.queueBytesUploaded += f.size;\r
1952                         if (c.inArray("onUploadSuccess", g.overrideEvents) < 0) {\r
1953                                 c("#" + f.id).find(".data").html(" - Complete");\r
1954                         }\r
1955                         if (g.onUploadSuccess) {\r
1956                                 g.onUploadSuccess.call(this, f, h, d);\r
1957                         }\r
1958                 }\r
1959         };\r
1960         c.fn.uploadify = function (d) {\r
1961                 if (b[d]) {\r
1962                         return b[d].apply(this, Array.prototype.slice.call(arguments, 1));\r
1963                 } else {\r
1964                         if (typeof d === "object" || !d) {\r
1965                                 return b.init.apply(this, arguments);\r
1966                         } else {\r
1967                                 c.error("The method " + d + " does not exist in $.uploadify");\r
1968                         }\r
1969                 }\r
1970         };\r
1971 })($);