ACMS.Dispatch._observefilesize=function(elm){var browser=" "+ACMS.Dispatch.Utility.getBrowser();if(!(1&&window.File&&window.FileReader&&window.FileList&&window.Blob&&!(browser.indexOf(" ie")!==-1))){return}var $form=$(elm),Config=ACMS.Config,i18n=ACMS.i18n,postMax=returnBytes(Config.pms),fileMax=returnBytes(Config.umfs);function returnBytes(size){if(!!size.match(/^\d+}$/)){return size}var scale=size.slice(size.length-1);size=parseInt(size);switch(scale){case"G":size*=1024;case"M":size*=1024;case"K":size*=1024}return size}function convertBytes(size){var scale=String(size).length>6?"M":String(size).length>3?"K":"";switch(scale){case"G":size/=1024;case"M":size/=1024;case"K":size/=1024}return size.toFixed(1)+scale}function onSingleOver(file){alert(i18n.message1+"\n"+i18n.message2+" : "+file.name+"\n"+i18n.message3+" : "+convertBytes(file.size)+i18n.message10+"\n"+i18n.message6+" : "+convertBytes(fileMax)+i18n.message10+"\n"+"\n"+i18n.message7+i18n.message8)}function onTotalOver(totalCount,totalSize){alert(i18n.message1+"\n"+i18n.message4+" : "+totalCount+"\n"+i18n.message5+" : "+convertBytes(totalSize)+i18n.message10+"\n"+i18n.message6+" : "+convertBytes(postMax)+i18n.message10+"\n"+"\n"+i18n.message7+i18n.message9)}function checkFileSize(fileInput,callback){var files=fileInput.files,i=0,iz=files.length,size,totalSize=0,file;for(;i<iz;i++){file=files[i];size=file.size||file.fileSize;totalSize+=size;if(size>fileMax&&!!callback){callback(file);$(fileInput).val("")}}return totalSize}$(document).on("change",":file",function(){if($.contains(elm,this)){$form.removeClass("alerted");checkFileSize(this,onSingleOver)}});$form.submit(function(e){var totalSize=0,totalCount=0;$form.find(":file").each(function(){if(this.files.length){totalSize+=checkFileSize(this);totalCount+=this.files.length}});if(totalSize>postMax){onTotalOver(totalCount,totalSize);e.preventDefault();e.stopImmediatePropagation();return false}})};