//Variables for controlling opening and closing tags (function tag)

var b = 2;
var i = 2;
var u = 2;
var q = 2;
var c = 2;
var url = 2;
var img = 2;
var list =2;
var left =2;
var center =2;
var right =2;
var linia =2;
var html =2;

function emo_pop(form,pole,katalog,ilosc,width,height,path)
{
    
 window.open(path+'bbcode.php?form='+form+'&pole='+pole+'&katalog='+katalog+'&ilosc='+ilosc+'',form,'width='+width+',height='+height+',resizable=yes,scrollbars=yes','status=no'); 
    
}    

//Function for creating non-font tags

function tag(v, tagadd, newbut, tagclose, oldbut, name, form, pole) {
    if (eval(v)%2 == 0) {
        eval("window.document."+form+"."+name+".value = newbut;");
        eval("var post = window.document."+form+"."+pole+".value;");
        eval("window.document."+form+"."+pole+".value = post + tagadd;");
        eval("window.document."+form+"."+pole+".focus();");
    } else {
        eval("window.document."+form+"."+name+".value = oldbut;");
        eval("var post = window.document."+form+"."+pole+".value;");
        eval("window.document."+form+"."+pole+".value = post + tagclose;");
        eval("window.document."+form+"."+pole+".focus();");
    }
    eval(v+"++;");
}

//Function for adding font color and size tags

function font(bbopen, bbclose, form, pole) {
        eval("var post = document."+form+"."+pole+";");
        post.value += bbopen + bbclose;
        post.focus();
        return;
}

//Function for adding smilies

function smilie (smilie, form, pole) {
        eval("var post = document."+form+"."+pole+";");
        post.value += smilie;
        post.focus();
        return;
}

//Helpbox messages
bold_help = "Pogrubiony tekst: [b]tekst[/b]";
italic_help = "Pochyły tekst: [i]tekst[/i]";
underline_help = "Podkreśl tekst: [u]tekst[/u]";
left_help = "Akapit z wyrównaniem do lewej: [p=left]tekst[/p]";
center_help = "Akapit z wyrównaniem do środka: [p=center]tekst[/p]";
right_help = "Akapit z wyrównaniem do prawej: [p=right]tekst[/p]";
list_help = "Lista rzeczy: [list][*]1 element [*]2 element[/list] lub [list=1][*]1 element [*]2 element[/list]<-liczbowa";
quote_help = "Cytuj tekst: [quote]tekst[/quote] or [quote=name]tekst[/quote]";
img_help = "Wstaw obraz: [img]http://adres_obrazka[/img]";
url_help = "Wstaw adres URL: [url]http://url[/url] lub [url=http://url]Tekst linku[/url]";
fontcolor_help = "Kolor tekstu: [color=red]tekst[/color]  Wskazówka: możesz także użyć color=#FF0000";
fontsize_help = "Rozmiar tekstu: [size=16]tekst[/size]";
linia_help = "Pozioma linia: [hr=50]";
code_help = "Kod np. html: [code]tekst[/code]";
html_help = "Wstawienie kodu html zawartego między znacznikami.: [html]<b>pogrubiony tekst</b>[/html]";
galeria_help = "Dodaj obrazek z galerii lub z pliku";
emots_help = "Dodaj emotkę z galerii";
guziki_help = "Mozna dodac guzik do artykulu";

//Function for displaying help information

// Shows the help messages in the helpline window
function helpline(help, form, pole) {
        eval("var helpbox = document."+form+"."+pole+";");
        helpbox.value = eval(help + "_help");
}

function mail(user, domain){window.location = 'mailto:'+user+'@'+domain;}
