function EditImageSubmit(){var c=parent.selectedTreeNodeID,o=parent.document.getElementById("containerq"+c),p=o!=null?o:parent.document.getElementById("container"+c),tt=p.contentWindow.selectedListNodeID,n=p.contentWindow.document.getElementById("listnode"+tt),w=n.getAttribute("itemid"),b=parent.document.getElementById("ImageWidth"),k=parent.document.getElementById("ImageHeight"),r=b.value,u=k.value,t,l,a,f,v,y,h,e,i;if(r==n.getAttribute("width")&&u==n.getAttribute("height"))r=0,u=0;else if(r>2e3||u>2e3){alert(parent.I18N.LimitedSideSize);b.value=n.getAttribute("width");k.value=n.getAttribute("height");return}if(t=parent.document.getElementById("ImageTypeDropDownList").value,t==""&&(t=n.getAttribute("extension")),l=c,a=w,o!=null){var it=n.getAttribute("parentid"),rt=n.getAttribute("itemid"),s=parent.document.getElementById("sidebar").getElementsByTagName("div");for(f=0;f<s.length;f++)if(s[f].getAttribute("folderid")===it&&(v=parent.document.getElementById("container"+s[f].getAttribute("nodeid")),v!=null)){if(l=s[f].getAttribute("nodeid"),y=v.contentWindow.document.getElementById("listdetails"),y!=null)for(h=y.getElementsByTagName("tr"),e=0;e<h.length;e++)if(h[e].getAttribute("itemid")===rt){a=h[e].getAttribute("itemid");break}break}}if(parent.ExistItemInList(l,a,n.getAttribute("itemname")+"."+t,"file")){alert(parent.I18N.SameFileWithSelectedExtensionIsExists);return}parent.ClosePopUp();var d=parent.document.getElementById("CheckRotateHorizonal").checked,g=parent.document.getElementById("CheckRotateVetical").checked,nt=parent.document.getElementById("ImageText").value;(r!=0||u!=0||t!=""&&t!=n.getAttribute("extension")||d||g||nt!="")&&(parent.ShowLoadingIcon(),i=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP"),i.onreadystatechange=function(){var s,h,l,a,e,f;if(i.readyState==4)if(parent.HiddenLoadingIcon(),i.status==200)if(s=parent.json_parse(i.responseText),s.success=="success"){if(n.setAttribute("width",r),n.setAttribute("height",u),n.setAttribute("extension",t),n.setAttribute("lastwritetime",s.lastWriteTime),n.setAttribute("size",s.size),n.getElementsByTagName("img")[0].src="/content/images/filetype/"+t+".gif",n.getElementsByTagName("td")[1].innerHTML=parent.FileSizeFormated(s.size,"KB"),n.getElementsByTagName("td")[2].innerHTML=t.toUpperCase()+" File",o!=null){var v=n.getAttribute("parentid"),y=n.getAttribute("itemid"),c=parent.document.getElementById("sidebar").getElementsByTagName("div");for(h=0;h<c.length;h++)if(c[h].getAttribute("folderid")===v&&(l=parent.document.getElementById("container"+c[h].getAttribute("nodeid")),l!=null)){if(a=l.contentWindow.document.getElementById("listdetails"),a!=null)for(e=a.getElementsByTagName("tr"),f=0;f<e.length;f++)if(e[f].getAttribute("itemid")===y){e[f].setAttribute("width",r);e[f].setAttribute("height",u);e[f].setAttribute("extension",t);e[f].setAttribute("lastwritetime",s.lastWriteTime);e[f].setAttribute("size",s.size);e[f].getElementsByTagName("img")[0].src="/content/images/filetype/"+t+".gif";e[f].getElementsByTagName("td")[1].innerHTML=parent.FileSizeFormated(s.size,"KB");e[f].getElementsByTagName("td")[2].innerHTML=t.toUpperCase()+" File";break}break}}parent.ShowUsageSpace(s.totalFilesSize,parent.accountCapacity)}else alert(parent.I18N.FailedFunctionShortageUserCapacity);else i.status==500?alert(parent.I18N.ErrorFunction):i.status==530&&(parent.window.location=i.responseText)},i.open("post","/panel/editimage?targetfileid="+w+"&newwidth="+r+"&newheight="+u+"&newextension="+t+"&rotatehorizonal="+d+"&rotatevertical="+g,!0),i.setRequestHeader("X-Requested-With","XMLHttpRequest"),i.setRequestHeader("Content-type","application/x-www-form-urlencoded"),i.send("imagetext="+encodeURIComponent(nt)))}function UploaderAttachFile(n){var i="uploader"+n;navigator.userAgent.indexOf("MSIE")>-1?setTimeout("if(parent.document.getElementById('"+i+"') != null) parent.document.getElementById('"+i+"').contentWindow.document.getElementById('iframeForm').submit();",1e3):parent.document.getElementById(i).src+="javascript:document.getElementById('iframeForm').submit();";var u=!1,r=!1,t=window.setInterval(function(){var f;f=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");f.onreadystatechange=function(){if(f.readyState==4)if(f.status==200){var e=parent.json_parse(f.responseText);r||(e.totalFileSize>0?u||(u=!0,window.clearInterval(t),UploaderProgressBar(e.totalFileSize,i,n)):e.totalFileSize==-1?(r=!0,window.clearInterval(t),parent.UploaderFileCancel(n,parent.I18N.ErrorSendFile),parent.UploaderFileStart()):e.totalFileSize==-2?(r=!0,window.clearInterval(t),parent.UploaderFileCancel(n,parent.I18N.InvalidFileCapacity),parent.UploaderFileStart()):e.totalFileSize==-3&&(r=!0,window.clearInterval(t),parent.UploaderFileCancel(n,parent.I18N.ShortageUserCapacity),parent.UploaderFileStart()))}else f.status==500?(window.clearInterval(t),parent.UploaderFileCancel(n,parent.I18N.ErrorSendFile),parent.UploaderFileStart()):f.status==530&&(parent.window.location=f.responseText)};f.open("get","/file/gettotalfilesize"+parent.guid+Math.floor(Math.random()*1e4+1)+"?uploadkey="+parent.guid+"_"+n+"&"+Math.random(),!0);f.setRequestHeader("X-Requested-With","XMLHttpRequest");f.send(null);parent.document.getElementById(i)==null&&(r=!0,window.clearInterval(t))},2e3)}function UploaderProgressBar(n,t,i){var r=0,e,h=parent.document.getElementById("progressscroll"+i),c=parent.document.getElementById("progresspercent"+i),l=parent.document.getElementById("progressbar"+i).offsetWidth-2,b=parent.document.getElementById("uploadinfo"),a=!1,v=3,u=0,y=0,o=0,p,k=0,d=0,w=5,f=!1,s=window.setInterval(function(){u+=v;var g;g=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");g.onreadystatechange=function(){var v,nt,tt;g.readyState==4&&(g.status==200?(v=parent.json_parse(g.responseText),parseInt(v.currentFileSize)==-1||parent.document.getElementById(t)==null?(a=!0,window.clearInterval(s),parent.document.getElementById(t)!=null&&(parent.UploaderFileCancel(i,parent.I18N.ErrorSendFile),parent.UploaderFileStart())):r<parseInt(v.currentFileSize)&&!a&&(r=parseInt(v.currentFileSize),e=parseInt(r/n*100),h.style.width=l/100*e+"px",c.innerHTML=e+"%",p=parent.FixedNumber(r/1024/u,1)+"KB/sec",r!=0?(y=u*n/r-u,o=parent.FormatTime(y)):o="",b.innerHTML=parent.I18N.Send+" "+parent.ConvertorFileSize(r,!1).replace(" ","")+" "+parent.I18N.From+" "+parent.ConvertorFileSize(n,!1).replace(" ","")+" "+parent.I18N.WithRate+" "+p+" - "+parent.I18N.RemainTime+": "+o,r>=n&&(window.clearInterval(s),h.style.width=l+"px",c.innerHTML="100%",nt=parent.document.getElementById("cancelimgrow"+i),nt.title="",nt.className="",nt.onclick=function(){},tt=window.setInterval(function(){var n,t;n=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");n.onreadystatechange=function(){var t,e,r,o,u;n.readyState==4&&(n.status==200?(t=parent.json_parse(n.responseText),f||(f=!0,window.clearInterval(tt),e=parent.document.getElementById("uploadfile"+i),r=parent.document.getElementById("container"+e.getAttribute("treenodeid")),r!=null&&r.contentWindow.compeleteLoadListTable&&(r.contentWindow.DeleteFileList(t.fileId),o=r.contentWindow.lastListNodeID++,r.contentWindow.AddFileList(o,t.fileId,t.name,t.extension,t.size,t.server,0,"","",t.imageWidth,t.imageHeight,t.creationTime,t.creationTimeStamp,t.lastAccessTime,t.lastWriteTime),u=r.contentWindow.document.getElementById("list"),u.scrollTop=u.scrollHeight),parent.ShowUsageSpace(t.totalFilesSize,parent.accountCapacity),parent.UploaderFileComplete(i,t.fileId,t.name,t.extension,t.server),parent.UploaderFileStart())):n.status==530&&(parent.window.location=n.responseText),++d!=w||f||(parent.UploaderFileCancel(i,parent.I18N.ErrorSendFile),parent.UploaderFileStart()))};t=parent.username!=""?"&username="+parent.username:"";n.open("get","/file/fileuploadinfo"+parent.guid+Math.floor(Math.random()*1e4+1)+"?uploadkey="+parent.guid+"_"+i+t+"&"+Math.random(),!0);n.setRequestHeader("X-Requested-With","XMLHttpRequest");n.send(null);(++k==w||f)&&window.clearInterval(tt)},1500)))):g.status==500?(window.clearInterval(s),parent.UploaderFileCancel(i,parent.I18N.ErrorSendFile),parent.UploaderFileStart()):g.status==530&&(parent.window.location=g.responseText))};g.open("get","/file/getcurrentfilesize"+parent.guid+Math.floor(Math.random()*1e4+1)+"?uploadkey="+parent.guid+"_"+i+"&"+Math.random(),!0);g.setRequestHeader("X-Requested-With","XMLHttpRequest");g.send(null)},v*1e3)}function CleaApps(n){var t;t=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");t.onreadystatechange=function(){};t.open("get","/file/ClearApps"+parent.guid+Math.floor(Math.random()*1e4+1)+"?uploadkey="+n+"&"+Math.random(),!0);t.setRequestHeader("X-Requested-With","XMLHttpRequest");t.send(null)}