function tag_toolbar() { document.write('
'); }
function insert(aTag,eTag) {
if(aTag.indexOf("var_0")>1) {
var get_var = prompt("Bitte geben Sie eine URL an:");
aTag = aTag.replace(/var_0/g,get_var);
}
if(aTag.indexOf("var_1")>1) {
var get_var = prompt("Bitte geben Sie einen Titel an:");
aTag = aTag.replace(/var_1/g,get_var);
}
if(aTag.indexOf("var_2")>1) {
var get_var = prompt("Bitte geben Sie einen Farbe an (z.B.: #FF0000):");
aTag = aTag.replace(/var_2/g,get_var);
}
if(aTag.indexOf("var_3")>1) {
var get_var = prompt("Bitte geben Sie die Größe in Pixel an (z.B.: 12):");
aTag = aTag.replace(/var_3/g,get_var);
}
aTag = aTag.replace(/{/g, '"');
aTag = aTag.replace(/}/g, '"');
var input = document.getElementById(input_id);
input.focus();
if(typeof document.selection != 'undefined') {
var range = document.selection.createRange();
var insText = range.text;
range.text = aTag + insText + eTag;
range = document.selection.createRange();
if (insText.length == 0) {
range.move('character', -eTag.length);
} else {
range.moveStart('character', aTag.length + insText.length + eTag.length);
}
range.select();
}
else if(typeof input.selectionStart != 'undefined') {
var start = input.selectionStart;
var end = input.selectionEnd;
var insText = input.value.substring(start, end);
input.value = input.value.substr(0, start) + aTag + insText + eTag + input.value.substr(end);
var pos;
if (insText.length == 0) {
pos = start + aTag.length;
} else {
pos = start + aTag.length + insText.length + eTag.length;
}
input.selectionStart = pos;
input.selectionEnd = pos;
}
else {
var pos;
var re = new RegExp('^[0-9]{0,3}$');
while(!re.test(pos)) {
pos = prompt("Einfügen an Position (0.." + input.value.length + "):", "0");
}
if(pos > input.value.length) {
pos = input.value.length;
}
var insText = prompt("Bitte geben Sie den zu formatierenden Text ein:");
input.value = input.value.substr(0, pos) + aTag + insText + eTag + input.value.substr(pos);
}
}