function FM (defaultpath)
{
	this.defaultpath = defaultpath;
};

FM.prototype.fileBrowserCallBack = function(field_name, url, type, win)
{
	this.field = field_name;
	this.callerWindow = win;

	if (url == '')
	{
		url = this.defaultpath;
	}

	var path = "/admin/wysiwyg/fm/fm.php?field_name=" + field_name + "&cdir=" + url + "&type=" + type;

	var width = 700;
	var height = 500;

	var x = parseInt(screen.width / 2.0) - (width / 2.0);
	var y = parseInt(screen.height / 2.0) - (height / 2.0);

	var win = window.open(path, "FM", "top=" + y + ",left=" + x + ",scrollbars=yes,width=" + width + ",height=" + height + ",resizable=yes");
}

FM.prototype.insertFile = function(url)
{
	var url;

	this.callerWindow.document.forms[0].elements[this.field].value = url;

	try
	{
		this.callerWindow.document.forms[0].elements[this.field].onchange();
	}
	catch (e)
	{
	}
};