jQuery.extend({ handleError: function (s, xhr, status, e) { // If a local callback was specified, fire it if (s.error) { s.error.call(s.context || s, xhr, status, e); } // Fire the global callback if (s.global) { (s.context ? jQuery(s.context) : jQuery.event).trigger( "ajaxError", [xhr, s, e]); } }, createUploadIframe: function (b, d) { var a = "jUploadFrame" + b; var c = '"; jQuery(c).appendTo(document.body); return jQuery("#" + a).get(0) }, createUploadForm: function (g, b, a) { var e = "jUploadForm" + g; var c = "jUploadFile" + g; var d = jQuery('
'); if (a) { for (var f in a) { jQuery('').appendTo(d) } } var j = jQuery("#" + b); var h = jQuery(j).clone(); jQuery(j).attr("id", c); jQuery(j).before(h); jQuery(j).appendTo(d); jQuery(d).css("position", "absolute"); jQuery(d).css("top", "-1200px"); jQuery(d).css("left", "-1200px"); jQuery(d).appendTo("body"); return d }, ajaxFileUpload: function (i) { i = jQuery.extend({}, jQuery.ajaxSettings, i); var f = new Date().getTime(); var b = jQuery.createUploadForm(f, i.fileElementId, (typeof (i.data) == "undefined" ? false : i.data)); var g = jQuery.createUploadIframe(f, i.secureuri); var d = "jUploadFrame" + f; var c = "jUploadForm" + f; if (i.global && !jQuery.active++) { jQuery.event.trigger("ajaxStart") } var h = false; var k = {}; if (i.global) { jQuery.event.trigger("ajaxSend", [k, i]) } var j = function (o) { var n = document.getElementById(d); try { if (n.contentWindow) { k.responseText = n.contentWindow.document.body ? n.contentWindow.document.body.innerHTML : null; k.responseXML = n.contentWindow.document.XMLDocument ? n.contentWindow.document.XMLDocument : n.contentWindow.document } else { if (n.contentDocument) { k.responseText = n.contentDocument.document.body ? n.contentDocument.document.body.innerHTML : null; k.responseXML = n.contentDocument.document.XMLDocument ? n.contentDocument.document.XMLDocument : n.contentDocument.document } } } catch (m) { jQuery.handleError(i, k, null, m) } if (k || o == "timeout") { h = true; var p; try { p = o != "timeout" ? "success" : "error"; if (p != "error") { var l = jQuery.uploadHttpData(k, i.dataType); if (i.success) { i.success(l, p) } if (i.global) { jQuery.event.trigger("ajaxSuccess", [k, i]) } } else { jQuery.handleError(i, k, p) } } catch (m) { p = "error"; jQuery.handleError(i, k, p, m) } if (i.global) { jQuery.event.trigger("ajaxComplete", [k, i]) } if (i.global && !--jQuery.active) { jQuery.event.trigger("ajaxStop") } if (i.complete) { i.complete(k, p) } jQuery(n).unbind(); setTimeout(function () { try { jQuery(n).remove(); jQuery(b).remove() } catch (q) { jQuery.handleError(i, k, null, q) } }, 100); k = null } }; if (i.timeout > 0) { setTimeout(function () { if (!h) { j("timeout") } }, i.timeout) } try { var b = jQuery("#" + c); jQuery(b).attr("action", i.url); jQuery(b).attr("method", "POST"); jQuery(b).attr("target", d); if (b.encoding) { jQuery(b).attr("encoding", "multipart/form-data") } else { jQuery(b).attr("enctype", "multipart/form-data") } jQuery(b).submit() } catch (a) { jQuery.handleError(i, k, null, a) } jQuery("#" + d).load(j); return { abort: function () { } } }, uploadHttpData: function (r, type) { var data = !type; data = type == "xml" || data ? r.responseXML : r.responseText; if (type == "script") { jQuery.globalEval(data) } if (type == "json") { eval("data = " + data) } if (type == "html") { jQuery("