//Skryje neviditelne bloky
document.write('<style>.sel-hidden { display: none; }<' + '/style>');
/* 
 * Knihovna funkci a trid specifickych pro auteo
 */

//=== Changer ==================================================================
/**
 * AJAX zmena obsahu selectu ve vyhledavacich fomularich a konfiguratoru
 *
 * @copyright Copyright (c) 2009 Auteo.cz
 * @author Jindrich Samec <jindrich.samec@gmail.com>
 * @package Auteo.cz
 * @since 17.3.2010
 *
 * @license CREATIVE COMMONS PUBLIC LICENSE
 * @link http://creativecommons.org/licenses/by-sa/3.0/cz/legalcode
 *
 * @todo Nepodporuje vice formularu s vyberem parmettru na jedne strnce
 */
var Changer = function() {
	//nastveni URL pro AJAX
	this.AJAX_URL_MODELS_PAIRS = '/www/vehicle-tree/get-models-pairs/format/json/';
	this.AJAX_URL_PARENT_BODIES_PAIRS = '/www/vehicle-tree/get-vehicle-parent-bodies/format/json/';
	this.AJAX_URL_BODIES_PAIRS = '/www/vehicle-tree/get-vehicle-bodies/format/json/';
	this.AJAX_URL_ENGINE_TYPES_PAIRS = '/www/vehicle-tree/get-engine-types-pairs/format/json/';
	this.AJAX_URL_ENGINES_PAIRS = '/www/vehicle-tree/get-engines-pairs/format/json/';
	this.AJAX_URL_EDITIONS_PAIRS = '/www/vehicle-tree/get-editions-pairs/format/json/';
	this.AJAX_URL_TRANSMISSIONS_PAIRS = '/www/vehicle-tree/get-transmissions-pairs/format/json/';
}

Changer.prototype = {	
	/**
	 * Inicializace changeru - navesi udalosti na selecty
	 */
	init: function() {
		var _changer = this;

	//=== onChange marqueId
		$('select[name=marqueId]').live('change', function() {
			if($(this).val() == "") return;

			if($('select[name=modelId]').length > 0) {
				_changer._disableSelect('modelId');
				_changer.changeModel( $(this).val(), this);
			}			
			
			if($('select[name*=engineId]').length > 0) {
				_changer._disableSelect('engineId');
				_changer.changeEngine( $(this).val(), this);
			}
		});

	//=== onChange modelId
		$('select[name=modelId]').live('change', function() {
			if($(this).val() == "") return;
			
			if($('select[name=bodyId]').length > 0) {
				_changer._disableSelect('bodyId');
				_changer.changeBody( $(this).val(), this);
			}
			if($('select[name*=editionId]').length > 0) {
				_changer._disableSelect('editionId');
				_changer.changeEdition( $(this).val(), this);
			}
		});

	//=== onChange bodyId
		$('select[name=bodyId]').live('change', function() {
			if($(this).val() == "" || $('select[name=engineTypeId]').length == 0) return;

			_changer._disableSelect('engineTypeId');
			_changer.changeEngineType( $(this).parents('form').find('select[name=modelId]').val(), $(this).val(), this);
		});

	//=== onChange engineId
		$('select[name*=engineId]').live('change', function() {
			if($(this).val() == "" || $('select[name*=transmissionId]').length == 0) return;

			_changer._disableSelect('transmissionId');
			_changer.changeTransmission( $(this).val(), this);
		});
		
	//=== onChange engineTypeId
		$('select[name*=engineTypeId]').live('change', function() {
			if($(this).val() == "" || $('select[name*=engineId]').length == 0) return;

			_changer._disableSelect('engineId');
			_changer.changeEngine( $('select[name=marqueId]').val(), $(this).val(), this);
		});
	},

	/**
	 * Zmeni obsah HTML elementu select
	 *
	 * @param p_name
	 * @param p_json
	 */
	_changeSelect: function( p_name, p_json) {
		if(p_json != null && p_json.data) {
			var _pairs = p_json.data;
			var _selector = 'select[name*=' + p_name + ']';
			$( _selector).empty().append(
				$('<option></option>').val("").html("--vyberte z nabídky--")
			);
			for(var id in _pairs) {
				$( _selector).append(
					$('<option></option>').val(id).html(_pairs[id])
				);
			}
		}
		this._enableSelect(p_name);
		//V pripade jednoho zaznamu v selectu ho automaticky vyberu a nactu dalsi select
	},

	/**
	 * Deaktivuje SELECT pred vytvorenim ajax-requestu
	 *
	 * @param p_name Nazev SELECTu, ktery ma byt deaktivovat
	 */
	_disableSelect: function( p_name) {
		var _selector = 'select[name*=' + p_name + ']';
		$( _selector).empty().append(
			$('<option></option>').val("").html("\u010cekejte prosím...")
		);
		$(_selector).attr('disabled', 'disabled');
	},

	/**
	 * Aktivuje SELECT po uspesnem naplneni pomoci ajax-requestu
	 *
	 * @param p_name - Nazev selectu, ktery ma byt aktivovan
	 */
	_enableSelect: function ( p_name) {
		var _selector = 'select[name*=' + p_name + ']';
		$(_selector).removeAttr('disabled');

		if($(_selector).find('option').size() == 2) {
			$(_selector).find('option:last-child').attr('selected', 'selected');
			$(_selector).change();
		}
	},

	/**
	 * Reset selectu - vrati select do jeho defaultni podoby
	 *
	 * @param p_name - Nazev selectu
	 */
	_resetSelect: function (p_name) {
		var _selector = 'select[name*=' + p_name + ']';
		$( _selector).empty().append(
			$('<option></option>').val("").html("---")
		);
	},
	
	/**
	 * Zmeni obsah selectu s vyberem modelu podle predaneho ID znacky
	 *
	 * @param p_marqueId
	 */
	changeModel: function( p_marqueId, el) {
		var _changer = this;
		$.getJSON(this.AJAX_URL_MODELS_PAIRS, {marqueId: p_marqueId, checkPricelist: $(el).parents('form').find('input[name=auteocp]').size()}, function( json) {
			_changer._changeSelect('modelId', json)
		});
	},

	/**
	 * Zmeni obsah selectu s vyberem motoru podle predaneho ID znacky
	 *
	 * @param p_marqueId
	 * @param p_engineTypeId
	 */
	changeEngine: function( p_marqueId, p_engineTypeId, el) {
		var _changer = this;
		
		var params = {}		
		params['marqueId'] = parseInt(p_marqueId);
	
		if (typeof p_engineTypeId == 'HTMLElement') {
			el = p_engineTypeId;
		}
		else {
			params['engineTypeId'] = parseInt(p_engineTypeId);		
		}
		params['checkPricelist'] = $(el).parents('form').find('input[name=auteocp]').size() > 0;
	
		$.getJSON(this.AJAX_URL_ENGINES_PAIRS, params, function( json) {
			_changer._changeSelect('engineId', json);
		});
	},

	/**
	 * Zmeni obsah selectu s vyberem motoru podle predaneho ID znacky
	 *
	 * @param p_engineId
	 */
	changeTransmission: function( p_engineId, el) {
		var _changer = this;
		$.getJSON(this.AJAX_URL_TRANSMISSIONS_PAIRS, {engineId: p_engineId, checkPricelist: $(el).parents('form').find('input[name=auteocp]').size()}, function( json) {
			_changer._changeSelect('transmissionId', json);
		});
	},

	/**
	 * Zmeni obsah selectu s vyberem motoru podle predaneho ID znacky
	 *
	 * @param p_modelId
	 */
	changeEdition: function( p_modelId, el) {
		var _changer = this;
		$.getJSON(this.AJAX_URL_EDITIONS_PAIRS, {modelId: p_modelId, checkPricelist: $(el).parents('form').find('input[name=auteocp]').size()}, function( json) {
			_changer._changeSelect('editionId', json);
		});
	},

	/**
	 * Zmeni obsah selectu s vyberem modelu podle predaneho ID znacky
	 *
	 * @param p_modelId
	 */
	changeBody: function( p_modelId, el) {
		var _changer = this;
		$.getJSON(this.AJAX_URL_BODIES_PAIRS, {modelId: p_modelId, checkPricelist: $(el).parents('form').find('input[name=auteocp]').size()}, function( json) {
			_changer._changeSelect('bodyId', json);
		});
	},

	/**
	 * Zmeni obsah selectu s vyberem modelu podle predaneho ID znacky
	 *
	 * @param p_modelId
	 * @param p_bodyId
	 */
	changeEngineType: function( p_modelId, p_bodyId, el) {
		var _changer = this;
		$.getJSON(this.AJAX_URL_ENGINE_TYPES_PAIRS, {modelId: p_modelId, bodyId: p_bodyId, checkPricelist: $(el).parents('form').find('input[name=auteocp]').size()}, function( json) {
			_changer._changeSelect('engineTypeId', json)
		});
	}
}


//--- VehicleTree --------------------------------------------------------------
function VehicleTree( flag, parentElementId, clickListener) {

    if(flag != "" && flag != undefined) {
        this._flag = flag;
    }
    else {
        this._flag = "P";
    }
    this._parentElementId = parentElementId;
	this._clickListener = clickListener;

    this.init();
}

VehicleTree.prototype._parentElementId;
VehicleTree.prototype._lastElementId;
/**
 * Uklada posledni node, na ktery bylo kliknuto
 */
VehicleTree.prototype._lastClikedNode;
/**
 * Posluchac kliku na Label
 * Objekt obsahujuci metody
 * setMarque() - nastavi ID znacky, pokud je zname
 * setModel() - nastavi ID modelu, pokud je zname
 * setColor() - nastavi ID barvy, pokud je barva vybrana
 * setVehicleBody() - nastavi
 * doAction() - provede akci
 */
VehicleTree.prototype._clickListenter;
//global variable to allow console inspection of tree:
VehicleTree.prototype._tree;
VehicleTree.prototype._marques;


VehicleTree.prototype.buildBranch = function(node, data, name, loadFn)
{
    for ( var key in data  ) {
        var tmpNode = new YAHOO.widget.TextNode( {id: key, label: data[key]}, node, false);
        tmpNode.data.name = name;
        tmpNode.setDynamicLoad(loadFn, 1);
    }
}

VehicleTree.prototype.buildRandomTextNodeTree = function(parentElementId)
{
    var that = this;
    //instantiate the tree:
    this._tree = new YAHOO.widget.TreeView( parentElementId);

    //turn dynamic loading on for entire tree:
//    this._tree.setDynamicLoad(this.loadModels, 1);

    this.buildBranch( this._tree.getRoot(), this._marques, 'marque', function(node, fnLoadComplete) {
        that.loadModels(node, fnLoadComplete);
    });

    // Trees with TextNodes will fire an event for when the label is clicked:
    this._tree.subscribe("labelClick", function(node) {
        if( node.data.name == 'marque') {
            that._clickListener.setMarque( node.data.id, node.label);
            that._clickListener.setModel( 0, "");
            that._clickListener.setVehicleBody( 0, "");
            that._clickListener.setColor(0, "");
        }
        if( node.data.name == 'model') {
            that._clickListener.setModel( node.data.id, node.label);
            that._clickListener.setMarque( node.parent.data.id, node.parent.label);
            that._clickListener.setVehicleBody( 0, "");
            that._clickListener.setColor(0, "");
        }
        if( node.data.name == 'vehicleBody') {
            that._clickListener.setVehicleBody( node.data.id, node.label);
            that._clickListener.setModel( node.parent.data.id, node.parent.label);
            that._clickListener.setMarque( node.parent.parent.data.id, node.parent.parent.label);
            that._clickListener.setColor(0, "");
        }
        if( node.data.name == 'color') {
            that._clickListener.setColor( node.data.id, node.label);
            that._clickListener.setVehicleBody( node.parent.data.id, node.parent.label);
            that._clickListener.setModel( node.parent.parent.data.id, node.parent.parent.label);
            that._clickListener.setMarque( node.parent.parent.parent.data.id, node.parent.parent.parent.label);
        }
        that._lastClickedNode = node;
        that._clickListener.doAction();
    });
    //The tree is not created in the DOM until this method is called:
    this._tree.draw();
}

VehicleTree.prototype.refresh = function ()
{
	this.init(this._parentElementId, this._clickListener)
}

VehicleTree.prototype.init = function()
{
    var that = this;
    var url = '/www/marque/get-classifier/format/json/';

    if(this._flag != '') {
        url += 'flag/'+this._flag+'/';
    }

	$.getJSON(url, null, function(json) {
        that._marques = json.data;
        that.buildRandomTextNodeTree(that._parentElementId);
    });
}

VehicleTree.prototype.setFlag = function( flag)
{
    this._flag = flag;
}

//Add an onDOMReady handler to build the tree when the document is ready
//YAHOO.util.Event.onDOMReady(treeInit);
VehicleTree.prototype.loadNodeData = function(node, fnLoadComplete, sUrl, name, loadFunction)  {

    var that = this;
    //We'll create child nodes based on what we get back when we
    //use Connection Manager to pass the text label of the
    //expanding node to the Yahoo!
    //Search "related suggestions" API.  Here, we're at the
    //first part of the request -- we'll make the request to the
    //server.  In our Connection Manager success handler, we'll build our new children
    //and then return fnLoadComplete back to the tree.

    //Get the node's label and urlencode it; this is the word/s
    //on which we'll search for related words:
    // var node = encodeURI(node);

    //prepare URL for XHR request:
    //var sUrl = "/vehicle-tree/get-models/marqueId/"+node.itemId;

    //prepare our callback object
    var callback = {

        //if our XHR call is successful, we want to make use
        //of the returned data and create child nodes.
        success: function(oResponse) {
            var oResults = eval("(" + oResponse.responseText + ")");
            that.buildBranch(node, oResults.data, name, loadFunction);
            oResponse.argument.fnLoadComplete();
        },

        //if our XHR call is not successful, we want to
        //fire the TreeView callback and let the Tree
        //proceed with its business.
        failure: function(oResponse) {
            oResponse.argument.fnLoadComplete();
        },

        //our handlers for the XHR response will need the same
        //argument information we got to loadNodeData, so
        //we'll pass those along:
        argument: {
            "node": node,
            "fnLoadComplete": fnLoadComplete
        },

        //timeout -- if more than 7 seconds go by, we'll abort
        //the transaction and assume there are no children:
        timeout: 7000
    };

    //With our callback object ready, it's now time to
    //make our XHR call using Connection Manager's
    //asyncRequest method:
    YAHOO.util.Connect.asyncRequest('GET', sUrl, callback);
}

VehicleTree.prototype.loadModels = function (node, fnLoadComplete)
{
    var url = "/www/model/get-classifier/format/json/marqueId/"+node.data.id;
    var that = this;

    if(this._flag != '') {
        url += '/flag/'+this._flag+'/';
    }
    this.loadNodeData(node, fnLoadComplete, url, 'model', function(node, fnLoadComplete) {
        that.loadVehicleBodies(node, fnLoadComplete);
    });
}

VehicleTree.prototype.loadVehicleBodies = function(node, fnLoadComplete)
{
    var url = "/www/vehicle-tree/get-vehicle-bodies/format/json/modelId/"+node.data.id;
    var that = this;

    if(this._flag != '') {
        url += '/flag/'+this._flag+'/';
    }

    this.loadNodeData(node, fnLoadComplete, url, 'vehicleBody', function(node, fnLoadComplete) {
        that.loadColors(node, fnLoadComplete);
    });
}

VehicleTree.prototype.loadColors  = function(node, fnLoadComplete)
{
    var url = "/www/vehicle-tree/get-colors/format/json/modelId/"+node.parent.data.id;

    if(this._flag != '') {
        url += '/flag/'+this._flag+"/";
    }
    this.loadNodeData(node, fnLoadComplete, url, 'color', null);
}


//=== Ajax klient ==============================================================

/**
 * Wrapper pro jquery.ajax* funkce prizpusobeny Xendu
 * Slozui jako centrlni misto pro vytvareni AJAX requestu na aplikaci auteo
 * 
 * @deprecated - JE TO HUMUUUS!!!
 */

function AjaxClient_call ( model, method, args, callback) {
	if(args != null) {
		args = args.toLocaleString();
	}
	if(this.debug) {
		alert(args);
	}
	data = {model:model,method:method,args:args};

	$.get(this._targetUrl, data, callback, "json");
}

function AjaxClient_OwnCall( args, callback) {
	$.get(this._targetUrl, args, callback, "json");
}

var defaultOptions = {
	type:'json', //Typ odpovedi
	debug:0
}

function AjaxClient( options)
{
	if(options == null) {
		options = defaultOptions;
	}
	//response type
	if(options.type != null) {
		this._type = options.type;
	}
	else {
		this._type = defaultOptions.type;
	}
	//AJAX Server url
	if(options.targetUrl != null) {
		this._targetUrl = options.targetUrl;
		this.call = AjaxClient_OwnCall;
	}
	else {
		this._targetUrl = defaultOptions.targetUrl;
		this.call = AjaxClient_call;
	}
	//enable debug mode
	if(options.debug) {
		this.debug = true;
	}
	else {
		this.debug = false;
	}

//	Ajax indicator
	$(function() {
		var sp = new Spinner;
	    $(document).ajaxSend(function() {
	       sp.show();
	    });
	    $(document).ajaxStop(function() {
	       	sp.hide();
	    });
});
}

//--- Datagrid -----------------------------------------------------------------
/**
 * TODO:
 * - Posledni request by se mel ukladat do cookie, aby byla zachovana posledne hledana informace pokud se pujde v historii zpet
 * - Melo by odchazet vicero parametru autcomplete
 */

// ----- PREDDEFINOVANE FORMATTERY ------

/**
 * Zmeni emailovou adresu na mailto: odkaz a prida ikonu emailu pred odkaz
 */
var email = function(elCell, oRecord, oColumn, sData){
	elCell.innerHTML = '<img src="/images/icons/16/mail_generic.png" /> <a href="mailto:' + sData + '">' + sData + '</a>';
}
/**
 * Vytvori odkaz z url
 */
var url = function(elCell, oRecord, oColumn, sData){
	elCell.innerHTML = '<img src="/images/icons/16/network.png" /> <a href="' + sData + '">' + sData + '</a>';
}
/**
 * Vytvori ikonu "smazat" s odkazem na akci, ktera smaze data odpovidajiciho zaznamu
 */
var deleteUrl = function(elCell, oRecord, oColumn, sData){
	elCell.innerHTML = '<a href="' + sData + '" class="confirm" title="Chete smazat záznam?"><img src="/images/icons/16/edit_delete.png" /></a>';
}
var editUrl = function(elCell, oRecors, oColumn, sData) {
	elCell.innerHTML = '<a href="' + sData + '"><img src="/images/icons/16/edit.png" width="16" height="16" /></a>';
}
var editUrlIcon = function(elCell, oRecors, oColumn, sData) {
	elCell.innerHTML = '<a href="' + sData + '"><img src="/images/icons/16/edit.png" width="16" height="16" /></a>';
}
/**
 * Vytvori ikonu ok/cancel
 */
var checkbox = function(elCell, oRecord, oColumn, sData){
	var checked = sData?'<img src="/images/icons/button_ok.png" />':'<img src="/images/icons/16/button_cancel.png" />';
	elCell.innerHTML = checked;
}
// ----- /PREDDEFINOVANE FORMATTERY ------

function DataGrid(config){
	this._config = config;
	this.init( config);
	this.dataSourceUrl = "";
	/**
	 * Udava, zda byl obsah datagridu na strance nacten poprve
	 * To je dulezite, pri nacitani parametru z cookies nebo primo z kodu stranky
	 *
	 * @var boolean
	 */
	this.firstLoad = true;
}

DataGrid.prototype.refresh = function() {
	this.init( this._config);
}
DataGrid.prototype.reload = function( url) {
	this._config.dataSourceUrl = url;
	this.init( this._config);
}
DataGrid.prototype.callbackObj = {
	success: this.mySuccessHandler,
	failure: this.myFailureHandler,
	scope: this.myDataTable
};
DataGrid.prototype.mySuccessHandler = function(){
	this.set("sortedBy", null);
	this.onDataReturnAppendRows.apply(this, arguments);
};

DataGrid.prototype.myFailureHandler = function(){
			this.showTableMessage(YAHOO.widget.DataTable.MSG_ERROR, YAHOO.widget.DataTable.CLASS_ERROR);
			this.onDataReturnAppendRows.apply(this, arguments);
		};
DataGrid.prototype._createAutocompleteContainer = function( containerName) {
    var container = document.createElement('div');
    container.setAttribute('id', containerName + '-container');
	field = $('[name='+containerName+']')
    $('body').add(container);
}

DataGrid.prototype._getDataSourceUrl = function()
{
	if(this.firstLoad) {
		return YAHOO.util.Cookie.get("datagrid.dataSourceUrl");
	}
	return '';
}

DataGrid.prototype._setDataSourceUrl = function( dataDourceUrl)
{
	return YAHOO.util.Cookie.get("datagrid.dataSourceUrl");
}

DataGrid.prototype.init = function( config) {
		this.myDataSource = null;
		this.myDataTable = null;
		var myColumnDefs = config.columnDefs;

		var parent = this;

		var _myConfig = {
			//--- strankovac ---
			paginator: new YAHOO.widget.Paginator({
				rowsPerPage: 25,
				previousPageLinkLabel: '<img src="/images/icons/16/arrow_left.png" alt="previous">',
				nextPageLinkLabel: '<img src="/images/icons/16/arrow_right.png" alt="next">',
				firstPageLinkLabel: '<img src="/images/icons/16/arrow_left_double.png" alt="previous">',
				lastPageLinkLabel: '<img src="/images/icons/16/arrow_right_double.png" alt="next">'
			}),
			//--- strankovac konec ---
			dynamicData: true
		}

		config.dataTableConfig.paginator = _myConfig.paginator;
		config.dataTableConfig.dynamicData = true;

		//-- naseptavac ---

		for (var i = 0; i < config.autocomplete.findByFieldId.length; i++) {
			if (config.autocomplete.findByFieldId[i] != null) { //Bez tohodle hazi IE chybu

				var oACDS = new YAHOO.util.FunctionDataSource(function(query){
					parent.myDataSource.sendRequest(this.sUrl + query, parent.myDataTable.onDataReturnInitializeTable, parent.myDataTable);
				});

                this._createAutocompleteContainer(config.autocomplete.findByFieldId[i].key);

				oACDS.sUrl = '&findBy=' + config.autocomplete.findByFieldId[i].key + '&value=';
				oACDS.queryMatchContains = true;
				oACDS.queryDelay = 0.8;
				var oAutoComp = new YAHOO.widget.AutoComplete(config.autocomplete.findByFieldId[i].key, config.autocomplete.findByFieldId[i].key + '-container', oACDS);
				oAutoComp.alwaysShowContainer = true;
			}
		}
		// --- naseptavac konec ---
		this.dataSourceUrl = config.dataSourceUrl + '?datagrid=1&';
		this.myDataSource = new YAHOO.util.DataSource(this.dataSourceUrl);
		this.myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
		this.myDataSource.connXhrMode = "queueRequests";
		this.myDataSource.responseSchema = config.responseSchema;

		//-- zpetna kompatibilita (driv se blok pro datagrid jmenova nepochopitelne json --
		if(document.getElementById(config.datagridId)) {
			datagridId = config.datagridId;
		}
		else {
			datagridId = 'json';
		}

		this.myDataTable = new YAHOO.widget.DataTable(datagridId, myColumnDefs, this.myDataSource, config.dataTableConfig);
		// Update totalRecords on the fly with value from server
		this.myDataTable.handleDataReturnPayload = function(oRequest, oResponse, oPayload){
			if (!oPayload) {
				return oPayload;
			}
			oPayload.totalRecords = oResponse.meta.totalRecords;
			return oPayload;
		}

        //highlighter
        this.myDataTable.subscribe("rowMouseoverEvent", this.myDataTable.onEventHighlightRow);
        this.myDataTable.subscribe("rowMouseoutEvent", this.myDataTable.onEventUnhighlightRow);
	}

//=== Texyla ===================================================================
var createTexyla = function()
{
	if(jQuery().texyla) {
		$("textarea.texyla").texyla({
			texyCfg: "admin",
			height: 600,
			toolbar: [
				null,null,
				'bold', 'italic',
				'h1', 'h2','h3','h4',
				null,
				'sub','sup','del',
				null,
				'center','left', 'right', 'justify',
				null,
				'ul','ol',
				'blockquote',
				null,
				'color',
				'hr',
				'acronym',
				null,null,
				'preview', ['preview','htmlPreview'],
				null,null,
				'link',
				'table',
				'files',
				'img',
				'symbol',
				'html',
				null,null,
				'syntax'
			],
			// tlacitka vlevo dole
			bottomLeftToolbar: [],
			// tlacitka vpravo dole pri editaci
			bottomRightEditToolbar: [],
			// tlcitka vpravo dole pri nahledu
			bottomRightPreviewToolbar: ['edit']
		});
	}
}

