function SWFUpload2(Settings) {
    var button_text = "";
    switch (Settings.post_params.FilesType) {
    case "images":
        button_text = '<span class="theFont">图片上传</span>';
        break;
    case "files":
        button_text = '<span class="theFont">附件上传</span>';
        break;
    }
    var settings = {
        flash_url: "swfupload/swfupload/swfupload.swf",
        post_params: Settings.post_params,
        upload_url: "upload.aspx",
        file_size_limit: Settings.file_size_limit,
        file_types: Settings.file_types,
        file_types_description: Settings.file_types_description,
        file_upload_limit: 5,
        file_queue_limit: 0,
        Id: Settings.Id,
        Value: Settings.Value,
        View: Settings.View,
        fg_fileSizes: 0,
        fg_uploads: 0,
        custom_settings: {

            progressTarget: Settings.progressTarget,
            progressGroupTarget: Settings.progressGroupTarget,

            //progress object
            container_css: "progressobj",
            icoNormal_css: "IcoNormal",
            icoWaiting_css: "IcoWaiting",
            icoUpload_css: "IcoUpload",
            fname_css: "fle ftt",
            state_div_css: "statebarSmallDiv",
            state_bar_css: "statebar",
            percent_css: "ftt",
            href_delete_css: "ftt",

            //sum object
            s_cnt_progress: "cnt_progress_" + Settings.Id,
            s_cnt_span_text: "fle",
            s_cnt_progress_statebar: "cnt_progress_statebar_" + Settings.Id,
            s_cnt_progress_percent: "cnt_progress_percent_" + Settings.Id,
            s_cnt_progress_uploaded: "cnt_progress_uploaded_" + Settings.Id,
            s_cnt_progress_size: "cnt_progress_size_" + Settings.Id
        },
        debug: false,

        // Button settings
        button_image_url: "swfupload/images/65x29.gif",
        button_width: "65",
        button_height: "22",
        button_placeholder_id: Settings.button_placeholder_id,
        button_text: button_text,
        button_text_style: ".theFont { font-size: 12;color:#0068B7; }",
        button_text_left_padding: 5,
        button_text_top_padding: 0,

        // The event handler functions are defined in handlers.js
        file_queued_handler: fileQueued,
        file_queue_error_handler: fileQueueError,
        upload_start_handler: uploadStart,
        upload_progress_handler: uploadProgress,
        upload_error_handler: uploadError,
        upload_success_handler: uploadSuccess,
        upload_complete_handler: uploadComplete,
        file_dialog_complete_handler: fileDialogComplete,
        file_dialog_start_handler: fileDialogStart
    };
    var swfu = new SWFUpload(settings);
}
function onUploadSuccess(settings, e) {
    var path = e.split("?")[0];
    var ViewHTML = "";
    switch (settings.post_params.FilesType) {
    case "images":
        var html = "";
        html += "<div style=\"float:left; padding:2px; border:1px #cccccc dashed; margin:2px; width:100px; height:120px;\">";
        html += "  <div style=\"width:100px; height:100px;\"><a href='../" + path.split('|')[1] + "' target='_blank'><img src=\"../" + path.split('|')[0] + "\" style=\"border-width:0px;\"></a></div>";
        html += "  <div style=\"width:100px; height:20px;text-align:center\"><img src=\"images/delete.png\" style=\"border-width:0px;\" onclick=\"fileRemove(this,'" + settings.Value + "','" + path.split('|') + "')\"></div>";
        html += "</div>";
        ViewHTML += html;
        break;
    case "files":
        var FilePath = path.split('|')[0];
        var FileName = FilePath.substring(FilePath.lastIndexOf("/") + 1);
        var html = "";
        html += "<div style=\"float:left; padding:2px; border:1px #cccccc dashed; margin:2px; width:98%; height:20px;\">";
        html += "  <div style=\"width:100%; height:20px;\"><img style='border-width:0px;' src='images/attach.png'><a href='../" + path.split('|')[0] + "' target='_blank'><font color=green>" + FileName + "</font></a>&nbsp;<img src=\"images/delete.png\" style=\"border-width:0px;vertical-align:bottom\" onclick=\"fileRemove(this,'" + settings.Value + "','" + path.split('|') + "')\"></div>";
        html += "</div>";
        ViewHTML += html;
        break;
    }
    uiGet(settings.Value).value += path + ";";
    uiGet(settings.View).innerHTML += ViewHTML;
}
function fileRemove(obj, objName, objValue) {
    var flag = window.confirm("您确认要移出所选记录吗？");
    if (flag) {
        var div = obj.parentElement.parentElement;
        if (div != null) {
            obj.parentElement.parentElement.parentElement.removeChild(div);;
        }
        var input = uiGet(objName).value;
        var result = input.replace(objValue, "");
        uiGet(objName).value = result;
    }
}