/* * @copyright Leyun internet Technology(Shanghai)Co.,Ltd * @license http://www.dzzoffice.com/licenses/license.txt * @package DzzOffice * @link http://www.dzzoffice.com * @author zyx(zyx@dzz.cc) */ var forms,mainForm,attachexts=new Array,attachwh=new Array,insertType=1,thumbwidth=parseInt(60),thumbheight=parseInt(60),extensions="jpg,jpeg,gif,png",nowUid=0,uploadStat=0,picid=0,nowid=0,successState=!1;function getExt(e){return-1==e.lastIndexOf(".")?"":e.substr(e.lastIndexOf(".")+1,e.length).toLowerCase()}function delete_pic(e,t){document.getElementById("pic_container").removeChild(e.parentNode.parentNode);var n=document.createElement("input");n.type="hidden",n.name="delete_pics[]",n.value=t,document.getElementById("pic_delete").appendChild(n)}function delAttach(e){document.getElementById("attachbody").removeChild(document.getElementById("attach_"+e).parentNode.parentNode.parentNode),""==document.getElementById("attachbody").innerHTML&&addAttach(),document.getElementById("localimgpreview_"+e+"_menu")&&document.body.removeChild(document.getElementById("localimgpreview_"+e+"_menu"))}function addAttach(){newnode=document.getElementById("attachbodyhidden").rows[0].cloneNode(!0);var e,t=nowid;e=newnode.getElementsByTagName("form");for(var n=0;n",i+='['+__lang.delete+"]",i+="",document.getElementById("localfile_"+e).innerHTML=i,document.getElementById("attach_"+e).style.display="none",addAttach()}else alert(__lang.support_upload_pictures_extensions)}function getPath(e){if(e)return BROWSER.ie&&BROWSER.ie<7?(e.select(),document.selection.createRange().text):BROWSER.firefox?e.files?e.files.item(0).getAsDataURL():e.value:""}function inArray(e,t){if("string"==typeof e)for(var n in t)if(t[n]==e)return!0;return!1}function insertAttachimgTag(e){edit_insert("[imgid="+e+"]")}function uploadSubmit(e){e.disabled=!0,mainForm=e.form,forms=document.getElementById("attachbody").getElementsByTagName("FORM"),upload()}function upload(){if(void 0===forms[nowUid])return!1;var e=forms[nowUid].id.split("_");if(e=e[1],nowUid>0){var t=document.getElementById("showmsg"+nowid);if(1==uploadStat){t.innerHTML=__lang.upload_success,successState=!0;try{var n=document.createElement('')}catch(e){(n=document.createElement("input")).setAttribute("name","picids[]"),n.setAttribute("type","hidden"),n.setAttribute("id","picid_"+picid),n.setAttribute("value",picid)}mainForm.appendChild(n)}else t.style.color="#f00",t.innerHTML=__lang.upload_failed+uploadStat}null!=document.getElementById("showmsg"+e)?(document.getElementById("showmsg"+e).innerHTML=__lang.upload_await+'('+__lang.founder_upgrade_reset+")",forms[nowUid].submit()):nowUid+1==forms.length&&(window.onbeforeunload=null,mainForm.submit()),nowid=e,nowUid++,uploadStat=0}addAttach();