var edButtons = new Array();
var edOpenTags = new Array();
var edCanvas = new Array();
function edButton(id, display, tagStart, tagEnd, access, open, location) {
this.id = id; // used to name the toolbar button
this.display = display; // label on button
this.tagStart = tagStart; // open tag
this.tagEnd = tagEnd; // close tag
this.access = access; // access key
this.open = open; // set to -1 if tag does not need to be closed
this.location = location
}
edButtons[edButtons.length] = new edButton('ed_italic','kursywa','','','i');
edButtons[edButtons.length] = new edButton('ed_bold','pogrubienie','','','b');
edButtons[edButtons.length] = new edButton('ed_image','wstaw obrazek','[inline:1]','','p','-1');
edButtons[edButtons.length] = new edButton('ed_image2','wstaw drugi obrazek','[inline:2]','','[','-1');
edButtons[edButtons.length] = new edButton('ed_image3','wstaw trzeci obrazek','[inline:3]','',']','-1');
edButtons[edButtons.length] = new edButton('ed_link','link','','','l','-1','edInsertLink');
edButtons[edButtons.length] = new edButton('ed_break','przerwa','','','t','-1');
function edShowButton(button, i, id) {
if (button.location) {
document.write('
');
}
else {
document.write('
');
}
}
function edAddTag(button) {
if (edButtons[button].tagEnd != '') {
edOpenTags[edOpenTags.length] = button;
document.getElementById(edButtons[button].id).alt = '/' + document.getElementById(edButtons[button].id).alt;
document.getElementById(edButtons[button].id).style.border = 'solid red 1px';
}
}
function edRemoveTag(button) {
for (i = 0; i < edOpenTags.length; i++) {
if (edOpenTags[i] == button) {
edOpenTags.splice(i, 1);
document.getElementById(edButtons[button].id).alt = document.getElementById(edButtons[button].id).alt.replace('/', '');
document.getElementById(edButtons[button].id).style.border = '';
}
}
}
function edCheckOpenTags(button) {
var tag = 0;
for (i = 0; i < edOpenTags.length; i++) {
if (edOpenTags[i] == button) {
tag++;
}
}
if (tag > 0) {
return true; // tag found
}
else {
return false; // tag not found
}
}
function edCloseAllTags(id) {
var count = edOpenTags.length;
for (o = 0; o < count; o++) {
edInsertTag(edCanvas[id], edOpenTags[edOpenTags.length - 1]);
}
}
function edToolbar(id) {
document.write('