function onSilverlightError(c,d){alert("onSilverlightError: "+d.errormessage)}(function(c){function d(e){var a=false;var x=null;try{var s=null;try{s=new ActiveXObject("AgControl.AgControl");if(e==null){a=true}else{if(s.IsVersionSupported(e)){a=true}}s=null}catch(p){var r=navigator.plugins["Silverlight Plug-In"];if(r){if(e===null){a=true}else{var w=r.description;if(w==="1.0.30226.2"){w="2.0.30226.2"}var v=w.split(".");while(v.length>3){v.pop()}while(v.length<4){v.push(0)}var u=e.split(".");while(u.length>4){u.pop()}var b,t,q=0;do{b=parseInt(u[q]);t=parseInt(v[q]);q++}while(q<u.length&&b===t);if(b<=t&&!isNaN(b)){a=true}}}}}catch(p){a=false}return a}if(!c.multiUpload.initialized&&d("2.0.31005.0")){c.multiUpload.initialized=1;c.multiUpload.runtime="silverlight";c.multiUpload.setup=function(a){c.multiUpload.plugin=c("#multiuploader")[0].content.Upload;c.multiUpload._fireEvent("init")};c.multiUpload.instances=[];c.multiUpload._fireEvent=function(j,a,b,h,i){window.setTimeout(function(){c(c.multiUpload.instances).each(function(e,f){c(f).trigger("multiUpload:"+j,[a,b,h,i])})},0)};c.extend(c.multiUpload.prototype,{init:function(){var b=this,a=[];c.multiUpload.instances.push(b);if(!c("#multiuploader")[0]){c("body").append('<object id="multiuploader" data="data:application/x-silverlight," type="application/x-silverlight-2" width="100" height="100"><param name="source" value="'+b.settings.silverlight_xap_url+'"/><param name="onerror" value="onSilverlightError" /></object>')}c(b).bind("multiUpload:slSelectFile",function(k,e,n,l){var m={id:e,name:n,size:l,loaded:0};a.push(m);b.files.push(m)});c(b).bind("multiUpload:slSelectSuccessful",function(){c(b).trigger("multiUpload:filesSelected",[{files:a}]);c(b).trigger("multiUpload:filesChanged");a=[]});c(b).bind("multiUpload:slSelectCancelled",function(){c(b).trigger("multiUpload:filesSelectionCancelled",[a]);a=[]});c(b).bind("multiUpload:slUploadFileProgress",function(k,e,l,m){var n=b.getFile(e);n.loaded=l;c(b).trigger("multiUpload:fileUploadProgress",[{file:n,loaded:l,total:m}])});c(b).bind("multiUpload:slUploadSuccessful",function(k,e,j){var l;if(l=b.getFile(e)){if(!l.status){l.status="completed";c(b).trigger("multiUpload:fileUploaded",[{file:l,response:j}])}}c(b).trigger("multiUpload:filesChanged");b.uploadNext()});c(b).bind("multiUpload:stopUpload",function(e){c.multiUpload.plugin.CancelUpload()});c(b).bind("multiUpload:slUploadChunkSuccessful",function(o,e,q,m,n){var p=b.getFile(e),r={file:p,chunk:q,chunks:m,response:n};c(b).trigger("multiUpload:chunkUploaded",[r]);if(r.cancel){p.status="failed";c.multiUpload.plugin.CancelUpload()}});c(b).bind("multiUpload:slUploadChunkError",function(l,e,n,k,m){c(b).trigger("multiUpload:uploadChunkError",[{file:b.getFile(e),chunk:n,chunks:k,error:m}])});c(b).bind("multiUpload:selectFiles",function(e){c.multiUpload.plugin.SelectFiles("Files |"+c.map(b.settings.filter,function(f){return"*."+f}).join(";"))});c(b).bind("multiUpload:removeFile",function(e,h){c.multiUpload.plugin.RemoveFile(h.id)});c(b).bind("multiUpload:uploadFile",function(e,h){c.multiUpload.plugin.UploadFile(h.id,b.settings.upload_url+"&name="+escape(h.name)+"&path="+escape(b.settings.path),parseInt(b.settings.chunk_size))});c(b).bind("multiUpload:clearFiles",function(e){c.multiUpload.plugin.ClearFiles()})}})}})(jQuery);