function fileDialogComplete(numFilesSelected, numFilesQueued) {     //选择上传开始事件,关闭对话框
    try {
        if (numFilesQueued > 0) {
            $("#divstatebg").css("width", "0px");
            $("#divstatebg").show();
            $("#divstatehtml").show();
            $("#divstatehtml").html("正在上传 <span id='swfS1' >0</span>/<span>" + (Number(this.getStats().files_queued) + Number(this.getStats().successful_uploads)) + "</span>,<span id='swfS2' >0.00</span>%");
            this.startUpload();
        }
    } catch (ex) {

    }
}

function uploadStart(file) {      //文件开始上传事件
    
}

function uploadProgress(file, bytesLoaded) {  //文件上传实时进度事件
    try {
        var percent = parseFloat(Math.ceil((bytesLoaded / file.size) * 100)).toFixed(2);
        if (percent >= 100)
            percent = 100.00;
        $("#swfS1").html((Number(this.getStats().successful_uploads)));
        $("#swfS2").html(Number(percent));
        $("#divstatebg").css("width", 2 * percent + "px");
    } catch (ex) {}
}

function uploadSuccess(file, serverData) {    //单个文件上传成功返回事件
    try {
        var id = QueryString("id");
        if (thumbs == true) {
            $("#" + id, window.parent.document).val($("#" + id, window.parent.document).val() + serverData + ",");
            window.parent.CmsData.UpFiles.ShowImages(id, serverData);
        } else {
            $("#" + id, window.parent.document).val(serverData);
            window.parent.CmsData.UpFiles.ShowImage(id, serverData);
        }
    } catch (ex) {}
}

function uploadComplete(file) {     //当前上传结束事件
    try {
        if (this.getStats().files_queued > 0)
            this.startUpload();
        else {
            $("#swfS1").html((Number(this.getStats().successful_uploads)));
            $("#divstatehtml").show().fadeOut(5000);
            $("#divstatebg").show().fadeOut(5000);
        }
    } catch (ex) {}
}

function uploadError(file, errorCode, message) {  //上传出错 返回中止上传
    try {
        switch (errorCode) {
            case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:
                break;
            case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:
                break;
            case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:
                break;
            default:
                alert("上传出错啦!");
                break;
        }
    } catch (ex) {

    }
}

function Init() {
    
}

function QueryString(name) {    //获取url请求地址
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
    var r = window.location.search.substr(1).match(reg);
    if (r != null) return unescape(r[2]); return "";
}