var BBCEInstance = null;
var BBCEContent = null;
var BBCEPopup = null;
var BBCEButtons = 'http://www.cudownedzieci.pl/Includes/BBCodeEditor/Images/';
var BBCEChangeCase = 'http://www.cudownedzieci.pl/Includes/BBCodeEditor/ChangeCase.php';
var BBCEColors = 'http://www.cudownedzieci.pl/Includes/BBCodeEditor/TextColor.php';
var BBCEHelp = 'http://www.cudownedzieci.pl/Includes/BBCodeEditor/Help.php';
var BBCESelect = 'Zaznacz tekst aby go sformatować';
var BBCEMail = 'Podaj adres e-mail';
var BBCELink = 'Podaj adres strony';
var BBCEImage = 'Podaj adres obrazka';
var BBCECase = 'Podaj rozmiar tekstu';
var BBCEMovie = 'Podaj adres filmiku z serwisu YouTube.pl';
var BBCEButtonBold = 'Pogrubienie';
var BBCEButtonItalic = 'Pochylenie';
var BBCEButtonUnderline = 'Podkreślenie';
var BBCEButtonStrike = 'Przekreślenie';
var BBCEButtonSup = 'Indeks górny';
var BBCEButtonSub = 'Indeks dolny';
var BBCEButtonAlignRight = 'Wyrównaj do prawej';
var BBCEButtonAlignCenter = 'Wyśrodkuj';
var BBCEButtonAlignLeft = 'Wyrównaj do lewej';
var BBCEButtonEmail = 'Wstaw adres e-mail';
var BBCEButtonLink = 'Wstaw adres www';
var BBCEButtonImage = 'Wstaw obrazek';
var BBCEButtonChangeCase = 'Zmień rozmiar tekstu';
var BBCEButtonMovie = 'Wstaw filmik z YouTube';
var BBCEButtonColors = 'Zmień kolor tekstu';
var BBCEButtonHelp = 'Pomoc';
function EditorInit(Object, Height)
{
document.write('
');
document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
');document.write('
'); document.write('
');
document.write('');
document.write('

');
document.write('

');
document.write('

');
document.write('

');
document.write('

');
document.write('

');
document.write('

');
document.write('

');
document.write('

');
document.write('

');
document.write('

');
document.write('

');
document.write('

');
document.write('

');
document.write('

');
document.write('

');
document.write('

');
document.write('

');
document.write('

');
document.write('
');
var OldEditorWindow = document.getElementById(Object);
BBCEContent = OldEditorWindow.innerHTML;
OldEditorWindow.parentNode.removeChild(OldEditorWindow);
document.write('');
BBCEInstance = document.getElementById(Object);
}
function ForumEditorInit(Object, Height)
{
document.write('');
document.write('

');
document.write('

');
document.write('

');
document.write('

');
document.write('

');
document.write('

');
document.write('

');
document.write('

');
document.write('

');
document.write('

');
document.write('

');
document.write('

');
document.write('

');
document.write('

');
document.write('

');
/*
document.write('

');
*/
document.write('

');
document.write('

');
document.write('
');
var OldEditorWindow = document.getElementById(Object);
BBCEContent = OldEditorWindow.innerHTML;
OldEditorWindow.parentNode.removeChild(OldEditorWindow);
document.write('');
BBCEInstance = document.getElementById(Object);
}
function EditorSimpleInit(Object, Height)
{
document.write('');
document.write('

');
document.write('

');
document.write('

');
document.write('

');
document.write('

');
document.write('

');
document.write('

');
document.write('

');
document.write('

');
document.write('
');
var OldEditorWindow = document.getElementById(Object);
BBCEContent = OldEditorWindow.innerHTML;
OldEditorWindow.parentNode.removeChild(OldEditorWindow);
document.write('');
BBCEInstance = document.getElementById(Object);
}
function AddTag(OpeningTag, ClosingTag, Object)
{
BBCEInstance = document.getElementById(Object);
if (document.selection)
{
BBCEInstance.focus();
var Selection = document.selection.createRange();
if (Selection.text.length)
{
Selection.text = OpeningTag + Selection.text + ClosingTag;
}
else
{
alert(BBCESelect);
}
}
else
{
var Length = BBCEInstance.value.length;
var Start = BBCEInstance.selectionStart;
var End = BBCEInstance.selectionEnd;
var Selection = BBCEInstance.value.substring(Start, End);
if (Start != End)
{
var Replace = OpeningTag + Selection + ClosingTag;
BBCEInstance.value = BBCEInstance.value.substring(0, Start) + Replace + BBCEInstance.value.substring(End, Length);
}
else
{
alert(BBCESelect);
}
}
}
function InitImage(Object)
{
BBCEInstance = document.getElementById(Object);
var Img = prompt(BBCEImage + ':', 'http://');
if ((Img) && (Img.length >= 8))
{
if (document.selection)
{
BBCEInstance.focus();
var Selection = document.selection.createRange();
Selection.text = '[img]' + Img + '[/img]';
}
else
{
var Length = BBCEInstance.value.length;
var Start = BBCEInstance.selectionStart;
var End = BBCEInstance.selectionEnd;
var Selection = BBCEInstance.value.substring(Start, End);
var Replace = '[img]' + Img + '[/img]';
BBCEInstance.value = BBCEInstance.value.substring(0, Start) + Replace + BBCEInstance.value.substring(End, Length);
}
}
else
{
alert(BBCEImage);
}
}
function InitEmail(Object)
{
BBCEInstance = document.getElementById(Object);
var Mail = prompt(BBCEMail + ':', '');
if ((Mail) && (Mail.length >= 1))
{
if (document.selection)
{
BBCEInstance.focus();
var Selection = document.selection.createRange();
Selection.text = (Selection.text.length > 0) ? '[mail=' + Mail + ']' + Selection.text + '[/mail]' : '[mail]' + Mail + '[/mail]';
}
else
{
var Length = BBCEInstance.value.length;
var Start = BBCEInstance.selectionStart;
var End = BBCEInstance.selectionEnd;
var Selection = BBCEInstance.value.substring(Start, End);
var Replace = (Selection.length > 0) ? '[mail=' + Mail + ']' + Selection + '[/mail]' : '[mail]' + Mail + '[/mail]';
BBCEInstance.value = BBCEInstance.value.substring(0, Start) + Replace + BBCEInstance.value.substring(End, Length);
}
}
else if (Email)
{
alert(BBCEMail);
}
}
function InitLink(Object)
{
BBCEInstance = document.getElementById(Object);
var Url = prompt(BBCELink + ':', 'http://');
if ((Url) && (Url.length >= 8))
{
if (document.selection)
{
BBCEInstance.focus();
var Selection = document.selection.createRange();
Selection.text = (Selection.text.length > 0) ? '[url=' + Url + ']' + Selection.text + '[/url]' : '[url]' + Url + '[/url]';
}
else
{
var Length = BBCEInstance.value.length;
var Start = BBCEInstance.selectionStart;
var End = BBCEInstance.selectionEnd;
var Selection = BBCEInstance.value.substring(Start, End);
var Replace = (Selection.length > 0) ? '[url=' + Url + ']' + Selection + '[/url]' : '[url]' + Url + '[/url]';
BBCEInstance.value = BBCEInstance.value.substring(0, Start) + Replace + BBCEInstance.value.substring(End, Length);
}
}
else if (Url)
{
alert(BBCEMail);
}
}
function InitChangeCase(Object)
{
BBCEInstance = document.getElementById(Object);
var Size = prompt(BBCECase + ':', '11');
if ((Size) && (Size > 0) && (Size < 73))
{
if (document.selection)
{
BBCEInstance.focus();
var Selection = document.selection.createRange();
Selection.text = (Selection.text.length > 0) ? '[size=' + Size + ']' + Selection.text + '[/size]' : Selection.text;
}
else
{
var Length = BBCEInstance.value.length;
var Start = BBCEInstance.selectionStart;
var End = BBCEInstance.selectionEnd;
var Selection = BBCEInstance.value.substring(Start, End);
var Replace = (Selection.length > 0) ? '[size=' + Size + ']' + Selection + '[/size]' : Selection;
BBCEInstance.value = BBCEInstance.value.substring(0, Start) + Replace + BBCEInstance.value.substring(End, Length);
}
}
else if (Size)
{
alert(BBCECase);
}
}
function InitMovie(Object)
{
BBCEInstance = document.getElementById(Object);
var Movie = prompt(BBCEMovie + ':', 'http://');
if ((Movie) && (Movie.length >= 8))
{
if (document.selection)
{
BBCEInstance.focus();
var Selection = document.selection.createRange();
Selection.text = '[youtube]' + Movie + '[/youtube]';
}
else
{
var Length = BBCEInstance.value.length;
var Start = BBCEInstance.selectionStart;
var End = BBCEInstance.selectionEnd;
var Selection = BBCEInstance.value.substring(Start, End);
var Replace = '[youtube]' + Movie + '[/youtube]';
BBCEInstance.value = BBCEInstance.value.substring(0, Start) + Replace + BBCEInstance.value.substring(End, Length);
}
}
else
{
alert(BBCEMovie);
}
}
function Colors(Color, Object)
{
BBCEInstance = document.getElementById(Object);
if (document.selection)
{
BBCEInstance.focus();
var Selection = document.selection.createRange();
Selection.text = (Selection.text.length > 0) ? '[color=' + Color + ']' + Selection.text + '[/color]' : Selection.text;
}
else
{
var Length = BBCEInstance.value.length;
var Start = BBCEInstance.selectionStart;
var End = BBCEInstance.selectionEnd;
var Selection = BBCEInstance.value.substring(Start, End);
var Replace = (Selection.length > 0) ? '[color=' + Color + ']' + Selection + '[/color]' : Selection;
BBCEInstance.value = BBCEInstance.value.substring(0, Start) + Replace + BBCEInstance.value.substring(End, Length);
}
}
function InitHelp()
{
BBCEPopup = window.open(BBCEHelp, "BBCEPopup", "width=450,height=500,scrollbars=yes");
BBCEPopup.focus();
}