var pwUploads=new Array();
var pwProgressPanels=new Array();
var pwSubmitQueue=new Array();
var pwProgressID=null;
var pwOrigSubmit=null;
var pwOrigSubmitResult=true;
var pwDoFormSubmit=false;
var pwFlashDebug=false;
var pwDeadButtonClicked="";
function pwFlashDebug(debugMsg){
alert(debugMsg);
}
function pwPrepEvent(ctlClientID,ctlUniqueID){
pwDeadButtonClicked=ctlUniqueID;
return true;
}
function pwDetectFlashCaps(){
var version="";
var supported=false;
try{
axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.8");
version=axo.GetVariable("$version");
}catch(e){
if(navigator.plugins!=null&&navigator.plugins.length>0){
if(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]){
var swVer2=navigator.plugins["Shockwave Flash 2.0"]?" 2.0":"";
var flashDescription=navigator.plugins["Shockwave Flash"+swVer2].description;
var descArray=flashDescription.split(" ");
var tempArrayMajor=descArray[2].split(".");
var versionMajor=tempArrayMajor[0];
var versionMinor=tempArrayMajor[1];if(descArray[3]!=""){
tempArrayMinor=descArray[3].split("r");
}else{
tempArrayMinor=descArray[4].split("r");
}
var versionRevision=tempArrayMinor[1]>0?tempArrayMinor[1]:0;
version=versionMajor+","+versionMinor+","+versionRevision;
}
}
}
version=version.replace("WIN ","");
var parts=version.split(',');
var num=parseFloat(parts[0]);
if(num>=8)supported=true;
return supported;
}
function pwSetFormsEncType(){
for(i=0;i<document.forms.length;i++){
document.forms[i].enctype="multipart/form-data";
}
}
function pwAddUpload(upload){
pwUploads.push(upload)
}
function pwAddProgressPanel(progpanel){
pwProgressPanels.push(progpanel);
}
function pwGetUpload(uploadID){
for(var i=0;i<pwUploads.length;i++){
if(pwUploads[i].ID==uploadID)
return pwUploads[i];
}
return null;
}
function pwGetProgPanel(panelID){
for(var i=0;i<pwProgressPanels.length;i++){
if(pwProgressPanels[i].ID==panelID)
return pwProgressPanels[i];
}
return null;
}
function pwOpenProgressPanels(){
for(var i=0;i<pwProgressPanels.length;i++){
pwOpenProgressPanel(pwProgressPanels[i].ID,0);
}
}
function pwGetEncodedString(ctlId,ctlClientId){
var enc=document.getElementById("pwFileUploadData");
if(enc)return ctlId+"|"+ctlClientId+"|"+enc.value;
return"";
}
function pwSetEncodedString(encData){
var enc=document.getElementById("pwFileUploadData");
if(enc)enc.value=encData;
}
function pwFlashDialogExists(uploadID){
var upload=pwGetUpload(uploadID);
if(typeof(upload)=="undefined"||typeof(upload.dlg)=="undefined")
return false;
return true;
}
function pwResetUploads(){
for(var i=0;i<pwUploads.length;i++){
pwUploads[i].reset();
}
}
function pwSendUploadCallback(id,eventName,eventArg){
uploadManager.SetForCallback();
pwBeginCallback(id,eventName,eventArg,'pwInternalCallback','',false,null,null,null,null,true);
uploadManager.ClearForPostback();
}
function pwSubmit(){
if(!pwCanSubmit()){
uploadManager.ClearForPostback();
if(pwOrigSubmit!=null)
return pwOrigSubmit();
else
return true;
}
pwDoFormSubmit=true;
if(pwOrigSubmit!=null){
pwOrigSubmitResult=pwOrigSubmit();
}
if(!pwOrigSubmitResult)return false;
for(var i=0;i<pwUploads.length;i++){
var upl=pwUploads[i];
if((upl.enabled&&!upl.suppressed)&&(!upl.autoPostback)){
upl.submit();
}
}
if(pwSubmitQueue.length>0){
pwProcessSubmitQueue();
return false;
}
return true;
}
function pwSubmitPrep(){
if(!uploadManager.isPolling){
uploadManager.completedFiles=0;
uploadManager.failedFiles=0;
pwResetProgressPanels();
pwProgressSetCount();
pwStartManagerProgress();
}
}
function pwDoFilePost(upl){
if(upl){
if(pwIsFlash()){
upl.dlg.doStartUploads();
}
else{
setTimeout("pwGetUpload('"+upl.ID+"').pwDoSubmitForm()",100);
}
}
}
function pwProcessSubmitQueue(){
if(pwOrigSubmitResult&&pwSubmitQueue.length>0){
pwDoFilePost(pwSubmitQueue.pop());
}
else{
pwClearTotals();
}
}
function pwUploadComplete(uploadID){
if(uploadManager==null)return;
pwSendUploadCallback(uploadManager.ID,"InternalUploadComplete","");
pwUploadPostComplete(uploadID);
}
function pwReportFileFailed(uploadID){
if(!uploadManager)return;
if(uploadManager.fileFailedBehavior&&uploadManager.fileFailedBehavior=="Proceed"){
var upl=pwGetUpload(uploadID);
if(upl&&pwIsFlash())upl.dlg.doNextUpload(true);
return;
}
uploadManager.stopProgressLoop();
for(var i=0;i<pwUploads.length;i++){
try{
if(pwUploads[i]&&pwIsFlash()){
pwUploads[i].dlg.doCancel();
}
if(!pwIsFlash())
pwUploads[i].restoreUrl();
}catch(err){}
}
pwSubmitQueue=new Array();
pwProgressSetAllComplete();
}
function pwUploadPostComplete(uploadID){
var bGroupComplete=false;
var upload=pwGetUpload(uploadID);
upload.selectedFiles="";
if(upload.autoPostback)
bGroupComplete=true;
else{
if(pwSubmitQueue.length>0)
pwProcessSubmitQueue();
else
bGroupComplete=true;
}
if(bGroupComplete){
pwToggleUploadControls(true);
var delay=500;
setTimeout("pwUploadGroupComplete()",delay);
}
}
function pwUploadGroupComplete(){
if(uploadManager==null)return;
pwSendUploadCallback(uploadManager.ID,"InternalUploadGroupComplete","");
uploadManager.stopProgressLoop();
if(pwDeadButtonClicked!=""){
var pwTarget=document.forms[0].__EVENTTARGET;
var pwArg=document.forms[0].__EVENTARGUMENT;
if(!pwTarget){
pwTarget=document.createElement("input type=hidden");
pwTarget.name="__EVENTTARGET";
document.forms[0].appendChild(pwTarget);
if(document.all)document.forms[0].normalize();
}
if(!pwArg){
pwArg=document.createElement("input type=hidden");
pwArg.name="__EVENTARGUMENT";
document.forms[0].appendChild(pwArg);
if(document.all)document.forms[0].normalize();
}
pwTarget.value=pwDeadButtonClicked;
pwArg.value="";
pwSendUploadCallback(pwDeadButtonClicked,"Click","");
pwDeadButtonClicked="";
pwTarget.value="";
}
pwClearTotals();
if(pwDoFormSubmit==true)
{
pwDoFormSubmit=false;
if(pwOrigSubmit!=null)pwOrigSubmit();
}
}
function pwOnDialogSelect(uploadID,selectedFilename){
var upload=pwGetUpload(uploadID);
if(upload){upload.dialogSelect(selectedFilename);}
}
function pwUploadCleanup(uploadID,msg,pwReset){
if(uploadManager&&uploadManager.isPolling){
if(uploadManager)uploadManager.stopProgressLoop();
if(msg)pwBroadcastStatus(msg);
if(pwReset){
var upl=pwGetUpload(uploadID);
if(upl)upl.reset();
pwProgressSetComplete();
}
}
}
function pwIFrameComplete(uploadID,bFailed){
var upload=pwGetUpload(uploadID);
if(upload){
if(!bFailed)pwUploadComplete(uploadID);
upload.restoreUrl();
}
}
function pwGetFormFieldValue(form,field){
if(document.all){
var val=document.getElementById(field);
return(val==null)?"":val.value;
}
else{
try{
for(var i=0;i<form.elements.length;i++){
var pwFormEl=form.elements[i];
if(pwFormEl.name==field)
return pwFormEl.value;
}
}
catch(err){
}
}
return"";
}
function pwGetPageKey(){
if(pwUploads.length<=0)return"";
var key=pwGetFormFieldValue(pwUploads[0].form,"pwPageKey");
return key;
}
function pwGetViewState(){
if(pwUploads.length<=0)return"";
var state=pwGetFormFieldValue(pwUploads[0].form,"__VIEWSTATE");
return state;
}
function pwDetectUploadType(uploadType){
if(uploadType!="AutoDetect")return uploadType;
var isFlash=pwDetectFlashCaps();
if(isFlash==true)return"Flash";
return"IFrame";
}
function pwGetFirstForm(){
return document.forms[0];
}
function pwIsFlash(){
if(!uploadManager)return false;
return(uploadManager.uploadType=="Flash");
}
function pwUploadManager(id,pollingInterval,uploadType,uniqueID,fileFailedBehavior,forceSSL){
this.form=pwGetFirstForm();
this.uploadType=pwDetectUploadType(uploadType);
this.ID=id;
this.uniqueID=uniqueID;
this.pollingInterval=(pollingInterval==null)?1000:pollingInterval;
this.IDs=new Array();
this.isPolling=false;
this.cancelled=false;
this.completedFiles=0;
this.failedFiles=0;
this.fileFailedBehavior=fileFailedBehavior;
this.hiddenElement=document.getElementById(id);
if(forceSSL)
{
var svr=new String();
svr=pwServer;
pwServer=svr.replace("http:","https:");
}
if(pwOrigSubmit==null){
pwOrigSubmit=this.form.onsubmit;
this.form.onsubmit=pwSubmit;
}
}
pwUploadManager.prototype.ClearForPostback=function(){
if(this.hiddenElement)
this.hiddenElement.name="";
}
pwUploadManager.prototype.SetForCallback=function(){
if(this.hiddenElement)
this.hiddenElement.name=this.uniqueID;
}
pwUploadManager.prototype.addPendingSubmit=function(submitID){
this.IDs.push(submitID);
}
pwUploadManager.prototype.onCancel=function(){
this.stopProgressLoop();
this.cancelled=true;
var stopped=false;
for(var i=0;i<pwUploads.length;i++){
pwSendUploadCallback(this.ID,"InternalUploadCancel","");
if(pwIsFlash()){
pwUploads[i].dlg.doCancel();
}
else{
pwUploads[i].restoreUrl();
if(!stopped){
psSubmitQueue=new Array();
stopped=true;
}
}
}
}
pwUploadManager.prototype.stopProgressLoop=function(){
window.clearInterval(this.progressID);
this.progressID=null;
this.isPolling=false;
pwToggleUploadControls(true);
}
function pwRaiseManagerProgress(){
if(uploadManager&&uploadManager.isPolling){
uploadManager.raiseProgress();
}
}
pwUploadManager.prototype.startProgressLoop=function(){
if(!this.progressID){
this.isPolling=true;
this.progressID=setInterval(pwRaiseManagerProgress,this.pollingInterval);
}
}
pwUploadManager.prototype.confirmPolling=function(){
this.startProgressLoop();
}
pwUploadManager.prototype.raiseProgress=function(){
pwSendUploadCallback(this.ID,"InternalProgress",pwTotalFiles()+'');
}
function pwStartManagerProgress(){
if(uploadManager&&!uploadManager.isPolling){
pwOpenProgressPanels();
uploadManager.startProgressLoop();
}
}
function pwReportFileCount(uploadID,fileCount){
var upl=pwGetUpload(uploadID);
if(!upl)return;
upl.filecount=fileCount;
if(fileCount==0){
var spliceIdx=-1;
for(i=0;i<pwSubmitQueue.length;i++){
if(pwSubmitQueue[i].ID==uploadID){
pwSubmitQueue.splice(i,1);
break;
}
}
}
pwProgressSetCount();
}
function pwReportFileComplete(completed,failed){
if(uploadManager){
if(completed>uploadManager.completedFiles||failed>uploadManager.failedFiles){
uploadManager.completedFiles=completed;
uploadManager.failedFiles=failed;
if(uploadManager.completedFiles+uploadManager.failedFiles>=pwTotalFiles()){
pwProgressSetComplete();
}
}
}
pwProgressSetCount();
}
function pwUpload(uploadManager,containerID,ID,autoPostback,enabled,enableCallback,text,showTextBox,buttonImageUrl,tabIndex,tooltip){
this.manager=eval(uploadManager);
this.containerID=containerID;
this.container=document.getElementById(containerID);
this.appendElement=this.container;
this.doc=document;
this.ID=ID;
this.flashID=containerID+"_Flash";
this.buttonID=containerID+"_Button";
this.textboxID=containerID+"_TextBox";
this.iframeID=containerID+"_IFrame";
this.autoPostback=autoPostback;
this.enabled=enabled;
this.suppressed=false;
this.enableCallback=enableCallback;
this.form=document.forms[0];
this.filecount=0;
this.selectedFiles="";
this.upload=null;
this.textbox=null;
this.button=null;
this.childForm=null;
this.dataField=null;
this.text=text;
this.showTextBox=showTextBox;
this.buttonImageUrl=buttonImageUrl;
this.tabIndex=tabIndex;
this.tooltip=tooltip;
this.cachedUrl="";
this.cancelled=false;
this.iframe=null;
pwAddUpload(this);
}
function pwToggleUploadControls(buttonState){
for(var i=0;i<pwUploads.length;i++){
var upl=pwUploads[i];
pwToggleUploadControl(upl.ID,buttonState);
}
}
function pwToggleUploadControl(uploadID,buttonState){
var upl=pwGetUpload(uploadID);
if(!upl)upl=pwGetUpload(uploadID+"_Upload");
if(upl){
upl.suppressed=!buttonState;
if(upl.dlg&&upl.dlg.enableFlashButton)
upl.dlg.enableFlashButton(buttonState&&upl.enabled);
}
}
function pwEnableUploadControl(uploadID){
pwToggleUploadControl(uploadID,true);
}
function pwDisableUploadControl(uploadID){
pwToggleUploadControl(uploadID,false);
}
function pwIsUploadEnabled(uploadID){
var upl=pwGetUpload(uploadID);
if(upl)
return(upl.enabled&&!upl.suppressed);
else
return false;
}
function pwBindFlash(uploadID,flashObj){
var upl=pwGetUpload(uploadID);
if(upl)upl.bindFlash(flashObj);
}
pwUpload.prototype.bindFlash=function(flashObj){
if((typeof(this.dlg)=="undefined"||typeof(this.dlg.doOpenDialog)=="undefined")&&typeof(flashObj)!="undefined")
{
this.dlg=flashObj;
}
}
pwUpload.prototype.reset=function(){
if(this.textbox)this.textbox.value=""
if(this.uploadCtl){
this.uploadCtl.value="";
var newObj=this.uploadCtl.cloneNode(true);
this.uploadCtl.parentNode.insertBefore(newObj,this.uploadCtl);
this.uploadCtl.parentNode.removeChild(this.uploadCtl);
this.uploadCtl=newObj;
}
this.selectedFiles="";
this.filecount=0;
this.cancelled=false;
}
pwUpload.prototype.dialogSelect=function(selectedFilename){
if(!this.enabled||this.suppressed)return;
this.selectedFiles=selectedFilename;
if(this.textbox&&this.showTextBox)this.textbox.value=selectedFilename;
if(this.autoPostback){
if(pwIsFlash()){this.dlg.doReportFileCount();}
this.submit();
}
}
function pwOnDialogCancel(uploadID){
}
pwUpload.prototype.submit=function(){
if(this.selectedFiles=="")return;
if(uploadManager){
pwSubmitPrep();
uploadManager.cancelled=false;
this.cancelled=false;
if(this.autoPostback)
{
if(uploadManager.uploadType!="Flash"){
pwReportFileCount(this.ID,1);
}
pwDoFilePost(this);
}
else
{
this.pushtoqueue();
}
}
}
pwUpload.prototype.pushtoqueue=function(){
this.filecount=0;
var doPush=false;
if(pwIsFlash())
{
doPush=true;
this.dlg.doReportFileCount();
}
else if(this.uploadCtl&&this.uploadCtl.value!="")
{
doPush=true;
pwReportFileCount(this.ID,1);
}
if(doPush&&this.filecount>0)pwSubmitQueue.push(this);
}
pwUpload.prototype.setUrl=function(url){
this.cachedUrl=url;
var newIF=document.createElement("iframe");
var cnt=document.getElementById(this.containerID);
newIF.id=this.iframeID;
newIF.setAttribute("scrolling","no");
newIF.setAttribute("position","absolute");
newIF.setAttribute("top","0");
newIF.setAttribute("left","0");
newIF.frameBorder="0";
newIF.setAttribute("allowTransparency","true");
newIF.style.background="none transparent";
newIF.src=url;
newIF.style.width=cnt.style.width;
newIF.style.height=cnt.style.height;
cnt.appendChild(newIF);
if(this.iframe){
cnt.removeChild(this.iframe);
}
this.iframe=newIF;
}
pwUpload.prototype.restoreUrl=function(){
if(this.cachedUrl!=null&&this.cachedUrl!="")
this.setUrl(this.cachedUrl);
}
function pwGetParent(pwElementType,pwSelectedElement){
if(document.all){
if(pwElementType.toLowerCase()==pwSelectedElement.tagName.toLowerCase())
return pwSelectedElement;
else if(pwSelectedElement.tagName.toLowerCase()=="body")
return null;
else
return pwGetParent(pwElementType,pwSelectedElement.parentElement);
}
else{
if(pwSelectedElement.nodeType==1){
if(pwElementType.toLowerCase()==pwSelectedElement.tagName.toLowerCase())
return pwSelectedElement;
else if(pwSelectedElement.tagName.toLowerCase()=="body")
return null;
}
return pwGetParent(pwElementType,pwSelectedElement.parentNode);
}
}
function pwGetElementTop(pwElementId){
var top=0;
var element=document.getElementById(pwElementId);
while(element){
if(element.style.position=="absolute"){
var t=parseInt(element.style.top);
return top+t;
}
top+=element.offsetTop;
element=element.offsetParent;
}
return top;
}
function pwGetElementLeft(pwElementId){
var left=0;
var element=document.getElementById(pwElementId);
while(element){
if(element.style.position=="absolute"){
var t=parseInt(element.style.left);
return left+t;
}
left+=element.offsetLeft;
element=element.offsetParent;
}
return left;
}
function pwProgressPanel(pwPanelId,pwDefaultStatusTxt,pwHrLabel,pwMnLabel,pwScLabel)
{
this.ID=pwPanelId;
this.CancelEnabled=false;
this.Container=document.getElementById(this.ID);
this.CancelButton=document.getElementById(this.ID+"_CancelButton");
this.CancelButtonImg=document.getElementById(this.ID+"_CancelButton_img");
this.CancelButtonImgD=document.getElementById(this.ID+"_CancelButton_imgD");
this.StatusText=document.getElementById(this.ID+"_StatusText");
this.UploadSpeed=document.getElementById(this.ID+"_UploadSpeed_Value");
this.UploadCount=document.getElementById(this.ID+"_UploadCount_Value");
this.UploadBytes=document.getElementById(this.ID+"_UploadBytes_Value");
this.UploadTimeElapsed=document.getElementById(this.ID+"_UploadTimeElapsed_Value");
this.UploadTimeRemaining=document.getElementById(this.ID+"_UploadTimeRemaining_Value");
this.ProgFileContainer=document.getElementById(this.ID+"_ProgFileContainer");
this.ProgFilePrototype=document.getElementById(this.ID+"_ProgFile_ProtoType");
this.ProgFilePrototypeContainer=document.getElementById(this.ID+"_ProgFile_ProtoType_Container");
this.CloseLink=document.getElementById(this.ID+"_CloseLink");
this.defaultStatusText=pwDefaultStatusTxt;
this.hrLabel=pwHrLabel;
this.mnLabel=pwMnLabel;
this.scLabel=pwScLabel;
pwAddProgressPanel(this);
if(this.CancelButton){
this.CancelButton.panel=this;
this.CancelButton.onclick=pwDoCancelClick;
}
}
pwProgressPanel.prototype.ShowClose=function(){
if(this.CloseLink)this.CloseLink.style.display="inline";
}
pwProgressPanel.prototype.HideClose=function(){
if(this.CloseLink)this.CloseLink.style.display="none";
}
pwProgressPanel.prototype.SetStatus=function(msg){
if(this.StatusText)this.StatusText.innerHTML=msg;
}
pwProgressPanel.prototype.SetSpeed=function(bps){
if(this.UploadSpeed)this.UploadSpeed.innerHTML=pwFormatDataSize(bps)+"/"+this.scLabel;
}
function pwFormatDataSize(pwNum){
if(pwNum>=1024000)return Math.round(pwNum*100/1024000)/100+" MB";
if(pwNum>=1024)return Math.round(pwNum*100/1024)/100+" KB";
return pwNum+" B";
}
pwProgressPanel.prototype.SetBytes=function(currentBytes)
{
if(this.UploadBytes)this.UploadBytes.innerHTML=pwFormatDataSize(currentBytes);
}
function pwFormatTime(tm,txt,hl,ml)
{
if(tm<=0&&(txt==hl||txt==ml))
return"";
if(tm<10)
tm="0"+tm;
tm=tm+" "+txt+" ";
return tm;
}
function pwSetObjTime(obj,hh,mm,ss,hl,ml,sl)
{
if(obj){
hh=pwFormatTime(hh,hl,hl,ml);
mm=pwFormatTime(mm,ml,hl,ml);
ss=pwFormatTime(ss,sl,hl,ml);
obj.innerHTML=hh+mm+ss;
}
}
pwProgressPanel.prototype.SetElapsed=function(hh,mm,ss){
pwSetObjTime(this.UploadTimeElapsed,hh,mm,ss,this.hrLabel,this.mnLabel,this.scLabel);
}
pwProgressPanel.prototype.SetRemaining=function(hh,mm,ss){
pwSetObjTime(this.UploadTimeRemaining,hh,mm,ss,this.hrLabel,this.mnLabel,this.scLabel);
}
pwProgressPanel.prototype.SetCount=function(completed){
var total=pwTotalFiles();
if(completed>total)total=completed;
if(completed==total)this.SetCancelButton(false);
if(this.UploadCount)this.UploadCount.innerHTML=completed+" / "+total;
}
pwProgressPanel.prototype.AppendFileBar=function(pwFileId,pwFileName)
{
var tempChild=document.createElement('div');
var str=this.ProgFilePrototypeContainer.innerHTML;
progHandle=pwFileId;
str=str.replace(/ProtoType/g,progHandle);
tempChild.innerHTML=str;
if(tempChild.childNodes[0].style.display)tempChild.childNodes[0].style.display="";
this.ProgFileContainer.appendChild(tempChild);
document.getElementById(this.ID+"_ProgFile_"+progHandle+"_Text").innerHTML=pwFileName;
document.getElementById(this.ID+"_ProgFile_"+progHandle).style.width="0%";
}
pwProgressPanel.prototype.RemoveFileBar=function(pwFileId){
var tempNode=document.getElementById(this.ID+"_ProgFile_"+pwFileId+"_Container");
if(tempNode)this.ProgFileContainer.removeChild(tempNode);
}
pwProgressPanel.prototype.ClearFileBars=function(){
while(this.ProgFileContainer.childNodes.length>1)
{
this.ProgFileContainer.removeChild(this.ProgFileContainer.childNodes[1]);
}
}
function pwDoCancelClick(){
this.panel.SetCancelButton(false);
this.panel.DoCancel();
}
pwProgressPanel.prototype.DoCancel=function(){
if(uploadManager){
uploadManager.onCancel();
}
pwClearTotals();
this.ShowClose();
}
pwProgressPanel.prototype.SetCancelButton=function(buttonVal){
if((this.CancelEnabled==buttonVal)||(!this.CancelButton))return;
if(this.CancelButton.type=="button")
this.CancelButton.disabled=!(buttonVal);
else{
if(buttonVal){
this.CancelButton.src=this.CancelButtonImg.src;
}
else{
this.CancelButton.src=this.CancelButtonImgD.src;
}
}
this.CancelEnabled=buttonVal;
}
function pwResetProgressPanels(){
for(var i=0;i<pwProgressPanels.length;i++){
var pnl=pwProgressPanels[i];
pnl.SetStatus(pnl.defaultStatusText);
pwUpdateProgressPanelDirect(pnl,0,0,"0:0:0","0:0:0");
pnl.ClearFileBars();
pnl.ProgFilePrototypeContainer.style.display="";
}
}
function pwUpdateProgressPanel(pwPanelId,pwSpeed,pwTotBytes,pwEl,pwRem)
{
var pwProgPnl=pwGetProgPanel(pwPanelId);
if(pwProgPnl)pwUpdateProgressPanelDirect(pwProgPnl,pwSpeed,pwTotBytes,pwEl,pwRem);
}
function pwUpdateProgressPanelDirect(pwPanel,pwSpeed,pwTotBytes,pwEl,pwRem)
{
if(pwPanel){
var spwEl=new Array();
spwEl=pwEl.split(":");
var spwRm=new Array();
spwRm=pwRem.split(":");
pwPanel.SetSpeed(pwSpeed);
pwPanel.SetBytes(pwTotBytes);
pwPanel.SetElapsed(spwEl[0],spwEl[1],spwEl[2]);
pwPanel.SetRemaining(spwRm[0],spwRm[1],spwRm[2]);
pwPanel.SetCancelButton(true);
}
}
function pwUpdateFileProgress(pwPanelId,pwFileId,pwProgbarText,pwFilePct)
{
var pwProgPnl=pwGetProgPanel(pwPanelId);
var pwFileProg;
var pwFileProgText;
if(pwProgPnl)
{
pwFileProg=document.getElementById(pwPanelId+"_ProgFile_"+pwFileId);
if(!pwFileProg){
pwProgPnl.AppendFileBar(pwFileId,pwProgbarText);
pwProgPnl.ProgFilePrototypeContainer.style.display="none";
}
pwFileProg=document.getElementById(pwPanelId+"_ProgFile_"+pwFileId);
pwFileProgText=document.getElementById(pwPanelId+"_ProgFile_"+pwFileId+"_Text");
if(pwFileProgText)pwFileProgText.innerHTML=pwProgbarText;
if(pwFileProg)pwFileProg.style.width=pwFilePct+"%";
if(pwFilePct==100){
pwOpenProgressPanel(pwPanelId,0);
}
pwProgPnl.HideClose();
}
}
function pwSetProgressStatus(pwPanelId,pwStatusText)
{
var pwProgPnl=pwGetProgPanel(pwPanelId);
if(pwProgPnl)pwProgPnl.SetStatus(pwStatusText);
}
function pwCloseProgressPanel(pwPanelId,delay){
var pwProgPnl=pwGetProgPanel(pwPanelId);
if(pwProgPnl)
{
if(!delay)delay=0;
setTimeout("pwDoCloseProgressPanel('"+pwProgPnl.ID+"')",delay);
}
}
function pwDoCloseProgressPanel(pwPanelId){
var pwProgPnl=pwGetProgPanel(pwPanelId);
if(pwProgPnl)
{
pwProgPnl.ClearFileBars();
document.getElementById(pwProgPnl.ID).style.display='none';
}
}
function pwOpenProgressPanel(pwPanelId,delay){
var pwProgPnl=pwGetProgPanel(pwPanelId);
if(pwProgPnl)
{
pwProgPnl.HideClose();
if(!delay)delay=0;
setTimeout("document.getElementById('"+pwProgPnl.ID+"').style.display = 'block'",delay);
}
}
function pwProgressSetAllComplete(){
for(var i=0;i<pwProgressPanels.length;i++){
pwProgressPanels[i].SetCancelButton(false);
pwProgressPanels[i].ShowClose()
}
pwClearTotals();
}
function pwProgressSetComplete()
{
for(i=0;i<pwProgressPanels.length;i++)
{
pwProgressPanels[i].SetCancelButton(false);
pwProgressPanels[i].ShowClose()
}
}
function pwProgressSetCancelled(pwPanelId)
{
var pwProgPnl=pwGetProgPanel(pwPanelId);
if(pwProgPnl){
pwProgPnl.SetCancelButton(false);
pwProgPnl.ShowClose();
}
}
function pwProgressSetCount(){
for(var i=0;i<pwProgressPanels.length;i++){
pwProgressPanels[i].SetCount(uploadManager.completedFiles-uploadManager.failedFiles);
}
}
function pwBroadcastStatus(msg){
for(var i=0;i<pwProgressPanels.length;i++){
pwProgressPanels[i].SetStatus(msg);
}
}
function pwClearFileBars(){
for(var i=0;i<pwProgressPanels.length;i++){
pwProgressPanels[i].ClearFileBars();
}
}
function pwTotalFiles(){
var tot=0;
for(var i=0;i<pwUploads.length;i++){
tot+=pwUploads[i].filecount;
}
return tot;
}
function pwClearTotals(){
for(var i=0;i<pwUploads.length;i++){
pwUploads[i].reset();
}
}
function pwCanSubmit(){
if(uploadManager==null||uploadManager.isPolling||pwUploads.length<=0)return false;
for(var i=0;i<pwUploads.length;i++){
if((pwIsFlash()&&(pwUploads[i].textbox&&pwUploads[i].textbox.value!="")||(pwUploads[i].selectedFiles!=""))||
(pwUploads[i].uploadCtl&&pwUploads[i].uploadCtl.value!=""))
{
return true;
}
}
return false;
}
