function otworz_html(plik,tytul,szer,wys)
{
    config='left=100,top=100,width='+szer+',height='+wys+',innerheight='+wys+',innerwidth='+szer+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no';
    NoweOkienko=window.open(plik,tytul,config); 
}

function slideToggleSlow(id)
{
    $('#'+id).slideToggle('slow');
}
    
function FormCount(mCh,p,w)
{
    t=document.getElementById(w);s=document.getElementById(p);s.innerHTML=mCh;
    if( t.value.length>mCh )
    {
	//alert('Za duża liczba znaków!');
	t.value=t.value.substring(0,mCh)
    }
    i=mCh-t.value.length;s.innerHTML="Zostało "+i+" znaków do wpisania.";
}

function tinyMCEsetup()
{
    tinyMCE.init({
	mode : "textareas",
	language : "pl",
        theme : "advanced",
	theme_advanced_buttons1 : "forecolor,fontsizeselect,separator,bold,italic,underline,strikethrough,hr,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,bullist,numlist,outdent,indent",
	theme_advanced_buttons2 : "pastetext,pasteword,search,replace,separator,link,unlink,separator,undo,redo,separator,removeformat,cleanup,code,separator,preview,fullscreen",
        theme_advanced_buttons3 : "",
	theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "left",
	theme_advanced_statusbar_location : "bottom",
	theme_advanced_resizing : true,
	convert_urls : false,
	relative_urls : false,
	plugins : "preview,fullscreen,paste,searchreplace",
	tab_focus : ':prev,:next',
	editor_selector : "mceEditor",
	extend_valid_elements : "scirpt[src|type]"
    });
}

function tinyMCEsetupEncyklopedia()
{
    tinyMCE.init({
	mode : "textareas",
	language : "pl",
        theme : "advanced",
	theme_advanced_buttons1 : "bold,italic,underline,bullist,numlist,pastetext",
	theme_advanced_buttons2 : "",
        theme_advanced_buttons3 : "",
	theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "left",
	theme_advanced_statusbar_location : "bottom",
	theme_advanced_resizing : true,
	convert_urls : false,
	relative_urls : false,
	plugins : "preview,fullscreen,paste,searchreplace",
	tab_focus : ':prev,:next',
	editor_selector : "mceEditorEncyklopedia",
	extend_valid_elements : "scirpt[src|type]"
    });
}

function tinyMCEsetupWiadomosciDodaj()
{
    tinyMCE.init({
	mode : "textareas",
	language : "pl",
        theme : "advanced",
	theme_advanced_buttons1 : "forecolor,backcolor,separator,bold,italic,underline,strikethrough,hr,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,bullist,numlist,outdent,indent,separator,preview,fullscreen",
	theme_advanced_buttons2 : "fontselect,fontsizeselect,separator,pastetext,pasteword,search,replace,separator,link,unlink,image,separator,undo,redo",
        theme_advanced_buttons3 : "tablecontrols,separator,removeformat,cleanup,code",
	theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "left",
	theme_advanced_statusbar_location : "bottom",
	theme_advanced_resizing : true,
	convert_urls : false,
	relative_urls : false,
	plugins : "preview,fullscreen,paste,searchreplace,table",
	tab_focus : ':prev,:next',
	editor_selector : "mceEditorWiadomoscDodaj",
	extend_valid_elements : "scirpt[src|type]"
    });
}

function tinyMCEsetupWiadomosciEdytuj(id_wiadomosci)
{
    tinyMCE.init({
	mode : "textareas",
	language : "pl",
        theme : "advanced",
	theme_advanced_buttons1 : "forecolor,backcolor,separator,bold,italic,underline,strikethrough,hr,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,bullist,numlist,outdent,indent,separator,preview,fullscreen",
	theme_advanced_buttons2 : "fontselect,fontsizeselect,separator,pastetext,pasteword,search,replace,separator,link,unlink,image,separator,undo,redo",
        theme_advanced_buttons3 : "tablecontrols,separator,removeformat,cleanup,code",
	theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "left",
	theme_advanced_statusbar_location : "bottom",
	theme_advanced_resizing : true,
	convert_urls : false,
	relative_urls : false,
	plugins : "preview,fullscreen,paste,searchreplace,table,advimage,advlink",
	theme_advanced_styles : "ThickBox=thickbox",
	external_image_list_url : "tiny_wiadomosci_image_list,"+id_wiadomosci+".js",
	external_link_list_url : "tiny_wiadomosci_file_list,"+id_wiadomosci+".js",
	tab_focus : ':prev,:next',
	editor_selector : "mceEditorWiadomoscEdytuj",
	extend_valid_elements : "scirpt[src|type]"
    });
}

function tinyMCEsetupCMS(ids)
{
    tinyMCE.init({
	mode : "textareas",
	language : "pl",
        theme : "advanced",
	theme_advanced_buttons1 : "forecolor,backcolor,separator,bold,italic,underline,strikethrough,hr,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,bullist,numlist,outdent,indent,separator,preview,fullscreen",
	theme_advanced_buttons2 : "fontselect,fontsizeselect,separator,pastetext,pasteword,search,replace,separator,link,unlink,image,separator,undo,redo",
        theme_advanced_buttons3 : "tablecontrols,separator,removeformat,cleanup,code",
	theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "left",
	theme_advanced_statusbar_location : "bottom",
	theme_advanced_resizing : true,
	convert_urls : false,
	relative_urls : false,
	plugins : "preview,fullscreen,paste,searchreplace,table,advimage,advlink",
	theme_advanced_styles : "ThickBox=thickbox",
	external_image_list_url : "tiny_cms_image_list,"+ids+".js",
	external_link_list_url : "tiny_cms_file_list,"+ids+".js",
	tab_focus : ':prev,:next',
	editor_selector : "mceEditorCMS",
	extend_valid_elements : "scirpt[src|type]"
    });
}
	
function tinyMCEsetupBlog(id_wpisu)
{
    tinyMCE.init({
	mode : "textareas",
	language : "pl",
        theme : "advanced",
	theme_advanced_buttons1 : "bold,italic,underline,seperator,link,unlink,image,separator,undo,redo,removeformat,cleanup,code",
	theme_advanced_buttons2 : "justifyleft,justifycenter,justifyright,justifyfull,separator",
	theme_advanced_buttons3 : "",
	theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "left",
	theme_advanced_statusbar_location : "bottom",
	theme_advanced_resizing : true,
	convert_urls : false,
	relative_urls : false,
	plugins : "preview,fullscreen,paste,searchreplace,table,advimage",
	theme_advanced_styles : "ThickBox=thickbox",
	external_image_list_url : "tiny_blog_image_list,"+id_wpisu+".js",
	tab_focus : ':prev,:next',
	editor_selector : "mceEditorBlog",
	extend_valid_elements : "scirpt[src|type]"
    });
}
	
function tinyMCESetupForum()
{
    tinyMCE.init({
	mode : "textareas",
	language : "pl",
        theme : "advanced",
	theme_advanced_buttons1 : "bold,italic,underline,separator,link,unlink,separator,undo,redo,separator,removeformat,cleanup",
	theme_advanced_buttons2 : "",
        theme_advanced_buttons3 : "",
	theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "left",
	theme_advanced_statusbar_location : "bottom",
	theme_advanced_resizing : true,
	convert_urls : false,
	relative_urls : false,
	inline_styles: false,
	plugins : "paste,searchreplace,bbcode",
	tab_focus : ':prev,:next',
	editor_selector : "mceForum",
	convert_fonts_to_spans : false,
	valid_elements : "fieldset,legend,br,i,em,u,b,strong,a[href],p"
    });

}	