
if (typeof wzs == "undefined") {
	wzs = {};
}

wzs.SWFHandler = function() {}

wzs.SWFHandler.prototype.titleimg = "";
wzs.SWFHandler.prototype.imgcnt = 0;
wzs.SWFHandler.prototype.images = new Array();
wzs.SWFHandler.prototype.uploadurl = "";
wzs.SWFHandler.prototype.uploadwidth = "";
wzs.SWFHandler.prototype.uploadheight = "";
wzs.SWFHandler.prototype.uploadwidth2 = "";
wzs.SWFHandler.prototype.uploadheight2 = "";
wzs.SWFHandler.prototype.uploadwidth3 = "";
wzs.SWFHandler.prototype.uploadheight3 = "";

wzs.SWFHandler.prototype.titleimg_default = "/templates/gogomel/images/noimage.gif";
wzs.SWFHandler.prototype.images_max = 4;
wzs.SWFHandler.prototype.imgTitleDeleteEnable = false;
wzs.SWFHandler.prototype.divTitleImage = "titleImage";
wzs.SWFHandler.prototype.divThumbnails = "thumbnails";
wzs.SWFHandler.prototype.btnImages = "btnImages";
wzs.SWFHandler.prototype.btnDelTitle = "btnDelTitle";
wzs.SWFHandler.prototype.btnDelete = "btnDelete";
wzs.SWFHandler.prototype.divFileProgressContainer = "divFileProgressContainer";

wzs.SWFHandler.prototype.init = function(uploadurl,uploadwidth,uploadheight,uploadwidth2,uploadheight2,uploadwidth3,uploadheight3, imgDeleteEnable) {

	this.titleimg = "";
	this.imgcnt = 0;

	for(i=0; i<this.images_max; i++) {
		this.images[i] = "";
	}

	this.uploadurl = uploadurl;
	this.uploadwidth = uploadwidth;
	this.uploadheight = uploadheight;
	this.uploadwidth2 = uploadwidth2;
	this.uploadheight2 = uploadheight2;
	this.uploadwidth3 = uploadwidth3;
	this.uploadheight3 = uploadheight3;
	this.imgTitleDeleteEnable = imgDeleteEnable;
}

wzs.SWFHandler.prototype.getImage = function(index) {
	return this.images[index];
}

wzs.SWFHandler.prototype.setImage = function(index, imgname) {
	this.images[index] = imgname;
}

wzs.SWFHandler.prototype.setTitleImage = function(imgname) {
	this.titleimg = imgname;
}

wzs.SWFHandler.prototype.setTitleImageDefault = function(imgname) {
	this.titleimg_default = imgname;
}

wzs.SWFHandler.prototype.addExtraImage = function(imgname) {
	this.images[this.imgcnt] = imgname;
	this.imgcnt++;
}

wzs.SWFHandler.prototype.deleteTitleImage = function() {

       if (confirm("タイトルのイメージを削除します。\nよろしいですか?")) {

		this.titleimg = "";

		document.getElementById(this.btnDelTitle).disabled = true;
		document.getElementById(this.divTitleImage).innerHTML = "<img src=\"" + this.titleimg_default + "\" width=\"" + this.uploadwidth2 + "\" height=\"" + this.uploadheight2 + "\" alt=\"\" />";
       }

}

wzs.SWFHandler.prototype.deleteTitleImage2 = function() {

       if (confirm("タイトルのイメージを削除します。\nよろしいですか?")) {

		this.titleimg = this.titleimg_default;

		document.getElementById(this.btnDelTitle).disabled = true;
		document.getElementById(this.divTitleImage).innerHTML = "<img src=\"" + this.uploadurl + "/" + this.titleimg_default + "\" width=\"" + this.uploadwidth2 + "\" height=\"" + this.uploadheight2 + "\" alt=\"\" />";
       }

}

wzs.SWFHandler.prototype.deleteImage = function() {

       if (confirm("最後のイメージを削除します。\nよろしいですか?")) {

		if (this.imgcnt > 0) {
			this.images[this.imgcnt] = "";
			this.imgcnt--;
		}

		if (wzs.swfu3 != undefined) { wzs.swfu3.setButtonDisabled(false); }
		if (this.imgcnt == 0) {
			document.getElementById(this.btnDelete).disabled = true;
		}

		document.getElementById(this.divThumbnails).innerHTML = "";

		for (i=0; i<this.imgcnt; i++) {
			document.getElementById(this.divThumbnails).innerHTML += "<img src=\"" + this.uploadurl + "/" + this.images[i] + "\" width=\"" + this.uploadwidth3 + "\" height=\"" + this.uploadheight3 + "\" alt=\"\" />";
		}
       }

}


/* **********************
   Event Handlers
   ********************** */
wzs.SWFHandler.State = function() {}
wzs.SWFHandler.State.fileDialogStart = function() {
	/* I don't need to do anything here */
}

wzs.SWFHandler.State.fileQueued = function(file) {
	try {
		var progress = new wzs.SWFHandler.FileProgress(file, this.customSettings.progressTarget);
		progress.setStatus("Pending...");
		progress.toggleCancel(true, this);
	} catch (ex) { this.debug(ex); }
}

wzs.SWFHandler.State.fileQueueError = function(file, errorCode, message) {
	try {
		if (errorCode === SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED) {
			alert("You have attempted to queue too many files.\n" + (message === 0 ? "You have reached the upload limit." : "You may select " + (message > 1 ? "up to " + message + " files." : "one file.")));
			return;
		}

		var progress = new wzs.SWFHandler.FileProgress(file, this.customSettings.progressTarget);
		progress.setError();
		progress.toggleCancel(false);

		switch (errorCode) {
		case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:
			progress.setStatus("File is too big.");
			this.debug("Error Code: File too big, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
			break;
		case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:
			progress.setStatus("Cannot upload Zero Byte files.");
			this.debug("Error Code: Zero byte file, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
			break;
		case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:
			progress.setStatus("Invalid File Type.");
			this.debug("Error Code: Invalid File Type, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
			break;
		case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED:
			alert("You have selected too many files.  " +  (message > 1 ? "You may only add " +  message + " more files" : "You cannot add any more files."));
			break;
		default:
			if (file !== null) {
				progress.setStatus("Unhandled Error");
			}
			this.debug("Error Code: " + errorCode + ", File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
			break;
		}
	} catch (ex) { this.debug(ex); }
}

wzs.SWFHandler.State.fileDialogComplete = function(numFilesSelected, numFilesQueued) {
	try {
		if (this.getStats().files_queued > 0) {
			document.getElementById(this.customSettings.cancelButtonId).disabled = false;
		}
		
		/* I want auto start the upload and I can do that here */
		this.startUpload();
	} catch (ex) { this.debug(ex); }
}

wzs.SWFHandler.State.uploadStart = function(file) {
	try {
		/* I don't want to do any file validation or anything,  I'll just update the UI and
		return true to indicate that the upload should start.
		It's important to update the UI here because in Linux no uploadProgress events are called. The best
		we can do is say we are uploading.
		 */
		var progress = new wzs.SWFHandler.FileProgress(file, this.customSettings.progressTarget);
		progress.setStatus("Uploading...");
		progress.toggleCancel(true, this);
	}
	catch (ex) {}
	
	return true;
}

wzs.SWFHandler.State.uploadProgress = function(file, bytesLoaded, bytesTotal) {
	try {
		var percent = Math.ceil((bytesLoaded / bytesTotal) * 100);

		var progress = new wzs.SWFHandler.FileProgress(file, this.customSettings.progressTarget);
		progress.setProgress(percent);
		if (percent === 100) {
			progress.SetStatus("Resizing Image.....");
			progress.ToggleCancel(false);
		} else {
			progress.SetStatus("Uploading... " + percent + "%");
			progress.ToggleCancel(true, this);
		}
	} catch (ex) { this.debug(ex); }
}

wzs.SWFHandler.State.uploadSuccess = function(file, serverData) {
	var response = Ext.util.JSON.decode(serverData);
	try {
		var progress = new wzs.SWFHandler.FileProgress(file, this.customSettings.progressTarget);
		progress.setComplete();
		progress.setStatus("Complete.");
		progress.toggleCancel(false);
		if (wzs.ckeditor) {
			wzs.ckeditor.insertHtml("<img src=\"" + response.url + "/" + response.filename + "\" width=\"" + response.width + "\" height=\"" + response.height + "\" alt=\"\" />");
		}
	} catch (ex) { this.debug(ex); }
}

wzs.SWFHandler.State.uploadSuccess2 = function(file, serverData) {
	var response = Ext.util.JSON.decode(serverData);
	try {
		var progress = new wzs.SWFHandler.FileProgress(file, this.customSettings.progressTarget);
		progress.setComplete();
		progress.setStatus("Complete.");
		progress.toggleCancel(false);
		wzs.swfHandler.setTitleImage(response.filename);
		if (wzs.swfHandler.imgTitleDeleteEnable) {
			document.getElementById(wzs.swfHandler.btnDelTitle).disabled = false;
		}
		document.getElementById(wzs.swfHandler.divTitleImage).innerHTML = "<img src=\"" + wzs.swfHandler.uploadurl + "/" + response.filename + "\" width=\"" + wzs.swfHandler.uploadwidth2 + "\" height=\"" + wzs.swfHandler.uploadheight2 + "\" alt=\"\" />";
		if (!wzs.swfHandler.imgTitleDeleteEnable) {
			document.getElementById(wzs.swfHandler.divTitleImage).innerHTML += "<input type= \"hidden\" name=\"blog_title_image\" value=\"" + response.filename + "\" />";
		}
	} catch (ex) { this.debug(ex); }
}

wzs.SWFHandler.State.uploadSuccess3 = function(file, serverData) {
	var response = Ext.util.JSON.decode(serverData);
	try {
		var progress = new wzs.SWFHandler.FileProgress(file, this.customSettings.progressTarget);
		progress.setComplete();
		progress.setStatus("Complete.");
		progress.toggleCancel(false);
		if (wzs.swfHandler.imgcnt < wzs.swfHandler.images_max) {
			wzs.swfHandler.setImage(wzs.swfHandler.imgcnt, response.filename);
			wzs.swfHandler.imgcnt++;

			if (wzs.swfHandler.imgcnt == wzs.swfHandler.images_max)
				if (wzs.swfu3 != undefined) { wzs.swfu3.setButtonDisabled(true); }
			document.getElementById(wzs.swfHandler.btnDelete).disabled = false;
		}

		document.getElementById(wzs.swfHandler.divThumbnails).innerHTML = "";

		for (i=0; i<wzs.swfHandler.imgcnt; i++) {
			document.getElementById(wzs.swfHandler.divThumbnails).innerHTML += "<img src=\"" + wzs.swfHandler.uploadurl + "/" + wzs.swfHandler.images[i] + "\" width=\"" + wzs.swfHandler.uploadwidth3 + "\" height=\"" + wzs.swfHandler.uploadheight3 + "\" alt=\"\" />";
		}
	} catch (ex) { this.debug(ex); }
}

wzs.SWFHandler.State.uploadError = function(file, errorCode, message) {
	try {
		var progress = new wzs.SWFHandler.FileProgress(file, this.customSettings.progressTarget);
		progress.setError();
		progress.toggleCancel(false);

		switch (errorCode) {
		case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:
			progress.setStatus("Upload Error: " + message);
			this.debug("Error Code: HTTP Error, File name: " + file.name + ", Message: " + message);
			break;
		case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:
			progress.setStatus("Upload Failed.");
			this.debug("Error Code: Upload Failed, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
			break;
		case SWFUpload.UPLOAD_ERROR.IO_ERROR:
			progress.setStatus("Server (IO) Error");
			this.debug("Error Code: IO Error, File name: " + file.name + ", Message: " + message);
			break;
		case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:
			progress.setStatus("Security Error");
			this.debug("Error Code: Security Error, File name: " + file.name + ", Message: " + message);
			break;
		case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:
			progress.setStatus("Upload limit exceeded.");
			this.debug("Error Code: Upload Limit Exceeded, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
			break;
		case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:
			progress.setStatus("Failed Validation.  Upload skipped.");
			this.debug("Error Code: File Validation Failed, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
			break;
		case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:
			// If there aren't any files left (they were all cancelled) disable the cancel button
			if (this.getStats().files_queued === 0) {
				document.getElementById(this.customSettings.cancelButtonId).disabled = true;
			}
			progress.setStatus("Cancelled");
			progress.setCancelled();
			break;
		case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:
			progress.setStatus("Stopped");
			break;
		default:
			progress.setStatus("Unhandled Error: " + errorCode);
			this.debug("Error Code: " + errorCode + ", File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
			break;
		}
	} catch (ex) { this.debug(ex); }
}

wzs.SWFHandler.State.uploadComplete = function(file) {
	try {
		if (this.getStats().files_queued > 0) {
			this.startUpload();
		} else {
			// document.getElementById(this.customSettings.cancelButtonId).disabled = true;
			document.getElementById(this.customSettings.progressTarget).innerHTML = "";
			wzs_win.hide();
			if (wzs.swfu != undefined) { wzs.swfu.setButtonDimensions(160,22); }
			if (wzs.swfu2 != undefined) { wzs.swfu2.setButtonDimensions(160,22); }
			if (wzs.swfu3 != undefined) { wzs.swfu3.setButtonDimensions(160,22); }
		}
	} catch (ex) { this.debug(ex); }
}

// This event comes from the Queue Plugin
wzs.SWFHandler.State.queueComplete = function(numFilesUploaded) {
	var status = document.getElementById("divStatus");
	status.innerHTML = numFilesUploaded + " file" + (numFilesUploaded === 1 ? "" : "s") + " uploaded.";
}



/* ******************************************
 *	FileProgress Object
 * ****************************************** */
wzs.SWFHandler.FileProgress = function(file, targetID) {
	this.fileProgressID = file.id;

	this.opacity = 100;
	this.height = 0;

	if (wzs.swfu != undefined) { wzs.swfu.setButtonDimensions(1,1); }
	if (wzs.swfu2 != undefined) { wzs.swfu2.setButtonDimensions(1,1); }
	if (wzs.swfu3 != undefined) { wzs.swfu3.setButtonDimensions(1,1); }
	wzs_win.show();
	this.fileProgressWrapper = document.getElementById(this.fileProgressID);
	if (!this.fileProgressWrapper) {
		this.fileProgressWrapper = document.createElement("div");
		this.fileProgressWrapper.className = "progressWrapper";
		this.fileProgressWrapper.id = this.fileProgressID;

		this.fileProgressElement = document.createElement("div");
		this.fileProgressElement.className = "progressContainer";

		var progressCancel = document.createElement("a");
		progressCancel.className = "progressCancel";
		progressCancel.href = "#";
		progressCancel.style.visibility = "hidden";
		progressCancel.appendChild(document.createTextNode(" "));

		var progressText = document.createElement("div");
		progressText.className = "progressName";
		progressText.appendChild(document.createTextNode(file.name));

		var progressBar = document.createElement("div");
		progressBar.className = "progressBarInProgress";

		var progressStatus = document.createElement("div");
		progressStatus.className = "progressBarStatus";
		progressStatus.innerHTML = "&nbsp;";

		this.fileProgressElement.appendChild(progressCancel);
		this.fileProgressElement.appendChild(progressText);
		this.fileProgressElement.appendChild(progressStatus);
		this.fileProgressElement.appendChild(progressBar);

		this.fileProgressWrapper.appendChild(this.fileProgressElement);

		document.getElementById(targetID).appendChild(this.fileProgressWrapper);
	} else {
		this.fileProgressElement = this.fileProgressWrapper.firstChild;
	}

	this.height = this.fileProgressWrapper.offsetHeight;

}
wzs.SWFHandler.FileProgress.prototype.setProgress = function (percentage) {
	this.fileProgressElement.className = "progressContainer green";
	this.fileProgressElement.childNodes[3].className = "progressBarInProgress";
	this.fileProgressElement.childNodes[3].style.width = percentage + "%";
};
wzs.SWFHandler.FileProgress.prototype.setComplete = function () {
	this.fileProgressElement.className = "progressContainer blue";
	this.fileProgressElement.childNodes[3].className = "progressBarComplete";
	this.fileProgressElement.childNodes[3].style.width = "";
};
wzs.SWFHandler.FileProgress.prototype.setError = function () {
	this.fileProgressElement.className = "progressContainer red";
	this.fileProgressElement.childNodes[3].className = "progressBarError";
	this.fileProgressElement.childNodes[3].style.width = "";
};
wzs.SWFHandler.FileProgress.prototype.setCancelled = function () {
	this.fileProgressElement.className = "progressContainer";
	this.fileProgressElement.childNodes[3].className = "progressBarError";
	this.fileProgressElement.childNodes[3].style.width = "";
};
wzs.SWFHandler.FileProgress.prototype.setStatus = function (status) {
	this.fileProgressElement.childNodes[2].innerHTML = status;
};

// Show/Hide the cancel button
wzs.SWFHandler.FileProgress.prototype.toggleCancel = function (show, swfUploadInstance) {
	this.fileProgressElement.childNodes[0].style.visibility = show ? "visible" : "hidden";
	if (swfUploadInstance) {
		var fileID = this.fileProgressID;
		this.fileProgressElement.childNodes[0].onclick = function () {
			swfUploadInstance.cancelUpload(fileID);
			return false;
		};
	}
};

// Fades out and clips away the FileProgress box.
wzs.SWFHandler.FileProgress.prototype.disappear = function () {

	var reduceOpacityBy = 15;
	var reduceHeightBy = 4;
	var rate = 30;	// 15 fps

	if (this.opacity > 0) {
		this.opacity -= reduceOpacityBy;
		if (this.opacity < 0) {
			this.opacity = 0;
		}

		if (this.fileProgressWrapper.filters) {
			try {
				this.fileProgressWrapper.filters.item("DXImageTransform.Microsoft.Alpha").opacity = this.opacity;
			} catch (e) {
				// If it is not set initially, the browser will throw an error.  This will set it if it is not set yet.
				this.fileProgressWrapper.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=" + this.opacity + ")";
			}
		} else {
			this.fileProgressWrapper.style.opacity = this.opacity / 100;
		}
	}

	if (this.height > 0) {
		this.height -= reduceHeightBy;
		if (this.height < 0) {
			this.height = 0;
		}

		this.fileProgressWrapper.style.height = this.height + "px";
	}

	if (this.height > 0 || this.opacity > 0) {
		var oSelf = this;
		setTimeout(function () {
			oSelf.disappear();
		}, rate);
	} else {
		this.fileProgressWrapper.style.display = "none";
	}
};
wzs.swfHandler = new wzs.SWFHandler();
var wzs_win;

Ext.onReady(function() {

	if(!wzs_win){
		wzs_win = new Ext.Window({
			el:'progress_win',
			layout:'fit',
			width:420,
			height:200,
			closeAction:'hide',
			modal:true,
 			items: new Ext.Panel({
				contentEl : 'progress_panel'
			})
		});
	}

	if (document.getElementById("spanButtonPlaceHolder")) {
		wzs.swfu = new SWFUpload({
			flash_url : "/tools/swfupload/swfupload.swf",
			upload_url: "/tools/php/swfupload/swfupload.php?width=" + wzs.swfHandler.uploadwidth + "&height=" + wzs.swfHandler.uploadheight + "&filledrectangel=0&uploadurl=" + wzs.swfHandler.uploadurl,	// Relative to the SWF file
			file_size_limit : "512 KB",
			file_types : "*.jpg;*.png;*.gif",
			file_types_description : "Image Files",
			file_upload_limit : "0",
			file_queue_limit : "1",
			custom_settings : {
				progressTarget : wzs.swfHandler.divFileProgressContainer,
				cancelButtonId : "btnCancel"
			},
			debug: false,

			// Button settings
			button_image_url: "/templates/gogomel/images/XPButtonNoText_160x22.png",
			button_width: "160",
			button_height: "22",
			button_placeholder_id: "spanButtonPlaceHolder",
			button_text: '画像貼付  (500 KB Max)',
			button_text_style: ".theFont { font-size:13px; }",
			button_text_left_padding: 17,
			button_text_top_padding: 1,

			file_queued_handler : wzs.SWFHandler.State.fileQueued,
			file_queue_error_handler : wzs.SWFHandler.State.fileQueueError,
			file_dialog_complete_handler : wzs.SWFHandler.State.fileDialogComplete,
			upload_start_handler : wzs.SWFHandler.State.uploadStart,
			upload_progress_handler : wzs.SWFHandler.State.uploadProgress,
			upload_error_handler : wzs.SWFHandler.State.uploadError,
			upload_success_handler : wzs.SWFHandler.State.uploadSuccess,
			upload_complete_handler : wzs.SWFHandler.State.uploadComplete,
			queue_complete_handler : wzs.SWFHandler.State.queueComplete	// Queue plugin event
		});
	}

	if (document.getElementById("spanButtonPlaceHolder2")) {
		wzs.swfu2 = new SWFUpload({
			flash_url : "/tools/swfupload/swfupload.swf",
			upload_url: "/tools/php/swfupload/swfupload.php?width=" + wzs.swfHandler.uploadwidth + "&height=" + wzs.swfHandler.uploadheight + "&filledrectangel=0&uploadurl=" + wzs.swfHandler.uploadurl,	// Relative to the SWF file
			file_size_limit : "512 KB",
			file_types : "*.jpg;*.png;*.gif",
			file_types_description : "Image Files",
			file_upload_limit : "0",
			file_queue_limit : "1",
			custom_settings : {
				progressTarget : wzs.swfHandler.divFileProgressContainer,
				cancelButtonId : "btnCancel2"
			},
			debug: false,

			// Button settings
			button_image_url: "/templates/gogomel/images/XPButtonNoText_160x22.png",
			button_width: "160",
			button_height: "22",
			button_placeholder_id: "spanButtonPlaceHolder2",
			button_text: '画像変更  (500 KB Max)',
			button_text_style: ".theFont { font-size:13px; }",
			button_text_left_padding: 7,
			button_text_top_padding: 1,

			file_queued_handler : wzs.SWFHandler.State.fileQueued,
			file_queue_error_handler : wzs.SWFHandler.State.fileQueueError,
			file_dialog_complete_handler : wzs.SWFHandler.State.fileDialogComplete,
			upload_start_handler : wzs.SWFHandler.State.uploadStart,
			upload_progress_handler : wzs.SWFHandler.State.uploadProgress,
			upload_error_handler : wzs.SWFHandler.State.uploadError,
			upload_success_handler : wzs.SWFHandler.State.uploadSuccess2,
			upload_complete_handler : wzs.SWFHandler.State.uploadComplete,
			queue_complete_handler : wzs.SWFHandler.State.queueComplete	// Queue plugin event
		});
	}

	if (document.getElementById("spanButtonPlaceHolder3")) {
		wzs.swfu3 = new SWFUpload({
			flash_url : "/tools/swfupload/swfupload.swf",
			upload_url: "/tools/php/swfupload/swfupload.php?width=" + wzs.swfHandler.uploadwidth + "&height=" + wzs.swfHandler.uploadheight + "&filledrectangel=0&uploadurl=" + wzs.swfHandler.uploadurl,	// Relative to the SWF file
			file_size_limit : "512 KB",
			file_types : "*.jpg;*.png;*.gif",
			file_types_description : "Image Files",
			file_upload_limit : "0",
			file_queue_limit : "1",
			custom_settings : {
				progressTarget : wzs.swfHandler.divFileProgressContainer,
				cancelButtonId : "btnCancel3"
			},
			debug: false,

			// Button settings
			button_image_url: "/templates/gogomel/images/XPButtonNoText_160x22.png",
			button_width: "160",
			button_height: "22",
			button_placeholder_id: "spanButtonPlaceHolder3",
			button_text: '画像追加  (500 KB Max)',
			button_text_style: ".theFont { font-size:13px; }",
			button_text_left_padding: 7,
			button_text_top_padding: 1,

			file_queued_handler : wzs.SWFHandler.State.fileQueued,
			file_queue_error_handler : wzs.SWFHandler.State.fileQueueError,
			file_dialog_complete_handler : wzs.SWFHandler.State.fileDialogComplete,
			upload_start_handler : wzs.SWFHandler.State.uploadStart,
			upload_progress_handler : wzs.SWFHandler.State.uploadProgress,
			upload_error_handler : wzs.SWFHandler.State.uploadError,
			upload_success_handler : wzs.SWFHandler.State.uploadSuccess3,
			upload_complete_handler : wzs.SWFHandler.State.uploadComplete,
			queue_complete_handler : wzs.SWFHandler.State.queueComplete	// Queue plugin event
		});
	}

} );


