(function(){var b=0,g=[],i={},e={},a={"<":"lt",">":"gt","&":"amp",'"':"quot","'":"#39"},h=/[<>&\"\']/g;function d(){this.returnValue=false}function f(){this.cancelBubble=true}(function(j){var k=j.split(/,/),l,n,m;for(l=0;l0){c.each(k,function(n,m){j[m]=n})}});return j},cleanName:function(j){var k,l;l=[/[\300-\306]/g,"A",/[\340-\346]/g,"a",/\307/g,"C",/\347/g,"c",/[\310-\313]/g,"E",/[\350-\353]/g,"e",/[\314-\317]/g,"I",/[\354-\357]/g,"i",/\321/g,"N",/\361/g,"n",/[\322-\330]/g,"O",/[\362-\370]/g,"o",/[\331-\334]/g,"U",/[\371-\374]/g,"u"];for(k=0;k0?"&":"?")+l}return k},each:function(n,o){var m,l,k,j;if(n){m=n.length;if(m===l){for(k in n){if(n.hasOwnProperty(k)){if(o(n[k],k)===false){return}}}}else{for(j=0;j1048576){return Math.round(j/1048576,1)+" MB"}if(j>1024){return Math.round(j/1024,1)+" KB"}return j+" b"},getPos:function(k,o){var p=0,n=0,r,q=document,l,m;k=k;o=o||q.body;function j(v){var t,u,s=0,w=0;if(v){u=v.getBoundingClientRect();t=q.compatMode==="CSS1Compat"?q.documentElement:q.body;s=u.left+t.scrollLeft;w=u.top+t.scrollTop}return{x:s,y:w}}if(k.getBoundingClientRect&&(navigator.userAgent.indexOf("MSIE")>0&&q.documentMode!==8)){l=j(k);m=j(o);return{x:l.x-m.x,y:l.y-m.y}}r=k;while(r&&r!=o&&r.nodeType){p+=r.offsetLeft||0;n+=r.offsetTop||0;r=r.offsetParent}r=k.parentNode;while(r&&r!=o&&r.nodeType){p-=r.scrollLeft||0;n-=r.scrollTop||0;r=r.parentNode}return{x:p,y:n}},getSize:function(j){return{w:j.clientWidth||j.offsetWidth,h:j.clientHeight||j.offsetHeight}},parseSize:function(j){var k;if(typeof(j)=="string"){j=/^([0-9]+)([mgk]+)$/.exec(j.toLowerCase().replace(/[^0-9mkg]/g,""));k=j[2];j=+j[1];if(k=="g"){j*=1073741824}if(k=="m"){j*=1048576}if(k=="k"){j*=1024}}return j},xmlEncode:function(j){return j?(""+j).replace(h,function(k){return a[k]?"&"+a[k]+";":k}):j},toArray:function(l){var k,j=[];for(k=0;k0?Math.ceil(p.loaded/p.size*100):0;p.bytesPerSec=Math.ceil(p.loaded/((+new Date()-l||1)/1000))}c.extend(this,{state:c.STOPPED,features:{},files:o,settings:m,total:p,id:c.guid(),init:function(){var w=this,x,t,s,v=0,u;m.page_url=m.page_url||document.location.pathname.replace(/\/[^\/]+$/g,"/");if(!/^(\w+:\/\/|\/)/.test(m.url)){m.url=m.page_url+m.url}m.chunk_size=c.parseSize(m.chunk_size);m.max_file_size=c.parseSize(m.max_file_size);w.bind("FilesAdded",function(y,B){var A,z,C=0;for(A=0;A0?Math.ceil(z.loaded/z.size*100):0;j()});w.bind("StateChanged",function(y){if(y.state==c.STARTED){l=(+new Date())}});w.bind("QueueChanged",j);w.bind("Error",function(y,z){if(z.file){z.file.status=c.FAILED;j();window.setTimeout(function(){n.call(w)})}});w.bind("FileUploaded",function(y,z){z.status=c.DONE;y.trigger("UploadProgress",z);n.call(w)});if(m.runtimes){t=[];u=m.runtimes.split(/\s?,\s?/);for(x=0;x=0;r--){if(o[r].id===s){return o[r]}}},removeFile:function(s){var r;for(r=o.length-1;r>=0;r--){if(o[r].id===s.id){return this.splice(r,1)[0]}}},splice:function(t,r){var s;s=o.splice(t,r);this.trigger("FilesRemoved",s);this.trigger("QueueChanged");return s},trigger:function(s){var u=k[s.toLowerCase()],t,r;if(u){r=Array.prototype.slice.call(arguments);r[0]=this;for(t=0;t=0;s--){if(u[s].func===t){u.splice(s,1)}}}}})};c.File=function(m,k,l){var j=this;j.id=m;j.name=k;j.size=l;j.loaded=0;j.percent=0;j.status=0};c.Runtime=function(){this.init=function(j,k){}};c.QueueProgress=function(){var j=this;j.size=0;j.loaded=0;j.uploaded=0;j.failed=0;j.queued=0;j.percent=0;j.bytesPerSec=0;j.reset=function(){j.size=j.loaded=j.uploaded=j.failed=j.queued=j.percent=j.bytesPerSec=0}};c.runtimes={};window.plupload=c})();(function(b){var c={};function a(i,e,k,j,d){var l,g,f,h;g=google.gears.factory.create("beta.canvas");g.decode(i);h=Math.min(e/g.width,k/g.height);if(h<1){e=Math.round(g.width*h);k=Math.round(g.height*h)}else{e=g.width;k=g.height}g.resize(e,k);return g.encode(d,{quality:j/100})}b.runtimes.Gears=b.addRuntime("gears",{init:function(g,i){var h;if(!window.google||!google.gears){return i({success:false})}try{h=google.gears.factory.create("beta.desktop")}catch(f){return i({success:false})}function d(k){var j,e,l=[],m;for(e=0;e0;p=Math.ceil(l.size/m);if(!e){m=l.size;p=1}if(k&&/\.(png|jpg|jpeg)$/i.test(l.name)){c[l.id]=a(c[l.id],k.width,k.height,k.quality||90,/\.png$/i.test(l.name)?"image/png":"image/jpeg")}l.size=c[l.id].length;function j(){var u,w,s=o.settings.multipart,r=0,v={name:l.target_name||l.name};function t(y){var x,C="----pluploadboundary"+b.guid(),A="--",B="\r\n",z;if(s){u.setRequestHeader("Content-Type","multipart/form-data; boundary="+C);x=google.gears.factory.create("beta.blobbuilder");b.each(o.settings.multipart_params,function(E,D){x.append(A+C+B+'Content-Disposition: form-data; name="'+D+'"'+B+B);x.append(E+B)});x.append(A+C+B+'Content-Disposition: form-data; name="file"; filename="'+l.name+'"'+B+"Content-Type: application/octet-stream"+B+B);x.append(y);x.append(B+A+C+A+B);z=x.getAsBlob();r=z.length-y.length;y=z}u.send(y)}if(l.status==b.DONE||l.status==b.FAILED||o.state==b.STOPPED){return}if(e){v.chunk=q;v.chunks=p}w=Math.min(m,l.size-(q*m));u=google.gears.factory.create("beta.httprequest");u.open("POST",b.buildUrl(o.settings.url,v));if(!s){u.setRequestHeader("Content-Disposition",'attachment; filename="'+l.name+'"');u.setRequestHeader("Content-Type","application/octet-stream")}u.upload.onprogress=function(x){l.loaded=n+x.loaded-r;o.trigger("UploadProgress",l)};u.onreadystatechange=function(){var x;if(u.readyState==4){if(u.status==200){x={chunk:q,chunks:p,response:u.responseText,status:u.status};o.trigger("ChunkUploaded",l,x);if(x.cancelled){l.status=b.FAILED;return}n+=w;if(++q>=p){l.status=b.DONE;o.trigger("FileUploaded",l,{response:u.responseText,status:u.status})}else{j()}}else{o.trigger("Error",{code:b.HTTP_ERROR,message:"HTTP Error.",file:l,chunk:q,chunks:p,status:u.status})}}};if(q3){h.pop()}while(h.length<4){h.push(0)}i=o.split(".");while(i.length>4){i.pop()}do{q=parseInt(i[m],10);j=parseInt(h[m],10);m++}while(m';function e(){return document.getElementById(l.id+"_silverlight").content.Upload}l.bind("Silverlight:Init",function(){var i,n={};l.bind("Silverlight:StartSelectFiles",function(o){i=[]});l.bind("Silverlight:SelectFile",function(o,r,p,q){var s;s=c.guid();n[s]=r;n[r]=s;i.push(new c.File(s,p,q))});l.bind("Silverlight:SelectSuccessful",function(){if(i.length){l.trigger("FilesAdded",i)}});l.bind("Silverlight:UploadChunkError",function(o,r,p,s,q){l.trigger("Error",{code:c.IO_ERROR,message:"IO Error.",details:q,file:o.getFile(n[r])})});l.bind("Silverlight:UploadFileProgress",function(o,s,p,r){var q=o.getFile(n[s]);if(q.status!=c.FAILED){q.size=r;q.loaded=p;o.trigger("UploadProgress",q)}});l.bind("Refresh",function(o){var p,q,r;p=document.getElementById(o.settings.browse_button);q=c.getPos(p,document.getElementById(o.settings.container));r=c.getSize(p);c.extend(document.getElementById(o.id+"_silverlight_container").style,{top:q.y+"px",left:q.x+"px",width:r.w+"px",height:r.h+"px"})});l.bind("Silverlight:UploadChunkSuccessful",function(o,r,p,u,t){var s,q=o.getFile(n[r]);s={chunk:p,chunks:u,response:t};o.trigger("ChunkUploaded",q,s);if(q.status!=c.FAILED){e().UploadNextChunk()}if(p==u-1){q.status=c.DONE;o.trigger("FileUploaded",q,{response:t})}});l.bind("Silverlight:UploadSuccessful",function(o,r,p){var q=o.getFile(n[r]);q.status=c.DONE;o.trigger("FileUploaded",q,{response:p})});l.bind("FilesRemoved",function(o,q){var p;for(p=0;p';function j(){return document.getElementById(g.id+"_flash")}function i(){if(m++>5000){l({success:false});return}if(!e){setTimeout(i,1)}}i();k=f=null;g.bind("Flash:Init",function(){var q={},o,p=g.settings.filters,n=g.settings.resize||{};e=true;for(o=0;o0){r(++s,u)}else{k.status=a.DONE;n.trigger("FileUploaded",k,{response:w.value.body,status:v});if(v!=200){n.trigger("Error",{code:a.HTTP_ERROR,message:"HTTP Error.",file:k,status:v})}}}else{n.trigger("Error",{code:a.GENERIC_ERROR,message:"Generic Error.",file:k,details:w.error})}})}function q(s){k.size=s.size;if(l){e.FileAccess.chunk({file:s,chunkSize:l},function(v){if(v.success){var w=v.value,t=w.length;o=Array(t);for(var u=0;u";document.getElementById(g.id+"_html5").onchange=function(){f(this.files);this.value=""}});g.bind("PostInit",function(){var i=document.getElementById(g.settings.drop_element);if(i){b.addEvent(i,"dragover",function(j){j.preventDefault()});b.addEvent(i,"drop",function(k){var j=k.dataTransfer;if(j&&j.files){f(j.files)}k.preventDefault()})}});g.bind("Refresh",function(i){var j,k,l;j=document.getElementById(g.settings.browse_button);k=b.getPos(j,document.getElementById(i.settings.container));l=b.getSize(j);b.extend(document.getElementById(g.id+"_html5_container").style,{top:k.y+"px",left:k.x+"px",width:l.w+"px",height:l.h+"px"})});g.bind("UploadFile",function(i,l){var p=new XMLHttpRequest(),k=p.upload,j=i.settings.resize,o,n=0;function m(q){var u="----pluploadboundary"+b.guid(),s="--",t="\r\n",r="";if(i.settings.multipart){p.setRequestHeader("Content-Type","multipart/form-data; boundary="+u);b.each(i.settings.multipart_params,function(w,v){r+=s+u+t+'Content-Disposition: form-data; name="'+v+'"'+t+t;r+=w+t});r+=s+u+t+'Content-Disposition: form-data; name="file"; filename="'+l.name+'"'+t+"Content-Type: application/octet-stream"+t+t+q+t+s+u+s+t;n=r.length-q.length;q=r}p.sendAsBinary(q)}if(l.status==b.DONE||l.status==b.FAILED||i.state==b.STOPPED){return}if(k){k.onprogress=function(q){l.loaded=q.loaded-n;i.trigger("UploadProgress",l)}}p.onreadystatechange=function(){var q=p.status;if(p.readyState==4){l.status=b.DONE;l.loaded=l.size;i.trigger("UploadProgress",l);i.trigger("FileUploaded",l,{response:p.responseText,status:q});if(q!=200){i.trigger("Error",{code:b.HTTP_ERROR,message:"HTTP Error.",file:l,status:q})}}};p.open("post",b.buildUrl(i.settings.url,{name:l.target_name||l.name}),true);p.setRequestHeader("Content-Type","application/octet-stream");o=c[l.id];if(p.sendAsBinary){if(j&&/\.(png|jpg|jpeg)$/i.test(l.name)){a(o.getAsDataURL(),j.width,j.height,/\.png$/i.test(l.name)?"image/png":"image/jpeg",function(q){if(q.success){l.size=q.data.length;m(q.data)}else{m(o.getAsBinary())}})}else{m(o.getAsBinary())}}else{p.send(o)}});e=!!(File&&File.prototype.getAsDataURL);g.features={dragdrop:window.mozInnerScreenX!==undefined,jpgresize:e,pngresize:e};h({success:true})}})})(plupload);(function(a){a.runtimes.Html4=a.addRuntime("html4",{init:function(f,g){var d={},c,b;function e(l){var k,j,m=[],n,h;h=l.value.replace(/\\/g,"/");h=h.substring(h.length,h.lastIndexOf("/")+1);n=a.guid();k=new a.File(n,h,1025);d[n]=k;k.input=l;m.push(k);if(m.length){f.trigger("FilesAdded",m)}}f.bind("Init",function(o){var h,w,u,s=[],n,t,m=o.settings.filters,l,r,q=/MSIE/.test(navigator.userAgent),k="javascript",v,j=document.body;if(f.settings.container){j=document.getElementById(f.settings.container);j.style.position="relative"}if(!o.settings.form){h=document.getElementsByTagName("form");if(!h.length){c=document.createElement("form");c.setAttribute("action",o.settings.url);c.setAttribute("target","_self");document.body.appendChild(c)}else{c=h[0]}c.setAttribute("id",c.id||o.id);c.setAttribute("method","post");c.setAttribute("enctype","multipart/form-data")}else{c=(typeof o.settings.form=="string")?document.getElementById(o.settings.form):o.settings.form}a.each(o.settings.multipart_params,function(y,x){var i=document.createElement("input");a.extend(i,{type:"hidden",name:x,value:y});c.appendChild(i)});b=document.createElement("iframe");b.setAttribute("src",k+':""');b.setAttribute("name",o.id+"_iframe");b.setAttribute("id",o.id+"_iframe");b.style.display="none";a.addEvent(b,"load",function(A){var B=A.target,y=f.currentfile,z;try{z=B.contentWindow.document||B.contentDocument||window.frames[B.id].document}catch(x){o.trigger("Error",{code:a.SECURITY_ERROR,message:"Security error.",file:y});return}if(z.location.href=="about:blank"||!y){return}var i=z.documentElement.innerText||z.documentElement.textContent;if(i!=""){y.status=a.DONE;y.loaded=1025;y.percent=100;if(y.input){y.input.removeAttribute("name")}o.trigger("UploadProgress",y);o.trigger("FileUploaded",y,{response:i});if(c.tmpAction){c.action=c.tmpAction}if(c.tmpTarget){c.target=c.tmpTarget}}});c.appendChild(b);if(q){window.frames[b.id].name=b.name}w=document.createElement("div");w.id=o.id+"_iframe_container";for(n=0;n