
/*
 * @version Id: mcedriver.js 09/apr/07
 * @package Parcelle
 * @copyright Copyright (C) 2007 Andrea Bizzotto - Tecnobit S.R.L. All rights reserved.
 * @license 
 * Created on 09/apr/07
 *
 * Driver for TinyMCE
 * Every driver MUST implement the following functions:
 * getEditorHTML() : returns editor html
 * setEditorHTML(html) : sets editor html
 * checkNewHTML(html) : verifies new html to be regular (could leave "return true;")
 */
 
function myOnInit() {

	tinyMCE.execInstanceCommand('mce_editor_0', 'mceToggleVisualAid', false);
} 

function myOnHeaderInit() {

    tinyMCE.execInstanceCommand('mce_editor_1', 'mceToggleVisualAid', false);
} 

function myOnFooterInit() {

    tinyMCE.execInstanceCommand('mce_editor_2', 'mceToggleVisualAid', false);
} 

function initEditor() {

	tinyMCE.init({
		theme : "advanced",
		mode : "exact",
		elements : "editor-div",        
		plugins : "table",
        theme_advanced_buttons1_add : "fontselect,fontsizeselect",
		content_css : "editor.css",
		oninit : "myOnInit"
	});
}

function initHeaderEditor() {

    tinyMCE.init({
        theme : "advanced",
        mode : "exact",
        elements : "editor-header-div",
        plugins : "table",
        theme_advanced_buttons1_add : "fontselect,fontsizeselect",
        content_css : "editor.css",
        oninit : "myOnHeaderInit"
    });
}

function initFooterEditor() {

    tinyMCE.init({
        theme : "advanced",
        mode : "exact",
        elements : "editor-footer-div",
        plugins : "table",
        theme_advanced_buttons1_add : "fontselect,fontsizeselect",
        content_css : "editor.css",
        oninit : "myOnFooterInit"
    });
}


// required functions:
function getEditorHTML() {

	return normalizeHTML(tinyMCE.getContent());
}

function setEditorHTML(html) {

	tinyMCE.setContent(html);
}

function checkNewHTML(html) {

	return true;
}

function getHeaderHTML()
{
    return normalizeHTML(tinyMCE.getContent('mce_editor_0'));
}

function getFooterHTML()
{
    return normalizeHTML(tinyMCE.getContent('mce_editor_1'));
}

function setHeaderHTML(html) {

    tinyMCE.getInstanceById('mce_editor_0').setHTML(html);
}

function setFooterHTML(html) {

    tinyMCE.getInstanceById('mce_editor_1').setHTML(html);
}


