tinyMCE.init({
    theme : "advanced",
    mode : "textareas",
	language : "fr",
	plugins : "preview, paste",
	paste_create_paragraphs : false,
	paste_create_linebreaks : false,
	paste_use_dialog : true,
	paste_remove_spans:true,
	paste_remove_styles:true,
	paste_auto_cleanup_on_paste : false,
	paste_convert_middot_lists : true,
	paste_convert_headers_to_strong : true,
	//paste_insert_word_content_callback : "convertWord",
    elements : "notepad",
    theme_advanced_toolbar_location : "top",
	theme_advanced_toolbar_align : "left",
    theme_advanced_buttons1 : "bold,italic,underline,strikethrough,separator,bullist,numlist,fontsizeselect,undo,redo,separator,sub,sup,charmap,link,unlink,code,preview,pastetext,pasteword,selectall",
	//+ "justifyleft,justifycenter,justifyright,justifyfull,outdent,indent", 
    theme_advanced_buttons2 : "",//",anchor,image,separator,"
    //+"",
	content_css : "css/style.css",
	plugin_preview_width : "300",
	plugin_preview_height : "280",
	plugin_preview_pageurl : "../../plugins/preview/example.html",
	//theme_advanced_resizing : true,
    height:"300px",
    width:"280px"
  });

function hide_or_show(idbloc)
{
	content= 'content' + idbloc;
	param_content = "param_content_" + idbloc;

	if ($(content).style.display == 'none')
	{
		new Effect.BlindDown(content);
	}
	else
	{
		new Effect.BlindUp(content);
	}
	if ($(param_content).style.display != 'none')
	{
		new Effect.BlindUp(param_content);
	}
}
function cli_hide_or_show(div)
{
	if ($(div).style.display == 'none')
	{
		new Effect.BlindDown(div);
	}
	else
	{
		new Effect.BlindUp(div);
	}
}
function close_box(idbloc, iduser)
{
	box = "box_" + idbloc;
	new Effect.Fade(box);
	params = '?idbloc=' + idbloc;
	var ajax = new Ajax.Request('supp_box.php',{
		method: 'post',
		parameters: params
	});
}

function  hide_or_show_rm(name)
{
	var div = document.getElementById(name);
	name2 = 'bis_' + name;
	var a = document.getElementById(name2);
	if (div.style.display == 'none')
	{
		new Effect.Fade(a);
		new Effect.BlindDown(name);
	}
	else
	{
		new Effect.Appear(a);
		new Effect.BlindUp(name);
	}
}

function hide_rss_desc(idbloc, cpt)
{	
	rss_desc = "rss_" + idbloc + "_" + cpt;
	if ($(rss_desc).style.display != "none")
	{
		new Effect.BlindUp(rss_desc);
	}
}

function show_rss_desc(idbloc, cpt)
{	
	rss_desc = "rss_" + idbloc + "_" + cpt;
	if ($(rss_desc).style.display == "none")
	{
		new Effect.BlindDown(rss_desc);
		$(rss_desc).style.display = 'block';
	}
}

function show_param(idbloc)
{
	content = "content" + idbloc;
	param_content = "param_content_" + idbloc;
	image = "reduce" + idbloc;
	if ($(param_content).style.display == "none")
	{
		if ($(content).style.display == "none")
		{
			new Effect.BlindDown(content);
			$(content).style.display = 'block';
			$(image).src = 'http://www.pmtic.net/module2bis/images/template/bt_reduce.png';
		}
		Effect.BlindDown(param_content);
		$(param_content).style.display = 'block';
	}
	else
	{
		Effect.BlindUp(param_content);
	}
	
}
function param_add_bloc(idbloc)
{
	param_content = "param_content_" + idbloc;
	if ($(param_content).style.display == "none")
	{
		Effect.BlindDown(param_content);
		$(param_content).style.display = 'block';
	}
	else
	{
		Effect.BlindUp(param_content);
	}
}

function change_bloc_color(idbloc, iduser)
{
	h1 = 'h1_' + idbloc;
	input = 'color_bloc_' + idbloc;
	color = $(input).value;
	$(h1).style.color = color;
	if (color.charAt(0) == "#")
	{
		color = color.replace("#","");
	} 
	params = '?idbloc=' + idbloc + '&iduser=' + iduser + '&color=' + color;
	var ajax = new Ajax.Request('change_title_color.php',{
		method: 'post',
		parameters: params
	});
}

function change_notepad_content(idbloc, iduser)
{
	content = $(input).value;
	params = '?idbloc=' + idbloc + '&iduser=' + iduser + '&content=' + content;
	var ajax = new Ajax.Request('change_notepad_content.php',{
		method: 'post',
		parameters: params
	});
	return_div = 'content' + idbloc;
	$(return_div).innerHTML = '<p>' + content + '</p>';
}

function open_tine_mce(idbloc)
{
	
}

function reduce_expand(idbloc, iduser, status)
{
	params = '?idbloc=' + idbloc + '&iduser=' + iduser + '&status=' + status;
	var ajax = new Ajax.Request('change_bloc_status.php',{
		method: 'post',
		parameters: params
	});
}

function highlight_bloc(idbloc)
{
	box = 'box_' + idbloc;
	new Effect.Highlight_PMTIC($(box), { startcolor: '#FFFFFF',endcolor: '#FFFF99' });
}
function unhighlight_bloc(idbloc)
{
	box = 'box_' + idbloc;
	new Effect.Highlight_PMTIC($(box), { startcolor: '#FFFFFF',endcolor: '#FFFFFF' });
}

function highlight_tag(idtag)
{
	tag = 'tag_' + idtag;
	new Effect.Highlight_PMTIC($(tag), { startcolor: '#FFFFFF',endcolor: '#FFFF99' });
}
function unhighlight_tag(idtag)
{
	tag = 'tag_' + idtag;
	new Effect.Highlight_PMTIC($(tag), { startcolor: '#FFFFFF',endcolor: '#FFFFFF' });
}

function show_tag_result(idtag)
{
	div = 'install_from_tag_' + idtag;
	div_result = 'tag_response';

	$(div_result).innerHTML = $(div).innerHTML;
	new Effect.BlindDown(div_result);	
}
function hide_tag_result(idtag)
{
	div_result = 'tag_response';
	new Effect.BlindUp(div_result);
}
