jQuery.extend({createUploadIframe:function(g,e){var f="jUploadFrame"+g;if(window.ActiveXObject){var h=document.createElement('<iframe id="'+f+'" name="'+f+'" />');if(typeof e=="boolean"){h.src="javascript:false"}else{if(typeof e=="string"){h.src=e}}}else{var h=document.createElement("iframe");h.id=f;h.name=f}h.style.position="absolute";h.style.top="-1000px";h.style.left="-1000px";document.body.appendChild(h);return h},createUploadForm:function(j,h){var l="jUploadForm"+j;var i="jUploadFile"+j;var m=$('<form  action="" method="POST" name="'+l+'" id="'+l+'" enctype="multipart/form-data"></form>');var n=$("#"+h);var k=$(n).clone();$(n).attr("id",i);$(n).before(k);$(n).appendTo(m);$(m).css("position","absolute");$(m).css("top","-1200px");$(m).css("left","-1200px");$(m).appendTo("body");return m},ajaxFileUpload:function(e){e=jQuery.extend({},jQuery.ajaxSettings,e);var t=new Date().getTime();var s=jQuery.createUploadForm(t,e.fileElementId);var m=jQuery.createUploadIframe(t,e.secureuri);var n="jUploadFrame"+t;var l="jUploadForm"+t;if(e.global&&!jQuery.active++){jQuery.event.trigger("ajaxStart")}var r=false;var p={};if(e.global){jQuery.event.trigger("ajaxSend",[p,e])}var q=function(b){var c=document.getElementById(n);try{if(c.contentWindow){p.responseText=c.contentWindow.document.body?c.contentWindow.document.body.innerHTML:null;p.responseXML=c.contentWindow.document.XMLDocument?c.contentWindow.document.XMLDocument:c.contentWindow.document}else{if(c.contentDocument){p.responseText=c.contentDocument.document.body?c.contentDocument.document.body.innerHTML:null;p.responseXML=c.contentDocument.document.XMLDocument?c.contentDocument.document.XMLDocument:c.contentDocument.document}}}catch(d){jQuery.handleError(e,p,null,d)}if(p||b=="timeout"){r=true;var a;try{a=b!="timeout"?"success":"error";if(a!="error"){var f=jQuery.uploadHttpData(p,e.dataType);if(e.success){e.success(f,a)}if(e.global){jQuery.event.trigger("ajaxSuccess",[p,e])}}else{jQuery.handleError(e,p,a)}}catch(d){a="error";jQuery.handleError(e,p,a,d)}if(e.global){jQuery.event.trigger("ajaxComplete",[p,e])}if(e.global&&!--jQuery.active){jQuery.event.trigger("ajaxStop")}if(e.complete){e.complete(p,a)}jQuery(c).unbind();setTimeout(function(){try{$(c).remove();$(s).remove()}catch(g){jQuery.handleError(e,p,null,g)}},100);p=null}};if(e.timeout>0){setTimeout(function(){if(!r){q("timeout")}},e.timeout)}try{var s=$("#"+l);$(s).attr("action",e.url);$(s).attr("method","POST");$(s).attr("target",n);if(s.encoding){s.encoding="multipart/form-data"}else{s.enctype="multipart/form-data"}$(s).submit()}catch(o){jQuery.handleError(e,p,null,o)}if(window.attachEvent){document.getElementById(n).attachEvent("onload",q)}else{document.getElementById(n).addEventListener("load",q,false)}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("<div>").html(data).evalScripts()}return data}});